00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021 #ifndef FXLISTBOX_H
00022 #define FXLISTBOX_H
00023
00024 #ifndef FXPACKER_H
00025 #include "FXPacker.h"
00026 #endif
00027
00028 namespace FX {
00029
00030
00032 enum {
00033 LISTBOX_NORMAL = 0
00034 };
00035
00036
00037 class FXButton;
00038 class FXMenuButton;
00039 class FXList;
00040 class FXPopup;
00041
00042
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 onListCommand(FXObject*,FXSelector,void*);
00076 long onListForward(FXObject*,FXSelector,void*);
00077 long onCmdSetValue(FXObject*,FXSelector,void*);
00078 long onCmdGetIntValue(FXObject*,FXSelector,void*);
00079 long onCmdSetIntValue(FXObject*,FXSelector,void*);
00080 public:
00081 enum {
00082 ID_LIST=FXPacker::ID_LAST,
00083 ID_FIELD,
00084 ID_LAST
00085 };
00086 public:
00087
00089 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);
00090
00092 virtual void create();
00093
00095 virtual void detach();
00096
00098 virtual void destroy();
00099
00101 virtual void layout();
00102
00104 virtual void enable();
00105
00107 virtual void disable();
00108
00110 virtual FXint getDefaultWidth();
00111
00113 virtual FXint getDefaultHeight();
00114
00116 FXint getNumItems() const;
00117
00119 FXint getNumVisible() const;
00120
00122 void setNumVisible(FXint nvis);
00123
00125 FXbool isItemCurrent(FXint index) const;
00126
00128 virtual void setCurrentItem(FXint index,FXbool notify=false);
00129
00131 FXint getCurrentItem() const;
00132
00134 FXString getItem(FXint index) const;
00135
00137 FXint setItem(FXint index,const FXString& text,FXIcon* icon=NULL,void* ptr=NULL,FXbool notify=false);
00138
00140 FXint fillItems(const FXchar** strings,FXIcon* icon=NULL,void* ptr=NULL,FXbool notify=false);
00141
00143 FXint fillItems(const FXString& strings,FXIcon* icon=NULL,void* ptr=NULL,FXbool notify=false);
00144
00146 FXint insertItem(FXint index,const FXString& text,FXIcon* icon=NULL,void* ptr=NULL,FXbool notify=false);
00147
00149 FXint appendItem(const FXString& text,FXIcon* icon=NULL,void* ptr=NULL,FXbool notify=false);
00150
00152 FXint prependItem(const FXString& text,FXIcon* icon=NULL,void* ptr=NULL,FXbool notify=false);
00153
00155 FXint moveItem(FXint newindex,FXint oldindex,FXbool notify=false);
00156
00158 FXListItem* extractItem(FXint index,FXbool notify=false);
00159
00161 void removeItem(FXint index,FXbool notify=false);
00162
00164 void clearItems(FXbool notify=false);
00165
00176 FXint findItem(const FXString& text,FXint start=-1,FXuint flags=SEARCH_FORWARD|SEARCH_WRAP) const;
00177
00185 FXint findItemByData(const void *ptr,FXint start=-1,FXuint flags=SEARCH_FORWARD|SEARCH_WRAP) const;
00186
00188 void setItemText(FXint index,const FXString& text);
00189
00191 FXString getItemText(FXint index) const;
00192
00194 void setItemIcon(FXint index,FXIcon* icon,FXbool owned=false);
00195
00197 FXIcon* getItemIcon(FXint index) const;
00198
00200 void setItemData(FXint index,void* ptr) const;
00201
00203 void* getItemData(FXint index) const;
00204
00206 void showMenu(FXbool shw);
00207
00209 FXbool isMenuShown() const;
00210
00212 void sortItems();
00213
00215 void setFont(FXFont* fnt);
00216
00218 FXFont* getFont() const;
00219
00221 void setShrinkWrap(FXbool flag);
00222
00224 FXbool getShrinkWrap() const;
00225
00227 virtual void setBackColor(FXColor clr);
00228
00230 FXColor getBackColor() const;
00231
00233 void setTextColor(FXColor clr);
00234
00236 FXColor getTextColor() const;
00237
00239 void setSelBackColor(FXColor clr);
00240
00242 FXColor getSelBackColor() const;
00243
00245 void setSelTextColor(FXColor clr);
00246
00248 FXColor getSelTextColor() const;
00249
00251 FXListSortFunc getSortFunc() const;
00252
00254 void setSortFunc(FXListSortFunc func);
00255
00257 void setHelpText(const FXString& txt);
00258
00260 const FXString& getHelpText() const;
00261
00263 void setTipText(const FXString& txt);
00264
00266 const FXString& getTipText() const;
00267
00269 virtual void save(FXStream& store) const;
00270
00272 virtual void load(FXStream& store);
00273
00275 virtual ~FXListBox();
00276 };
00277
00278 }
00279
00280 #endif