Mercurial > dwindows
comparison os2/dw.c @ 1498:f8b4d6075cac
Added auto-size support during dw_window_set_pos() on OS/2, Mac and Windows.
Since dw_window_set_pos() can have unexpected results on unsized windows... if a window is unsized attempt to auto-size at that point. Auto-sizing during dw_window_set_pos() will cause auto-sizing not to happen during dw_window_show() so make sure it is completely packed before setting the position.
author | bsmith@81767d24-ef19-dc11-ae90-00e081727c95 |
---|---|
date | Sun, 25 Dec 2011 13:56:30 +0000 |
parents | 3b4dc98d753b |
children | c6ab88dcf016 |
comparison
equal
deleted
inserted
replaced
1497:99a53823079f | 1498:f8b4d6075cac |
---|---|
7082 * y: Y location from the bottom left. | 7082 * y: Y location from the bottom left. |
7083 */ | 7083 */ |
7084 void API dw_window_set_pos(HWND handle, LONG x, LONG y) | 7084 void API dw_window_set_pos(HWND handle, LONG x, LONG y) |
7085 { | 7085 { |
7086 unsigned long width, height; | 7086 unsigned long width, height; |
7087 | 7087 |
7088 dw_window_get_pos_size(handle, NULL, NULL, &width, &height); | 7088 dw_window_get_pos_size(handle, NULL, NULL, &width, &height); |
7089 /* Can't position an unsized window, so attempt to auto-size */ | |
7090 if(width == 0 || height == 0) | |
7091 { | |
7092 dw_window_set_size(handle, 0, 0); | |
7093 dw_window_get_pos_size(handle, NULL, NULL, &width, &height); | |
7094 } | |
7089 _handle_gravity(handle, &x, &y, width, height); | 7095 _handle_gravity(handle, &x, &y, width, height); |
7090 WinSetWindowPos(handle, NULLHANDLE, x, y, 0, 0, SWP_MOVE); | 7096 WinSetWindowPos(handle, NULLHANDLE, x, y, 0, 0, SWP_MOVE); |
7091 } | 7097 } |
7092 | 7098 |
7093 /* | 7099 /* |