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 FXCOMBOBOX_H
00025 #define FXCOMBOBOX_H
00026
00027 #ifndef FXPACKER_H
00028 #include "FXPacker.h"
00029 #endif
00030
00031 namespace FX {
00032
00033
00035 enum {
00036 COMBOBOX_NO_REPLACE = 0,
00037 COMBOBOX_REPLACE = 0x00020000,
00038 COMBOBOX_INSERT_BEFORE = 0x00040000,
00039 COMBOBOX_INSERT_AFTER = 0x00060000,
00040 COMBOBOX_INSERT_FIRST = 0x00080000,
00041 COMBOBOX_INSERT_LAST = 0x00090000,
00042 COMBOBOX_STATIC = 0x00100000,
00043 COMBOBOX_NORMAL = 0
00044 };
00045
00046
00047 class FXTextField;
00048 class FXMenuButton;
00049 class FXList;
00050 class FXPopup;
00051
00052
00068 class FXAPI FXComboBox : public FXPacker {
00069 FXDECLARE(FXComboBox)
00070 protected:
00071 FXTextField *field;
00072 FXMenuButton *button;
00073 FXList *list;
00074 FXPopup *pane;
00075 protected:
00076 FXComboBox(){}
00077 private:
00078 FXComboBox(const FXComboBox&);
00079 FXComboBox &operator=(const FXComboBox&);
00080 public:
00081 long onFocusUp(FXObject*,FXSelector,void*);
00082 long onFocusDown(FXObject*,FXSelector,void*);
00083 long onFocusSelf(FXObject*,FXSelector,void*);
00084 long onMouseWheel(FXObject*,FXSelector,void*);
00085 long onTextButton(FXObject*,FXSelector,void*);
00086 long onTextChanged(FXObject*,FXSelector,void*);
00087 long onTextCommand(FXObject*,FXSelector,void*);
00088 long onListClicked(FXObject*,FXSelector,void*);
00089 long onFwdToText(FXObject*,FXSelector,void*);
00090 long onUpdFmText(FXObject*,FXSelector,void*);
00091 public:
00092 enum {
00093 ID_LIST=FXPacker::ID_LAST,
00094 ID_TEXT,
00095 ID_LAST
00096 };
00097 public:
00098
00100 FXComboBox(FXComposite *p,FXint cols,FXObject* tgt=NULL,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);
00101
00103 virtual void create();
00104
00106 virtual void detach();
00107
00109 virtual void destroy();
00110
00112 virtual void enable();
00113
00115 virtual void disable();
00116
00118 virtual FXint getDefaultWidth();
00119
00121 virtual FXint getDefaultHeight();
00122
00124 virtual void layout();
00125
00127 FXbool isEditable() const;
00128
00130 void setEditable(FXbool edit=TRUE);
00131
00133 void setText(const FXString& text);
00134
00136 FXString getText() const;
00137
00139 void setNumColumns(FXint cols);
00140
00142 FXint getNumColumns() const;
00143
00145 void setJustify(FXuint mode);
00146
00148 FXuint getJustify() const;
00149
00151 FXint getNumItems() const;
00152
00154 FXint getNumVisible() const;
00155
00157 void setNumVisible(FXint nvis);
00158
00160 FXbool isItemCurrent(FXint index) const;
00161
00163 void setCurrentItem(FXint index,FXbool notify=FALSE);
00164
00166 FXint getCurrentItem() const;
00167
00169 FXString getItem(FXint index) const;
00170
00172 FXint setItem(FXint index,const FXString& text,void* ptr=NULL);
00173
00175 FXint fillItems(const FXchar** strings);
00176
00178 FXint fillItems(const FXString& strings);
00179
00181 FXint insertItem(FXint index,const FXString& text,void* ptr=NULL);
00182
00184 FXint appendItem(const FXString& text,void* ptr=NULL);
00185
00187 FXint prependItem(const FXString& text,void* ptr=NULL);
00188
00190 FXint moveItem(FXint newindex,FXint oldindex);
00191
00193 void removeItem(FXint index);
00194
00196 void clearItems();
00197
00208 FXint findItem(const FXString& text,FXint start=-1,FXuint flags=SEARCH_FORWARD|SEARCH_WRAP) const;
00209
00217 FXint findItemByData(const void *ptr,FXint start=-1,FXuint flags=SEARCH_FORWARD|SEARCH_WRAP) const;
00218
00220 void setItemText(FXint index,const FXString& text);
00221
00223 FXString getItemText(FXint index) const;
00224
00226 void setItemData(FXint index,void* ptr) const;
00227
00229 void* getItemData(FXint index) const;
00230
00232 FXbool isPaneShown() const;
00233
00235 void sortItems();
00236
00238 void setFont(FXFont* fnt);
00239
00241 FXFont* getFont() const;
00242
00244 void setComboStyle(FXuint mode);
00245
00247 FXuint getComboStyle() const;
00248
00250 virtual void setBackColor(FXColor clr);
00251
00253 FXColor getBackColor() const;
00254
00256 void setTextColor(FXColor clr);
00257
00259 FXColor getTextColor() const;
00260
00262 void setSelBackColor(FXColor clr);
00263
00265 FXColor getSelBackColor() const;
00266
00268 void setSelTextColor(FXColor clr);
00269
00271 FXColor getSelTextColor() const;
00272
00274 FXListSortFunc getSortFunc() const;
00275
00277 void setSortFunc(FXListSortFunc func);
00278
00280 void setHelpText(const FXString& txt);
00281
00283 const FXString& getHelpText() const;
00284
00286 void setTipText(const FXString& txt);
00287
00289 const FXString& getTipText() const;
00290
00292 virtual void save(FXStream& store) const;
00293
00295 virtual void load(FXStream& store);
00296
00298 virtual ~FXComboBox();
00299 };
00300
00301 }
00302
00303 #endif