Implemented UINode::onDrop API.

Replaced/renamed all references to nodes and widgets that referred to them as "control".
This commit is contained in:
Martín Lucas Golini
2020-06-18 04:07:04 -03:00
parent 7de3420a9f
commit d904cea482
50 changed files with 478 additions and 442 deletions
+18 -18
View File
@@ -214,24 +214,24 @@ Small tool, used to create and edit texture atlases.
## UI Layout XML example
It should look really familiar to any Android developer. This is a window with
the most basic controls in a vertical linear layout display.
the most basic widgets in a vertical linear layout display.
```xml
<window layout_width="300dp" layout_height="300dp" winflags="default|maximize">
<LinearLayout id="testlayout" orientation="vertical" layout_width="match_parent" layout_height="match_parent" layout_margin="8dp">
<TextView text="Hello World!" gravity="center" layout_gravity="center_horizontal" layout_width="match_parent" layout_height="wrap_content" backgroundColor="black" />
<PushButton text="OK!" textSize="16dp" icon="ok" gravity="center" layout_gravity="center_horizontal" layout_width="match_parent" layout_height="wrap_content" />
<Image src="thecircle" layout_width="match_parent" layout_height="32dp" flags="clip" />
<Sprite src="gn" />
<TextInput text="test" layout_width="match_parent" layout_height="wrap_content" />
<DropDownList layout_width="match_parent" layout_height="wrap_content" selectedIndex="0">
<item>Test Item</item>
<item>@string/test_item</item>
</DropDownList>
<ListBox layout_width="match_parent" layout_height="match_parent" layout_weight="1">
<item>Hello!</item>
<item>World!</item>
</ListBox>
<TextView text="Hello World!" gravity="center" layout_gravity="center_horizontal" layout_width="match_parent" layout_height="wrap_content" backgroundColor="black" />
<PushButton text="OK!" textSize="16dp" icon="ok" gravity="center" layout_gravity="center_horizontal" layout_width="match_parent" layout_height="wrap_content" />
<Image src="thecircle" layout_width="match_parent" layout_height="32dp" flags="clip" />
<Sprite src="gn" />
<TextInput text="test" layout_width="match_parent" layout_height="wrap_content" />
<DropDownList layout_width="match_parent" layout_height="wrap_content" selectedIndex="0">
<item>Test Item</item>
<item>@string/test_item</item>
</DropDownList>
<ListBox layout_width="match_parent" layout_height="match_parent" layout_weight="1">
<item>Hello!</item>
<item>World!</item>
</ListBox>
</LinearLayout>
</window>
```
@@ -244,10 +244,10 @@ How does it look with real code?
```cpp
UITextView::New()->setText( "Text on test 1" )
->setCharacterSize( 12 )
->setLayoutMargin( Rect( 10, 10, 10, 10 ) )
->setLayoutSizePolicy( SizePolicy::MatchParent, SizePolicy::WrapContent )
->setParent( layout );
->setCharacterSize( 12 )
->setLayoutMargin( Rect( 10, 10, 10, 10 ) )
->setLayoutSizePolicy( SizePolicy::MatchParent, SizePolicy::WrapContent )
->setParent( layout );
```
## UI Styling
+2 -4
View File
@@ -1,10 +1,6 @@
# TODO - Short and mid term plans.
## UIWidget
* Add `onDrop( UIWidget* )` API. In order to be able to drop widgets onto other widgets.
## UITabWidget
* Add support to move Tabs from one `UITabWidget` to another using the onDrop API.
@@ -17,6 +13,8 @@ Implement icon themes separated from the `UITheme` and customizable from a CSS f
* Add show white spaces.
* Add new CSS properties related to the widget.
## TextDocument
* Add indentation type auto-detection.
+13 -2
View File
@@ -48,13 +48,13 @@ class EE_API Event {
OnWindowMinimizeClick,
OpenFile,
SaveFile,
OnControlClear,
OnClear,
MsgBoxConfirmClick,
MsgBoxCancelClick,
OnTabSelected,
OnTabClosed,
OnTabNavigate,
OnClose, // Warning: Only some controls will report this event.
OnClose, // Warning: Only some nodes will report this event.
OnDragStart,
OnDragStop,
OnPaddingChange,
@@ -67,6 +67,7 @@ class EE_API Event {
OnClassChange,
OnLayoutUpdate,
OnSelectionChanged,
OnNodeDropped,
UserEvent,
NoEvent = eeINDEX_NOT_FOUND
};
@@ -88,6 +89,16 @@ class EE_API Event {
Uint32 mCallbackId;
};
class EE_API DropEvent : public Event {
public:
DropEvent( Node* node, Node* droppedNode, const Uint32& eventType ) :
Event( node, eventType ), droppedNode( droppedNode ) {}
Node* getDroppedNode() const { return droppedNode; }
protected:
Node* droppedNode;
};
}} // namespace EE::Scene
#endif
+8 -8
View File
@@ -200,7 +200,7 @@ class EE_API Node : public Transformable {
const Rectf& getWorldBounds();
bool isParentOf( Node* Ctrl ) const;
bool isParentOf( Node* node ) const;
void sendEvent( const Event* Event );
@@ -222,9 +222,9 @@ class EE_API Node : public Transformable {
return reinterpret_cast<T*>( find( id ) );
}
template <typename T> T* bind( const std::string& id, T*& ctrl ) {
ctrl = find<T>( id );
return ctrl;
template <typename T> T* bind( const std::string& id, T*& node ) {
node = find<T>( id );
return node;
}
template <typename T> T* asType() { return reinterpret_cast<T*>( this ); }
@@ -235,9 +235,9 @@ class EE_API Node : public Transformable {
return reinterpret_cast<T*>( findByType( type ) );
}
template <typename T> T* bindByType( const Uint32& type, T*& ctrl ) {
ctrl = findByType<T>( type );
return ctrl;
template <typename T> T* bindByType( const Uint32& type, T*& node ) {
node = findByType<T>( type );
return node;
}
bool inNodeTree( Node* node ) const;
@@ -396,7 +396,7 @@ class EE_API Node : public Transformable {
Vector2i mScreenPosi;
Sizef mSize;
UintPtr mData;
Node* mParentCtrl;
Node* mParentNode;
SceneNode* mSceneNode;
Node* mNodeDrawInvalidator;
Node* mChild; //! Pointer to the first child of the node
+12 -1
View File
@@ -24,12 +24,13 @@ class EE_API NodeMessage {
Selected,
DragStart,
DragStop,
Drop,
LayoutAttributeChange,
UserMessage,
NoMessage = eeINDEX_NOT_FOUND
};
NodeMessage( Node* node, const Uint32& Msg, const Uint32& Flags = NoMessage );
NodeMessage( Node* node, const Uint32& msg, const Uint32& flags = NoMessage );
~NodeMessage();
@@ -45,6 +46,16 @@ class EE_API NodeMessage {
Uint32 mFlags;
};
class EE_API NodeDropMessage : public NodeMessage {
public:
NodeDropMessage( Node* node, const Uint32& msg, Node* droppedNode );
Node* getDroppedNode() const;
private:
Node* mDroppedNode;
};
}} // namespace EE::Scene
#endif
+2 -2
View File
@@ -155,9 +155,9 @@ class EE_API SceneNode : public Node {
virtual void onDrawDebugDataChange();
void sendMsg( Node* Ctrl, const Uint32& Msg, const Uint32& Flags = 0 );
void sendMsg( Node* node, const Uint32& msg, const Uint32& flags = 0 );
virtual void resizeControl( EE::Window::Window* win );
virtual void resizeNode( EE::Window::Window* win );
void addToCloseQueue( Node* node );
+1 -1
View File
@@ -68,7 +68,7 @@ class EE_API TextureAtlasEditor {
void onTextureRegionChange( const Event* Event );
void updateControls();
void updateWidgets();
void fillTextureRegionList();
+1 -1
View File
@@ -40,7 +40,7 @@ class EE_API UIComboBox : public UIWidget {
Uint32 onMessage( const NodeMessage* Msg );
void updateControls();
void updateWidgets();
virtual void onSizeChange();
+3 -3
View File
@@ -56,7 +56,7 @@ class EE_API UIDropDownList : public UITextInput {
StyleConfig mStyleConfig;
UIListBox* mListBox;
UINode* mFriendCtrl;
UINode* mFriendNode;
void onListBoxFocusLoss( const Event* Event );
@@ -78,7 +78,7 @@ class EE_API UIDropDownList : public UITextInput {
virtual void onItemKeyDown( const Event* Event );
virtual void onControlClear( const Event* Event );
virtual void onWidgetClear( const Event* Event );
virtual Uint32 onKeyDown( const KeyEvent& Event );
@@ -88,7 +88,7 @@ class EE_API UIDropDownList : public UITextInput {
virtual void onThemeLoaded();
void setFriendControl( UINode* friendCtrl );
void setFriendNode( UINode* friendNode );
void destroyListBox();
};
+2 -2
View File
@@ -125,7 +125,7 @@ class EE_API UIMenu : public UIWidget {
bool widgetCheckSize( UIWidget* widget, const bool& resize = true );
bool isSubMenu( Node* Ctrl );
bool isSubMenu( Node* node );
void setItemSelected( UIWidget* Item );
@@ -135,7 +135,7 @@ class EE_API UIMenu : public UIWidget {
void nextSel();
void trySelect( UIWidget* Ctrl, bool Up );
void trySelect( UIWidget* node, bool up );
};
}} // namespace EE::UI
+1 -1
View File
@@ -58,7 +58,7 @@ class EE_API UIMenuBar : public UIWidget {
UIPopUpMenu* getMenuFromButton( UISelectButton* Button );
bool isPopUpMenuChild( Node* Ctrl );
bool isPopUpMenuChild( Node* node );
void onMenuFocusLoss( const Event* Event );
+2
View File
@@ -304,6 +304,8 @@ class EE_API UINode : public Node {
virtual Uint32 onDragStop( const Vector2i& position, const Uint32& flags );
virtual Uint32 onDrop( UINode* widget );
virtual Uint32 onMouseOver( const Vector2i& position, const Uint32& flags );
virtual Uint32 onMouseLeave( const Vector2i& position, const Uint32& flags );
+1 -1
View File
@@ -125,7 +125,7 @@ class EE_API UISceneNode : public SceneNode {
std::unordered_set<UILayout*> mDirtyLayouts;
std::vector<std::pair<Float, std::string>> mTimes;
virtual void resizeControl( EE::Window::Window* win );
virtual void resizeNode( EE::Window::Window* win );
virtual void onDrawDebugDataChange();
+1 -1
View File
@@ -62,7 +62,7 @@ class EE_API UITab : public UISelectButton {
virtual UIWidget* getExtraInnerWidget();
void setOwnedControl();
void setOwnedNode();
void updateTab();
};
+1 -1
View File
@@ -18,7 +18,7 @@ class EE_API UITableCell : public UIWidget {
virtual void setTheme( UITheme* Theme );
void setCell( const Uint32& CollumnIndex, UINode* Ctrl );
void setCell( const Uint32& CollumnIndex, UINode* node );
UINode* getCell( const Uint32& CollumnIndex ) const;
+11 -11
View File
@@ -50,27 +50,27 @@ class EE_API UITabWidget : public UIWidget {
UITab* add( const String& text, UINode* nodeOwned, Drawable* icon = NULL );
UITabWidget* add( UITab* Tab );
UITabWidget* add( UITab* tab );
UITab* getTab( const Uint32& Index );
UITab* getTab( const Uint32& index );
UITab* getTab( const String& Text );
UITab* getTab( const String& text );
Uint32 getTabIndex( UITab* Tab );
Uint32 getTabIndex( UITab* tab );
Uint32 getTabCount() const;
void removeTab( const Uint32& index, bool destroyOwnedNode = true );
void removeTab( UITab* Tab, bool destroyOwnedNode = true );
void removeTab( UITab* tab, bool destroyOwnedNode = true );
void removeAllTabs( bool destroyOwnedNode = true );
void insertTab( const String& Text, UINode* CtrlOwned, Drawable* Icon, const Uint32& Index );
void insertTab( const String& text, UINode* nodeOwned, Drawable* icon, const Uint32& index );
void insertTab( UITab* Tab, const Uint32& Index );
void insertTab( UITab* tab, const Uint32& index );
virtual void setTheme( UITheme* Theme );
virtual void setTheme( UITheme* theme );
UITab* getTabSelected() const;
@@ -78,7 +78,7 @@ class EE_API UITabWidget : public UIWidget {
UIWidget* getTabBar() const;
UIWidget* getControlContainer() const;
UIWidget* getContainerNode() const;
Float getTabSeparation() const;
@@ -125,7 +125,7 @@ class EE_API UITabWidget : public UIWidget {
void selectNextTab();
UITab* setTabSelected( UITab* Tab );
UITab* setTabSelected( UITab* tab );
UITab* setTabSelected( const Uint32& tabIndex );
@@ -144,7 +144,7 @@ class EE_API UITabWidget : public UIWidget {
protected:
friend class UITab;
UIWidget* mCtrlContainer;
UIWidget* mNodeContainer;
UIWidget* mTabBar;
StyleConfig mStyleConfig;
std::deque<UITab*> mTabs;
+1 -1
View File
@@ -61,7 +61,7 @@ class EE_API UITheme : protected ResourceManagerMulti<UISkin> {
EE::Graphics::Drawable* getIconByName( const std::string& name );
UISkin* getSkin( const std::string& controlName );
UISkin* getSkin( const std::string& widgetName );
Font* getDefaultFont() const;
+5 -5
View File
@@ -28,7 +28,7 @@ class EE_API UIThemeManager : public ResourceManager<UITheme> {
UITheme* getDefaultTheme() const;
UIThemeManager* applyDefaultTheme( UINode* Control );
UIThemeManager* applyDefaultTheme( UINode* node );
UIThemeManager* setAutoApplyDefaultTheme( const bool& apply );
@@ -38,13 +38,13 @@ class EE_API UIThemeManager : public ResourceManager<UITheme> {
const bool& getDefaultEffectsEnabled() const;
const Time& getControlsFadeInTime() const;
const Time& getWidgetsFadeInTime() const;
UIThemeManager* setControlsFadeInTime( const Time& Time );
UIThemeManager* setWidgetsFadeInTime( const Time& Time );
const Time& getControlsFadeOutTime() const;
const Time& getWidgetsFadeOutTime() const;
UIThemeManager* setControlsFadeOutTime( const Time& Time );
UIThemeManager* setWidgetsFadeOutTime( const Time& Time );
UIThemeManager* setTooltipTimeToShow( const Time& Time );
+4 -4
View File
@@ -117,7 +117,7 @@ class EE_API UIWindow : public UIWidget {
bool isModal();
UIWidget* getModalControl() const;
UIWidget* getModalWidget() const;
void maximize();
@@ -190,7 +190,7 @@ class EE_API UIWindow : public UIWidget {
UIWidget* mButtonMaximize;
UITextView* mTitle;
UIWidget* mModalCtrl;
UIWidget* mModalNode;
Vector2f mNonMaxPos;
Sizef mNonMaxSize;
@@ -218,7 +218,7 @@ class EE_API UIWindow : public UIWidget {
void doResize( const NodeMessage* Msg );
void decideResizeType( Node* Control );
void decideResizeType( Node* node );
void tryResize( const UI_RESIZE_TYPE& getType );
@@ -240,7 +240,7 @@ class EE_API UIWindow : public UIWidget {
UIKeyboardShortcuts::iterator existsShortcut( const Keycode& KeyCode, const Uint32& Mod );
void createModalControl();
void createModalNode();
void resizeCursor();
+5 -5
View File
@@ -33,16 +33,16 @@ static UITextView* createTextBox( const String& Text = "", Node* Parent = NULL,
const Sizef& Size = Sizef(), const Vector2f& Pos = Vector2f(),
const Uint32& Flags = UI_NODE_DEFAULT_FLAGS | UI_AUTO_SIZE,
const Uint32& fontStyle = Text::Regular ) {
UITextView* Ctrl = UITextView::New();
Ctrl->setFontStyle( fontStyle );
Ctrl->resetFlags( Flags )
UITextView* widget = UITextView::New();
widget->setFontStyle( fontStyle );
widget->resetFlags( Flags )
->setParent( Parent )
->setSize( Size )
->setVisible( true )
->setEnabled( false )
->setPosition( Pos );
Ctrl->setText( Text );
return Ctrl;
widget->setText( Text );
return widget;
}
MapEditor* MapEditor::New( UIWindow* AttatchTo, const MapEditor::MapEditorCloseCb& callback ) {
@@ -9,16 +9,16 @@ static UITextView* createTextBox( const String& Text = "", Node* Parent = NULL,
const Sizef& Size = Sizef(), const Vector2f& Pos = Vector2f(),
const Uint32& Flags = UI_NODE_DEFAULT_FLAGS | UI_AUTO_SIZE,
const Uint32& fontStyle = Text::Regular ) {
UITextView* Ctrl = UITextView::New();
Ctrl->setFontStyle( fontStyle );
Ctrl->resetFlags( Flags )
UITextView* widget = UITextView::New();
widget->setFontStyle( fontStyle );
widget->resetFlags( Flags )
->setParent( Parent )
->setSize( Size )
->setVisible( true )
->setEnabled( false )
->setPosition( Pos );
Ctrl->setText( Text );
return Ctrl;
widget->setText( Text );
return widget;
}
MapObjectProperties::MapObjectProperties( GameObjectObject* Obj ) :
@@ -9,16 +9,16 @@ static UITextView* createTextBox( const String& Text = "", Node* Parent = NULL,
const Sizef& Size = Sizef(), const Vector2f& Pos = Vector2f(),
const Uint32& Flags = UI_NODE_DEFAULT_FLAGS | UI_AUTO_SIZE,
const Uint32& fontStyle = Text::Regular ) {
UITextView* Ctrl = UITextView::New();
Ctrl->setFontStyle( fontStyle );
Ctrl->resetFlags( Flags )
UITextView* widget = UITextView::New();
widget->setFontStyle( fontStyle );
widget->resetFlags( Flags )
->setParent( Parent )
->setSize( Size )
->setVisible( true )
->setEnabled( false )
->setPosition( Pos );
Ctrl->setText( Text );
return Ctrl;
widget->setText( Text );
return widget;
}
TileMapProperties::TileMapProperties( TileMap* Map ) :
+5 -5
View File
@@ -9,16 +9,16 @@ static UITextView* createTextBox( const String& Text = "", Node* Parent = NULL,
const Sizef& Size = Sizef(), const Vector2f& Pos = Vector2f(),
const Uint32& Flags = UI_NODE_DEFAULT_FLAGS | UI_AUTO_SIZE,
const Uint32& fontStyle = Text::Regular ) {
UITextView* Ctrl = UITextView::New();
Ctrl->setFontStyle( fontStyle );
Ctrl->resetFlags( Flags )
UITextView* widget = UITextView::New();
widget->setFontStyle( fontStyle );
widget->resetFlags( Flags )
->setParent( Parent )
->setSize( Size )
->setVisible( true )
->setEnabled( false )
->setPosition( Pos );
Ctrl->setText( Text );
return Ctrl;
widget->setText( Text );
return widget;
}
UIMapNew::UIMapNew( UIMap* Map, std::function<void()> NewMapCb, bool ResizeMap ) :
+43 -47
View File
@@ -17,7 +17,7 @@ Node::Node() :
mIdHash( 0 ),
mSize( 0, 0 ),
mData( 0 ),
mParentCtrl( NULL ),
mParentNode( NULL ),
mSceneNode( NULL ),
mNodeDrawInvalidator( NULL ),
mChild( NULL ),
@@ -45,8 +45,8 @@ Node::~Node() {
childDeleteAll();
if ( NULL != mParentCtrl )
mParentCtrl->childRemove( this );
if ( NULL != mParentNode )
mParentNode->childRemove( this );
EventDispatcher* eventDispatcher = NULL != mSceneNode ? mSceneNode->getEventDispatcher() : NULL;
@@ -62,7 +62,7 @@ Node::~Node() {
}
void Node::worldToNodeTranslation( Vector2f& Pos ) const {
Node* ParentLoop = mParentCtrl;
Node* ParentLoop = mParentNode;
Pos -= mPosition;
@@ -76,7 +76,7 @@ void Node::worldToNodeTranslation( Vector2f& Pos ) const {
}
void Node::nodeToWorldTranslation( Vector2f& Pos ) const {
Node* ParentLoop = mParentCtrl;
Node* ParentLoop = mParentNode;
while ( NULL != ParentLoop ) {
const Vector2f& ParentPos = ParentLoop->getPosition();
@@ -198,7 +198,7 @@ bool Node::isDisabled() const {
}
Node* Node::getParent() const {
return mParentCtrl;
return mParentNode;
}
void Node::updateDrawInvalidator( bool force ) {
@@ -234,18 +234,18 @@ bool Node::isSubscribedForScheduledUpdate() {
Node* Node::setParent( Node* parent ) {
eeASSERT( NULL != parent );
if ( parent == mParentCtrl )
if ( parent == mParentNode )
return this;
if ( NULL != mParentCtrl )
mParentCtrl->childRemove( this );
if ( NULL != mParentNode )
mParentNode->childRemove( this );
mParentCtrl = parent;
mParentNode = parent;
updateDrawInvalidator();
if ( NULL != mParentCtrl )
mParentCtrl->childAdd( this );
if ( NULL != mParentNode )
mParentNode->childAdd( this );
setDirty();
@@ -257,18 +257,14 @@ Node* Node::setParent( Node* parent ) {
return this;
}
bool Node::isParentOf( Node* Ctrl ) const {
eeASSERT( NULL != Ctrl );
Node* tParent = Ctrl->getParent();
bool Node::isParentOf( Node* node ) const {
eeASSERT( NULL != node );
Node* tParent = node->getParent();
while ( NULL != tParent ) {
if ( this == tParent )
return true;
tParent = tParent->getParent();
}
return false;
}
@@ -352,8 +348,8 @@ Uint32 Node::onMouseDoubleClick( const Vector2i& Pos, const Uint32& Flags ) {
}
Uint32 Node::onMouseOver( const Vector2i& Pos, const Uint32& Flags ) {
if ( NULL != mParentCtrl && mParentCtrl->isMouseOverMeOrChilds() )
mParentCtrl->onMouseOver( Pos, Flags );
if ( NULL != mParentNode && mParentNode->isMouseOverMeOrChilds() )
mParentNode->onMouseOver( Pos, Flags );
writeNodeFlag( NODE_FLAG_MOUSEOVER, 1 );
@@ -366,8 +362,8 @@ Uint32 Node::onMouseOver( const Vector2i& Pos, const Uint32& Flags ) {
}
Uint32 Node::onMouseLeave( const Vector2i& Pos, const Uint32& Flags ) {
if ( NULL != mParentCtrl && !mParentCtrl->isMouseOverMeOrChilds() )
mParentCtrl->onMouseLeave( Pos, Flags );
if ( NULL != mParentNode && !mParentNode->isMouseOverMeOrChilds() )
mParentNode->onMouseLeave( Pos, Flags );
writeNodeFlag( NODE_FLAG_MOUSEOVER, 0 );
@@ -423,21 +419,21 @@ const BlendMode& Node::getBlendMode() const {
}
void Node::toFront() {
if ( NULL != mParentCtrl && mParentCtrl->mChildLast != this ) {
mParentCtrl->childRemove( this );
mParentCtrl->childAdd( this );
if ( NULL != mParentNode && mParentNode->mChildLast != this ) {
mParentNode->childRemove( this );
mParentNode->childAdd( this );
}
}
void Node::toBack() {
if ( NULL != mParentCtrl ) {
mParentCtrl->childAddAt( this, 0 );
if ( NULL != mParentNode ) {
mParentNode->childAddAt( this, 0 );
}
}
void Node::toPosition( const Uint32& Pos ) {
if ( NULL != mParentCtrl ) {
mParentCtrl->childAddAt( this, Pos );
if ( NULL != mParentNode ) {
mParentNode->childAddAt( this, Pos );
}
}
@@ -601,7 +597,7 @@ void Node::childAddAt( Node* node, Uint32 index ) {
childRemove( node );
node->mParentCtrl = this;
node->mParentNode = this;
node->mSceneNode = node->findSceneNode();
if ( nodeLoop == NULL ) {
@@ -717,10 +713,10 @@ Node* Node::findIdHash( const String::HashType& idHash ) const {
Node* child = mChild;
while ( NULL != child ) {
Node* foundCtrl = child->findIdHash( idHash );
Node* foundNode = child->findIdHash( idHash );
if ( NULL != foundCtrl )
return foundCtrl;
if ( NULL != foundNode )
return foundNode;
child = child->mNext;
}
@@ -778,13 +774,13 @@ bool Node::isChild( Node* child ) const {
}
bool Node::inParentTreeOf( Node* Child ) const {
Node* ParentLoop = Child->mParentCtrl;
Node* ParentLoop = Child->mParentNode;
while ( NULL != ParentLoop ) {
if ( ParentLoop == this )
return true;
ParentLoop = ParentLoop->mParentCtrl;
ParentLoop = ParentLoop->mParentNode;
}
return false;
@@ -835,8 +831,8 @@ Node* Node::getChildAt( Uint32 index ) const {
Uint32 Node::getNodeIndex() const {
Uint32 nodeIndex = 0;
if ( NULL != mParentCtrl ) {
Node* parentChild = mParentCtrl->mChild;
if ( NULL != mParentNode ) {
Node* parentChild = mParentNode->mChild;
while ( parentChild != NULL ) {
if ( parentChild == this )
return nodeIndex;
@@ -850,8 +846,8 @@ Uint32 Node::getNodeIndex() const {
Uint32 Node::getNodeOfTypeIndex() const {
Uint32 nodeIndex = 0;
Uint32 type = getType();
if ( NULL != mParentCtrl ) {
Node* parentChild = mParentCtrl->mChild;
if ( NULL != mParentNode ) {
Node* parentChild = mParentNode->mChild;
while ( parentChild != NULL ) {
if ( parentChild == this )
return nodeIndex;
@@ -904,9 +900,9 @@ Node* Node::overFind( const Vector2f& point ) {
}
void Node::detach() {
if ( mParentCtrl ) {
mParentCtrl->childRemove( this );
mParentCtrl = NULL;
if ( mParentNode ) {
mParentNode->childRemove( this );
mParentNode = NULL;
}
}
@@ -1164,7 +1160,7 @@ SceneNode* Node::getSceneNode() const {
}
SceneNode* Node::findSceneNode() {
Node* node = mParentCtrl;
Node* node = mParentNode;
while ( node != NULL ) {
if ( node->isSceneNode() )
return static_cast<SceneNode*>( node );
@@ -1434,7 +1430,7 @@ Transform Node::getLocalTransform() const {
}
Transform Node::getGlobalTransform() const {
return NULL != mParentCtrl ? mParentCtrl->getGlobalTransform() * getTransform()
return NULL != mParentNode ? mParentNode->getGlobalTransform() * getTransform()
: getTransform();
}
@@ -1504,7 +1500,7 @@ Node* Node::getFirstWidget() const {
}
Node* Node::getParentWidget() const {
Node* parentNode = mParentCtrl;
Node* parentNode = mParentNode;
while ( NULL != parentNode ) {
if ( parentNode->isWidget() ) {
@@ -1591,7 +1587,7 @@ void Node::clipSmartDisable() {
}
Node* Node::getDrawInvalidator() {
Node* node = mParentCtrl;
Node* node = mParentNode;
while ( node != NULL ) {
if ( node->isDrawInvalidator() )
return node;
+5 -2
View File
@@ -3,8 +3,8 @@
namespace EE { namespace Scene {
NodeMessage::NodeMessage( Node* node, const Uint32& Msg, const Uint32& Flags ) :
mNode( node ), mMsg( Msg ), mFlags( Flags ) {}
NodeMessage::NodeMessage( Node* node, const Uint32& msg, const Uint32& flags ) :
mNode( node ), mMsg( msg ), mFlags( flags ) {}
NodeMessage::~NodeMessage() {}
@@ -20,4 +20,7 @@ const Uint32& NodeMessage::getFlags() const {
return mFlags;
}
NodeDropMessage::NodeDropMessage( Node* node, const Uint32& msg, Node* droppedNode ) :
NodeMessage( node, msg ), mDroppedNode( droppedNode ) {}
}} // namespace EE::Scene
+13 -13
View File
@@ -43,14 +43,14 @@ SceneNode::SceneNode( EE::Window::Window* window ) :
mWindow = Engine::instance()->getCurrentWindow();
}
mResizeCb = mWindow->pushResizeCallback( cb::Make1( this, &SceneNode::resizeControl ) );
mResizeCb = mWindow->pushResizeCallback( cb::Make1( this, &SceneNode::resizeNode ) );
DisplayManager* displayManager = Engine::instance()->getDisplayManager();
int currentDisplayIndex = getWindow()->getCurrentDisplayIndex();
Display* currentDisplay = displayManager->getDisplayIndex( currentDisplayIndex );
mDPI = currentDisplay->getDPI();
resizeControl( window );
resizeNode( window );
}
SceneNode::~SceneNode() {
@@ -181,9 +181,9 @@ void SceneNode::addToCloseQueue( Node* node ) {
if ( mCloseList.count( node ) > 0 )
return;
for ( auto& closeCtrl : mCloseList ) {
if ( NULL != closeCtrl && closeCtrl->isParentOf( node ) ) {
// If a parent will be removed, means that the control
for ( auto& closeNode : mCloseList ) {
if ( NULL != closeNode && closeNode->isParentOf( node ) ) {
// If a parent will be removed, means that the node
// that we are trying to queue will be removed by the father
// so we skip it
return;
@@ -196,8 +196,8 @@ void SceneNode::addToCloseQueue( Node* node ) {
itNode = *it;
if ( NULL != itNode && node->isParentOf( itNode ) ) {
// if the control added is parent of another control already added,
// we remove the already added control because it will be deleted
// if the node added is parent of another node already added,
// we remove the already added node because it will be deleted
// by its parent
itEraseList.push_back( it );
} else if ( NULL == itNode ) {
@@ -205,8 +205,8 @@ void SceneNode::addToCloseQueue( Node* node ) {
}
}
// We delete all the controls that don't need to be deleted
// because of the new added control to the queue
// We delete all the nodes that don't need to be deleted
// because of the new added node to the queue
for ( auto ite = itEraseList.begin(); ite != itEraseList.end(); ++ite ) {
mCloseList.erase( *ite );
}
@@ -316,12 +316,12 @@ void SceneNode::matrixUnset() {
}
}
void SceneNode::sendMsg( Node* Ctrl, const Uint32& Msg, const Uint32& Flags ) {
NodeMessage tMsg( Ctrl, Msg, Flags );
Ctrl->messagePost( &tMsg );
void SceneNode::sendMsg( Node* node, const Uint32& msg, const Uint32& flags ) {
NodeMessage tMsg( node, msg, flags );
node->messagePost( &tMsg );
}
void SceneNode::resizeControl( EE::Window::Window* ) {
void SceneNode::resizeNode( EE::Window::Window* ) {
setSize( (Float)mWindow->getWidth(), (Float)mWindow->getHeight() );
sendMsg( this, NodeMessage::WindowResize );
}
+2 -2
View File
@@ -353,7 +353,7 @@ void TextureAtlasEditor::onTextureAtlasCreate( TexturePacker* TexPacker ) {
cb::Make1( this, &TextureAtlasEditor::onTextureAtlasLoaded ) );
}
void TextureAtlasEditor::updateControls() {
void TextureAtlasEditor::updateWidgets() {
if ( NULL != mTextureAtlasLoader && mTextureAtlasLoader->isLoaded() ) {
mTextureFilterList->getListBox()->setSelected(
mTextureAtlasLoader->getTextureAtlasHeader().TextureFilter );
@@ -456,7 +456,7 @@ void TextureAtlasEditor::onTextureAtlasLoaded( TextureAtlasLoader* textureAtlasL
mTextureAtlasLoader = textureAtlasLoader;
if ( mTextureAtlasLoader->isLoaded() ) {
mUIContainer->runOnMainThread( [&] { updateControls(); } );
mUIContainer->runOnMainThread( [&] { updateWidgets(); } );
}
}
+17 -17
View File
@@ -251,16 +251,16 @@ UIColorPicker::UIColorPicker( UIWindow* attachTo, const UIColorPicker::ColorPick
if ( NULL != mUIWindow && mUIWindow->isModal() ) {
if ( mModalAlpha != 0.f ) {
mUIWindow->getModalControl()->setBackgroundColor( Color( 0, 0, 0, mModalAlpha ) );
mUIWindow->getModalWidget()->setBackgroundColor( Color( 0, 0, 0, mModalAlpha ) );
if ( mRoot->getUISceneNode()->getUIThemeManager()->getDefaultEffectsEnabled() ) {
mUIWindow->getModalControl()->runAction( Actions::Fade::New(
mUIWindow->getModalWidget()->runAction( Actions::Fade::New(
0.f, mModalAlpha,
mRoot->getUISceneNode()->getUIThemeManager()->getControlsFadeOutTime() ) );
mRoot->getUISceneNode()->getUIThemeManager()->getWidgetsFadeOutTime() ) );
}
}
mUIWindow->getModalControl()->addEventListener( Event::MouseClick,
[&]( const Event* ) { closePicker(); } );
mUIWindow->getModalWidget()->addEventListener( Event::MouseClick,
[&]( const Event* ) { closePicker(); } );
mUIWindow->addEventListener( Event::KeyDown, [&]( const Event* event ) {
const KeyEvent* keyEvent = static_cast<const KeyEvent*>( event );
onKeyDown( *keyEvent );
@@ -328,8 +328,8 @@ UIWindow* UIColorPicker::getUIWindow() const {
void UIColorPicker::closePicker() {
if ( mModalAlpha != 0.f &&
mRoot->getUISceneNode()->getUIThemeManager()->getDefaultEffectsEnabled() )
mUIWindow->getModalControl()->runAction( Actions::FadeOut::New(
mRoot->getUISceneNode()->getUIThemeManager()->getControlsFadeOutTime() ) );
mUIWindow->getModalWidget()->runAction( Actions::FadeOut::New(
mRoot->getUISceneNode()->getUIThemeManager()->getWidgetsFadeOutTime() ) );
mUIWindow->closeWindow();
}
@@ -348,7 +348,7 @@ void UIColorPicker::setModalAlpha( const Uint8& modalAlpha ) {
mModalAlpha = modalAlpha;
if ( NULL != mUIWindow && mUIWindow->isModal() ) {
mUIWindow->getModalControl()->setBackgroundColor( Color( 0, 0, 0, mModalAlpha ) );
mUIWindow->getModalWidget()->setBackgroundColor( Color( 0, 0, 0, mModalAlpha ) );
}
}
}
@@ -587,20 +587,20 @@ void UIColorPicker::registerEvents() {
}
void UIColorPicker::onColorPickerEvent( const MouseEvent* mouseEvent ) {
Vector2f controlPos( mouseEvent->getPosition().x, mouseEvent->getPosition().y );
mouseEvent->getNode()->worldToNode( controlPos );
controlPos = PixelDensity::dpToPx( controlPos );
Float s = controlPos.x / mouseEvent->getNode()->asType<UIWidget>()->getPixelsSize().getWidth();
Vector2f nodePos( mouseEvent->getPosition().x, mouseEvent->getPosition().y );
mouseEvent->getNode()->worldToNode( nodePos );
nodePos = PixelDensity::dpToPx( nodePos );
Float s = nodePos.x / mouseEvent->getNode()->asType<UIWidget>()->getPixelsSize().getWidth();
Float v =
1.f - controlPos.y / mouseEvent->getNode()->asType<UIWidget>()->getPixelsSize().getHeight();
1.f - nodePos.y / mouseEvent->getNode()->asType<UIWidget>()->getPixelsSize().getHeight();
setHsvColor( Colorf( mHsv.hsv.h, s, v, mHsv.hsv.a ) );
}
void UIColorPicker::onHuePickerEvent( const MouseEvent* mouseEvent ) {
Vector2f controlPos( mouseEvent->getPosition().x, mouseEvent->getPosition().y );
mouseEvent->getNode()->worldToNode( controlPos );
controlPos = PixelDensity::dpToPx( controlPos );
Float h = 360.f - 360.f * controlPos.y /
Vector2f nodePos( mouseEvent->getPosition().x, mouseEvent->getPosition().y );
mouseEvent->getNode()->worldToNode( nodePos );
nodePos = PixelDensity::dpToPx( nodePos );
Float h = 360.f - 360.f * nodePos.y /
mouseEvent->getNode()->asType<UIWidget>()->getPixelsSize().getHeight();
setHsvColor( Colorf( h, mHsv.hsv.s, mHsv.hsv.v, mHsv.hsv.a ) );
}
+7 -7
View File
@@ -10,7 +10,7 @@ UIComboBox* UIComboBox::New() {
UIComboBox::UIComboBox() : UIWidget( "combobox" ), mDropDownList( NULL ), mButton( NULL ) {
mDropDownList = UIDropDownList::NewWithTag( "combobox::dropdownlist" );
mDropDownList->setParent( this );
mDropDownList->setFriendControl( this );
mDropDownList->setFriendNode( this );
mDropDownList->setVisible( true );
mDropDownList->setEnabled( true );
mDropDownList->setAllowEditing( true );
@@ -54,7 +54,7 @@ void UIComboBox::setTheme( UITheme* Theme ) {
mButton->setSize( mButton->getSkinSize() );
}
updateControls();
updateWidgets();
onThemeLoaded();
}
@@ -77,7 +77,7 @@ void UIComboBox::loadFromXmlNode( const pugi::xml_node& node ) {
endAttributesTransaction();
updateControls();
updateWidgets();
}
Uint32 UIComboBox::onMessage( const NodeMessage* Msg ) {
@@ -89,7 +89,7 @@ Uint32 UIComboBox::onMessage( const NodeMessage* Msg ) {
return UIWidget::onMessage( Msg );
}
void UIComboBox::updateControls() {
void UIComboBox::updateWidgets() {
if ( NULL != mDropDownList ) {
if ( ( mFlags & UI_AUTO_SIZE ) ||
getSize().getHeight() < mDropDownList->getSize().getHeight() ) {
@@ -111,19 +111,19 @@ void UIComboBox::updateControls() {
}
void UIComboBox::onSizeChange() {
updateControls();
updateWidgets();
UIWidget::onSizeChange();
}
void UIComboBox::onPositionChange() {
updateControls();
updateWidgets();
UIWidget::onPositionChange();
}
void UIComboBox::onPaddingChange() {
updateControls();
updateWidgets();
UIWidget::onPaddingChange();
}
+13 -13
View File
@@ -18,7 +18,7 @@ UIDropDownList* UIDropDownList::New() {
}
UIDropDownList::UIDropDownList( const std::string& tag ) :
UITextInput( tag ), mListBox( NULL ), mFriendCtrl( NULL ) {
UITextInput( tag ), mListBox( NULL ), mFriendNode( NULL ) {
clipEnable();
setFlags( UI_AUTO_SIZE | UI_AUTO_PADDING );
unsetFlags( UI_TEXT_SELECTION_ENABLED );
@@ -44,8 +44,8 @@ UIDropDownList::UIDropDownList( const std::string& tag ) :
mListBox->addEventListener( Event::OnItemKeyDown,
cb::Make1( this, &UIDropDownList::onItemKeyDown ) );
mListBox->addEventListener( Event::KeyDown, cb::Make1( this, &UIDropDownList::onItemKeyDown ) );
mListBox->addEventListener( Event::OnControlClear,
cb::Make1( this, &UIDropDownList::onControlClear ) );
mListBox->addEventListener( Event::OnClear,
cb::Make1( this, &UIDropDownList::onWidgetClear ) );
}
UIDropDownList::~UIDropDownList() {
@@ -80,8 +80,8 @@ void UIDropDownList::onThemeLoaded() {
onAutoSize();
}
void UIDropDownList::setFriendControl( UINode* friendCtrl ) {
mFriendCtrl = friendCtrl;
void UIDropDownList::setFriendNode( UINode* friendNode ) {
mFriendNode = friendNode;
}
void UIDropDownList::onAutoSize() {
@@ -118,10 +118,10 @@ Uint32 UIDropDownList::onMouseUp( const Vector2i& Pos, const Uint32& Flags ) {
}
Uint32 UIDropDownList::onMouseClick( const Vector2i& Pos, const Uint32& Flags ) {
if ( ( Flags & EE_BUTTON_LMASK ) && NULL == mFriendCtrl )
if ( ( Flags & EE_BUTTON_LMASK ) && NULL == mFriendNode )
showList();
if ( NULL != mFriendCtrl ) {
if ( NULL != mFriendNode ) {
UITextInput::onMouseClick( Pos, Flags );
}
@@ -163,11 +163,11 @@ void UIDropDownList::showList() {
if ( mStyleConfig.MaxNumVisibleItems < mListBox->getCount() ) {
mListBox->setSize(
NULL != mFriendCtrl ? mFriendCtrl->getSize().getWidth() : getSize().getWidth(),
NULL != mFriendNode ? mFriendNode->getSize().getWidth() : getSize().getWidth(),
( Int32 )( mStyleConfig.MaxNumVisibleItems * mListBox->getRowHeight() ) +
tPadding.Top + tPadding.Bottom );
} else {
mListBox->setSize( NULL != mFriendCtrl ? mFriendCtrl->getSize().getWidth()
mListBox->setSize( NULL != mFriendNode ? mFriendNode->getSize().getWidth()
: getSize().getWidth(),
( Int32 )( mListBox->getCount() * mListBox->getRowHeight() ) +
tPadding.Top + tPadding.Bottom );
@@ -217,7 +217,7 @@ void UIDropDownList::setStyleConfig( const StyleConfig& styleConfig ) {
setPopUpToRoot( mStyleConfig.PopUpToRoot );
}
void UIDropDownList::onControlClear( const Event* ) {
void UIDropDownList::onWidgetClear( const Event* ) {
setText( "" );
}
@@ -232,7 +232,7 @@ void UIDropDownList::onListBoxFocusLoss( const Event* ) {
if ( NULL == getEventDispatcher() )
return;
bool frienIsFocus = NULL != mFriendCtrl && mFriendCtrl == getEventDispatcher()->getFocusNode();
bool frienIsFocus = NULL != mFriendNode && mFriendNode == getEventDispatcher()->getFocusNode();
bool isChildFocus = isChild( getEventDispatcher()->getFocusNode() );
if ( getEventDispatcher()->getFocusNode() != this && !isChildFocus && !frienIsFocus ) {
@@ -265,7 +265,7 @@ void UIDropDownList::show() {
getUISceneNode()->getUIThemeManager()->getDefaultEffectsEnabled() ) {
mListBox->runAction( Actions::Sequence::New(
Actions::Fade::New( 255.f == mListBox->getAlpha() ? 0.f : mListBox->getAlpha(), 255.f,
getUISceneNode()->getUIThemeManager()->getControlsFadeOutTime() ),
getUISceneNode()->getUIThemeManager()->getWidgetsFadeOutTime() ),
Actions::Spawn::New( Actions::Enable::New(), Actions::Visible::New( true ) ) ) );
}
}
@@ -278,7 +278,7 @@ void UIDropDownList::hide() {
getUISceneNode()->getUIThemeManager()->getDefaultEffectsEnabled() ) {
mListBox->runAction( Actions::Sequence::New(
Actions::FadeOut::New(
getUISceneNode()->getUIThemeManager()->getControlsFadeOutTime() ),
getUISceneNode()->getUIThemeManager()->getWidgetsFadeOutTime() ),
Actions::Spawn::New( Actions::Disable::New(), Actions::Visible::New( false ) ) ) );
} else {
mListBox->setEnabled( false );
+3 -3
View File
@@ -242,7 +242,7 @@ void UIListBox::clear() {
updateScroll();
updateListBoxItemsSize();
sendCommonEvent( Event::OnControlClear );
sendCommonEvent( Event::OnClear );
}
Uint32 UIListBox::removeListBoxItem( Uint32 ItemIndex ) {
@@ -964,9 +964,9 @@ Uint32 UIListBox::onMessage( const NodeMessage* Msg ) {
switch ( Msg->getMsg() ) {
case NodeMessage::FocusLoss: {
if ( NULL != getEventDispatcher() ) {
Node* FocusCtrl = getEventDispatcher()->getFocusNode();
Node* focusNode = getEventDispatcher()->getFocusNode();
if ( this != FocusCtrl && !isParentOf( FocusCtrl ) ) {
if ( this != focusNode && !isParentOf( focusNode ) ) {
onWidgetFocusLoss();
}
+2 -2
View File
@@ -24,10 +24,10 @@ UIListBoxItem::~UIListBoxItem() {
if ( NULL != eventDispatcher ) {
if ( eventDispatcher->getFocusNode() == this )
mParentCtrl->setFocus();
mParentNode->setFocus();
if ( eventDispatcher->getMouseOverNode() == this )
eventDispatcher->setMouseOverNode( mParentCtrl );
eventDispatcher->setMouseOverNode( mParentNode );
}
}
+18 -19
View File
@@ -115,15 +115,14 @@ UIMenuRadioButton* UIMenu::addRadioButton( const String& text, const bool& activ
}
UIMenuSubMenu* UIMenu::createSubMenu( const String& text, Drawable* icon, UIMenu* subMenu ) {
UIMenuSubMenu* tCtrl = UIMenuSubMenu::New();
tCtrl->setHorizontalAlign( UI_HALIGN_LEFT );
tCtrl->setParent( this );
tCtrl->setIconMinimumSize( mIconMinSize );
tCtrl->setIcon( icon );
tCtrl->setText( text );
tCtrl->setSubMenu( subMenu );
return tCtrl;
UIMenuSubMenu* menu = UIMenuSubMenu::New();
menu->setHorizontalAlign( UI_HALIGN_LEFT );
menu->setParent( this );
menu->setIconMinimumSize( mIconMinSize );
menu->setIcon( icon );
menu->setText( text );
menu->setSubMenu( subMenu );
return menu;
}
UIMenuSubMenu* UIMenu::addSubMenu( const String& text, Drawable* icon, UIMenu* subMenu ) {
@@ -292,12 +291,12 @@ void UIMenu::insert( UIWidget* widget, const Uint32& index ) {
widgetsResize();
}
bool UIMenu::isSubMenu( Node* Ctrl ) {
bool UIMenu::isSubMenu( Node* node ) {
for ( Uint32 i = 0; i < mItems.size(); i++ ) {
if ( NULL != mItems[i] && mItems[i]->isType( UI_TYPE_MENUSUBMENU ) ) {
UIMenuSubMenu* tMenu = mItems[i]->asType<UIMenuSubMenu>();
if ( tMenu->getSubMenu() == Ctrl )
if ( tMenu->getSubMenu() == node )
return true;
}
}
@@ -317,10 +316,10 @@ Uint32 UIMenu::onMessage( const NodeMessage* Msg ) {
}
case NodeMessage::FocusLoss: {
if ( NULL != getEventDispatcher() ) {
Node* focusCtrl = getEventDispatcher()->getFocusNode();
Node* focusNode = getEventDispatcher()->getFocusNode();
if ( this != focusCtrl && !isParentOf( focusCtrl ) && !isSubMenu( focusCtrl ) &&
mOwnerNode != focusCtrl ) {
if ( this != focusNode && !isParentOf( focusNode ) && !isSubMenu( focusNode ) &&
mOwnerNode != focusNode ) {
mClickHide = true;
onWidgetFocusLoss();
@@ -434,15 +433,15 @@ void UIMenu::setItemSelected( UIWidget* Item ) {
}
}
void UIMenu::trySelect( UIWidget* Ctrl, bool Up ) {
void UIMenu::trySelect( UIWidget* node, bool up ) {
if ( mItems.size() ) {
if ( !Ctrl->isType( UI_TYPE_MENU_SEPARATOR ) ) {
setItemSelected( Ctrl );
if ( !node->isType( UI_TYPE_MENU_SEPARATOR ) ) {
setItemSelected( node );
} else {
Uint32 Index = getItemIndex( Ctrl );
Uint32 Index = getItemIndex( node );
if ( Index != eeINDEX_NOT_FOUND ) {
if ( Up ) {
if ( up ) {
if ( Index > 0 ) {
for ( Int32 i = (Int32)Index - 1; i >= 0; i-- ) {
if ( !mItems[i]->isType( UI_TYPE_MENU_SEPARATOR ) ) {
+4 -4
View File
@@ -140,12 +140,12 @@ UINode* UIMenuSubMenu::getArrow() const {
}
void UIMenuSubMenu::onSubMenuFocusLoss( const Event* ) {
Node* focusCtrl = NULL;
Node* focusNode = NULL;
if ( NULL != getEventDispatcher() ) {
focusCtrl = getEventDispatcher()->getFocusNode();
focusNode = getEventDispatcher()->getFocusNode();
if ( getParent() != focusCtrl && !getParent()->isParentOf( focusCtrl ) ) {
if ( getParent() != focusNode && !getParent()->isParentOf( focusNode ) ) {
getParent()->setFocus();
}
}
@@ -153,7 +153,7 @@ void UIMenuSubMenu::onSubMenuFocusLoss( const Event* ) {
if ( mSubMenu->mClickHide ) {
UIMenu* parentMenu = getParent()->asType<UIMenu>();
if ( !parentMenu->isSubMenu( focusCtrl ) && focusCtrl != this ) {
if ( !parentMenu->isSubMenu( focusNode ) && focusNode != this ) {
parentMenu->sendCommonEvent( Event::OnHideByClick );
parentMenu->hide();
}
+19 -3
View File
@@ -58,7 +58,7 @@ UINode::~UINode() {
}
void UINode::worldToNodeTranslation( Vector2f& Pos ) const {
Node* ParentLoop = mParentCtrl;
Node* ParentLoop = mParentNode;
Pos -= mPosition;
@@ -74,7 +74,7 @@ void UINode::worldToNodeTranslation( Vector2f& Pos ) const {
}
void UINode::nodeToWorldTranslation( Vector2f& Pos ) const {
Node* ParentLoop = mParentCtrl;
Node* ParentLoop = mParentNode;
while ( NULL != ParentLoop ) {
const Vector2f& ParentPos = ParentLoop->isUINode()
@@ -800,7 +800,7 @@ void UINode::setThemeByName( const std::string& Theme ) {
}
void UINode::setTheme( UITheme* Theme ) {
setThemeSkin( Theme, "control" );
setThemeSkin( Theme, "widget" );
}
UINode* UINode::setThemeSkin( const std::string& skinName ) {
@@ -1081,6 +1081,12 @@ Uint32 UINode::onDragStop( const Vector2i& pos, const Uint32& flags ) {
return 1;
}
Uint32 UINode::onDrop( UINode* widget ) {
DropEvent event( this, widget, Event::OnNodeDropped );
sendEvent( &event );
return 1;
}
Uint32 UINode::onMouseOver( const Vector2i& position, const Uint32& flags ) {
Node::onMouseOver( position, flags );
@@ -1126,6 +1132,16 @@ void UINode::setDragging( const bool& dragging ) {
messagePost( &tMsg );
onDragStop( getEventDispatcher()->getMousePos(), getEventDispatcher()->getPressTrigger() );
bool enabled = isEnabled();
mEnabled = false;
Node* found = getUISceneNode()->overFind( getEventDispatcher()->getMousePosf() );
if ( found && found->isUINode() ) {
found->asType<UINode>()->onDrop( this );
NodeDropMessage msg( found, NodeMessage::Drop, this );
found->messagePost( &msg );
}
mEnabled = enabled;
}
}
+2 -2
View File
@@ -49,7 +49,7 @@ bool UIPopUpMenu::show() {
runAction( Actions::Sequence::New(
Actions::Fade::New(
255.f == mAlpha ? 0.f : mAlpha, 255.f,
getUISceneNode()->getUIThemeManager()->getControlsFadeOutTime() ),
getUISceneNode()->getUIThemeManager()->getWidgetsFadeOutTime() ),
Actions::Spawn::New( Actions::Enable::New(), Actions::Visible::New( true ) ) ) );
}
@@ -73,7 +73,7 @@ bool UIPopUpMenu::hide() {
getUISceneNode()->getUIThemeManager()->getDefaultEffectsEnabled() ) {
runAction( Actions::Sequence::New(
Actions::FadeOut::New(
getUISceneNode()->getUIThemeManager()->getControlsFadeOutTime() ),
getUISceneNode()->getUIThemeManager()->getWidgetsFadeOutTime() ),
Actions::Spawn::New( Actions::Disable::New(), Actions::Visible::New( false ) ) ) );
} else {
setEnabled( false );
+7 -7
View File
@@ -154,8 +154,8 @@ void UIRadioButton::setActive( const bool& active ) {
onValueChange();
}
if ( active && NULL != mParentCtrl ) {
Node* tChild = mParentCtrl->getFirstChild();
if ( active && NULL != mParentNode ) {
Node* tChild = mParentNode->getFirstChild();
while ( NULL != tChild ) {
if ( tChild->isType( UI_TYPE_RADIOBUTTON ) ) {
@@ -173,8 +173,8 @@ void UIRadioButton::setActive( const bool& active ) {
}
bool UIRadioButton::checkActives() {
if ( NULL != mParentCtrl ) {
Node* tChild = mParentCtrl->getFirstChild();
if ( NULL != mParentNode ) {
Node* tChild = mParentNode->getFirstChild();
while ( NULL != tChild ) {
if ( tChild->isType( UI_TYPE_RADIOBUTTON ) ) {
@@ -194,10 +194,10 @@ bool UIRadioButton::checkActives() {
}
void UIRadioButton::autoActivate() {
eeASSERT( NULL != mParentCtrl );
eeASSERT( NULL != mParentNode );
if ( NULL != mParentCtrl ) {
Node* tChild = mParentCtrl->getFirstChild();
if ( NULL != mParentNode ) {
Node* tChild = mParentNode->getFirstChild();
while ( NULL != tChild ) {
if ( tChild->isType( UI_TYPE_RADIOBUTTON ) ) {
+8 -8
View File
@@ -52,7 +52,7 @@ UISceneNode::UISceneNode( EE::Window::Window* window ) :
mRoot->setParent( this )->setPosition( 0, 0 )->setId( "uiscenenode_root_node" );
mRoot->enableReportSizeChangeToChilds();
resizeControl( mWindow );
resizeNode( mWindow );
}
UISceneNode::~UISceneNode() {
@@ -63,7 +63,7 @@ UISceneNode::~UISceneNode() {
}
}
void UISceneNode::resizeControl( EE::Window::Window* ) {
void UISceneNode::resizeNode( EE::Window::Window* ) {
setPixelsSize( mWindow->getSize().asFloat() );
onMediaChanged();
sendMsg( this, NodeMessage::WindowResize );
@@ -519,8 +519,8 @@ void UISceneNode::invalidateStyle( UIWidget* node ) {
if ( mDirtyStyle.count( node ) > 0 )
return;
for ( auto& dirtyCtrl : mDirtyStyle ) {
if ( NULL != dirtyCtrl && dirtyCtrl->isParentOf( node ) ) {
for ( auto& dirtyNode : mDirtyStyle ) {
if ( NULL != dirtyNode && dirtyNode->isParentOf( node ) ) {
return;
}
}
@@ -555,8 +555,8 @@ void UISceneNode::invalidateStyleState( UIWidget* node, bool disableCSSAnimation
if ( mDirtyStyleState.count( node ) > 0 )
return;
for ( auto& dirtyCtrl : mDirtyStyleState ) {
if ( NULL != dirtyCtrl && dirtyCtrl->isParentOf( node ) ) {
for ( auto& dirtyNode : mDirtyStyleState ) {
if ( NULL != dirtyNode && dirtyNode->isParentOf( node ) ) {
return;
}
}
@@ -593,8 +593,8 @@ void UISceneNode::invalidateLayout( UILayout* node ) {
return;
if ( node->getParent()->isLayout() ) {
for ( auto& dirtyCtrl : mDirtyLayouts ) {
if ( NULL != dirtyCtrl && dirtyCtrl->isParentOf( node ) &&
for ( auto& dirtyNode : mDirtyLayouts ) {
if ( NULL != dirtyNode && dirtyNode->isParentOf( node ) &&
node->getParent()->isLayout() ) {
return;
}
+4 -4
View File
@@ -428,18 +428,18 @@ Uint32 UISlider::onKeyDown( const KeyEvent& Event ) {
void UISlider::manageClick( const Uint32& Flags ) {
if ( Flags && NULL != getEventDispatcher() ) {
Vector2f controlPos = getEventDispatcher()->getMousePosf();
mSlider->worldToNode( controlPos );
Vector2f nodePos = getEventDispatcher()->getMousePosf();
mSlider->worldToNode( nodePos );
if ( Flags & EE_BUTTON_LMASK && !mSlider->isMouseOver() && !mSlider->isDragging() &&
getUISceneNode()->getEventDispatcher()->getNodeWasDragging() != mSlider ) {
if ( UIOrientation::Horizontal == mOrientation ) {
if ( controlPos.x < 0 )
if ( nodePos.x < 0 )
setValue( mValue - mClickStep );
else
setValue( mValue + mClickStep );
} else {
if ( controlPos.y < 0 )
if ( nodePos.y < 0 )
setValue( mValue - mClickStep );
else
setValue( mValue + mClickStep );
+6 -6
View File
@@ -233,7 +233,7 @@ bool UITab::applyProperty( const StyleSheetProperty& attribute ) {
break;
case PropertyId::Owns:
mOwnedName = attribute.asString();
setOwnedControl();
setOwnedNode();
break;
default:
return UISelectButton::applyProperty( attribute );
@@ -248,7 +248,7 @@ Uint32 UITab::onMessage( const NodeMessage* message ) {
return 1;
if ( NULL == mOwnedWidget && !mOwnedName.empty() ) {
setOwnedControl();
setOwnedNode();
}
Uint32 flags = message->getFlags();
@@ -286,11 +286,11 @@ Uint32 UITab::onMessage( const NodeMessage* message ) {
return 0;
}
void UITab::setOwnedControl() {
Node* ctrl = getParent()->getParent()->find( mOwnedName );
void UITab::setOwnedNode() {
Node* node = getParent()->getParent()->find( mOwnedName );
if ( NULL != ctrl ) {
setOwnedWidget( ctrl );
if ( NULL != node ) {
setOwnedWidget( node );
}
}
+2 -2
View File
@@ -592,9 +592,9 @@ Uint32 UITable::onMessage( const NodeMessage* Msg ) {
switch ( Msg->getMsg() ) {
case NodeMessage::FocusLoss: {
if ( NULL != getEventDispatcher() ) {
Node* FocusCtrl = getEventDispatcher()->getFocusNode();
Node* focusNode = getEventDispatcher()->getFocusNode();
if ( this != FocusCtrl && !isParentOf( FocusCtrl ) ) {
if ( this != focusNode && !isParentOf( focusNode ) ) {
onWidgetFocusLoss();
}
+13 -13
View File
@@ -14,10 +14,10 @@ UITableCell::UITableCell() : UIWidget( "tablecell" ) {
UITableCell::~UITableCell() {
if ( NULL != getEventDispatcher() ) {
if ( getEventDispatcher()->getFocusNode() == this )
mParentCtrl->setFocus();
mParentNode->setFocus();
if ( getEventDispatcher()->getMouseOverNode() == this )
getEventDispatcher()->setMouseOverNode( mParentCtrl );
getEventDispatcher()->setMouseOverNode( mParentNode );
}
}
@@ -30,27 +30,27 @@ void UITableCell::setTheme( UITheme* Theme ) {
}
UITable* UITableCell::gridParent() const {
return mParentCtrl->getParent()->asType<UITable>();
return mParentNode->getParent()->asType<UITable>();
}
void UITableCell::setCell( const Uint32& CollumnIndex, UINode* Ctrl ) {
void UITableCell::setCell( const Uint32& CollumnIndex, UINode* node ) {
eeASSERT( CollumnIndex < gridParent()->getCollumnsCount() );
UITable* P = gridParent();
mCells[CollumnIndex] = Ctrl;
mCells[CollumnIndex] = node;
if ( Ctrl->getParent() != this )
Ctrl->setParent( this );
if ( node->getParent() != this )
node->setParent( this );
if ( Ctrl->isWidget() )
static_cast<UIWidget*>( Ctrl )->setLayoutSizePolicy( SizePolicy::Fixed, SizePolicy::Fixed );
if ( node->isWidget() )
static_cast<UIWidget*>( node )->setLayoutSizePolicy( SizePolicy::Fixed, SizePolicy::Fixed );
Ctrl->setPosition( P->getCellPosition( CollumnIndex ), 0 );
Ctrl->setSize( P->getCollumnWidth( CollumnIndex ), P->getRowHeight() );
node->setPosition( P->getCellPosition( CollumnIndex ), 0 );
node->setSize( P->getCollumnWidth( CollumnIndex ), P->getRowHeight() );
Ctrl->setVisible( true );
Ctrl->setEnabled( true );
node->setVisible( true );
node->setEnabled( true );
}
UINode* UITableCell::getCell( const Uint32& CollumnIndex ) const {
+63 -63
View File
@@ -15,7 +15,7 @@ UITabWidget* UITabWidget::New() {
UITabWidget::UITabWidget() :
UIWidget( "tabwidget" ),
mCtrlContainer( NULL ),
mNodeContainer( NULL ),
mTabBar( NULL ),
mTabSelected( NULL ),
mTabSelectedIndex( eeINDEX_NOT_FOUND ),
@@ -29,13 +29,13 @@ UITabWidget::UITabWidget() :
->setPosition( 0, 0 );
mTabBar->clipEnable();
mCtrlContainer = UIWidget::NewWithTag( "tabwidget::container" );
mCtrlContainer
mNodeContainer = UIWidget::NewWithTag( "tabwidget::container" );
mNodeContainer
->setPixelsSize( mSize.getWidth(),
mSize.getHeight() - PixelDensity::dpToPx( mStyleConfig.TabHeight ) )
->setParent( this )
->setPosition( 0, mStyleConfig.TabHeight );
mCtrlContainer->clipEnable();
mNodeContainer->clipEnable();
onSizeChange();
@@ -52,15 +52,15 @@ bool UITabWidget::isType( const Uint32& type ) const {
return UITabWidget::getType() == type ? true : UIWidget::isType( type );
}
void UITabWidget::setTheme( UITheme* Theme ) {
UIWidget::setTheme( Theme );
void UITabWidget::setTheme( UITheme* theme ) {
UIWidget::setTheme( theme );
mTabBar->setThemeSkin( Theme, "tabwidget" );
mTabBar->setThemeSkin( theme, "tabwidget" );
mCtrlContainer->setThemeSkin( Theme, "tabbar" );
mNodeContainer->setThemeSkin( theme, "tabbar" );
if ( 0 == mStyleConfig.TabHeight ) {
UISkin* tSkin = Theme->getSkin( "tab" );
UISkin* tSkin = theme->getSkin( "tab" );
if ( NULL != tSkin ) {
Sizef tSize1 = getSkinSize( tSkin );
@@ -86,11 +86,11 @@ void UITabWidget::setContainerSize() {
if ( getTabCount() < 2 && mHideTabBarOnSingleTab ) {
mTabBar->setVisible( false );
mTabBar->setEnabled( false );
mCtrlContainer->setPosition( mPadding.Left, mPadding.Top );
mNodeContainer->setPosition( mPadding.Left, mPadding.Top );
Sizef s( mSize.getWidth() - mRealPadding.Left - mRealPadding.Right,
mSize.getHeight() - mRealPadding.Top - mRealPadding.Bottom );
if ( s != mCtrlContainer->getPixelsSize() ) {
mCtrlContainer->setPixelsSize( s );
if ( s != mNodeContainer->getPixelsSize() ) {
mNodeContainer->setPixelsSize( s );
for ( auto& tab : mTabs ) {
refreshOwnedWidget( tab );
@@ -102,12 +102,12 @@ void UITabWidget::setContainerSize() {
mTabBar->setPixelsSize( mSize.getWidth() - mRealPadding.Left - mRealPadding.Right,
PixelDensity::dpToPx( mStyleConfig.TabHeight ) );
mTabBar->setPosition( mPadding.Left, mPadding.Top );
mCtrlContainer->setPosition( mPadding.Left, mPadding.Top + mStyleConfig.TabHeight );
mNodeContainer->setPosition( mPadding.Left, mPadding.Top + mStyleConfig.TabHeight );
Sizef s( mSize.getWidth() - mRealPadding.Left - mRealPadding.Right,
mSize.getHeight() - PixelDensity::dpToPx( mStyleConfig.TabHeight ) -
mRealPadding.Top - mRealPadding.Bottom );
if ( s != mCtrlContainer->getPixelsSize() ) {
mCtrlContainer->setPixelsSize( s );
if ( s != mNodeContainer->getPixelsSize() ) {
mNodeContainer->setPixelsSize( s );
for ( auto& tab : mTabs ) {
refreshOwnedWidget( tab );
@@ -163,20 +163,20 @@ bool UITabWidget::isDrawInvalidator() const {
void UITabWidget::invalidate( Node* invalidator ) {
// Only invalidate if the invalidator is actually visible in the current active tab.
if ( NULL != invalidator ) {
if ( invalidator == mCtrlContainer || invalidator == mTabBar ||
if ( invalidator == mNodeContainer || invalidator == mTabBar ||
mTabBar->inParentTreeOf( invalidator ) ) {
mNodeDrawInvalidator->invalidate( mCtrlContainer );
} else if ( invalidator->getParent() == mCtrlContainer ) {
mNodeDrawInvalidator->invalidate( mNodeContainer );
} else if ( invalidator->getParent() == mNodeContainer ) {
if ( invalidator->isVisible() ) {
mNodeDrawInvalidator->invalidate( mCtrlContainer );
mNodeDrawInvalidator->invalidate( mNodeContainer );
}
} else {
Node* container = invalidator->getParent();
while ( container->getParent() != NULL && container->getParent() != mCtrlContainer ) {
while ( container->getParent() != NULL && container->getParent() != mNodeContainer ) {
container = container->getParent();
}
if ( container->getParent() == mCtrlContainer && container->isVisible() ) {
mNodeDrawInvalidator->invalidate( mCtrlContainer );
if ( container->getParent() == mNodeContainer && container->isVisible() ) {
mNodeDrawInvalidator->invalidate( mNodeContainer );
}
}
} else if ( NULL != mNodeDrawInvalidator ) {
@@ -394,7 +394,7 @@ UITab* UITabWidget::createTab( const String& text, UINode* nodeOwned, Drawable*
tab->setVisible( true );
tab->setEnabled( true );
tab->setOwnedWidget( nodeOwned );
nodeOwned->setParent( mCtrlContainer );
nodeOwned->setParent( mNodeContainer );
nodeOwned->setVisible( false );
nodeOwned->setEnabled( true );
@@ -413,13 +413,13 @@ UITab* UITabWidget::add( const String& text, UINode* nodeOwned, Drawable* icon )
return tab;
}
UITabWidget* UITabWidget::add( UITab* Tab ) {
Tab->setParent( mTabBar );
UITabWidget* UITabWidget::add( UITab* tab ) {
tab->setParent( mTabBar );
mTabs.push_back( Tab );
mTabs.push_back( tab );
if ( NULL == mTabSelected ) {
setTabSelected( Tab );
setTabSelected( tab );
} else {
orderTabs();
}
@@ -427,17 +427,17 @@ UITabWidget* UITabWidget::add( UITab* Tab ) {
return this;
}
UITab* UITabWidget::getTab( const Uint32& Index ) {
eeASSERT( Index < mTabs.size() );
return mTabs[Index];
UITab* UITabWidget::getTab( const Uint32& index ) {
eeASSERT( index < mTabs.size() );
return mTabs[index];
}
UITab* UITabWidget::getTab( const String& Text ) {
UITab* UITabWidget::getTab( const String& text ) {
for ( Uint32 i = 0; i < mTabs.size(); i++ ) {
if ( mTabs[i]->isType( UI_TYPE_TAB ) ) {
UITab* tTab = mTabs[i]->asType<UITab>();
if ( tTab->getText() == Text )
if ( tTab->getText() == text )
return tTab;
}
}
@@ -445,9 +445,9 @@ UITab* UITabWidget::getTab( const String& Text ) {
return NULL;
}
Uint32 UITabWidget::getTabIndex( UITab* Tab ) {
Uint32 UITabWidget::getTabIndex( UITab* tab ) {
for ( Uint32 i = 0; i < mTabs.size(); i++ ) {
if ( mTabs[i] == Tab )
if ( mTabs[i] == tab )
return i;
}
@@ -498,8 +498,8 @@ void UITabWidget::removeTab( const Uint32& index, bool destroyOwnedNode ) {
sendEvent( &tabEvent );
}
void UITabWidget::removeTab( UITab* Tab, bool destroyOwnedNode ) {
removeTab( getTabIndex( Tab ), destroyOwnedNode );
void UITabWidget::removeTab( UITab* tab, bool destroyOwnedNode ) {
removeTab( getTabIndex( tab ), destroyOwnedNode );
}
void UITabWidget::removeAllTabs( bool destroyOwnedNode ) {
@@ -533,33 +533,33 @@ void UITabWidget::removeAllTabs( bool destroyOwnedNode ) {
}
}
void UITabWidget::insertTab( const String& Text, UINode* CtrlOwned, Drawable* Icon,
const Uint32& Index ) {
insertTab( createTab( Text, CtrlOwned, Icon ), Index );
void UITabWidget::insertTab( const String& text, UINode* nodeOwned, Drawable* icon,
const Uint32& index ) {
insertTab( createTab( text, nodeOwned, icon ), index );
}
void UITabWidget::insertTab( UITab* Tab, const Uint32& Index ) {
mTabs.insert( mTabs.begin() + Index, Tab );
void UITabWidget::insertTab( UITab* Tab, const Uint32& index ) {
mTabs.insert( mTabs.begin() + index, Tab );
childAddAt( Tab, Index );
childAddAt( Tab, index );
orderTabs();
}
UITab* UITabWidget::setTabSelected( UITab* Tab ) {
if ( NULL == Tab )
UITab* UITabWidget::setTabSelected( UITab* tab ) {
if ( NULL == tab )
return NULL;
if ( std::find( mTabs.begin(), mTabs.end(), Tab ) == mTabs.end() )
if ( std::find( mTabs.begin(), mTabs.end(), tab ) == mTabs.end() )
return NULL;
invalidateDraw();
if ( Tab == mTabSelected ) {
refreshOwnedWidget( Tab );
if ( Tab->getOwnedWidget() )
Tab->getOwnedWidget()->setFocus();
return Tab;
if ( tab == mTabSelected ) {
refreshOwnedWidget( tab );
if ( tab->getOwnedWidget() )
tab->getOwnedWidget()->setFocus();
return tab;
}
if ( NULL != mTabSelected ) {
@@ -571,14 +571,14 @@ UITab* UITabWidget::setTabSelected( UITab* Tab ) {
}
}
Tab->select();
if ( Tab->getOwnedWidget() )
Tab->getOwnedWidget()->setFocus();
tab->select();
if ( tab->getOwnedWidget() )
tab->getOwnedWidget()->setFocus();
Uint32 TabIndex = getTabIndex( Tab );
Uint32 TabIndex = getTabIndex( tab );
if ( eeINDEX_NOT_FOUND != TabIndex ) {
mTabSelected = Tab;
mTabSelected = tab;
mTabSelectedIndex = TabIndex;
refreshOwnedWidget( mTabSelected );
@@ -588,7 +588,7 @@ UITab* UITabWidget::setTabSelected( UITab* Tab ) {
sendCommonEvent( Event::OnTabSelected );
}
return Tab;
return tab;
}
UITab* UITabWidget::setTabSelected( const Uint32& tabIndex ) {
@@ -630,10 +630,10 @@ void UITabWidget::setAllowRearrangeTabs( bool allowRearrangeTabs ) {
void UITabWidget::refreshOwnedWidget( UITab* tab ) {
if ( NULL != tab && NULL != tab->getOwnedWidget() ) {
tab->getOwnedWidget()->setParent( mCtrlContainer );
tab->getOwnedWidget()->setParent( mNodeContainer );
tab->getOwnedWidget()->setVisible( tab == mTabSelected );
tab->getOwnedWidget()->setEnabled( tab == mTabSelected );
tab->getOwnedWidget()->setSize( mCtrlContainer->getSize() );
tab->getOwnedWidget()->setSize( mNodeContainer->getSize() );
if ( tab->getOwnedWidget()->isWidget() ) {
UIWidget* widget = static_cast<UIWidget*>( tab->getOwnedWidget() );
@@ -686,14 +686,14 @@ void UITabWidget::onSizeChange() {
posTabs();
if ( NULL != mTabSelected && NULL != mTabSelected->getOwnedWidget() ) {
mTabSelected->getOwnedWidget()->setSize( mCtrlContainer->getSize() );
mTabSelected->getOwnedWidget()->setSize( mNodeContainer->getSize() );
}
UIWidget::onSizeChange();
}
void UITabWidget::onChildCountChange( Node* child, const bool& removed ) {
if ( !removed && child != mTabBar && child != mCtrlContainer ) {
if ( !removed && child != mTabBar && child != mNodeContainer ) {
if ( child->isType( UI_TYPE_TAB ) ) {
UITab* Tab = static_cast<UITab*>( child );
@@ -707,7 +707,7 @@ void UITabWidget::onChildCountChange( Node* child, const bool& removed ) {
orderTabs();
}
} else {
child->setParent( mCtrlContainer );
child->setParent( mNodeContainer );
child->setVisible( false );
child->setEnabled( true );
}
@@ -734,8 +734,8 @@ UIWidget* UITabWidget::getTabBar() const {
return mTabBar;
}
UIWidget* UITabWidget::getControlContainer() const {
return mCtrlContainer;
UIWidget* UITabWidget::getContainerNode() const {
return mNodeContainer;
}
}} // namespace EE::UI
+12 -12
View File
@@ -380,14 +380,14 @@ Vector2f UITextView::getAlignOffset() const {
Uint32 UITextView::onMouseDoubleClick( const Vector2i& Pos, const Uint32& Flags ) {
if ( isTextSelectionEnabled() && ( Flags & EE_BUTTON_LMASK ) ) {
Vector2f controlPos( Vector2f( Pos.x, Pos.y ) );
worldToNode( controlPos );
controlPos = PixelDensity::dpToPx( controlPos ) - mRealAlignOffset -
Vector2f nodePos( Vector2f( Pos.x, Pos.y ) );
worldToNode( nodePos );
nodePos = PixelDensity::dpToPx( nodePos ) - mRealAlignOffset -
Vector2f( mRealPadding.Left, mRealPadding.Top );
controlPos.x = eemax( 0.f, controlPos.x );
controlPos.y = eemax( 0.f, controlPos.y );
nodePos.x = eemax( 0.f, nodePos.x );
nodePos.y = eemax( 0.f, nodePos.y );
Int32 curPos = mTextCache->findCharacterFromPos( controlPos.asInt() );
Int32 curPos = mTextCache->findCharacterFromPos( nodePos.asInt() );
if ( -1 != curPos ) {
Int32 tSelCurInit, tSelCurEnd;
@@ -416,14 +416,14 @@ Uint32 UITextView::onMouseClick( const Vector2i& Pos, const Uint32& Flags ) {
Uint32 UITextView::onMouseDown( const Vector2i& Pos, const Uint32& Flags ) {
if ( NULL != getEventDispatcher() && isTextSelectionEnabled() && ( Flags & EE_BUTTON_LMASK ) &&
getEventDispatcher()->getMouseDownNode() == this ) {
Vector2f controlPos( Vector2f( Pos.x, Pos.y ) );
worldToNode( controlPos );
controlPos = PixelDensity::dpToPx( controlPos ) - mRealAlignOffset -
Vector2f nodePos( Vector2f( Pos.x, Pos.y ) );
worldToNode( nodePos );
nodePos = PixelDensity::dpToPx( nodePos ) - mRealAlignOffset -
Vector2f( mRealPadding.Left, mRealPadding.Top );
controlPos.x = eemax( 0.f, controlPos.x );
controlPos.y = eemax( 0.f, controlPos.y );
nodePos.x = eemax( 0.f, nodePos.x );
nodePos.y = eemax( 0.f, nodePos.y );
Int32 curPos = mTextCache->findCharacterFromPos( controlPos.asInt() );
Int32 curPos = mTextCache->findCharacterFromPos( nodePos.asInt() );
if ( -1 != curPos ) {
if ( !mSelecting ) {
+2 -2
View File
@@ -302,8 +302,8 @@ Drawable* UITheme::getIconByName( const std::string& name ) {
return NULL;
}
UISkin* UITheme::getSkin( const std::string& controlName ) {
return getByName( mAbbr + "_" + controlName );
UISkin* UITheme::getSkin( const std::string& widgetName ) {
return getByName( mAbbr + "_" + widgetName );
}
const CSS::StyleSheet& UITheme::getStyleSheet() const {
+7 -7
View File
@@ -63,9 +63,9 @@ UITheme* UIThemeManager::getDefaultTheme() const {
return mThemeDefault;
}
UIThemeManager* UIThemeManager::applyDefaultTheme( UINode* Control ) {
if ( mAutoApplyDefaultTheme && NULL != mThemeDefault && NULL != Control )
Control->setTheme( mThemeDefault );
UIThemeManager* UIThemeManager::applyDefaultTheme( UINode* node ) {
if ( mAutoApplyDefaultTheme && NULL != mThemeDefault && NULL != node )
node->setTheme( mThemeDefault );
return this;
}
@@ -88,20 +88,20 @@ const bool& UIThemeManager::getDefaultEffectsEnabled() const {
return mEnableDefaultEffects;
}
const Time& UIThemeManager::getControlsFadeInTime() const {
const Time& UIThemeManager::getWidgetsFadeInTime() const {
return mFadeInTime;
}
UIThemeManager* UIThemeManager::setControlsFadeInTime( const Time& Time ) {
UIThemeManager* UIThemeManager::setWidgetsFadeInTime( const Time& Time ) {
mFadeInTime = Time;
return this;
}
const Time& UIThemeManager::getControlsFadeOutTime() const {
const Time& UIThemeManager::getWidgetsFadeOutTime() const {
return mFadeOutTime;
}
UIThemeManager* UIThemeManager::setControlsFadeOutTime( const Time& Time ) {
UIThemeManager* UIThemeManager::setWidgetsFadeOutTime( const Time& Time ) {
mFadeOutTime = Time;
return this;
}
+2 -2
View File
@@ -78,7 +78,7 @@ void UITooltip::show() {
runAction( Actions::Sequence::New(
Actions::Fade::New(
255.f == mAlpha ? 0.f : mAlpha, 255.f,
getUISceneNode()->getUIThemeManager()->getControlsFadeOutTime() ),
getUISceneNode()->getUIThemeManager()->getWidgetsFadeOutTime() ),
Actions::Visible::New( true ) ) );
}
}
@@ -91,7 +91,7 @@ void UITooltip::hide() {
if ( getUISceneNode()->getUIThemeManager()->getDefaultEffectsEnabled() ) {
runAction( Actions::Sequence::New(
Actions::FadeOut::New(
getUISceneNode()->getUIThemeManager()->getControlsFadeOutTime() ),
getUISceneNode()->getUIThemeManager()->getWidgetsFadeOutTime() ),
Actions::Visible::New( false ) ) );
} else {
setVisible( false );
+13 -13
View File
@@ -73,10 +73,10 @@ bool UIWidget::isType( const Uint32& type ) const {
}
void UIWidget::updateAnchorsDistances() {
if ( NULL != mParentCtrl ) {
if ( NULL != mParentNode ) {
mDistToBorder = Rect( mPosition.x, mPosition.y,
mParentCtrl->getPixelsSize().x - ( mPosition.x + mSize.x ),
mParentCtrl->getPixelsSize().y - ( mPosition.y + mSize.y ) );
mParentNode->getPixelsSize().x - ( mPosition.x + mSize.x ),
mParentNode->getPixelsSize().y - ( mPosition.y + mSize.y ) );
}
}
@@ -557,9 +557,9 @@ void UIWidget::notifyLayoutAttrChange() {
}
void UIWidget::notifyLayoutAttrChangeParent() {
if ( 0 == mAttributesTransactionCount && NULL != mParentCtrl ) {
if ( 0 == mAttributesTransactionCount && NULL != mParentNode ) {
NodeMessage msg( this, NodeMessage::LayoutAttributeChange );
mParentCtrl->messagePost( &msg );
mParentNode->messagePost( &msg );
}
}
@@ -574,8 +574,8 @@ void UIWidget::updateAnchors( const Vector2f& SizeChange ) {
}
if ( mFlags & UI_ANCHOR_RIGHT ) {
if ( NULL != mParentCtrl ) {
newSize.x = mParentCtrl->getSize().getWidth() - mDpPos.x -
if ( NULL != mParentNode ) {
newSize.x = mParentNode->getSize().getWidth() - mDpPos.x -
PixelDensity::pxToDpI( mDistToBorder.Right );
if ( newSize.x < mMinSize.getWidth() )
@@ -588,9 +588,9 @@ void UIWidget::updateAnchors( const Vector2f& SizeChange ) {
}
if ( mFlags & UI_ANCHOR_BOTTOM ) {
if ( NULL != mParentCtrl ) {
if ( NULL != mParentNode ) {
newSize.y =
mParentCtrl->getSize().y - mDpPos.y - PixelDensity::pxToDpI( mDistToBorder.Bottom );
mParentNode->getSize().y - mDpPos.y - PixelDensity::pxToDpI( mDistToBorder.Bottom );
if ( newSize.y < mMinSize.getHeight() )
newSize.y = mMinSize.getHeight();
@@ -810,7 +810,7 @@ const std::vector<std::string>& UIWidget::getStyleSheetClasses() const {
}
UIWidget* UIWidget::getStyleSheetParentElement() const {
return NULL != mParentCtrl && mParentCtrl->isWidget() ? mParentCtrl->asType<UIWidget>() : NULL;
return NULL != mParentNode && mParentNode->isWidget() ? mParentNode->asType<UIWidget>() : NULL;
}
UIWidget* UIWidget::getStyleSheetPreviousSiblingElement() const {
@@ -1635,9 +1635,9 @@ bool UIWidget::applyProperty( const StyleSheetProperty& attribute ) {
else if ( layoutId == PropertyId::LayoutToBottomOf )
rule = PositionPolicy::BottomOf;
std::string id = attribute.asString();
Node* control = getParent()->find( id );
if ( NULL != control && control->isWidget() ) {
UIWidget* widget = static_cast<UIWidget*>( control );
Node* node = getParent()->find( id );
if ( NULL != node && node->isWidget() ) {
UIWidget* widget = static_cast<UIWidget*>( node );
setLayoutPositionPolicy( rule, widget );
}
break;
+61 -61
View File
@@ -42,7 +42,7 @@ UIWindow::UIWindow( UIWindow::WindowBaseContainerType type, const StyleConfig& w
mButtonMinimize( NULL ),
mButtonMaximize( NULL ),
mTitle( NULL ),
mModalCtrl( NULL ),
mModalNode( NULL ),
mResizeType( RESIZE_NONE ),
mFrameBufferBound( false ) {
subscribeScheduledUpdate();
@@ -92,10 +92,10 @@ UIWindow::UIWindow( UIWindow::WindowBaseContainerType type, const StyleConfig& w
UIWindow::~UIWindow() {
if ( NULL != getUISceneNode() && !SceneManager::instance()->isShootingDown() ) {
if ( NULL != mModalCtrl ) {
mModalCtrl->setEnabled( false );
mModalCtrl->setVisible( false );
mModalCtrl->close();
if ( NULL != mModalNode ) {
mModalNode->setEnabled( false );
mModalNode->setVisible( false );
mModalNode->close();
}
getUISceneNode()->windowRemove( this );
@@ -294,8 +294,8 @@ void UIWindow::updateWinFlags() {
updateDrawInvalidator( true );
if ( isModal() && NULL == mModalCtrl ) {
createModalControl();
if ( isModal() && NULL == mModalNode ) {
createModalNode();
}
if ( needsUpdate ) {
@@ -438,21 +438,21 @@ void UIWindow::onWindowReady() {
}
}
void UIWindow::createModalControl() {
Node* Ctrl = mSceneNode;
void UIWindow::createModalNode() {
Node* node = mSceneNode;
if ( NULL == Ctrl )
if ( NULL == node )
return;
if ( NULL == mModalCtrl ) {
mModalCtrl = UIWidget::NewWithTag( "window::modaldialog" );
mModalCtrl->setParent( Ctrl )->setPosition( 0, 0 )->setSize( Ctrl->getSize() );
mModalCtrl->setAnchors( UI_ANCHOR_LEFT | UI_ANCHOR_TOP | UI_ANCHOR_RIGHT |
if ( NULL == mModalNode ) {
mModalNode = UIWidget::NewWithTag( "window::modaldialog" );
mModalNode->setParent( node )->setPosition( 0, 0 )->setSize( node->getSize() );
mModalNode->setAnchors( UI_ANCHOR_LEFT | UI_ANCHOR_TOP | UI_ANCHOR_RIGHT |
UI_ANCHOR_BOTTOM );
} else {
mModalCtrl->setPosition( 0, 0 );
mModalCtrl->setSize( Ctrl->getSize() );
mModalCtrl->updateAnchorsDistances();
mModalNode->setPosition( 0, 0 );
mModalNode->setSize( node->getSize() );
mModalNode->updateAnchorsDistances();
}
}
@@ -477,7 +477,7 @@ void UIWindow::closeWindow() {
UIThemeManager* themeManager = getUISceneNode()->getUIThemeManager();
if ( themeManager->getDefaultEffectsEnabled() ) {
runAction(
Actions::Sequence::New( Actions::FadeOut::New( themeManager->getControlsFadeOutTime() ),
Actions::Sequence::New( Actions::FadeOut::New( themeManager->getWidgetsFadeOutTime() ),
Actions::Close::New() ) );
} else {
close();
@@ -487,11 +487,11 @@ void UIWindow::closeWindow() {
void UIWindow::close() {
UIWidget::close();
if ( NULL != mModalCtrl ) {
mModalCtrl->setEnabled( false );
mModalCtrl->setVisible( false );
mModalCtrl->close();
mModalCtrl = NULL;
if ( NULL != mModalNode ) {
mModalNode->setEnabled( false );
mModalNode->setVisible( false );
mModalNode->close();
mModalNode = NULL;
}
}
@@ -771,8 +771,8 @@ Uint32 UIWindow::onMessage( const NodeMessage* Msg ) {
break;
}
case NodeMessage::WindowResize: {
if ( isModal() && NULL != mModalCtrl && NULL != mSceneNode ) {
mModalCtrl->setSize( mSceneNode->getSize() );
if ( isModal() && NULL != mModalNode && NULL != mSceneNode ) {
mModalNode->setSize( mSceneNode->getSize() );
}
break;
@@ -831,7 +831,7 @@ void UIWindow::doResize( const NodeMessage* Msg ) {
decideResizeType( Msg->getSender() );
}
void UIWindow::decideResizeType( Node* Control ) {
void UIWindow::decideResizeType( Node* node ) {
if ( NULL == getEventDispatcher() )
return;
@@ -839,7 +839,7 @@ void UIWindow::decideResizeType( Node* Control ) {
worldToNode( Pos );
if ( Control == this ) {
if ( node == this ) {
if ( Pos.x <= mBorderLeft->getSize().getWidth() ) {
tryResize( RESIZE_TOPLEFT );
} else if ( Pos.x >= ( getSize().getWidth() - mBorderRight->getSize().getWidth() ) ) {
@@ -853,7 +853,7 @@ void UIWindow::decideResizeType( Node* Control ) {
tryResize( RESIZE_TOP );
}
}
} else if ( Control == mBorderBottom ) {
} else if ( node == mBorderBottom ) {
if ( Pos.x < mStyleConfig.MinCornerDistance ) {
tryResize( RESIZE_LEFTBOTTOM );
} else if ( Pos.x > getSize().getWidth() - mStyleConfig.MinCornerDistance ) {
@@ -861,13 +861,13 @@ void UIWindow::decideResizeType( Node* Control ) {
} else {
tryResize( RESIZE_BOTTOM );
}
} else if ( Control == mBorderLeft ) {
} else if ( node == mBorderLeft ) {
if ( Pos.y >= getSize().getHeight() - mStyleConfig.MinCornerDistance ) {
tryResize( RESIZE_LEFTBOTTOM );
} else {
tryResize( RESIZE_LEFT );
}
} else if ( Control == mBorderRight ) {
} else if ( node == mBorderRight ) {
if ( Pos.y >= getSize().getHeight() - mStyleConfig.MinCornerDistance ) {
tryResize( RESIZE_RIGHTBOTTOM );
} else {
@@ -1043,11 +1043,11 @@ UINode* UIWindow::getButtonMinimize() const {
void UIWindow::setupModal() {
if ( isModal() ) {
createModalControl();
createModalNode();
mModalCtrl->setEnabled( true );
mModalCtrl->setVisible( true );
mModalCtrl->toFront();
mModalNode->setEnabled( true );
mModalNode->setVisible( true );
mModalNode->toFront();
toFront();
}
@@ -1064,7 +1064,7 @@ bool UIWindow::show() {
if ( themeManager->getDefaultEffectsEnabled() ) {
runAction( Actions::Fade::New( mStyleConfig.BaseAlpha == getAlpha() ? 0.f : mAlpha,
mStyleConfig.BaseAlpha,
themeManager->getControlsFadeOutTime() ) );
themeManager->getWidgetsFadeOutTime() ) );
}
setupModal();
@@ -1081,7 +1081,7 @@ bool UIWindow::hide() {
UIThemeManager* themeManager = getUISceneNode()->getUIThemeManager();
if ( themeManager->getDefaultEffectsEnabled() ) {
runAction( Actions::Sequence::New(
Actions::FadeOut::New( themeManager->getControlsFadeOutTime() ),
Actions::FadeOut::New( themeManager->getWidgetsFadeOutTime() ),
Actions::Spawn::New( Actions::Disable::New(), Actions::Visible::New( false ) ) ) );
} else {
setEnabled( false );
@@ -1091,9 +1091,9 @@ bool UIWindow::hide() {
if ( NULL != mSceneNode )
mSceneNode->setFocus();
if ( NULL != mModalCtrl ) {
mModalCtrl->setEnabled( false );
mModalCtrl->setVisible( false );
if ( NULL != mModalNode ) {
mModalNode->setEnabled( false );
mModalNode->setVisible( false );
}
return true;
@@ -1183,12 +1183,12 @@ UITextView* UIWindow::getTitleTextBox() const {
}
void UIWindow::maximize() {
Node* Ctrl = mSceneNode;
Node* node = mSceneNode;
if ( NULL == Ctrl )
if ( NULL == node )
return;
if ( Ctrl->getSize() == getSize() ) {
if ( node->getSize() == getSize() ) {
setPixelsPosition( mNonMaxPos );
internalSize( mNonMaxSize );
} else {
@@ -1196,7 +1196,7 @@ void UIWindow::maximize() {
mNonMaxSize = mSize;
setPosition( 0, 0 );
setSizeWithDecoration( Ctrl->getSize() );
setSizeWithDecoration( node->getSize() );
}
}
@@ -1443,8 +1443,8 @@ bool UIWindow::isModal() {
return 0 != ( mStyleConfig.WinFlags & UI_WIN_MODAL );
}
UIWidget* UIWindow::getModalControl() const {
return mModalCtrl;
UIWidget* UIWindow::getModalWidget() const {
return mModalNode;
}
void UIWindow::resizeCursor() {
@@ -1456,21 +1456,21 @@ void UIWindow::resizeCursor() {
EventDispatcher* eventDispatcher = sceneNode->getEventDispatcher();
Vector2i Pos = eventDispatcher->getMousePos();
Vector2i pos = eventDispatcher->getMousePos();
worldToNode( Pos );
worldToNode( pos );
const Node* Control = eventDispatcher->getMouseOverNode();
const Node* node = eventDispatcher->getMouseOverNode();
if ( Control == this ) {
if ( Pos.x <= mBorderLeft->getSize().getWidth() ) {
if ( node == this ) {
if ( pos.x <= mBorderLeft->getSize().getWidth() ) {
sceneNode->setCursor( Cursor::SizeNWSE ); // RESIZE_TOPLEFT
} else if ( Pos.x >= ( getSize().getWidth() - mBorderRight->getSize().getWidth() ) ) {
} else if ( pos.x >= ( getSize().getWidth() - mBorderRight->getSize().getWidth() ) ) {
sceneNode->setCursor( Cursor::SizeNESW ); // RESIZE_TOPRIGHT
} else if ( Pos.y <= mBorderBottom->getSize().getHeight() ) {
if ( Pos.x < mStyleConfig.MinCornerDistance ) {
} else if ( pos.y <= mBorderBottom->getSize().getHeight() ) {
if ( pos.x < mStyleConfig.MinCornerDistance ) {
sceneNode->setCursor( Cursor::SizeNWSE ); // RESIZE_TOPLEFT
} else if ( Pos.x > getSize().getWidth() - mStyleConfig.MinCornerDistance ) {
} else if ( pos.x > getSize().getWidth() - mStyleConfig.MinCornerDistance ) {
sceneNode->setCursor( Cursor::SizeNESW ); // RESIZE_TOPRIGHT
} else {
sceneNode->setCursor( Cursor::SizeNS ); // RESIZE_TOP
@@ -1478,22 +1478,22 @@ void UIWindow::resizeCursor() {
} else if ( !( eventDispatcher->getPressTrigger() & EE_BUTTON_LMASK ) ) {
sceneNode->setCursor( Cursor::Arrow );
}
} else if ( Control == mBorderBottom ) {
if ( Pos.x < mStyleConfig.MinCornerDistance ) {
} else if ( node == mBorderBottom ) {
if ( pos.x < mStyleConfig.MinCornerDistance ) {
sceneNode->setCursor( Cursor::SizeNESW ); // RESIZE_LEFTBOTTOM
} else if ( Pos.x > getSize().getWidth() - mStyleConfig.MinCornerDistance ) {
} else if ( pos.x > getSize().getWidth() - mStyleConfig.MinCornerDistance ) {
sceneNode->setCursor( Cursor::SizeNWSE ); // RESIZE_RIGHTBOTTOM
} else {
sceneNode->setCursor( Cursor::SizeNS ); // RESIZE_BOTTOM
}
} else if ( Control == mBorderLeft ) {
if ( Pos.y >= getSize().getHeight() - mStyleConfig.MinCornerDistance ) {
} else if ( node == mBorderLeft ) {
if ( pos.y >= getSize().getHeight() - mStyleConfig.MinCornerDistance ) {
sceneNode->setCursor( Cursor::SizeNESW ); // RESIZE_LEFTBOTTOM
} else {
sceneNode->setCursor( Cursor::SizeWE ); // RESIZE_LEFT
}
} else if ( Control == mBorderRight ) {
if ( Pos.y >= getSize().getHeight() - mStyleConfig.MinCornerDistance ) {
} else if ( node == mBorderRight ) {
if ( pos.y >= getSize().getHeight() - mStyleConfig.MinCornerDistance ) {
sceneNode->setCursor( Cursor::SizeNWSE ); // RESIZE_RIGHTBOTTOM
} else {
sceneNode->setCursor( Cursor::SizeWE ); // RESIZE_RIGHT
+21 -21
View File
@@ -303,18 +303,18 @@ void EETest::createShaders() {
void EETest::onWinMouseUp( const Event* Event ) {
const MouseEvent* MEvent = reinterpret_cast<const MouseEvent*>( Event );
Node* CtrlAnim;
Node* nodeAnim;
if ( Event->getNode()->isType( UI_TYPE_WINDOW ) ) {
CtrlAnim = reinterpret_cast<Node*>( Event->getNode() );
nodeAnim = reinterpret_cast<Node*>( Event->getNode() );
} else {
CtrlAnim = reinterpret_cast<Node*>( Event->getNode()->getParent() );
nodeAnim = reinterpret_cast<Node*>( Event->getNode()->getParent() );
}
if ( MEvent->getFlags() & EE_BUTTON_WUMASK ) {
CtrlAnim->setScale( CtrlAnim->getScale() + 0.1f );
nodeAnim->setScale( nodeAnim->getScale() + 0.1f );
} else if ( MEvent->getFlags() & EE_BUTTON_WDMASK ) {
CtrlAnim->setScale( CtrlAnim->getScale() - 0.1f );
nodeAnim->setScale( nodeAnim->getScale() - 0.1f );
}
}
@@ -366,7 +366,7 @@ void EETest::createBaseUI() {
C = static_cast<UINode*>( tWin->getContainer() );
tWin->setVisible( false )->setEnabled( false );
tWin->setTitle( "Controls Test" );
tWin->setTitle( "Widgets Test" );
tWin->addEventListener( Event::MouseUp, cb::Make1( this, &EETest::onWinMouseUp ) );
C->addEventListener( Event::MouseUp, cb::Make1( this, &EETest::onWinMouseUp ) );
@@ -667,16 +667,16 @@ void EETest::createNewUI() {
->setParent( container );
loader->setBackgroundColor( 0xCCCCCCCC );
UIRadioButton* ctrl = UIRadioButton::New();
ctrl->setId( "happy_radio" );
ctrl->setLayoutSizePolicy( SizePolicy::Fixed, SizePolicy::Fixed )
UIRadioButton* radioButton = UIRadioButton::New();
radioButton->setId( "happy_radio" );
radioButton->setLayoutSizePolicy( SizePolicy::Fixed, SizePolicy::Fixed )
->setPosition( 50, 100 )
->setSize( 200, 32 )
->setParent( container );
ctrl->setBackgroundColor( 0x33333333 );
ctrl->setBorderColor( 0x66666666 );
ctrl->setText( "Happy RadioButon :)" );
ctrl->setFontColor( Color::Black );
radioButton->setBackgroundColor( 0x33333333 );
radioButton->setBorderColor( 0x66666666 );
radioButton->setText( "Happy RadioButon :)" );
radioButton->setFontColor( Color::Black );
UICheckBox* cbox = UICheckBox::New();
cbox->setId( "happy_check" );
@@ -1049,18 +1049,18 @@ void EETest::createFileDialog() {
}
static void onWinDragStart( const Event* event ) {
UINode* ctrl = static_cast<UINode*>( event->getNode() );
UIWindow* window = ctrl->isType( UI_TYPE_WINDOW )
? static_cast<UIWindow*>( ctrl )
: static_cast<UIWindow*>( ctrl->getWindowContainer()->getParent() );
UINode* node = static_cast<UINode*>( event->getNode() );
UIWindow* window = node->isType( UI_TYPE_WINDOW )
? static_cast<UIWindow*>( node )
: static_cast<UIWindow*>( node->getWindowContainer()->getParent() );
window->runAction( Actions::Fade::New( window->getAlpha(), 100, Seconds( 0.2f ) ) );
}
static void onWinDragStop( const Event* event ) {
UINode* ctrl = static_cast<UINode*>( event->getNode() );
UIWindow* window = ctrl->isType( UI_TYPE_WINDOW )
? static_cast<UIWindow*>( ctrl )
: static_cast<UIWindow*>( ctrl->getWindowContainer()->getParent() );
UINode* node = static_cast<UINode*>( event->getNode() );
UIWindow* window = node->isType( UI_TYPE_WINDOW )
? static_cast<UIWindow*>( node )
: static_cast<UIWindow*>( node->getWindowContainer()->getParent() );
window->runAction( Actions::Fade::New( window->getAlpha(), 255, Seconds( 0.2f ) ) );
}