summaryrefslogtreecommitdiff
path: root/FL
diff options
context:
space:
mode:
authorMatthias Melcher <fltk@matthiasm.com>2010-04-07 23:17:33 +0000
committerMatthias Melcher <fltk@matthiasm.com>2010-04-07 23:17:33 +0000
commitf899c3897d62bd4f3c2d3bcaaf1ac5447ca8d158 (patch)
tree98d2c3bbfabae8ba92f3f31c825b4de700b391a1 /FL
parent0fe65e94c98cee0baf9df8d60bef0137f42fdb92 (diff)
Added new flags for label alignment: FL_LEFT_TOP, FL_RIGHT_TOP, FL_LEFT_BOTTOM, and FL_RIGHT_BOTTOM align outside labels first to the side, then to the top or botton, filling a gap in possible alignment. Also FL_ALIGN_TEXT_NEXT_TO_IMAGE and FL_ALIGN_IMAGE_NEXT_TO_TEXT which do just that, and finally FL_ALIGN_IMAGE_BACKDROP which renders the image in the background and draws the label on top.
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@7469 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
Diffstat (limited to 'FL')
-rw-r--r--FL/Enumerations.H36
-rw-r--r--FL/Fl_Widget.H3
2 files changed, 35 insertions, 4 deletions
diff --git a/FL/Enumerations.H b/FL/Enumerations.H
index e3e53eb36..b2e5aa367 100644
--- a/FL/Enumerations.H
+++ b/FL/Enumerations.H
@@ -618,6 +618,27 @@ extern Fl_Labeltype FL_EXPORT fl_define_FL_EMBOSSED_LABEL();
* inside the widget.
*
* Flags can be or'd to achieve a combination of alignments.
+ *
+ * Outside alignments:
+ * \code
+ * TOP_LEFT TOP TOP_RIGHT
+ * LEFT_TOP+---------------------------------+RIGHT_TOP
+ * | |
+ * LEFT| |RIGHT
+ * | |
+ * LEFT_BOTTOM+---------------------------------+RIGHT_BOTTOM
+ * BOTTOM_RIGHT BOTTOM BOTTOM_LEFT
+ *
+ * Inside alignments:
+ * \code
+ * +---------------------------------+
+ * |TOP_LEFT TOP TOP_RIGHT|
+ * | |
+ * |LEFT RIGHT|
+ * | |
+ * |BOTTOM_RIGHT BOTTOM BOTTOM_LEFT|
+ * +---------------------------------+
+ * \endcode
* \see #FL_ALIGN_CENTER, etc.
*/
typedef unsigned Fl_Align;
@@ -644,17 +665,24 @@ const Fl_Align FL_ALIGN_IMAGE_OVER_TEXT = (Fl_Align)0;
const Fl_Align FL_ALIGN_CLIP = (Fl_Align)64;
/** Wrap text that does not fit the width of the widget. */
const Fl_Align FL_ALIGN_WRAP = (Fl_Align)128;
+ /** If the label contains an image, draw the text to the left of the image. */
+const Fl_Align FL_ALIGN_TEXT_NEXT_TO_IMAGE = (Fl_Align)0x0100;
+ /** If the label contains an image, draw the text to the right of the image. */
+const Fl_Align FL_ALIGN_IMAGE_NEXT_TO_TEXT = (Fl_Align)0x0110;
+/** If the label contains an image, draw the image or deimage in the backgroup. */
+const Fl_Align FL_ALIGN_IMAGE_BACKDROP = (Fl_Align)0x0200;
const Fl_Align FL_ALIGN_TOP_LEFT = FL_ALIGN_TOP | FL_ALIGN_LEFT;
const Fl_Align FL_ALIGN_TOP_RIGHT = FL_ALIGN_TOP | FL_ALIGN_RIGHT;
const Fl_Align FL_ALIGN_BOTTOM_LEFT = FL_ALIGN_BOTTOM | FL_ALIGN_LEFT;
const Fl_Align FL_ALIGN_BOTTOM_RIGHT = FL_ALIGN_BOTTOM | FL_ALIGN_RIGHT;
-const Fl_Align FL_ALIGN_LEFT_TOP = FL_ALIGN_TOP_LEFT;
-const Fl_Align FL_ALIGN_RIGHT_TOP = FL_ALIGN_TOP_RIGHT;
-const Fl_Align FL_ALIGN_LEFT_BOTTOM = FL_ALIGN_BOTTOM_LEFT;
-const Fl_Align FL_ALIGN_RIGHT_BOTTOM = FL_ALIGN_BOTTOM_RIGHT;
+const Fl_Align FL_ALIGN_LEFT_TOP = 0x0007; // magic value
+const Fl_Align FL_ALIGN_RIGHT_TOP = 0x000b; // magic value
+const Fl_Align FL_ALIGN_LEFT_BOTTOM = 0x000d; // magic value
+const Fl_Align FL_ALIGN_RIGHT_BOTTOM = 0x000e; // magic value
const Fl_Align FL_ALIGN_NOWRAP = (Fl_Align)0; // for back compatability
/*@}*/
+
/** \name Font Numbers */
/*@{*/
/** A font number is an index into the internal font table.
diff --git a/FL/Fl_Widget.H b/FL/Fl_Widget.H
index a3a2d6ad6..3e61c7534 100644
--- a/FL/Fl_Widget.H
+++ b/FL/Fl_Widget.H
@@ -170,6 +170,7 @@ protected:
void draw_box() const;
void draw_box(Fl_Boxtype t, Fl_Color c) const;
void draw_box(Fl_Boxtype t, int x,int y,int w,int h, Fl_Color c) const;
+ void draw_backdrop() const;
/** draws a focus rectangle around the widget */
void draw_focus() {draw_focus(box(),x(),y(),w(),h());}
void draw_focus(Fl_Boxtype t, int x,int y,int w,int h) const;
@@ -497,6 +498,7 @@ public:
\return the current image
*/
Fl_Image* image() {return label_.image;}
+ const Fl_Image* image() const {return label_.image;}
/** Sets the image to use as part of the widget label.
This image is used when drawing the widget in the active state.
@@ -515,6 +517,7 @@ public:
\return the current image for the deactivated widget
*/
Fl_Image* deimage() {return label_.deimage;}
+ const Fl_Image* deimage() const {return label_.deimage;}
/** Sets the image to use as part of the widget label.
This image is used when drawing the widget in the inactive state.