changeset 1408:96460bd4c679

Fixes for groupboxes with no text (or very small text) on Windows not displaying properly.
author bsmith@81767d24-ef19-dc11-ae90-00e081727c95
date Thu, 01 Dec 2011 08:51:05 +0000
parents 2f10480d2c8a
children 93eb987c05cf
files win/dw.c
diffstat 1 files changed, 10 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/win/dw.c	Wed Nov 30 06:00:29 2011 +0000
+++ b/win/dw.c	Thu Dec 01 08:51:05 2011 +0000
@@ -1125,19 +1125,26 @@
    {
       char *text = dw_window_get_text(thisbox->grouphwnd);
 
-      thisbox->grouppady = 0;
+      thisbox->grouppady = 9;
 
       if(text)
       {
-         dw_font_text_extents_get(thisbox->grouphwnd, 0, text, NULL, &thisbox->grouppady);
+         if(*text)
+            dw_font_text_extents_get(thisbox->grouphwnd, 0, text, NULL, &thisbox->grouppady);
          dw_free(text);
       }
-
+      /* If the string height is less than 9...
+       * set it to 9 anyway since that is the minimum.
+       */
+      if(thisbox->grouppady < 9)
+         thisbox->grouppady = 9;
+         
       if(thisbox->grouppady)
          thisbox->grouppady += 3;
       else
          thisbox->grouppady = 6;
 
+      dw_debug("grouppady %d\n", thisbox->grouppady);
       thisbox->grouppadx = 6;
 
       (*usedx) += thisbox->grouppadx;