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

FXComboBox.h
1 /********************************************************************************
2 * *
3 * C o m b o B o x W i d g e t *
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 FXCOMBOBOX_H
22 #define FXCOMBOBOX_H
23 
24 #ifndef FXPACKER_H
25 #include "FXPacker.h"
26 #endif
27 
28 namespace FX {
29 
30 
32 enum {
33  COMBOBOX_NO_REPLACE = 0,
34  COMBOBOX_REPLACE = 0x00020000,
35  COMBOBOX_INSERT_BEFORE = 0x00040000,
36  COMBOBOX_INSERT_AFTER = 0x00060000,
37  COMBOBOX_INSERT_FIRST = 0x00080000,
38  COMBOBOX_INSERT_LAST = 0x000A0000,
39  COMBOBOX_STATIC = 0x00100000,
40  COMBOBOX_NORMAL = 0
41  };
42 
43 
44 class FXTextField;
45 class FXMenuButton;
46 class FXList;
47 class FXPopup;
48 
49 
65 class FXAPI FXComboBox : public FXPacker {
66  FXDECLARE(FXComboBox)
67 protected:
68  FXTextField *field;
69  FXMenuButton *button;
70  FXList *list;
71  FXPopup *pane;
72 protected:
73  FXComboBox(){}
74 private:
75  FXComboBox(const FXComboBox&);
76  FXComboBox &operator=(const FXComboBox&);
77 public:
78  long onFocusUp(FXObject*,FXSelector,void*);
79  long onFocusDown(FXObject*,FXSelector,void*);
80  long onFocusSelf(FXObject*,FXSelector,void*);
81  long onMouseWheel(FXObject*,FXSelector,void*);
82  long onTextButton(FXObject*,FXSelector,void*);
83  long onTextChanged(FXObject*,FXSelector,void*);
84  long onTextCommand(FXObject*,FXSelector,void*);
85  long onListClicked(FXObject*,FXSelector,void*);
86  long onListCommand(FXObject*,FXSelector,void*);
87  long onFwdToText(FXObject*,FXSelector,void*);
88  long onUpdFmText(FXObject*,FXSelector,void*);
89 public:
90  enum {
91  ID_LIST=FXPacker::ID_LAST,
92  ID_TEXT,
93  ID_LAST
94  };
95 public:
96 
98  FXComboBox(FXComposite *p,FXint cols,FXObject* tgt=nullptr,FXSelector sel=0,FXuint opts=COMBOBOX_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);
99 
101  virtual void create();
102 
104  virtual void detach();
105 
107  virtual void destroy();
108 
110  virtual void enable();
111 
113  virtual void disable();
114 
116  virtual FXint getDefaultWidth();
117 
119  virtual FXint getDefaultHeight();
120 
122  virtual void layout();
123 
125  FXbool isEditable() const;
126 
128  void setEditable(FXbool edit=true);
129 
131  void setText(const FXString& text,FXbool notify=false);
132 
134  FXString getText() const;
135 
137  void setNumColumns(FXint cols);
138 
140  FXint getNumColumns() const;
141 
143  void setJustify(FXuint mode);
144 
146  FXuint getJustify() const;
147 
149  FXint getNumItems() const;
150 
152  FXint getNumVisible() const;
153 
155  void setNumVisible(FXint nvis);
156 
158  FXbool isItemCurrent(FXint index) const;
159 
161  void setCurrentItem(FXint index,FXbool notify=false);
162 
164  FXint getCurrentItem() const;
165 
167  FXString getItem(FXint index) const;
168 
170  FXint setItem(FXint index,const FXString& text,FXptr ptr=nullptr,FXbool notify=false);
171 
173  FXint fillItems(const FXchar *const *strings,FXbool notify=false);
174 
176  FXint fillItems(const FXString* strings,FXbool notify=false);
177 
179  FXint fillItems(const FXString& strings,FXbool notify=false);
180 
182  FXint insertItem(FXint index,const FXString& text,FXptr ptr=nullptr,FXbool notify=false);
183 
185  FXint appendItem(const FXString& text,FXptr ptr=nullptr,FXbool notify=false);
186 
188  FXint prependItem(const FXString& text,FXptr ptr=nullptr,FXbool notify=false);
189 
191  FXint moveItem(FXint newindex,FXint oldindex,FXbool notify=false);
192 
194  void removeItem(FXint index,FXbool notify=false);
195 
197  void clearItems(FXbool notify=false);
198 
209  FXint findItem(const FXString& string,FXint start=-1,FXuint flags=SEARCH_FORWARD|SEARCH_WRAP) const;
210 
218  FXint findItemByData(FXptr ptr,FXint start=-1,FXuint flags=SEARCH_FORWARD|SEARCH_WRAP) const;
219 
221  void setItemText(FXint index,const FXString& text);
222 
224  FXString getItemText(FXint index) const;
225 
227  void setItemData(FXint index,FXptr ptr) const;
228 
230  FXptr getItemData(FXint index) const;
231 
233  FXbool isItemEnabled(FXint index) const;
234 
236  FXbool enableItem(FXint index);
237 
239  FXbool disableItem(FXint index);
240 
242  void showMenu(FXbool shw);
243 
245  FXbool isMenuShown() const;
246 
248  void sortItems();
249 
251  void setFont(FXFont* fnt);
252 
254  FXFont* getFont() const;
255 
257  void setComboStyle(FXuint mode);
258 
260  FXuint getComboStyle() const;
261 
263  void setShrinkWrap(FXbool flag);
264 
266  FXbool getShrinkWrap() const;
267 
269  virtual void setBackColor(FXColor clr);
270 
272  FXColor getBackColor() const;
273 
275  void setTextColor(FXColor clr);
276 
278  FXColor getTextColor() const;
279 
281  void setSelBackColor(FXColor clr);
282 
284  FXColor getSelBackColor() const;
285 
287  void setSelTextColor(FXColor clr);
288 
290  FXColor getSelTextColor() const;
291 
293  FXListSortFunc getSortFunc() const;
294 
296  void setSortFunc(FXListSortFunc func);
297 
299  void setHelpText(const FXString& txt);
300 
302  const FXString& getHelpText() const;
303 
305  void setTipText(const FXString& txt);
306 
308  const FXString& getTipText() const;
309 
311  virtual void save(FXStream& store) const;
312 
314  virtual void load(FXStream& store);
315 
317  virtual ~FXComboBox();
318  };
319 
320 }
321 
322 #endif
A menu button posts a popup menu when clicked.
Definition: FXMenuButton.h:69
Popup window is used as a container for transitional controls such as menu panes and other ephemeral ...
Definition: FXPopup.h:51
Base composite.
Definition: FXComposite.h:32
A stream is a way to serialize data and objects into a byte stream.
Definition: FXStream.h:81
A List Widget displays a list of items, each with a text and optional icon.
Definition: FXList.h:169
Definition: FX4Splitter.h:28
Packer is a layout manager which automatically places child windows inside its area against the left...
Definition: FXPacker.h:48
A text field is a single-line text entry widget.
Definition: FXTextField.h:63
Object is the base class for all objects in FOX; in order to receive messages from the user interface...
Definition: FXObject.h:134
A Combo Box provides a way to select a string from a list of strings.
Definition: FXComboBox.h:65
Font class.
Definition: FXFont.h:137
FXString provides essential string manipulation capabilities in FOX.
Definition: FXString.h:42

Copyright © 1997-2022 Jeroen van der Zijp