]>
Commit | Line | Data |
---|---|---|
1 | ///////////////////////////////////////////////////////////////////////////// | |
2 | // Name: hintanimpl.h | |
3 | // Purpose: Header for cbHintAnimationPlugin class. | |
4 | // Author: Aleksandras Gluchovas | |
5 | // Modified by: | |
6 | // Created: 9/11/98 | |
7 | // RCS-ID: $Id$ | |
8 | // Copyright: (c) Aleksandras Gluchovas | |
9 | // Licence: wxWindows licence | |
10 | ///////////////////////////////////////////////////////////////////////////// | |
11 | ||
12 | #ifndef __HINTANIMPL_G__ | |
13 | #define __HINTANIMPL_G__ | |
14 | ||
15 | #if defined(__GNUG__) && !defined(__APPLE__) | |
16 | #pragma interface "hintanimpl.h" | |
17 | #endif | |
18 | ||
19 | #include "wx/fl/controlbar.h" | |
20 | ||
21 | #include "wx/timer.h" | |
22 | ||
23 | class WXDLLIMPEXP_FL cbHintAnimTimer; | |
24 | ||
25 | /* | |
26 | A plugin to draw animated hints when the user drags a pane. | |
27 | */ | |
28 | ||
29 | class WXDLLIMPEXP_FL cbHintAnimationPlugin : public cbPluginBase | |
30 | { | |
31 | DECLARE_DYNAMIC_CLASS( cbHintAnimationPlugin ) | |
32 | protected: | |
33 | friend class cbHintAnimTimer; | |
34 | ||
35 | wxScreenDC* mpScrDc; // created while tracking hint-rect | |
36 | cbHintAnimTimer* mpAnimTimer; | |
37 | ||
38 | // FOR NOW:: try it without mutually exculisve locks | |
39 | volatile wxRect mCurRect; | |
40 | ||
41 | // state variables | |
42 | ||
43 | bool mAnimStarted; | |
44 | bool mStopPending; | |
45 | ||
46 | bool mPrevInClient; | |
47 | bool mCurInClient; | |
48 | ||
49 | wxRect mPrevRect; | |
50 | ||
51 | public: | |
52 | int mMorphDelay; // delay between frames in miliseconds, default: 20 | |
53 | int mMaxFrames; // number of iterations for hint morphing, default: 30 | |
54 | // (morph duration = mMorphDelay * mMaxFrames msec) | |
55 | ||
56 | int mInClientHintBorder; // default: 4 pixels | |
57 | ||
58 | bool mAccelerationOn; // true, if morph accelerates, otherwise morph | |
59 | // speed is constant. Default: true | |
60 | ||
61 | // TBD:: get/set methods for above members | |
62 | ||
63 | protected: | |
64 | ||
65 | // Internal function for starting tracking. | |
66 | void StartTracking(); | |
67 | ||
68 | // Internal function for drawing a hint rectangle. | |
69 | void DrawHintRect ( wxRect& rect, bool isInClientRect); | |
70 | ||
71 | // Internal function for erasing a hint rectangle. | |
72 | void EraseHintRect( wxRect& rect, bool isInClientRect); | |
73 | ||
74 | // Internal function for finishing tracking. | |
75 | void FinishTracking(); | |
76 | ||
77 | // Internal function for drawing a hint rectangle. | |
78 | void DoDrawHintRect( wxRect& rect, bool isInClientRect); | |
79 | ||
80 | // Internal function for translating coordinates. | |
81 | void RectToScr( wxRect& frameRect, wxRect& scrRect ); | |
82 | ||
83 | public: | |
84 | // Default constructor. | |
85 | cbHintAnimationPlugin(); | |
86 | ||
87 | // Constructor, taking a layout panel and pane mask. | |
88 | cbHintAnimationPlugin( wxFrameLayout* pPanel, int paneMask = wxALL_PANES ); | |
89 | ||
90 | // Destructor. | |
91 | ~cbHintAnimationPlugin(); | |
92 | ||
93 | // Event handler respoding to hint draw events. | |
94 | void OnDrawHintRect( cbDrawHintRectEvent& event ); | |
95 | ||
96 | DECLARE_EVENT_TABLE() | |
97 | }; | |
98 | ||
99 | ||
100 | /* | |
101 | A private helper class. | |
102 | */ | |
103 | ||
104 | struct WXDLLIMPEXP_FL MorphInfoT | |
105 | { | |
106 | wxPoint mFrom; | |
107 | wxPoint mTill; | |
108 | }; | |
109 | ||
110 | /* | |
111 | A private helper class. | |
112 | */ | |
113 | ||
114 | class WXDLLIMPEXP_FL cbHintAnimTimer : public wxTimer | |
115 | { | |
116 | protected: | |
117 | ||
118 | friend class cbHintAnimationPlugin; | |
119 | ||
120 | wxRect mPrevMorphed; | |
121 | ||
122 | MorphInfoT mUpperLeft; | |
123 | MorphInfoT mLowerRight; | |
124 | int mCurIter; | |
125 | ||
126 | long mLock; | |
127 | ||
128 | cbHintAnimationPlugin* mpPl; | |
129 | ||
130 | void MorphPoint( wxPoint& origin, MorphInfoT& info, wxPoint& point ); | |
131 | ||
132 | public: | |
133 | ||
134 | cbHintAnimTimer(void); | |
135 | ||
136 | virtual void Notify(void); | |
137 | ||
138 | virtual bool Init( cbHintAnimationPlugin* pAnimPl, bool reinit ); | |
139 | }; | |
140 | ||
141 | #endif /* __HINTANIMPL_G__ */ | |
142 |