FLTK 1.4.5: Fl_Tabs.H Source File

FLTK 1.4.5

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
248 class FL_EXPORT Fl_Tabs : public Fl_Group {
249
250 Fl_Widget *push_;
251
252protected:
253
254 int overflow_type;
255 int tab_offset;
256 int *tab_pos;
257 int *tab_width;
258 int *tab_flags;
259 int tab_count;
260 Fl_Align tab_align_;
261 int has_overflow_menu;
262
263 void take_focus(Fl_Widget *o);
264 int maybe_do_callback(Fl_Widget *o);
265 void check_overflow_menu();
266 void handle_overflow_menu();
267 void draw_overflow_menu_button();
268
269 int on_insert(Fl_Widget*, int) FL_OVERRIDE;
270 int on_move(int, int) FL_OVERRIDE;
271 void on_remove(int) FL_OVERRIDE;
272
273 virtual void redraw_tabs();
274 virtual int tab_positions(); // allocate and calculate tab positions
275 virtual void clear_tab_positions();
276 virtual void draw_tab(int x1, int x2, int W, int H, Fl_Widget* o, int flags, int sel);
277 virtual int tab_height();
278 virtual int hit_close(Fl_Widget *o, int event_x, int event_y);
279 virtual int hit_overflow_menu(int event_x, int event_y);
280 virtual int hit_tabs_area(int event_x, int event_y);
281
282 void draw() FL_OVERRIDE;
283
284public:
285
286 Fl_Tabs(int X, int Y, int W, int H, const char *L = 0);
287 ~Fl_Tabs() FL_OVERRIDE;
288
289 void resize(int, int, int, int) FL_OVERRIDE;
290 void show() FL_OVERRIDE;
291
292 int handle(int) FL_OVERRIDE;
293 Fl_Widget *value();
294 int value(Fl_Widget *);
295
306 Fl_Widget *push() const { return push_; }
307 int push(Fl_Widget *);
308
309 virtual Fl_Widget *which(int event_x, int event_y);
310 void client_area(int &rx, int &ry, int &rw, int &rh, int tabh=0);
311
323 void tab_align(Fl_Align a) { tab_align_ = a; }
324
330 Fl_Align tab_align() const { return tab_align_; }
331
332 enum {
333 OVERFLOW_COMPRESS = 0,
334 OVERFLOW_CLIP,
335 OVERFLOW_PULLDOWN,
336 OVERFLOW_DRAG
337 };
338
339 void handle_overflow(int ov);
340
341};
342
343#endif
Fl_Align
unsigned Fl_Align
FLTK type for alignment control.
Definition Enumerations.H:986
Fl_Group.H
Fl_Group and Fl_End classes.
Fl_Tabs::handle_overflow_menu
void handle_overflow_menu()
This is called when the user clicks the overflow pulldown menu button.
Definition Fl_Tabs.cxx:439
Fl_Tabs::redraw_tabs
virtual void redraw_tabs()
Redraw all tabs (and only the tabs).
Definition Fl_Tabs.cxx:516
Fl_Tabs::maybe_do_callback
int maybe_do_callback(Fl_Widget *o)
Set tab o as selected and call callbacks if needed.
Definition Fl_Tabs.cxx:405
Fl_Tabs::on_insert
int on_insert(Fl_Widget *, int) FL_OVERRIDE
Make sure that we redraw all tabs when new children are added.
Definition Fl_Tabs.cxx:45
Fl_Tabs::tab_width
int * tab_width
Array of widths of tabs per child.
Definition Fl_Tabs.H:257
Fl_Tabs::draw_overflow_menu_button
void draw_overflow_menu_button()
Draw square button-like graphics with a down arrow in the top or bottom right corner.
Definition Fl_Tabs.cxx:484
Fl_Tabs::has_overflow_menu
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:261
Fl_Tabs::check_overflow_menu
void check_overflow_menu()
Check if the tabs overflow and sets the has_overflow_menu flag accordingly.
Definition Fl_Tabs.cxx:374
Fl_Tabs::tab_offset
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:255
Fl_Tabs::push
Fl_Widget * push() const
Returns the tab group for the tab the user has currently down-clicked on and remains over until FL_RE...
Definition Fl_Tabs.H:306
Fl_Tabs::Fl_Tabs
Fl_Tabs(int X, int Y, int W, int H, const char *L=0)
Creates a new Fl_Tabs widget using the given position, size, and label string.
Definition Fl_Tabs.cxx:1093
Fl_Tabs::clear_tab_positions
virtual void clear_tab_positions()
Clear internal array of tab positions and widths.
Definition Fl_Tabs.cxx:1181
Fl_Tabs::handle
int handle(int) FL_OVERRIDE
Handle all events in the tabs area and forward the rest to the selected child.
Definition Fl_Tabs.cxx:532
Fl_Tabs::draw_tab
virtual void draw_tab(int x1, int x2, int W, int H, Fl_Widget *o, int flags, int sel)
Draw a tab in the top or bottom tabs area.
Definition Fl_Tabs.cxx:990
Fl_Tabs::show
void show() FL_OVERRIDE
Ensure proper placement of selected tab.
Definition Fl_Tabs.cxx:77
Fl_Tabs::tab_pos
int * tab_pos
Array of x-offsets of tabs per child + 1.
Definition Fl_Tabs.H:256
Fl_Tabs::tab_align
void tab_align(Fl_Align a)
Sets the tab label alignment.
Definition Fl_Tabs.H:323
Fl_Tabs::tab_count
int tab_count
Array size of tab positions etc.
Definition Fl_Tabs.H:259
Fl_Tabs::hit_close
virtual int hit_close(Fl_Widget *o, int event_x, int event_y)
Check whether the coordinates fall within the "close" button area of the tab.
Definition Fl_Tabs.cxx:315
Fl_Tabs::hit_overflow_menu
virtual int hit_overflow_menu(int event_x, int event_y)
Determine if the coordinates are in the area of the overflow menu button.
Definition Fl_Tabs.cxx:336
Fl_Tabs::resize
void resize(int, int, int, int) FL_OVERRIDE
Make sure that we redraw all tabs when the widget size changes.
Definition Fl_Tabs.cxx:71
Fl_Tabs::on_remove
void on_remove(int) FL_OVERRIDE
Make sure that we redraw all tabs when new children are removed.
Definition Fl_Tabs.cxx:57
Fl_Tabs::value
Fl_Widget * value()
Gets the currently visible widget/tab.
Definition Fl_Tabs.cxx:728
Fl_Tabs::tab_positions
virtual int tab_positions()
Calculate tab positions and widths.
Definition Fl_Tabs.cxx:128
Fl_Tabs::tab_align
Fl_Align tab_align() const
Gets the tab label alignment.
Definition Fl_Tabs.H:330
Fl_Tabs::OVERFLOW_PULLDOWN
@ OVERFLOW_PULLDOWN
Tabs that do not fit will be placed in a pull-down menu.
Definition Fl_Tabs.H:335
Fl_Tabs::OVERFLOW_DRAG
@ OVERFLOW_DRAG
The tab bar can be dragged horizontally to reveal additional tabs.
Definition Fl_Tabs.H:336
Fl_Tabs::OVERFLOW_CLIP
@ OVERFLOW_CLIP
Only the first tabs that fit will be displayed.
Definition Fl_Tabs.H:334
Fl_Tabs::OVERFLOW_COMPRESS
@ OVERFLOW_COMPRESS
Tabs will be compressed and overlaid on top of each other.
Definition Fl_Tabs.H:333
Fl_Tabs::on_move
int on_move(int, int) FL_OVERRIDE
Make sure that we redraw all tabs when children are moved.
Definition Fl_Tabs.cxx:51
Fl_Tabs::draw
void draw() FL_OVERRIDE
Draw the tabs area, the optional pulldown button, and all children.
Definition Fl_Tabs.cxx:788
Fl_Tabs::tab_flags
int * tab_flags
Array of tab flag of tabs per child.
Definition Fl_Tabs.H:258
Fl_Tabs::tab_height
virtual int tab_height()
Return space (height) in pixels usable for tabs.
Definition Fl_Tabs.cxx:258
Fl_Tabs::overflow_type
int overflow_type
Definition Fl_Tabs.H:254
Fl_Tabs::tab_align_
Fl_Align tab_align_
tab label alignment
Definition Fl_Tabs.H:260
Fl_Tabs::hit_tabs_area
virtual int hit_tabs_area(int event_x, int event_y)
Determine if the coordinates are within the tabs area.
Definition Fl_Tabs.cxx:357
Fl_Tabs::take_focus
void take_focus(Fl_Widget *o)
Take keyboard focus if o is not NULL.
Definition Fl_Tabs.cxx:393
Fl_Widget
Fl_Widget is the base class for all widgets in FLTK.
Definition Fl_Widget.H:112
Fl_Widget::flags
unsigned int flags() const
Gets the widget flags mask.
Definition Fl_Widget.H:158
FL_OVERRIDE
#define FL_OVERRIDE
This macro makes it safe to use the C++11 keyword override with older compilers.
Definition fl_attr.h:46