diff --git a/include/eepp/ui/cuicontrol.hpp b/include/eepp/ui/cuicontrol.hpp index 815aa401a..faf7d2b3a 100644 --- a/include/eepp/ui/cuicontrol.hpp +++ b/include/eepp/ui/cuicontrol.hpp @@ -239,6 +239,7 @@ class EE_API cUIControl { protected: typedef std::map< Uint32, std::map > UIEventsMap; friend class cUIManager; + friend class cUIWindow; eeVector2i mPos; eeVector2i mScreenPos; diff --git a/include/eepp/ui/cuitheme.hpp b/include/eepp/ui/cuitheme.hpp index 66aa8ae6a..1583280d5 100644 --- a/include/eepp/ui/cuitheme.hpp +++ b/include/eepp/ui/cuitheme.hpp @@ -109,7 +109,7 @@ class EE_API cUITheme : protected tResourceManager { virtual cUIRadioButton * CreateRadioButton( cUIControl * Parent = NULL, const eeSize& Size = eeSize(), const eeVector2i& Pos = eeVector2i(), const Uint32& Flags = UI_CONTROL_DEFAULT_FLAGS ); - virtual cUITextBox * CreateTextBox( const String& Text = "", cUIControl * Parent = NULL, const eeSize& Size = eeSize(), const eeVector2i& Pos = eeVector2i(), const Uint32& Flags = UI_CONTROL_DEFAULT_FLAGS ); + virtual cUITextBox * CreateTextBox( const String& Text = "", cUIControl * Parent = NULL, const eeSize& Size = eeSize(), const eeVector2i& Pos = eeVector2i(), const Uint32& Flags = UI_CONTROL_DEFAULT_FLAGS | UI_AUTO_SIZE ); virtual cUITextEdit * CreateTextEdit( cUIControl * Parent = NULL, const eeSize& Size = eeSize(), const eeVector2i& Pos = eeVector2i(), const Uint32& Flags = UI_CONTROL_DEFAULT_FLAGS | UI_AUTO_PADDING | UI_CLIP_ENABLE | UI_AUTO_SIZE, UI_SCROLLBAR_MODE HScrollBar = UI_SCROLLBAR_AUTO, UI_SCROLLBAR_MODE VScrollBar = UI_SCROLLBAR_AUTO, bool WordWrap = true ); diff --git a/include/eepp/ui/cuiwindow.hpp b/include/eepp/ui/cuiwindow.hpp index 6d840f7d7..4c198b8c0 100644 --- a/include/eepp/ui/cuiwindow.hpp +++ b/include/eepp/ui/cuiwindow.hpp @@ -74,6 +74,8 @@ class EE_API cUIWindow : public cUIComplexControl { virtual void CloseWindow(); + virtual void Close(); + void BaseAlpha( const Uint8& Alpha ); const Uint8& BaseAlpha() const; @@ -206,6 +208,10 @@ class EE_API cUIWindow : public cUIComplexControl { KeyboardShortcuts::iterator ExistsShortcut( const Uint32& KeyCode, const Uint32& Mod ); void CreateModalControl(); + + void EnableByModal(); + + void DisableByModal(); }; }} diff --git a/include/eepp/ui/uihelper.hpp b/include/eepp/ui/uihelper.hpp index 06aa1c8e0..88782f4d6 100644 --- a/include/eepp/ui/uihelper.hpp +++ b/include/eepp/ui/uihelper.hpp @@ -19,6 +19,7 @@ enum UI_CONTROL_FLAGS_VALUES { UI_CTRL_FLAG_COMPLEX = (1<<10), UI_CTRL_FLAG_SKIN_OWNER = (1<<11), UI_CTRL_FLAG_TOUCH_DRAGGING = (1<<12), + UI_CTRL_FLAG_DISABLED_BY_MODAL_WINDOW = (1<<13), UI_CTRL_FLAG_FREE_USE = (1<<31) }; diff --git a/src/eepp/ui/cuicontrol.cpp b/src/eepp/ui/cuicontrol.cpp index b018e3175..7ab4e5052 100644 --- a/src/eepp/ui/cuicontrol.cpp +++ b/src/eepp/ui/cuicontrol.cpp @@ -1168,7 +1168,7 @@ cUIControl * cUIControl::NextComplexControl() { cUIControl * ChildLoop = mChild; while( NULL != ChildLoop ) { - if ( ChildLoop->Visible() ) { + if ( ChildLoop->Visible() && ChildLoop->Enabled() ) { if ( ChildLoop->IsComplex() ) { return ChildLoop; } else { @@ -1184,7 +1184,7 @@ cUIControl * cUIControl::NextComplexControl() { } if ( NULL != mNext ) { - if ( mNext->Visible() && mNext->IsComplex() ) { + if ( mNext->Visible() && mNext->Enabled() && mNext->IsComplex() ) { return mNext; } else { return mNext->NextComplexControl(); @@ -1194,7 +1194,7 @@ cUIControl * cUIControl::NextComplexControl() { while ( NULL != ChildLoop ) { if ( NULL != ChildLoop->mNext ) { - if ( ChildLoop->mNext->Visible() && ChildLoop->mNext->IsComplex() ) { + if ( ChildLoop->mNext->Visible() && ChildLoop->mNext->Enabled() && ChildLoop->mNext->IsComplex() ) { return ChildLoop->mNext; } else { return ChildLoop->mNext->NextComplexControl(); diff --git a/src/eepp/ui/cuitheme.cpp b/src/eepp/ui/cuitheme.cpp index d678fd1f2..86ac67c6b 100644 --- a/src/eepp/ui/cuitheme.cpp +++ b/src/eepp/ui/cuitheme.cpp @@ -485,7 +485,7 @@ cUITextBox * cUITheme::CreateTextBox( const String& Text, cUIControl * Parent, c TextBoxParams.Flags = Flags; cUITextBox * Ctrl = eeNew( cUITextBox, ( TextBoxParams ) ); Ctrl->Visible( true ); - Ctrl->Enabled( true ); + Ctrl->Enabled( false ); Ctrl->Text( Text ); return Ctrl; } diff --git a/src/eepp/ui/cuiwindow.cpp b/src/eepp/ui/cuiwindow.cpp index 5ca3c3e95..8e00a7fc7 100644 --- a/src/eepp/ui/cuiwindow.cpp +++ b/src/eepp/ui/cuiwindow.cpp @@ -117,6 +117,46 @@ void cUIWindow::CreateModalControl() { if ( NULL == mModalCtrl ) { cUIControl * Ctrl = cUIManager::instance()->MainControl(); mModalCtrl = eeNew( cUIControlAnim, ( cUIControlAnim::CreateParams( Ctrl , eeVector2i(0,0), Ctrl->Size(), UI_ANCHOR_LEFT | UI_ANCHOR_TOP | UI_ANCHOR_RIGHT | UI_ANCHOR_BOTTOM ) ) ); + + DisableByModal(); + } +} + +void cUIWindow::EnableByModal() { + if ( IsModal() ) { + cUIControl * CtrlChild = cUIManager::instance()->MainControl()->ChildGetFirst(); + + while ( NULL != CtrlChild ) + { + if ( CtrlChild != mModalCtrl && + CtrlChild != this && + CtrlChild->ControlFlags() & UI_CTRL_FLAG_DISABLED_BY_MODAL_WINDOW ) + { + CtrlChild->Enabled( true ); + CtrlChild->WriteCtrlFlag( UI_CTRL_FLAG_DISABLED_BY_MODAL_WINDOW, 0 ); + } + + CtrlChild = CtrlChild->NextGet(); + } + } +} + +void cUIWindow::DisableByModal() { + if ( IsModal() ) { + cUIControl * CtrlChild = cUIManager::instance()->MainControl()->ChildGetFirst(); + + while ( NULL != CtrlChild ) + { + if ( CtrlChild != mModalCtrl && + CtrlChild != this && + CtrlChild->Enabled() ) + { + CtrlChild->Enabled( false ); + CtrlChild->WriteCtrlFlag( UI_CTRL_FLAG_DISABLED_BY_MODAL_WINDOW, 1 ); + } + + CtrlChild = CtrlChild->NextGet(); + } } } @@ -165,6 +205,12 @@ void cUIWindow::CloseWindow() { Close(); } +void cUIWindow::Close() { + cUIComplexControl::Close(); + + EnableByModal(); +} + void cUIWindow::ButtonMaximizeClick( const cUIEvent * Event ) { Maximize();