00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024 #ifndef FXLISTBOX_H
00025 #define FXLISTBOX_H
00026
00027 #ifndef FXPACKER_H
00028 #include "FXPacker.h"
00029 #endif
00030
00031 namespace FX {
00032
00033
00035 enum {
00036 LISTBOX_NORMAL = 0
00037 };
00038
00039
00040 class FXButton;
00041 class FXMenuButton;
00042 class FXList;
00043 class FXPopup;
00044
00045
00055 class FXAPI FXListBox : public FXPacker {
00056 FXDECLARE(FXListBox)
00057 protected:
00058 FXButton *field;
00059 FXMenuButton *button;
00060 FXList *list;
00061 FXPopup *pane;
00062 protected:
00063 FXListBox(){}
00064 private:
00065 FXListBox(const FXListBox&);
00066 FXListBox &operator=(const FXListBox&);
00067 public:
00068 long onFocusUp(FXObject*,FXSelector,void*);
00069 long onFocusDown(FXObject*,FXSelector,void*);
00070 long onFocusSelf(FXObject*,FXSelector,void*);
00071 long onMouseWheel(FXObject*,FXSelector,void*);
00072 long onFieldButton(FXObject*,FXSelector,void*);
00073 long onListUpdate(FXObject*,FXSelector,void*);
00074 long onListClicked(FXObject*,FXSelector,void*);
00075 long onListChanged(FXObject*,FXSelector,void*);
00076 long onCmdSetValue(FXObject*,FXSelector,void*);
00077 long onCmdGetIntValue(FXObject*,FXSelector,void*);
00078 long onCmdSetIntValue(FXObject*,FXSelector,void*);
00079 public:
00080 enum {
00081 ID_LIST=FXPacker::ID_LAST,
00082 ID_FIELD,
00083 ID_LAST
00084 };
00085 public:
00086
00088 FXListBox(FXComposite *p,FXObject* tgt=NULL,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);
00089
00091 virtual void create();
00092
00094 virtual void detach();
00095
00097 virtual void destroy();
00098
00100 virtual void layout();
00101
00103 virtual void enable();
00104
00106 virtual void disable();
00107
00109 virtual FXint getDefaultWidth();
00110
00112 virtual FXint getDefaultHeight();
00113
00115 FXint getNumItems() const;
00116
00118 FXint getNumVisible() const;
00119
00121 void setNumVisible(FXint nvis);
00122
00124 FXbool isItemCurrent(FXint index) const;
00125
00127 virtual void setCurrentItem(FXint index,FXbool notify=FALSE);
00128
00130 FXint getCurrentItem() const;
00131
00133 FXString getItem(FXint index) const;
00134
00136 FXint setItem(FXint index,const FXString& text,FXIcon* icon=NULL,void* ptr=NULL);
00137
00139 FXint fillItems(const FXchar** strings,FXIcon* icon=NULL,void* ptr=NULL);
00140
00142 FXint fillItems(const FXString& strings,FXIcon* icon=NULL,void* ptr=NULL);
00143
00145 FXint insertItem(FXint index,const FXString& text,FXIcon* icon=NULL,void* ptr=NULL);
00146
00148 FXint appendItem(const FXString& text,FXIcon* icon=NULL,void* ptr=NULL);
00149
00151 FXint prependItem(const FXString& text,FXIcon* icon=NULL,void* ptr=NULL);
00152
00154 FXint moveItem(FXint newindex,FXint oldindex);
00155
00157 FXListItem* extractItem(FXint index);
00158
00160 void removeItem(FXint index);
00161
00163 void clearItems();
00164
00175 FXint findItem(const FXString& text,FXint start=-1,FXuint flags=SEARCH_FORWARD|SEARCH_WRAP) const;
00176
00184 FXint findItemByData(const void *ptr,FXint start=-1,FXuint flags=SEARCH_FORWARD|SEARCH_WRAP) const;
00185
00187 void setItemText(FXint index,const FXString& text);
00188
00190 FXString getItemText(FXint index) const;
00191
00193 void setItemIcon(FXint index,FXIcon* icon,FXbool owned=FALSE);
00194
00196 FXIcon* getItemIcon(FXint index) const;
00197
00199 void setItemData(FXint index,void* ptr) const;
00200
00202 void* getItemData(FXint index) const;
00203
00205 FXbool isPaneShown() const;
00206
00208 void sortItems();
00209
00211 void setFont(FXFont* fnt);
00212
00214 FXFont* getFont() const;
00215
00217 virtual void setBackColor(FXColor clr);
00218
00220 FXColor getBackColor() const;
00221
00223 void setTextColor(FXColor clr);
00224
00226 FXColor getTextColor() const;
00227
00229 void setSelBackColor(FXColor clr);
00230
00232 FXColor getSelBackColor() const;
00233
00235 void setSelTextColor(FXColor clr);
00236
00238 FXColor getSelTextColor() const;
00239
00241 FXListSortFunc getSortFunc() const;
00242
00244 void setSortFunc(FXListSortFunc func);
00245
00247 void setHelpText(const FXString& txt);
00248
00250 const FXString& getHelpText() const;
00251
00253 void setTipText(const FXString& txt);
00254
00256 const FXString& getTipText() const;
00257
00259 virtual void save(FXStream& store) const;
00260
00262 virtual void load(FXStream& store);
00263
00265 virtual ~FXListBox();
00266 };
00267
00268 }
00269
00270 #endif