UNIVERS  15.3
UNIVERS base processing software API
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
ZtScrollBar.H
1 // ZtScrollBar.H $Revision: 1.5 $ $Date: 2005/04/29 10:11:53 $
2 
3 #if !defined __ZtScrollBar_H
4 
5 #define __ZtScrollBar_H
6 
7 #include <zm/ZTypes.h>
8 #include <zm/ZtObject.H>
9 
10 
11 /* Scrollbar coord is defined in 0..SB_COORD_SET */
12 #define SB_COORD_SET 32000
13 
14 /* Default increment fraction: 0..1 */
15 #define SB_INCREMENT 0.05
16 
17 
18 /*************************************************************
19  * Base class for all scrollbar realization. Establish
20  * interface and tools for any specific object. Scrollbar
21  * has own coordinates that is mapped to bounds of its natural
22  * group. By default page increment is equal to current slider
23  * size and increment is equal to 1/20 of slider size.
24  *************************************************************/
25 class ZtScrollBar : public ZtObject
26 {
27 public:
28 
29  /* Dimension: zdHorizontal, zdVertical scrollbar */
30  ZtScrollBar (ZtMain* pManager, ZDimension dimension, ZGroupId nid);
31  ZtScrollBar (ZtMain* pManager, ZDimension dimension, ZGroupId nid,
32  Widget sb_widget);
33 #ifndef NO_XTOOLKIT
34  /* Define own XmScrollBar */
35  ZtScrollBar (ZtMain* pManager, ZGroupId pxid, ZGroupId pyid,
36  ZDimension dimension, ZGroupId nid);
37 #endif /* NO_XTOOLKIT */
38 
39  virtual ~ZtScrollBar ();
40 
41  /* Call this function in callback of any event for scrollbar */
42  virtual void sb_callback (Widget w = NULL);
43 
44  /* Standard scrollbar callback (with this passed via pThis) */
45  static void sb_callback (Widget w, XtPointer pThis, XtPointer pCallData);
46 
47  /* Register for scrollbar local callback. */
48  void use_sb_callback ();
49 
50  /* Synchronize given scrollbar widget position and size with it's
51  natural group parameters or synchronize with default scrollbar */
52  virtual void sb_synchronize (Widget w = NULL);
53 
54  /* Set increment for slider as fraction of slider size */
55  void sb_increment (float v_inc);
56 
57  /* Force synchronization instead of redraw */
58  virtual void expose ();
59 
60  /* Return reference at the only natural coord group of scrollbar */
61  ZNCoordSlave& nslave () const;
62 
64  virtual const char* class_id () const;
65 
66 private:
67 
68  Widget wsb; /* widget of Motif's scrollbar */
69  Widget own_wsb; /* own widget of Motif's scrollbar -
70  * create and destroy with the object */
71 
72 protected:
73 
74  float inc_frac; /* increment as fraction of slider size */
75 
76  ZDimension dim; /* zdHorizontal or zdVertical */
77 
78  /* Convert natural coord into scrollbar coord meaning the whole
79  * range coord is associated with bounds of natural group:
80  * 0..|b[1]-b[0]| ==> 0..SB_COORD_SET */
81  int nc2sb (float nc_value);
82 
83  /* Convert scrollbar value into natural one
84  * 0..|b[1]-b[0]| <== 0..SB_COORD_SET */
85  float sb2nc (int sb_value);
86 
87  /* Set location of scrollbar widget (own_wsb) the same as of *this
88  * zobject */
89  void set_own_location ();
90 
91 };
92 
93 #endif // ZtScrollBar.H
Definition: ZtMain.H:32
virtual const char * class_id() const
Definition: ZtObject.H:57
Definition: ZtScrollBar.H:25
Definition: ZNaturalCoord.H:88
virtual void expose()