diff options
| author | Matthias Melcher <github@matthiasm.com> | 2024-08-14 01:45:20 +0200 |
|---|---|---|
| committer | Matthias Melcher <github@matthiasm.com> | 2024-08-14 01:52:37 +0200 |
| commit | cfc54a3b190dd7e85d6e2a313ab67d3ded4a4ab8 (patch) | |
| tree | e3c619c02f391079bbf0fba72032e05ff1b25421 /test | |
| parent | 325ac336c74e27037c3bfe0d8517be369f632aa9 (diff) | |
Adding Fl_Widget::label_image_spacing() (#1039)
- May need a better method name.
- This makes the gap between the image in a label and
the label text user settable.
- Can be tested using test/label app
Diffstat (limited to 'test')
| -rw-r--r-- | test/label.cxx | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/test/label.cxx b/test/label.cxx index 7ae739bc4..de88b976b 100644 --- a/test/label.cxx +++ b/test/label.cxx @@ -32,6 +32,7 @@ Fl_Box *text; Fl_Input *input; Fl_Hor_Value_Slider *fonts; Fl_Hor_Value_Slider *sizes; +Fl_Hor_Value_Slider *spacing; Fl_Double_Window *window; Fl_Pixmap *img; @@ -64,6 +65,11 @@ void font_cb(Fl_Widget *,void *) { window->redraw(); } +void spacing_cb(Fl_Widget *,void *) { + text->label_image_spacing(int(spacing->value())); + window->redraw(); +} + void size_cb(Fl_Widget *,void *) { text->labelsize(int(sizes->value())); window->redraw(); @@ -114,9 +120,9 @@ Fl_Menu_Item choices[] = { int main(int argc, char **argv) { img = new Fl_Pixmap(blast_xpm); - window = new Fl_Double_Window(440,420); + window = new Fl_Double_Window(440,445); - input = new Fl_Input(70,375,350,25,"Label:"); + input = new Fl_Input(70,400,350,25,"Label:"); input->static_value("The quick brown fox jumped over the lazy dog."); input->when(FL_WHEN_CHANGED); input->callback(input_cb); @@ -136,6 +142,13 @@ int main(int argc, char **argv) { fonts->value(0); fonts->callback(font_cb); + spacing=new Fl_Hor_Value_Slider(70,375,350,25,"Spacing:"); + spacing->align(FL_ALIGN_LEFT); + spacing->bounds(0,100); + spacing->step(1); + spacing->value(0); + spacing->callback(spacing_cb); + Fl_Group *g = new Fl_Group(70,275,350,50); imageb = new Fl_Toggle_Button(70,275,50,25,"image"); imageb->callback(image_cb); |
