Mercurial > dwindows
diff 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 |
line wrap: on
line diff
--- a/gtk/dw.c Sun Dec 04 19:13:10 2011 +0000 +++ b/gtk/dw.c Sun Dec 04 20:11:38 2011 +0000 @@ -10152,6 +10152,27 @@ } /* + * Gets the size the system thinks the widget should be. + * Parameters: + * handle: Window handle of the item to be back. + * width: Width in pixels of the item or NULL if not needed. + * height: Height in pixels of the item or NULL if not needed. + */ +void API dw_window_get_preferred_size(HWND handle, int *width, int *height) +{ + GtkRequisition req; + int _locked_by_me = FALSE; + + DW_MUTEX_LOCK; + gtk_widget_get_requisition(handle, &req); + if(width) + *width = req.width; + if(height) + *height = req.height; + DW_MUTEX_UNLOCK; +} + +/* * Returns the width of the screen. */ int dw_screen_width(void)