/usr/include/wx-2.6/wx/animate/animate.h is in wx2.6-headers 2.6.3.2.2-5ubuntu4.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 | /////////////////////////////////////////////////////////////////////////////
// Name: animate.h
// Purpose: Animation classes
// Author: Julian Smart and Guillermo Rodriguez Garcia
// Modified by:
// Created: 13/8/99
// RCS-ID: $Id: animate.h,v 1.5 2004/02/08 11:59:31 JS Exp $
// Copyright: (c) Julian Smart and Guillermo Rodriguez Garcia
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifndef _WX_ANIMATEH__
#define _WX_ANIMATEH__
#if defined(__GNUG__) && !defined(__APPLE__)
#pragma interface "animate.h"
#endif
#include <wx/defs.h>
#include <wx/string.h>
#include <wx/gdicmn.h>
#include <wx/list.h>
#include <wx/timer.h>
#include <wx/bitmap.h>
#include <wx/colour.h>
#include <wx/control.h>
#ifdef WXMAKINGDLL_ANIMATE
#define WXDLLIMPEXP_ANIMATE WXEXPORT
#elif defined(WXUSINGDLL)
#define WXDLLIMPEXP_ANIMATE WXIMPORT
#else // not making nor using DLL
#define WXDLLIMPEXP_ANIMATE
#endif
class WXDLLIMPEXP_ANIMATE wxAnimationBase;
class WXDLLIMPEXP_ANIMATE wxAnimationPlayer;
class WXDLLEXPORT wxImage;
enum wxAnimationDisposal
{
wxANIM_UNSPECIFIED = -1,
wxANIM_DONOTREMOVE = 0,
wxANIM_TOBACKGROUND = 1,
wxANIM_TOPREVIOUS = 2
} ;
class WXDLLIMPEXP_ANIMATE wxAnimationTimer: public wxTimer
{
public:
wxAnimationTimer() { m_player = (wxAnimationPlayer*) NULL; }
virtual void Notify();
void SetPlayer(wxAnimationPlayer* player) { m_player = player; }
protected:
wxAnimationPlayer* m_player;
};
/* wxAnimationPlayer
* Create an object of this class, and either pass an wxXXXAnimation object in
* the constructor, or call SetAnimation. Then call Play(). The wxAnimation
* object is only destroyed in the destructor if destroyAnimation is TRUE in
* the constructor.
*/
class WXDLLIMPEXP_ANIMATE wxAnimationPlayer : public wxObject
{
DECLARE_CLASS(wxAnimationPlayer)
public:
wxAnimationPlayer(wxAnimationBase *animation = (wxAnimationBase *) NULL, bool destroyAnimation = FALSE);
~wxAnimationPlayer();
//// Accessors
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 SetCurrentFrame(int currentFrame) { m_currentFrame = currentFrame; };
int GetCurrentFrame() const { return m_currentFrame; }
void SetWindow(wxWindow* window) { m_window = window; };
wxWindow* GetWindow() const { return m_window; }
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; }
// 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; }
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; }
//// Operations
// Play
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.
virtual bool Build();
// Stop the animation
virtual void Stop();
// Draw the current view of the animation into this DC.
// Call this from your OnPaint, for example.
virtual void Draw(wxDC& dc);
//// Accessing the current animation
virtual int GetFrameCount() const;
virtual wxImage* GetFrame(int i) const; // Creates a new wxImage
virtual wxAnimationDisposal GetDisposalMethod(int i) const;
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 ;
//// Implementation
// Play the frame
virtual bool PlayFrame(int frame, wxWindow& window, const wxPoint& pos);
virtual bool PlayFrame();
virtual void DrawFrame(int frame, wxDC& dc, const wxPoint& pos);
virtual void DrawBackground(wxDC& dc, const wxPoint& pos, const wxColour& colour);
// Clear the wxImage cache
virtual void ClearCache();
// Save the pertinent area of the window so we can restore
// it if drawing transparently
void SaveBackground(const wxRect& rect);
wxBitmap& GetBackingStore() { return m_backingStore; }
//// Data members
protected:
wxAnimationBase* m_animation;
bool m_destroyAnimation; // Destroy m_animation on deletion of this object
wxList m_frames; // List of cached wxBitmap frames.
int m_currentFrame; // Current frame
wxWindow* m_window; // Window to draw into
wxPoint m_position; // Position to draw at
bool m_looped; // Looped, or not
wxAnimationTimer m_timer; // The timer
bool m_isPlaying; // Is the animation playing?
wxBitmap m_savedBackground; // Saved background of window portion
wxBitmap m_backingStore; // The player draws into this
bool m_useBackgroundColour; // Use colour or background
wxColour m_customBackgroundColour; // Override animation background
bool m_useCustomBackgroundColour;
bool m_useParentBackground; // Grab background from parent?
};
/* wxAnimationBase
* Base class for animations.
* A wxXXXAnimation only stores the animation, providing accessors to
* wxAnimationPlayer. Currently an animation is read-only, but we could
* extend the API for adding frames programmatically, and perhaps have a
* wxMemoryAnimation class that stores its frames in memory, and is able to
* save all files with suitable filenames. You could then use e.g. Ulead GIF
* Animator to load the image files into a GIF animation.
*/
class WXDLLIMPEXP_ANIMATE wxAnimationBase : public wxObject
{
DECLARE_ABSTRACT_CLASS(wxAnimationBase)
public:
wxAnimationBase() {};
~wxAnimationBase() {};
//// Accessors. Should be overridden by each derived class.
virtual int GetFrameCount() const = 0;
virtual wxImage* GetFrame(int i) const = 0; // Creates a new wxImage
virtual wxAnimationDisposal GetDisposalMethod(int i) const = 0;
virtual wxRect GetFrameRect(int i) const = 0; // Position and size of frame
virtual int GetDelay(int i) const = 0; // Delay for this frame
virtual wxSize GetLogicalScreenSize() const = 0;
virtual bool GetBackgroundColour(wxColour& col) const = 0;
virtual bool GetTransparentColour(wxColour& col) const = 0;
// Is the animation OK?
virtual bool IsValid() const = 0;
//// Operations
virtual bool LoadFile(const wxString& WXUNUSED(filename)) { return FALSE; }
};
/* wxGIFAnimation
* This will be moved to a separate file in due course.
*/
class WXDLLIMPEXP_ANIMATE wxGIFDecoder;
class WXDLLIMPEXP_ANIMATE wxGIFAnimation : public wxAnimationBase
{
DECLARE_CLASS(wxGIFAnimation)
public:
wxGIFAnimation() ;
~wxGIFAnimation() ;
//// Accessors
virtual int GetFrameCount() const;
virtual wxImage* GetFrame(int i) const;
virtual wxAnimationDisposal GetDisposalMethod(int i) const;
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 bool IsValid() const;
//// Operations
virtual bool LoadFile(const wxString& filename);
protected:
wxGIFDecoder* m_decoder;
};
/*
* wxAnimationCtrlBase
* Abstract base class for format-specific animation controls.
* This class implements most of the functionality; all a derived
* class has to do is create the appropriate animation class on demand.
*/
// Resize to animation size if this is set
#define wxAN_FIT_ANIMATION 0x0010
class WXDLLIMPEXP_ANIMATE wxAnimationCtrlBase: public wxControl
{
public:
wxAnimationCtrlBase() { }
wxAnimationCtrlBase(wxWindow *parent, wxWindowID id,
const wxString& filename = wxEmptyString,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize, long style = wxAN_FIT_ANIMATION|wxNO_BORDER,
const wxString& name = wxT("animationControl"))
{
Create(parent, id, filename, pos, size, style, name);
}
~wxAnimationCtrlBase();
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 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 void FitToAnimation();
//// Accessors
virtual bool IsPlaying() const { return m_animationPlayer.IsPlaying(); }
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);
protected:
virtual wxSize DoGetBestSize() const;
// Override this in derived classes
virtual wxAnimationBase* DoCreateAnimation(const wxString& filename) = 0;
wxAnimationPlayer m_animationPlayer;
wxAnimationBase* m_animation;
wxString m_filename;
private:
DECLARE_ABSTRACT_CLASS(wxAnimationCtrlBase)
DECLARE_EVENT_TABLE()
};
/*
* wxGIFAnimationCtrl
* Provides a GIF animation class when required.
*/
class WXDLLIMPEXP_ANIMATE wxGIFAnimationCtrl: public wxAnimationCtrlBase
{
public:
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 wxString& name = wxT("animationControl"))
{
Create(parent, id, filename, pos, size, style, name);
}
protected:
virtual wxAnimationBase* DoCreateAnimation(const wxString& filename) ;
private:
DECLARE_DYNAMIC_CLASS(wxGIFAnimationCtrl)
};
#endif // _WX_ANIMATEH__
|