Databaseconnectionclasses  0.5.3
hk_visible.h
1 // ****************************************************************************
2 // copyright (c) 2000-2005 Horst Knorr <hk_classes@knoda.org>
3 // This file is part of the hk_classes library.
4 // This file may be distributed and/or modified under the terms of the
5 // GNU Library Public License version 2 as published by the Free Software
6 // Foundation and appearing in the file COPYING included in the
7 // packaging of this file.
8 // This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
9 // WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
10 // ****************************************************************************
11 #ifndef HK_VISIBLE
12 #define HK_VISIBLE
13 #include "hk_definitions.h"
14 #include "hk_class.h"
15 #include "hk_colour.h"
16 #include "hk_font.h"
17 #include "hk_key.h"
18 
19 using namespace std;
20 
21 class hk_presentation;
22 class hk_form;
23 class hk_report;
25 class hk_visibleprivate;
26 class hk_tabvisible;
35 class hk_visible:public hk_class
36 
37 {
38  friend class hk_presentation;
39  friend class hk_form;
40  friend class hk_reportdata;
41  friend class hk_tabvisible;
42  public:
43  hk_visible(hk_presentation* p=NULL);
44  virtual ~hk_visible(void);
48  void set_x(unsigned int px, bool registerchange=true);
52  void set_y(unsigned int py, bool registerchange=true);
56  void set_width(unsigned int w, bool registerchange=true);
60  void set_height(unsigned int h, bool registerchange=true);
61  unsigned int x(void) const;
62  unsigned int y(void) const;
63  unsigned int width(void)const;
64  unsigned int height(void) ;
68  void set_size(unsigned int x, unsigned int y,unsigned int w, unsigned int h, bool registerchange=true);
69  void set_size(unsigned int x, unsigned int y,unsigned int w, unsigned int h, bool registerchange,bool force_setting);
70  void set_size(unsigned int width, unsigned int height, bool registerchange=true);
71  void set_position(unsigned int x, unsigned int y, bool registerchange=true);
76  void set_label(const hk_string& l, bool registerchange=true);
77  void set_label(const hk_string& l, bool registerchange,bool force_setting);
78  hk_string label(void);
83  bool set_identifier(const hk_string&,bool registerchange=true,enum_interaction=interactive);
84  hk_string identifier(void) const;
85 
86 
87  enum enum_visibletype {textlabel,button,rowselector,boolean,lineedit,memo,combobox,grid,form,report,reportsection,reportdata,query,subform,image,date,tabvisible,other};
88  enum_visibletype type(void) {return p_visibletype;}
92  void set_font(const hk_string& font,int size,bool registerchange=true);
93  void set_font(const hk_string& font,int size,bool registerchange,bool force_setting);
94  void set_font(const hk_font& font,bool registerchange=true);
95  void set_font(const hk_font& font,bool registerchange,bool force_setting);
96 
97  virtual hk_font font(void);
101  void set_foregroundcolour(const hk_colour& colour,bool registerchange=true);
102  void set_foregroundcolour(const hk_colour& colour,bool registerchange,bool force_setting);
103  hk_colour foregroundcolour(void);
107  void set_backgroundcolour(const hk_colour& colour,bool registerchange=true);
108  void set_backgroundcolour(const hk_colour& colour,bool registerchange,bool force_setting);
109  hk_colour backgroundcolour(void);
110 
116  void set_neverregisterchange(bool n);
117  void set_neverregisterchange(bool n,bool force_setting);
118  bool neverregisterchange(void);
119  virtual void savedata(ostream& s );
120  virtual void loaddata(xmlNodePtr definition);
124  long presentationnumber(void) const;
125  void set_datetimeformat(const hk_string& datetime,const hk_string& date, const hk_string& time);
126  void set_datetimeformat(const hk_string& datetime,const hk_string& date, const hk_string& time,bool force_setting);
127  hk_string datetimeformat(void);
128  hk_string dateformat(void);
129  hk_string timeformat(void);
130  void set_counts_as(unsigned long int c);
131  virtual void set_counts_as(unsigned long int c,bool force_setting);
132  virtual unsigned long int counts_as(void);
133  virtual hk_string replace(const hk_string& where);
134  hk_presentation* presentation(void);
135 
140  void set_load_presentationnumber(bool l);
141  void set_load_presentationnumber(bool l,bool force_setting);
142  bool load_presentationnumber(void);
146  enum alignmenttype{alignleft,alignright,aligncenter,aligndefault};
150  void set_alignment(alignmenttype a,bool registerchange=true);
151  void set_alignment(alignmenttype a,bool registerchange,bool force_setting);
152  alignmenttype alignment(void);
153 
159  static alignmenttype defaulttextalignment(void);
165  static alignmenttype defaultnumberalignment(void);
169  static void set_open_maximized_windows(bool m);
170  static bool open_maximized_windows(void);
171 
172 
176 void set_tooltip(const hk_string&,bool registerchange=true,bool force_setting=false);
180 hk_string tooltip(void);
181 
182 
183 
184 virtual void show_widget(void);
185 virtual void hide_widget(void);
186 virtual bool close_widget(void);
187 
188 
189 
193  virtual void lower_widget(bool registerchange=true);
197  virtual void raise_widget(bool registerchange=true);
198 
202  void set_on_click_action(const hk_string&,bool registerchange=true,bool force_setting=true);
206  hk_string on_click_action(void);
210  void set_on_doubleclick_action(const hk_string&,bool registerchange=true,bool force_setting=true);
214  hk_string on_doubleclick_action(void);
220  void set_on_open_action(const hk_string&,bool registerchange=true,bool force_setting=true);
224  hk_string on_open_action(void);
229  void set_on_close_action(const hk_string&,bool registerchange=true,bool force_setting=true);
233  hk_string on_close_action(void);
234 
240 void set_on_getfocus_action(const hk_string&,bool registerchange=true,bool force_setting=true);
245 hk_string on_getfocus_action(void);
246 
252 void set_on_loosefocus_action(const hk_string&,bool registerchange=true,bool force_setting=true);
257 hk_string on_loosefocus_action(void);
258 
259 
260 void set_on_key_action(const hk_string&,bool registerchange=true,bool force_setting=true);
265 hk_string on_key_action(void);
266 void set_key(const hk_key&);
270 hk_key* key() const;
271 
272 void set_enabled(bool enabled, bool registerchange=true,bool force_setting=false);
273 bool is_enabled();
274 
275 
276 
277 // script action called when this visible object is clicked
278 virtual bool action_on_click(void);
279 virtual bool action_on_doubleclick(void);
280 virtual bool action_on_close(void);
281 virtual bool action_on_open(void);
282 virtual bool action_on_getfocus(void);
283 virtual bool action_on_loosefocus(void);
284 virtual bool action_on_key(void);
285  bool in_tabvisible(void) const;
286 void set_buddylabel(long int labelid,bool registerchange=true,bool force_setting=false);
287 long int buddylabel(void) const;
288 void set_movebuddylabel(bool);
289 bool move_buddylabel(void) const;
290 
291 
292 int tag_number(const hk_string&);
293 virtual hk_string tag_value(int tagnumber, bool& ok);
294 virtual hk_string column_value(const hk_string& colname,bool& ok);
295 hk_string tag_value(const hk_string&, bool& ok);
296 int register_tag(const hk_string&);
297 
298  protected:
299  virtual void widget_specific_form_resizes(void);
300  virtual void widget_specific_font_changed(void);
301  virtual void widget_specific_label_changed(void);
302  virtual void widget_specific_foregroundcolour_changed(const hk_colour& oldcolour);
303  virtual void widget_specific_backgroundcolour_changed(const hk_colour& oldcolour);
304  virtual bool widget_specific_coordinates(unsigned int px,unsigned int py,unsigned int pwidth,unsigned int pheight);
305  virtual void widget_specific_raise_widget(void);
306  virtual void widget_specific_lower_widget(void);
307  virtual void widget_specific_tooltip_changed(void);
308  virtual void widget_specific_enabled_changed(void);
309  virtual bool presentationmode_changed(void);
310  virtual void before_presentationmode_changed(void);
311  virtual void widget_specific_alignment(void);
312  virtual void sizetype_changed(void);
313  virtual void widget_specific_sizetype_changed(void);
314 
315  bool allow_datachanging(bool force_setting);
316  enum enum_has_changed{standard,forcesetting};
317  void has_changed(bool registerchange,enum_has_changed force_setting=standard);
318  hk_presentation* p_presentation;
319  enum_visibletype p_visibletype;
320  bool p_setcoordinates;
321  bool p_setwidgetcoordinates;
322  bool while_init;
323  void set_tabvisible(hk_tabvisible*);
324  private:
325  static alignmenttype p_defaulttextalign;
326  static alignmenttype p_defaultnumberalign;
327  static bool p_open_maximized_windows;
328 
329  hk_visiblemodeprivate* p_designdata;
330  hk_visiblemodeprivate* p_viewdata;
331  hk_visibleprivate* p_private;
332  long int p_vupn; //visual unique presentation number
333 
334 };
335 #endif
void set_on_open_action(const hk_string &, bool registerchange=true, bool force_setting=true)
Definition: hk_visible.cpp:1215
alignmenttype
Definition: hk_visible.h:146
void set_tooltip(const hk_string &, bool registerchange=true, bool force_setting=false)
Definition: hk_visible.cpp:1276
basic class for all other defined classes.
Definition: hk_class.h:52
void set_x(unsigned int px, bool registerchange=true)
Definition: hk_visible.cpp:303
virtual void loaddata(xmlNodePtr definition)
Definition: hk_tabvisible.cpp:139
hk_string on_getfocus_action(void)
Definition: hk_visible.cpp:1316
base class for a pressed key
Definition: hk_key.h:28
void set_alignment(alignmenttype a, bool registerchange=true)
Definition: hk_visible.cpp:907
void set_on_doubleclick_action(const hk_string &, bool registerchange=true, bool force_setting=true)
Definition: hk_visible.cpp:1189
void set_on_loosefocus_action(const hk_string &, bool registerchange=true, bool force_setting=true)
Definition: hk_visible.cpp:1324
hk_key * key() const
Definition: hk_visible.cpp:1398
represents a RGB-colour
Definition: hk_colour.h:24
represents a font
Definition: hk_font.h:26
void set_size(unsigned int x, unsigned int y, unsigned int w, unsigned int h, bool registerchange=true)
Definition: hk_visible.cpp:159
base class for forms
Definition: hk_form.h:43
enum_interaction
Definition: hk_class.h:60
Definition: hk_visible.cpp:21
static void set_defaultnumberalignment(alignmenttype a)
Definition: hk_visible.cpp:954
void set_label(const hk_string &l, bool registerchange=true)
Definition: hk_visible.cpp:394
void set_neverregisterchange(bool n)
Definition: hk_visible.cpp:684
Definition: hk_visible.cpp:80
static void set_defaulttextalignment(alignmenttype a)
Definition: hk_visible.cpp:940
void set_foregroundcolour(const hk_colour &colour, bool registerchange=true)
Definition: hk_visible.cpp:981
hk_string on_close_action(void)
Definition: hk_visible.cpp:1259
void set_width(unsigned int w, bool registerchange=true)
Definition: hk_visible.cpp:315
hk_string tooltip(void)
Definition: hk_visible.cpp:1289
void set_backgroundcolour(const hk_colour &colour, bool registerchange=true)
Definition: hk_visible.cpp:1014
represents the data of a field within a section.
Definition: hk_reportdata.h:75
virtual void savedata(ostream &s)
Definition: hk_tabvisible.cpp:134
void set_height(unsigned int h, bool registerchange=true)
Definition: hk_visible.cpp:333
long presentationnumber(void) const
Definition: hk_visible.cpp:298
void set_on_getfocus_action(const hk_string &, bool registerchange=true, bool force_setting=true)
Definition: hk_visible.cpp:1305
base class for visible widgets
Definition: hk_visible.h:35
void set_y(unsigned int py, bool registerchange=true)
Definition: hk_visible.cpp:309
void set_load_presentationnumber(bool l)
Definition: hk_visible.cpp:878
virtual void lower_widget(bool registerchange=true)
Definition: hk_visible.cpp:1056
hk_string on_open_action(void)
Definition: hk_visible.cpp:1227
base class for multidatasource based classes like forms and reports
Definition: hk_presentation.h:40
static void set_open_maximized_windows(bool m)
Definition: hk_visible.cpp:969
void set_font(const hk_string &font, int size, bool registerchange=true)
Definition: hk_visible.cpp:636
bool set_identifier(const hk_string &, bool registerchange=true, enum_interaction=interactive)
Definition: hk_visible.cpp:448
basic class to create reports
Definition: hk_report.h:52
virtual void raise_widget(bool registerchange=true)
Definition: hk_visible.cpp:1064
hk_string on_loosefocus_action(void)
Definition: hk_visible.cpp:1335
void set_on_click_action(const hk_string &, bool registerchange=true, bool force_setting=true)
Definition: hk_visible.cpp:1159
hk_string on_key_action(void)
Definition: hk_visible.cpp:1375
hk_string on_doubleclick_action(void)
Definition: hk_visible.cpp:1199
void set_on_close_action(const hk_string &, bool registerchange=true, bool force_setting=true)
Definition: hk_visible.cpp:1246
hk_string on_click_action(void)
Definition: hk_visible.cpp:1172
Definition: hk_tabvisible.h:35