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

hk_interpreter.h

00001 // ****************************************************************************
00002 // copyright (c) 2000-2004 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_INTERPRETER
00012 #define HK_INTERPRETER
00013 #include "hk_class.h"
00014 #ifdef HAVE_CONFIG_H
00015 #include "config.h"
00016 #endif
00017 
00018 class hk_button;
00019 class hk_dslineedit;
00020 class hk_dsgrid;
00021 class hk_dsboolean;
00022 class hk_dscombobox;
00023 class hk_dsmemo;
00024 class hk_dsgrid;
00025 class hk_visible;
00026 class hk_dsvisible;
00027 class hk_presentation;
00028 class hk_form;
00029 class hk_report;
00030 class hk_reportdata;
00031 class hk_subform;
00032 
00040 class hk_interpreter:public hk_class
00041 {
00042 public:
00043 hk_interpreter(hk_presentation* p);
00044 virtual ~hk_interpreter(){}
00045 virtual void init(){}
00049 virtual bool on_click(hk_visible*)=0;
00053 virtual bool on_doubleclick(hk_visible*)=0;
00058 virtual bool before_row_change(hk_dsvisible*)=0;
00062 virtual bool after_row_change(hk_dsvisible*)=0;
00066 virtual bool before_update(hk_dsvisible*)=0;
00071 virtual bool after_update(hk_dsvisible*)=0;
00075 virtual bool before_delete(hk_dsvisible*)=0;
00079 virtual bool after_delete(hk_dsvisible*)=0;
00083 virtual bool before_insert(hk_dsvisible*)=0;
00087 virtual bool after_insert(hk_dsvisible*)=0;
00091 virtual bool on_close(hk_visible*)=0;
00095 virtual bool on_open(hk_visible*)=0;
00099 virtual bool on_print_data(hk_reportdata*)=0;
00103 virtual bool on_print_new_page(hk_report*)=0;
00107 bool scripterror(void){return p_error_occured;}
00111 hk_string errormessage(void){return p_errormessage;}
00115 int error_rownumber(void){return p_error_rownumber;}
00119 virtual hk_string interpretername(void) const {return "unknown";}
00120 enum enum_action{       a_before_row_change,
00121                                 a_after_row_change,
00122                                 a_click,
00123                                 a_doubleclick,
00124                                 a_onopen,
00125                                 a_onclose,
00126                                 a_before_update,
00127                                 a_after_update,
00128                                 a_before_delete,
00129                                 a_after_delete,
00130                                 a_before_insert,
00131                                 a_after_insert,
00132                                 a_on_print_data,
00133                                 a_on_print_new_page
00134                                 };//when gets updated don't forget to update hk_kdesimpleform/hk_kdesimplereport::script_error !!!
00135 
00136 protected:
00137 hk_presentation* p_presentation;
00138 bool p_error_occured;
00139 hk_string p_errormessage;
00140 int p_error_rownumber;
00141 
00142 private:
00143 
00144 };
00145 
00154 class hk_no_interpreter:public hk_interpreter
00155 {
00156 public:
00157 hk_no_interpreter(hk_presentation*p);
00158 virtual bool on_click(hk_visible*);
00159 virtual bool on_doubleclick(hk_visible*);
00160 virtual bool before_row_change(hk_dsvisible*);
00161 virtual bool after_row_change(hk_dsvisible*);
00162 virtual bool before_update(hk_dsvisible*);
00163 virtual bool after_update(hk_dsvisible*);
00164 virtual bool on_close(hk_visible*);
00165 virtual bool on_open(hk_visible*);
00166 virtual bool before_delete(hk_dsvisible*);
00167 virtual bool after_delete(hk_dsvisible*);
00168 virtual bool before_insert(hk_dsvisible*);
00169 virtual bool after_insert(hk_dsvisible*);
00170 virtual bool on_print_data(hk_reportdata*);
00171 virtual bool on_print_new_page(hk_report*);
00172 private:
00173 void warning(void);
00174  bool warning_already_displayed;
00175 };
00176 
00177 #ifdef HAVE_PYTHON
00178 
00179 class hk_pythoninterpreterprivate;
00188 class hk_pythoninterpreter:public hk_interpreter
00189 {
00190 public:
00191 hk_pythoninterpreter(hk_presentation* );
00192 virtual ~hk_pythoninterpreter();
00193 virtual void init();
00194 
00195 virtual bool on_click(hk_visible*);
00196 virtual bool on_doubleclick(hk_visible*);
00197 virtual bool before_row_change(hk_dsvisible*);
00198 virtual bool after_row_change(hk_dsvisible*);
00199 virtual bool before_update(hk_dsvisible*);
00200 virtual bool after_update(hk_dsvisible*);
00201 virtual bool on_close(hk_visible*);
00202 virtual bool on_open(hk_visible*);
00203 virtual hk_string interpretername(void) const {return "python";}
00204 virtual bool before_delete(hk_dsvisible*);
00205 virtual bool after_delete(hk_dsvisible*);
00206 virtual bool before_insert(hk_dsvisible*);
00207 virtual bool after_insert(hk_dsvisible*);
00208 virtual bool on_print_data(hk_reportdata*);
00209 virtual bool on_print_new_page(hk_report*);
00210 
00211 protected:
00212 
00213 
00214 private:
00215 void error_occured(enum_action action);
00216 bool execute_script(const hk_string& script,enum_action action);
00217 hk_string pystatement(void);
00218 hk_pythoninterpreterprivate* p_privatdata;
00219 
00220 static int p_referencecounting;
00221 
00222 
00223 };
00224 
00225 #endif //HAVE_PYTHON
00226  hk_button* currentbutton(void);
00227  hk_dslineedit* currentlineedit(void);
00228  hk_dsmemo* currentmemo(void);
00229  hk_dsgrid* currentgrid(void);
00230  hk_dscombobox* currentcombobox(void);
00231  hk_dsboolean*  currentboolean(void);
00232  hk_form* currentform(void);
00233  hk_report* currentreport(void);
00234  hk_reportdata* currentreportdata(void);
00235  hk_dsvisible* currentdsvisible(void);
00236  hk_visible*  currentvisible(void);
00237 
00238  hk_button *cast_button(hk_visible*);
00239  hk_dslineedit *cast_dslineedit(hk_visible*);
00240  hk_dsmemo *cast_dsmemo(hk_visible*);
00241  hk_dsgrid *cast_dsgrid(hk_visible*);
00242  hk_dscombobox *cast_dscombobox(hk_visible*);
00243  hk_dsboolean *cast_dsboolean(hk_visible*);
00244  hk_dsvisible *cast_dsvisible(hk_visible*);
00245  hk_form *cast_form(hk_visible*);
00246  hk_report *cast_report(hk_visible*);
00247  hk_reportdata *cast_reportdata(hk_visible*);
00248  hk_subform *cast_subform(hk_visible*);
00249 
00250 #endif //HK_INTERPRETER
00251 

Generated on Tue Mar 22 20:01:12 2005 for Databaseconnectionclasses by  doxygen 1.4.1