You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

93 lines
3.0KB

  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. /* \file
  28. Fl_Tabs widget . */
  29. #ifndef Fl_Tabs_H
  30. #define Fl_Tabs_H
  31. #include "Fl_Group.H"
  32. /**
  33. The Fl_Tabs widget is the "file card tabs"
  34. interface that allows you to put lots and lots of buttons and
  35. switches in a panel, as popularized by many toolkits.
  36. \image html tabs.png
  37. \image latex tabs.png "Fl_Tabs" width=8cm
  38. Clicking the tab makes a child visible() by calling
  39. show() on it, and all other children are made invisible
  40. by calling hide() on them. Usually the children are Fl_Group widgets
  41. containing several widgets themselves.
  42. Each child makes a card, and its label() is printed
  43. on the card tab, including the label font and style. The
  44. selection color of that child is used to color the tab, while
  45. the color of the child determines the background color of the pane.
  46. The size of the tabs is controlled by the bounding box of the
  47. children (there should be some space between the children and
  48. the edge of the Fl_Tabs), and the tabs may be placed
  49. "inverted" on the bottom - this is determined by which
  50. gap is larger. It is easiest to lay this out in fluid, using the
  51. fluid browser to select each child group and resize them until
  52. the tabs look the way you want them to.
  53. */
  54. class FL_EXPORT Fl_Tabs : public Fl_Group {
  55. Fl_Widget *value_;
  56. Fl_Widget *push_;
  57. int *tab_pos; // array of x-offsets of tabs per child + 1
  58. int *tab_width; // array of widths of tabs per child + 1
  59. int tab_count; // array size
  60. int tab_positions(); // allocate and calculate tab positions
  61. void clear_tab_positions();
  62. int tab_height();
  63. void draw_tab(int x1, int x2, int W, int H, Fl_Widget* o, int sel=0);
  64. protected:
  65. void redraw_tabs();
  66. void draw();
  67. public:
  68. int handle(int);
  69. Fl_Widget *value();
  70. int value(Fl_Widget *);
  71. Fl_Widget *push() const {return push_;}
  72. int push(Fl_Widget *);
  73. Fl_Tabs(int,int,int,int,const char * = 0);
  74. Fl_Widget *which(int event_x, int event_y);
  75. ~Fl_Tabs();
  76. void client_area(int &rx, int &ry, int &rw, int &rh, int tabh=0);
  77. };
  78. #endif
  79. //
  80. // End of "$Id: Fl_Tabs.H 8101 2010-12-22 13:06:03Z AlbrechtS $".
  81. //