]>
Commit | Line | Data |
---|---|---|
1 | /* | |
2 | Copyright (C) 1996 Scott W. Sadler | |
3 | All rights reserved. | |
4 | */ | |
5 | ||
6 | /* | |
7 | XsOutline.h | |
8 | ||
9 | History | |
10 | 03-Mar-96 1.0; Scott W. Sadler (ssadler@cisco.com) | |
11 | Created | |
12 | */ | |
13 | ||
14 | #ifndef XSOUTLINE_H | |
15 | #define XSOUTLINE_H | |
16 | ||
17 | // Includes | |
18 | ||
19 | #include <X11/Intrinsic.h> | |
20 | ||
21 | // XsOutline class | |
22 | ||
23 | class XsOutline { | |
24 | ||
25 | public: | |
26 | ||
27 | // Constructor/Destructor | |
28 | ||
29 | XsOutline (Widget w); | |
30 | virtual ~XsOutline ( ); | |
31 | ||
32 | // Event handler | |
33 | ||
34 | Boolean go (Boolean drawInitial = False); | |
35 | ||
36 | // Utilities | |
37 | ||
38 | int width ( ) const; | |
39 | int height ( ) const; | |
40 | int x ( ) const; | |
41 | int y ( ) const; | |
42 | ||
43 | protected: | |
44 | ||
45 | // Enumerations | |
46 | ||
47 | enum { BorderSize = 6 }; | |
48 | enum { GrabEventMask = (unsigned int)(ButtonPressMask | ButtonReleaseMask | PointerMotionMask) }; | |
49 | ||
50 | // Components | |
51 | ||
52 | Widget _w; | |
53 | ||
54 | // Graphics context | |
55 | ||
56 | GC _gc; | |
57 | ||
58 | // Current dimensions | |
59 | ||
60 | int _x, _y; | |
61 | int _width; | |
62 | int _height; | |
63 | ||
64 | // Outline utilities | |
65 | ||
66 | virtual void _motionHandler (XEvent*) = 0; | |
67 | virtual Cursor _getCursor ( ) const; | |
68 | void _drawOutline (Boolean); | |
69 | ||
70 | private: | |
71 | ||
72 | // Pointer grabs | |
73 | ||
74 | Boolean _grabPointer ( ); | |
75 | void _ungrabPointer ( ); | |
76 | ||
77 | // Save dimensions | |
78 | ||
79 | int _savedX, _savedY; | |
80 | int _savedW, _savedH; | |
81 | ||
82 | // Drawing | |
83 | ||
84 | void _drawIt (int, int, int, int); | |
85 | }; | |
86 | ||
87 | // Inline member functions | |
88 | ||
89 | inline int XsOutline::width ( ) const | |
90 | { | |
91 | return (_width); | |
92 | } | |
93 | ||
94 | inline int XsOutline::height ( ) const | |
95 | { | |
96 | return (_height); | |
97 | } | |
98 | ||
99 | inline int XsOutline::x ( ) const | |
100 | { | |
101 | return (_x); | |
102 | } | |
103 | ||
104 | inline int XsOutline::y ( ) const | |
105 | { | |
106 | return (_y); | |
107 | } | |
108 | ||
109 | #endif |