comparison gtk/dw.c @ 1429:fbaec6e5df63

Added dw_window_get_preferred_size() which attempts to determine the size the system wants for the widget. This is useful when creating nice looking layouts.
author bsmith@81767d24-ef19-dc11-ae90-00e081727c95
date Sun, 04 Dec 2011 20:11:38 +0000
parents 1bb1865fed9d
children 95ca625b8ffc
comparison
equal deleted inserted replaced
1428:7826031d48ce 1429:fbaec6e5df63
10150 gtk_widget_set_usize(handle, width, height); 10150 gtk_widget_set_usize(handle, width, height);
10151 DW_MUTEX_UNLOCK; 10151 DW_MUTEX_UNLOCK;
10152 } 10152 }
10153 10153
10154 /* 10154 /*
10155 * Gets the size the system thinks the widget should be.
10156 * Parameters:
10157 * handle: Window handle of the item to be back.
10158 * width: Width in pixels of the item or NULL if not needed.
10159 * height: Height in pixels of the item or NULL if not needed.
10160 */
10161 void API dw_window_get_preferred_size(HWND handle, int *width, int *height)
10162 {
10163 GtkRequisition req;
10164 int _locked_by_me = FALSE;
10165
10166 DW_MUTEX_LOCK;
10167 gtk_widget_get_requisition(handle, &req);
10168 if(width)
10169 *width = req.width;
10170 if(height)
10171 *height = req.height;
10172 DW_MUTEX_UNLOCK;
10173 }
10174
10175 /*
10155 * Returns the width of the screen. 10176 * Returns the width of the screen.
10156 */ 10177 */
10157 int dw_screen_width(void) 10178 int dw_screen_width(void)
10158 { 10179 {
10159 int retval; 10180 int retval;