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

FXOptionMenu.h
Go to the documentation of this file.
1 /********************************************************************************
2 * *
3 * O p t i o n M e n u *
4 * *
5 *********************************************************************************
6 * Copyright (C) 1997,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: FXOptionMenu.h,v 1.28 2006/02/06 02:03:38 fox Exp $ *
23 ********************************************************************************/
24 #ifndef FXOPTIONMENU_H
25 #define FXOPTIONMENU_H
26 
27 #ifndef FXLABEL_H
28 #include "FXLabel.h"
29 #endif
30 
31 namespace FX {
32 
33 
34 class FXPopup;
35 
36 
37 /// Option Menu Button
38 class FXAPI FXOption : public FXLabel {
40 protected:
41  FXColor selbackColor;
42  FXColor seltextColor;
43 protected:
44  FXOption();
45 private:
46  FXOption(const FXOption&);
47  FXOption &operator=(const FXOption&);
48 public:
49  long onPaint(FXObject*,FXSelector,void*);
50  long onEnter(FXObject*,FXSelector,void*);
51  long onLeave(FXObject*,FXSelector,void*);
52  long onLeftBtnPress(FXObject*,FXSelector,void*);
53  long onLeftBtnRelease(FXObject*,FXSelector,void*);
54  long onKeyPress(FXObject*,FXSelector,void*);
55  long onKeyRelease(FXObject*,FXSelector,void*);
56  long onHotKeyPress(FXObject*,FXSelector,void*);
57  long onHotKeyRelease(FXObject*,FXSelector,void*);
58 public:
59 
60  /// Constructor
62 
63  /// Return default width
64  virtual FXint getDefaultWidth();
65 
66  /// Return default height
67  virtual FXint getDefaultHeight();
68 
69  /// Returns true because a menu button can receive focus
70  virtual bool canFocus() const;
71 
72  /// Set focus to this window
73  virtual void setFocus();
74 
75  /// Remove the focus from this window
76  virtual void killFocus();
77 
78  /// Return the selection background color
79  void setSelBackColor(FXColor clr);
80 
81  /// Return the selection background color
82  FXColor getSelBackColor() const { return selbackColor; }
83 
84  /// Return the selection text color
85  void setSelTextColor(FXColor clr);
86 
87  /// Return the selection text color
88  FXColor getSelTextColor() const { return seltextColor; }
89 
90  /// Destructor
91  virtual ~FXOption();
92  };
93 
94 
95 
96 /// Option Menu
97 class FXAPI FXOptionMenu : public FXLabel {
99 protected:
100  FXPopup *pane;
101  FXOption *current;
102 protected:
103  FXOptionMenu(){}
104 private:
105  FXOptionMenu(const FXOptionMenu&);
106  FXOptionMenu &operator=(const FXOptionMenu&);
107 public:
108  long onPaint(FXObject*,FXSelector,void*);
109  long onLeftBtnPress(FXObject*,FXSelector,void*);
110  long onLeftBtnRelease(FXObject*,FXSelector,void*);
111  long onFocusIn(FXObject*,FXSelector,void*);
112  long onFocusOut(FXObject*,FXSelector,void*);
113  long onMotion(FXObject*,FXSelector,void*);
114  long onKeyPress(FXObject*,FXSelector,void*);
115  long onKeyRelease(FXObject*,FXSelector,void*);
116  long onCmdPost(FXObject*,FXSelector,void*);
117  long onCmdUnpost(FXObject*,FXSelector,void*);
118  long onQueryHelp(FXObject*,FXSelector,void*);
119  long onQueryTip(FXObject*,FXSelector,void*);
120  long onCmdSetValue(FXObject*,FXSelector,void*);
121  long onCmdSetIntValue(FXObject*,FXSelector,void*);
122  long onCmdGetIntValue(FXObject*,FXSelector,void*);
123  long onMouseWheel(FXObject*,FXSelector,void*);
124 public:
125 
126  /// Constructor
127  FXOptionMenu(FXComposite* p,FXPopup* pup=NULL,FXuint opts=JUSTIFY_NORMAL|ICON_BEFORE_TEXT,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);
128 
129  /// Create server-side resources
130  virtual void create();
131 
132  /// Detach server-side resources
133  virtual void detach();
134 
135  /// Delete server-side resources
136  virtual void destroy();
137 
138  /// Perform layout
139  virtual void layout();
140 
141  /// Remove the focus from this window
142  virtual void killFocus();
143 
144  /// Return default width
145  virtual FXint getDefaultWidth();
146 
147  /// Return default height
148  virtual FXint getDefaultHeight();
149 
150  /// Return TRUE if the position is logically in the pane
151  virtual bool contains(FXint parentx,FXint parenty) const;
152 
153  /// Set the current option
154  void setCurrent(FXOption *win,FXbool notify=FALSE);
155 
156  /// Return the current option
157  FXOption* getCurrent() const { return current; }
158 
159  /// Set the current option number
160  void setCurrentNo(FXint no,FXbool notify=FALSE);
161 
162  /// Get the current option number
163  FXint getCurrentNo() const;
164 
165  /// Get number of options
166  FXint getNumOptions() const;
167 
168  /// Set the pane which will be popped up
169  void setMenu(FXPopup *pup);
170 
171  /// Return the pane which is poppup up
172  FXPopup* getMenu() const { return pane; }
173 
174  /// Returns true because a option menu can receive focus
175  virtual bool canFocus() const;
176 
177  /// Return TRUE if popped up
178  FXbool isPopped() const;
179 
180  /// Save option menu to a stream
181  virtual void save(FXStream& store) const;
182 
183  /// Load option menu from a stream
184  virtual void load(FXStream& store);
185 
186  /// Destructor
187  virtual ~FXOptionMenu();
188  };
189 
190 }
191 
192 #endif
A label widget can be used to place a text and/or icon for explanation purposes.
Definition: FXLabel.h:79
unsigned int FXuint
Definition: fxdefs.h:396
Popup window.
Definition: FXPopup.h:52
Definition: FXFrame.h:56
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
Option Menu Button.
Definition: FXOptionMenu.h:38
Definition: FX4Splitter.h:31
int FXint
Definition: fxdefs.h:397
An Icon is an image with two additional server-side resources: a shape bitmap, which is used to mask ...
Definition: FXIcon.h:45
Option Menu.
Definition: FXOptionMenu.h:89
#define FALSE
Definition: fxdefs.h:35
Object is the base class for all objects in FOX; in order to receive messages from the user interface...
Definition: FXObject.h:166
Icon appears before text (to its left)
Definition: FXLabel.h:41
Default justification is centered text.
Definition: FXFrame.h:39
#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