summaryrefslogtreecommitdiff
path: root/FL
diff options
context:
space:
mode:
authorMichael R Sweet <michael.r.sweet@gmail.com>2001-08-01 21:24:49 +0000
committerMichael R Sweet <michael.r.sweet@gmail.com>2001-08-01 21:24:49 +0000
commitbd069130577e28b3b26dbb5637bb3172fe108e81 (patch)
treefcf77d8c891ad889902cc4f606b348374f2691bb /FL
parent3cb5ebe0e811f3db008085d985b7761725589a74 (diff)
First bunch of changes for the 1.1 branch - tooltips.
NOTE: looking into a problem with the tooltip not going away when you ESCape a window (close it)... git-svn-id: file:///fltk/svn/fltk/branches/branch-1.1@1514 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
Diffstat (limited to 'FL')
-rw-r--r--FL/Enumerations.H11
-rw-r--r--FL/Fl_Tooltip.H79
-rw-r--r--FL/Fl_Widget.H191
3 files changed, 147 insertions, 134 deletions
diff --git a/FL/Enumerations.H b/FL/Enumerations.H
index 71188640f..fb0a2aab5 100644
--- a/FL/Enumerations.H
+++ b/FL/Enumerations.H
@@ -1,5 +1,5 @@
//
-// "$Id: Enumerations.H,v 1.18.2.14 2001/01/22 15:13:37 easysw Exp $"
+// "$Id: Enumerations.H,v 1.18.2.14.2.1 2001/08/01 21:24:48 easysw Exp $"
//
// Enumerations for the Fast Light Tool Kit (FLTK).
//
@@ -55,8 +55,8 @@
//
#define FL_MAJOR_VERSION 1
-#define FL_MINOR_VERSION 0
-#define FL_PATCH_VERSION 11
+#define FL_MINOR_VERSION 1
+#define FL_PATCH_VERSION 0
#define FL_VERSION ((double)FL_MAJOR_VERSION + \
(double)FL_MINOR_VERSION * 0.01 + \
(double)FL_PATCH_VERSION * 0.0001)
@@ -82,7 +82,8 @@ enum Fl_Event { // events
FL_HIDE = 15,
FL_SHOW = 16,
FL_PASTE = 17,
- FL_SELECTIONCLEAR = 18
+ FL_SELECTIONCLEAR = 18,
+ FL_MOUSEWHEEL = 19
};
enum Fl_When { // Fl_Widget::when():
@@ -371,5 +372,5 @@ enum Fl_Damage {
#endif
//
-// End of "$Id: Enumerations.H,v 1.18.2.14 2001/01/22 15:13:37 easysw Exp $".
+// End of "$Id: Enumerations.H,v 1.18.2.14.2.1 2001/08/01 21:24:48 easysw Exp $".
//
diff --git a/FL/Fl_Tooltip.H b/FL/Fl_Tooltip.H
index 054c16786..8826fdff7 100644
--- a/FL/Fl_Tooltip.H
+++ b/FL/Fl_Tooltip.H
@@ -1,9 +1,9 @@
//
-// "$Id: Fl_Tooltip.H,v 1.16 2001/02/25 01:41:19 clip Exp $"
+// "$Id: Fl_Tooltip.H,v 1.16.2.1 2001/08/01 21:24:48 easysw Exp $"
//
-// Tooltip definitions for the Fast Light Tool Kit (FLTK).
+// Tooltip header file for the Fast Light Tool Kit (FLTK).
//
-// Copyright 1998-1999 by Bill Spitzak and others.
+// Copyright 1998-2001 by Bill Spitzak and others.
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Library General Public
@@ -20,53 +20,60 @@
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
// USA.
//
-// Please report all bugs and problems to "fltk-bugs@easysw.com".
+// Please report all bugs and problems to "fltk-bugs@fltk.org".
//
-#ifndef _FL_TOOLTIP_H_
-#define _FL_TOOLTIP_H_
+#ifndef _Fl_Tooltip_H_
+#define _Fl_Tooltip_H_
#include <FL/Fl.H>
#include <FL/Fl_Widget.H>
-class FL_API Fl_Tooltip {
-public:
- static float delay() { return delay_; }
- static void delay(float f) { delay_ = f; }
- static int enabled() { return enabled_; }
- static void enable(int b = 1) { enabled_ = b; }
- static void disable() { enable(0); }
-
- // This is called when the pointer enters a widget,
- // Also enter(0) gets rid of any displayed or pending tooltip:
- static void (*enter)(Fl_Widget* w);
- // A widget may also pop up tooltips for internal parts by calling this:
- static void (*enter_area)(Fl_Widget* w, int X, int Y, int W, int H, const char* tip);
+class Fl_TooltipBox;
+class Fl_Menu_Window;
- // This is called when a widget is destroyed or hidden:
- static void (*exit)(Fl_Widget *w);
+FL_EXPORT class Fl_Tooltip {
- static Fl_Style* style() { return default_style; }
- static Fl_Font font() { return style()->label_font; }
- static void font(Fl_Font i) { style()->label_font = i; }
- static unsigned size() { return style()->label_size; }
- static void size(unsigned s) { style()->label_size = s; }
- static void color(Fl_Color c) { style()->color = c; }
- static Fl_Color color() { return style()->color; }
- static void textcolor(Fl_Color c) {style()->label_color = c; }
- static Fl_Color textcolor() { return style()->label_color; }
- static void boxtype(Fl_Boxtype b) {style()->box = b; }
- static Fl_Boxtype boxtype() { return style()->box; }
+ friend class Fl_TooltipBox;
+ friend class Fl_Widget;
-private:
- static Fl_Named_Style* default_style;
static float delay_;
- static int enabled_;
+ static Fl_TooltipBox *box;
+ static Fl_Menu_Window *window;
+ static Fl_Widget *widget;
+ static int shown;
+ static uchar color_;
+ static int font_;
+ static int size_;
+
+ static void tooltip_timeout(void *);
+ static void tooltip_exit(Fl_Widget *);
+
+ static void (*tooltip_callback_)(void *);
+ static void (*tooltip_exit_)(void *);
+
+public:
+
+ // These functions are user-called functions
+ static float tooltip_delay() { return delay_; }
+ static void tooltip_delay(float f) { delay_ = (f < 0.1) ? 0.1 : f; }
+ static int font() { return font_; }
+ static int size() { return size_; }
+ static void font(int i) { font_ = i; }
+ static void size(int s) { size_ = s; }
+ static void color(uchar c) { color_ = c; }
+ static uchar color() { return color_; }
+
+ static void enter(Fl_Widget *w);
+ static void exit(Fl_Widget *w);
+ static void enable() {tooltip_callback_ = tooltip_timeout; tooltip_exit_ = (void (*)(void *))tooltip_exit;}
+ static void disable() {tooltip_callback_ = 0; tooltip_exit_ = 0;}
};
+
#endif
//
-// End of "$Id: Fl_Tooltip.H,v 1.16 2001/02/25 01:41:19 clip Exp $".
+// End of "$Id: Fl_Tooltip.H,v 1.16.2.1 2001/08/01 21:24:48 easysw Exp $".
//
diff --git a/FL/Fl_Widget.H b/FL/Fl_Widget.H
index 09bace607..72e5b8b4e 100644
--- a/FL/Fl_Widget.H
+++ b/FL/Fl_Widget.H
@@ -1,5 +1,5 @@
//
-// "$Id: Fl_Widget.H,v 1.6.2.4 2001/01/22 15:13:38 easysw Exp $"
+// "$Id: Fl_Widget.H,v 1.6.2.4.2.1 2001/08/01 21:24:48 easysw Exp $"
//
// Widget header file for the Fast Light Tool Kit (FLTK).
//
@@ -27,6 +27,7 @@
#define Fl_Widget_H
#include "Enumerations.H"
+#include "Fl_Tooltip.H"
class Fl_Widget;
class Fl_Window;
@@ -46,7 +47,7 @@ struct Fl_Label {
FL_EXPORT void measure(int&, int&) const ;
};
-class Fl_Widget {
+FL_EXPORT class Fl_Widget {
friend class Fl_Group;
Fl_Widget* parent_;
@@ -63,6 +64,8 @@ class Fl_Widget {
uchar align_;
uchar when_;
+ const char *tooltip_;
+
// "de-implement" the copy constructors:
Fl_Widget & operator=(const Fl_Widget &);
FL_EXPORT Fl_Widget(const Fl_Widget &);
@@ -89,98 +92,100 @@ protected:
public:
- virtual FL_EXPORT ~Fl_Widget();
-
- virtual FL_EXPORT void draw() = 0;
- virtual FL_EXPORT int handle(int);
- FL_EXPORT Fl_Widget* parent() const {return parent_;}
- FL_EXPORT void parent(Fl_Widget* w) {parent_ = w;} // for hacks only
-
- FL_EXPORT uchar type() const {return type_;}
- FL_EXPORT void type(uchar t) {type_ = t;}
-
- FL_EXPORT int x() const {return x_;}
- FL_EXPORT int y() const {return y_;}
- FL_EXPORT int w() const {return w_;}
- FL_EXPORT int h() const {return h_;}
- virtual FL_EXPORT void resize(int,int,int,int);
- FL_EXPORT int damage_resize(int,int,int,int);
- FL_EXPORT void position(int X,int Y) {resize(X,Y,w_,h_);}
- FL_EXPORT void size(int W,int H) {resize(x_,y_,W,H);}
-
- FL_EXPORT Fl_Align align() const {return (Fl_Align)align_;}
- FL_EXPORT void align(uchar a) {align_ = a;}
- FL_EXPORT Fl_Boxtype box() const {return (Fl_Boxtype)box_;}
- FL_EXPORT void box(Fl_Boxtype a) {box_ = a;}
- FL_EXPORT Fl_Color color() const {return (Fl_Color)color_;}
- FL_EXPORT void color(uchar a) {color_ = a;}
- FL_EXPORT Fl_Color selection_color() const {return (Fl_Color)color2_;}
- FL_EXPORT void selection_color(uchar a) {color2_ = a;}
- FL_EXPORT void color(uchar a, uchar b) {color_=a; color2_=b;}
- FL_EXPORT const char* label() const {return label_.value;}
- FL_EXPORT void label(const char* a) {label_.value=a;}
- FL_EXPORT void label(Fl_Labeltype a,const char* b) {label_.type = a; label_.value = b;}
- FL_EXPORT Fl_Labeltype labeltype() const {return (Fl_Labeltype)label_.type;}
- FL_EXPORT void labeltype(Fl_Labeltype a) {label_.type = a;}
- FL_EXPORT Fl_Color labelcolor() const {return (Fl_Color)label_.color;}
- FL_EXPORT void labelcolor(uchar a) {label_.color=a;}
- FL_EXPORT Fl_Font labelfont() const {return (Fl_Font)label_.font;}
- FL_EXPORT void labelfont(uchar a) {label_.font=a;}
- FL_EXPORT uchar labelsize() const {return label_.size;}
- FL_EXPORT void labelsize(uchar a) {label_.size=a;}
- FL_EXPORT Fl_Callback_p callback() const {return callback_;}
- FL_EXPORT void callback(Fl_Callback* c, void* p) {callback_=c; user_data_=p;}
- FL_EXPORT void callback(Fl_Callback* c) {callback_=c;}
- FL_EXPORT void callback(Fl_Callback0*c) {callback_=(Fl_Callback*)c;}
- FL_EXPORT void callback(Fl_Callback1*c, long p=0) {callback_=(Fl_Callback*)c; user_data_=(void*)p;}
- FL_EXPORT void* user_data() const {return user_data_;}
- FL_EXPORT void user_data(void* v) {user_data_ = v;}
- FL_EXPORT long argument() const {return (long)user_data_;}
- FL_EXPORT void argument(long v) {user_data_ = (void*)v;}
- FL_EXPORT Fl_When when() const {return (Fl_When)when_;}
- FL_EXPORT void when(uchar i) {when_ = i;}
-
- FL_EXPORT int visible() const {return !(flags_&INVISIBLE);}
- FL_EXPORT int visible_r() const;
- FL_EXPORT void show();
- FL_EXPORT void hide();
- FL_EXPORT void set_visible() {flags_ &= ~INVISIBLE;}
- FL_EXPORT void clear_visible() {flags_ |= INVISIBLE;}
- FL_EXPORT int active() const {return !(flags_&INACTIVE);}
- FL_EXPORT int active_r() const;
- FL_EXPORT void activate();
- FL_EXPORT void deactivate();
- FL_EXPORT int output() const {return (flags_&OUTPUT);}
- FL_EXPORT void set_output() {flags_ |= OUTPUT;}
- FL_EXPORT void clear_output() {flags_ &= ~OUTPUT;}
- FL_EXPORT int takesevents() const {return !(flags_&(INACTIVE|INVISIBLE|OUTPUT));}
- FL_EXPORT int changed() const {return flags_&CHANGED;}
- FL_EXPORT void set_changed() {flags_ |= CHANGED;}
- FL_EXPORT void clear_changed() {flags_ &= ~CHANGED;}
- FL_EXPORT int take_focus();
-
- static FL_EXPORT void default_callback(Fl_Widget*, void*);
- FL_EXPORT void do_callback() {callback_(this,user_data_);}
- FL_EXPORT void do_callback(Fl_Widget* o,void* arg=0) {callback_(o,arg);}
- FL_EXPORT void do_callback(Fl_Widget* o,long arg) {callback_(o,(void*)arg);}
- FL_EXPORT int test_shortcut();
- static FL_EXPORT int test_shortcut(const char*);
- FL_EXPORT int contains(const Fl_Widget*) const ;
- FL_EXPORT int inside(const Fl_Widget* o) const {return o ? o->contains(this) : 0;}
-
- FL_EXPORT void redraw();
- FL_EXPORT uchar damage() const {return damage_;}
- FL_EXPORT void clear_damage(uchar c = 0) {damage_ = c;}
- FL_EXPORT void damage(uchar c);
- FL_EXPORT void damage(uchar c,int,int,int,int);
- FL_EXPORT void draw_label(int, int, int, int, Fl_Align) const;
- FL_EXPORT void measure_label(int& x, int& y) {label_.measure(x,y);}
-
- FL_EXPORT Fl_Window* window() const ;
+ virtual ~Fl_Widget();
+
+ virtual void draw() = 0;
+ virtual int handle(int);
+ Fl_Widget* parent() const {return parent_;}
+ void parent(Fl_Widget* w) {parent_ = w;} // for hacks only
+
+ uchar type() const {return type_;}
+ void type(uchar t) {type_ = t;}
+
+ int x() const {return x_;}
+ int y() const {return y_;}
+ int w() const {return w_;}
+ int h() const {return h_;}
+ virtual void resize(int,int,int,int);
+ int damage_resize(int,int,int,int);
+ void position(int X,int Y) {resize(X,Y,w_,h_);}
+ void size(int W,int H) {resize(x_,y_,W,H);}
+
+ Fl_Align align() const {return (Fl_Align)align_;}
+ void align(uchar a) {align_ = a;}
+ Fl_Boxtype box() const {return (Fl_Boxtype)box_;}
+ void box(Fl_Boxtype a) {box_ = a;}
+ Fl_Color color() const {return (Fl_Color)color_;}
+ void color(uchar a) {color_ = a;}
+ Fl_Color selection_color() const {return (Fl_Color)color2_;}
+ void selection_color(uchar a) {color2_ = a;}
+ void color(uchar a, uchar b) {color_=a; color2_=b;}
+ const char* label() const {return label_.value;}
+ void label(const char* a) {label_.value=a;}
+ void label(Fl_Labeltype a,const char* b) {label_.type = a; label_.value = b;}
+ Fl_Labeltype labeltype() const {return (Fl_Labeltype)label_.type;}
+ void labeltype(Fl_Labeltype a) {label_.type = a;}
+ Fl_Color labelcolor() const {return (Fl_Color)label_.color;}
+ void labelcolor(uchar a) {label_.color=a;}
+ Fl_Font labelfont() const {return (Fl_Font)label_.font;}
+ void labelfont(uchar a) {label_.font=a;}
+ uchar labelsize() const {return label_.size;}
+ void labelsize(uchar a) {label_.size=a;}
+ const char *tooltip() const {return tooltip_;}
+ void tooltip(const char *t) {Fl_Tooltip::enable(); tooltip_ = t;}
+ Fl_Callback_p callback() const {return callback_;}
+ void callback(Fl_Callback* c, void* p) {callback_=c; user_data_=p;}
+ void callback(Fl_Callback* c) {callback_=c;}
+ void callback(Fl_Callback0*c) {callback_=(Fl_Callback*)c;}
+ void callback(Fl_Callback1*c, long p=0) {callback_=(Fl_Callback*)c; user_data_=(void*)p;}
+ void* user_data() const {return user_data_;}
+ void user_data(void* v) {user_data_ = v;}
+ long argument() const {return (long)user_data_;}
+ void argument(long v) {user_data_ = (void*)v;}
+ Fl_When when() const {return (Fl_When)when_;}
+ void when(uchar i) {when_ = i;}
+
+ int visible() const {return !(flags_&INVISIBLE);}
+ int visible_r() const;
+ void show();
+ void hide();
+ void set_visible() {flags_ &= ~INVISIBLE;}
+ void clear_visible() {flags_ |= INVISIBLE;}
+ int active() const {return !(flags_&INACTIVE);}
+ int active_r() const;
+ void activate();
+ void deactivate();
+ int output() const {return (flags_&OUTPUT);}
+ void set_output() {flags_ |= OUTPUT;}
+ void clear_output() {flags_ &= ~OUTPUT;}
+ int takesevents() const {return !(flags_&(INACTIVE|INVISIBLE|OUTPUT));}
+ int changed() const {return flags_&CHANGED;}
+ void set_changed() {flags_ |= CHANGED;}
+ void clear_changed() {flags_ &= ~CHANGED;}
+ int take_focus();
+
+ static void default_callback(Fl_Widget*, void*);
+ void do_callback() {callback_(this,user_data_);}
+ void do_callback(Fl_Widget* o,void* arg=0) {callback_(o,arg);}
+ void do_callback(Fl_Widget* o,long arg) {callback_(o,(void*)arg);}
+ int test_shortcut();
+ static int test_shortcut(const char*);
+ int contains(const Fl_Widget*) const ;
+ int inside(const Fl_Widget* o) const {return o ? o->contains(this) : 0;}
+
+ void redraw();
+ uchar damage() const {return damage_;}
+ void clear_damage(uchar c = 0) {damage_ = c;}
+ void damage(uchar c);
+ void damage(uchar c,int,int,int,int);
+ void draw_label(int, int, int, int, Fl_Align) const;
+ void measure_label(int& x, int& y) {label_.measure(x,y);}
+
+ Fl_Window* window() const ;
// back compatability only:
- FL_EXPORT Fl_Color color2() const {return (Fl_Color)color2_;}
- FL_EXPORT void color2(uchar a) {color2_ = a;}
+ Fl_Color color2() const {return (Fl_Color)color2_;}
+ void color2(uchar a) {color2_ = a;}
};
// reserved type numbers (necessary for my cheapo RTTI) start here.
@@ -191,5 +196,5 @@ public:
#endif
//
-// End of "$Id: Fl_Widget.H,v 1.6.2.4 2001/01/22 15:13:38 easysw Exp $".
+// End of "$Id: Fl_Widget.H,v 1.6.2.4.2.1 2001/08/01 21:24:48 easysw Exp $".
//