cleanup - reformat

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@36609 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
David Surovell
2005-12-31 01:33:40 +00:00
parent 84a17ce686
commit 6446bbcf31

View File

@@ -21,6 +21,7 @@
#include <wx/colour.h> #include <wx/colour.h>
#include <wx/control.h> #include <wx/control.h>
#ifdef WXMAKINGDLL_ANIMATE #ifdef WXMAKINGDLL_ANIMATE
#define WXDLLIMPEXP_ANIMATE WXEXPORT #define WXDLLIMPEXP_ANIMATE WXEXPORT
#elif defined(WXUSINGDLL) #elif defined(WXUSINGDLL)
@@ -44,10 +45,13 @@ enum wxAnimationDisposal
class WXDLLIMPEXP_ANIMATE wxAnimationTimer: public wxTimer class WXDLLIMPEXP_ANIMATE wxAnimationTimer: public wxTimer
{ {
public: public:
wxAnimationTimer() { m_player = (wxAnimationPlayer*) NULL; } wxAnimationTimer()
{ m_player = (wxAnimationPlayer*) NULL; }
virtual void Notify(); virtual void Notify();
void SetPlayer(wxAnimationPlayer* player) { m_player = player; }
void SetPlayer(wxAnimationPlayer* player)
{ m_player = player; }
protected: protected:
wxAnimationPlayer* m_player; wxAnimationPlayer* m_player;
@@ -65,56 +69,87 @@ class WXDLLIMPEXP_ANIMATE wxAnimationPlayer : public wxObject
DECLARE_CLASS(wxAnimationPlayer) DECLARE_CLASS(wxAnimationPlayer)
public: public:
wxAnimationPlayer(wxAnimationBase *animation = (wxAnimationBase *) NULL, bool destroyAnimation = FALSE); wxAnimationPlayer(wxAnimationBase *animation = (wxAnimationBase *) NULL, bool destroyAnimation = false);
~wxAnimationPlayer(); ~wxAnimationPlayer();
//// Accessors //// Accessors
void SetAnimation(wxAnimationBase* animation, bool destroyAnimation = FALSE); void SetAnimation(wxAnimationBase* animation, bool destroyAnimation = false);
wxAnimationBase* GetAnimation() const { return m_animation; } wxAnimationBase* GetAnimation() const
{ return m_animation; }
void SetDestroyAnimation(bool destroyAnimation) { m_destroyAnimation = destroyAnimation; }; void SetDestroyAnimation(bool destroyAnimation)
bool GetDestroyAnimation() const { return m_destroyAnimation; } { m_destroyAnimation = destroyAnimation; }
void SetCurrentFrame(int currentFrame) { m_currentFrame = currentFrame; }; bool GetDestroyAnimation() const
int GetCurrentFrame() const { return m_currentFrame; } { return m_destroyAnimation; }
void SetWindow(wxWindow* window) { m_window = window; }; void SetCurrentFrame(int currentFrame)
wxWindow* GetWindow() const { return m_window; } { m_currentFrame = currentFrame; }
void SetPosition(const wxPoint& pos) { m_position = pos; }; int GetCurrentFrame() const
wxPoint GetPosition() const { return m_position; } { return m_currentFrame; }
void SetLooped(bool looped) { m_looped = looped; }; void SetWindow(wxWindow* window)
bool GetLooped() const { return m_looped; } { m_window = window; }
bool HasAnimation() const { return (m_animation != (wxAnimationBase*) NULL); } wxWindow* GetWindow() const
{ return m_window; }
bool IsPlaying() const { return m_isPlaying; } void SetPosition(const wxPoint& pos)
{ m_position = pos; }
wxPoint GetPosition() const
{ return m_position; }
void SetLooped(bool looped)
{ m_looped = looped; }
bool GetLooped() const
{ return m_looped; }
bool HasAnimation() const
{ return (m_animation != (wxAnimationBase*) NULL); }
bool IsPlaying() const
{ return m_isPlaying; }
// Specify whether the GIF's background colour is to be shown, // Specify whether the GIF's background colour is to be shown,
// or whether the window background should show through (the default) // or whether the window background should show through (the default)
void UseBackgroundColour(bool useBackground) { m_useBackgroundColour = useBackground; } void UseBackgroundColour(bool useBackground)
bool UsingBackgroundColour() const { return m_useBackgroundColour; } { m_useBackgroundColour = useBackground; }
bool UsingBackgroundColour() const
{ return m_useBackgroundColour; }
// Set and use a user-specified background colour (valid for transparent // Set and use a user-specified background colour (valid for transparent
// animations only) // animations only)
void SetCustomBackgroundColour(const wxColour& col, bool useCustomBackgroundColour = TRUE) void SetCustomBackgroundColour(const wxColour& col, bool useCustomBackgroundColour = true)
{ m_customBackgroundColour = col; m_useCustomBackgroundColour = useCustomBackgroundColour; } {
m_customBackgroundColour = col;
m_useCustomBackgroundColour = useCustomBackgroundColour;
}
bool UsingCustomBackgroundColour() const { return m_useCustomBackgroundColour; } bool UsingCustomBackgroundColour() const
const wxColour& GetCustomBackgroundColour() const { return m_customBackgroundColour; } { return m_useCustomBackgroundColour; }
const wxColour& GetCustomBackgroundColour() const
{ return m_customBackgroundColour; }
// Another refinement - suppose we're drawing the animation in a separate // Another refinement - suppose we're drawing the animation in a separate
// control or window. We may wish to use the background of the parent // control or window. We may wish to use the background of the parent
// window as the background of our animation. This allows us to specify // window as the background of our animation. This allows us to specify
// whether to grab from the parent or from this window. // whether to grab from the parent or from this window.
void UseParentBackground(bool useParent) { m_useParentBackground = useParent; } void UseParentBackground(bool useParent)
bool UsingParentBackground() const { return m_useParentBackground; } { m_useParentBackground = useParent; }
bool UsingParentBackground() const
{ return m_useParentBackground; }
//// Operations //// Operations
// Play // Play
virtual bool Play(wxWindow& window, const wxPoint& pos = wxPoint(0, 0), bool looped = TRUE); virtual bool Play(wxWindow& window, const wxPoint& pos = wxPoint(0, 0), bool looped = true);
// Build animation (list of wxImages). If not called before Play // Build animation (list of wxImages). If not called before Play
// is called, Play will call this automatically. // is called, Play will call this automatically.
@@ -154,7 +189,8 @@ public:
// it if drawing transparently // it if drawing transparently
void SaveBackground(const wxRect& rect); void SaveBackground(const wxRect& rect);
wxBitmap& GetBackingStore() { return m_backingStore; } wxBitmap& GetBackingStore()
{ return m_backingStore; }
//// Data members //// Data members
protected: protected:
@@ -210,7 +246,8 @@ public:
//// Operations //// Operations
virtual bool LoadFile(const wxString& WXUNUSED(filename)) { return FALSE; } virtual bool LoadFile(const wxString& WXUNUSED(filename))
{ return false; }
}; };
/* wxGIFAnimation /* wxGIFAnimation
@@ -246,7 +283,6 @@ public:
virtual bool LoadFile(const wxString& filename); virtual bool LoadFile(const wxString& filename);
protected: protected:
wxGIFDecoder* m_decoder; wxGIFDecoder* m_decoder;
}; };
@@ -277,22 +313,33 @@ public:
bool Create(wxWindow *parent, wxWindowID id, bool Create(wxWindow *parent, wxWindowID id,
const wxString& filename = wxEmptyString, const wxString& filename = wxEmptyString,
const wxPoint& pos = wxDefaultPosition, const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize, long style = wxAN_FIT_ANIMATION|wxNO_BORDER, const wxSize& size = wxDefaultSize,
long style = wxAN_FIT_ANIMATION | wxNO_BORDER,
const wxString& name = wxT("animationControl")); const wxString& name = wxT("animationControl"));
//// Operations //// Operations
virtual bool LoadFile(const wxString& filename = wxEmptyString); virtual bool LoadFile(const wxString& filename = wxEmptyString);
virtual bool Play(bool looped = TRUE) ; virtual bool Play(bool looped = true);
virtual void Stop() { m_animationPlayer.Stop(); } virtual void Stop()
{ m_animationPlayer.Stop(); }
virtual void FitToAnimation(); virtual void FitToAnimation();
//// Accessors //// Accessors
virtual bool IsPlaying() const { return m_animationPlayer.IsPlaying(); } virtual bool IsPlaying() const
virtual wxAnimationPlayer& GetPlayer() { return m_animationPlayer; } { return m_animationPlayer.IsPlaying(); }
virtual wxAnimationBase* GetAnimation() { return m_animation; }
const wxString& GetFilename() const { return m_filename; } virtual wxAnimationPlayer& GetPlayer()
void SetFilename(const wxString& filename) { m_filename = filename; } { return m_animationPlayer; }
virtual wxAnimationBase* GetAnimation()
{ return m_animation; }
const wxString& GetFilename() const
{ return m_filename; }
void SetFilename(const wxString& filename)
{ m_filename = filename; }
//// Event handlers //// Event handlers
void OnPaint(wxPaintEvent& event); void OnPaint(wxPaintEvent& event);
@@ -321,10 +368,12 @@ class WXDLLIMPEXP_ANIMATE wxGIFAnimationCtrl: public wxAnimationCtrlBase
{ {
public: public:
wxGIFAnimationCtrl() {} wxGIFAnimationCtrl() {}
wxGIFAnimationCtrl(wxWindow *parent, wxWindowID id, wxGIFAnimationCtrl(wxWindow *parent,
wxWindowID id,
const wxString& filename = wxEmptyString, const wxString& filename = wxEmptyString,
const wxPoint& pos = wxDefaultPosition, const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize, long style = wxAN_FIT_ANIMATION|wxNO_BORDER, const wxSize& size = wxDefaultSize,
long style = wxAN_FIT_ANIMATION | wxNO_BORDER,
const wxString& name = wxT("animationControl")) const wxString& name = wxT("animationControl"))
{ {
Create(parent, id, filename, pos, size, style, name); Create(parent, id, filename, pos, size, style, name);
@@ -332,9 +381,9 @@ public:
protected: protected:
virtual wxAnimationBase* DoCreateAnimation(const wxString& filename); virtual wxAnimationBase* DoCreateAnimation(const wxString& filename);
private: private:
DECLARE_DYNAMIC_CLASS(wxGIFAnimationCtrl) DECLARE_DYNAMIC_CLASS(wxGIFAnimationCtrl)
}; };
#endif // _WX_ANIMATEH__ #endif // _WX_ANIMATEH__