00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023 #ifndef FXCOMBOBOX_H
00024 #define FXCOMBOBOX_H
00025
00026 #ifndef FXPACKER_H
00027 #include "FXPacker.h"
00028 #endif
00029
00030 namespace FX {
00031
00032
00033
00034 enum {
00035 COMBOBOX_NO_REPLACE = 0,
00036 COMBOBOX_REPLACE = 0x00020000,
00037 COMBOBOX_INSERT_BEFORE = 0x00040000,
00038 COMBOBOX_INSERT_AFTER = 0x00060000,
00039 COMBOBOX_INSERT_FIRST = 0x00080000,
00040 COMBOBOX_INSERT_LAST = 0x00090000,
00041 COMBOBOX_STATIC = 0x00100000,
00042 COMBOBOX_NORMAL = 0
00043 };
00044
00045
00046 class FXTextField;
00047 class FXMenuButton;
00048 class FXList;
00049 class FXPopup;
00050
00051
00052
00053
00054
00055
00056
00057
00058
00059
00060
00061
00062
00063
00064
00065
00066
00067 class FXAPI FXComboBox : public FXPacker {
00068 FXDECLARE(FXComboBox)
00069 protected:
00070 FXTextField *field;
00071 FXMenuButton *button;
00072 FXList *list;
00073 FXPopup *pane;
00074 protected:
00075 FXComboBox(){}
00076 private:
00077 FXComboBox(const FXComboBox&);
00078 FXComboBox &operator=(const FXComboBox&);
00079 public:
00080 long onFocusUp(FXObject*,FXSelector,void*);
00081 long onFocusDown(FXObject*,FXSelector,void*);
00082 long onFocusSelf(FXObject*,FXSelector,void*);
00083 long onMouseWheel(FXObject*,FXSelector,void*);
00084 long onTextButton(FXObject*,FXSelector,void*);
00085 long onTextChanged(FXObject*,FXSelector,void*);
00086 long onTextCommand(FXObject*,FXSelector,void*);
00087 long onListClicked(FXObject*,FXSelector,void*);
00088 long onListCommand(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
00099
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
00102
00103 virtual void create();
00104
00105
00106 virtual void detach();
00107
00108
00109 virtual void destroy();
00110
00111
00112 virtual void enable();
00113
00114
00115 virtual void disable();
00116
00117
00118 virtual FXint getDefaultWidth();
00119
00120
00121 virtual FXint getDefaultHeight();
00122
00123
00124 virtual void layout();
00125
00126
00127 FXbool isEditable() const;
00128
00129
00130 void setEditable(FXbool edit=true);
00131
00132
00133 void setText(const FXString& text,FXbool notify=false);
00134
00135
00136 FXString getText() const;
00137
00138
00139 void setNumColumns(FXint cols);
00140
00141
00142 FXint getNumColumns() const;
00143
00144
00145 void setJustify(FXuint mode);
00146
00147
00148 FXuint getJustify() const;
00149
00150
00151 FXint getNumItems() const;
00152
00153
00154 FXint getNumVisible() const;
00155
00156
00157 void setNumVisible(FXint nvis);
00158
00159
00160 FXbool isItemCurrent(FXint index) const;
00161
00162
00163 void setCurrentItem(FXint index,FXbool notify=false);
00164
00165
00166 FXint getCurrentItem() const;
00167
00168
00169 FXString getItem(FXint index) const;
00170
00171
00172 FXint setItem(FXint index,const FXString& text,void* ptr=NULL,FXbool notify=false);
00173
00174
00175 FXint fillItems(const FXchar** strings,FXbool notify=false);
00176
00177
00178 FXint fillItems(const FXString& strings,FXbool notify=false);
00179
00180
00181 FXint insertItem(FXint index,const FXString& text,void* ptr=NULL,FXbool notify=false);
00182
00183
00184 FXint appendItem(const FXString& text,void* ptr=NULL,FXbool notify=false);
00185
00186
00187 FXint prependItem(const FXString& text,void* ptr=NULL,FXbool notify=false);
00188
00189
00190 FXint moveItem(FXint newindex,FXint oldindex,FXbool notify=false);
00191
00192
00193 void removeItem(FXint index,FXbool notify=false);
00194
00195
00196 void clearItems(FXbool notify=false);
00197
00198
00199
00200
00201
00202
00203
00204
00205
00206
00207
00208 FXint findItem(const FXString& text,FXint start=-1,FXuint flags=SEARCH_FORWARD|SEARCH_WRAP) const;
00209
00210
00211
00212
00213
00214
00215
00216
00217 FXint findItemByData(const void *ptr,FXint start=-1,FXuint flags=SEARCH_FORWARD|SEARCH_WRAP) const;
00218
00219
00220 void setItemText(FXint index,const FXString& text);
00221
00222
00223 FXString getItemText(FXint index) const;
00224
00225
00226 void setItemData(FXint index,void* ptr) const;
00227
00228
00229 void* getItemData(FXint index) const;
00230
00231
00232 void showMenu(FXbool shw);
00233
00234
00235 FXbool isMenuShown() const;
00236
00237
00238 void sortItems();
00239
00240
00241 void setFont(FXFont* fnt);
00242
00243
00244 FXFont* getFont() const;
00245
00246
00247 void setComboStyle(FXuint mode);
00248
00249
00250 FXuint getComboStyle() const;
00251
00252
00253 void setShrinkWrap(FXbool flag);
00254
00255
00256 FXbool getShrinkWrap() const;
00257
00258
00259 virtual void setBackColor(FXColor clr);
00260
00261
00262 FXColor getBackColor() const;
00263
00264
00265 void setTextColor(FXColor clr);
00266
00267
00268 FXColor getTextColor() const;
00269
00270
00271 void setSelBackColor(FXColor clr);
00272
00273
00274 FXColor getSelBackColor() const;
00275
00276
00277 void setSelTextColor(FXColor clr);
00278
00279
00280 FXColor getSelTextColor() const;
00281
00282
00283 FXListSortFunc getSortFunc() const;
00284
00285
00286 void setSortFunc(FXListSortFunc func);
00287
00288
00289 void setHelpText(const FXString& txt);
00290
00291
00292 const FXString& getHelpText() const;
00293
00294
00295 void setTipText(const FXString& txt);
00296
00297
00298 const FXString& getTipText() const;
00299
00300
00301 virtual void save(FXStream& store) const;
00302
00303
00304 virtual void load(FXStream& store);
00305
00306
00307 virtual ~FXComboBox();
00308 };
00309
00310 }
00311
00312 #endif