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_FORM_H 00012 #define HK_FORM_H 00013 #include "hk_presentation.h" 00014 #include <list> 00015 using namespace std; 00016 00017 class hk_dslineedit; 00018 class hk_dsgrid; 00019 class hk_dsboolean; 00020 class hk_dsrowselector; 00021 class hk_dscombobox; 00022 class hk_dsmemo; 00023 class hk_button; 00024 class hk_label; 00025 class hk_dsimage; 00026 class hk_dsdate; 00027 class hk_tabvisible; 00028 class hk_formprivate; 00029 class hk_subform; 00030 class hk_formmodeprivate; 00043 class hk_form:public hk_presentation 00044 { 00045 friend class hk_dsvisible; 00046 friend class hk_visible; 00047 friend class hk_subform; 00048 00049 public: 00050 00051 hk_form(void); 00052 virtual ~hk_form(void); 00058 hk_dsgrid* new_grid(void); 00064 hk_dslineedit* new_lineedit(void); 00070 hk_dsboolean* new_bool(void); 00076 hk_dscombobox* new_combobox(void); 00082 hk_button* new_button(void); 00088 hk_dsrowselector* new_rowselector(void); 00094 hk_dsmemo* new_memo(void); 00100 hk_label* new_label(void); 00101 00102 hk_subform* new_subform(void); 00103 hk_dsdate* new_date(void); 00104 hk_dsimage* new_image(void); 00105 hk_tabvisible* new_tabvisible(void); 00106 00113 bool save_form(const hk_string& name="",bool ask=true); 00119 void load_form(const hk_string& name=""); 00120 virtual void savedata(ostream& s); 00121 virtual void loaddata(const hk_string& definition); 00122 00128 virtual void set_designsize(unsigned int width, unsigned int height,bool registerchange=true); 00129 hk_visible* get_visible(long nr); 00130 hk_visible* get_visible(const hk_string& identifier); 00131 virtual void bulk_operation(enum_bulkoperation bulkoperation); 00132 virtual bool set_mode(enum_mode s); 00136 hk_form* masterform(void) const; 00140 void clear_visiblelist(void); 00141 void set_taborder(list<int> t,bool registerchange=true, bool forcesetting=true); 00146 list<int> taborder() const; 00147 hk_visible* taborder_previous(hk_visible*); 00148 hk_visible* taborder_next(hk_visible*); 00149 hk_visible* first_tabobject(); 00150 hk_visible* last_tabobject(); 00154 virtual void goto_taborder_next(){} 00158 virtual void goto_taborder_previous(){} 00162 virtual void goto_taborder_first(){} 00166 virtual void goto_taborder_last(){} 00170 virtual void set_focus(hk_visible*){} 00171 00172 list<hk_visible*>* visibles(void); 00173 bool is_subform() const; 00174 virtual bool is_subpresentation(void); 00175 virtual bool show_asdialog(hk_form* parentform=NULL){return false;} 00176 00177 virtual int screen_width(); 00178 virtual int screen_height(); 00179 bool while_load_form(void) const; 00180 virtual bool while_loading(void); 00181 protected: 00182 void set_masterform(hk_form*); 00183 virtual hk_dsgrid* widget_specific_new_grid(void){return NULL;} 00184 virtual hk_dsrowselector* widget_specific_new_rowselector(void){return NULL;} 00185 virtual hk_dslineedit* widget_specific_new_lineedit(void){return NULL;} 00186 virtual hk_dsboolean* widget_specific_new_bool(void){return NULL;} 00187 virtual hk_button* widget_specific_new_button(void){return NULL;} 00188 virtual hk_dscombobox* widget_specific_new_combobox(void){return NULL;} 00189 virtual hk_dsmemo* widget_specific_new_memo(void){return NULL;} 00190 virtual hk_label* widget_specific_new_label(void){return NULL;} 00191 virtual hk_subform* widget_specific_new_subform(void){return NULL;} 00192 virtual hk_dsdate* widget_specific_new_date(void){return NULL;} 00193 virtual hk_dsimage* widget_specific_new_image(void){return NULL;} 00194 virtual hk_tabvisible* widget_specific_new_tabvisible(void){return NULL;} 00195 virtual void widget_specific_fieldresize(hk_visible* v); 00196 virtual void widget_specific_after_loadform(void){} 00197 void remove_visible(hk_visible* v); 00198 hk_visible* new_object(const hk_string& name); 00199 void raise_widget(hk_visible*); 00200 void lower_widget(hk_visible*); 00201 virtual void sizetype_changed(void); 00202 void set_subformobject(hk_subform*); 00203 hk_subform* subformobject() const; 00204 private: 00205 void add_visible(hk_visible* v); 00206 00207 hk_formprivate* p_private; 00208 hk_formmodeprivate* p_designdata; 00209 hk_formmodeprivate* p_viewdata; 00210 00211 }; 00212 #endif