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

FXMenuCheck.h
Go to the documentation of this file.
1 /********************************************************************************
2 * *
3 * M e n u C h e c k W i d g e t *
4 * *
5 *********************************************************************************
6 * Copyright (C) 2002,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: FXMenuCheck.h,v 1.13 2006/01/22 17:58:06 fox Exp $ *
23 ********************************************************************************/
24 #ifndef FXMENUCHECK_H
25 #define FXMENUCHECK_H
26 
27 #ifndef FXMENUCOMMAND_H
28 #include "FXMenuCommand.h"
29 #endif
30 
31 namespace FX {
32 
33 
34 /**
35 * The menu check widget is used to change a state in the
36 * application from a menu. Menu checks may reflect
37 * the state of the application by graying out, becoming hidden,
38 * or by a check mark.
39 * When activated, a menu check sends a SEL_COMMAND to its target;
40 * the void* argument of the message contains the new state.
41 */
44 protected:
45  FXuchar check; // State of menu
46  FXColor boxColor; // Box color
47 protected:
48  FXMenuCheck();
49 private:
50  FXMenuCheck(const FXMenuCheck&);
51  FXMenuCheck &operator=(const FXMenuCheck&);
52 public:
53  long onPaint(FXObject*,FXSelector,void*);
54  long onButtonPress(FXObject*,FXSelector,void*);
55  long onButtonRelease(FXObject*,FXSelector,void*);
56  long onKeyPress(FXObject*,FXSelector,void*);
57  long onKeyRelease(FXObject*,FXSelector,void*);
58  long onHotKeyPress(FXObject*,FXSelector,void*);
59  long onHotKeyRelease(FXObject*,FXSelector,void*);
60  long onCheck(FXObject*,FXSelector,void*);
61  long onUncheck(FXObject*,FXSelector,void*);
62  long onUnknown(FXObject*,FXSelector,void*);
63  long onCmdSetValue(FXObject*,FXSelector,void*);
64  long onCmdSetIntValue(FXObject*,FXSelector,void*);
65  long onCmdGetIntValue(FXObject*,FXSelector,void*);
66  long onCmdAccel(FXObject*,FXSelector,void*);
67 public:
68 
69  /// Construct a menu check
70  FXMenuCheck(FXComposite* p,const FXString& text,FXObject* tgt=NULL,FXSelector sel=0,FXuint opts=0);
71 
72  /// Return default width
73  virtual FXint getDefaultWidth();
74 
75  /// Return default height
76  virtual FXint getDefaultHeight();
77 
78  /// Set check state (TRUE, FALSE or MAYBE)
79  void setCheck(FXbool s=TRUE);
80 
81  /// Get check state (TRUE, FALSE or MAYBE)
82  FXbool getCheck() const { return check; }
83 
84  /// Get the box background color
85  FXColor getBoxColor() const { return boxColor; }
86 
87  /// Set the box background color
88  void setBoxColor(FXColor clr);
89 
90  /// Save menu to a stream
91  virtual void save(FXStream& store) const;
92 
93  /// Load menu from a stream
94  virtual void load(FXStream& store);
95  };
96 
97 }
98 
99 #endif
#define TRUE
Definition: fxdefs.h:32
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
The menu command widget is used to invoke a command in the application from a menu.
Definition: FXMenuCommand.h:40
Definition: FX4Splitter.h:31
int FXint
Definition: fxdefs.h:397
Object is the base class for all objects in FOX; in order to receive messages from the user interface...
Definition: FXObject.h:166
unsigned char FXuchar
Definition: fxdefs.h:392
The menu check widget is used to change a state in the application from a menu.
Definition: FXMenuCheck.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

Copyright © 1997-2005 Jeroen van der Zijp