diff gtk3/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 dfd9f177c34c
children 95ca625b8ffc
line wrap: on
line diff
--- a/gtk3/dw.c	Sun Dec 04 19:13:10 2011 +0000
+++ b/gtk3/dw.c	Sun Dec 04 20:11:38 2011 +0000
@@ -8558,6 +8558,25 @@
 }
 
 /*
+ * 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)
+{
+   int _locked_by_me = FALSE;
+
+   DW_MUTEX_LOCK;
+   if(width)
+      gtk_widget_get_preferred_width(handle, NULL, width);
+   if(height)
+      gtk_widget_get_preferred_height(handle, NULL, height);
+   DW_MUTEX_UNLOCK;
+}
+
+/*
  * Returns the width of the screen.
  */
 int dw_screen_width(void)