From 5994addecaf731a9468b77a4d3bb4e93def7a6e7 Mon Sep 17 00:00:00 2001 From: Michael R Sweet Date: Fri, 3 Aug 2001 15:48:20 +0000 Subject: [PATCH] Fixed tooltips under WIN32 - no more toolbar buttons... Fl_Group::handle() didn't pass FL_RELEASE events to Fl_Browser_ and similar subclasses of Fl_Group; updated to pass only to widget that should receive the event. git-svn-id: file:///fltk/svn/fltk/branches/branch-1.1@1547 ea41ed52-d2ee-0310-a9c1-e6b18d33e121 --- src/Fl_Browser_.cxx | 6 +++--- src/Fl_FileChooser.cxx | 1 + src/Fl_Group.cxx | 14 +++++++++++--- src/Fl_Widget.cxx | 5 +++-- src/Fl_win32.cxx | 10 ++++++---- src/fl_file_chooser.cxx | 6 ++++-- visualc/editor.dsp | 4 ++-- visualc/fltkdll.dsp | 4 ++-- visualc/fltkgldll.dsp | 4 ++-- 9 files changed, 34 insertions(+), 20 deletions(-) diff --git a/src/Fl_Browser_.cxx b/src/Fl_Browser_.cxx index 68ce30eae..4a0ee3724 100644 --- a/src/Fl_Browser_.cxx +++ b/src/Fl_Browser_.cxx @@ -1,5 +1,5 @@ // -// "$Id: Fl_Browser_.cxx,v 1.10.2.16.2.2 2001/08/02 21:11:43 easysw Exp $" +// "$Id: Fl_Browser_.cxx,v 1.10.2.16.2.3 2001/08/03 15:48:20 easysw Exp $" // // Base Browser widget class for the Fast Light Tool Kit (FLTK). // @@ -23,6 +23,7 @@ // Please report all bugs and problems to "fltk-bugs@fltk.org". // +#include #include #include #include @@ -497,7 +498,6 @@ int Fl_Browser_::select_only(void* l, int docallbacks) { } int Fl_Browser_::handle(int event) { - // must do shortcuts first or the scrollbar will get them... if ((event == FL_SHORTCUT || event == FL_KEYBOARD) && type() >= FL_HOLD_BROWSER) { @@ -715,5 +715,5 @@ void Fl_Browser_::item_select(void*, int) {} int Fl_Browser_::item_selected(void* l) const {return l==selection_;} // -// End of "$Id: Fl_Browser_.cxx,v 1.10.2.16.2.2 2001/08/02 21:11:43 easysw Exp $". +// End of "$Id: Fl_Browser_.cxx,v 1.10.2.16.2.3 2001/08/03 15:48:20 easysw Exp $". // diff --git a/src/Fl_FileChooser.cxx b/src/Fl_FileChooser.cxx index 9daf75e87..ffba23d5d 100644 --- a/src/Fl_FileChooser.cxx +++ b/src/Fl_FileChooser.cxx @@ -104,6 +104,7 @@ Fl_FileChooser::Fl_FileChooser(const char *d, const char *p, int t, const char * w->hotspot(o); { Fl_FileBrowser* o = fileList = new Fl_FileBrowser(10, 45, 355, 180); o->type(2); + o->when(FL_WHEN_RELEASE_ALWAYS); o->callback((Fl_Callback*)cb_fileList); Fl_Group::current()->resizable(o); w->hotspot(o); diff --git a/src/Fl_Group.cxx b/src/Fl_Group.cxx index 34b2e692c..1da45d181 100644 --- a/src/Fl_Group.cxx +++ b/src/Fl_Group.cxx @@ -1,5 +1,5 @@ // -// "$Id: Fl_Group.cxx,v 1.8.2.8.2.3 2001/08/02 21:11:43 easysw Exp $" +// "$Id: Fl_Group.cxx,v 1.8.2.8.2.4 2001/08/03 15:48:20 easysw Exp $" // // Group widget for the Fast Light Tool Kit (FLTK). // @@ -169,6 +169,15 @@ int Fl_Group::handle(int event) { } return 0; + case FL_RELEASE: + for (i = children(); i--;) { + o = a[i]; + if (o->takesevents() && Fl::event_inside(o)) { + if (send(o,FL_RELEASE)) return 1; + } + } + return 0; + case FL_DEACTIVATE: case FL_ACTIVATE: for (i = children(); i--;) { @@ -205,7 +214,6 @@ int Fl_Group::handle(int event) { } return 0; - } } @@ -538,5 +546,5 @@ void Fl_Group::draw_outside_label(const Fl_Widget& w) const { } // -// End of "$Id: Fl_Group.cxx,v 1.8.2.8.2.3 2001/08/02 21:11:43 easysw Exp $". +// End of "$Id: Fl_Group.cxx,v 1.8.2.8.2.4 2001/08/03 15:48:20 easysw Exp $". // diff --git a/src/Fl_Widget.cxx b/src/Fl_Widget.cxx index f10655e3d..7c95f9e8a 100644 --- a/src/Fl_Widget.cxx +++ b/src/Fl_Widget.cxx @@ -1,5 +1,5 @@ // -// "$Id: Fl_Widget.cxx,v 1.5.2.4.2.1 2001/08/02 15:31:59 easysw Exp $" +// "$Id: Fl_Widget.cxx,v 1.5.2.4.2.2 2001/08/03 15:48:20 easysw Exp $" // // Base widget class for the Fast Light Tool Kit (FLTK). // @@ -80,6 +80,7 @@ Fl_Widget::Fl_Widget(int X, int Y, int W, int H, const char* L) { label_.font = FL_HELVETICA; label_.size = FL_NORMAL_SIZE; label_.color = FL_BLACK; + tooltip_ = 0; callback_ = default_callback; user_data_ = 0; type_ = 0; @@ -205,5 +206,5 @@ int Fl_Widget::contains(const Fl_Widget *o) const { } // -// End of "$Id: Fl_Widget.cxx,v 1.5.2.4.2.1 2001/08/02 15:31:59 easysw Exp $". +// End of "$Id: Fl_Widget.cxx,v 1.5.2.4.2.2 2001/08/03 15:48:20 easysw Exp $". // diff --git a/src/Fl_win32.cxx b/src/Fl_win32.cxx index a1388fe88..f44cd57a8 100644 --- a/src/Fl_win32.cxx +++ b/src/Fl_win32.cxx @@ -1,5 +1,5 @@ // -// "$Id: Fl_win32.cxx,v 1.33.2.37.2.2 2001/08/03 02:28:32 easysw Exp $" +// "$Id: Fl_win32.cxx,v 1.33.2.37.2.3 2001/08/03 15:48:20 easysw Exp $" // // WIN32-specific code for the Fast Light Tool Kit (FLTK). // @@ -726,6 +726,7 @@ void Fl_Window::resize(int X,int Y,int W,int H) { x(X); y(Y); flags |= SWP_NOSIZE; } + if (!border()) flags |= SWP_NOACTIVATE; if (resize_from_program && shown()) { int dummy, bt, bx, by; //Ignore window managing when resizing, so that windows (and more @@ -837,7 +838,7 @@ Fl_X* Fl_X::make(Fl_Window* w) { while (w->parent()) w = w->window(); parent = fl_xid(w); if (!w->visible()) showit = 0; - } + } else if (Fl::grab()) parent = fl_xid(Fl::grab()); } Fl_X* x = new Fl_X; @@ -868,7 +869,8 @@ Fl_X* Fl_X::make(Fl_Window* w) { // If we've captured the mouse, we dont want do activate any // other windows from the code, or we loose the capture. ShowWindow(x->xid, !showit ? SW_SHOWMINNOACTIVE : - fl_capture? SW_SHOWNOACTIVATE : SW_SHOWNORMAL); + (Fl::grab() || (style & WS_POPUP)) ? SW_SHOWNOACTIVATE : SW_SHOWNORMAL); + if (w->modal()) {Fl::modal_ = w; fl_fix_focus();} return x; } @@ -991,5 +993,5 @@ void Fl_Window::make_current() { } // -// End of "$Id: Fl_win32.cxx,v 1.33.2.37.2.2 2001/08/03 02:28:32 easysw Exp $". +// End of "$Id: Fl_win32.cxx,v 1.33.2.37.2.3 2001/08/03 15:48:20 easysw Exp $". // diff --git a/src/fl_file_chooser.cxx b/src/fl_file_chooser.cxx index 271810db8..d53adc7d8 100644 --- a/src/fl_file_chooser.cxx +++ b/src/fl_file_chooser.cxx @@ -1,5 +1,5 @@ // -// "$Id: fl_file_chooser.cxx,v 1.10.2.10.2.1 2001/08/02 16:17:04 easysw Exp $" +// "$Id: fl_file_chooser.cxx,v 1.10.2.10.2.2 2001/08/03 15:48:20 easysw Exp $" // // File chooser widget for the Fast Light Tool Kit (FLTK). // @@ -37,6 +37,8 @@ void fl_file_chooser_callback(void (*cb)(const char*)) { char* fl_file_chooser(const char* message, const char* pat, const char* fname) { + if (!fname || !*fname) fname = "."; + if (!fc) fc = new Fl_FileChooser(fname, pat, Fl_FileChooser::CREATE, message); else { fc->filter(pat); @@ -54,5 +56,5 @@ char* fl_file_chooser(const char* message, const char* pat, const char* fname) // -// End of "$Id: fl_file_chooser.cxx,v 1.10.2.10.2.1 2001/08/02 16:17:04 easysw Exp $". +// End of "$Id: fl_file_chooser.cxx,v 1.10.2.10.2.2 2001/08/03 15:48:20 easysw Exp $". // diff --git a/visualc/editor.dsp b/visualc/editor.dsp index 813fe5d8e..0643ff8c0 100644 --- a/visualc/editor.dsp +++ b/visualc/editor.dsp @@ -53,7 +53,7 @@ BSC32=bscmake.exe # ADD BSC32 /nologo LINK32=link.exe # ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /machine:I386 -# ADD LINK32 fltkdll.lib wsock32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib /nologo /entry:"mainCRTStartup" /subsystem:windows /machine:I386 /nodefaultlib:"libcd" /out:"../test/editor.exe" /libpath:"..\lib" +# ADD LINK32 wsock32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib /nologo /entry:"mainCRTStartup" /subsystem:windows /machine:I386 /nodefaultlib:"libcd" /out:"../test/editor.exe" /libpath:"..\lib" # SUBTRACT LINK32 /pdb:none /incremental:yes !ELSEIF "$(CFG)" == "editor - Win32 Debug" @@ -80,7 +80,7 @@ BSC32=bscmake.exe # ADD BSC32 /nologo LINK32=link.exe # ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /debug /machine:I386 /pdbtype:sept -# ADD LINK32 fltkdlld.lib wsock32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib /nologo /entry:"mainCRTStartup" /subsystem:windows /debug /machine:I386 /nodefaultlib:"libcd" /out:"../test/editord.exe" /pdbtype:sept /libpath:"..\lib" +# ADD LINK32 wsock32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib /nologo /entry:"mainCRTStartup" /subsystem:windows /debug /machine:I386 /nodefaultlib:"libcd" /out:"../test/editord.exe" /pdbtype:sept /libpath:"..\lib" # SUBTRACT LINK32 /pdb:none /incremental:no !ENDIF diff --git a/visualc/fltkdll.dsp b/visualc/fltkdll.dsp index 369dd2b12..61fda1eae 100644 --- a/visualc/fltkdll.dsp +++ b/visualc/fltkdll.dsp @@ -38,7 +38,7 @@ RSC=rc.exe # PROP BASE Target_Dir "" # PROP Use_MFC 0 # PROP Use_Debug_Libraries 0 -# PROP Output_Dir "../lib" +# PROP Output_Dir "../test" # PROP Intermediate_Dir "fltkdll" # PROP Ignore_Export_Lib 0 # PROP Target_Dir "" @@ -65,7 +65,7 @@ LINK32=link.exe # PROP BASE Target_Dir "" # PROP Use_MFC 0 # PROP Use_Debug_Libraries 1 -# PROP Output_Dir "../lib" +# PROP Output_Dir "../test" # PROP Intermediate_Dir "fltkdlld" # PROP Ignore_Export_Lib 0 # PROP Target_Dir "" diff --git a/visualc/fltkgldll.dsp b/visualc/fltkgldll.dsp index c78a1422b..035c14e8d 100644 --- a/visualc/fltkgldll.dsp +++ b/visualc/fltkgldll.dsp @@ -38,7 +38,7 @@ RSC=rc.exe # PROP BASE Target_Dir "" # PROP Use_MFC 0 # PROP Use_Debug_Libraries 0 -# PROP Output_Dir "../lib" +# PROP Output_Dir "../test" # PROP Intermediate_Dir "fltkgldll" # PROP Ignore_Export_Lib 0 # PROP Target_Dir "" @@ -65,7 +65,7 @@ LINK32=link.exe # PROP BASE Target_Dir "" # PROP Use_MFC 0 # PROP Use_Debug_Libraries 1 -# PROP Output_Dir "../lib" +# PROP Output_Dir "../test" # PROP Intermediate_Dir "fltkgldlld" # PROP Ignore_Export_Lib 0 # PROP Target_Dir ""