diff options
| author | Manolo Gouy <Manolo> | 2016-03-23 07:08:17 +0000 |
|---|---|---|
| committer | Manolo Gouy <Manolo> | 2016-03-23 07:08:17 +0000 |
| commit | 270b437500552cba0d082363f9124456f16a1fda (patch) | |
| tree | ac7245b95a138a5f64c6e6b8318632fd4dc45075 /src/Fl_Window_Driver.cxx | |
| parent | bf7e4de688fc1f0e3008049a41c07543a7da0752 (diff) | |
Rewrite Fl_Window::hide() under the driver model.
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3-porting@11402 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
Diffstat (limited to 'src/Fl_Window_Driver.cxx')
| -rw-r--r-- | src/Fl_Window_Driver.cxx | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/src/Fl_Window_Driver.cxx b/src/Fl_Window_Driver.cxx index 40cc7c668..f9dc31c79 100644 --- a/src/Fl_Window_Driver.cxx +++ b/src/Fl_Window_Driver.cxx @@ -21,7 +21,9 @@ #include <config.h> #include <FL/Fl_Window_Driver.H> #include <FL/fl_draw.H> +#include <FL/Fl.H> +extern void fl_throw_focus(Fl_Widget *o); Fl_Window_Driver::Fl_Window_Driver(Fl_Window *win) : pWindow(win) @@ -151,6 +153,44 @@ void Fl_Window_Driver::capture_titlebar_and_borders(Fl_Shared_Image*& top, Fl_Sh top = left = bottom = right = NULL; } + +// This function is available for use by platform-specific, Fl_Window_Driver-derived classes +int Fl_Window_Driver::hide_common() { + pWindow->clear_visible(); + + if (!pWindow->shown()) return 1; + + // remove from the list of windows: + Fl_X* ip = Fl_X::i(pWindow); + Fl_X** pp = &Fl_X::first; + for (; *pp != ip; pp = &(*pp)->next) if (!*pp) return 1; + *pp = ip->next; + + pWindow->i = 0; + + // recursively remove any subwindows: + for (Fl_X *wi = Fl_X::first; wi;) { + Fl_Window* W = wi->w; + if (W->window() == pWindow) { + W->hide(); + W->set_visible(); + wi = Fl_X::first; + } else wi = wi->next; + } + + if (pWindow == Fl::modal_) { // we are closing the modal window, find next one: + Fl_Window* W; + for (W = Fl::first_window(); W; W = Fl::next_window(W)) + if (W->modal()) break; + Fl::modal_ = W; + } + + // Make sure no events are sent to this window: + fl_throw_focus(pWindow); + pWindow->handle(FL_HIDE); + return 0; +} + // // End of "$Id$". // |
