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

FXButton.h
1 /********************************************************************************
2 * *
3 * B u t t o n W i d g e t *
4 * *
5 *********************************************************************************
6 * Copyright (C) 1997,2022 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 FXBUTTON_H
22 #define FXBUTTON_H
23 
24 #ifndef FXLABEL_H
25 #include "FXLabel.h"
26 #endif
27 
28 namespace FX {
29 
30 
32 enum {
33  STATE_UP = 0,
34  STATE_DOWN = 1,
35  STATE_ENGAGED = 2,
36  STATE_UNCHECKED = STATE_UP,
37  STATE_CHECKED = STATE_ENGAGED
38  };
39 
40 
42 enum {
43  BUTTON_AUTOGRAY = 0x00800000,
44  BUTTON_AUTOHIDE = 0x01000000,
45  BUTTON_TOOLBAR = 0x02000000,
46  BUTTON_DEFAULT = 0x04000000,
47  BUTTON_INITIAL = 0x08000000,
48  BUTTON_NORMAL = (FRAME_RAISED|FRAME_THICK|JUSTIFY_NORMAL|ICON_BEFORE_TEXT)
49  };
50 
51 
70 class FXAPI FXButton : public FXLabel {
71  FXDECLARE(FXButton)
72 protected:
73  FXuchar state;
74 protected:
75  FXButton();
76 private:
77  FXButton(const FXButton&);
78  FXButton& operator=(const FXButton&);
79 public:
80  long onPaint(FXObject*,FXSelector,void*);
81  long onUpdate(FXObject*,FXSelector,void*);
82  long onEnter(FXObject*,FXSelector,void*);
83  long onLeave(FXObject*,FXSelector,void*);
84  long onFocusIn(FXObject*,FXSelector,void*);
85  long onFocusOut(FXObject*,FXSelector,void*);
86  long onUngrabbed(FXObject*,FXSelector,void*);
87  long onLeftBtnPress(FXObject*,FXSelector,void*);
88  long onLeftBtnRelease(FXObject*,FXSelector,void*);
89  long onKeyPress(FXObject*,FXSelector,void*);
90  long onKeyRelease(FXObject*,FXSelector,void*);
91  long onHotKeyPress(FXObject*,FXSelector,void*);
92  long onHotKeyRelease(FXObject*,FXSelector,void*);
93  long onCheck(FXObject*,FXSelector,void*);
94  long onUncheck(FXObject*,FXSelector,void*);
95  long onCmdSetValue(FXObject*,FXSelector,void*);
96  long onCmdSetIntValue(FXObject*,FXSelector,void*);
97  long onCmdGetIntValue(FXObject*,FXSelector,void*);
98 public:
99 
101  FXButton(FXComposite* p,const FXString& text,FXIcon* ic=nullptr,FXObject* tgt=nullptr,FXSelector sel=0,FXuint opts=BUTTON_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);
102 
104  virtual FXbool canFocus() const;
105 
107  virtual void setFocus();
108 
110  virtual void killFocus();
111 
113  virtual void setDefault(FXuchar flag=true);
114 
116  void setState(FXuint s);
117 
119  FXuint getState() const { return state; }
120 
122  void setButtonStyle(FXuint style);
123 
125  FXuint getButtonStyle() const;
126 
127  };
128 
129 }
130 
131 #endif
A label widget can be used to place a text and/or icon for explanation purposes.
Definition: FXLabel.h:64
A button provides a push button, with optional icon and/or text label.
Definition: FXButton.h:70
Base composite.
Definition: FXComposite.h:32
FXuint getState() const
Get the button state.
Definition: FXButton.h:119
Definition: FX4Splitter.h:28
An Icon is an image with two additional server-side resources: a shape bitmap, which is used to mask ...
Definition: FXIcon.h:42
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

Copyright © 1997-2022 Jeroen van der Zijp