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

hk_classes/hk_classes/hk_interpreter.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_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_dsgridcolumn;
00022 class hk_dsboolean;
00023 class hk_dscombobox;
00024 class hk_dsmemo;
00025 class hk_dsimage;
00026 class hk_dsdate;
00027 class hk_dsgrid;
00028 class hk_visible;
00029 class hk_dsvisible;
00030 class hk_dsdatavisible;
00031 class hk_presentation;
00032 class hk_form;
00033 class hk_report;
00034 class hk_reportdata;
00035 class hk_subform;
00036 
00044 class hk_interpreter:public hk_class
00045 {
00046 public:
00047 hk_interpreter(hk_presentation* p);
00048 virtual ~hk_interpreter(){}
00049 virtual void init(){}
00053 virtual bool on_click(hk_visible*)=0;
00057 virtual bool on_doubleclick(hk_visible*)=0;
00062 virtual bool before_row_change(hk_dsvisible*)=0;
00066 virtual bool after_row_change(hk_dsvisible*)=0;
00070 virtual bool before_update(hk_dsvisible*)=0;
00075 virtual bool after_update(hk_dsvisible*)=0;
00079 virtual bool before_delete(hk_dsvisible*)=0;
00083 virtual bool after_delete(hk_dsvisible*)=0;
00087 virtual bool before_insert(hk_dsvisible*)=0;
00091 virtual bool after_insert(hk_dsvisible*)=0;
00095 virtual bool on_close(hk_visible*)=0;
00099 virtual bool on_open(hk_visible*)=0;
00103 virtual bool on_getfocus(hk_visible*)=0;
00107 virtual bool on_loosefocus(hk_visible*)=0;
00108 
00112 virtual bool on_key(hk_visible*)=0;
00113 
00117 virtual bool on_valuechanged(hk_dsdatavisible*)=0;
00118 
00122 virtual bool on_print_data(hk_reportdata*)=0;
00126 virtual bool on_print_new_page(hk_report*)=0;
00127 
00128 virtual bool on_select(hk_dscombobox*)=0;
00129 virtual bool on_select(hk_dsgridcolumn*)=0;
00130 
00134 bool scripterror(void){return p_error_occured;}
00138 hk_string errormessage(void){return p_errormessage;}
00142 int error_rownumber(void){return p_error_rownumber;}
00146 virtual hk_string interpretername(void) const {return "unknown";}
00147 enum enum_action{       a_before_row_change,
00148                                 a_after_row_change,
00149                                 a_click,
00150                                 a_doubleclick,
00151                                 a_on_open,
00152                                 a_on_close,
00153                                 a_on_getfocus,
00154                                 a_on_loosefocus,
00155                                 a_on_key,
00156                                 a_before_update,
00157                                 a_after_update,
00158                                 a_before_delete,
00159                                 a_after_delete,
00160                                 a_before_insert,
00161                                 a_after_insert,
00162                                 a_on_print_data,
00163                                 a_on_print_new_page,
00164                                 a_on_select,
00165                                 a_on_valuechanged
00166                                 };//when gets updated don't forget to update hk_kdesimpleform/hk_kdesimplereport::script_error !!!
00167 
00168 protected:
00169 hk_presentation* p_presentation;
00170 bool p_error_occured;
00171 hk_string p_errormessage;
00172 int p_error_rownumber;
00173 
00174 private:
00175 
00176 };
00177 
00186 class hk_no_interpreter:public hk_interpreter
00187 {
00188 public:
00189 hk_no_interpreter(hk_presentation*p);
00190 virtual bool on_click(hk_visible*);
00191 virtual bool on_doubleclick(hk_visible*);
00192 virtual bool before_row_change(hk_dsvisible*);
00193 virtual bool after_row_change(hk_dsvisible*);
00194 virtual bool before_update(hk_dsvisible*);
00195 virtual bool after_update(hk_dsvisible*);
00196 virtual bool on_close(hk_visible*);
00197 virtual bool on_open(hk_visible*);
00198 virtual bool before_delete(hk_dsvisible*);
00199 virtual bool after_delete(hk_dsvisible*);
00200 virtual bool before_insert(hk_dsvisible*);
00201 virtual bool after_insert(hk_dsvisible*);
00202 virtual bool on_print_data(hk_reportdata*);
00203 virtual bool on_print_new_page(hk_report*);
00204 virtual bool on_getfocus(hk_visible*);
00205 virtual bool on_loosefocus(hk_visible*);
00206 virtual bool on_key(hk_visible*);
00207 virtual bool on_select(hk_dscombobox*);
00208 virtual bool on_select(hk_dsgridcolumn*);
00209 virtual bool on_valuechanged(hk_dsdatavisible*);
00210 private:
00211 void warning(void);
00212  bool warning_already_displayed;
00213 };
00214 
00215 
00216 
00217 class hk_pythoninterpreterprivate;
00226 class hk_pythoninterpreter:public hk_interpreter
00227 {
00228 public:
00229 hk_pythoninterpreter(hk_presentation* );
00230 virtual ~hk_pythoninterpreter();
00231 virtual void init();
00232 
00233 virtual bool on_click(hk_visible*);
00234 virtual bool on_doubleclick(hk_visible*);
00235 virtual bool before_row_change(hk_dsvisible*);
00236 virtual bool after_row_change(hk_dsvisible*);
00237 virtual bool before_update(hk_dsvisible*);
00238 virtual bool after_update(hk_dsvisible*);
00239 virtual bool on_close(hk_visible*);
00240 virtual bool on_open(hk_visible*);
00241 virtual hk_string interpretername(void) const {return "python";}
00242 virtual bool before_delete(hk_dsvisible*);
00243 virtual bool after_delete(hk_dsvisible*);
00244 virtual bool before_insert(hk_dsvisible*);
00245 virtual bool after_insert(hk_dsvisible*);
00246 virtual bool on_print_data(hk_reportdata*);
00247 virtual bool on_print_new_page(hk_report*);
00248 virtual bool on_getfocus(hk_visible*);
00249 virtual bool on_loosefocus(hk_visible*);
00250 virtual bool on_key(hk_visible*);
00251 virtual bool on_select(hk_dscombobox*);
00252 virtual bool on_select(hk_dsgridcolumn*);
00253 virtual bool on_valuechanged(hk_dsdatavisible*);
00254 
00255 protected:
00256 
00257 
00258 private:
00259 void error_occured(enum_action action);
00260 bool execute_script(const hk_string& script,enum_action action);
00261 hk_string pystatement(void);
00262 hk_pythoninterpreterprivate* p_privatdata;
00263 
00264 static int p_referencecounting;
00265 
00266 
00267 };
00268 
00269 
00270  hk_button* currentbutton(void);
00271  hk_dslineedit* currentlineedit(void);
00272  hk_dsmemo* currentmemo(void);
00273  hk_dsgrid* currentgrid(void);
00274  hk_dsgridcolumn* currentgridcolumn(void);
00275  hk_dscombobox* currentcombobox(void);
00276  hk_dsboolean*  currentboolean(void);
00277  hk_form* currentform(void);
00278  hk_report* currentreport(void);
00279  hk_reportdata* currentreportdata(void);
00280  hk_dsvisible* currentdsvisible(void);
00281  hk_visible*  currentvisible(void);
00282  hk_dsimage* currentdsimage(void);
00283  hk_dsdate*  currentdsdate(void);
00284  hk_button *cast_button(hk_visible*);
00285  hk_dslineedit *cast_dslineedit(hk_visible*);
00286  hk_dsmemo *cast_dsmemo(hk_visible*);
00287  hk_dsgrid *cast_dsgrid(hk_visible*);
00288  hk_dsgridcolumn *cast_dsgridcolumn(hk_visible*);
00289  hk_dscombobox *cast_dscombobox(hk_visible*);
00290  hk_dsboolean *cast_dsboolean(hk_visible*);
00291  hk_dsimage *cast_dsimage(hk_visible*);
00292  hk_dsdate *cast_dsdate(hk_visible*);
00293  hk_dsvisible *cast_dsvisible(hk_visible*);
00294  hk_form *cast_form(hk_visible*);
00295  hk_report *cast_report(hk_visible*);
00296  hk_reportdata *cast_reportdata(hk_visible*);
00297  hk_subform *cast_subform(hk_visible*);
00298 
00299 #endif //HK_INTERPRETER
00300 

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