FLTK 1.4.1
Loading...
Searching...
No Matches
Fl_Tabs.H
1//
2// Tab header file for the Fast Light Tool Kit (FLTK).
3//
4// Copyright 1998-2023 by Bill Spitzak and others.
5//
6// This library is free software. Distribution and use rights are outlined in
7// the file "COPYING" which should have been included with this file. If this
8// file is missing or damaged, see the license at:
9//
10// https://www.fltk.org/COPYING.php
11//
12// Please see the following page on how to report bugs and issues:
13//
14// https://www.fltk.org/bugs.php
15//
16
17/* \file
18 Fl_Tabs widget . */
19
20#ifndef Fl_Tabs_H
21#define Fl_Tabs_H
22
23#include "Fl_Group.H"
24
25struct Fl_Menu_Item;
26
239class FL_EXPORT Fl_Tabs : public Fl_Group {
240
241 Fl_Widget *push_;
242
243protected:
244
247 int *tab_pos;
253
254 void take_focus(Fl_Widget *o);
255 int maybe_do_callback(Fl_Widget *o);
256 void check_overflow_menu();
257 void handle_overflow_menu();
258 void draw_overflow_menu_button();
259
261 int on_move(int, int) FL_OVERRIDE;
262 void on_remove(int) FL_OVERRIDE;
263
264 virtual void redraw_tabs();
265 virtual int tab_positions(); // allocate and calculate tab positions
266 virtual void clear_tab_positions();
267 virtual void draw_tab(int x1, int x2, int W, int H, Fl_Widget* o, int flags, int sel);
268 virtual int tab_height();
269 virtual int hit_close(Fl_Widget *o, int event_x, int event_y);
270 virtual int hit_overflow_menu(int event_x, int event_y);
271 virtual int hit_tabs_area(int event_x, int event_y);
272
273 void draw() FL_OVERRIDE;
274
275public:
276
277 Fl_Tabs(int X, int Y, int W, int H, const char *L = 0);
279
280 void resize(int, int, int, int) FL_OVERRIDE;
281 void show() FL_OVERRIDE;
282
283 int handle(int) FL_OVERRIDE;
284 Fl_Widget *value();
285 int value(Fl_Widget *);
286
297 Fl_Widget *push() const { return push_; }
298 int push(Fl_Widget *);
299
300 virtual Fl_Widget *which(int event_x, int event_y);
301 void client_area(int &rx, int &ry, int &rw, int &rh, int tabh=0);
302
314 void tab_align(Fl_Align a) { tab_align_ = a; }
315
321 Fl_Align tab_align() const { return tab_align_; }
322
323 enum {
324 OVERFLOW_COMPRESS = 0,
327 OVERFLOW_DRAG
328 };
329
330 void handle_overflow(int ov);
331
332};
333
334#endif
unsigned Fl_Align
FLTK type for alignment control.
Definition Enumerations.H:977
Fl_Group and Fl_End classes.
The Fl_Group class is the main FLTK container widget.
Definition Fl_Group.H:56
virtual void on_remove(int)
Allow derived groups to act when a child widget is removed from the group.
Definition Fl_Group.cxx:571
virtual int on_move(int, int)
Allow derived groups to act when a widget is moved within the group.
Definition Fl_Group.cxx:499
void draw() FL_OVERRIDE
Draws the widget.
Definition Fl_Group.cxx:943
virtual int on_insert(Fl_Widget *, int)
Allow derived groups to act when a widget is added as a child.
Definition Fl_Group.cxx:475
The Fl_Tabs widget is a container widget that displays a set of tabs, with each tab representing a di...
Definition Fl_Tabs.H:239
int * tab_width
Array of widths of tabs per child.
Definition Fl_Tabs.H:248
int has_overflow_menu
set in OVERFLOW_PULLDOWN mode if tabs overflow. The actual menu array is created only on demand
Definition Fl_Tabs.H:252
@ OVERFLOW_PULLDOWN
Tabs that do not fit will be placed in a pull-down menu.
Definition Fl_Tabs.H:326
@ OVERFLOW_CLIP
Only the first tabs that fit will be displayed.
Definition Fl_Tabs.H:325
int tab_offset
for pulldown and drag overflow, this is the horizontal offset when the tabs bar is dragged by the use...
Definition Fl_Tabs.H:246
int * tab_pos
Array of x-offsets of tabs per child + 1.
Definition Fl_Tabs.H:247
void tab_align(Fl_Align a)
Sets the tab label alignment.
Definition Fl_Tabs.H:314
int tab_count
Array size of tab positions etc.
Definition Fl_Tabs.H:250
Fl_Align tab_align() const
Gets the tab label alignment.
Definition Fl_Tabs.H:321
int * tab_flags
Array of tab flag of tabs per child.
Definition Fl_Tabs.H:249
int overflow_type
Definition Fl_Tabs.H:245
Fl_Align tab_align_
tab label alignment
Definition Fl_Tabs.H:251
Fl_Widget is the base class for all widgets in FLTK.
Definition Fl_Widget.H:112
int take_focus()
Gives the widget the keyboard focus.
Definition Fl_Widget.cxx:150
#define FL_OVERRIDE
This macro makes it safe to use the C++11 keyword override with older compilers.
Definition fl_attr.h:46
The Fl_Menu_Item structure defines a single menu item that is used by the Fl_Menu_ class.
Definition Fl_Menu_Item.H:124