hk_dsgrid.h

00001 // ****************************************************************************
00002 // copyright (c) 2000-2005 Horst Knorr <hk_classes@knoda.org>
00003 // This file is part of the hk_classes library.
00004 // This file may be distributed and/or modified under the terms of the
00005 // GNU Library Public License version 2 as published by the Free Software
00006 // Foundation and appearing in the file COPYING included in the
00007 // packaging of this file.
00008 // This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
00009 // WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
00010 // ****************************************************************************
00011 #ifndef HK_DSGRID
00012 #define HK_DSGRID
00013 #include "hk_dsvisible.h"
00014 #include "hk_dsgridcolumn.h"
00015 #include <vector>
00016 #include <list>
00017 using namespace std;
00018 class hk_column;
00026 class hk_dsgrid:public hk_dsvisible
00027 {
00028     friend class hk_dsgridcolumn;
00029     public:
00030         hk_dsgrid(hk_form* form=NULL );
00031         virtual ~hk_dsgrid(void);
00036         hk_dsgridcolumn* gridcolumn(unsigned int c);
00037         hk_dsgridcolumn* gridcolumn(const hk_string& identfier);
00041         unsigned int columnscount(void);
00047         void set_gridcolumnwidth(unsigned int col,int newwidth);
00053         void change_columnposition(unsigned int from,unsigned int to);
00058         void set_gridcolumns(vector<hk_dsgridcolumn>& c,bool registerchange=true);
00063         void set_gridcolumns(list<hk_string>&sl);
00064         void clear_gridcolumn(void);
00070         void set_hold_rowdefinition(bool h=true);
00077         void set_enablingbehaviour(bool add_col,bool del_col);
00078 //      bool save_grid(const hk_string& name="",bool ask=true);
00079         virtual   void  savedata(ostream& s,bool saveall);
00080         virtual   void savedata(ostream&s );
00081         virtual   void loaddata(xmlNodePtr definition);
00082         virtual void set_datasource(hk_datasource*);
00083         list <hk_string>* visible_columns(void);
00084         list <hk_string>* nonvisible_columns(void);
00085         bool save_table(const hk_string& s="",bool ask=true);
00086         bool load_table(void);
00087         bool save_view(const hk_string& s="",bool ask=true);
00088         bool load_view(void);
00089         void set_rowheight(int,bool registerchange=true);
00090         int rowheight(void);
00091 
00092 
00093 
00094 
00095     protected:
00096         bool    datasource_enable(void);
00097         bool    datasource_disable(void);
00098         bool    columns_new_created(void);
00099         virtual void    before_store_changed_data(void);
00100         virtual bool table_structure_changes(void);
00101         virtual void widget_specific_columns_created(void){}
00102         virtual void widget_specific_rowheight_changes(void){}
00103 
00104 
00105 
00106     private:
00107 
00108         void delete_nonexisting_columns(void);
00109         void add_new_columns(void);
00110         void clear_cols(void);
00111         void resize_cols(int n);
00112         vector<hk_dsgridcolumn*> p_cols;
00113         bool    p_automatic_columns;
00114         bool    p_delete_nonexisting_columns;
00115         bool    p_add_new_columns;
00116         bool    p_holdrowdefinition;
00117         int       p_rowheight;
00118         list<hk_string> p_visiblecols;
00119         list<hk_string> p_nonvisiblecols;
00120 };
00121 #endif

Generated on Sat Sep 22 02:48:30 2007 for Databaseconnectionclasses by  doxygen 1.5.3