mirror of
https://github.com/SpartanJ/eepp.git
synced 2026-06-02 19:46:29 +03:00
UIStyle WIP.
--HG-- branch : dev-stateful-drawable
This commit is contained in:
@@ -35,6 +35,24 @@ class NodeAttribute {
|
||||
TypeRectf
|
||||
};
|
||||
|
||||
class Info
|
||||
{
|
||||
public:
|
||||
Info( AttributeType type, const std::string& name );
|
||||
|
||||
Info( AttributeType type, const std::vector<std::string>& names );
|
||||
|
||||
bool isName( const std::string& name );
|
||||
|
||||
const AttributeType& getType() const;
|
||||
|
||||
const std::vector<std::string>& getNames() const;
|
||||
protected:
|
||||
AttributeType type;
|
||||
|
||||
std::vector<std::string> names;
|
||||
};
|
||||
|
||||
NodeAttribute( std::string name, std::string value );
|
||||
|
||||
std::string getName() const;
|
||||
|
||||
27
include/eepp/ui/uistyle.hpp
Normal file
27
include/eepp/ui/uistyle.hpp
Normal file
@@ -0,0 +1,27 @@
|
||||
#ifndef EE_UI_UISTYLE_HPP
|
||||
#define EE_UI_UISTYLE_HPP
|
||||
|
||||
#include <eepp/ui/uistate.hpp>
|
||||
#include <eepp/scene/nodeattribute.hpp>
|
||||
|
||||
using namespace EE::Scene;
|
||||
|
||||
namespace EE { namespace UI {
|
||||
|
||||
class EE_API UIStyle : public UIState {
|
||||
public:
|
||||
static UIStyle * New();
|
||||
|
||||
explicit UIStyle();
|
||||
|
||||
virtual ~UIStyle();
|
||||
|
||||
bool stateExists( const Uint32& State );
|
||||
protected:
|
||||
std::map<int, std::map<std::string, NodeAttribute> > states;;
|
||||
};
|
||||
|
||||
}}
|
||||
|
||||
|
||||
#endif
|
||||
@@ -11,6 +11,9 @@ class EE_API UIWidgetCreator {
|
||||
typedef std::function<UIWidget*( std::string )> CustomWidgetCb;
|
||||
typedef std::function<UIWidget*()> RegisterWidgetCb;
|
||||
|
||||
typedef std::map<std::string, UIWidgetCreator::CustomWidgetCb> WidgetCallbackMap;
|
||||
typedef std::map<std::string, UIWidgetCreator::RegisterWidgetCb> RegisteredWidgetCallbackMap;
|
||||
|
||||
static UIWidget * createFromName( std::string widgetName );
|
||||
|
||||
static void addCustomWidgetCallback( std::string widgetName, const CustomWidgetCb& cb );
|
||||
@@ -24,9 +27,9 @@ class EE_API UIWidgetCreator {
|
||||
static void unregisterWidget( std::string widgetName );
|
||||
|
||||
static bool isWidgetRegistered( std::string widgetName );
|
||||
|
||||
static const RegisteredWidgetCallbackMap& getRegisteredWidgets();
|
||||
protected:
|
||||
typedef std::map<std::string, UIWidgetCreator::CustomWidgetCb> WidgetCallbackMap;
|
||||
typedef std::map<std::string, UIWidgetCreator::RegisterWidgetCb> RegisteredWidgetCallbackMap;
|
||||
|
||||
static RegisteredWidgetCallbackMap registeredWidget;
|
||||
|
||||
|
||||
@@ -333,6 +333,7 @@
|
||||
../../include/eepp/ui/uispinbox.hpp
|
||||
../../include/eepp/ui/uisprite.hpp
|
||||
../../include/eepp/ui/uistate.hpp
|
||||
../../include/eepp/ui/uistyle.hpp
|
||||
../../include/eepp/ui/uitab.hpp
|
||||
../../include/eepp/ui/uitablecell.hpp
|
||||
../../include/eepp/ui/uitable.hpp
|
||||
@@ -732,6 +733,7 @@
|
||||
../../src/eepp/ui/uispinbox.cpp
|
||||
../../src/eepp/ui/uisprite.cpp
|
||||
../../src/eepp/ui/uistate.cpp
|
||||
../../src/eepp/ui/uistyle.cpp
|
||||
../../src/eepp/ui/uitab.cpp
|
||||
../../src/eepp/ui/uitablecell.cpp
|
||||
../../src/eepp/ui/uitable.cpp
|
||||
|
||||
@@ -95,7 +95,7 @@ bool FrameBufferFBO::create( const Uint32& Width, const Uint32& Height, bool Ste
|
||||
mFrameBuffer = static_cast<Int32>( frameBuffer );
|
||||
|
||||
if ( !mFrameBuffer ) {
|
||||
eePRINT("FrameBufferFBO::create: Failed to created FrameBuffer Object");
|
||||
eePRINTL("FrameBufferFBO::create: Failed to created FrameBuffer Object");
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -109,7 +109,7 @@ bool FrameBufferFBO::create( const Uint32& Width, const Uint32& Height, bool Ste
|
||||
mDepthBuffer = static_cast<unsigned int>(depth);
|
||||
|
||||
if ( !mDepthBuffer ) {
|
||||
eePRINT("FrameBufferFBO::create: Failed to created Depth Buffer");
|
||||
eePRINTL("FrameBufferFBO::create: Failed to created Depth Buffer");
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -129,7 +129,7 @@ bool FrameBufferFBO::create( const Uint32& Width, const Uint32& Height, bool Ste
|
||||
mStencilBuffer = static_cast<Uint32>(stencil);
|
||||
|
||||
if (!mStencilBuffer) {
|
||||
eePRINT("FrameBufferFBO::create: Failed to created Stencil Buffer");
|
||||
eePRINTL("FrameBufferFBO::create: Failed to created Stencil Buffer");
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@@ -44,7 +44,7 @@ void SocketSelector::add(Socket& socket) {
|
||||
if (mImpl->SocketCount >= FD_SETSIZE) {
|
||||
eePRINT( "The socket can't be added to the selector because its " );
|
||||
eePRINT( "ID is too high. This is a limitation of your operating " );
|
||||
eePRINT( "system's FD_SETSIZE setting." );
|
||||
eePRINTL( "system's FD_SETSIZE setting." );
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -56,7 +56,7 @@ void SocketSelector::add(Socket& socket) {
|
||||
if (handle >= FD_SETSIZE) {
|
||||
eePRINT( "The socket can't be added to the selector because its " );
|
||||
eePRINT( "ID is too high. This is a limitation of your operating " );
|
||||
eePRINT( "system's FD_SETSIZE setting." );
|
||||
eePRINTL( "system's FD_SETSIZE setting." );
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,10 +1,33 @@
|
||||
#include <eepp/scene/nodeattribute.hpp>
|
||||
#include <eepp/graphics/pixeldensity.hpp>
|
||||
#include <algorithm>
|
||||
|
||||
using namespace EE::Graphics;
|
||||
|
||||
namespace EE { namespace Scene {
|
||||
|
||||
NodeAttribute::Info::Info( NodeAttribute::AttributeType type, const std::string& name ) :
|
||||
type( type ),
|
||||
names( { name } )
|
||||
{}
|
||||
|
||||
NodeAttribute::Info::Info( AttributeType type, const std::vector<std::string>& names ) :
|
||||
type( type ),
|
||||
names( names )
|
||||
{}
|
||||
|
||||
bool NodeAttribute::Info::isName( const std::string& name ) {
|
||||
return std::find(names.begin(), names.end(), name) != names.end();
|
||||
}
|
||||
|
||||
const NodeAttribute::AttributeType& NodeAttribute::Info::getType() const {
|
||||
return type;
|
||||
}
|
||||
|
||||
const std::vector<std::string>& NodeAttribute::Info::getNames() const {
|
||||
return names;
|
||||
}
|
||||
|
||||
NodeAttribute::NodeAttribute( std::string name, std::string value ) :
|
||||
mName( String::toLower( name ) ),
|
||||
mValue( value )
|
||||
|
||||
21
src/eepp/ui/uistyle.cpp
Normal file
21
src/eepp/ui/uistyle.cpp
Normal file
@@ -0,0 +1,21 @@
|
||||
#include <eepp/ui/uistyle.hpp>
|
||||
|
||||
namespace EE { namespace UI {
|
||||
|
||||
UIStyle * EE::UI::UIStyle::New() {
|
||||
return eeNew( UIStyle, () );
|
||||
}
|
||||
|
||||
UIStyle::UIStyle()
|
||||
{
|
||||
}
|
||||
|
||||
UIStyle::~UIStyle()
|
||||
{
|
||||
}
|
||||
|
||||
bool UIStyle::stateExists( const EE::Uint32 & State ) {
|
||||
return false;
|
||||
}
|
||||
|
||||
}}
|
||||
@@ -117,4 +117,8 @@ bool UIWidgetCreator::isWidgetRegistered( std::string widgetName ) {
|
||||
return registeredWidget.find( String::toLower( widgetName ) ) != registeredWidget.end();
|
||||
}
|
||||
|
||||
const UIWidgetCreator::RegisteredWidgetCallbackMap& UIWidgetCreator::getRegisteredWidgets() {
|
||||
return registeredWidget;
|
||||
}
|
||||
|
||||
}}
|
||||
|
||||
Reference in New Issue
Block a user