1 //
2 // "$Id: Fl_Tabs.H 8101 2010-12-22 13:06:03Z AlbrechtS $"
3 //
4 // Tab header file for the Fast Light Tool Kit (FLTK).
5 //
6 // Copyright 1998-2010 by Bill Spitzak and others.
7 //
8 // This library is free software; you can redistribute it and/or
9 // modify it under the terms of the GNU Library General Public
10 // License as published by the Free Software Foundation; either
11 // version 2 of the License, or (at your option) any later version.
12 //
13 // This library is distributed in the hope that it will be useful,
14 // but WITHOUT ANY WARRANTY; without even the implied warranty of
15 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
16 // Library General Public License for more details.
17 //
18 // You should have received a copy of the GNU Library General Public
19 // License along with this library; if not, write to the Free Software
20 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
21 // USA.
22 //
23 // Please report all bugs and problems on the following page:
24 //
25 //     http://www.fltk.org/str.php
26 //
27 
28 /* \file
29    Fl_Tabs widget . */
30 
31 #ifndef Fl_Tabs_H
32 #define Fl_Tabs_H
33 
34 #include "Fl_Group.H"
35 
36 /**
37   The Fl_Tabs widget is the "file card tabs"
38   interface that allows you to put lots and lots of buttons and
39   switches in a panel, as popularized by many toolkits.
40 
41   \image html  tabs.png
42   \image latex tabs.png "Fl_Tabs" width=8cm
43 
44   Clicking the tab makes a child visible() by calling
45   show() on it, and all other children are made invisible
46   by calling hide() on them. Usually the children are Fl_Group widgets
47   containing several widgets themselves.
48 
49   Each child makes a card, and its label() is printed
50   on the card tab, including the label font and style.  The
51   selection color of that child is used to color the tab, while
52   the color of the child determines the background color of the pane.
53 
54   The size of the tabs is controlled by the bounding box of the
55   children (there should be some space between the children and
56   the edge of the Fl_Tabs), and the tabs may be placed
57   "inverted" on the bottom - this is determined by which
58   gap is larger. It is easiest to lay this out in fluid, using the
59   fluid browser to select each child group and resize them until
60   the tabs look the way you want them to.
61 */
62 class FL_EXPORT Fl_Tabs : public Fl_Group {
63   Fl_Widget *value_;
64   Fl_Widget *push_;
65   int *tab_pos;		// array of x-offsets of tabs per child + 1
66   int *tab_width;	// array of widths of tabs per child + 1
67   int tab_count;	// array size
68   int tab_positions();	// allocate and calculate tab positions
69   void clear_tab_positions();
70   int tab_height();
71   void draw_tab(int x1, int x2, int W, int H, Fl_Widget* o, int sel=0);
72 protected:
73   void redraw_tabs();
74   void draw();
75 
76 public:
77   int handle(int);
78   Fl_Widget *value();
79   int value(Fl_Widget *);
push()80   Fl_Widget *push() const {return push_;}
81   int push(Fl_Widget *);
82   Fl_Tabs(int,int,int,int,const char * = 0);
83   Fl_Widget *which(int event_x, int event_y);
84   ~Fl_Tabs();
85   void client_area(int &rx, int &ry, int &rw, int &rh, int tabh=0);
86 };
87 
88 #endif
89 
90 //
91 // End of "$Id: Fl_Tabs.H 8101 2010-12-22 13:06:03Z AlbrechtS $".
92 //
93