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

FXArrowButton.h
Go to the documentation of this file.
1 /********************************************************************************
2 * *
3 * A r r o w B u t t o n W i d g e t *
4 * *
5 *********************************************************************************
6 * Copyright (C) 1998,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: FXArrowButton.h,v 1.39 2006/01/22 17:57:58 fox Exp $ *
23 ********************************************************************************/
24 #ifndef FXARROWBUTTON_H
25 #define FXARROWBUTTON_H
26 
27 #ifndef FXFRAME_H
28 #include "FXFrame.h"
29 #endif
30 
31 namespace FX {
32 
33 
34 // Arrow style options
35 enum {
36  ARROW_NONE = 0, // No arrow
37  ARROW_UP = 0x00080000, // Arrow points up
38  ARROW_DOWN = 0x00100000, // Arrow points down
39  ARROW_LEFT = 0x00200000, // Arrow points left
40  ARROW_RIGHT = 0x00400000, // Arrow points right
41  ARROW_AUTO = 0x00800000, // Automatically fire when hovering mouse over button
42  ARROW_REPEAT = 0x01000000, // Button repeats if held down
43  ARROW_AUTOGRAY = 0x02000000, // Automatically gray out when not updated
44  ARROW_AUTOHIDE = 0x04000000, // Automatically hide when not updated
45  ARROW_TOOLBAR = 0x08000000, // Button is toolbar-style
47  };
48 
49 
50 /**
51 * Button with an arrow; the arrow can point in any direction.
52 * When clicked, the arrow button sends a SEL_COMMAND to its target.
53 * When ARROW_REPEAT is passed, the arrow button sends a SEL_COMMAND
54 * repeatedly while the button is pressed.
55 * The option ARROW_AUTO together with ARROW_REPEAT makes the arrow
56 * button work in repeat mode simply by hovering the cursor over it.
57 */
58 class FXAPI FXArrowButton : public FXFrame {
60 protected:
61  FXColor arrowColor; // Arrow color
62  FXint arrowSize; // Arrow size
63  FXString tip; // Tooltip value
64  FXString help; // Help value
65  FXbool state; // State of button
66  FXbool fired; // Timer has fired
67 protected:
68  FXArrowButton();
69 private:
71  FXArrowButton &operator=(const FXArrowButton&);
72 public:
73  long onPaint(FXObject*,FXSelector,void*);
74  long onUpdate(FXObject*,FXSelector,void*);
75  long onEnter(FXObject*,FXSelector,void*);
76  long onLeave(FXObject*,FXSelector,void*);
77  long onLeftBtnPress(FXObject*,FXSelector,void*);
78  long onLeftBtnRelease(FXObject*,FXSelector,void*);
79  long onUngrabbed(FXObject*,FXSelector,void*);
80  long onRepeat(FXObject*,FXSelector,void*);
81  long onAuto(FXObject*,FXSelector,void*);
82  long onKeyPress(FXObject*,FXSelector,void*);
83  long onKeyRelease(FXObject*,FXSelector,void*);
84  long onHotKeyPress(FXObject*,FXSelector,void*);
85  long onHotKeyRelease(FXObject*,FXSelector,void*);
86  long onCmdSetHelp(FXObject*,FXSelector,void*);
87  long onCmdGetHelp(FXObject*,FXSelector,void*);
88  long onCmdSetTip(FXObject*,FXSelector,void*);
89  long onCmdGetTip(FXObject*,FXSelector,void*);
90  long onQueryHelp(FXObject*,FXSelector,void*);
91  long onQueryTip(FXObject*,FXSelector,void*);
92 public:
93  enum {
94  ID_REPEAT=FXFrame::ID_LAST,
95  ID_AUTO,
96  ID_LAST
97  };
98 public:
99 
100  /// Construct arrow button
102 
103  /// Get default width
104  virtual FXint getDefaultWidth();
105 
106  /// Get default height
107  virtual FXint getDefaultHeight();
108 
109  /// Enable the button
110  virtual void enable();
111 
112  /// Disable the button
113  virtual void disable();
114 
115  /// Returns true because a button can receive focus
116  virtual bool canFocus() const;
117 
118  /// Set the button state (where TRUE means the button is down)
119  void setState(FXbool s);
120 
121  /// Get the button state (where TRUE means the button is down)
122  FXbool getState() const { return state; }
123 
124  /// Set status line help text for this arrow button
125  void setHelpText(const FXString& text){ help=text; }
126 
127  /// Get status line help text for this arrow button
128  const FXString& getHelpText() const { return help; }
129 
130  /// Set tool tip message for this arrow button
131  void setTipText(const FXString& text){ tip=text; }
132 
133  /// Get tool tip message for this arrow button
134  const FXString& getTipText() const { return tip; }
135 
136  /// Set the arrow style flags
137  void setArrowStyle(FXuint style);
138 
139  /// Get the arrow style flags
140  FXuint getArrowStyle() const;
141 
142  /// Set the default arrow size
143  void setArrowSize(FXint size);
144 
145  /// Get the default arrow size
146  FXint getArrowSize() const { return arrowSize; }
147 
148  /// Set the current justification mode.
149  void setJustify(FXuint mode);
150 
151  /// Get the current justification mode.
152  FXuint getJustify() const;
153 
154  /// Get the fill color for the arrow
155  FXColor getArrowColor() const { return arrowColor; }
156 
157  /// Set the fill color for the arrow
158  void setArrowColor(FXColor clr);
159 
160  /// Save label to a stream
161  virtual void save(FXStream& store) const;
162 
163  /// Load label from a stream
164  virtual void load(FXStream& store);
165 
166  /// Destructor
167  virtual ~FXArrowButton();
168  };
169 
170 }
171 
172 #endif
Arrow points down.
Definition: FXArrowButton.h:41
Automatically gray out when not updated.
Definition: FXArrowButton.h:46
Automatically fire when hovering mouse over button.
Definition: FXArrowButton.h:44
Arrow points right.
Definition: FXArrowButton.h:43
The Frame widget provides borders around some contents.
Definition: FXFrame.h:73
Definition: FXWindow.h:241
unsigned int FXuint
Definition: fxdefs.h:396
Automatically hide when not updated.
Definition: FXArrowButton.h:47
Definition: FXFrame.h:56
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
Arrow points up.
Definition: FXArrowButton.h:40
Definition: FX4Splitter.h:31
int FXint
Definition: fxdefs.h:397
Raised border.
Definition: FXWindow.h:77
Button repeats if held down.
Definition: FXArrowButton.h:45
Object is the base class for all objects in FOX; in order to receive messages from the user interface...
Definition: FXObject.h:166
Thick border.
Definition: FXWindow.h:78
No arrow.
Definition: FXArrowButton.h:39
Definition: FXArrowButton.h:49
Button is toolbar-style.
Definition: FXArrowButton.h:48
Arrow points left.
Definition: FXArrowButton.h:42
#define FXDECLARE(classname)
Macro to set up class declaration.
Definition: FXObject.h:92
FXString provides essential string manipulation capabilities.
Definition: FXString.h:33
Button with an arrow; the arrow can point in any direction.
Definition: FXArrowButton.h:65

Copyright © 1997-2005 Jeroen van der Zijp