mirror of
https://github.com/SpartanJ/eepp.git
synced 2026-08-18 06:55:48 +03:00
Removed StyleSheetElement interface in favor of using UIWidget directly. Thanks to this all dynamic_casts has been removed at the cost of a little less readable code.
This commit is contained in:
@@ -54,6 +54,10 @@ class EE_API Action {
|
||||
|
||||
void setTarget( Node* target );
|
||||
|
||||
void setId( const Uint32& id );
|
||||
|
||||
const Uint32& getId();
|
||||
|
||||
protected:
|
||||
friend class Node;
|
||||
typedef std::map<ActionType, std::map<Uint32, ActionCallback>> ActionCallbackMap;
|
||||
@@ -62,6 +66,7 @@ class EE_API Action {
|
||||
Uint32 mFlags;
|
||||
Uint32 mTag;
|
||||
Uint32 mNumCallBacks;
|
||||
Uint32 mId;
|
||||
ActionCallbackMap mCallbacks;
|
||||
|
||||
virtual void onStart();
|
||||
|
||||
@@ -50,7 +50,6 @@
|
||||
#include <eepp/ui/uiwidgetcreator.hpp>
|
||||
|
||||
#include <eepp/ui/css/stylesheet.hpp>
|
||||
#include <eepp/ui/css/stylesheetelement.hpp>
|
||||
#include <eepp/ui/css/stylesheetparser.hpp>
|
||||
#include <eepp/ui/css/stylesheetpropertiesparser.hpp>
|
||||
#include <eepp/ui/css/stylesheetproperty.hpp>
|
||||
|
||||
@@ -6,8 +6,6 @@
|
||||
|
||||
namespace EE { namespace UI { namespace CSS {
|
||||
|
||||
class StyleSheetElement;
|
||||
|
||||
class EE_API StyleSheet {
|
||||
public:
|
||||
StyleSheet();
|
||||
@@ -20,7 +18,7 @@ class EE_API StyleSheet {
|
||||
|
||||
void combineStyleSheet( const StyleSheet& styleSheet );
|
||||
|
||||
StyleSheetStyleVector getElementStyles( StyleSheetElement* element,
|
||||
StyleSheetStyleVector getElementStyles( UIWidget* element,
|
||||
const bool& applyPseudo = false ) const;
|
||||
|
||||
const StyleSheetStyleVector& getStyles() const;
|
||||
|
||||
@@ -1,28 +0,0 @@
|
||||
#ifndef EE_UI_CSS_STYLESHEETELEMENT_HPP
|
||||
#define EE_UI_CSS_STYLESHEETELEMENT_HPP
|
||||
|
||||
#include <eepp/config.hpp>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
namespace EE { namespace UI { namespace CSS {
|
||||
|
||||
class EE_API StyleSheetElement {
|
||||
public:
|
||||
virtual const std::string& getStyleSheetTag() const = 0;
|
||||
|
||||
virtual const std::string& getStyleSheetId() const = 0;
|
||||
|
||||
virtual const std::vector<std::string>& getStyleSheetClasses() const = 0;
|
||||
|
||||
virtual StyleSheetElement* getStyleSheetParentElement() const = 0;
|
||||
|
||||
virtual StyleSheetElement* getStyleSheetPreviousSiblingElement() const = 0;
|
||||
|
||||
virtual StyleSheetElement* getStyleSheetNextSiblingElement() const = 0;
|
||||
|
||||
virtual const std::vector<std::string>& getStyleSheetPseudoClasses() const = 0;
|
||||
};
|
||||
}}} // namespace EE::UI::CSS
|
||||
|
||||
#endif
|
||||
@@ -17,6 +17,8 @@ namespace EE { namespace UI { namespace CSS {
|
||||
|
||||
class EE_API StyleSheetPropertyTransition : public Action {
|
||||
public:
|
||||
static constexpr Uint32 ID = String::hash( "StyleSheetPropertyTransition" );
|
||||
|
||||
static bool transitionSupported( const PropertyType& type );
|
||||
|
||||
static StyleSheetPropertyTransition* New( const PropertyDefinition* property,
|
||||
|
||||
@@ -1,12 +1,13 @@
|
||||
#ifndef EE_UI_CSS_STYLESHEETSELECTOR_HPP
|
||||
#define EE_UI_CSS_STYLESHEETSELECTOR_HPP
|
||||
|
||||
#include <eepp/core.hpp>
|
||||
#include <eepp/ui/css/stylesheetselectorrule.hpp>
|
||||
|
||||
namespace EE { namespace UI { namespace CSS {
|
||||
namespace EE { namespace UI {
|
||||
class UIWidget;
|
||||
}} // namespace EE::UI
|
||||
|
||||
class StyleSheetElement;
|
||||
namespace EE { namespace UI { namespace CSS {
|
||||
|
||||
class EE_API StyleSheetSelector {
|
||||
public:
|
||||
@@ -20,7 +21,7 @@ class EE_API StyleSheetSelector {
|
||||
|
||||
const Uint32& getSpecificity() const;
|
||||
|
||||
bool select( StyleSheetElement* element, const bool& applyPseudo = true ) const;
|
||||
bool select( UIWidget* element, const bool& applyPseudo = true ) const;
|
||||
|
||||
const bool& isCacheable() const;
|
||||
|
||||
@@ -28,8 +29,8 @@ class EE_API StyleSheetSelector {
|
||||
|
||||
bool hasPseudoClasses() const;
|
||||
|
||||
std::vector<StyleSheetElement*> getRelatedElements( StyleSheetElement* element,
|
||||
const bool& applyPseudo = true ) const;
|
||||
std::vector<UIWidget*> getRelatedElements( UIWidget* element,
|
||||
const bool& applyPseudo = true ) const;
|
||||
|
||||
protected:
|
||||
std::string mName;
|
||||
|
||||
@@ -3,9 +3,11 @@
|
||||
|
||||
#include <eepp/core.hpp>
|
||||
|
||||
namespace EE { namespace UI { namespace CSS {
|
||||
namespace EE { namespace UI {
|
||||
class UIWidget;
|
||||
}} // namespace EE::UI
|
||||
|
||||
class StyleSheetElement;
|
||||
namespace EE { namespace UI { namespace CSS {
|
||||
|
||||
class EE_API StyleSheetSelectorRule {
|
||||
public:
|
||||
@@ -48,7 +50,7 @@ class EE_API StyleSheetSelectorRule {
|
||||
|
||||
const int& getSpecificity() const { return mSpecificity; }
|
||||
|
||||
bool matches( StyleSheetElement* element, const bool& applyPseudo = true ) const;
|
||||
bool matches( UIWidget* element, const bool& applyPseudo = true ) const;
|
||||
|
||||
bool hasClass( const std::string& cls ) const;
|
||||
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
#ifndef EE_UIUIWIDGET_HPP
|
||||
#define EE_UIUIWIDGET_HPP
|
||||
|
||||
#include <eepp/ui/css/stylesheetelement.hpp>
|
||||
#include <eepp/ui/css/stylesheetproperty.hpp>
|
||||
#include <eepp/ui/css/stylesheetselector.hpp>
|
||||
#include <eepp/ui/uinode.hpp>
|
||||
@@ -21,7 +20,7 @@ namespace EE { namespace UI {
|
||||
class UITooltip;
|
||||
class UIStyle;
|
||||
|
||||
class EE_API UIWidget : public UINode, public CSS::StyleSheetElement {
|
||||
class EE_API UIWidget : public UINode {
|
||||
public:
|
||||
static UIWidget* New();
|
||||
|
||||
@@ -132,11 +131,11 @@ class EE_API UIWidget : public UINode, public CSS::StyleSheetElement {
|
||||
|
||||
const std::vector<std::string>& getStyleSheetClasses() const;
|
||||
|
||||
StyleSheetElement* getStyleSheetParentElement() const;
|
||||
UIWidget* getStyleSheetParentElement() const;
|
||||
|
||||
StyleSheetElement* getStyleSheetPreviousSiblingElement() const;
|
||||
UIWidget* getStyleSheetPreviousSiblingElement() const;
|
||||
|
||||
StyleSheetElement* getStyleSheetNextSiblingElement() const;
|
||||
UIWidget* getStyleSheetNextSiblingElement() const;
|
||||
|
||||
const std::vector<std::string>& getStyleSheetPseudoClasses() const;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user