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

FXOptionMenu.h
1 /********************************************************************************
2 * *
3 * O p t i o n M e n u *
4 * *
5 *********************************************************************************
6 * Copyright (C) 1997,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 FXOPTIONMENU_H
22 #define FXOPTIONMENU_H
23 
24 #ifndef FXLABEL_H
25 #include "FXLabel.h"
26 #endif
27 
28 namespace FX {
29 
30 
31 class FXPopup;
32 
33 
35 enum {
36  OPTIONMENU_TOOLBAR = 0x00800000,
37  OPTIONMENU_NOGLYPH = 0x01000000,
38  };
39 
40 
42 class FXAPI FXOption : public FXLabel {
43  FXDECLARE(FXOption)
44 protected:
45  FXColor selbackColor;
46  FXColor seltextColor;
47 protected:
48  FXOption();
49 private:
50  FXOption(const FXOption&);
51  FXOption &operator=(const FXOption&);
52 public:
53  long onPaint(FXObject*,FXSelector,void*);
54  long onEnter(FXObject*,FXSelector,void*);
55  long onLeave(FXObject*,FXSelector,void*);
56  long onLeftBtnPress(FXObject*,FXSelector,void*);
57  long onLeftBtnRelease(FXObject*,FXSelector,void*);
58  long onKeyPress(FXObject*,FXSelector,void*);
59  long onKeyRelease(FXObject*,FXSelector,void*);
60  long onHotKeyPress(FXObject*,FXSelector,void*);
61  long onHotKeyRelease(FXObject*,FXSelector,void*);
62 public:
63 
65  FXOption(FXComposite* p,const FXString& text,FXIcon* ic=nullptr,FXObject* tgt=nullptr,FXSelector sel=0,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);
66 
68  virtual FXint getDefaultWidth();
69 
71  virtual FXint getDefaultHeight();
72 
74  virtual FXbool canFocus() const;
75 
77  virtual void setFocus();
78 
80  virtual void killFocus();
81 
83  void setSelBackColor(FXColor clr);
84 
86  FXColor getSelBackColor() const { return selbackColor; }
87 
89  void setSelTextColor(FXColor clr);
90 
92  FXColor getSelTextColor() const { return seltextColor; }
93 
95  virtual ~FXOption();
96  };
97 
98 
99 
101 class FXAPI FXOptionMenu : public FXLabel {
102  FXDECLARE(FXOptionMenu)
103 protected:
104  FXPopup *pane;
105  FXOption *current;
106 protected:
107  FXOptionMenu(){}
108 private:
109  FXOptionMenu(const FXOptionMenu&);
110  FXOptionMenu &operator=(const FXOptionMenu&);
111 public:
112  long onPaint(FXObject*,FXSelector,void*);
113  long onLeftBtnPress(FXObject*,FXSelector,void*);
114  long onLeftBtnRelease(FXObject*,FXSelector,void*);
115  long onEnter(FXObject*,FXSelector,void*);
116  long onLeave(FXObject*,FXSelector,void*);
117  long onFocusIn(FXObject*,FXSelector,void*);
118  long onFocusOut(FXObject*,FXSelector,void*);
119  long onMotion(FXObject*,FXSelector,void*);
120  long onKeyPress(FXObject*,FXSelector,void*);
121  long onKeyRelease(FXObject*,FXSelector,void*);
122  long onCmdPost(FXObject*,FXSelector,void*);
123  long onCmdUnpost(FXObject*,FXSelector,void*);
124  long onQueryHelp(FXObject*,FXSelector,void*);
125  long onQueryTip(FXObject*,FXSelector,void*);
126  long onCmdSetValue(FXObject*,FXSelector,void*);
127  long onCmdSetIntValue(FXObject*,FXSelector,void*);
128  long onCmdGetIntValue(FXObject*,FXSelector,void*);
129  long onMouseWheel(FXObject*,FXSelector,void*);
130 public:
131 
133  FXOptionMenu(FXComposite* p,FXPopup* pup=nullptr,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);
134 
136  virtual void create();
137 
139  virtual void detach();
140 
142  virtual void destroy();
143 
145  virtual void layout();
146 
148  virtual void killFocus();
149 
151  virtual FXint getDefaultWidth();
152 
154  virtual FXint getDefaultHeight();
155 
157  virtual FXbool contains(FXint parentx,FXint parenty) const;
158 
160  FXOption *getItem(FXint index) const;
161 
163  void setCurrent(FXOption *win,FXbool notify=false);
164 
166  FXOption* getCurrent() const { return current; }
167 
169  void setCurrentNo(FXint no,FXbool notify=false);
170 
172  FXint getCurrentNo() const;
173 
175  FXint getNumOptions() const;
176 
178  void setMenu(FXPopup *pup);
179 
181  FXPopup* getMenu() const { return pane; }
182 
184  virtual FXbool canFocus() const;
185 
187  FXbool isPopped() const;
188 
190  virtual void save(FXStream& store) const;
191 
193  virtual void load(FXStream& store);
194 
196  virtual ~FXOptionMenu();
197  };
198 
199 }
200 
201 #endif
FXColor getSelBackColor() const
Return the selection background color.
Definition: FXOptionMenu.h:86
A label widget can be used to place a text and/or icon for explanation purposes.
Definition: FXLabel.h:64
Popup window is used as a container for transitional controls such as menu panes and other ephemeral ...
Definition: FXPopup.h:51
FXOption * getCurrent() const
Return the current option.
Definition: FXOptionMenu.h:166
Base composite.
Definition: FXComposite.h:32
A stream is a way to serialize data and objects into a byte stream.
Definition: FXStream.h:81
Option Menu Button.
Definition: FXOptionMenu.h:42
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
Option Menu.
Definition: FXOptionMenu.h:101
Object is the base class for all objects in FOX; in order to receive messages from the user interface...
Definition: FXObject.h:138
FXColor getSelTextColor() const
Return the selection text color.
Definition: FXOptionMenu.h:92
FXPopup * getMenu() const
Return the pane which is poppup up.
Definition: FXOptionMenu.h:181
FXString provides essential string manipulation capabilities in FOX.
Definition: FXString.h:42

Copyright © 1997-2022 Jeroen van der Zijp