]>
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 | ||
ab7ce33c | 15 | #if defined(__GNUG__) && !defined(__APPLE__) |
8e08b761 JS |
16 | #pragma interface "hintanimpl.h" |
17 | #endif | |
18 | ||
19 | #include "wx/fl/controlbar.h" | |
20 | ||
21 | #include "wx/timer.h" | |
22 | ||
510b9edb | 23 | class WXDLLIMPEXP_FL cbHintAnimTimer; |
8e08b761 | 24 | |
4cbc57f0 JS |
25 | /* |
26 | A plugin to draw animated hints when the user drags a pane. | |
27 | */ | |
28 | ||
510b9edb | 29 | class WXDLLIMPEXP_FL cbHintAnimationPlugin : public cbPluginBase |
8e08b761 | 30 | { |
4cbc57f0 | 31 | DECLARE_DYNAMIC_CLASS( cbHintAnimationPlugin ) |
8e08b761 | 32 | protected: |
4cbc57f0 | 33 | friend class cbHintAnimTimer; |
8e08b761 | 34 | |
4cbc57f0 JS |
35 | wxScreenDC* mpScrDc; // created while tracking hint-rect |
36 | cbHintAnimTimer* mpAnimTimer; | |
8e08b761 | 37 | |
4cbc57f0 JS |
38 | // FOR NOW:: try it without mutually exculisve locks |
39 | volatile wxRect mCurRect; | |
8e08b761 | 40 | |
4cbc57f0 | 41 | // state variables |
8e08b761 | 42 | |
4cbc57f0 JS |
43 | bool mAnimStarted; |
44 | bool mStopPending; | |
8e08b761 | 45 | |
4cbc57f0 JS |
46 | bool mPrevInClient; |
47 | bool mCurInClient; | |
8e08b761 | 48 | |
4cbc57f0 | 49 | wxRect mPrevRect; |
8e08b761 JS |
50 | |
51 | public: | |
4cbc57f0 JS |
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) | |
8e08b761 | 55 | |
4cbc57f0 | 56 | int mInClientHintBorder; // default: 4 pixels |
8e08b761 | 57 | |
c82c42d4 WS |
58 | bool mAccelerationOn; // true, if morph accelerates, otherwise morph |
59 | // speed is constant. Default: true | |
8e08b761 | 60 | |
4cbc57f0 | 61 | // TBD:: get/set methods for above members |
8e08b761 JS |
62 | |
63 | protected: | |
8e08b761 | 64 | |
4cbc57f0 JS |
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); | |
8e08b761 | 70 | |
4cbc57f0 JS |
71 | // Internal function for erasing a hint rectangle. |
72 | void EraseHintRect( wxRect& rect, bool isInClientRect); | |
8e08b761 | 73 | |
4cbc57f0 JS |
74 | // Internal function for finishing tracking. |
75 | void FinishTracking(); | |
8e08b761 | 76 | |
4cbc57f0 JS |
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 ); | |
8e08b761 JS |
82 | |
83 | public: | |
4cbc57f0 JS |
84 | // Default constructor. |
85 | cbHintAnimationPlugin(); | |
8e08b761 | 86 | |
4cbc57f0 JS |
87 | // Constructor, taking a layout panel and pane mask. |
88 | cbHintAnimationPlugin( wxFrameLayout* pPanel, int paneMask = wxALL_PANES ); | |
8e08b761 | 89 | |
4cbc57f0 JS |
90 | // Destructor. |
91 | ~cbHintAnimationPlugin(); | |
8e08b761 | 92 | |
4cbc57f0 JS |
93 | // Event handler respoding to hint draw events. |
94 | void OnDrawHintRect( cbDrawHintRectEvent& event ); | |
8e08b761 | 95 | |
4cbc57f0 | 96 | DECLARE_EVENT_TABLE() |
8e08b761 JS |
97 | }; |
98 | ||
99 | ||
4cbc57f0 JS |
100 | /* |
101 | A private helper class. | |
102 | */ | |
8e08b761 | 103 | |
510b9edb | 104 | struct WXDLLIMPEXP_FL MorphInfoT |
8e08b761 | 105 | { |
4cbc57f0 JS |
106 | wxPoint mFrom; |
107 | wxPoint mTill; | |
8e08b761 JS |
108 | }; |
109 | ||
4cbc57f0 JS |
110 | /* |
111 | A private helper class. | |
112 | */ | |
113 | ||
510b9edb | 114 | class WXDLLIMPEXP_FL cbHintAnimTimer : public wxTimer |
8e08b761 JS |
115 | { |
116 | protected: | |
117 | ||
4cbc57f0 | 118 | friend class cbHintAnimationPlugin; |
8e08b761 | 119 | |
4cbc57f0 | 120 | wxRect mPrevMorphed; |
8e08b761 | 121 | |
4cbc57f0 JS |
122 | MorphInfoT mUpperLeft; |
123 | MorphInfoT mLowerRight; | |
124 | int mCurIter; | |
8e08b761 | 125 | |
4cbc57f0 | 126 | long mLock; |
8e08b761 | 127 | |
4cbc57f0 | 128 | cbHintAnimationPlugin* mpPl; |
8e08b761 | 129 | |
4cbc57f0 | 130 | void MorphPoint( wxPoint& origin, MorphInfoT& info, wxPoint& point ); |
8e08b761 JS |
131 | |
132 | public: | |
133 | ||
4cbc57f0 | 134 | cbHintAnimTimer(void); |
8e08b761 | 135 | |
4cbc57f0 | 136 | virtual void Notify(void); |
8e08b761 | 137 | |
4cbc57f0 | 138 | virtual bool Init( cbHintAnimationPlugin* pAnimPl, bool reinit ); |
8e08b761 JS |
139 | }; |
140 | ||
141 | #endif /* __HINTANIMPL_G__ */ | |
142 |