diff options
| author | Albrecht Schlosser <albrechts.fltk@online.de> | 2023-10-16 10:53:18 +0200 |
|---|---|---|
| committer | Albrecht Schlosser <albrechts.fltk@online.de> | 2023-10-16 13:33:40 +0200 |
| commit | 6ba7b49baf11e526d1ed19aef491db2cd120e55e (patch) | |
| tree | 1a13b19b4496ccc4d7552e7fc80a8f9234808e31 /FL | |
| parent | da5331b59210769b4e15f24a0b5237a7ec5bfc4d (diff) | |
Improve subclassing cababilities of Fl_Tile (STR 2791)
- remove static variables and functions
- make move_intersection() virtual
- add (protected) cursor access methods
These changes were inspired by STR 2791 where the user proposing an
enhancement was not able to subclass Fl_Tile properly. This commit
fixes the mentioned issues and enables subclassing without copying
internal code.
Diffstat (limited to 'FL')
| -rw-r--r-- | FL/Fl_Tile.H | 20 |
1 files changed, 17 insertions, 3 deletions
diff --git a/FL/Fl_Tile.H b/FL/Fl_Tile.H index af104a4eb..a7de02fea 100644 --- a/FL/Fl_Tile.H +++ b/FL/Fl_Tile.H @@ -1,7 +1,7 @@ // // Tile header file for the Fast Light Tool Kit (FLTK). // -// Copyright 1998-2016 by Bill Spitzak and others. +// Copyright 1998-2023 by Bill Spitzak and others. // // This library is free software. Distribution and use rights are outlined in // the file "COPYING" which should have been included with this file. If this @@ -29,10 +29,24 @@ public: int handle(int event) FL_OVERRIDE; Fl_Tile(int X, int Y, int W, int H, const char *L=0); void resize(int X, int Y, int W, int H) FL_OVERRIDE; - void move_intersection(int oldx, int oldy, int newx, int newy); + virtual void move_intersection(int oldx, int oldy, int newx, int newy); FL_DEPRECATED("in 1.4.0 - use move_intersection(p) instead", - void position(int oldx, int oldy, int newx, int newy)) { return move_intersection(oldx, oldy, newx, newy); } + void position(int oldx, int oldy, int newx, int newy)) { move_intersection(oldx, oldy, newx, newy); } void position(int x, int y) { Fl_Group::position(x, y); } + +protected: + int cursor_; ///< current cursor index (0..3) + Fl_Cursor *cursors_; ///< points at the array of 4 cursors (may be overridden) + + /** Returns the cursor for cursor index n. + \see Fl_Tile::set_cursor(int) + */ + + Fl_Cursor cursor(int n) { + return cursors_[n]; + } + + void set_cursor(int n); // set one of n (0..3) cursors }; #endif |
