src/widget/widget.h
branchcpp_gui
changeset 6286 6e8eec87fa9d
parent 6283 7072ee68c676
child 6287 e59240e63a90
--- a/src/widget/widget.h	Sun Mar 04 04:25:36 2007 +0000
+++ b/src/widget/widget.h	Sun Mar 04 12:50:21 2007 +0000
@@ -22,6 +22,7 @@
 	FR_BORDERONLY   = 0x10,  ///< Draw border only, no background
 	FR_LOWERED      = 0x20,  ///< If set the frame is lowered and the background color brighter (ie. buttons when pressed)
 	FR_DARKENED     = 0x40,  ///< If set the background is darker, allows for lowered frames with normal background color when used with FR_LOWERED (ie. dropdown boxes)
+	FR_BG_ONLY      = 0x80,  ///< If set only the background is drawn without any frame (labels and such)
 };
 
 DECLARE_ENUM_AS_BIT_SET(FrameFlags);
@@ -45,6 +46,7 @@
 	FF_NO_STICKY_BOX       = (1 <<  2),
 	FF_NO_RESIZE_BOX       = (1 <<  3),
 	FF_UNMOVABLE           = (1 <<  4),
+	FF_TRANSPARENT         = (1 <<  5),
 };
 
 DECLARE_ENUM_AS_BIT_SET(FeatureFlags);
@@ -114,6 +116,9 @@
 	void SetSize(const Point16 &pt);
 	void SetRect(const Rect16 &rect);
 
+	byte GetColor() const;
+	void SetColor(byte val);
+
 	void SetAnchors(Anchors a);
 
 	WidgetId GetId() const;
@@ -218,6 +223,40 @@
 	/*virtual*/ void OnResize(EvtResize &ev);
 };
 
+struct Label : public Widget {
+	typedef Widget super;
+
+protected:
+	StringID m_text;
+
+public:
+	Label()
+		: Widget()
+	{}
+
+	//Label(CompositeWidget *container, WidgetId id, FeatureFlags feature_flags, const Rect16 &rect, StringID text)
+	//	: Widget(container, id, feature_flags, container->GetColor(), rect, 0x0)
+	//	, m_text(text)
+	//{}
+
+	//Label(CompositeWidget *container, WidgetId id, FeatureFlags feature_flags, const Rect16 &rect, StringID text, StringID tooltip)
+	//	: Widget(container, id, feature_flags, container->GetColor(), rect, tooltip)
+	//	, m_text(text)
+	//{}
+
+	Label(CompositeWidget *container, WidgetId id, FeatureFlags feature_flags, const Rect16 &rect, StringID text, StringID tooltip = 0, int color = COLOUR_NONE)
+		: Widget(container, id, feature_flags, (byte)color, rect, tooltip)
+		, m_text(text)
+	{
+		/* make the label transparent (no background) if color not provided */
+		if (color == COLOUR_NONE) m_feature_flags |= FF_TRANSPARENT;
+	}
+
+	/*virtual*/ void DrawBackground(EvtPaint &ev);
+
+	/*virtual*/ void OnPaint(EvtPaint &ev);
+};
+
 struct Button : public Widget {
 	typedef Widget super;
 
@@ -352,17 +391,6 @@
 
 };
 
-
-
-
-
-
-
-
-
-
-
 }; // namespace gui
 
-
 #endif /* WIDGET_H */