00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027 #ifndef VDKCLIST_H
00028 #define VDKCLIST_H
00029 #include <vdk/vdkcustom.h>
00030
00031
00032
00033
00034 class VDKCustomList;
00035
00036 typedef VDKReadWriteValueProp<VDKCustomList,VDKPoint>
00037 CustomListSelProperty;
00038
00039 class SelectionProp: public CustomListSelProperty
00040 {
00041 public:
00042 SelectionProp(
00043 char* name,
00044 VDKCustomList* object,
00045 VDKPoint defValue,
00046 void (VDKCustomList::*write)(VDKPoint),
00047 VDKPoint (VDKCustomList::*read)(void) =
00048 (VDKPoint (VDKCustomList::*)(void)) NULL
00049 ):CustomListSelProperty(name,object,defValue,write,read)
00050 { }
00051
00052 int Row()const { return Value().X();}
00053 int Col()const { return Value().Y();}
00054
00055 };
00056
00098 class VDKCustomList: public VDKCustom
00099 {
00100
00101 protected:
00102 VDKIntArray WideSelection;
00103 VDKPoint selection, unselection;
00104
00105 int pointer;
00106
00107 int start,end;
00108 void _update_pix(int row,const char* s, char** pixdata = NULL, int col = 0);
00109 void _update_size(int row,int *W, int *H);
00110 void SetStyle(int row);
00111 void ConnectSignals();
00112
00113 static void ColumnClick(GtkWidget* w,
00114 gint column,
00115 gpointer s);
00116
00117
00118 static int RowSelection(GtkWidget *wid,
00119 gint row,
00120 gint column,
00121 GdkEvent *event,
00122 gpointer data);
00123 static int RowUnselection(GtkWidget *wid,
00124 gint row,
00125 gint column,
00126 GdkEventButton *event,
00127 gpointer data);
00128
00129
00130 public:
00131
00136 SelectionProp Selected;
00141 SelectionProp Unselected;
00152 TupleList Tuples;
00153
00154 public:
00161 VDKCustomList(VDKForm* owner,
00162 int columns = 1,
00163 char **titles = NULL,
00164 GtkSelectionMode mode = GTK_SELECTION_SINGLE);
00168 virtual ~VDKCustomList();
00169
00176 void AddRow(char **texts, char** pixdata = NULL, int col = 0);
00183 void UpdateRow(int row, char** s,
00184 char** pixdata = NULL, int col = 0);
00188 void UpdateRow(int row, Tuple& t,
00189 char** pixdata = NULL, int col = 0);
00197 void UpdateCell(int row, int col,
00198 const char* s, char** pixdata = NULL);
00203 void RemoveRow(int row);
00207 VDKPoint Selection() { return selection; }
00211 VDKPoint Unselection() { return unselection; }
00217 void SelectRow(int row, int col);
00222 void SelectRow(VDKPoint p) { SelectRow(p.X(),p.Y()); }
00228 void UnselectRow(int row, int col);
00233 void UnselectRow(VDKPoint p) { UnselectRow(p.X(),p.Y()); }
00234
00235 virtual void Clear();
00241 VDKIntArray& Selections();
00242 #ifdef USE_SIGCPLUSPLUS
00243 public:
00250 VDKSignal2<void, int, int> OnRowSelect;
00257 VDKSignal2<void, int, int> OnRowUnselect;
00264 VDKSignal2<void, int, int> OnRowMove;
00265
00266
00267
00268 protected:
00269 static void make_gtksigc_connection(VDKCustomList*);
00270 private:
00271 static void _handle_row_move(GtkWidget* wid, int, int,
00272 gpointer obj);
00273
00274
00275
00276
00277 #endif
00278 };
00279 #endif
00280