1 namespace gui::controls;
5 public class Label : CommonControl
7 class_property(icon) = "<:ecere>controls/label.png";
15 property Window labeledWindow
17 property_category "Behavior"
23 stopwatching(window, text);
30 SetInitSize(initSize);
35 text { SetInitSize(initSize); }
36 disabled { Update(null); }
41 get { return window; }
44 property bool isGroupBox
46 property_category "Appearance"
52 get { return isGroupBox; }
59 if(window && (window == master || window == parent))
61 stopwatching(window, text);
70 stopwatching(window, text);
75 bool OnResizing(int *w, int *h)
79 Window labeledWindow = text ? this : window;
80 char * string = (labeledWindow && labeledWindow.text) ? labeledWindow.text : " ";
82 int width = 0, height = 0;
84 display.FontExtent(fontObject, string, strlen(string), &width, &height);
85 if(labeledWindow && labeledWindow.text)
94 bool OnLeftButtonDown(int x, int y, Modifiers mods)
96 if(window && window.visible && window.created)
101 void OnRedraw(Surface surface)
103 Window labeledWindow = text ? this : window;
108 surface.Bevel(true, 1,7, clientSize.w - 2, clientSize.h - 8);
109 surface.Bevel(false, 0,6, clientSize.w, clientSize.h - 6);
110 if(parent.background)
112 surface.TextOpacity(true);
113 surface.SetBackground(parent.background);
118 labeledWindow.WriteCaption(surface, offset, 0);
121 watch(font) { SetInitSize(initSize); };
122 watch(text) { SetInitSize(initSize); };