2.0 tooltip changes into 1.1.x.
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.1@2704 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
This commit is contained in:
parent
314a351940
commit
7d0d281fb4
6
CHANGES
6
CHANGES
@ -1,7 +1,9 @@
|
|||||||
CHANGES IN FLTK 1.1.2
|
CHANGES IN FLTK 1.1.2
|
||||||
|
|
||||||
- MacOS windows were resizable, even when size_range would
|
- Back-ported some FLTK 2.0 tooltip changes to eliminate
|
||||||
not allow for resizing.
|
erroneous tooltip display.
|
||||||
|
- MacOS windows were resizable, even when size_range
|
||||||
|
would not allow for resizing.
|
||||||
- Fl_Text_Editor now supports Shift+Delete, Ctrl+Insert,
|
- Fl_Text_Editor now supports Shift+Delete, Ctrl+Insert,
|
||||||
and Shift+Insert for cut, copy, and paste,
|
and Shift+Insert for cut, copy, and paste,
|
||||||
respectively.
|
respectively.
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
//
|
//
|
||||||
// "$Id: Enumerations.H,v 1.18.2.14.2.28 2002/10/24 12:53:40 easysw Exp $"
|
// "$Id: Enumerations.H,v 1.18.2.14.2.29 2002/10/29 19:45:08 easysw Exp $"
|
||||||
//
|
//
|
||||||
// Enumerations for the Fast Light Tool Kit (FLTK).
|
// Enumerations for the Fast Light Tool Kit (FLTK).
|
||||||
//
|
//
|
||||||
@ -145,6 +145,8 @@ enum Fl_When { // Fl_Widget::when():
|
|||||||
#define FL_BUTTON1 0x01000000
|
#define FL_BUTTON1 0x01000000
|
||||||
#define FL_BUTTON2 0x02000000
|
#define FL_BUTTON2 0x02000000
|
||||||
#define FL_BUTTON3 0x04000000
|
#define FL_BUTTON3 0x04000000
|
||||||
|
#define FL_BUTTONS 0x7f000000 // All possible buttons
|
||||||
|
#define FL_BUTTON(n) (0x00800000<<(n))
|
||||||
|
|
||||||
enum Fl_Boxtype { // boxtypes (if you change these you must fix fl_boxtype.C):
|
enum Fl_Boxtype { // boxtypes (if you change these you must fix fl_boxtype.C):
|
||||||
FL_NO_BOX = 0, FL_FLAT_BOX,
|
FL_NO_BOX = 0, FL_FLAT_BOX,
|
||||||
@ -406,5 +408,5 @@ enum Fl_Damage {
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
//
|
//
|
||||||
// End of "$Id: Enumerations.H,v 1.18.2.14.2.28 2002/10/24 12:53:40 easysw Exp $".
|
// End of "$Id: Enumerations.H,v 1.18.2.14.2.29 2002/10/29 19:45:08 easysw Exp $".
|
||||||
//
|
//
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
//
|
//
|
||||||
// "$Id: Fl_Tooltip.H,v 1.16.2.8 2002/05/13 05:05:11 spitzak Exp $"
|
// "$Id: Fl_Tooltip.H,v 1.16.2.9 2002/10/29 19:45:09 easysw Exp $"
|
||||||
//
|
//
|
||||||
// Tooltip header file for the Fast Light Tool Kit (FLTK).
|
// Tooltip header file for the Fast Light Tool Kit (FLTK).
|
||||||
//
|
//
|
||||||
@ -39,6 +39,8 @@ public:
|
|||||||
static void (*enter)(Fl_Widget* w);
|
static void (*enter)(Fl_Widget* w);
|
||||||
static void enter_area(Fl_Widget* w, int X, int Y, int W, int H, const char* tip);
|
static void enter_area(Fl_Widget* w, int X, int Y, int W, int H, const char* tip);
|
||||||
static void (*exit)(Fl_Widget *w);
|
static void (*exit)(Fl_Widget *w);
|
||||||
|
static Fl_Widget* current() {return widget_;}
|
||||||
|
static void current(Fl_Widget*);
|
||||||
|
|
||||||
static int font() { return font_; }
|
static int font() { return font_; }
|
||||||
static int size() { return size_; }
|
static int size() { return size_; }
|
||||||
@ -55,10 +57,11 @@ private:
|
|||||||
static unsigned textcolor_;
|
static unsigned textcolor_;
|
||||||
static int font_;
|
static int font_;
|
||||||
static int size_;
|
static int size_;
|
||||||
|
static Fl_Widget* widget_;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
//
|
//
|
||||||
// End of "$Id: Fl_Tooltip.H,v 1.16.2.8 2002/05/13 05:05:11 spitzak Exp $".
|
// End of "$Id: Fl_Tooltip.H,v 1.16.2.9 2002/10/29 19:45:09 easysw Exp $".
|
||||||
//
|
//
|
||||||
|
14
src/Fl.cxx
14
src/Fl.cxx
@ -1,5 +1,5 @@
|
|||||||
//
|
//
|
||||||
// "$Id: Fl.cxx,v 1.24.2.41.2.55 2002/10/22 17:39:11 easysw Exp $"
|
// "$Id: Fl.cxx,v 1.24.2.41.2.56 2002/10/29 19:45:09 easysw Exp $"
|
||||||
//
|
//
|
||||||
// Main event handling code for the Fast Light Tool Kit (FLTK).
|
// Main event handling code for the Fast Light Tool Kit (FLTK).
|
||||||
//
|
//
|
||||||
@ -533,6 +533,7 @@ void fl_throw_focus(Fl_Widget *o) {
|
|||||||
if (o->contains(Fl::belowmouse())) Fl::belowmouse_ = 0;
|
if (o->contains(Fl::belowmouse())) Fl::belowmouse_ = 0;
|
||||||
if (o->contains(Fl::focus())) Fl::focus_ = 0;
|
if (o->contains(Fl::focus())) Fl::focus_ = 0;
|
||||||
if (o == fl_xfocus) fl_xfocus = 0;
|
if (o == fl_xfocus) fl_xfocus = 0;
|
||||||
|
if (o == Fl_Tooltip::current()) Fl_Tooltip::current(0);
|
||||||
if (o == fl_xmousewin) fl_xmousewin = 0;
|
if (o == fl_xmousewin) fl_xmousewin = 0;
|
||||||
Fl_Tooltip::exit(o);
|
Fl_Tooltip::exit(o);
|
||||||
fl_fix_focus();
|
fl_fix_focus();
|
||||||
@ -579,10 +580,10 @@ int Fl::handle(int e, Fl_Window* window)
|
|||||||
return 1;
|
return 1;
|
||||||
|
|
||||||
case FL_PUSH:
|
case FL_PUSH:
|
||||||
Fl_Tooltip::enter((Fl_Widget*)0);
|
|
||||||
if (grab()) wi = grab();
|
if (grab()) wi = grab();
|
||||||
else if (modal() && wi != modal()) return 0;
|
else if (modal() && wi != modal()) return 0;
|
||||||
pushed_ = wi;
|
pushed_ = wi;
|
||||||
|
Fl_Tooltip::current(wi);
|
||||||
if (send(e, wi, window)) return 1;
|
if (send(e, wi, window)) return 1;
|
||||||
// raise windows that are clicked on:
|
// raise windows that are clicked on:
|
||||||
window->show();
|
window->show();
|
||||||
@ -686,6 +687,10 @@ int Fl::handle(int e, Fl_Window* window)
|
|||||||
return 1;
|
return 1;
|
||||||
|
|
||||||
case FL_LEAVE:
|
case FL_LEAVE:
|
||||||
|
if (!pushed_) {
|
||||||
|
belowmouse(0);
|
||||||
|
Fl_Tooltip::enter(0);
|
||||||
|
}
|
||||||
if (window == fl_xmousewin) {fl_xmousewin = 0; fl_fix_focus();}
|
if (window == fl_xmousewin) {fl_xmousewin = 0; fl_fix_focus();}
|
||||||
return 1;
|
return 1;
|
||||||
|
|
||||||
@ -790,9 +795,6 @@ void Fl_Window::hide() {
|
|||||||
Fl::first_window()->show();
|
Fl::first_window()->show();
|
||||||
#endif
|
#endif
|
||||||
delete ip;
|
delete ip;
|
||||||
|
|
||||||
// Hide any visible tooltips...
|
|
||||||
//Fl_Tooltip::enter(0);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Fl_Window::~Fl_Window() {
|
Fl_Window::~Fl_Window() {
|
||||||
@ -967,5 +969,5 @@ void Fl_Window::flush() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// End of "$Id: Fl.cxx,v 1.24.2.41.2.55 2002/10/22 17:39:11 easysw Exp $".
|
// End of "$Id: Fl.cxx,v 1.24.2.41.2.56 2002/10/29 19:45:09 easysw Exp $".
|
||||||
//
|
//
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
//
|
//
|
||||||
// "$Id: Fl_Tooltip.cxx,v 1.38.2.24 2002/08/09 03:17:30 easysw Exp $"
|
// "$Id: Fl_Tooltip.cxx,v 1.38.2.25 2002/10/29 19:45:10 easysw Exp $"
|
||||||
//
|
//
|
||||||
// Tooltip source file for the Fast Light Tool Kit (FLTK).
|
// Tooltip source file for the Fast Light Tool Kit (FLTK).
|
||||||
//
|
//
|
||||||
@ -55,7 +55,7 @@ public:
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
static Fl_Widget* widget;
|
Fl_Widget* Fl_Tooltip::widget_ = 0;
|
||||||
static Fl_TooltipBox *window = 0;
|
static Fl_TooltipBox *window = 0;
|
||||||
static int X,Y,W,H;
|
static int X,Y,W,H;
|
||||||
|
|
||||||
@ -70,7 +70,7 @@ void Fl_TooltipBox::layout() {
|
|||||||
int ox = Fl::event_x_root();
|
int ox = Fl::event_x_root();
|
||||||
//int ox = X+W/2;
|
//int ox = X+W/2;
|
||||||
int oy = Y + H+2;
|
int oy = Y + H+2;
|
||||||
for (Fl_Widget* p = widget; p; p = p->window()) {
|
for (Fl_Widget* p = Fl_Tooltip::current(); p; p = p->window()) {
|
||||||
//ox += p->x();
|
//ox += p->x();
|
||||||
oy += p->y();
|
oy += p->y();
|
||||||
}
|
}
|
||||||
@ -105,28 +105,57 @@ static char recursion;
|
|||||||
static void tooltip_timeout(void*) {
|
static void tooltip_timeout(void*) {
|
||||||
if (recursion) return;
|
if (recursion) return;
|
||||||
recursion = 1;
|
recursion = 1;
|
||||||
if (!tip || !*tip) return;
|
if (!tip || !*tip) {
|
||||||
//if (Fl::grab()) return;
|
if (window) window->hide();
|
||||||
if (!window) window = new Fl_TooltipBox;
|
} else {
|
||||||
// this cast bypasses the normal Fl_Window label() code:
|
//if (Fl::grab()) return;
|
||||||
((Fl_Widget*)window)->label(tip);
|
if (!window) window = new Fl_TooltipBox;
|
||||||
window->layout();
|
// this cast bypasses the normal Fl_Window label() code:
|
||||||
window->redraw();
|
((Fl_Widget*)window)->label(tip);
|
||||||
// printf("tooltip_timeout: Showing window %p with tooltip \"%s\"...\n",
|
window->layout();
|
||||||
// window, tip ? tip : "(null)");
|
window->redraw();
|
||||||
window->show();
|
// printf("tooltip_timeout: Showing window %p with tooltip \"%s\"...\n",
|
||||||
|
// window, tip ? tip : "(null)");
|
||||||
|
window->show();
|
||||||
|
}
|
||||||
|
|
||||||
Fl::remove_timeout(recent_timeout);
|
Fl::remove_timeout(recent_timeout);
|
||||||
recent_tooltip = 1;
|
recent_tooltip = 1;
|
||||||
recursion = 0;
|
recursion = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Acts as though enter(widget) was done but does not pop up a
|
||||||
|
// tooltip. This is useful to prevent a tooltip from reappearing when
|
||||||
|
// a modal overlapping window is deleted. Fltk does this automatically
|
||||||
|
// when you click the mouse button.
|
||||||
|
void Fl_Tooltip::current(Fl_Widget* w) {
|
||||||
|
enter(0);
|
||||||
|
// find the enclosing group with a tooltip:
|
||||||
|
Fl_Widget* tw = w;
|
||||||
|
for (;;) {
|
||||||
|
if (!tw) return;
|
||||||
|
if (tw->tooltip()) break;
|
||||||
|
tw = tw->parent();
|
||||||
|
}
|
||||||
|
// act just like tt_enter() except we can remember a zero:
|
||||||
|
widget_ = w;
|
||||||
|
}
|
||||||
|
|
||||||
// This is called when a widget is destroyed:
|
// This is called when a widget is destroyed:
|
||||||
static void
|
static void
|
||||||
tt_exit(Fl_Widget *w) {
|
tt_exit(Fl_Widget *w) {
|
||||||
// printf("tt_exit(w=%p)\n", w);
|
// printf("tt_exit(w=%p)\n", w);
|
||||||
// printf(" widget=%p, window=%p\n", widget, window);
|
// printf(" widget=%p, window=%p\n", widget, window);
|
||||||
|
|
||||||
if (w && w == widget) Fl_Tooltip::enter_area(0,0,0,0,0,0);
|
if (!Fl_Tooltip::current()) return;
|
||||||
|
Fl_Tooltip::current(0);
|
||||||
|
Fl::remove_timeout(tooltip_timeout);
|
||||||
|
Fl::remove_timeout(recent_timeout);
|
||||||
|
if (window) window->hide();
|
||||||
|
if (recent_tooltip) {
|
||||||
|
if (Fl::event_state() & FL_BUTTONS) recent_tooltip = 0;
|
||||||
|
else Fl::add_timeout(.2f, recent_timeout);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@ -154,38 +183,29 @@ Fl_Tooltip::enter_area(Fl_Widget* wid, int x,int y,int w,int h, const char* t)
|
|||||||
// printf(" recursion=%d, window=%p\n", recursion, window);
|
// printf(" recursion=%d, window=%p\n", recursion, window);
|
||||||
|
|
||||||
if (recursion) return;
|
if (recursion) return;
|
||||||
if (t && *t && enabled()) { // there is a tooltip
|
if (!t || !*t || !enabled()) {
|
||||||
// do nothing if it is the same:
|
|
||||||
if (wid==widget && x==X && y==Y && w==W && h==H && t==tip) return;
|
|
||||||
Fl::remove_timeout(tooltip_timeout);
|
|
||||||
Fl::remove_timeout(recent_timeout);
|
|
||||||
// remember it:
|
|
||||||
widget = wid; X = x; Y = y; W = w; H = h; tip = t;
|
|
||||||
if (recent_tooltip || Fl_Tooltip::delay() < .1) {
|
|
||||||
// switch directly from a previous tooltip to the new one:
|
|
||||||
#ifdef WIN32
|
|
||||||
// possible fix for the Windows titlebar, it seems to want the
|
|
||||||
// window to be destroyed, moving it messes up the parenting:
|
|
||||||
if (window) window->hide();
|
|
||||||
#endif
|
|
||||||
tooltip_timeout(0);
|
|
||||||
} else {
|
|
||||||
if (window) window->hide();
|
|
||||||
Fl::add_timeout(Fl_Tooltip::delay(), tooltip_timeout);
|
|
||||||
}
|
|
||||||
} else { // no tooltip
|
|
||||||
if (!tip) return;
|
|
||||||
Fl::remove_timeout(tooltip_timeout);
|
|
||||||
Fl::remove_timeout(recent_timeout);
|
|
||||||
tip = 0;
|
|
||||||
widget = 0;
|
|
||||||
if (window) window->hide();
|
if (window) window->hide();
|
||||||
if (recent_tooltip) {
|
Fl::remove_timeout(tooltip_timeout);
|
||||||
if (Fl::event_state() & 0x7f00000 /*FL_BUTTONS*/)
|
Fl::remove_timeout(recent_timeout);
|
||||||
recent_tooltip = 0;
|
return;
|
||||||
else
|
}
|
||||||
Fl::add_timeout(.2, recent_timeout);
|
// do nothing if it is the same:
|
||||||
}
|
if (wid==widget_ && x==X && y==Y && w==W && h==H && t==tip) return;
|
||||||
|
Fl::remove_timeout(tooltip_timeout);
|
||||||
|
Fl::remove_timeout(recent_timeout);
|
||||||
|
// remember it:
|
||||||
|
widget_ = wid; X = x; Y = y; W = w; H = h; tip = t;
|
||||||
|
// popup the tooltip immediately if it was recently up:
|
||||||
|
if (recent_tooltip || Fl_Tooltip::delay() < .1) {
|
||||||
|
#ifdef WIN32
|
||||||
|
// possible fix for the Windows titlebar, it seems to want the
|
||||||
|
// window to be destroyed, moving it messes up the parenting:
|
||||||
|
if (window) window->hide();
|
||||||
|
#endif
|
||||||
|
tooltip_timeout(0);
|
||||||
|
} else {
|
||||||
|
if (window) window->hide();
|
||||||
|
Fl::add_timeout(Fl_Tooltip::delay(), tooltip_timeout);
|
||||||
}
|
}
|
||||||
|
|
||||||
// printf(" tip=\"%s\", window->shown()=%d\n", tip ? tip : "(null)",
|
// printf(" tip=\"%s\", window->shown()=%d\n", tip ? tip : "(null)",
|
||||||
@ -203,5 +223,5 @@ void Fl_Widget::tooltip(const char *tt) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// End of "$Id: Fl_Tooltip.cxx,v 1.38.2.24 2002/08/09 03:17:30 easysw Exp $".
|
// End of "$Id: Fl_Tooltip.cxx,v 1.38.2.25 2002/10/29 19:45:10 easysw Exp $".
|
||||||
//
|
//
|
||||||
|
Loading…
Reference in New Issue
Block a user