summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlbrecht Schlosser <albrechts.fltk@online.de>2017-05-22 14:34:38 +0000
committerAlbrecht Schlosser <albrechts.fltk@online.de>2017-05-22 14:34:38 +0000
commitc364bb73f6506f286a77949c05d6cad08f6e3c4b (patch)
treecc51a2d957a62251db91472d52a4745a301c6f6f
parent0489d790850d20b180bc7f5a5aebce8a03a5c1d2 (diff)
Make some methods of Fl_Tabs protected and/or virtual (STR #3211).
Patch proposed by Teklad (STR #3211, file #7): http://www.fltk.org/strfiles/3211/Fl_Tabs.H.patch with minor modifications and adjustments for FLTK 1.4.0. Method which() is now also virtual, as suggested by guyben in comment #24. git-svn-id: file:///fltk/svn/fltk/branches/branch-1.4@12243 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
-rw-r--r--CHANGES3
-rw-r--r--FL/Fl_Tabs.H32
2 files changed, 25 insertions, 10 deletions
diff --git a/CHANGES b/CHANGES
index 0ea50f43c..4d527c7e1 100644
--- a/CHANGES
+++ b/CHANGES
@@ -48,6 +48,9 @@ Changes in FLTK 1.4.0 Released: ??? ?? 2017
Other Improvements
- (add new items here)
+ - Some methods of Fl_Tabs are now virtual and/or protected for easier
+ subclassing without code duplication (STR #3211 and others).
+ To be continued...
- Separated Fl_Input_Choice.H and Fl_Input_Choice.cxx (STR #2750, #2752).
- Separated Fl_Spinner.H and Fl_Spinner.cxx (STR #2776).
- New method Fl_Spinner::wrap(int) allows to set wrap mode at bounds if
diff --git a/FL/Fl_Tabs.H b/FL/Fl_Tabs.H
index 06c23aee5..a3439fa0b 100644
--- a/FL/Fl_Tabs.H
+++ b/FL/Fl_Tabs.H
@@ -3,7 +3,7 @@
//
// Tab header file for the Fast Light Tool Kit (FLTK).
//
-// Copyright 1998-2010 by Bill Spitzak and others.
+// Copyright 1998-2017 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
@@ -199,20 +199,29 @@
such as using the arrow keys while at the left or right end of the tabs.
*/
class FL_EXPORT Fl_Tabs : public Fl_Group {
+
Fl_Widget *push_;
+
+protected:
+
int *tab_pos; // array of x-offsets of tabs per child + 1
int *tab_width; // array of widths of tabs per child + 1
int tab_count; // array size
- int tab_positions(); // allocate and calculate tab positions
- void clear_tab_positions();
- int tab_height();
- void draw_tab(int x1, int x2, int W, int H, Fl_Widget* o, int sel=0);
-protected:
Fl_Align tab_align_; // tab label alignment
- void redraw_tabs();
+
+ virtual void redraw_tabs();
+ virtual int tab_positions(); // allocate and calculate tab positions
+ virtual void clear_tab_positions();
+ virtual void draw_tab(int x1, int x2, int W, int H, Fl_Widget* o, int sel=0);
+ virtual int tab_height();
+
void draw();
public:
+
+ Fl_Tabs(int,int,int,int,const char * = 0);
+ virtual ~Fl_Tabs();
+
int handle(int);
Fl_Widget *value();
int value(Fl_Widget *);
@@ -228,10 +237,13 @@ public:
*/
Fl_Widget *push() const {return push_;}
int push(Fl_Widget *);
- Fl_Tabs(int,int,int,int,const char * = 0);
- Fl_Widget *which(int event_x, int event_y);
- ~Fl_Tabs();
+
+ // Returns the widget of the tab the user clicked on at event_x/event_y.
+ virtual Fl_Widget *which(int event_x, int event_y);
+
+ // Returns the position and size available to be used by its children.
void client_area(int &rx, int &ry, int &rw, int &rh, int tabh=0);
+
/**
Sets the tab label alignment.