/[pcsx2_0.9.7]/branch/r3113_0.9.7_beta/3rdparty/wxWidgets/include/wx/generic/animate.h
ViewVC logotype

Contents of /branch/r3113_0.9.7_beta/3rdparty/wxWidgets/include/wx/generic/animate.h

Parent Directory Parent Directory | Revision Log Revision Log


Revision 32 - (show annotations) (download)
Tue Sep 7 03:29:01 2010 UTC (9 years, 10 months ago) by william
File MIME type: text/plain
File size: 6308 byte(s)
branching from upstream revision (http://pcsx2.googlecode.com/svn/trunk
): r3113 to
https://svn.netsolutions.dnsalias.com/websvn/ps2/pcsx2/pcsx2_0.9.7/branch/r3113_0.9.7_beta
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: wx/generic/animate.h
3 // Purpose: wxAnimation and wxAnimationCtrl
4 // Author: Julian Smart and Guillermo Rodriguez Garcia
5 // Modified by: Francesco Montorsi
6 // Created: 13/8/99
7 // RCS-ID: $Id: animate.h 58350 2009-01-24 10:00:38Z FM $
8 // Copyright: (c) Julian Smart and Guillermo Rodriguez Garcia
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
11
12 #ifndef _WX_GENERIC_ANIMATEH__
13 #define _WX_GENERIC_ANIMATEH__
14
15 #include "wx/bitmap.h"
16
17 // ----------------------------------------------------------------------------
18 // wxAnimation
19 // ----------------------------------------------------------------------------
20
21 WX_DECLARE_LIST_WITH_DECL(wxAnimationDecoder, wxAnimationDecoderList, class WXDLLIMPEXP_ADV);
22
23 class WXDLLIMPEXP_ADV wxAnimation : public wxAnimationBase
24 {
25 public:
26 #if wxABI_VERSION >= 20810
27 wxAnimation() {}
28 wxAnimation(const wxString &name, wxAnimationType type = wxANIMATION_TYPE_ANY)
29 { LoadFile(name, type); }
30 #endif
31 virtual bool IsOk() const
32 { return m_refData != NULL; }
33
34 virtual unsigned int GetFrameCount() const;
35 virtual int GetDelay(unsigned int i) const;
36 virtual wxImage GetFrame(unsigned int i) const;
37 virtual wxSize GetSize() const;
38
39 virtual bool LoadFile(const wxString& filename,
40 wxAnimationType type = wxANIMATION_TYPE_ANY);
41 virtual bool Load(wxInputStream& stream,
42 wxAnimationType type = wxANIMATION_TYPE_ANY);
43
44 // extended interface used by the generic implementation of wxAnimationCtrl
45 wxPoint GetFramePosition(unsigned int frame) const;
46 wxSize GetFrameSize(unsigned int frame) const;
47 wxAnimationDisposal GetDisposalMethod(unsigned int frame) const;
48 wxColour GetTransparentColour(unsigned int frame) const;
49 wxColour GetBackgroundColour() const;
50
51 protected:
52 static wxAnimationDecoderList sm_handlers;
53
54 public:
55 static inline wxAnimationDecoderList& GetHandlers() { return sm_handlers; }
56 static void AddHandler(wxAnimationDecoder *handler);
57 static void InsertHandler(wxAnimationDecoder *handler);
58 static const wxAnimationDecoder *FindHandler( wxAnimationType animType );
59
60 static void CleanUpHandlers();
61 static void InitStandardHandlers();
62
63 DECLARE_DYNAMIC_CLASS(wxAnimation)
64 };
65
66
67 // ----------------------------------------------------------------------------
68 // wxAnimationCtrl
69 // ----------------------------------------------------------------------------
70
71 class WXDLLIMPEXP_ADV wxAnimationCtrl: public wxAnimationCtrlBase
72 {
73 public:
74 wxAnimationCtrl() { Init(); }
75 wxAnimationCtrl(wxWindow *parent,
76 wxWindowID id,
77 const wxAnimation& anim = wxNullAnimation,
78 const wxPoint& pos = wxDefaultPosition,
79 const wxSize& size = wxDefaultSize,
80 long style = wxAC_DEFAULT_STYLE,
81 const wxString& name = wxAnimationCtrlNameStr)
82 {
83 Init();
84
85 Create(parent, id, anim, pos, size, style, name);
86 }
87
88 void Init();
89
90 bool Create(wxWindow *parent, wxWindowID id,
91 const wxAnimation& anim = wxNullAnimation,
92 const wxPoint& pos = wxDefaultPosition,
93 const wxSize& size = wxDefaultSize,
94 long style = wxAC_DEFAULT_STYLE,
95 const wxString& name = wxAnimationCtrlNameStr);
96
97 ~wxAnimationCtrl();
98
99 public:
100 virtual bool LoadFile(const wxString& filename, wxAnimationType type = wxANIMATION_TYPE_ANY);
101
102 virtual void Stop();
103 virtual bool Play()
104 { return Play(true /* looped */); }
105 virtual bool IsPlaying() const
106 { return m_isPlaying; }
107
108 void SetAnimation(const wxAnimation &animation);
109 wxAnimation GetAnimation() const
110 { return m_animation; }
111
112 virtual void SetInactiveBitmap(const wxBitmap &bmp);
113
114 // override base class method
115 virtual bool SetBackgroundColour(const wxColour& col);
116
117 public: // event handlers
118
119 void OnPaint(wxPaintEvent& event);
120 void OnTimer(wxTimerEvent& event);
121 void OnSize(wxSizeEvent& event);
122
123 public: // extended API specific to this implementation of wxAnimateCtrl
124
125 // Specify whether the animation's background colour is to be shown (the default),
126 // or whether the window background should show through
127 void SetUseWindowBackgroundColour(bool useWinBackground = true)
128 { m_useWinBackgroundColour = useWinBackground; }
129 bool IsUsingWindowBackgroundColour() const
130 { return m_useWinBackgroundColour; }
131
132 // This overload of Play() lets you specify if the animation must loop or not
133 bool Play(bool looped);
134
135 // Draw the current frame of the animation into given DC.
136 // This is fast as current frame is always cached.
137 void DrawCurrentFrame(wxDC& dc);
138
139 // Returns a wxBitmap with the current frame drawn in it
140 wxBitmap& GetBackingStore()
141 { return m_backingStore; }
142
143 protected: // internal utilities
144
145 // resize this control to fit m_animation
146 void FitToAnimation();
147
148 // Draw the background; use this when e.g. previous frame had wxANIM_TOBACKGROUND disposal.
149 void DisposeToBackground();
150 void DisposeToBackground(wxDC& dc);
151 void DisposeToBackground(wxDC& dc, const wxPoint &pos, const wxSize &sz);
152
153 void IncrementalUpdateBackingStore();
154 bool RebuildBackingStoreUpToFrame(unsigned int);
155 void DrawFrame(wxDC &dc, unsigned int);
156
157 virtual void DisplayStaticImage();
158 virtual wxSize DoGetBestSize() const;
159
160 protected:
161 unsigned int m_currentFrame; // Current frame
162 bool m_looped; // Looped, or not
163 wxTimer m_timer; // The timer
164 wxAnimation m_animation; // The animation
165
166 bool m_isPlaying; // Is the animation playing?
167 bool m_useWinBackgroundColour; // Use animation bg colour or window bg colour?
168
169 wxBitmap m_backingStore; // The frames are drawn here and then blitted
170 // on the screen
171
172 private:
173 typedef wxAnimationCtrlBase base_type;
174 DECLARE_DYNAMIC_CLASS(wxAnimationCtrl)
175 DECLARE_EVENT_TABLE()
176 };
177
178 #endif // _WX_GENERIC_ANIMATEH__

  ViewVC Help
Powered by ViewVC 1.1.22