mirror of
https://github.com/aseprite/aseprite.git
synced 2025-03-01 10:13:22 +00:00
Context class is Vaca::NonCopyable now.
This commit is contained in:
parent
52ed39739c
commit
37e08c1a4a
@ -20,6 +20,7 @@
|
|||||||
#define CONTEXT_H_INCLUDED
|
#define CONTEXT_H_INCLUDED
|
||||||
|
|
||||||
#include <list>
|
#include <list>
|
||||||
|
#include "Vaca/NonCopyable.h"
|
||||||
#include "ase_exception.h"
|
#include "ase_exception.h"
|
||||||
#include "settings/settings.h"
|
#include "settings/settings.h"
|
||||||
|
|
||||||
@ -37,25 +38,8 @@ public:
|
|||||||
: ase_exception("Cannot execute the command because its pre-conditions are false.") { }
|
: ase_exception("Cannot execute the command because its pre-conditions are false.") { }
|
||||||
};
|
};
|
||||||
|
|
||||||
class Context
|
class Context : Vaca::NonCopyable
|
||||||
{
|
{
|
||||||
// List of all sprites.
|
|
||||||
SpriteList m_sprites;
|
|
||||||
|
|
||||||
// Current selected sprite to operate.
|
|
||||||
Sprite* m_currentSprite;
|
|
||||||
|
|
||||||
// Settings in this context.
|
|
||||||
ISettings* m_settings;
|
|
||||||
|
|
||||||
private:
|
|
||||||
Context();
|
|
||||||
Context(const Context&);
|
|
||||||
|
|
||||||
protected:
|
|
||||||
// The "settings" are deleted automatically in the ~Context destructor
|
|
||||||
Context(ISettings* settings);
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
virtual ~Context();
|
virtual ~Context();
|
||||||
|
|
||||||
@ -83,10 +67,27 @@ public:
|
|||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
|
// The "settings" are deleted automatically in the ~Context destructor
|
||||||
|
Context(ISettings* settings);
|
||||||
|
|
||||||
virtual void on_add_sprite(Sprite* sprite);
|
virtual void on_add_sprite(Sprite* sprite);
|
||||||
virtual void on_remove_sprite(Sprite* sprite);
|
virtual void on_remove_sprite(Sprite* sprite);
|
||||||
virtual void on_set_current_sprite(Sprite* sprite);
|
virtual void on_set_current_sprite(Sprite* sprite);
|
||||||
|
|
||||||
|
private:
|
||||||
|
|
||||||
|
// Without default constructor
|
||||||
|
Context();
|
||||||
|
|
||||||
|
// List of all sprites.
|
||||||
|
SpriteList m_sprites;
|
||||||
|
|
||||||
|
// Current selected sprite to operate.
|
||||||
|
Sprite* m_currentSprite;
|
||||||
|
|
||||||
|
// Settings in this context.
|
||||||
|
ISettings* m_settings;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -23,8 +23,6 @@
|
|||||||
|
|
||||||
class UIContext : public Context
|
class UIContext : public Context
|
||||||
{
|
{
|
||||||
static UIContext* m_instance;
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
static UIContext* instance() { return m_instance; }
|
static UIContext* instance() { return m_instance; }
|
||||||
|
|
||||||
@ -34,11 +32,13 @@ public:
|
|||||||
virtual bool is_ui_available() const { return true; }
|
virtual bool is_ui_available() const { return true; }
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
virtual void on_add_sprite(Sprite* sprite);
|
virtual void on_add_sprite(Sprite* sprite);
|
||||||
virtual void on_remove_sprite(Sprite* sprite);
|
virtual void on_remove_sprite(Sprite* sprite);
|
||||||
virtual void on_set_current_sprite(Sprite* sprite);
|
virtual void on_set_current_sprite(Sprite* sprite);
|
||||||
|
|
||||||
|
private:
|
||||||
|
static UIContext* m_instance;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
Loading…
x
Reference in New Issue
Block a user