diff options
| author | Matthias Melcher <fltk@matthiasm.com> | 2009-12-25 20:53:22 +0000 |
|---|---|---|
| committer | Matthias Melcher <fltk@matthiasm.com> | 2009-12-25 20:53:22 +0000 |
| commit | 38c15442a418a238462b1207adb681cf992edab7 (patch) | |
| tree | 3588313acf89c15ac6ad705038464304c7849ec7 | |
| parent | 9a505ef44c8433c8f58c68b79888c6f52c7739db (diff) | |
Changed widget bin closing behavior when pressing ESC (which IMO should quit the app, not the widget bin).
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@6981 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
| -rw-r--r-- | fluid/fluid.cxx | 1 | ||||
| -rw-r--r-- | fluid/function_panel.cxx | 10 | ||||
| -rw-r--r-- | fluid/function_panel.fl | 15 |
3 files changed, 22 insertions, 4 deletions
diff --git a/fluid/fluid.cxx b/fluid/fluid.cxx index f8c16bb69..6355d100f 100644 --- a/fluid/fluid.cxx +++ b/fluid/fluid.cxx @@ -1705,7 +1705,6 @@ void scheme_cb(Fl_Choice *, void *) { void toggle_widgetbin_cb(Fl_Widget *, void *) { if (!widgetbin_panel) { make_widgetbin(); - widgetbin_panel->callback(toggle_widgetbin_cb); if (!position_window(widgetbin_panel,"widgetbin_pos", 1, 320, 30)) return; } diff --git a/fluid/function_panel.cxx b/fluid/function_panel.cxx index d1a25238a..e36a9439b 100644 --- a/fluid/function_panel.cxx +++ b/fluid/function_panel.cxx @@ -34,6 +34,8 @@ extern class Fl_Pixmap *pixmap[]; extern class Fl_Type *Fl_Type_make(const char*); extern void select_only(Fl_Type*); +extern void exit_cb(Fl_Widget*, void*); +extern void toggle_widgetbin_cb(Fl_Widget*, void*); Fl_Double_Window *function_panel=(Fl_Double_Window *)0; @@ -595,8 +597,16 @@ void type_make_cb(Fl_Widget*,void*d) { Fl_Window *widgetbin_panel=(Fl_Window *)0; +static void cb_widgetbin_panel(Fl_Window* o, void* v) { + if (Fl::event()==FL_SHORTCUT && Fl::event_key()==FL_Escape) + exit_cb((Fl_Widget*)o, v); +else + toggle_widgetbin_cb((Fl_Widget*)o, v); +} + Fl_Window* make_widgetbin() { { widgetbin_panel = new Fl_Window(550, 85, "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, 3, 79, 79); { Fl_Button* o = new Fl_Button(5, 5, 24, 24); diff --git a/fluid/function_panel.fl b/fluid/function_panel.fl index 21aa03dd4..426f0ef56 100644 --- a/fluid/function_panel.fl +++ b/fluid/function_panel.fl @@ -43,6 +43,12 @@ decl {extern class Fl_Type *Fl_Type_make(const char*);} {} decl {extern void select_only(Fl_Type*);} {} +decl {extern void exit_cb(Fl_Widget*, void*);} {global +} + +decl {extern void toggle_widgetbin_cb(Fl_Widget*, void*);} {global +} + Function {make_function_panel()} {} { Fl_Window function_panel { label {Function/Method Properties} open @@ -432,7 +438,11 @@ Function {type_make_cb(Fl_Widget*,void*d)} {return_type void Function {make_widgetbin()} {} { Fl_Window widgetbin_panel { label {Widget Bin} - xywh {411 171 550 85} type Single align 80 non_modal visible + callback {if (Fl::event()==FL_SHORTCUT && Fl::event_key()==FL_Escape) + exit_cb((Fl_Widget*)o, v); +else + toggle_widgetbin_cb((Fl_Widget*)o, v);} open selected + xywh {410 171 550 85} type Single align 80 non_modal visible } { Fl_Group {} { xywh {3 3 79 79} @@ -763,8 +773,7 @@ Function {make_widgetbin()} {} { } } -Function {make_sourceview()} {selected -} { +Function {make_sourceview()} {} { Fl_Window sourceview_panel { label {Code View} callback toggle_sourceview_cb |
