UNIVERS  15.3
UNIVERS base processing software API
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
ZtScale.H
1 /* $Id: ZtScale.H,v 1.9 2005/07/18 07:16:56 nikita Exp $ */
2 
3 #if !defined __ZtScale_H
4 
5 #define __ZtScale_H
6 
7 #include <zm/ZtObject.H>
8 
9 
10 #define ztScaleLeft (0x4|0x1)
11 #define ztScaleRight (0x4|0x2)
12 #define ztScaleUp (0x8|0x1)
13 #define ztScaleDown (0x8|0x2)
14 
15 
16 class ZtScale : public ZtObject
17 {
18 private:
19 
20  char szDefaultFormat[6]; /* = "%6.1f" */
21 
22 protected:
23  XColor xAxisColor;
24  XColor xLabelColor;
25 
26  int ver_dim; /* TRUE if vertical */
27  int less_coord; /* TRUE if in top(v) and left(h) */
28  int more_coord; /* TRUE if in bottom(v) and right(h) */
29 
30  int iCharsCount; /* planned count of chars in one label */
31  char *szLabel; /* memory for temporary label text */
32  char *szFormat; /* format of label string for sprintf */
33 
34  int big_notch_size, small_notch_size, labels_offset;
35  float big_notch_step; /* natural coord step */
36  int small_notch_freq; /* count of small notches between two
37  big notches */
38 
39  Logic dots; /* TRUE if notches are doted */
40  Logic auto_step; /* TRUE if notches are doted */
41 
42  ColorPixel axisColor, labelColor;
43  char *axisColorName;
44  char *labelColorName;
45  void drawAxis ();
46  void drawLabels ();
47 
48  void update_limitations ();
49 
50 public:
51 
52  ZtScale (ZtMain* pManager, ZGroupId pxid, ZGroupId pyid,
53  int dimension, ZGroupId nid);
54 
55  ~ZtScale();
56 
57  void set_axis_color (const char* szColorName);
58  void set_axis_color (ColorPixel cpixel);
59  ColorPixel get_axis_color () const;
60  const char* get_axis_color_name () const;
61 
62  void set_label_color (const char* szColorName);
63  void set_label_color (ColorPixel cpixel);
64  ColorPixel get_label_color () const;
65  const char* get_label_color_name () const;
66 
67  void set_auto_step (Logic flag);
68  Logic get_auto_step () const;
69 
71  void auto_step_calc ();
72 
73  void set_label_step (float val);
74  float get_label_step () const;
75 
76  void set_notch_freq (int cnt);
77  int get_notch_freq () const;
78 
79  void set_doted_notches ();
80 
81  /* sizes[0] - big notches size (pixels);
82  sizes[1] - small notches size (pixels);
83  sizes[2] - labels offset from big notches (pixels; >=3).
84  */
85  void set_sizes (int sizes[3]);
86  void get_sizes (int sizes[3]) const;
87 
88  void set_chars_count (int new_count);
89  int get_chars_count () const;
90 
91  void set_float_label_format (int iWidth, int iPrecision = 0);
92  virtual char* print_label (char* label, float val);
93 
94  /* Non-trivial expose */
95  virtual void redraw ();
96 
97  /* Called when font change take place */
98  virtual void changed_state (int mask_of_changes);
99 
101  virtual const char* class_id () const;
102 
103 };
104 
105 
106 #endif // ZtScale.H
virtual void redraw()
Definition: ZtMain.H:32
Definition: ZtScale.H:16
void auto_step_calc()
Definition: ZtObject.H:57
virtual const char * class_id() const