ecere/gui/DataBox: (#849) Default size for SavingDataBox
authorJerome St-Louis <jerome@ecere.com>
Thu, 8 Aug 2013 00:00:51 +0000 (20:00 -0400)
committerJerome St-Louis <jerome@ecere.com>
Thu, 8 Aug 2013 00:00:51 +0000 (20:00 -0400)
- Nicer for dragging it from the toolbox

ecere/src/gui/controls/DataBox.ec

index 91f46d3..b422867 100644 (file)
@@ -232,4 +232,18 @@ public class SavingDataBox : DataBox
       }
       return DataBox::OnKeyDown(key, ch);
    }
+
+   bool OnResizing(int * w, int * h)
+   {
+      if(!*w || !*h)
+      {
+         int spaceH;
+         display.FontExtent(fontObject, " ", 1, null, &spaceH);
+         if(!*h)
+            *h = spaceH + 2;
+         if(!*w)
+            *w = spaceH * 80 / 14;
+      }
+      return true;
+   }
 }