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

FXListBox.h
1 /********************************************************************************
2 * *
3 * L i s t 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 FXLISTBOX_H
22 #define FXLISTBOX_H
23 
24 #ifndef FXPACKER_H
25 #include "FXPacker.h"
26 #endif
27 
28 namespace FX {
29 
30 
32 enum {
33  LISTBOX_NORMAL = 0 // Normal style
34  };
35 
36 
37 class FXButton;
38 class FXMenuButton;
39 class FXList;
40 class FXPopup;
41 
42 
55 class FXAPI FXListBox : public FXPacker {
56  FXDECLARE(FXListBox)
57 protected:
58  FXButton *field;
59  FXMenuButton *button;
60  FXList *list;
61  FXPopup *pane;
62 protected:
63  FXListBox(){}
64 private:
65  FXListBox(const FXListBox&);
66  FXListBox &operator=(const FXListBox&);
67 public:
68  long onFocusUp(FXObject*,FXSelector,void*);
69  long onFocusDown(FXObject*,FXSelector,void*);
70  long onFocusSelf(FXObject*,FXSelector,void*);
71  long onMouseWheel(FXObject*,FXSelector,void*);
72  long onFieldButton(FXObject*,FXSelector,void*);
73  long onListUpdate(FXObject*,FXSelector,void*);
74  long onListClicked(FXObject*,FXSelector,void*);
75  long onListChanged(FXObject*,FXSelector,void*);
76  long onListCommand(FXObject*,FXSelector,void*);
77  long onListForward(FXObject*,FXSelector,void*);
78  long onCmdSetValue(FXObject*,FXSelector,void*);
79  long onCmdGetIntValue(FXObject*,FXSelector,void*);
80  long onCmdSetIntValue(FXObject*,FXSelector,void*);
81 public:
82  enum {
83  ID_LIST=FXPacker::ID_LAST,
84  ID_FIELD,
85  ID_LAST
86  };
87 public:
88 
90  FXListBox(FXComposite *p,FXObject* tgt=nullptr,FXSelector sel=0,FXuint opts=FRAME_SUNKEN|FRAME_THICK|LISTBOX_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);
91 
93  virtual void create();
94 
96  virtual void detach();
97 
99  virtual void destroy();
100 
102  virtual void layout();
103 
105  virtual void enable();
106 
108  virtual void disable();
109 
111  virtual FXint getDefaultWidth();
112 
114  virtual FXint getDefaultHeight();
115 
117  FXint getNumItems() const;
118 
120  FXint getNumVisible() const;
121 
123  void setNumVisible(FXint nvis);
124 
126  FXbool isItemCurrent(FXint index) const;
127 
129  virtual void setCurrentItem(FXint index,FXbool notify=false);
130 
132  FXint getCurrentItem() const;
133 
135  FXString getItem(FXint index) const;
136 
138  FXint setItem(FXint index,const FXString& text,FXIcon* icon=nullptr,FXptr ptr=nullptr,FXbool notify=false);
139 
141  FXint fillItems(const FXchar *const *strings,FXIcon* icon=nullptr,FXptr ptr=nullptr,FXbool notify=false);
142 
144  FXint fillItems(const FXString* strings,FXIcon* icon=nullptr,FXptr ptr=nullptr,FXbool notify=false);
145 
147  FXint fillItems(const FXString& strings,FXIcon* icon=nullptr,FXptr ptr=nullptr,FXbool notify=false);
148 
150  FXint insertItem(FXint index,const FXString& text,FXIcon* icon=nullptr,FXptr ptr=nullptr,FXbool notify=false);
151 
153  FXint appendItem(const FXString& text,FXIcon* icon=nullptr,FXptr ptr=nullptr,FXbool notify=false);
154 
156  FXint prependItem(const FXString& text,FXIcon* icon=nullptr,FXptr ptr=nullptr,FXbool notify=false);
157 
159  FXint moveItem(FXint newindex,FXint oldindex,FXbool notify=false);
160 
162  FXListItem* extractItem(FXint index,FXbool notify=false);
163 
165  void removeItem(FXint index,FXbool notify=false);
166 
168  void clearItems(FXbool notify=false);
169 
180  FXint findItem(const FXString& string,FXint start=-1,FXuint flags=SEARCH_FORWARD|SEARCH_WRAP) const;
181 
189  FXint findItemByData(FXptr ptr,FXint start=-1,FXuint flags=SEARCH_FORWARD|SEARCH_WRAP) const;
190 
192  void setItemText(FXint index,const FXString& text);
193 
195  FXString getItemText(FXint index) const;
196 
198  void setItemIcon(FXint index,FXIcon* icon,FXbool owned=false);
199 
201  FXIcon* getItemIcon(FXint index) const;
202 
204  void setItemData(FXint index,FXptr ptr) const;
205 
207  FXptr getItemData(FXint index) const;
208 
210  FXbool isItemEnabled(FXint index) const;
211 
213  FXbool enableItem(FXint index);
214 
216  FXbool disableItem(FXint index);
217 
219  void showMenu(FXbool shw);
220 
222  FXbool isMenuShown() const;
223 
225  void sortItems();
226 
228  void setFont(FXFont* fnt);
229 
231  FXFont* getFont() const;
232 
234  void setShrinkWrap(FXbool flag);
235 
237  FXbool getShrinkWrap() const;
238 
240  virtual void setBackColor(FXColor clr);
241 
243  FXColor getBackColor() const;
244 
246  void setTextColor(FXColor clr);
247 
249  FXColor getTextColor() const;
250 
252  void setSelBackColor(FXColor clr);
253 
255  FXColor getSelBackColor() const;
256 
258  void setSelTextColor(FXColor clr);
259 
261  FXColor getSelTextColor() const;
262 
264  FXListSortFunc getSortFunc() const;
265 
267  void setSortFunc(FXListSortFunc func);
268 
270  void setHelpText(const FXString& txt);
271 
273  const FXString& getHelpText() const;
274 
276  void setTipText(const FXString& txt);
277 
279  const FXString& getTipText() const;
280 
282  virtual void save(FXStream& store) const;
283 
285  virtual void load(FXStream& store);
286 
288  virtual ~FXListBox();
289  };
290 
291 }
292 
293 #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
A button provides a push button, with optional icon and/or text label.
Definition: FXButton.h:70
The List Box is a control to select one of a list of options.
Definition: FXListBox.h:55
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
An Icon is an image with two additional server-side resources: a shape bitmap, which is used to mask ...
Definition: FXIcon.h:42
Packer is a layout manager which automatically places child windows inside its area against the left...
Definition: FXPacker.h:48
Object is the base class for all objects in FOX; in order to receive messages from the user interface...
Definition: FXObject.h:134
List item.
Definition: FXList.h:48
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