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