diff options
| author | Michael R Sweet <michael.r.sweet@gmail.com> | 2001-08-05 23:58:54 +0000 |
|---|---|---|
| committer | Michael R Sweet <michael.r.sweet@gmail.com> | 2001-08-05 23:58:54 +0000 |
| commit | 7ebaf77cdcbcadb4706c87f1662730a4687caf20 (patch) | |
| tree | 07340f24b863b23f716b9cf9f657026c76c62fbf /FL | |
| parent | 208cf399a6ab801951bf28a82a0e07adefc60028 (diff) | |
Image labels!
image() method to set active image, deimage() method to set inactive image.
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.1@1560 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
Diffstat (limited to 'FL')
| -rw-r--r-- | FL/Enumerations.H | 50 | ||||
| -rw-r--r-- | FL/Fl_Bitmap.H | 29 | ||||
| -rw-r--r-- | FL/Fl_Image.H | 43 | ||||
| -rw-r--r-- | FL/Fl_Pixmap.H | 36 | ||||
| -rw-r--r-- | FL/Fl_Widget.H | 13 | ||||
| -rw-r--r-- | FL/fl_draw.H | 15 |
6 files changed, 115 insertions, 71 deletions
diff --git a/FL/Enumerations.H b/FL/Enumerations.H index ae39d371e..05ce6caf8 100644 --- a/FL/Enumerations.H +++ b/FL/Enumerations.H @@ -1,5 +1,5 @@ // -// "$Id: Enumerations.H,v 1.18.2.14.2.3 2001/08/04 12:21:33 easysw Exp $" +// "$Id: Enumerations.H,v 1.18.2.14.2.4 2001/08/05 23:58:54 easysw Exp $" // // Enumerations for the Fast Light Tool Kit (FLTK). // @@ -62,10 +62,11 @@ enum Fl_Event { // events FL_DRAG = 5, FL_FOCUS = 6, FL_UNFOCUS = 7, - FL_KEYBOARD = 8, - FL_CLOSE = 9, - FL_MOVE = 10, - FL_SHORTCUT = 11, + FL_KEYDOWN = 8, + FL_KEYUP = 9, + FL_CLOSE = 10, + FL_MOVE = 11, + FL_SHORTCUT = 12, FL_DEACTIVATE = 13, FL_ACTIVATE = 14, FL_HIDE = 15, @@ -74,6 +75,7 @@ enum Fl_Event { // events FL_SELECTIONCLEAR = 18, FL_MOUSEWHEEL = 19 }; +#define FL_KEYBOARD FL_KEYDOWN enum Fl_When { // Fl_Widget::when(): FL_WHEN_NEVER = 0, @@ -215,23 +217,25 @@ extern Fl_Labeltype FL_EXPORT define_FL_EMBOSSED_LABEL(); #define FL_EMBOSSED_LABEL define_FL_EMBOSSED_LABEL() enum Fl_Align { // align() values - FL_ALIGN_CENTER = 0, - FL_ALIGN_TOP = 1, - FL_ALIGN_BOTTOM = 2, - FL_ALIGN_LEFT = 4, - FL_ALIGN_RIGHT = 8, - FL_ALIGN_INSIDE = 16, - FL_ALIGN_CLIP = 64, - FL_ALIGN_WRAP = 128, - FL_ALIGN_TOP_LEFT = FL_ALIGN_TOP | FL_ALIGN_LEFT, - FL_ALIGN_TOP_RIGHT = FL_ALIGN_TOP | FL_ALIGN_RIGHT, - FL_ALIGN_BOTTOM_LEFT = FL_ALIGN_BOTTOM | FL_ALIGN_LEFT, - FL_ALIGN_BOTTOM_RIGHT = FL_ALIGN_BOTTOM | FL_ALIGN_RIGHT, - FL_ALIGN_LEFT_TOP = FL_ALIGN_TOP_LEFT, - FL_ALIGN_RIGHT_TOP = FL_ALIGN_TOP_RIGHT, - FL_ALIGN_LEFT_BOTTOM = FL_ALIGN_BOTTOM_LEFT, - FL_ALIGN_RIGHT_BOTTOM = FL_ALIGN_BOTTOM_RIGHT, - FL_ALIGN_NOWRAP = 0 // for back compatability + FL_ALIGN_CENTER = 0, + FL_ALIGN_TOP = 1, + FL_ALIGN_BOTTOM = 2, + FL_ALIGN_LEFT = 4, + FL_ALIGN_RIGHT = 8, + FL_ALIGN_INSIDE = 16, + FL_ALIGN_TEXT_OVER_IMAGE = 32, + FL_ALIGN_IMAGE_OVER_TEXT = 0, + FL_ALIGN_CLIP = 64, + FL_ALIGN_WRAP = 128, + FL_ALIGN_TOP_LEFT = FL_ALIGN_TOP | FL_ALIGN_LEFT, + FL_ALIGN_TOP_RIGHT = FL_ALIGN_TOP | FL_ALIGN_RIGHT, + FL_ALIGN_BOTTOM_LEFT = FL_ALIGN_BOTTOM | FL_ALIGN_LEFT, + FL_ALIGN_BOTTOM_RIGHT = FL_ALIGN_BOTTOM | FL_ALIGN_RIGHT, + FL_ALIGN_LEFT_TOP = FL_ALIGN_TOP_LEFT, + FL_ALIGN_RIGHT_TOP = FL_ALIGN_TOP_RIGHT, + FL_ALIGN_LEFT_BOTTOM = FL_ALIGN_BOTTOM_LEFT, + FL_ALIGN_RIGHT_BOTTOM = FL_ALIGN_BOTTOM_RIGHT, + FL_ALIGN_NOWRAP = 0 // for back compatability }; enum Fl_Font { // standard fonts @@ -365,5 +369,5 @@ enum Fl_Damage { #endif // -// End of "$Id: Enumerations.H,v 1.18.2.14.2.3 2001/08/04 12:21:33 easysw Exp $". +// End of "$Id: Enumerations.H,v 1.18.2.14.2.4 2001/08/05 23:58:54 easysw Exp $". // diff --git a/FL/Fl_Bitmap.H b/FL/Fl_Bitmap.H index 994b31d2f..03256caa7 100644 --- a/FL/Fl_Bitmap.H +++ b/FL/Fl_Bitmap.H @@ -1,5 +1,5 @@ // -// "$Id: Fl_Bitmap.H,v 1.5.2.3 2001/01/22 15:13:37 easysw Exp $" +// "$Id: Fl_Bitmap.H,v 1.5.2.3.2.1 2001/08/05 23:58:54 easysw Exp $" // // Bitmap header file for the Fast Light Tool Kit (FLTK). // @@ -25,27 +25,30 @@ #ifndef Fl_Bitmap_H #define Fl_Bitmap_H +# include "Fl_Image.H" class Fl_Widget; struct Fl_Menu_Item; -struct Fl_Bitmap { +class FL_EXPORT Fl_Bitmap : public Fl_Image { + public: + const uchar *array; - int w, h; ulong id; // for internal use - FL_EXPORT Fl_Bitmap(const uchar *bits, int W, int H) : - array(bits), w(W), h(H), id(0) {} - FL_EXPORT Fl_Bitmap(const char *bits, int W, int H) : - array((const uchar *)bits), w(W), h(H), id(0) {} - FL_EXPORT ~Fl_Bitmap(); - FL_EXPORT void label(Fl_Widget*); - FL_EXPORT void label(Fl_Menu_Item*); - FL_EXPORT void draw(int X, int Y, int W, int H, int cx=0, int cy=0); - FL_EXPORT void draw(int X, int Y) {draw(X, Y, w, h, 0, 0);} + + Fl_Bitmap(const uchar *bits, int W, int H) : + Fl_Image(W,H), array(bits), id(0) {} + Fl_Bitmap(const char *bits, int W, int H) : + Fl_Image(W,H), array((const uchar *)bits), id(0) {} + virtual ~Fl_Bitmap(); + virtual void draw(int X, int Y, int W, int H, int cx=0, int cy=0); + void draw(int X, int Y) {draw(X, Y, w(), h(), 0, 0);} + virtual void label(Fl_Widget*w); + virtual void label(Fl_Menu_Item*m); }; #endif // -// End of "$Id: Fl_Bitmap.H,v 1.5.2.3 2001/01/22 15:13:37 easysw Exp $". +// End of "$Id: Fl_Bitmap.H,v 1.5.2.3.2.1 2001/08/05 23:58:54 easysw Exp $". // diff --git a/FL/Fl_Image.H b/FL/Fl_Image.H index 8e7bb219c..e0a9f29f8 100644 --- a/FL/Fl_Image.H +++ b/FL/Fl_Image.H @@ -1,5 +1,5 @@ // -// "$Id: Fl_Image.H,v 1.5.2.3 2001/01/22 15:13:37 easysw Exp $" +// "$Id: Fl_Image.H,v 1.5.2.3.2.1 2001/08/05 23:58:54 easysw Exp $" // // Image header file for the Fast Light Tool Kit (FLTK). // @@ -29,21 +29,42 @@ class Fl_Widget; struct Fl_Menu_Item; -struct Fl_Image { +class FL_EXPORT Fl_Image { + int w_, h_; + + public: + + int w() const {return w_;} + void w(int W) {w_ = W;} + int h() const {return h_;} + void h(int H) {h_ = H;} + + Fl_Image(int W, int H) {w_ = W; h_ = H;} + virtual ~Fl_Image(); + virtual void label(Fl_Widget*w); + virtual void label(Fl_Menu_Item*m); + virtual void draw(int X, int Y, int W, int H, int cx=0, int cy=0); + void draw(int X, int Y) {draw(X, Y, w(), h(), 0, 0);} +}; + +class FL_EXPORT Fl_RGB_Image : public Fl_Image { + public: + const uchar *array; - int w, h, d, ld; + int d, ld; ulong id; // for internal use - FL_EXPORT Fl_Image(const uchar *bits, int W, int H, int D=3, int LD=0) : - array(bits), w(W), h(H), d(D), ld(LD), id(0) {} - FL_EXPORT ~Fl_Image(); - FL_EXPORT void label(Fl_Widget*); - FL_EXPORT void label(Fl_Menu_Item*); - FL_EXPORT void draw(int X, int Y, int W, int H, int cx=0, int cy=0); - FL_EXPORT void draw(int X, int Y) {draw(X, Y, w, h, 0, 0);} + + Fl_RGB_Image(const uchar *bits, int W, int H, int D=3, int LD=0) : + Fl_Image(W,H), array(bits), d(D), ld(LD), id(0) {} + virtual ~Fl_RGB_Image(); + virtual void draw(int X, int Y, int W, int H, int cx=0, int cy=0); + void draw(int X, int Y) {draw(X, Y, w(), h(), 0, 0);} + virtual void label(Fl_Widget*w); + virtual void label(Fl_Menu_Item*m); }; #endif // -// End of "$Id: Fl_Image.H,v 1.5.2.3 2001/01/22 15:13:37 easysw Exp $". +// End of "$Id: Fl_Image.H,v 1.5.2.3.2.1 2001/08/05 23:58:54 easysw Exp $". // diff --git a/FL/Fl_Pixmap.H b/FL/Fl_Pixmap.H index b663f755b..31d99c673 100644 --- a/FL/Fl_Pixmap.H +++ b/FL/Fl_Pixmap.H @@ -1,5 +1,5 @@ // -// "$Id: Fl_Pixmap.H,v 1.6.2.8 2001/06/07 13:16:08 easysw Exp $" +// "$Id: Fl_Pixmap.H,v 1.6.2.8.2.1 2001/08/05 23:58:54 easysw Exp $" // // Pixmap header file for the Fast Light Tool Kit (FLTK). // @@ -25,33 +25,33 @@ #ifndef Fl_Pixmap_H #define Fl_Pixmap_H +# include "Fl_Image.H" class Fl_Widget; struct Fl_Menu_Item; -// Older C++ compilers don't support the explicit keyword... :( -#if defined(__sgi) && !defined(_COMPILER_VERSION) -#define explicit -#endif // __sgi && !_COMPILER_VERSION +class FL_EXPORT Fl_Pixmap : public Fl_Image { + void measure(); + + public: -struct Fl_Pixmap { const char * const * data; - int w, h; // set by first draw... - ulong id; // for internal use (the pixmap) + ulong id; // for internal use ulong mask; // for internal use (mask bitmap) - explicit Fl_Pixmap(char * const * d) : data((const char*const*)d), w(-1), h(0), id(0),mask(0) {} - explicit Fl_Pixmap(uchar* const * d) : data((const char*const*)d), w(-1), h(0), id(0),mask(0) {} - explicit Fl_Pixmap(const char * const * d) : data(d), w(-1), h(0), id(0),mask(0) {} - explicit Fl_Pixmap(const uchar* const * d) : data((const char*const*)d), w(-1), h(0), id(0),mask(0) {} - FL_EXPORT ~Fl_Pixmap(); - FL_EXPORT void label(Fl_Widget*); - FL_EXPORT void label(Fl_Menu_Item*); - FL_EXPORT void draw(int X, int Y, int W, int H, int cx=0, int cy=0); - void draw(int X, int Y) {draw(X, Y, w, h, 0, 0);} + + explicit Fl_Pixmap(char * const * d) : Fl_Image(-1,0), data((const char*const*)d), id(0),mask(0) {measure();} + explicit Fl_Pixmap(uchar* const * d) : Fl_Image(-1,0), data((const char*const*)d), id(0),mask(0) {measure();} + explicit Fl_Pixmap(const char * const * d) : Fl_Image(-1,0), data(d), id(0),mask(0) {measure();} + explicit Fl_Pixmap(const uchar* const * d) : Fl_Image(-1,0), data((const char*const*)d), id(0),mask(0) {measure();} + virtual ~Fl_Pixmap(); + virtual void draw(int X, int Y, int W, int H, int cx=0, int cy=0); + void draw(int X, int Y) {draw(X, Y, w(), h(), 0, 0);} + virtual void label(Fl_Widget*w); + virtual void label(Fl_Menu_Item*m); }; #endif // -// End of "$Id: Fl_Pixmap.H,v 1.6.2.8 2001/06/07 13:16:08 easysw Exp $". +// End of "$Id: Fl_Pixmap.H,v 1.6.2.8.2.1 2001/08/05 23:58:54 easysw Exp $". // diff --git a/FL/Fl_Widget.H b/FL/Fl_Widget.H index 37530cbb3..3f5804188 100644 --- a/FL/Fl_Widget.H +++ b/FL/Fl_Widget.H @@ -1,5 +1,5 @@ // -// "$Id: Fl_Widget.H,v 1.6.2.4.2.4 2001/08/04 20:17:10 easysw Exp $" +// "$Id: Fl_Widget.H,v 1.6.2.4.2.5 2001/08/05 23:58:54 easysw Exp $" // // Widget header file for the Fast Light Tool Kit (FLTK). // @@ -30,6 +30,7 @@ class Fl_Widget; class Fl_Window; +class Fl_Image; typedef void (Fl_Callback )(Fl_Widget*, void*); typedef Fl_Callback* Fl_Callback_p; // needed for BORLAND @@ -38,6 +39,8 @@ typedef void (Fl_Callback1)(Fl_Widget*, long); struct Fl_Label { const char* value; + Fl_Image* image; + Fl_Image* deimage; uchar type; uchar font; uchar size; @@ -132,6 +135,12 @@ public: void labelfont(uchar a) {label_.font=a;} uchar labelsize() const {return label_.size;} void labelsize(uchar a) {label_.size=a;} + Fl_Image* image() {return label_.image;} + void image(Fl_Image* a) {label_.image=a;} + void image(Fl_Image& a) {label_.image=&a;} + Fl_Image* deimage() {return label_.deimage;} + void deimage(Fl_Image* a) {label_.deimage=a;} + void deimage(Fl_Image& a) {label_.deimage=&a;} const char *tooltip() const {return tooltip_;} void tooltip(const char *t); Fl_Callback_p callback() const {return callback_;} @@ -197,5 +206,5 @@ public: #endif // -// End of "$Id: Fl_Widget.H,v 1.6.2.4.2.4 2001/08/04 20:17:10 easysw Exp $". +// End of "$Id: Fl_Widget.H,v 1.6.2.4.2.5 2001/08/05 23:58:54 easysw Exp $". // diff --git a/FL/fl_draw.H b/FL/fl_draw.H index 50ab7a1f9..e33ed8a39 100644 --- a/FL/fl_draw.H +++ b/FL/fl_draw.H @@ -1,5 +1,5 @@ // -// "$Id: fl_draw.H,v 1.9.2.6.2.1 2001/08/04 12:21:33 easysw Exp $" +// "$Id: fl_draw.H,v 1.9.2.6.2.2 2001/08/05 23:58:54 easysw Exp $" // // Portable drawing function header file for the Fast Light Tool Kit (FLTK). // @@ -28,6 +28,12 @@ #include "Enumerations.H" // for the color names +// Image class... +class Fl_Image; + +// Label flags... +FL_EXPORT extern char fl_draw_shortcut; + // Colors: FL_EXPORT void fl_color(Fl_Color); // select indexed color inline void fl_color(int c) {fl_color((Fl_Color)c);} // for back compatability @@ -146,9 +152,10 @@ FL_EXPORT double fl_width(uchar); FL_EXPORT void fl_draw(const char*, int x, int y); FL_EXPORT void fl_draw(const char*, int n, int x, int y); FL_EXPORT void fl_measure(const char*, int& x, int& y); -FL_EXPORT void fl_draw(const char*, int,int,int,int, Fl_Align); +FL_EXPORT void fl_draw(const char*, int,int,int,int, Fl_Align, Fl_Image* img=0); FL_EXPORT void fl_draw(const char*, int,int,int,int, Fl_Align, - void (*callthis)(const char *, int n, int x, int y)); + void (*callthis)(const char *, int n, int x, int y), + Fl_Image* img=0); // boxtypes: FL_EXPORT void fl_frame(const char* s, int x, int y, int w, int h); @@ -184,5 +191,5 @@ FL_EXPORT int fl_add_symbol(const char* name, void (*drawit)(Fl_Color), int scal #endif // -// End of "$Id: fl_draw.H,v 1.9.2.6.2.1 2001/08/04 12:21:33 easysw Exp $". +// End of "$Id: fl_draw.H,v 1.9.2.6.2.2 2001/08/05 23:58:54 easysw Exp $". // |
