Main Page | Namespace List | Class Hierarchy | Class List | File List | Class Members | File Members | Related Pages

hk_classes/hk_classes/hk_presentation.h

Go to the documentation of this file.
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_PRESENTATION
00012 #define HK_PRESENTATION
00013 #include <list>
00014 #include <exception>
00015 //#include <fstream.h>
00016 #include "hk_dsmodevisible.h"
00017 using namespace std;
00018 
00019 #include "hk_datasource.h"
00020 #include "hk_interpreter.h"
00021 class hk_database;
00022 class hk_form;
00023 class hk_presentationprivate;
00024 
00040 class hk_presentation   :public hk_dsmodevisible
00041 {
00042     friend class hk_datasource;
00043     friend class hk_database;
00044     friend class hk_dsvisible;
00045     friend class hk_visible;
00046     public:
00047         hk_presentation(void);
00048         virtual ~hk_presentation(void);
00052         void            set_database(hk_database* db);
00053         hk_database*        database(void) const;
00054 
00055         enum            enum_presentationtype {general,form,report,qbe,referentialintegrity};
00056         enum_presentationtype   presentationtype(void)const {return p_presentationtype;}
00060         void            set_name(const hk_string& n);
00061         hk_string       name(void) const;
00062        virtual bool            set_mode(enum_mode s);
00063 
00067         list<hk_datasource*>*   datasources(void) const;
00072         long        new_datasource(const hk_string& name,datasourcetype dt=dt_table);
00076         hk_datasource*  get_datasource(long nr);
00077         hk_datasource*  get_datasource(const hk_string& description);
00078         hk_datasource*  get_datasource_by_shortname(const hk_string& description);
00083         hk_string   unique_datasourcename(long nr);
00084         hk_string   unique_shortdatasourcename(long nr);
00085         virtual void                savedata(ostream& s);
00086         virtual void                loaddata(const hk_string& definition);
00090         void clear_datasourcelist(void);
00091 
00095         void            set_designsize(unsigned int width, unsigned int height,bool registerchange=true);
00096         virtual void            set_presentationsize(unsigned int,unsigned int);
00097         unsigned int    designwidth(void);
00098         unsigned int    designheight(void);
00099 
00100         unsigned int        horizontal2relativ(unsigned int h);
00101         unsigned int        vertical2relativ(unsigned int v);
00102         unsigned int        relativ2horizontal(unsigned int r);
00103         unsigned int        relativ2vertical(unsigned int r);
00104         virtual void register_object(hk_visible*);
00109         void set_automatic_enable_datasources(bool);
00110         bool automatic_enable_datasources(void);
00111         enum enum_bulkoperation {bulkfont,bulkforeground,bulkbackground};
00112         virtual void bulk_operation(enum_bulkoperation bulkoperation);
00113         enum enum_sizetype {relative,absolute};
00114         void set_sizetype(enum_sizetype type,bool registerchange=true);
00115         enum_sizetype sizetype(void);
00116         static void set_defaultsizetype(enum_sizetype type);
00117         static enum_sizetype defaultsizetype(void);
00118         static void set_snap2gridx(int);
00119         static int snap2gridx(void) ;
00120         static void set_snap2gridy(int);
00121         static int snap2gridy(void) ;
00122 
00123         hk_interpreter*  interpreter(void);
00124 
00125         virtual void script_error(hk_visible*, hk_interpreter::enum_action){}
00126         void set_interpretername(const hk_string&,bool registerchange=true);
00127         hk_string interpretername(void) const;
00128         void enable_datasources(bool enable,hk_datasource::enum_accessmode mode=hk_datasource::standard);
00129         virtual bool is_subpresentation(void);
00130         virtual bool while_loading(void){return false;}
00131 
00132     protected:
00133         void    remove_datasource(long nr, bool registerchange=true);
00134         virtual void    widget_specific_presentationresize(void){}
00135         virtual void    widget_specific_fieldresize(hk_visible* ){}
00136         enum_presentationtype p_presentationtype;
00137         void        database_delete(void);
00138 //will be called from database_delete()
00139         virtual void    database_has_vanished(void);
00140         void before_source_vanishes(void);
00141         bool ask_name(void);
00142         virtual void raise_widget(hk_visible*){}
00143         virtual void lower_widget(hk_visible*){}
00144 
00145         unsigned int p_actualwidth;
00146         unsigned int p_actualheight;
00147         bool         p_while_errorhandling;
00148         virtual void sizetype_changed(void);
00149 
00150     private:
00151         void remove_datasource( hk_datasource* d,bool registerchange);
00152         long add_datasource(hk_datasource* d);
00153         hk_presentationprivate* p_private;
00154         static enum_sizetype p_defaultsizetype;
00155         static int p_snap_to_gridx;
00156         static int p_snap_to_gridy;
00157 
00158 
00159 };
00160 #endif

Generated on Thu Mar 9 18:40:40 2006 for hk_classes by  doxygen 1.4.1