UIState now is an interface. UISkinState implements Skin states.

Some minor fixes.

--HG--
branch : dev-stateful-drawable
This commit is contained in:
Martín Lucas Golini
2018-12-22 18:31:18 -03:00
parent dd2bfc083c
commit 33ba62193b
12 changed files with 115 additions and 65 deletions

View File

@@ -5,8 +5,12 @@
#include <eepp/ui/uihelper.hpp>
#include <eepp/ui/uistate.hpp>
#include <eepp/ui/uiskin.hpp>
#include <eepp/ui/uiskinstate.hpp>
#include <eepp/scene/node.hpp>
namespace EE { namespace Graphics {
class Drawable;
}}
namespace EE { namespace Scene {
class Action;
class ActionManager;
@@ -16,6 +20,8 @@ using namespace EE::Scene;
namespace EE { namespace UI {
class UITheme;
class UISkin;
class UISkinState;
class EE_API UINode : public Node {
public:
@@ -184,10 +190,10 @@ class EE_API UINode : public Node {
Vector2f mDpPos;
Sizef mDpSize;
Uint32 mFlags;
UIState * mSkinState;
UIState * mBackgroundState;
UIState * mForegroundState;
UIState * mBorderState;
UISkinState * mSkinState;
UISkinState * mBackgroundState;
UISkinState * mForegroundState;
UISkinState * mBorderState;
Vector2f mDragPoint;
Uint32 mDragButton;

View File

@@ -0,0 +1,29 @@
#ifndef EE_UI_UISKINSTATE_HPP
#define EE_UI_UISKINSTATE_HPP
#include <eepp/ui/uistate.hpp>
namespace EE { namespace UI {
class UISkin;
class EE_API UISkinState : public UIState {
public:
static UISkinState * New( UISkin * skin );
explicit UISkinState( UISkin * Skin );
virtual ~UISkinState();
UISkin * getSkin() const;
void draw( const Float& X, const Float& Y, const Float& Width, const Float& Height, const Uint32& Alpha );
bool stateExists( const Uint32& State );
protected:
UISkin * mSkin;
};
}}
#endif

View File

@@ -39,11 +39,9 @@ class EE_API UIState {
static bool isStateName( const std::string& State );
static UIState * New( UISkin * skin );
UIState();
explicit UIState( UISkin * Skin );
~UIState();
virtual ~UIState();
const Uint32& getState() const;
@@ -53,17 +51,10 @@ class EE_API UIState {
void popState( const Uint32& State );
UISkin * getSkin() const;
void draw( const Float& X, const Float& Y, const Float& Width, const Float& Height, const Uint32& Alpha );
bool stateExists( const Uint32& State );
virtual bool stateExists( const Uint32& State ) = 0;
Uint32 getCurrentState() const;
protected:
friend class UINode;
UISkin * mSkin;
Uint32 mState;
Uint32 mCurrentState;

View File

@@ -31,8 +31,6 @@ class EE_API UITextEdit : public UIWidget {
UIScrollBar * getVScrollBar() const;
virtual void update( const Time& time );
void setAllowEditing( const bool& allow );
const bool& isEditingAllowed() const;
@@ -67,6 +65,8 @@ class EE_API UITextEdit : public UIWidget {
virtual void onPaddingChange();
virtual Uint32 onMessage( const NodeMessage * Msg );
void onVScrollValueChange( const Event * Event );
void onHScrollValueChange( const Event * Event );