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/control.h>
#ifdef WXMAKINGDLL_ANIMATE
#define WXDLLIMPEXP_ANIMATE WXEXPORT
#elif defined(WXUSINGDLL)
@@ -39,15 +40,18 @@ enum wxAnimationDisposal
wxANIM_DONOTREMOVE = 0,
wxANIM_TOBACKGROUND = 1,
wxANIM_TOPREVIOUS = 2
} ;
};
class WXDLLIMPEXP_ANIMATE wxAnimationTimer: public wxTimer
{
public:
wxAnimationTimer() { m_player = (wxAnimationPlayer*) NULL; }
wxAnimationTimer()
{ m_player = (wxAnimationPlayer*) NULL; }
virtual void Notify();
void SetPlayer(wxAnimationPlayer* player) { m_player = player; }
void SetPlayer(wxAnimationPlayer* player)
{ m_player = player; }
protected:
wxAnimationPlayer* m_player;
@@ -65,56 +69,87 @@ class WXDLLIMPEXP_ANIMATE wxAnimationPlayer : public wxObject
DECLARE_CLASS(wxAnimationPlayer)
public:
wxAnimationPlayer(wxAnimationBase *animation = (wxAnimationBase *) NULL, bool destroyAnimation = FALSE);
wxAnimationPlayer(wxAnimationBase *animation = (wxAnimationBase *) NULL, bool destroyAnimation = false);
~wxAnimationPlayer();
//// Accessors
void SetAnimation(wxAnimationBase* animation, bool destroyAnimation = FALSE);
wxAnimationBase* GetAnimation() const { return m_animation; }
void SetAnimation(wxAnimationBase* animation, bool destroyAnimation = false);
wxAnimationBase* GetAnimation() const
{ return m_animation; }
void SetDestroyAnimation(bool destroyAnimation) { m_destroyAnimation = destroyAnimation; };
bool GetDestroyAnimation() const { return m_destroyAnimation; }
void SetDestroyAnimation(bool destroyAnimation)
{ m_destroyAnimation = destroyAnimation; }
void SetCurrentFrame(int currentFrame) { m_currentFrame = currentFrame; };
int GetCurrentFrame() const { return m_currentFrame; }
bool GetDestroyAnimation() const
{ return m_destroyAnimation; }
void SetWindow(wxWindow* window) { m_window = window; };
wxWindow* GetWindow() const { return m_window; }
void SetCurrentFrame(int currentFrame)
{ m_currentFrame = currentFrame; }
void SetPosition(const wxPoint& pos) { m_position = pos; };
wxPoint GetPosition() const { return m_position; }
int GetCurrentFrame() const
{ return m_currentFrame; }
void SetLooped(bool looped) { m_looped = looped; };
bool GetLooped() const { return m_looped; }
void SetWindow(wxWindow* window)
{ 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,
// or whether the window background should show through (the default)
void UseBackgroundColour(bool useBackground) { m_useBackgroundColour = useBackground; }
bool UsingBackgroundColour() const { return m_useBackgroundColour; }
void UseBackgroundColour(bool useBackground)
{ m_useBackgroundColour = useBackground; }
bool UsingBackgroundColour() const
{ return m_useBackgroundColour; }
// Set and use a user-specified background colour (valid for transparent
// animations only)
void SetCustomBackgroundColour(const wxColour& col, bool useCustomBackgroundColour = TRUE)
{ m_customBackgroundColour = col; m_useCustomBackgroundColour = useCustomBackgroundColour; }
void SetCustomBackgroundColour(const wxColour& col, bool useCustomBackgroundColour = true)
{
m_customBackgroundColour = col;
m_useCustomBackgroundColour = useCustomBackgroundColour;
}
bool UsingCustomBackgroundColour() const { return m_useCustomBackgroundColour; }
const wxColour& GetCustomBackgroundColour() const { return m_customBackgroundColour; }
bool UsingCustomBackgroundColour() const
{ return m_useCustomBackgroundColour; }
const wxColour& GetCustomBackgroundColour() const
{ return m_customBackgroundColour; }
// Another refinement - suppose we're drawing the animation in a separate
// 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
// whether to grab from the parent or from this window.
void UseParentBackground(bool useParent) { m_useParentBackground = useParent; }
bool UsingParentBackground() const { return m_useParentBackground; }
void UseParentBackground(bool useParent)
{ m_useParentBackground = useParent; }
bool UsingParentBackground() const
{ return m_useParentBackground; }
//// Operations
// 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
// is called, Play will call this automatically.
@@ -136,8 +171,8 @@ public:
virtual int GetDelay(int i) const; // Delay for this frame
virtual wxSize GetLogicalScreenSize() const;
virtual bool GetBackgroundColour(wxColour& col) const ;
virtual bool GetTransparentColour(wxColour& col) const ;
virtual bool GetBackgroundColour(wxColour& col) const;
virtual bool GetTransparentColour(wxColour& col) const;
//// Implementation
@@ -154,7 +189,8 @@ public:
// it if drawing transparently
void SaveBackground(const wxRect& rect);
wxBitmap& GetBackingStore() { return m_backingStore; }
wxBitmap& GetBackingStore()
{ return m_backingStore; }
//// Data members
protected:
@@ -210,7 +246,8 @@ public:
//// Operations
virtual bool LoadFile(const wxString& WXUNUSED(filename)) { return FALSE; }
virtual bool LoadFile(const wxString& WXUNUSED(filename))
{ return false; }
};
/* wxGIFAnimation
@@ -224,8 +261,8 @@ class WXDLLIMPEXP_ANIMATE wxGIFAnimation : public wxAnimationBase
DECLARE_CLASS(wxGIFAnimation)
public:
wxGIFAnimation() ;
~wxGIFAnimation() ;
wxGIFAnimation();
~wxGIFAnimation();
//// Accessors
@@ -235,9 +272,9 @@ public:
virtual wxRect GetFrameRect(int i) const; // Position and size of frame
virtual int GetDelay(int i) const; // Delay for this frame
virtual wxSize GetLogicalScreenSize() const ;
virtual bool GetBackgroundColour(wxColour& col) const ;
virtual bool GetTransparentColour(wxColour& col) const ;
virtual wxSize GetLogicalScreenSize() const;
virtual bool GetBackgroundColour(wxColour& col) const;
virtual bool GetTransparentColour(wxColour& col) const;
virtual bool IsValid() const;
@@ -246,7 +283,6 @@ public:
virtual bool LoadFile(const wxString& filename);
protected:
wxGIFDecoder* m_decoder;
};
@@ -263,7 +299,7 @@ protected:
class WXDLLIMPEXP_ANIMATE wxAnimationCtrlBase: public wxControl
{
public:
wxAnimationCtrlBase() { }
wxAnimationCtrlBase() {}
wxAnimationCtrlBase(wxWindow *parent, wxWindowID id,
const wxString& filename = wxEmptyString,
const wxPoint& pos = wxDefaultPosition,
@@ -277,22 +313,33 @@ public:
bool Create(wxWindow *parent, wxWindowID id,
const wxString& filename = wxEmptyString,
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"));
//// Operations
virtual bool LoadFile(const wxString& filename = wxEmptyString);
virtual bool Play(bool looped = TRUE) ;
virtual void Stop() { m_animationPlayer.Stop(); }
virtual bool Play(bool looped = true);
virtual void Stop()
{ m_animationPlayer.Stop(); }
virtual void FitToAnimation();
//// Accessors
virtual bool IsPlaying() const { return m_animationPlayer.IsPlaying(); }
virtual wxAnimationPlayer& GetPlayer() { return m_animationPlayer; }
virtual wxAnimationBase* GetAnimation() { return m_animation; }
virtual bool IsPlaying() const
{ return m_animationPlayer.IsPlaying(); }
const wxString& GetFilename() const { return m_filename; }
void SetFilename(const wxString& filename) { m_filename = filename; }
virtual wxAnimationPlayer& GetPlayer()
{ 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
void OnPaint(wxPaintEvent& event);
@@ -320,21 +367,23 @@ private:
class WXDLLIMPEXP_ANIMATE wxGIFAnimationCtrl: public wxAnimationCtrlBase
{
public:
wxGIFAnimationCtrl() { }
wxGIFAnimationCtrl(wxWindow *parent, wxWindowID id,
wxGIFAnimationCtrl() {}
wxGIFAnimationCtrl(wxWindow *parent,
wxWindowID id,
const wxString& filename = wxEmptyString,
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"))
{
Create(parent, id, filename, pos, size, style, name);
}
protected:
virtual wxAnimationBase* DoCreateAnimation(const wxString& filename) ;
virtual wxAnimationBase* DoCreateAnimation(const wxString& filename);
private:
DECLARE_DYNAMIC_CLASS(wxGIFAnimationCtrl)
};
#endif // _WX_ANIMATEH__