mirror of
https://github.com/SpartanJ/eepp.git
synced 2026-06-03 20:16:29 +03:00
Added root element to the UISceneNode, in order to support ":root" tag in CSS.
--HG-- branch : dev
This commit is contained in:
@@ -3,9 +3,13 @@
|
||||
src: url("file://assets/fonts/OpenSans-Regular.ttf");
|
||||
}
|
||||
|
||||
:root {
|
||||
--font-color: #E6E6E6FF;
|
||||
}
|
||||
|
||||
/* Global rules */
|
||||
* {
|
||||
color: #E6E6E6FF;
|
||||
color: var(--font-color);
|
||||
shadow-color: #32323296;
|
||||
selected-color: #000;
|
||||
selection-back-color: #969696FF;
|
||||
@@ -31,7 +35,7 @@ WinMenu {
|
||||
|
||||
Menu,
|
||||
PopUpMenu {
|
||||
color: #E6E6E6FF;
|
||||
color: var(--font-color);
|
||||
min-width: 100dp;
|
||||
min-icon-space: 24dp;
|
||||
min-margin-right: 8dp;
|
||||
@@ -63,7 +67,7 @@ Window {
|
||||
}
|
||||
|
||||
Window::title {
|
||||
color: #E6E6E6FF;
|
||||
color: var(--font-color);
|
||||
font-style: shadow;
|
||||
}
|
||||
|
||||
|
||||
@@ -10,6 +10,7 @@ namespace EE { namespace UI {
|
||||
class UIThemeManager;
|
||||
class UIWidget;
|
||||
class UIWindow;
|
||||
class UIWidget;
|
||||
|
||||
class EE_API UISceneNode : public SceneNode {
|
||||
public:
|
||||
@@ -62,8 +63,11 @@ class EE_API UISceneNode : public SceneNode {
|
||||
|
||||
UIThemeManager* getUIThemeManager() const;
|
||||
|
||||
UIWidget* getRoot() const;
|
||||
|
||||
protected:
|
||||
friend class EE::UI::UIWindow;
|
||||
UIWidget* mRoot;
|
||||
Sizef mDpSize;
|
||||
Uint32 mFlags;
|
||||
Translator mTranslator;
|
||||
@@ -89,6 +93,10 @@ class EE_API UISceneNode : public SceneNode {
|
||||
void reloadStyle();
|
||||
|
||||
bool onMediaChanged();
|
||||
|
||||
virtual void onChildCountChange();
|
||||
|
||||
virtual void onSizeChange();
|
||||
};
|
||||
|
||||
}} // namespace EE::UI
|
||||
|
||||
@@ -43,7 +43,7 @@ UINode::UINode() :
|
||||
mNodeFlags |= NODE_FLAG_UINODE | NODE_FLAG_OVER_FIND_ALLOWED;
|
||||
|
||||
if ( NULL != SceneManager::instance()->getUISceneNode() )
|
||||
setParent( (Node*)SceneManager::instance()->getUISceneNode() );
|
||||
setParent( (Node*)SceneManager::instance()->getUISceneNode()->getRoot() );
|
||||
}
|
||||
|
||||
UINode::~UINode() {
|
||||
@@ -889,7 +889,11 @@ Node * UINode::getWindowContainer() const {
|
||||
if ( Ctrl->isType( UI_TYPE_WINDOW ) ) {
|
||||
return static_cast<const UIWindow*>( Ctrl )->getContainer();
|
||||
} else if ( mSceneNode == Ctrl ) {
|
||||
return mSceneNode;
|
||||
if ( mSceneNode->isUISceneNode() ) {
|
||||
return static_cast<UISceneNode*>( mSceneNode )->getRoot();
|
||||
} else {
|
||||
return mSceneNode;
|
||||
}
|
||||
}
|
||||
|
||||
Ctrl = Ctrl->getParent();
|
||||
|
||||
@@ -18,7 +18,10 @@ UISceneNode* UISceneNode::New( EE::Window::Window* window ) {
|
||||
}
|
||||
|
||||
UISceneNode::UISceneNode( EE::Window::Window* window ) :
|
||||
SceneNode( window ), mIsLoading( false ), mUIThemeManager( UIThemeManager::New() ) {
|
||||
SceneNode( window ),
|
||||
mRoot( NULL ),
|
||||
mIsLoading( false ),
|
||||
mUIThemeManager( UIThemeManager::New() ) {
|
||||
// Update only UI elements that requires it.
|
||||
setUpdateAllChilds( false );
|
||||
|
||||
@@ -26,6 +29,13 @@ UISceneNode::UISceneNode( EE::Window::Window* window ) :
|
||||
|
||||
setEventDispatcher( UIEventDispatcher::New( this ) );
|
||||
|
||||
mRoot = UIWidget::NewWithTag( ":root" );
|
||||
mRoot->setLayoutSizeRules( FIXED, FIXED );
|
||||
mRoot->writeNodeFlag( NODE_FLAG_OWNED_BY_NODE, 1 );
|
||||
mRoot->setParent( this );
|
||||
mRoot->clipEnable();
|
||||
mRoot->enableReportSizeChangeToChilds();
|
||||
|
||||
resizeControl( mWindow );
|
||||
}
|
||||
|
||||
@@ -166,7 +176,7 @@ void UISceneNode::reloadStyle() {
|
||||
|
||||
while ( NULL != ChildLoop ) {
|
||||
if ( ChildLoop->isWidget() )
|
||||
static_cast<UIWidget*>( ChildLoop )->reloadStyle();
|
||||
ChildLoop->asType<UIWidget>()->reloadStyle();
|
||||
|
||||
ChildLoop = ChildLoop->getNextNode();
|
||||
}
|
||||
@@ -300,6 +310,10 @@ UIThemeManager* UISceneNode::getUIThemeManager() const {
|
||||
return mUIThemeManager;
|
||||
}
|
||||
|
||||
UIWidget* UISceneNode::getRoot() const {
|
||||
return mRoot;
|
||||
}
|
||||
|
||||
bool UISceneNode::onMediaChanged() {
|
||||
if ( !mStyleSheet.isMediaQueryListEmpty() ) {
|
||||
MediaFeatures media;
|
||||
@@ -322,4 +336,31 @@ bool UISceneNode::onMediaChanged() {
|
||||
return false;
|
||||
}
|
||||
|
||||
void UISceneNode::onChildCountChange() {
|
||||
if ( NULL == mRoot )
|
||||
return;
|
||||
|
||||
Node* child = mChild;
|
||||
bool found = false;
|
||||
|
||||
while ( NULL != child ) {
|
||||
if ( !( child->getNodeFlags() & NODE_FLAG_OWNED_BY_NODE ) ) {
|
||||
found = true;
|
||||
break;
|
||||
}
|
||||
|
||||
child = child->getNextNode();
|
||||
}
|
||||
|
||||
if ( found ) {
|
||||
child->setParent( mRoot );
|
||||
}
|
||||
}
|
||||
|
||||
void UISceneNode::onSizeChange() {
|
||||
SceneNode::onSizeChange();
|
||||
|
||||
mRoot->setPixelsSize( getPixelsSize() );
|
||||
}
|
||||
|
||||
}} // namespace EE::UI
|
||||
|
||||
@@ -713,7 +713,7 @@ UIStyle * UIWidget::getUIStyle() const {
|
||||
}
|
||||
|
||||
void UIWidget::reloadStyle( const bool& reloadChilds ) {
|
||||
if ( NULL == mStyle && getSceneNode()->isUISceneNode() && static_cast<UISceneNode*>( getSceneNode() )->hasStyleSheet() ) {
|
||||
if ( NULL == mStyle && NULL != getSceneNode() && getSceneNode()->isUISceneNode() && getUISceneNode()->hasStyleSheet() ) {
|
||||
mStyle = UIStyle::New( this );
|
||||
mStyle->setState( mState );
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user