Mercurial > dwindows
comparison os2/dw.c @ 1473:4468ac1db710
Fixes building on OS/2 and reverted a change where I tried to not
show the window while sizing on OS/2, but that seems to break the
sizing code... will revisit this soon.
author | bsmith@81767d24-ef19-dc11-ae90-00e081727c95 |
---|---|
date | Tue, 20 Dec 2011 16:18:46 +0000 |
parents | 1794caee0758 |
children | 73f2ad84d4ec |
comparison
equal
deleted
inserted
replaced
1472:1794caee0758 | 1473:4468ac1db710 |
---|---|
6905 /* Attempt to auto-size */ | 6905 /* Attempt to auto-size */ |
6906 if ( width < 1 || height < 1 ) | 6906 if ( width < 1 || height < 1 ) |
6907 _get_window_for_size(handle, &width, &height); | 6907 _get_window_for_size(handle, &width, &height); |
6908 | 6908 |
6909 /* Finally set the size */ | 6909 /* Finally set the size */ |
6910 WinSetWindowPos(handle, NULLHANDLE, 0, 0, width, height, SWP_SIZE); | 6910 WinSetWindowPos(handle, NULLHANDLE, 0, 0, width, height, SWP_SHOW | SWP_SIZE); |
6911 } | 6911 } |
6912 | 6912 |
6913 /* | 6913 /* |
6914 * Gets the size the system thinks the widget should be. | 6914 * Gets the size the system thinks the widget should be. |
6915 * Parameters: | 6915 * Parameters: |
6945 long colors; | 6945 long colors; |
6946 | 6946 |
6947 DevQueryCaps(hdc, CAPS_COLOR_BITCOUNT, 1, &colors); | 6947 DevQueryCaps(hdc, CAPS_COLOR_BITCOUNT, 1, &colors); |
6948 DevCloseDC(hdc); | 6948 DevCloseDC(hdc); |
6949 return colors; | 6949 return colors; |
6950 } | |
6951 | |
6952 /* | |
6953 * Sets the gravity of a given window (widget). | |
6954 * Gravity controls which corner of the screen and window the position is relative to. | |
6955 * Parameters: | |
6956 * handle: Window (widget) handle. | |
6957 * horz: DW_GRAV_LEFT (default), DW_GRAV_RIGHT or DW_GRAV_CENTER. | |
6958 * vert: DW_GRAV_TOP (default), DW_GRAV_BOTTOM or DW_GRAV_CENTER. | |
6959 */ | |
6960 void API dw_window_set_gravity(HWND handle, int horz, int vert) | |
6961 { | |
6962 dw_window_set_data(handle, "_dw_grav_horz", DW_INT_TO_POINTER(horz)); | |
6963 dw_window_set_data(handle, "_dw_grav_vert", DW_INT_TO_POINTER(vert)); | |
6950 } | 6964 } |
6951 | 6965 |
6952 /* Convert the coordinates based on gravity */ | 6966 /* Convert the coordinates based on gravity */ |
6953 void _handle_gravity(HWND handle, long *x, long *y, unsigned long width, unsigned long height) | 6967 void _handle_gravity(HWND handle, long *x, long *y, unsigned long width, unsigned long height) |
6954 { | 6968 { |
7009 if ( width < 1 || height < 1 ) | 7023 if ( width < 1 || height < 1 ) |
7010 _get_window_for_size(handle, &width, &height); | 7024 _get_window_for_size(handle, &width, &height); |
7011 | 7025 |
7012 _handle_gravity(handle, &x, &y, width, height); | 7026 _handle_gravity(handle, &x, &y, width, height); |
7013 /* Finally set the size */ | 7027 /* Finally set the size */ |
7014 WinSetWindowPos(handle, NULLHANDLE, x, y, width, height, SWP_MOVE | SWP_SIZE); | 7028 WinSetWindowPos(handle, NULLHANDLE, x, y, width, height, SWP_SHOW | SWP_MOVE | SWP_SIZE); |
7015 } | 7029 } |
7016 | 7030 |
7017 /* | 7031 /* |
7018 * Gets the position and size of a given window (widget). | 7032 * Gets the position and size of a given window (widget). |
7019 * Parameters: | 7033 * Parameters: |