Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members  

vdkclist.h

00001 /*
00002  * ===========================
00003  * VDK Visual Development Kit
00004  * Version 0.5
00005  * November 1998
00006  * ===========================
00007  *
00008  * Copyright (C) 1998, Mario Motta
00009  * Developed by Mario Motta <mmotta@guest.net>
00010  *
00011  * This library is free software; you can redistribute it and/or
00012  * modify it under the terms of the GNU Library General Public
00013  * License as published by the Free Software Foundation; either
00014  * version 2 of the License, or (at your option) any later version.
00015  *
00016  * This library is distributed in the hope that it will be useful,
00017  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00018  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00019  * Library General Public License for more details.
00020  *
00021  * You should have received a copy of the GNU Library General Public
00022  * License along with this library; if not, write to the Free Software
00023  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
00024  * 02111-130
00025  */
00026 
00027 #ifndef VDKCLIST_H
00028 #define VDKCLIST_H
00029 #include <vdk/vdkcustom.h>
00030 //#include <vector>
00031 //#include <string>
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; // selected row,column
00104   // extended selection
00105   int pointer;
00106   // wide selection
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   // handle title clicks
00113   static void ColumnClick(GtkWidget* w,
00114                           gint column,
00115                           gpointer s);
00116 
00117   // handle selection in modes != EXTENDED
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     // properties
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   //void AddRow(vector<string> v, char** pixdata = NULL, int col = 0);
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 //  VDKSignal2<void, int, const char**> OnRowInsert; 
00267 //  VDKSignal1<void, int> OnRowRemove;
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 //  static void _handle_row_insert(GtkWidget* wid, int, char**,
00274 //                               gpointer obj);
00275 //  static void _handle_row_remove(GtkWidget* wid, int row,
00276 //                               gpointer obj);
00277 #endif /* USE_SIGCPLUSPLUS */
00278 };
00279 #endif
00280 

Generated on Sat May 4 21:58:35 2002 for vdk 2.0.1 by doxygen1.2.15