summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlbrecht Schlosser <albrechts.fltk@online.de>2009-08-03 06:26:32 +0000
committerAlbrecht Schlosser <albrechts.fltk@online.de>2009-08-03 06:26:32 +0000
commit5e21c7ce233da01593263b03ff237bccc1b3eda1 (patch)
treec7507931fc44a83f8b9ae6a0bbc9fdd9a4e47624
parent7e8ba419c6283797fd19f15de90fb0064b2c5cf5 (diff)
Added new Fl_Window:: flags() and methods:
- set_menu_window() to mark a window as a menu window - set_tooltip_window() to mark a window as a tooltip window and the corresponding get methods: - menu_window() - tooltip_window(). This is a first step for providing more information for correct parenting and properties to support modern (X) window managers (STR #2230). Please see also the information in fltk.development: http://www.fltk.org/newsgroups.php?gfltk.development+v:8003 ToDo: Another point is to be able to handle menu windows and popup windows that are opened while a menu is active properly (will follow later). git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@6841 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
-rw-r--r--FL/Fl_Window.H45
-rw-r--r--src/Fl_Menu.cxx2
-rw-r--r--src/Fl_Tooltip.cxx1
3 files changed, 46 insertions, 2 deletions
diff --git a/FL/Fl_Window.H b/FL/Fl_Window.H
index bb4858c66..0f7fd9610 100644
--- a/FL/Fl_Window.H
+++ b/FL/Fl_Window.H
@@ -75,7 +75,9 @@ class FL_EXPORT Fl_Window : public Fl_Group {
FL_NOBORDER = 8,
FL_FORCE_POSITION = 16,
FL_NON_MODAL = 32,
- FL_OVERRIDE = 256
+ FL_OVERRIDE = 256,
+ FL_MENU_WINDOW = 4096,
+ FL_TOOLTIP_WINDOW = 8192
};
void _Fl_Window(); // constructor innards
@@ -177,7 +179,7 @@ public:
being delivered to other windows in the same program, and will also
remain on top of the other windows (if the X window manager supports
the "transient for" property). Several modal windows may be shown at
- once, in which case only the last one shown gets events. You can See
+ once, in which case only the last one shown gets events. You can see
which window (if any) is modal by calling
Fl::modal().
*/
@@ -195,6 +197,45 @@ public:
int non_modal() const {return flags() & (FL_NON_MODAL|FL_MODAL);}
/**
+ Marks the window as a menu window.
+
+ This is intended for internal use, but it can also be used if you
+ write your own menu handling. However, this is not recommended.
+
+ This flag is used for correct "parenting" of windows in communication
+ with the windowing system. Modern X window managers can use different
+ flags to distinguish menu and tooltip windows from normal windows.
+
+ This must be called before the window is shown and cannot be changed
+ later.
+ */
+ void set_menu_window() {set_flag(FL_MENU_WINDOW);}
+
+ /** Returns true if this window is a menu window. */
+ int menu_window() const {return flags() & FL_MENU_WINDOW;}
+
+ /**
+ Marks the window as a tooltip window.
+
+ This is intended for internal use, but it can also be used if you
+ write your own tooltip handling. However, this is not recommended.
+
+ This flag is used for correct "parenting" of windows in communication
+ with the windowing system. Modern X window managers can use different
+ flags to distinguish menu and tooltip windows from normal windows.
+
+ This must be called before the window is shown and cannot be changed
+ later.
+
+ \note Since Fl_Tooltip_Window is derived from Fl_Menu_Window, this
+ also \b clears the menu_window() state.
+ */
+ void set_tooltip_window() { set_flag(FL_TOOLTIP_WINDOW);
+ clear_flag(FL_MENU_WINDOW); }
+ /** Returns true if this window is a tooltip window. */
+ int tooltip_window() const {return flags() & FL_TOOLTIP_WINDOW;}
+
+ /**
Position the window so that the mouse is pointing at the
given position, or at the center of the given widget, which may be the
window itself. If the optional offscreen parameter is
diff --git a/src/Fl_Menu.cxx b/src/Fl_Menu.cxx
index 1eba33867..91c5086ef 100644
--- a/src/Fl_Menu.cxx
+++ b/src/Fl_Menu.cxx
@@ -268,6 +268,7 @@ menutitle::menutitle(int X, int Y, int W, int H, const Fl_Menu_Item* L) :
end();
set_modal();
clear_border();
+ set_menu_window();
menu = L;
if (L->labelcolor_ || Fl::scheme() || L->labeltype_ > FL_NO_LABEL) clear_overlay();
}
@@ -286,6 +287,7 @@ menuwindow::menuwindow(const Fl_Menu_Item* m, int X, int Y, int Wp, int Hp,
end();
set_modal();
clear_border();
+ set_menu_window();
menu = m;
if (m) m = m->first(); // find the first item that needs to be rendered
drawn_selected = -1;
diff --git a/src/Fl_Tooltip.cxx b/src/Fl_Tooltip.cxx
index 6c6ab4226..0ca2178de 100644
--- a/src/Fl_Tooltip.cxx
+++ b/src/Fl_Tooltip.cxx
@@ -52,6 +52,7 @@ public:
/** Creates the box window */
Fl_TooltipBox() : Fl_Menu_Window(0, 0) {
set_override();
+ set_tooltip_window();
end();
}
void draw();