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