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

FXTreeListBox.h
1 /********************************************************************************
2 * *
3 * T r e e L i s t B o x W i d g e t *
4 * *
5 *********************************************************************************
6 * Copyright (C) 1999,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 FXTREELISTBOX_H
22 #define FXTREELISTBOX_H
23 
24 #ifndef FXPACKER_H
25 #include "FXPacker.h"
26 #endif
27 
28 namespace FX {
29 
30 
32 enum {
33  TREELISTBOX_NORMAL = 0
34  };
35 
36 
37 class FXButton;
38 class FXMenuButton;
39 class FXTreeList;
40 class FXPopup;
41 
42 
53 class FXAPI FXTreeListBox : public FXPacker {
54  FXDECLARE(FXTreeListBox)
55 protected:
56  FXButton *field;
57  FXMenuButton *button;
58  FXTreeList *tree;
59  FXPopup *pane;
60 protected:
61  FXTreeListBox(){}
62 private:
64  FXTreeListBox& operator=(const FXTreeListBox&);
65 public:
66  long onFocusUp(FXObject*,FXSelector,void*);
67  long onFocusDown(FXObject*,FXSelector,void*);
68  long onFocusSelf(FXObject*,FXSelector,void*);
69  long onMouseWheel(FXObject*,FXSelector,void*);
70  long onFieldButton(FXObject*,FXSelector,void*);
71  long onTreeUpdate(FXObject*,FXSelector,void*);
72  long onTreeForward(FXObject*,FXSelector,void*);
73  long onTreeClicked(FXObject*,FXSelector,void*);
74  long onTreeCommand(FXObject*,FXSelector,void*);
75 public:
76  enum{
77  ID_TREE=FXPacker::ID_LAST,
78  ID_FIELD,
79  ID_LAST
80  };
81 public:
82 
84  FXTreeListBox(FXComposite *p,FXObject* tgt=nullptr,FXSelector sel=0,FXuint opts=FRAME_SUNKEN|FRAME_THICK|TREELISTBOX_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);
85 
87  virtual void create();
88 
90  virtual void detach();
91 
93  virtual void destroy();
94 
96  virtual void layout();
97 
99  virtual void enable();
100 
102  virtual void disable();
103 
105  virtual FXint getDefaultWidth();
106 
108  virtual FXint getDefaultHeight();
109 
111  FXint getNumItems() const;
112 
114  FXint getNumVisible() const;
115 
117  void setNumVisible(FXint nvis);
118 
120  FXTreeItem* getFirstItem() const;
121 
123  FXTreeItem* getLastItem() const;
124 
126  FXbool isItemCurrent(const FXTreeItem* item) const;
127 
129  virtual void setCurrentItem(FXTreeItem* item,FXbool notify=false);
130 
132  FXTreeItem* getCurrentItem() const;
133 
135  FXint fillItems(FXTreeItem* father,const FXchar *const *strings,FXIcon* oi=nullptr,FXIcon* ci=nullptr,FXptr ptr=nullptr,FXbool notify=false);
136 
138  FXint fillItems(FXTreeItem* father,const FXString* strings,FXIcon* oi=nullptr,FXIcon* ci=nullptr,FXptr ptr=nullptr,FXbool notify=false);
139 
141  FXint fillItems(FXTreeItem* father,const FXString& strings,FXIcon* oi=nullptr,FXIcon* ci=nullptr,FXptr ptr=nullptr,FXbool notify=false);
142 
144  FXTreeItem* setItem(FXTreeItem* orig,FXTreeItem* item,FXbool notify=false);
145 
147  FXTreeItem* insertItem(FXTreeItem* other,FXTreeItem* father,FXTreeItem* item,FXbool notify=false);
148 
150  FXTreeItem* insertItem(FXTreeItem* other,FXTreeItem* father,const FXString& text,FXIcon* oi=nullptr,FXIcon* ci=nullptr,FXptr ptr=nullptr,FXbool notify=false);
151 
153  FXTreeItem* appendItem(FXTreeItem* father,FXTreeItem* item,FXbool notify=false);
154 
156  FXTreeItem* appendItem(FXTreeItem* father,const FXString& text,FXIcon* oi=nullptr,FXIcon* ci=nullptr,FXptr ptr=nullptr,FXbool notify=false);
157 
159  FXTreeItem* prependItem(FXTreeItem* father,FXTreeItem* item,FXbool notify=false);
160 
162  FXTreeItem* prependItem(FXTreeItem* father,const FXString& text,FXIcon* oi=nullptr,FXIcon* ci=nullptr,FXptr ptr=nullptr,FXbool notify=false);
163 
165  FXTreeItem *moveItem(FXTreeItem* other,FXTreeItem* father,FXTreeItem* item);
166 
168  FXTreeItem* extractItem(FXTreeItem* item,FXbool notify=false);
169 
171  void removeItem(FXTreeItem* item,FXbool notify=false);
172 
174  void removeItems(FXTreeItem* fm,FXTreeItem* to,FXbool notify=false);
175 
177  void clearItems(FXbool notify=false);
178 
189  FXTreeItem* findItem(const FXString& string,FXTreeItem* start=nullptr,FXuint flags=SEARCH_FORWARD|SEARCH_WRAP) const;
190 
198  FXTreeItem* findItemByData(FXptr ptr,FXTreeItem* start=nullptr,FXuint flags=SEARCH_FORWARD|SEARCH_WRAP) const;
199 
201  void setItemText(FXTreeItem* item,const FXString& text);
202 
204  FXString getItemText(const FXTreeItem* item) const;
205 
207  void setItemOpenIcon(FXTreeItem* item,FXIcon* icon,FXbool owned=false);
208 
210  FXIcon* getItemOpenIcon(const FXTreeItem* item) const;
211 
213  void setItemClosedIcon(FXTreeItem* item,FXIcon* icon,FXbool owned=false);
214 
216  FXIcon* getItemClosedIcon(const FXTreeItem* item) const;
217 
219  void setItemData(FXTreeItem* item,FXptr ptr) const;
220 
222  FXptr getItemData(const FXTreeItem* item) const;
223 
225  FXbool isItemLeaf(const FXTreeItem* item) const;
226 
228  FXbool isItemEnabled(const FXTreeItem* item) const;
229 
231  FXbool enableItem(FXTreeItem* item);
232 
234  FXbool disableItem(FXTreeItem* item);
235 
237  void showMenu(FXbool shw);
238 
240  FXbool isMenuShown() const;
241 
243  void sortItems();
244 
246  void sortRootItems();
247 
249  void sortChildItems(FXTreeItem* item);
250 
252  void setFont(FXFont* fnt);
253 
255  FXFont* getFont() const;
256 
258  void setListStyle(FXuint style);
259 
261  FXuint getListStyle() const;
262 
264  void setShrinkWrap(FXbool flag);
265 
267  FXbool getShrinkWrap() const;
268 
270  FXTreeListSortFunc getSortFunc() const;
271 
273  void setSortFunc(FXTreeListSortFunc func);
274 
276  void setHelpText(const FXString& txt);
277 
279  const FXString& getHelpText() const;
280 
282  void setTipText(const FXString& txt);
283 
285  const FXString& getTipText() const;
286 
288  virtual void save(FXStream& store) const;
289 
291  virtual void load(FXStream& store);
292 
294  virtual ~FXTreeListBox();
295  };
296 
297 }
298 
299 #endif
A menu button posts a popup menu when clicked.
Definition: FXMenuButton.h:69
Tree list Item.
Definition: FXTreeList.h:52
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
A Tree List Widget organizes items in a hierarchical, tree-like fashion.
Definition: FXTreeList.h:243
Base composite.
Definition: FXComposite.h:32
A stream is a way to serialize data and objects into a byte stream.
Definition: FXStream.h:81
The Tree List Box behaves very much like a List Box, except that it supports a hierarchical, tree structured display of the items.
Definition: FXTreeListBox.h:53
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:138
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