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

FXArrowButton.h
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,2024 by Jeroen van der Zijp. All Rights Reserved. *
7 *********************************************************************************
8 * This library is free software; you can redistribute it and/or modify *
9 * it under the terms of the GNU Lesser General Public License as published by *
10 * the Free Software Foundation; either version 3 of the License, or *
11 * (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 *
16 * GNU Lesser General Public License for more details. *
17 * *
18 * You should have received a copy of the GNU Lesser General Public License *
19 * along with this program. If not, see <http://www.gnu.org/licenses/> *
20 ********************************************************************************/
21 #ifndef FXARROWBUTTON_H
22 #define FXARROWBUTTON_H
23 
24 #ifndef FXFRAME_H
25 #include "FXFrame.h"
26 #endif
27 
28 namespace FX {
29 
30 
31 // Arrow style options
32 enum {
33  ARROW_NONE = 0, // No arrow
34  ARROW_UP = 0x00080000, // Arrow points up
35  ARROW_DOWN = 0x00100000, // Arrow points down
36  ARROW_LEFT = 0x00200000, // Arrow points left
37  ARROW_RIGHT = 0x00400000, // Arrow points right
38  ARROW_AUTO = 0x00800000, // Automatically fire when hovering mouse over button
39  ARROW_REPEAT = 0x01000000, // Button repeats if held down
40  ARROW_AUTOGRAY = 0x02000000, // Automatically gray out when not updated
41  ARROW_AUTOHIDE = 0x04000000, // Automatically hide when not updated
42  ARROW_TOOLBAR = 0x08000000, // Button is toolbar-style
43  ARROW_NORMAL = FRAME_RAISED|FRAME_THICK|ARROW_UP
44  };
45 
46 
55 class FXAPI FXArrowButton : public FXFrame {
56  FXDECLARE(FXArrowButton)
57 protected:
58  FXColor arrowColor; // Arrow color
59  FXint arrowSize; // Arrow size
60  FXString tip; // Tooltip value
61  FXString help; // Help value
62  FXbool state; // State of button
63  FXbool fired; // Timer has fired
64 protected:
65  FXArrowButton();
66 private:
68  FXArrowButton &operator=(const FXArrowButton&);
69 public:
70  long onPaint(FXObject*,FXSelector,void*);
71  long onUpdate(FXObject*,FXSelector,void*);
72  long onEnter(FXObject*,FXSelector,void*);
73  long onLeave(FXObject*,FXSelector,void*);
74  long onLeftBtnPress(FXObject*,FXSelector,void*);
75  long onLeftBtnRelease(FXObject*,FXSelector,void*);
76  long onUngrabbed(FXObject*,FXSelector,void*);
77  long onRepeat(FXObject*,FXSelector,void*);
78  long onAuto(FXObject*,FXSelector,void*);
79  long onKeyPress(FXObject*,FXSelector,void*);
80  long onKeyRelease(FXObject*,FXSelector,void*);
81  long onHotKeyPress(FXObject*,FXSelector,void*);
82  long onHotKeyRelease(FXObject*,FXSelector,void*);
83  long onCmdSetHelp(FXObject*,FXSelector,void*);
84  long onCmdGetHelp(FXObject*,FXSelector,void*);
85  long onCmdSetTip(FXObject*,FXSelector,void*);
86  long onCmdGetTip(FXObject*,FXSelector,void*);
87  long onQueryHelp(FXObject*,FXSelector,void*);
88  long onQueryTip(FXObject*,FXSelector,void*);
89 public:
90  enum {
91  ID_REPEAT=FXFrame::ID_LAST,
92  ID_AUTO,
93  ID_LAST
94  };
95 public:
96 
98  FXArrowButton(FXComposite* p,FXObject* tgt=nullptr,FXSelector sel=0,FXuint opts=ARROW_NORMAL,FXint x=0,FXint y=0,FXint w=0,FXint h=0,FXint pl=DEFAULT_PAD,FXint pr=DEFAULT_PAD,FXint pt=DEFAULT_PAD,FXint pb=DEFAULT_PAD);
99 
101  virtual FXint getDefaultWidth();
102 
104  virtual FXint getDefaultHeight();
105 
107  virtual void enable();
108 
110  virtual void disable();
111 
113  virtual FXbool canFocus() const;
114 
116  void setState(FXbool s);
117 
119  FXbool getState() const { return state; }
120 
122  void setHelpText(const FXString& text){ help=text; }
123 
125  const FXString& getHelpText() const { return help; }
126 
128  void setTipText(const FXString& text){ tip=text; }
129 
131  const FXString& getTipText() const { return tip; }
132 
134  void setArrowStyle(FXuint style);
135 
137  FXuint getArrowStyle() const;
138 
140  void setArrowSize(FXint size);
141 
143  FXint getArrowSize() const { return arrowSize; }
144 
146  void setJustify(FXuint mode);
147 
149  FXuint getJustify() const;
150 
152  FXColor getArrowColor() const { return arrowColor; }
153 
155  void setArrowColor(FXColor clr);
156 
158  virtual void save(FXStream& store) const;
159 
161  virtual void load(FXStream& store);
162 
164  virtual ~FXArrowButton();
165  };
166 
167 }
168 
169 #endif
void setHelpText(const FXString &text)
Set status line help text for this arrow button.
Definition: FXArrowButton.h:122
const FXString & getTipText() const
Get tool tip message for this arrow button.
Definition: FXArrowButton.h:131
void setTipText(const FXString &text)
Set tool tip message for this arrow button.
Definition: FXArrowButton.h:128
The Frame widget provides borders around some contents.
Definition: FXFrame.h:58
FXColor getArrowColor() const
Get the fill color for the arrow.
Definition: FXArrowButton.h:152
Base composite.
Definition: FXComposite.h:32
FXbool getState() const
Get the button state (where true means the button is down)
Definition: FXArrowButton.h:119
A stream is a way to serialize data and objects into a byte stream.
Definition: FXStream.h:81
Definition: FX4Splitter.h:28
const FXString & getHelpText() const
Get status line help text for this arrow button.
Definition: FXArrowButton.h:125
Object is the base class for all objects in FOX; in order to receive messages from the user interface...
Definition: FXObject.h:134
FXString provides essential string manipulation capabilities in FOX.
Definition: FXString.h:42
FXint getArrowSize() const
Get the default arrow size.
Definition: FXArrowButton.h:143
Button with an arrow; the arrow can point in any direction.
Definition: FXArrowButton.h:55

Copyright © 1997-2022 Jeroen van der Zijp