Fluid: Adding shortcuts for Checkbox and Radio Menuitems.

This commit is contained in:
Matthias Melcher 2021-12-05 21:51:18 +01:00
parent 2e08864f9e
commit 45d1d95b57
5 changed files with 105 additions and 70 deletions

1
.gitignore vendored
View File

@ -99,6 +99,7 @@ etc/FLTKConfig.cmake
/fluid/TAGS
/fluid/fluid.app
/fluid/pixmaps/*.bck
/fluid/html/
# /lib/
/lib/lib*

View File

@ -695,12 +695,16 @@ public:
class Fl_Radio_Menu_Item_Type : public Fl_Menu_Item_Type {
public:
const char* type_name() {return "RadioMenuItem";}
Fl_Type* make();
int pixmapID() { return 55; }
};
class Fl_Checkbox_Menu_Item_Type : public Fl_Menu_Item_Type {
public:
const char* type_name() {return "CheckMenuItem";}
Fl_Type* make();
int pixmapID() { return 54; }
};
class Fl_Submenu_Type : public Fl_Menu_Item_Type {

View File

@ -728,7 +728,7 @@ else
}
Fl_Window* make_widgetbin() {
{ widgetbin_panel = new Fl_Window(574, 102, "Widget Bin");
{ widgetbin_panel = new Fl_Window(600, 102, "Widget Bin");
widgetbin_panel->callback((Fl_Callback*)cb_widgetbin_panel);
widgetbin_panel->align(Fl_Align(FL_ALIGN_CLIP|FL_ALIGN_INSIDE));
{ Fl_Group* o = new Fl_Group(3, 19, 79, 79, "Code");
@ -979,20 +979,26 @@ Fl_Window* make_widgetbin() {
} // Fl_Button* o
o->end();
} // Fl_Group* o
{ Fl_Group* o = new Fl_Group(398, 19, 54, 79, "Menus");
{ Fl_Group* o = new Fl_Group(398, 19, 79, 79, "Menus");
o->labelsize(12);
{ Fl_Button* o = new Fl_Button(400, 21, 24, 24);
o->tooltip("Menu Bar");
o->box(FL_THIN_UP_BOX);
o->callback((Fl_Callback*)type_make_cb, (void*)("Fl_Menu_Bar"));
o->image(pixmap[17]);
} // Fl_Button* o
{ Fl_Button* o = new Fl_Button(425, 21, 24, 24);
o->tooltip("Input Choice");
o->box(FL_THIN_UP_BOX);
o->callback((Fl_Callback*)type_make_cb, (void*)("Fl_Input_Choice"));
o->image(pixmap[53]);
} // Fl_Button* o
{ Fl_Button* o = new Fl_Button(425, 21, 24, 24);
o->tooltip("Menu Item");
o->box(FL_THIN_UP_BOX);
o->callback((Fl_Callback*)type_make_cb, (void*)("menuitem"));
o->image(pixmap[16]);
} // Fl_Button* o
{ Fl_Button* o = new Fl_Button(450, 21, 24, 24);
o->tooltip("Menu Bar");
o->box(FL_THIN_UP_BOX);
o->callback((Fl_Callback*)type_make_cb, (void*)("Fl_Menu_Bar"));
o->image(pixmap[17]);
} // Fl_Button* o
{ Fl_Button* o = new Fl_Button(400, 46, 24, 24);
o->tooltip("Menu Button");
o->box(FL_THIN_UP_BOX);
@ -1000,10 +1006,16 @@ Fl_Window* make_widgetbin() {
o->image(pixmap[26]);
} // Fl_Button* o
{ Fl_Button* o = new Fl_Button(425, 46, 24, 24);
o->tooltip("Menu Item");
o->tooltip("Checkbox Menu Item");
o->box(FL_THIN_UP_BOX);
o->callback((Fl_Callback*)type_make_cb, (void*)("menuitem"));
o->image(pixmap[16]);
o->callback((Fl_Callback*)type_make_cb, (void*)("checkmenuitem"));
o->image(pixmap[54]);
} // Fl_Button* o
{ Fl_Button* o = new Fl_Button(450, 46, 24, 24);
o->tooltip("Sub Menu");
o->box(FL_THIN_UP_BOX);
o->callback((Fl_Callback*)type_make_cb, (void*)("submenu"));
o->image(pixmap[18]);
} // Fl_Button* o
{ Fl_Button* o = new Fl_Button(400, 71, 24, 24);
o->tooltip("Choice");
@ -1012,46 +1024,46 @@ Fl_Window* make_widgetbin() {
o->image(pixmap[15]);
} // Fl_Button* o
{ Fl_Button* o = new Fl_Button(425, 71, 24, 24);
o->tooltip("Sub Menu");
o->tooltip("Radio Menu Item");
o->box(FL_THIN_UP_BOX);
o->callback((Fl_Callback*)type_make_cb, (void*)("submenu"));
o->image(pixmap[18]);
o->callback((Fl_Callback*)type_make_cb, (void*)("radiomenuitem"));
o->image(pixmap[55]);
} // Fl_Button* o
o->end();
} // Fl_Group* o
{ Fl_Group* o = new Fl_Group(457, 19, 54, 79, "Browsers");
{ Fl_Group* o = new Fl_Group(482, 19, 54, 79, "Browsers");
o->labelsize(12);
{ Fl_Button* o = new Fl_Button(459, 21, 24, 24);
{ Fl_Button* o = new Fl_Button(484, 21, 24, 24);
o->tooltip("Browser");
o->box(FL_THIN_UP_BOX);
o->callback((Fl_Callback*)type_make_cb, (void*)("Fl_Browser"));
o->image(pixmap[31]);
} // Fl_Button* o
{ Fl_Button* o = new Fl_Button(484, 21, 24, 24);
{ Fl_Button* o = new Fl_Button(509, 21, 24, 24);
o->tooltip("Tree");
o->box(FL_THIN_UP_BOX);
o->callback((Fl_Callback*)type_make_cb, (void*)("Fl_Tree"));
o->image(pixmap[50]);
} // Fl_Button* o
{ Fl_Button* o = new Fl_Button(459, 46, 24, 24);
{ Fl_Button* o = new Fl_Button(484, 46, 24, 24);
o->tooltip("Check Browser");
o->box(FL_THIN_UP_BOX);
o->callback((Fl_Callback*)type_make_cb, (void*)("Fl_Check_Browser"));
o->image(pixmap[32]);
} // Fl_Button* o
{ Fl_Button* o = new Fl_Button(459, 71, 24, 24);
o->tooltip("File Browser");
o->box(FL_THIN_UP_BOX);
o->callback((Fl_Callback*)type_make_cb, (void*)("Fl_File_Browser"));
o->image(pixmap[33]);
} // Fl_Button* o
{ Fl_Button* o = new Fl_Button(484, 46, 24, 24);
{ Fl_Button* o = new Fl_Button(509, 46, 24, 24);
o->tooltip("Help Browser");
o->box(FL_THIN_UP_BOX);
o->callback((Fl_Callback*)type_make_cb, (void*)("Fl_Help_View"));
o->image(pixmap[35]);
} // Fl_Button* o
{ Fl_Button* o = new Fl_Button(484, 71, 24, 24);
o->tooltip("File Browser");
o->box(FL_THIN_UP_BOX);
o->callback((Fl_Callback*)type_make_cb, (void*)("Fl_File_Browser"));
o->image(pixmap[33]);
} // Fl_Button* o
{ Fl_Button* o = new Fl_Button(509, 71, 24, 24);
o->tooltip("Table");
o->box(FL_THIN_UP_BOX);
o->callback((Fl_Callback*)type_make_cb, (void*)("Fl_Table"));
@ -1059,21 +1071,21 @@ Fl_Window* make_widgetbin() {
} // Fl_Button* o
o->end();
} // Fl_Group* o
{ Fl_Group* o = new Fl_Group(515, 19, 55, 79, "Misc");
{ Fl_Group* o = new Fl_Group(540, 19, 55, 79, "Misc");
o->labelsize(12);
{ Fl_Button* o = new Fl_Button(517, 21, 24, 24);
{ Fl_Button* o = new Fl_Button(542, 21, 24, 24);
o->tooltip("Box");
o->box(FL_THIN_UP_BOX);
o->callback((Fl_Callback*)type_make_cb, (void*)("Fl_Box"));
o->image(pixmap[5]);
} // Fl_Button* o
{ Fl_Button* o = new Fl_Button(542, 21, 24, 24);
{ Fl_Button* o = new Fl_Button(567, 21, 24, 24);
o->tooltip("Clock");
o->box(FL_THIN_UP_BOX);
o->callback((Fl_Callback*)type_make_cb, (void*)("Fl_Clock"));
o->image(pixmap[34]);
} // Fl_Button* o
{ Fl_Button* o = new Fl_Button(517, 46, 24, 24);
{ Fl_Button* o = new Fl_Button(542, 46, 24, 24);
o->tooltip("Progress");
o->box(FL_THIN_UP_BOX);
o->callback((Fl_Callback*)type_make_cb, (void*)("Fl_Progress"));

View File

@ -541,10 +541,10 @@ Function {make_widgetbin()} {open
exit_cb((Fl_Widget*)o, v);
else
toggle_widgetbin_cb((Fl_Widget*)o, v);} open
xywh {446 274 574 102} type Single align 80 non_modal visible
xywh {445 273 600 102} type Single align 80 non_modal visible
} {
Fl_Group {} {
label Code
label Code open
xywh {3 19 79 79} labelsize 12
} {
Fl_Button {} {
@ -603,7 +603,7 @@ else
}
}
Fl_Group {} {
label Groups
label Groups open
xywh {87 19 79 79} labelsize 12
} {
Fl_Button {} {
@ -650,7 +650,7 @@ else
}
}
Fl_Group {} {
label Buttons
label Buttons open
xywh {171 19 54 79} labelsize 12
} {
Fl_Button {} {
@ -691,7 +691,7 @@ else
}
}
Fl_Group {} {
label Valuators
label Valuators open
xywh {230 19 104 79} labelsize 12
} {
Fl_Button {} {
@ -756,7 +756,7 @@ else
}
}
Fl_Group {} {
label Text
label Text open
xywh {339 19 54 79} labelsize 12
} {
Fl_Button {} {
@ -797,21 +797,27 @@ else
}
}
Fl_Group {} {
label Menus
xywh {398 19 54 79} labelsize 12
label Menus open
xywh {398 19 79 79} labelsize 12
} {
Fl_Button {} {
user_data {"Fl_Menu_Bar"}
callback type_make_cb
tooltip {Menu Bar} xywh {400 21 24 24} box THIN_UP_BOX
code0 {o->image(pixmap[17]);}
}
Fl_Button {} {
user_data {"Fl_Input_Choice"}
callback type_make_cb
tooltip {Input Choice} xywh {425 21 24 24} box THIN_UP_BOX
tooltip {Input Choice} xywh {400 21 24 24} box THIN_UP_BOX
code0 {o->image(pixmap[53]);}
}
Fl_Button {} {
user_data {"menuitem"}
callback type_make_cb
tooltip {Menu Item} xywh {425 21 24 24} box THIN_UP_BOX
code0 {o->image(pixmap[16]);}
}
Fl_Button {} {
user_data {"Fl_Menu_Bar"}
callback type_make_cb
tooltip {Menu Bar} xywh {450 21 24 24} box THIN_UP_BOX
code0 {o->image(pixmap[17]);}
}
Fl_Button {} {
user_data {"Fl_Menu_Button"}
callback type_make_cb
@ -819,10 +825,16 @@ else
code0 {o->image(pixmap[26]);}
}
Fl_Button {} {
user_data {"menuitem"}
user_data {"checkmenuitem"}
callback type_make_cb
tooltip {Menu Item} xywh {425 46 24 24} box THIN_UP_BOX
code0 {o->image(pixmap[16]);}
tooltip {Checkbox Menu Item} xywh {425 46 24 24} box THIN_UP_BOX
code0 {o->image(pixmap[54]);}
}
Fl_Button {} {
user_data {"submenu"}
callback type_make_cb
tooltip {Sub Menu} xywh {450 46 24 24} box THIN_UP_BOX
code0 {o->image(pixmap[18]);}
}
Fl_Button {} {
user_data {"Fl_Choice"}
@ -831,73 +843,73 @@ else
code0 {o->image(pixmap[15]);}
}
Fl_Button {} {
user_data {"submenu"}
callback type_make_cb
tooltip {Sub Menu} xywh {425 71 24 24} box THIN_UP_BOX
code0 {o->image(pixmap[18]);}
user_data {"radiomenuitem"}
callback type_make_cb selected
tooltip {Radio Menu Item} xywh {425 71 24 24} box THIN_UP_BOX
code0 {o->image(pixmap[55]);}
}
}
Fl_Group {} {
label Browsers
xywh {457 19 54 79} labelsize 12
label Browsers open
xywh {482 19 54 79} labelsize 12
} {
Fl_Button {} {
user_data {"Fl_Browser"}
callback type_make_cb
tooltip Browser xywh {459 21 24 24} box THIN_UP_BOX
tooltip Browser xywh {484 21 24 24} box THIN_UP_BOX
code0 {o->image(pixmap[31]);}
}
Fl_Button {} {
user_data {"Fl_Tree"}
callback type_make_cb
tooltip Tree xywh {484 21 24 24} box THIN_UP_BOX
tooltip Tree xywh {509 21 24 24} box THIN_UP_BOX
code0 {o->image(pixmap[50]);}
}
Fl_Button {} {
user_data {"Fl_Check_Browser"}
callback type_make_cb
tooltip {Check Browser} xywh {459 46 24 24} box THIN_UP_BOX
tooltip {Check Browser} xywh {484 46 24 24} box THIN_UP_BOX
code0 {o->image(pixmap[32]);}
}
Fl_Button {} {
user_data {"Fl_File_Browser"}
callback type_make_cb
tooltip {File Browser} xywh {459 71 24 24} box THIN_UP_BOX
code0 {o->image(pixmap[33]);}
}
Fl_Button {} {
user_data {"Fl_Help_View"}
callback type_make_cb
tooltip {Help Browser} xywh {484 46 24 24} box THIN_UP_BOX
tooltip {Help Browser} xywh {509 46 24 24} box THIN_UP_BOX
code0 {o->image(pixmap[35]);}
}
Fl_Button {} {
user_data {"Fl_File_Browser"}
callback type_make_cb
tooltip {File Browser} xywh {484 71 24 24} box THIN_UP_BOX
code0 {o->image(pixmap[33]);}
}
Fl_Button {} {
user_data {"Fl_Table"}
callback type_make_cb
tooltip Table xywh {484 71 24 24} box THIN_UP_BOX
tooltip Table xywh {509 71 24 24} box THIN_UP_BOX
code0 {o->image(pixmap[51]);}
}
}
Fl_Group {} {
label Misc selected
xywh {515 19 55 79} labelsize 12
label Misc open
xywh {540 19 55 79} labelsize 12
} {
Fl_Button {} {
user_data {"Fl_Box"}
callback type_make_cb
tooltip Box xywh {517 21 24 24} box THIN_UP_BOX
tooltip Box xywh {542 21 24 24} box THIN_UP_BOX
code0 {o->image(pixmap[5]);}
}
Fl_Button {} {
user_data {"Fl_Clock"}
callback type_make_cb
tooltip Clock xywh {542 21 24 24} box THIN_UP_BOX
tooltip Clock xywh {567 21 24 24} box THIN_UP_BOX
code0 {o->image(pixmap[34]);}
}
Fl_Button {} {
user_data {"Fl_Progress"}
callback type_make_cb
tooltip Progress xywh {517 46 24 24} box THIN_UP_BOX
tooltip Progress xywh {542 46 24 24} box THIN_UP_BOX
code0 {o->image(pixmap[36]);}
}
}

View File

@ -75,6 +75,8 @@
#include "pixmaps/flTable.xpm"
#include "pixmaps/flSimpleTerminal.xpm"
#include "pixmaps/flInputChoice.xpm"
#include "pixmaps/flCheckMenuitem.xpm"
#include "pixmaps/flRadioMenuitem.xpm"
Fl_Pixmap *lock_pixmap;
Fl_Pixmap *protected_pixmap;
@ -133,8 +135,10 @@ Fl_Pixmap *tree_pixmap;
Fl_Pixmap *table_pixmap;
Fl_Pixmap *simple_terminal_pixmap;
Fl_Pixmap *input_choice_pixmap;
Fl_Pixmap *check_menuitem_pixmap;
Fl_Pixmap *radio_menuitem_pixmap;
Fl_Pixmap *pixmap[54];
Fl_Pixmap *pixmap[56];
void loadPixmaps()
{
@ -205,5 +209,7 @@ void loadPixmaps()
pixmap[52] = simple_terminal_pixmap = new Fl_Pixmap(flSimpleTerminal_xpm); simple_terminal_pixmap->scale(16, 16);
pixmap[53] = input_choice_pixmap = new Fl_Pixmap(flInputChoice_xpm); input_choice_pixmap->scale(16, 16);
pixmap[54] = check_menuitem_pixmap = new Fl_Pixmap(flCheckMenuitem_xpm); check_menuitem_pixmap->scale(16, 16);
pixmap[55] = radio_menuitem_pixmap = new Fl_Pixmap(flRadioMenuitem_xpm); radio_menuitem_pixmap->scale(16, 16);
}