Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members

FXToolBarTab.h
Go to the documentation of this file.
1 /********************************************************************************
2 * *
3 * T o o l B a r T a b W i d g e t *
4 * *
5 *********************************************************************************
6 * Copyright (C) 1999,2006 by Jeroen van der Zijp. All Rights Reserved. *
7 *********************************************************************************
8 * This library is free software; you can redistribute it and/or *
9 * modify it under the terms of the GNU Lesser General Public *
10 * License as published by the Free Software Foundation; either *
11 * version 2.1 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 * Lesser General Public License for more details. *
17 * *
18 * You should have received a copy of the GNU Lesser 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 USA. *
21 *********************************************************************************
22 * $Id: FXToolBarTab.h,v 1.11 2006/01/22 17:58:11 fox Exp $ *
23 ********************************************************************************/
24 #ifndef FXTOOLBARTAB_H
25 #define FXTOOLBARTAB_H
26 
27 #ifndef FXFRAME_H
28 #include "FXFrame.h"
29 #endif
30 
31 namespace FX {
32 
33 
34 /// Tool Bar Tab styles
35 enum {
36  TOOLBARTAB_HORIZONTAL = 0, /// Default is for horizontal toolbar
37  TOOLBARTAB_VERTICAL = 0x00008000 /// For vertical toolbar
38  };
39 
40 
41 
42 /**
43 * A toolbar tab is used to collapse or uncollapse a sibling
44 * widget. The sibling affected is the widget immediately following
45 * the toolbar tab or, if the toolbar tab is the last widget in the list,
46 * the widget immediately preceding the toolbar tab.
47 */
48 class FXAPI FXToolBarTab : public FXFrame {
50 protected:
51  FXColor activeColor; // Color when active
52  FXString tip; // Tooltip
53  FXbool collapsed; // Is collapsed flat
54  FXbool down; // Button down
55 protected:
56  FXToolBarTab();
57  void drawUpArrow(FXDCWindow& dc);
58  void drawDownArrow(FXDCWindow& dc);
59  void drawRightArrow(FXDCWindow& dc);
60  void drawLeftArrow(FXDCWindow& dc);
61  void drawHSpeckles(FXDCWindow& dc,FXint x,FXint w);
62  void drawVSpeckles(FXDCWindow& dc,FXint y,FXint h);
63 private:
64  FXToolBarTab(const FXToolBarTab&);
65  FXToolBarTab& operator=(const FXToolBarTab&);
66 public:
67  long onPaint(FXObject*,FXSelector,void*);
68  long onUpdate(FXObject*,FXSelector,void*);
69  long onEnter(FXObject*,FXSelector,void*);
70  long onLeave(FXObject*,FXSelector,void*);
71  long onUngrabbed(FXObject*,FXSelector,void*);
72  long onLeftBtnPress(FXObject*,FXSelector,void*);
73  long onLeftBtnRelease(FXObject*,FXSelector,void*);
74  long onKeyPress(FXObject*,FXSelector,void*);
75  long onKeyRelease(FXObject*,FXSelector,void*);
76  long onCmdCollapse(FXObject*,FXSelector,void*);
77  long onUpdCollapse(FXObject*,FXSelector,void*);
78  long onCmdUncollapse(FXObject*,FXSelector,void*);
79  long onUpdUncollapse(FXObject*,FXSelector,void*);
80  long onCmdSetTip(FXObject*,FXSelector,void*);
81  long onCmdGetTip(FXObject*,FXSelector,void*);
82  long onQueryTip(FXObject*,FXSelector,void*);
83 public:
84  enum {
85  ID_COLLAPSE=FXFrame::ID_LAST,
86  ID_UNCOLLAPSE,
87  ID_LAST
88  };
89 public:
90 
91  /// Construct toolbar tab
93 
94  /// Toolbar tab can receive focus
95  virtual bool canFocus() const;
96 
97  /// Return default width
98  virtual FXint getDefaultWidth();
99 
100  /// Return default height
101  virtual FXint getDefaultHeight();
102 
103  /// Enable the toolbar tab
104  virtual void enable();
105 
106  /// Disable the toolbar tab
107  virtual void disable();
109  /// Collapse or uncollapse the toolbar
110  void collapse(FXbool fold,FXbool notify=FALSE);
111 
112  /// Return true if the toolbar is collapsed
113  FXbool isCollapsed() const { return collapsed; }
115  /// Change the tab style
116  void setTabStyle(FXuint style);
118  /// Get current tab style
119  FXuint getTabStyle() const;
120 
121  /// Get the active color
122  FXColor getActiveColor() const { return activeColor; }
123 
124  /// Set the active color
125  void setActiveColor(FXColor clr);
126 
127  /// Set the tool tip message for the toolbar tab
128  void setTipText(const FXString& text){ tip=text; }
129 
130  /// Get the tool tip message for the toolbar tab
131  const FXString& getTipText() const { return tip; }
132 
133  /// Save to a stream
134  virtual void save(FXStream& store) const;
135 
136  /// Load from a stream
137  virtual void load(FXStream& store);
138  };
139 
140 }
141 
142 #endif
The Frame widget provides borders around some contents.
Definition: FXFrame.h:73
Definition: FXWindow.h:241
unsigned int FXuint
Definition: fxdefs.h:396
FXuint FXSelector
Association key.
Definition: FXObject.h:53
#define FXAPI
Definition: fxdefs.h:122
FXuchar FXbool
Definition: fxdefs.h:393
Base composite.
Definition: FXComposite.h:35
#define NULL
Definition: fxdefs.h:41
FXuint FXColor
Definition: fxdefs.h:454
Default is for horizontal toolbar.
Definition: FXToolBarTab.h:39
int FXint
Definition: fxdefs.h:397
For vertical toolbar.
Definition: FXToolBarTab.h:40
Raised border.
Definition: FXWindow.h:77
A toolbar tab is used to collapse or uncollapse a sibling widget.
Definition: FXToolBarTab.h:55
#define FALSE
Definition: fxdefs.h:35
Object is the base class for all objects in FOX; in order to receive messages from the user interface...
Definition: FXObject.h:166
Window Device Context.
Definition: FXDCWindow.h:52
#define FXDECLARE(classname)
Macro to set up class declaration.
Definition: FXObject.h:92
FXString provides essential string manipulation capabilities.
Definition: FXString.h:33

Copyright © 1997-2005 Jeroen van der Zijp