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

FXCheckButton.h
1 /********************************************************************************
2 * *
3 * C h e c k 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 FXCHECKBUTTON_H
22 #define FXCHECKBUTTON_H
23 
24 #ifndef FXLABEL_H
25 #include "FXLabel.h"
26 #endif
27 
28 namespace FX {
29 
30 
32 enum {
33  CHECKBUTTON_AUTOGRAY = 0x00800000,
34  CHECKBUTTON_AUTOHIDE = 0x01000000,
35  CHECKBUTTON_PLUS = 0x02000000,
36  CHECKBUTTON_NORMAL = JUSTIFY_NORMAL|ICON_BEFORE_TEXT
37  };
38 
39 
54 class FXAPI FXCheckButton : public FXLabel {
55  FXDECLARE(FXCheckButton)
56 protected:
57  FXColor checkColor; // Color of check mark
58  FXColor boxColor; // Color of check box
59  FXuchar check; // Check state
60  FXuchar oldcheck; // Old check state
61 protected:
62  FXCheckButton();
63 private:
65  FXCheckButton &operator=(const FXCheckButton&);
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 onFocusIn(FXObject*,FXSelector,void*);
72  long onFocusOut(FXObject*,FXSelector,void*);
73  long onUngrabbed(FXObject*,FXSelector,void*);
74  long onLeftBtnPress(FXObject*,FXSelector,void*);
75  long onLeftBtnRelease(FXObject*,FXSelector,void*);
76  long onKeyPress(FXObject*,FXSelector,void*);
77  long onKeyRelease(FXObject*,FXSelector,void*);
78  long onHotKeyPress(FXObject*,FXSelector,void*);
79  long onHotKeyRelease(FXObject*,FXSelector,void*);
80  long onCheck(FXObject*,FXSelector,void*);
81  long onUncheck(FXObject*,FXSelector,void*);
82  long onUnknown(FXObject*,FXSelector,void*);
83  long onCmdSetValue(FXObject*,FXSelector,void*);
84  long onCmdSetIntValue(FXObject*,FXSelector,void*);
85  long onCmdGetIntValue(FXObject*,FXSelector,void*);
86 public:
87 
89  FXCheckButton(FXComposite* p,const FXString& text,FXObject* tgt=nullptr,FXSelector sel=0,FXuint opts=CHECKBUTTON_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);
90 
92  virtual FXbool canFocus() const;
93 
95  virtual FXint getDefaultWidth();
96 
98  virtual FXint getDefaultHeight();
99 
101  void setCheck(FXuchar state=true,FXbool notify=false);
102 
104  FXuchar getCheck() const { return check; }
105 
107  void setCheckButtonStyle(FXuint style);
108 
110  FXuint getCheckButtonStyle() const;
111 
113  FXColor getBoxColor() const { return boxColor; }
114 
116  void setBoxColor(FXColor clr);
117 
119  FXColor getCheckColor() const { return checkColor; }
120 
122  void setCheckColor(FXColor clr);
123 
125  virtual void save(FXStream& store) const;
126 
128  virtual void load(FXStream& store);
129  };
130 
131 }
132 
133 #endif
A label widget can be used to place a text and/or icon for explanation purposes.
Definition: FXLabel.h:64
FXuchar getCheck() const
Get check button state (true, false or maybe)
Definition: FXCheckButton.h:104
Base composite.
Definition: FXComposite.h:32
FXColor getBoxColor() const
Get the box background color.
Definition: FXCheckButton.h:113
A Check Button is a tri-state button.
Definition: FXCheckButton.h:54
A stream is a way to serialize data and objects into a byte stream.
Definition: FXStream.h:81
Definition: FX4Splitter.h:28
Object is the base class for all objects in FOX; in order to receive messages from the user interface...
Definition: FXObject.h:138
FXColor getCheckColor() const
Get the box check color.
Definition: FXCheckButton.h:119
FXString provides essential string manipulation capabilities in FOX.
Definition: FXString.h:42

Copyright © 1997-2022 Jeroen van der Zijp