]>
Commit | Line | Data |
---|---|---|
bd9396d5 HH |
1 | ///////////////////////////////////////////////////////////////////////////// |
2 | // Name: No names yet. | |
3 | // Purpose: Contrib. demo | |
4 | // Author: Aleksandras Gluchovas | |
5 | // Modified by: | |
6 | // Created: 9/11/98 | |
7 | // RCS-ID: $Id$ | |
8 | // Copyright: (c) Aleksandras Gluchovas | |
9 | // Licence: wxWindows license | |
10 | ///////////////////////////////////////////////////////////////////////////// | |
11 | ||
12 | #ifndef __HINTANIMPL_G__ | |
13 | #define __HINTANIMPL_G__ | |
14 | ||
15 | #include "controlbar.h" | |
16 | ||
17 | #include "wx/timer.h" | |
18 | ||
19 | class cbHintAnimTimer; | |
20 | ||
21 | class cbHintAnimationPlugin : public cbPluginBase | |
22 | { | |
23 | DECLARE_DYNAMIC_CLASS( cbHintAnimationPlugin ) | |
24 | protected: | |
25 | friend class cbHintAnimTimer; | |
26 | ||
27 | wxScreenDC* mpScrDc; // created while tracking hint-rect | |
28 | cbHintAnimTimer* mpAnimTimer; | |
29 | ||
30 | // FOR NOW:: try it without mutually exculisve locks | |
31 | volatile wxRect mCurRect; | |
32 | ||
33 | // state variables | |
34 | ||
35 | bool mAnimStarted; | |
36 | bool mStopPending; | |
37 | ||
38 | bool mPrevInClient; | |
39 | bool mCurInClient; | |
40 | ||
41 | wxRect mPrevRect; | |
42 | ||
43 | public: | |
44 | int mMorphDelay; // delay between frames in miliseconds, default: 20 | |
45 | int mMaxFrames; // number of iterations for hint morphing, default: 30 | |
46 | // (morph duration = mMorphDelay * mMaxFrames msec) | |
47 | ||
48 | int mInClientHintBorder; // default: 4 pixels | |
49 | ||
50 | bool mAccelerationOn; // TRUE, if morph accelerates, otherwise morph | |
51 | // speed is constant. Default: TRUE | |
52 | ||
53 | // TBD:: get/set methods for above members | |
54 | ||
55 | protected: | |
56 | void StartTracking(); | |
57 | ||
58 | void DrawHintRect ( wxRect& rect, bool isInClientRect); | |
59 | void EraseHintRect( wxRect& rect, bool isInClientRect); | |
60 | ||
61 | void FinishTracking(); | |
62 | ||
63 | void DoDrawHintRect( wxRect& rect, bool isInClientRect); | |
64 | ||
65 | void RectToScr( wxRect& frameRect, wxRect& scrRect ); | |
66 | ||
67 | public: | |
68 | cbHintAnimationPlugin(void); | |
69 | ||
70 | ~cbHintAnimationPlugin(); | |
71 | ||
72 | cbHintAnimationPlugin( wxFrameLayout* pPanel, int paneMask = wxALL_PANES ); | |
73 | ||
74 | void OnDrawHintRect( cbDrawHintRectEvent& event ); | |
75 | ||
76 | DECLARE_EVENT_TABLE() | |
77 | }; | |
78 | ||
79 | ||
80 | // helper classes | |
81 | ||
82 | struct MorphInfoT | |
83 | { | |
84 | wxPoint mFrom; | |
85 | wxPoint mTill; | |
86 | }; | |
87 | ||
88 | class cbHintAnimTimer : public wxTimer | |
89 | { | |
90 | protected: | |
91 | ||
92 | friend class cbHintAnimationPlugin; | |
93 | ||
94 | wxRect mPrevMorphed; | |
95 | ||
96 | MorphInfoT mUpperLeft; | |
97 | MorphInfoT mLowerRight; | |
98 | int mCurIter; | |
99 | ||
100 | long mLock; | |
101 | ||
102 | cbHintAnimationPlugin* mpPl; | |
103 | ||
104 | void MorphPoint( wxPoint& origin, MorphInfoT& info, wxPoint& point ); | |
105 | ||
106 | public: | |
107 | ||
108 | cbHintAnimTimer(void); | |
109 | ||
110 | virtual void Notify(void); | |
111 | ||
112 | virtual bool Init( cbHintAnimationPlugin* pAnimPl, bool reinit ); | |
113 | }; | |
114 | ||
115 | #endif |