|void||pager (TabGroupPager *value)|
|setting the pager_ to a tabgroup, pager is _never_ null by design |
|TabGroupPager *||pager () const|
|returning the current pager_ responsible of this instance |
|bool||selected_child (Widget *)|
|Widget *||selected_child ()|
|TabGroup (int, int, int, int, const char *=0, bool begin=false)|
|int||value () const|
|int||which (int event_x, int event_y)|
|static void||default_pager (TabGroupPager *v)|
|setting the default pager_ for future tabgroups, a default pager is _never_ null by design |
|static void||default_pager (int factory_pager_index)|
|setting the default pager_ from the built-in ones |
|static NamedStyle *||default_style = &::style|
This is the "file card tabs" interface to allow you to put lots and lots of buttons and switches in a panel. This first appeared in NeXTStep, but is best known from Windows control panesl. FLTK's version draws in a style more reminiscent of NeXT or PageMaker, and avoids the confusing multiple-lines of Windows by drawing overlapping tabs.
Each child widget is a card, and it's label() is printed on the card tab (including the label font and style). The color() of the child is used to color the tab as well.
The size of the tabs is controlled by the bounding box of the children (there should be some space between the children and the edge of this widget). If there is a larger gap on the bottom than the top, the tabs are placed "inverted" along the bottom. It is easiest to lay this out in fluid, using the fluid browser to select each child group and resize them until the tabs look the way you want them to.
Clicking the tab makes that child visible() and hides all the other children. If the widget with the focus does not consume them, the ctrl+tab and ctrl+shift+tab keys will also switch tabs. The user can also navigate the focus to the tabs and change them with the arrow keys.
The callback() of the TabGroup widget is called when the user changes the visible tab, and SHOW and HIDE events are passed to the children.
|const char *||l =
Creates a new TabGroup widget using the given position, size, and label string. Use add(widget) to add each child. Each child is probably an fltk::Group widget containing the actual widgets the user sees. The children should be sized to stay away from the top or bottom edge of the
fltk::Tabs, which is where the tabs are drawn.
Fltk calls this virtual function to draw the widget, after setting up the graphics (current window, xy translation, etc) so that any drawing functions will go into this widget.
User code should not call this! You probably want to call redraw().
The default version calls draw_box() and draw_label(), thus drawing the box() to fill the widget and putting the label() and image() inside it to fill it, unless the align() flags are set to put it outside.
Information on how to write your own version is here.
Reimplemented from fltk::Group.
|void TabGroup::pager||(||TabGroupPager *||value||)|
setting the pager_ to a tabgroup, pager is _never_ null by design
assign dynamically a new pager with a preconfigured prototype
|bool TabGroup::selected_child||(||Widget *||newvalue||)|
Switch to this child widget, or to a child that contains() this widget. Returns true if this is a different selection than before. Does not do the callback(). If the widget is null or not a descendent of this, the last child is selected.
Return the index of the first visible() child, which is normally the one the user selected.
This will automatically force a single child to be visible() if more than one is, or if none are. If more than one is visible all except the first is hidden. If none are, the last one is made visible. The resulting visible child's index is returned. This behavior allows new TabGroups to be created with all children visible, and allows children to be deleted, moved to other groups, and show()/hide() called on them without the display ever looking wrong to the user.
If there are no children then -1 is returned.
Switch so index n is selected. If n is less than zero selects zero, if n is greater than the children it selects the last one. Returns true if this is a different child than last time. Does not do the callback().
Return the child index that would be selected by a click at the given mouse position. Returns -1 if the mouse position is not in a tab.
The default style has a gray color() and the box() is set to THIN_UP_BOX. The box() is used to draw the edge around the cards, including the top edge, but the tab itself is designed only to match THIN_UP_BOX. You can also use FLAT_BOX and it will look correct if the tabs fill the entire width of a window or parent box.
Reimplemented from fltk::Widget.