diff options
| author | Matthias Melcher <fltk@matthiasm.com> | 2010-04-09 22:18:05 +0000 |
|---|---|---|
| committer | Matthias Melcher <fltk@matthiasm.com> | 2010-04-09 22:18:05 +0000 |
| commit | 927fd351655320ed90ceecedaf9ea58656594650 (patch) | |
| tree | a9698d39716b54a81c88e5e2aa10656c062501ae | |
| parent | 08e71113e9b071be540c0ecb03287e647c0bc0c5 (diff) | |
Added new label alignments for image and text to Fluid.
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@7476 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
| -rw-r--r-- | FL/Enumerations.H | 12 | ||||
| -rw-r--r-- | fluid/Fl_Widget_Type.cxx | 31 | ||||
| -rw-r--r-- | fluid/widget_panel.cxx | 96 | ||||
| -rw-r--r-- | fluid/widget_panel.fl | 51 | ||||
| -rw-r--r-- | fluid/widget_panel.h | 3 | ||||
| -rw-r--r-- | src/Fl_Button.cxx | 1 | ||||
| -rw-r--r-- | src/fl_draw.cxx | 2 |
7 files changed, 133 insertions, 63 deletions
diff --git a/FL/Enumerations.H b/FL/Enumerations.H index b2e5aa367..4a0a8eef3 100644 --- a/FL/Enumerations.H +++ b/FL/Enumerations.H @@ -658,17 +658,17 @@ const Fl_Align FL_ALIGN_RIGHT = (Fl_Align)8; /** Draw the label inside of the widget. */ const Fl_Align FL_ALIGN_INSIDE = (Fl_Align)16; /** If the label contains an image, draw the text on top of the image. */ -const Fl_Align FL_ALIGN_TEXT_OVER_IMAGE = (Fl_Align)32; +const Fl_Align FL_ALIGN_TEXT_OVER_IMAGE = (Fl_Align)0x0020; /** If the label contains an image, draw the text below the image. */ -const Fl_Align FL_ALIGN_IMAGE_OVER_TEXT = (Fl_Align)0; +const Fl_Align FL_ALIGN_IMAGE_OVER_TEXT = (Fl_Align)0x0000; /** All parts of the label that are lager than the widget will not be drawn . */ 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; +const Fl_Align FL_ALIGN_IMAGE_NEXT_TO_TEXT = (Fl_Align)0x0100; + /** 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)0x0120; /** 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; @@ -680,6 +680,8 @@ 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 +const Fl_Align FL_ALIGN_POSITION_MASK = 0x000f; // left, right, top, bottom +const Fl_Align FL_ALIGN_IMAGE_MASK = 0x0320; // l/r, t/b, backdrop /*@}*/ diff --git a/fluid/Fl_Widget_Type.cxx b/fluid/Fl_Widget_Type.cxx index dc6215dec..0fde0a682 100644 --- a/fluid/Fl_Widget_Type.cxx +++ b/fluid/Fl_Widget_Type.cxx @@ -1170,6 +1170,37 @@ void align_cb(Fl_Button* i, void *v) { } } +void align_text_image_cb(Fl_Menu_Button* i, void *v) { + if (v == LOAD) { + if (current_widget->is_menu_item()) {i->deactivate(); return;} else i->activate(); + Fl_Menu_Item *mi = (Fl_Menu_Item*)i->menu(); + Fl_Align b = current_widget->o->align() & FL_ALIGN_IMAGE_MASK; + for (;mi->text;mi++) { + if (mi->argument()==b) + mi->set(); + else + mi->clear(); + } + } else { + const Fl_Menu_Item *mi = i->mvalue(); + Fl_Align b = Fl_Align(long(mi->user_data())); + int mod = 0; + for (Fl_Type *o = Fl_Type::first; o; o = o->next) { + if (o->selected && o->is_widget()) { + Fl_Widget_Type* q = (Fl_Widget_Type*)o; + Fl_Align x = q->o->align(); + Fl_Align y = (x & ~FL_ALIGN_IMAGE_MASK) | b; + if (x != y) { + q->o->align(y); + q->redraw(); + mod = 1; + } + } + } + if (mod) set_modflag(1); + } +} + //////////////////////////////////////////////////////////////// void callback_cb(CodeEditor* i, void *v) { diff --git a/fluid/widget_panel.cxx b/fluid/widget_panel.cxx index 5709a0666..b98439825 100644 --- a/fluid/widget_panel.cxx +++ b/fluid/widget_panel.cxx @@ -33,6 +33,15 @@ static void cb_(Fl_Tabs* o, void* v) { propagate_load((Fl_Group *)o,v); } +Fl_Menu_Item menu_Text[] = { + {"image over text", 0, 0, (void*)(FL_ALIGN_IMAGE_OVER_TEXT), 8, FL_NORMAL_LABEL, 0, 11, 0}, + {"text over image", 0, 0, (void*)(FL_ALIGN_TEXT_OVER_IMAGE), 8, FL_NORMAL_LABEL, 0, 11, 0}, + {"text next to image", 0, 0, (void*)(FL_ALIGN_TEXT_NEXT_TO_IMAGE), 8, FL_NORMAL_LABEL, 0, 11, 0}, + {"image next to text", 0, 0, (void*)(FL_ALIGN_IMAGE_NEXT_TO_TEXT), 8, FL_NORMAL_LABEL, 0, 11, 0}, + {"image is backdrop", 0, 0, (void*)(FL_ALIGN_IMAGE_BACKDROP), 8, FL_NORMAL_LABEL, 0, 11, 0}, + {0,0,0,0,0,0,0,0,0} +}; + Fl_Value_Input *widget_x_input=(Fl_Value_Input *)0; Fl_Value_Input *widget_y_input=(Fl_Value_Input *)0; @@ -63,7 +72,7 @@ Fl_Double_Window* make_widget_panel() { { Fl_Double_Window* o = new Fl_Double_Window(420, 360); w = o; o->labelsize(11); - o->align(FL_ALIGN_CLIP|FL_ALIGN_INSIDE); + o->align(Fl_Align(FL_ALIGN_CLIP|FL_ALIGN_INSIDE)); o->hotspot(o); { Fl_Tabs* o = new Fl_Tabs(10, 10, 400, 310); o->selection_color((Fl_Color)12); @@ -75,12 +84,11 @@ Fl_Double_Window* make_widget_panel() { o->labelsize(11); o->callback((Fl_Callback*)propagate_load); o->when(FL_WHEN_NEVER); - o->hide(); { Fl_Group* o = new Fl_Group(95, 40, 309, 20, "Label:"); o->labelfont(1); o->labelsize(11); o->callback((Fl_Callback*)propagate_load); - o->align(FL_ALIGN_LEFT); + o->align(Fl_Align(FL_ALIGN_LEFT)); { Fl_Input* o = new Fl_Input(95, 40, 190, 20); o->tooltip("The label text for the widget.\nUse Ctrl-J for newlines."); o->labelfont(1); @@ -106,7 +114,7 @@ Fl_Double_Window* make_widget_panel() { o->labelfont(1); o->labelsize(11); o->callback((Fl_Callback*)propagate_load); - o->align(FL_ALIGN_LEFT); + o->align(Fl_Align(FL_ALIGN_LEFT)); { Fl_Input* o = new Fl_Input(95, 65, 240, 20); o->tooltip("The active image for the widget."); o->labelfont(1); @@ -126,7 +134,7 @@ Fl_Double_Window* make_widget_panel() { o->labelfont(1); o->labelsize(11); o->callback((Fl_Callback*)propagate_load); - o->align(FL_ALIGN_LEFT); + o->align(Fl_Align(FL_ALIGN_LEFT)); { Fl_Input* o = new Fl_Input(95, 90, 240, 20); o->tooltip("The inactive image for the widget."); o->labelfont(1); @@ -146,29 +154,28 @@ Fl_Double_Window* make_widget_panel() { o->labelfont(1); o->labelsize(11); o->callback((Fl_Callback*)propagate_load); - o->align(FL_ALIGN_LEFT); - { Fl_Button* o = new Fl_Button(95, 115, 45, 20, "Clip"); + o->align(Fl_Align(FL_ALIGN_LEFT)); + { Fl_Button* o = new Fl_Button(95, 115, 40, 20, "Clip"); o->tooltip("Clip the label to the inside of the widget."); o->type(1); o->selection_color(FL_INACTIVE_COLOR); o->labelsize(11); o->callback((Fl_Callback*)align_cb, (void*)(FL_ALIGN_CLIP)); - o->align(FL_ALIGN_CENTER|FL_ALIGN_INSIDE); + o->align(Fl_Align(FL_ALIGN_CENTER|FL_ALIGN_INSIDE)); } // Fl_Button* o - { Fl_Button* o = new Fl_Button(145, 115, 50, 20, "Wrap"); + { Fl_Button* o = new Fl_Button(140, 115, 40, 20, "Wrap"); o->tooltip("Wrap the label text."); o->type(1); o->selection_color(FL_INACTIVE_COLOR); o->labelsize(11); o->callback((Fl_Callback*)align_cb, (void*)(FL_ALIGN_WRAP)); } // Fl_Button* o - { Fl_Button* o = new Fl_Button(200, 115, 65, 20, "Text/Image"); - o->tooltip("Show the label text over the image."); - o->type(1); - o->selection_color(FL_INACTIVE_COLOR); + { Fl_Menu_Button* o = new Fl_Menu_Button(185, 115, 80, 20, "Text/Image"); o->labelsize(11); - o->callback((Fl_Callback*)align_cb, (void*)(FL_ALIGN_TEXT_OVER_IMAGE)); - } // Fl_Button* o + o->callback((Fl_Callback*)align_text_image_cb); + o->align(Fl_Align(FL_ALIGN_LEFT|FL_ALIGN_INSIDE)); + o->menu(menu_Text); + } // Fl_Menu_Button* o { Fl_Button* o = new Fl_Button(270, 115, 20, 20, "@-1<-"); o->tooltip("Left-align the label."); o->type(1); @@ -219,7 +226,7 @@ Fl_Double_Window* make_widget_panel() { o->labelfont(1); o->labelsize(11); o->callback((Fl_Callback*)propagate_load); - o->align(FL_ALIGN_LEFT); + o->align(Fl_Align(FL_ALIGN_LEFT)); { widget_x_input = new Fl_Value_Input(95, 150, 55, 20, "X:"); widget_x_input->tooltip("The X position of the widget."); widget_x_input->labelsize(11); @@ -227,7 +234,7 @@ Fl_Double_Window* make_widget_panel() { widget_x_input->step(1); widget_x_input->textsize(11); widget_x_input->callback((Fl_Callback*)x_cb); - widget_x_input->align(FL_ALIGN_TOP_LEFT); + widget_x_input->align(Fl_Align(FL_ALIGN_TOP_LEFT)); } // Fl_Value_Input* widget_x_input { widget_y_input = new Fl_Value_Input(155, 150, 55, 20, "Y:"); widget_y_input->tooltip("The Y position of the widget."); @@ -236,7 +243,7 @@ Fl_Double_Window* make_widget_panel() { widget_y_input->step(1); widget_y_input->textsize(11); widget_y_input->callback((Fl_Callback*)y_cb); - widget_y_input->align(FL_ALIGN_TOP_LEFT); + widget_y_input->align(Fl_Align(FL_ALIGN_TOP_LEFT)); } // Fl_Value_Input* widget_y_input { widget_w_input = new Fl_Value_Input(215, 150, 55, 20, "Width:"); widget_w_input->tooltip("The width of the widget."); @@ -245,7 +252,7 @@ Fl_Double_Window* make_widget_panel() { widget_w_input->step(1); widget_w_input->textsize(11); widget_w_input->callback((Fl_Callback*)w_cb); - widget_w_input->align(FL_ALIGN_TOP_LEFT); + widget_w_input->align(Fl_Align(FL_ALIGN_TOP_LEFT)); } // Fl_Value_Input* widget_w_input { widget_h_input = new Fl_Value_Input(275, 150, 55, 20, "Height:"); widget_h_input->tooltip("The height of the widget."); @@ -254,7 +261,7 @@ Fl_Double_Window* make_widget_panel() { widget_h_input->step(1); widget_h_input->textsize(11); widget_h_input->callback((Fl_Callback*)h_cb); - widget_h_input->align(FL_ALIGN_TOP_LEFT); + widget_h_input->align(Fl_Align(FL_ALIGN_TOP_LEFT)); } // Fl_Value_Input* widget_h_input { Fl_Light_Button* o = new Fl_Light_Button(335, 150, 55, 20, "Relative"); o->tooltip("If set, widgets inside a widget class of type Fl_Group are repositioned relat\ @@ -271,21 +278,21 @@ ive to the origin at construction time"); o->labelfont(1); o->labelsize(11); o->callback((Fl_Callback*)propagate_load); - o->align(FL_ALIGN_LEFT); + o->align(Fl_Align(FL_ALIGN_LEFT)); { Fl_Value_Input* o = new Fl_Value_Input(95, 185, 55, 20, "Size:"); o->tooltip("The size of the slider."); o->labelsize(11); o->step(0.010101); o->textsize(11); o->callback((Fl_Callback*)slider_size_cb); - o->align(FL_ALIGN_TOP_LEFT); + o->align(Fl_Align(FL_ALIGN_TOP_LEFT)); } // Fl_Value_Input* o { Fl_Value_Input* o = new Fl_Value_Input(155, 185, 55, 20, "Minimum:"); o->tooltip("The minimum value of the widget."); o->labelsize(11); o->textsize(11); o->callback((Fl_Callback*)min_cb); - o->align(FL_ALIGN_TOP_LEFT); + o->align(Fl_Align(FL_ALIGN_TOP_LEFT)); } // Fl_Value_Input* o { Fl_Value_Input* o = new Fl_Value_Input(215, 185, 55, 20, "Maximum:"); o->tooltip("The maximum value of the widget."); @@ -293,21 +300,21 @@ ive to the origin at construction time"); o->value(1); o->textsize(11); o->callback((Fl_Callback*)max_cb); - o->align(FL_ALIGN_TOP_LEFT); + o->align(Fl_Align(FL_ALIGN_TOP_LEFT)); } // Fl_Value_Input* o { Fl_Value_Input* o = new Fl_Value_Input(275, 185, 55, 20, "Step:"); o->tooltip("The resolution of the widget value."); o->labelsize(11); o->textsize(11); o->callback((Fl_Callback*)step_cb); - o->align(FL_ALIGN_TOP_LEFT); + o->align(Fl_Align(FL_ALIGN_TOP_LEFT)); } // Fl_Value_Input* o { Fl_Value_Input* o = new Fl_Value_Input(335, 185, 55, 20, "Value:"); o->tooltip("The current widget value."); o->labelsize(11); o->textsize(11); o->callback((Fl_Callback*)value_cb); - o->align(FL_ALIGN_TOP_LEFT); + o->align(Fl_Align(FL_ALIGN_TOP_LEFT)); } // Fl_Value_Input* o { Fl_Box* o = new Fl_Box(395, 185, 0, 20); Fl_Group::current()->resizable(o); @@ -318,7 +325,7 @@ ive to the origin at construction time"); o->labelfont(1); o->labelsize(11); o->callback((Fl_Callback*)propagate_load); - o->align(FL_ALIGN_LEFT); + o->align(Fl_Align(FL_ALIGN_LEFT)); o->hide(); { Fl_Value_Input* o = new Fl_Value_Input(95, 185, 55, 20, "Minimum Size:"); o->tooltip("The size of the slider."); @@ -327,7 +334,7 @@ ive to the origin at construction time"); o->step(1); o->textsize(11); o->callback((Fl_Callback*)min_w_cb); - o->align(FL_ALIGN_TOP_LEFT); + o->align(Fl_Align(FL_ALIGN_TOP_LEFT)); } // Fl_Value_Input* o { Fl_Value_Input* o = new Fl_Value_Input(155, 185, 55, 20); o->tooltip("The minimum value of the widget."); @@ -336,7 +343,7 @@ ive to the origin at construction time"); o->step(1); o->textsize(11); o->callback((Fl_Callback*)min_h_cb); - o->align(FL_ALIGN_TOP_LEFT); + o->align(Fl_Align(FL_ALIGN_TOP_LEFT)); } // Fl_Value_Input* o { Fl_Button* o = new Fl_Button(215, 185, 25, 20, "set"); o->labelsize(11); @@ -349,7 +356,7 @@ ive to the origin at construction time"); o->step(1); o->textsize(11); o->callback((Fl_Callback*)max_w_cb); - o->align(FL_ALIGN_TOP_LEFT); + o->align(Fl_Align(FL_ALIGN_TOP_LEFT)); } // Fl_Value_Input* o { Fl_Value_Input* o = new Fl_Value_Input(305, 185, 55, 20); o->tooltip("The resolution of the widget value."); @@ -358,7 +365,7 @@ ive to the origin at construction time"); o->step(1); o->textsize(11); o->callback((Fl_Callback*)max_h_cb); - o->align(FL_ALIGN_TOP_LEFT); + o->align(Fl_Align(FL_ALIGN_TOP_LEFT)); } // Fl_Value_Input* o { Fl_Button* o = new Fl_Button(365, 185, 25, 20, "set"); o->labelsize(11); @@ -379,14 +386,14 @@ ive to the origin at construction time"); o->labelsize(11); o->labelcolor(FL_FOREGROUND_COLOR); o->callback((Fl_Callback*)shortcut_in_cb); - o->align(FL_ALIGN_LEFT); + o->align(Fl_Align(FL_ALIGN_LEFT)); o->when(FL_WHEN_RELEASE); } // Shortcut_Button* o { Fl_Group* o = new Fl_Group(95, 235, 300, 20, "X Class:"); o->labelfont(1); o->labelsize(11); o->callback((Fl_Callback*)propagate_load); - o->align(FL_ALIGN_LEFT); + o->align(Fl_Align(FL_ALIGN_LEFT)); { Fl_Input* o = new Fl_Input(95, 235, 95, 20, ":"); o->tooltip("The X resource class."); o->labelfont(1); @@ -412,7 +419,7 @@ ive to the origin at construction time"); o->selection_color((Fl_Color)1); o->labelsize(11); o->callback((Fl_Callback*)non_modal_cb); - o->align(132|FL_ALIGN_INSIDE); + o->align(Fl_Align(132|FL_ALIGN_INSIDE)); } // Fl_Light_Button* o o->end(); } // Fl_Group* o @@ -420,7 +427,7 @@ ive to the origin at construction time"); o->labelfont(1); o->labelsize(11); o->callback((Fl_Callback*)propagate_load); - o->align(FL_ALIGN_LEFT); + o->align(Fl_Align(FL_ALIGN_LEFT)); { Fl_Light_Button* o = new Fl_Light_Button(95, 260, 60, 20, "Visible"); o->tooltip("Show the widget."); o->selection_color((Fl_Color)1); @@ -476,7 +483,7 @@ ive to the origin at construction time"); o->labelfont(1); o->labelsize(11); o->callback((Fl_Callback*)propagate_load); - o->align(FL_ALIGN_LEFT); + o->align(Fl_Align(FL_ALIGN_LEFT)); { Fl_Choice* o = new Fl_Choice(95, 40, 170, 20); o->tooltip("The style of the label text."); o->box(FL_THIN_UP_BOX); @@ -508,7 +515,7 @@ ive to the origin at construction time"); o->labelfont(1); o->labelsize(11); o->callback((Fl_Callback*)propagate_load); - o->align(FL_ALIGN_LEFT); + o->align(Fl_Align(FL_ALIGN_LEFT)); { Fl_Choice* o = new Fl_Choice(95, 65, 219, 20); o->tooltip("The \"up\" box of the widget."); o->box(FL_THIN_UP_BOX); @@ -531,7 +538,7 @@ ive to the origin at construction time"); o->labelfont(1); o->labelsize(11); o->callback((Fl_Callback*)propagate_load); - o->align(FL_ALIGN_LEFT); + o->align(Fl_Align(FL_ALIGN_LEFT)); { Fl_Choice* o = new Fl_Choice(95, 90, 219, 20); o->tooltip("The \"down\" box of the widget."); o->box(FL_THIN_UP_BOX); @@ -554,7 +561,7 @@ ive to the origin at construction time"); o->labelfont(1); o->labelsize(11); o->callback((Fl_Callback*)propagate_load); - o->align(FL_ALIGN_LEFT); + o->align(Fl_Align(FL_ALIGN_LEFT)); { Fl_Choice* o = new Fl_Choice(95, 115, 170, 20); o->tooltip("The value text style."); o->box(FL_DOWN_BOX); @@ -592,11 +599,12 @@ ive to the origin at construction time"); o->labelsize(11); o->callback((Fl_Callback*)propagate_load); o->when(FL_WHEN_NEVER); + o->hide(); { Fl_Group* o = new Fl_Group(95, 40, 310, 20, "Class:"); o->labelfont(1); o->labelsize(11); o->callback((Fl_Callback*)propagate_load); - o->align(FL_ALIGN_LEFT); + o->align(Fl_Align(FL_ALIGN_LEFT)); { Fl_Input* o = new Fl_Input(95, 40, 172, 20); o->tooltip("The widget subclass."); o->labelfont(1); @@ -620,7 +628,7 @@ ive to the origin at construction time"); o->labelfont(1); o->labelsize(11); o->callback((Fl_Callback*)propagate_load); - o->align(FL_ALIGN_LEFT); + o->align(Fl_Align(FL_ALIGN_LEFT)); { Fl_Input* o = new Fl_Input(95, 65, 235, 20); o->tooltip("The name of the widget."); o->labelfont(1); @@ -691,7 +699,7 @@ access the Widget pointer and \'v\' to access the user value."); o->textfont(4); o->textsize(11); o->callback((Fl_Callback*)callback_cb); - o->align(FL_ALIGN_LEFT); + o->align(Fl_Align(FL_ALIGN_LEFT)); o->when(FL_WHEN_RELEASE); Fl_Group::current()->resizable(o); } // CodeEditor* o @@ -699,7 +707,7 @@ access the Widget pointer and \'v\' to access the user value."); o->labelfont(1); o->labelsize(11); o->callback((Fl_Callback*)propagate_load); - o->align(FL_ALIGN_LEFT); + o->align(Fl_Align(FL_ALIGN_LEFT)); { Fl_Input* o = new Fl_Input(95, 270, 158, 20); o->tooltip("The user data to pass into the callback code."); o->labelfont(1); @@ -726,7 +734,7 @@ access the Widget pointer and \'v\' to access the user value."); o->labelfont(1); o->labelsize(11); o->callback((Fl_Callback*)propagate_load); - o->align(FL_ALIGN_LEFT); + o->align(Fl_Align(FL_ALIGN_LEFT)); { Fl_Input* o = new Fl_Input(95, 295, 158, 20); o->tooltip("The type of the user data."); o->labelfont(1); diff --git a/fluid/widget_panel.fl b/fluid/widget_panel.fl index d6df14e39..3480fe35f 100644 --- a/fluid/widget_panel.fl +++ b/fluid/widget_panel.fl @@ -1,5 +1,5 @@ # data file for the Fltk User Interface Designer (fluid) -version 1.0108 +version 1.0300 header_name {.h} code_name {.cxx} comment {// @@ -43,12 +43,12 @@ Function {make_widget_panel()} {open } { Fl_Group {} { label GUI - callback propagate_load - xywh {10 30 400 290} labelsize 11 when 0 hide resizable + callback propagate_load open + xywh {10 30 400 290} labelsize 11 when 0 resizable } { Fl_Group {} { label {Label:} - callback propagate_load + callback propagate_load open xywh {95 40 309 20} labelfont 1 labelsize 11 align 4 } { Fl_Input {} { @@ -95,26 +95,51 @@ Use Ctrl-J for newlines.} xywh {95 40 190 20} labelfont 1 labelsize 11 when 1 te } Fl_Group {} { label {Alignment:} - callback propagate_load + callback propagate_load open xywh {95 115 300 20} labelfont 1 labelsize 11 align 4 } { Fl_Button {} { label Clip user_data FL_ALIGN_CLIP callback align_cb - tooltip {Clip the label to the inside of the widget.} xywh {95 115 45 20} type Toggle selection_color 8 labelsize 11 align 16 + tooltip {Clip the label to the inside of the widget.} xywh {95 115 40 20} type Toggle selection_color 8 labelsize 11 align 16 } Fl_Button {} { label Wrap user_data FL_ALIGN_WRAP callback align_cb - tooltip {Wrap the label text.} xywh {145 115 50 20} type Toggle selection_color 8 labelsize 11 + tooltip {Wrap the label text.} xywh {140 115 40 20} type Toggle selection_color 8 labelsize 11 } - Fl_Button {} { + Fl_Menu_Button {} { label {Text/Image} - user_data FL_ALIGN_TEXT_OVER_IMAGE - callback align_cb - tooltip {Show the label text over the image.} xywh {200 115 65 20} type Toggle selection_color 8 labelsize 11 + callback align_text_image_cb open + xywh {185 115 80 20} labelsize 11 align 20 + } { + MenuItem {} { + label {image over text} + user_data FL_ALIGN_IMAGE_OVER_TEXT + xywh {10 10 100 20} type Radio labelsize 11 + } + MenuItem {} { + label {text over image} + user_data FL_ALIGN_TEXT_OVER_IMAGE selected + xywh {0 0 100 20} type Radio labelsize 11 + } + MenuItem {} { + label {text next to image} + user_data FL_ALIGN_TEXT_NEXT_TO_IMAGE + xywh {20 20 100 20} type Radio labelsize 11 + } + MenuItem {} { + label {image next to text} + user_data FL_ALIGN_IMAGE_NEXT_TO_TEXT + xywh {30 30 100 20} type Radio labelsize 11 + } + MenuItem {} { + label {image is backdrop} + user_data FL_ALIGN_IMAGE_BACKDROP + xywh {40 40 100 20} type Radio labelsize 11 + } } Fl_Button {} { label {@-1<-} @@ -415,7 +440,7 @@ Use Ctrl-J for newlines.} xywh {95 285 310 20} labelfont 1 labelsize 11 textsize Fl_Group {} { label {C++} callback propagate_load open - xywh {10 30 400 290} labelsize 11 when 0 + xywh {10 30 400 290} labelsize 11 when 0 hide } { Fl_Group {} { label {Class:} @@ -438,7 +463,7 @@ Use Ctrl-J for newlines.} xywh {95 285 310 20} labelfont 1 labelsize 11 textsize xywh {95 65 310 20} labelfont 1 labelsize 11 align 4 } { Fl_Input {} { - callback name_cb selected + callback name_cb tooltip {The name of the widget.} xywh {95 65 235 20} labelfont 1 labelsize 11 textsize 11 resizable } Fl_Choice {} { diff --git a/fluid/widget_panel.h b/fluid/widget_panel.h index 9bd121a4e..3c8dafb4c 100644 --- a/fluid/widget_panel.h +++ b/fluid/widget_panel.h @@ -45,6 +45,8 @@ extern void image_browse_cb(Fl_Button*, void*); extern void inactive_cb(Fl_Input*, void*); extern void inactive_browse_cb(Fl_Button*, void*); extern void align_cb(Fl_Button*, void*); +#include <FL/Fl_Menu_Button.H> +extern void align_text_image_cb(Fl_Menu_Button*, void*); #include <FL/Fl_Box.H> #include <FL/Fl_Value_Input.H> extern void x_cb(Fl_Value_Input*, void*); @@ -113,6 +115,7 @@ extern void cancel_cb(Fl_Button*, void*); extern void live_mode_cb(Fl_Button*, void*); extern Fl_Button *wLiveMode; Fl_Double_Window* make_widget_panel(); +extern Fl_Menu_Item menu_Text[]; extern Fl_Menu_Item menu_[]; extern Fl_Menu_Item menu_1[]; #endif diff --git a/src/Fl_Button.cxx b/src/Fl_Button.cxx index be41a01a4..23b974039 100644 --- a/src/Fl_Button.cxx +++ b/src/Fl_Button.cxx @@ -72,6 +72,7 @@ void Fl_Button::draw() { if (type() == FL_HIDDEN_BUTTON) return; Fl_Color col = value() ? selection_color() : color(); draw_box(value() ? (down_box()?down_box():fl_down(box())) : box(), col); + draw_backdrop(); if (labeltype() == FL_NORMAL_LABEL && value()) { Fl_Color c = labelcolor(); labelcolor(fl_contrast(c, col)); diff --git a/src/fl_draw.cxx b/src/fl_draw.cxx index 27f50afad..0517ab747 100644 --- a/src/fl_draw.cxx +++ b/src/fl_draw.cxx @@ -253,7 +253,7 @@ void fl_draw( int xpos; int ypos; int height = fl_height(); - int imgvert = ((align&FL_ALIGN_TEXT_NEXT_TO_IMAGE)==0); + int imgvert = ((align&FL_ALIGN_IMAGE_NEXT_TO_TEXT)==0); int imgh = img && imgvert ? img->h() : 0; int imgw[2] = {0, 0}; |
