00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022 #ifndef FXHISTORYITEMS_H
00023 #define FXHISTORYITEMS_H
00024
00025 #ifndef FXBASEOBJECT_H
00026 #include "FXBaseObject.h"
00027 #endif
00028 namespace FXEX {
00029
00030
00031
00032
00033 class FXAPI FXHistoryItems : public FXBaseObject {
00034 FXDECLARE(FXHistoryItems)
00035
00036 protected:
00037 struct ItemDict{
00038 FXString name;
00039 void* data;
00040 FXint key;
00041 ItemDict *previous;
00042 ItemDict *next;
00043 };
00044
00045 protected:
00046 FXString group;
00047 FXint maxitems;
00048 FXint key;
00049 FXint amount;
00050 FXbool destroySave;
00051 FXbool stringData;
00052 ItemDict *listStart;
00053 ItemDict *currentItem;
00054
00055 private:
00056 FXHistoryItems(const FXHistoryItems&);
00057 FXHistoryItems &operator=(const FXHistoryItems&);
00058
00059 protected:
00060
00061 FXHistoryItems(){};
00062
00063
00064 void renumber();
00065
00066
00067 void removeExtras();
00068
00069 public:
00070 long onCmdClear(FXObject*,FXSelector,void*);
00071 long onCmdPrevious(FXObject*,FXSelector,void*);
00072 long onCmdNext(FXObject*,FXSelector,void*);
00073 long onUpdPrevious(FXObject*,FXSelector,void*);
00074 long onUpdNext(FXObject*,FXSelector,void*);
00075 long onCmdItem(FXObject*,FXSelector,void*);
00076 long onUpdItem(FXObject*,FXSelector,void*);
00077 long onUpdAnyItems(FXObject*,FXSelector,void*);
00078 long onUpdNextItems(FXObject*,FXSelector,void*);
00079 long onUpdPreviousItems(FXObject*,FXSelector,void*);
00080
00081 public:
00082
00083
00084
00085 enum{
00086 ID_ITEM_NOT_FOUND=-1,
00087 ID_ITEM_0,
00088 ID_ITEM_1,
00089 ID_ITEM_2,
00090 ID_ITEM_3,
00091 ID_ITEM_4,
00092 ID_ITEM_5,
00093 ID_ITEM_6,
00094 ID_ITEM_7,
00095 ID_ITEM_8,
00096 ID_ITEM_9,
00097 ID_ITEM_10,
00098 ID_ITEM_NEXT,
00099 ID_ITEM_PREVIOUS,
00100 ID_CLEAR,
00101 ID_ANY_ITEMS,
00102 ID_NEXT_ITEMS,
00103 ID_PREVIOUS_ITEMS,
00104 ID_LAST
00105 };
00106
00107 public:
00108
00109
00110
00111
00112 FXHistoryItems(FXApp *a,const FXString& gp="History Items",FXObject* tgt=NULL,FXSelector sel=0,FXint size=-1);
00113
00114
00115 FXint size(const FXint mx);
00116
00117
00118 FXint size() const { return maxitems; }
00119
00120
00121 FXint no() { return amount; }
00122
00123
00124 void clear();
00125
00126
00127 FXint index() const { return key; }
00128
00129
00130 FXint index(const FXint item);
00131
00132
00133 FXint previous();
00134
00135
00136 FXint next();
00137
00138
00139 FXint find(const FXString& name);
00140
00141
00142 FXString name() { return currentItem->name; }
00143
00144
00145 virtual void* data() { return currentItem->data; }
00146
00147
00148 FXint remove();
00149
00150
00151 FXint remove(const FXString& name);
00152
00153
00154 FXint remove(const FXint item);
00155
00156
00157
00158
00159
00160 virtual FXint add(const FXString& name,void* data=NULL);
00161
00162
00163 FXint removeNewer(const FXint item);
00164
00165
00166 FXint removeOlder(const FXint item);
00167
00168
00169
00170
00171
00172 FXint moveFirst(const FXString& name);
00173
00174
00175
00176
00177
00178 FXint moveFirst(const FXint item);
00179
00180
00181 void saveOnDestroy(FXbool state);
00182
00183
00184 void dataIsString(FXbool state);
00185
00186
00187 void clearReg();
00188
00189
00190 FXint writeReg();
00191
00192
00193 FXint readReg();
00194
00195
00196 virtual void save(FXStream& store) const;
00197
00198
00199 virtual void load(FXStream& store);
00200
00201
00202 virtual ~FXHistoryItems();
00203 };
00204
00205 }
00206 #endif // FXHISTORYITEMS_H