Propagate events from the tooltip window to the widget we are tooltipping
for... Add "tooltips" resource for default state of tooltips. Fix another tooltip cycling problem. Fix default help and argument processing (didn't have the right min chars for matching, and didn't list new options) Update docos to list new tooltip resource and list of standard arguments. git-svn-id: file:///fltk/svn/fltk/branches/branch-1.1@2079 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
This commit is contained in:
parent
dc355ebb54
commit
8e3cdc0ac1
4
CHANGES
4
CHANGES
@ -1,12 +1,14 @@
|
|||||||
CHANGES IN FLTK 1.1.0
|
CHANGES IN FLTK 1.1.0
|
||||||
|
|
||||||
|
- Now pass correctly pass keyboard and mouse events to
|
||||||
|
widget under tooltip as needed...
|
||||||
- Added new Fl::dnd_text_ops() methods to enable/disable
|
- Added new Fl::dnd_text_ops() methods to enable/disable
|
||||||
drag-and-drop text operations.
|
drag-and-drop text operations.
|
||||||
- Fl_Input now supports clicking inside a selection to
|
- Fl_Input now supports clicking inside a selection to
|
||||||
set the new text position when drag-and-drop is
|
set the new text position when drag-and-drop is
|
||||||
enabled.
|
enabled.
|
||||||
- Added support of X resources for scheme, dnd_text_ops,
|
- Added support of X resources for scheme, dnd_text_ops,
|
||||||
and visible_focus...
|
tooltips, and visible_focus...
|
||||||
- Fixed some case problems in includes for the MacOS X
|
- Fixed some case problems in includes for the MacOS X
|
||||||
code.
|
code.
|
||||||
- Fl_Widget::handle() returned 1 for FL_ENTER and
|
- Fl_Widget::handle() returned 1 for FL_ENTER and
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
//
|
//
|
||||||
// "$Id: Fl_Tooltip.H,v 1.16.2.6 2002/04/09 17:20:23 easysw Exp $"
|
// "$Id: Fl_Tooltip.H,v 1.16.2.7 2002/04/14 02:43:48 easysw Exp $"
|
||||||
//
|
//
|
||||||
// Tooltip header file for the Fast Light Tool Kit (FLTK).
|
// Tooltip header file for the Fast Light Tool Kit (FLTK).
|
||||||
//
|
//
|
||||||
@ -36,6 +36,7 @@ class Fl_Tooltip_Window;
|
|||||||
class FL_EXPORT Fl_Tooltip {
|
class FL_EXPORT Fl_Tooltip {
|
||||||
|
|
||||||
friend class Fl_Tooltip_Box;
|
friend class Fl_Tooltip_Box;
|
||||||
|
friend class Fl_Tooltip_Window;
|
||||||
friend class Fl_Widget;
|
friend class Fl_Widget;
|
||||||
|
|
||||||
static float delay_;
|
static float delay_;
|
||||||
@ -76,5 +77,5 @@ public:
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
//
|
//
|
||||||
// End of "$Id: Fl_Tooltip.H,v 1.16.2.6 2002/04/09 17:20:23 easysw Exp $".
|
// End of "$Id: Fl_Tooltip.H,v 1.16.2.7 2002/04/14 02:43:48 easysw Exp $".
|
||||||
//
|
//
|
||||||
|
@ -278,26 +278,73 @@ than <tt>argc</tt>.
|
|||||||
<P>All switches except -bg2 may be abbreviated one letter and case is ignored:
|
<P>All switches except -bg2 may be abbreviated one letter and case is ignored:
|
||||||
|
|
||||||
<UL>
|
<UL>
|
||||||
<LI><tt>-display host:n.n</tt> The X display to use (ignored under
|
|
||||||
WIN32). </LI>
|
<LI><TT>-bg color</TT> or <TT>-background color</TT>
|
||||||
<LI><tt>-geometry WxH+X+Y</tt> The window position and size will be
|
|
||||||
modified according the the standard X geometry string. </LI>
|
<P>Sets the background color using <A
|
||||||
<LI><tt>-name string</tt> Fl_Window::xclass(string) will be done to
|
HREF="#Fl.background"><TT>Fl::background()</TT></A>.</LI>
|
||||||
the window, possibly changing its icon. </LI>
|
|
||||||
<LI><tt>-title string</tt> Fl_Window::label(string) will be done to
|
<LI><TT>-bg2 color</TT> or <TT>-background2 color</TT>
|
||||||
the window, changing both its title and the icontitle. </LI>
|
|
||||||
<LI><tt>-iconic</tt> Fl_Window::iconize() will be done to the window. </LI>
|
<P>Sets the secondary background color using <A
|
||||||
<LI><tt>-bg color</tt> XParseColor is used to lookup the passed color
|
HREF="#Fl.background2"><TT>Fl::background2()</TT></A>.</LI>
|
||||||
and then Fl::background() is done. Under WIN32 only color names of
|
|
||||||
the form "#xxxxxx" are understood. </LI>
|
<LI><TT>-display host:n.n</TT>
|
||||||
<LI><tt>-bg2 color</tt> XParseColor is used to lookup the passed color
|
|
||||||
and then Fl::background2() is done. </LI>
|
<P>Sets the X display to use; this option is silently
|
||||||
<LI><tt>-fg color</tt> XParseColor is used to lookup the passed color
|
ignored under WIN32 and MacOS.</LI>
|
||||||
and then Fl::foreground() is done. </LI>
|
|
||||||
|
<LI><TT>-dnd</TT> and <TT>-nodnd</TT>
|
||||||
|
|
||||||
|
<P>Enables or disables drag and drop text operations
|
||||||
|
using <A
|
||||||
|
HREF="#Fl.dnd_text_ops"><TT>Fl::dnd_text_ops()</TT></A>.</LI>
|
||||||
|
|
||||||
|
<LI><TT>-fg color</TT> or <TT>-foreground color</TT>
|
||||||
|
|
||||||
|
<P>Sets the foreground color using <A
|
||||||
|
HREF="#Fl.foreground"><TT>Fl::foreground()</TT></A>.</LI>
|
||||||
|
|
||||||
|
<LI><TT>-geometry WxH+X+Y</TT>
|
||||||
|
|
||||||
|
<P>Sets the initial window position and size according
|
||||||
|
the the standard X geometry string.</LI>
|
||||||
|
|
||||||
|
<LI><TT>-iconic</TT>
|
||||||
|
|
||||||
|
<P>Iconifies the window using <A
|
||||||
|
HREF="Fl_Window.html#Fl_Window.iconize"><TT>Fl_Window::iconize()</TT></A>.</LI>
|
||||||
|
|
||||||
|
<LI><TT>-kbd</TT> and <TT>-nokbd</TT>
|
||||||
|
|
||||||
|
<P>Enables or disables visible keyboard focus for
|
||||||
|
non-text widgets using <A
|
||||||
|
HREF="#Fl.visible_focus"><TT>Fl::visible_focus()</TT></A>.</LI>
|
||||||
|
|
||||||
|
<LI><TT>-name string</TT>
|
||||||
|
|
||||||
|
<P>Sets the window class using <A
|
||||||
|
HREF="Fl_Window.html#Fl_Window.xclass"><TT>Fl_Window::xclass()</TT></A>.</LI>
|
||||||
|
|
||||||
|
<LI><TT>-scheme string</TT>
|
||||||
|
|
||||||
|
<P>Sets the widget scheme using <A
|
||||||
|
HREF="#Fl.scheme"><TT>Fl::scheme()</TT></A>.</LI>
|
||||||
|
|
||||||
|
<LI><TT>-title string</TT>
|
||||||
|
|
||||||
|
<P>Sets the window title using <A
|
||||||
|
HREF="Fl_Window.html#Fl_Window.label"><TT>Fl_Window::label()</TT></A>.</LI>
|
||||||
|
|
||||||
|
<LI><TT>-tooltips</TT> and <TT>-notooltips</TT>
|
||||||
|
|
||||||
|
<P>Enables or disables tooltips using <A
|
||||||
|
HREF="Fl_Tooltip.html#Fl_Tooltip.enable"><TT>Fl_Tooltip::enable()</TT></A>.</LI>
|
||||||
|
|
||||||
</UL>
|
</UL>
|
||||||
|
|
||||||
<P>The second form of <tt>Fl::args()</tt> is useful if your program does
|
<P>The second form of <tt>Fl::args()</tt> is useful if your program does
|
||||||
not have command line switches of its own. It parses all the switches,
|
not have command line switches of its own. It parses all the switches,
|
||||||
and if any are not recognized it calls <tt>Fl::abort(Fl::help)</tt>.
|
and if any are not recognized it calls <tt>Fl::abort(Fl::help)</tt>.
|
||||||
|
|
||||||
<P>A usage string is displayed if <tt>Fl::args()</tt> detects an invalid
|
<P>A usage string is displayed if <tt>Fl::args()</tt> detects an invalid
|
||||||
|
@ -393,6 +393,9 @@ resources:
|
|||||||
<LI><TT>Text.background</TT> - The default background
|
<LI><TT>Text.background</TT> - The default background
|
||||||
color for text fields (color).
|
color for text fields (color).
|
||||||
|
|
||||||
|
<LI><TT>tooltips</TT> - The default setting for
|
||||||
|
tooltips (boolean).
|
||||||
|
|
||||||
<LI><TT>visibleFocus</TT> - The default setting for
|
<LI><TT>visibleFocus</TT> - The default setting for
|
||||||
visible keyboard focus on non-text widgets (boolean).
|
visible keyboard focus on non-text widgets (boolean).
|
||||||
|
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
//
|
//
|
||||||
// "$Id: Fl_Tooltip.cxx,v 1.38.2.11 2002/04/09 17:20:24 easysw Exp $"
|
// "$Id: Fl_Tooltip.cxx,v 1.38.2.12 2002/04/14 02:43:48 easysw Exp $"
|
||||||
//
|
//
|
||||||
// Tooltip source file for the Fast Light Tool Kit (FLTK).
|
// Tooltip source file for the Fast Light Tool Kit (FLTK).
|
||||||
//
|
//
|
||||||
@ -68,8 +68,26 @@ class Fl_Tooltip_Window : public Fl_Menu_Window {
|
|||||||
|
|
||||||
int
|
int
|
||||||
Fl_Tooltip_Window::handle(int event) {
|
Fl_Tooltip_Window::handle(int event) {
|
||||||
if (event == FL_KEYDOWN || event == FL_KEYUP || event == FL_SHORTCUT) return 0;
|
switch (event) {
|
||||||
else return Fl_Menu_Window::handle(event);
|
case FL_KEYUP :
|
||||||
|
case FL_KEYDOWN :
|
||||||
|
case FL_SHORTCUT :
|
||||||
|
case FL_PUSH :
|
||||||
|
case FL_DRAG :
|
||||||
|
case FL_RELEASE :
|
||||||
|
case FL_MOUSEWHEEL :
|
||||||
|
if (Fl_Tooltip::widget) {
|
||||||
|
// Pass events to widget...
|
||||||
|
Fl::belowmouse(Fl_Tooltip::widget);
|
||||||
|
// Update event_x() and event_y() to be relative to the
|
||||||
|
// widget's window, not the tooltip window...
|
||||||
|
Fl::e_x = Fl::e_x_root - Fl_Tooltip::widget->window()->x();
|
||||||
|
Fl::e_y = Fl::e_y_root - Fl_Tooltip::widget->window()->y();
|
||||||
|
return Fl_Tooltip::widget->handle(event);
|
||||||
|
} else return 0;
|
||||||
|
default :
|
||||||
|
return Fl_Menu_Window::handle(event);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -140,7 +158,14 @@ Fl_Tooltip::enter(Fl_Widget *w) {
|
|||||||
// printf(" visible() = %d\n", w->visible());
|
// printf(" visible() = %d\n", w->visible());
|
||||||
// printf(" active() = %d\n", w->active());
|
// printf(" active() = %d\n", w->active());
|
||||||
// }
|
// }
|
||||||
|
Fl_Widget* temp = w;
|
||||||
|
while (temp && !temp->tooltip()) {
|
||||||
|
if (temp == window) return; // Don't do anything if pointed at tooltip
|
||||||
|
temp = temp->parent();
|
||||||
|
}
|
||||||
|
|
||||||
if ((!w || !w->tooltip()) && tooltip_callback_ && window) {
|
if ((!w || !w->tooltip()) && tooltip_callback_ && window) {
|
||||||
|
// puts("Hiding tooltip...");
|
||||||
Fl::remove_timeout(tooltip_callback_);
|
Fl::remove_timeout(tooltip_callback_);
|
||||||
window->hide();
|
window->hide();
|
||||||
shown = 0;
|
shown = 0;
|
||||||
@ -173,6 +198,7 @@ Fl_Tooltip::tooltip_exit(Fl_Widget *w) {
|
|||||||
widget = 0;
|
widget = 0;
|
||||||
|
|
||||||
if (window) {
|
if (window) {
|
||||||
|
// puts("Hiding tooltip...");
|
||||||
window->hide();
|
window->hide();
|
||||||
shown = 0;
|
shown = 0;
|
||||||
}
|
}
|
||||||
@ -196,6 +222,9 @@ Fl_Tooltip::tooltip_timeout(void *v) {
|
|||||||
window->resizable(box);
|
window->resizable(box);
|
||||||
window->end();
|
window->end();
|
||||||
Fl_Group::current(saveCurrent);
|
Fl_Group::current(saveCurrent);
|
||||||
|
|
||||||
|
// printf("Fl_Tooltip::window = %p\n", window);
|
||||||
|
// printf("Fl_Tooltip::box = %p\n", box);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!v)
|
if (!v)
|
||||||
@ -209,6 +238,7 @@ Fl_Tooltip::tooltip_timeout(void *v) {
|
|||||||
Fl_Window *widgetWindow = widget->window();
|
Fl_Window *widgetWindow = widget->window();
|
||||||
|
|
||||||
if (widgetWindow) {
|
if (widgetWindow) {
|
||||||
|
// puts("Showing tooltip");
|
||||||
Fl::grab(*widgetWindow);
|
Fl::grab(*widgetWindow);
|
||||||
window->show();
|
window->show();
|
||||||
Fl::release();
|
Fl::release();
|
||||||
@ -220,5 +250,5 @@ Fl_Tooltip::tooltip_timeout(void *v) {
|
|||||||
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// End of "$Id: Fl_Tooltip.cxx,v 1.38.2.11 2002/04/09 17:20:24 easysw Exp $".
|
// End of "$Id: Fl_Tooltip.cxx,v 1.38.2.12 2002/04/14 02:43:48 easysw Exp $".
|
||||||
//
|
//
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
//
|
//
|
||||||
// "$Id: Fl_arg.cxx,v 1.5.2.8.2.9 2002/04/13 22:17:46 easysw Exp $"
|
// "$Id: Fl_arg.cxx,v 1.5.2.8.2.10 2002/04/14 02:43:48 easysw Exp $"
|
||||||
//
|
//
|
||||||
// Optional argument initialization code for the Fast Light Tool Kit (FLTK).
|
// Optional argument initialization code for the Fast Light Tool Kit (FLTK).
|
||||||
//
|
//
|
||||||
@ -91,7 +91,7 @@ int Fl::arg(int argc, char **argv, int &i) {
|
|||||||
Fl::visible_focus(0);
|
Fl::visible_focus(0);
|
||||||
i++;
|
i++;
|
||||||
return 1;
|
return 1;
|
||||||
} else if (match(s, "dnd")) {
|
} else if (match(s, "dnd", 2)) {
|
||||||
Fl::dnd_text_ops(1);
|
Fl::dnd_text_ops(1);
|
||||||
i++;
|
i++;
|
||||||
return 1;
|
return 1;
|
||||||
@ -99,6 +99,14 @@ int Fl::arg(int argc, char **argv, int &i) {
|
|||||||
Fl::dnd_text_ops(0);
|
Fl::dnd_text_ops(0);
|
||||||
i++;
|
i++;
|
||||||
return 1;
|
return 1;
|
||||||
|
} else if (match(s, "tooltips", 2)) {
|
||||||
|
Fl_Tooltip::enable();
|
||||||
|
i++;
|
||||||
|
return 1;
|
||||||
|
} else if (match(s, "notooltips", 3)) {
|
||||||
|
Fl_Tooltip::disable();
|
||||||
|
i++;
|
||||||
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
const char *v = argv[i+1];
|
const char *v = argv[i+1];
|
||||||
@ -113,26 +121,26 @@ int Fl::arg(int argc, char **argv, int &i) {
|
|||||||
geometry = v;
|
geometry = v;
|
||||||
|
|
||||||
#if !defined(WIN32) && !defined(__APPLE__)
|
#if !defined(WIN32) && !defined(__APPLE__)
|
||||||
} else if (match(s, "display")) {
|
} else if (match(s, "display", 2)) {
|
||||||
Fl::display(v);
|
Fl::display(v);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
} else if (match(s, "title")) {
|
} else if (match(s, "title", 2)) {
|
||||||
title = v;
|
title = v;
|
||||||
|
|
||||||
} else if (match(s, "name")) {
|
} else if (match(s, "name", 2)) {
|
||||||
name = v;
|
name = v;
|
||||||
|
|
||||||
} else if (match(s, "bg2", 3) || match(s, "background2", 11)) {
|
} else if (match(s, "bg2", 3) || match(s, "background2", 11)) {
|
||||||
fl_bg2 = v;
|
fl_bg2 = v;
|
||||||
|
|
||||||
} else if (match(s, "bg") || match(s, "background")) {
|
} else if (match(s, "bg", 2) || match(s, "background", 10)) {
|
||||||
fl_bg = v;
|
fl_bg = v;
|
||||||
|
|
||||||
} else if (match(s, "fg") || match(s, "foreground")) {
|
} else if (match(s, "fg", 2) || match(s, "foreground", 10)) {
|
||||||
fl_fg = v;
|
fl_fg = v;
|
||||||
|
|
||||||
} else if (match(s, "scheme")) {
|
} else if (match(s, "scheme", 1)) {
|
||||||
Fl::scheme(v);
|
Fl::scheme(v);
|
||||||
|
|
||||||
} else return 0; // unrecognized
|
} else return 0; // unrecognized
|
||||||
@ -176,6 +184,11 @@ void Fl_Window::show(int argc, char **argv) {
|
|||||||
strcasecmp(val, "on") == 0 ||
|
strcasecmp(val, "on") == 0 ||
|
||||||
strcasecmp(val, "yes") == 0);
|
strcasecmp(val, "yes") == 0);
|
||||||
|
|
||||||
|
val = XGetDefault(fl_display, key, "tooltips");
|
||||||
|
if (val) Fl_Tooltip::enable(strcasecmp(val, "true") == 0 ||
|
||||||
|
strcasecmp(val, "on") == 0 ||
|
||||||
|
strcasecmp(val, "yes") == 0);
|
||||||
|
|
||||||
val = XGetDefault(fl_display, key, "visibleFocus");
|
val = XGetDefault(fl_display, key, "visibleFocus");
|
||||||
if (val) Fl::visible_focus(strcasecmp(val, "true") == 0 ||
|
if (val) Fl::visible_focus(strcasecmp(val, "true") == 0 ||
|
||||||
strcasecmp(val, "on") == 0 ||
|
strcasecmp(val, "on") == 0 ||
|
||||||
@ -239,15 +252,19 @@ static const char * const helpmsg =
|
|||||||
"options are:\n"
|
"options are:\n"
|
||||||
" -bg2 color\n"
|
" -bg2 color\n"
|
||||||
" -bg color\n"
|
" -bg color\n"
|
||||||
" -d[isplay] host:n.n\n"
|
" -di[splay] host:n.n\n"
|
||||||
|
" -dn[d]\n"
|
||||||
" -fg color\n"
|
" -fg color\n"
|
||||||
" -g[eometry] WxH+X+Y\n"
|
" -g[eometry] WxH+X+Y\n"
|
||||||
" -i[conic]\n"
|
" -i[conic]\n"
|
||||||
" -k[bd]\n"
|
" -k[bd]\n"
|
||||||
" -n[ame] classname\n"
|
" -na[me] classname\n"
|
||||||
|
" -nod[nd]\n"
|
||||||
" -nok[bd]\n"
|
" -nok[bd]\n"
|
||||||
|
" -not[ooltips]\n"
|
||||||
" -s[cheme] scheme\n"
|
" -s[cheme] scheme\n"
|
||||||
" -t[itle] windowtitle";
|
" -ti[tle] windowtitle\n";
|
||||||
|
" -to[oltips]";
|
||||||
|
|
||||||
const char * const Fl::help = helpmsg+13;
|
const char * const Fl::help = helpmsg+13;
|
||||||
|
|
||||||
@ -394,5 +411,5 @@ int XParseGeometry(const char* string, int* x, int* y,
|
|||||||
#endif // ifdef WIN32
|
#endif // ifdef WIN32
|
||||||
|
|
||||||
//
|
//
|
||||||
// End of "$Id: Fl_arg.cxx,v 1.5.2.8.2.9 2002/04/13 22:17:46 easysw Exp $".
|
// End of "$Id: Fl_arg.cxx,v 1.5.2.8.2.10 2002/04/14 02:43:48 easysw Exp $".
|
||||||
//
|
//
|
||||||
|
Loading…
Reference in New Issue
Block a user