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

FXMenuRadio.h
Go to the documentation of this file.
1 /********************************************************************************
2 * *
3 * M e n u R a d i o 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: FXMenuRadio.h,v 1.13 2006/01/22 17:58:06 fox Exp $ *
23 ********************************************************************************/
24 #ifndef FXMENURADIO_H
25 #define FXMENURADIO_H
26 
27 #ifndef FXMENUCOMMAND_H
28 #include "FXMenuCommand.h"
29 #endif
30 
31 namespace FX {
32 
33 
34 /**
35 * The menu radio widget is used to invoke a command in the
36 * application from a menu. Menu commands may reflect
37 * the state of the application by graying out, becoming hidden,
38 * or by a bullit.
39 * When activated, a menu radio sends a SEL_COMMAND to its target;
40 * the void* argument of the message contains the new state.
41 * A collection of menu radio widgets which belong to each other
42 * is supposed to be updated by a common SEL_UPDATE handler to
43 * properly maintain the state between them.
44 */
47 protected:
48  FXuchar check; // State of menu
49  FXColor radioColor; // Color of the radio
50 protected:
51  FXMenuRadio();
52 private:
53  FXMenuRadio(const FXMenuRadio&);
54  FXMenuRadio &operator=(const FXMenuRadio&);
55 public:
56  long onPaint(FXObject*,FXSelector,void*);
57  long onButtonPress(FXObject*,FXSelector,void*);
58  long onButtonRelease(FXObject*,FXSelector,void*);
59  long onKeyPress(FXObject*,FXSelector,void*);
60  long onKeyRelease(FXObject*,FXSelector,void*);
61  long onHotKeyPress(FXObject*,FXSelector,void*);
62  long onHotKeyRelease(FXObject*,FXSelector,void*);
63  long onCheck(FXObject*,FXSelector,void*);
64  long onUncheck(FXObject*,FXSelector,void*);
65  long onUnknown(FXObject*,FXSelector,void*);
66  long onCmdSetValue(FXObject*,FXSelector,void*);
67  long onCmdSetIntValue(FXObject*,FXSelector,void*);
68  long onCmdGetIntValue(FXObject*,FXSelector,void*);
69  long onCmdAccel(FXObject*,FXSelector,void*);
70 public:
71 
72  /// Construct a menu radio
73  FXMenuRadio(FXComposite* p,const FXString& text,FXObject* tgt=NULL,FXSelector sel=0,FXuint opts=0);
74 
75  /// Return default width
76  virtual FXint getDefaultWidth();
77 
78  /// Return default height
79  virtual FXint getDefaultHeight();
80 
81  /// Set radio button state (TRUE, FALSE or MAYBE)
82  void setCheck(FXbool s=TRUE);
83 
84  /// Get radio button state (TRUE, FALSE or MAYBE)
85  FXbool getCheck() const { return check; }
86 
87  /// Get the radio background color
88  FXColor getRadioColor() const { return radioColor; }
89 
90  /// Set the radio background color
91  void setRadioColor(FXColor clr);
92 
93  /// Save menu to a stream
94  virtual void save(FXStream& store) const;
95 
96  /// Load menu from a stream
97  virtual void load(FXStream& store);
98  };
99 
100 }
101 
102 #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
int FXint
Definition: fxdefs.h:397
The menu radio widget is used to invoke a command in the application from a menu. ...
Definition: FXMenuRadio.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
unsigned char FXuchar
Definition: fxdefs.h:392
#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