diff --git a/include/eepp/ui/uicheckbox.hpp b/include/eepp/ui/uicheckbox.hpp index 014f9383a..021b84e68 100644 --- a/include/eepp/ui/uicheckbox.hpp +++ b/include/eepp/ui/uicheckbox.hpp @@ -8,6 +8,8 @@ namespace EE { namespace UI { class EE_API UICheckBox : public UITextBox { public: + static UICheckBox * New(); + UICheckBox( const UITextBox::CreateParams& Params ); UICheckBox(); @@ -52,7 +54,7 @@ class EE_API UICheckBox : public UITextBox { void doAfterSetTheme(); - virtual void autoSize(); + virtual void onAutoSize(); }; }} diff --git a/include/eepp/ui/uicombobox.hpp b/include/eepp/ui/uicombobox.hpp index edd73add8..97643d970 100644 --- a/include/eepp/ui/uicombobox.hpp +++ b/include/eepp/ui/uicombobox.hpp @@ -43,6 +43,8 @@ class EE_API UIComboBox : public UIComplexControl { virtual void onSizeChange(); virtual void onPositionChange(); + + virtual void onAutoSize(); }; }} diff --git a/include/eepp/ui/uicomplexcontrol.hpp b/include/eepp/ui/uicomplexcontrol.hpp index d4fef8bce..afa7c4b54 100644 --- a/include/eepp/ui/uicomplexcontrol.hpp +++ b/include/eepp/ui/uicomplexcontrol.hpp @@ -82,6 +82,8 @@ class EE_API UIComplexControl : public UIControlAnim { virtual void onParentSizeChange( const Vector2i& SizeChange ); virtual void onPositionChange(); + + virtual void onAutoSize(); }; }} diff --git a/include/eepp/ui/uicontrol.hpp b/include/eepp/ui/uicontrol.hpp index 4650f4ee6..a534f6f93 100644 --- a/include/eepp/ui/uicontrol.hpp +++ b/include/eepp/ui/uicontrol.hpp @@ -180,7 +180,7 @@ class EE_API UIControl { virtual UIControl * unsetFlags( const Uint32& flags ); - UIControl * resetFlags( Uint32 newFlags = 0 ); + virtual UIControl * resetFlags( Uint32 newFlags = 0 ); void setBlendMode( const EE_BLEND_MODE& blend ); diff --git a/include/eepp/ui/uidropdownlist.hpp b/include/eepp/ui/uidropdownlist.hpp index ec9a812ec..17d2c461b 100644 --- a/include/eepp/ui/uidropdownlist.hpp +++ b/include/eepp/ui/uidropdownlist.hpp @@ -64,7 +64,7 @@ class EE_API UIDropDownList : public UITextInput { virtual void onSizeChange(); - virtual void autoSize(); + virtual void onAutoSize(); virtual void autoSizeControl(); diff --git a/include/eepp/ui/uigfx.hpp b/include/eepp/ui/uigfx.hpp index 0e331345d..e43cbbfc0 100644 --- a/include/eepp/ui/uigfx.hpp +++ b/include/eepp/ui/uigfx.hpp @@ -63,7 +63,7 @@ class EE_API UIGfx : public UIComplexControl { virtual void onAlignChange(); - void autoSize(); + void onAutoSize(); void autoAlign(); diff --git a/include/eepp/ui/uigridcell.hpp b/include/eepp/ui/uigridcell.hpp index 327a39ad8..9a4a2c5fd 100644 --- a/include/eepp/ui/uigridcell.hpp +++ b/include/eepp/ui/uigridcell.hpp @@ -33,8 +33,6 @@ class EE_API UIGridCell : public UIComplexControl { void select(); virtual Uint32 onMessage( const UIMessage * Msg ); - - void autoSize(); protected: friend class UIItemContainer; friend class UIGenericGrid; @@ -50,6 +48,8 @@ class EE_API UIGridCell : public UIComplexControl { virtual void onStateChange(); virtual void onParentChange(); + + virtual void onAutoSize(); }; }} diff --git a/include/eepp/ui/uimessagebox.hpp b/include/eepp/ui/uimessagebox.hpp index 3d2a95901..cd379fcbd 100644 --- a/include/eepp/ui/uimessagebox.hpp +++ b/include/eepp/ui/uimessagebox.hpp @@ -42,12 +42,12 @@ class EE_API UIMessageBox : public UIWindow { virtual bool show(); protected: UI_MSGBOX_TYPE mMsgBoxType; - UITextBox * mTextBox; + UITextBox * mTextBox; UIPushButton * mButtonOK; UIPushButton * mButtonCancel; Uint32 mCloseWithKey; - void autoSize(); + virtual void onAutoSize(); virtual Uint32 onKeyUp( const UIEventKey& Event ); }; diff --git a/include/eepp/ui/uipushbutton.hpp b/include/eepp/ui/uipushbutton.hpp index 3f8903764..d8161448a 100644 --- a/include/eepp/ui/uipushbutton.hpp +++ b/include/eepp/ui/uipushbutton.hpp @@ -20,7 +20,7 @@ class EE_API UIPushButton : public UIComplexControl { IconAutoMargin( true ), IconMinSize( 0, 0 ) { - fontStyleConfig = UIThemeManager::instance()->getDefaultFontStyleConfig(); + FontStyleConfig = UIThemeManager::instance()->getDefaultFontStyleConfig(); } inline ~CreateParams() {} @@ -32,7 +32,7 @@ class EE_API UIPushButton : public UIComplexControl { IconHorizontalMargin = 4; } - FontStyleConfig fontStyleConfig; + UI::FontStyleConfig FontStyleConfig; SubTexture * Icon; Int32 IconHorizontalMargin; bool IconAutoMargin; diff --git a/include/eepp/ui/uiradiobutton.hpp b/include/eepp/ui/uiradiobutton.hpp index da70c509c..40049247f 100644 --- a/include/eepp/ui/uiradiobutton.hpp +++ b/include/eepp/ui/uiradiobutton.hpp @@ -54,7 +54,7 @@ class EE_API UIRadioButton : public UITextBox { virtual Uint32 onMessage( const UIMessage * Msg ); - virtual void autoSize(); + virtual void onAutoSize(); }; }} diff --git a/include/eepp/ui/uiscrollbar.hpp b/include/eepp/ui/uiscrollbar.hpp index 964e24714..e21ac862b 100644 --- a/include/eepp/ui/uiscrollbar.hpp +++ b/include/eepp/ui/uiscrollbar.hpp @@ -77,7 +77,7 @@ class EE_API UIScrollBar : public UIComplexControl { virtual void onSizeChange(); - void autoSize(); + virtual void onAutoSize(); void adjustChilds(); diff --git a/include/eepp/ui/uitab.hpp b/include/eepp/ui/uitab.hpp index 3288dcdfa..f317d3ecb 100644 --- a/include/eepp/ui/uitab.hpp +++ b/include/eepp/ui/uitab.hpp @@ -37,7 +37,7 @@ class EE_API UITab : public UISelectButton { virtual void onStateChange(); - void autoSize(); + virtual void onAutoSize(); UITabWidget * getTabWidget(); diff --git a/include/eepp/ui/uitextbox.hpp b/include/eepp/ui/uitextbox.hpp index 1c5346ffe..14bdd0123 100644 --- a/include/eepp/ui/uitextbox.hpp +++ b/include/eepp/ui/uitextbox.hpp @@ -14,12 +14,12 @@ class EE_API UITextBox : public UIComplexControl { inline CreateParams() : UIComplexControl::CreateParams() { - fontStyleConfig = UIThemeManager::instance()->getDefaultFontStyleConfig(); + FontStyleConfig = UIThemeManager::instance()->getDefaultFontStyleConfig(); } inline ~CreateParams() {} - FontStyleConfig fontStyleConfig; + UI::FontStyleConfig FontStyleConfig; }; UITextBox( const UITextBox::CreateParams& Params ); @@ -96,7 +96,7 @@ class EE_API UITextBox : public UIComplexControl { virtual void autoShrink(); - virtual void autoSize(); + virtual void onAutoSize(); virtual void autoAlign(); diff --git a/include/eepp/ui/uitextinput.hpp b/include/eepp/ui/uitextinput.hpp index 91a21608a..14ce39b3b 100644 --- a/include/eepp/ui/uitextinput.hpp +++ b/include/eepp/ui/uitextinput.hpp @@ -77,7 +77,7 @@ class EE_API UITextInput : public UITextBox { virtual void alignFix(); - virtual void autoSize(); + virtual void onAutoSize(); void privOnPressEnter(); diff --git a/include/eepp/ui/uitheme.hpp b/include/eepp/ui/uitheme.hpp index 5f141de85..3398c37f1 100644 --- a/include/eepp/ui/uitheme.hpp +++ b/include/eepp/ui/uitheme.hpp @@ -83,8 +83,6 @@ class EE_API UITheme : protected ResourceManager { SubTexture * getIconByName( const std::string& name ); - virtual UICheckBox * createCheckBox( UIControl * Parent = NULL, const Sizei& Size = Sizei(), const Vector2i& Pos = Vector2i(), const Uint32& Flags = UI_CONTROL_DEFAULT_FLAGS ); - virtual UITextBox * createTextBox( const String& Text = "", UIControl * Parent = NULL, const Sizei& Size = Sizei(), const Vector2i& Pos = Vector2i(), const Uint32& Flags = UI_CONTROL_DEFAULT_FLAGS | UI_AUTO_SIZE ); virtual UITextInput * createTextInput( UIControl * Parent = NULL, const Sizei& Size = Sizei(), const Vector2i& Pos = Vector2i(), const Uint32& Flags = UI_CONTROL_DEFAULT_FLAGS | UI_CLIP_ENABLE | UI_AUTO_PADDING | UI_TEXT_SELECTION_ENABLED, bool SupportFreeEditing = true, Uint32 MaxLength = 1024*8 ); diff --git a/include/eepp/ui/uitooltip.hpp b/include/eepp/ui/uitooltip.hpp index ce631f24f..e1808a844 100644 --- a/include/eepp/ui/uitooltip.hpp +++ b/include/eepp/ui/uitooltip.hpp @@ -87,7 +87,7 @@ class EE_API UITooltip : public UIControlAnim { virtual void onSizeChange(); - virtual void autoSize(); + virtual void onAutoSize(); virtual void autoAlign(); diff --git a/src/eepp/gaming/mapeditor/mapeditor.cpp b/src/eepp/gaming/mapeditor/mapeditor.cpp index ce9f1b23d..59ed8bce2 100644 --- a/src/eepp/gaming/mapeditor/mapeditor.cpp +++ b/src/eepp/gaming/mapeditor/mapeditor.cpp @@ -280,36 +280,43 @@ void MapEditor::CreateSubTextureContainer( Int32 Width ) { Uint32 ChkFlags = UI_CONTROL_DEFAULT_ALIGN | UI_AUTO_SIZE | UI_ANCHOR_RIGHT | UI_ANCHOR_TOP; - mChkMirrored = mTheme->createCheckBox( mSubTextureCont, Sizei(), Vector2i( TAB_CONT_X_DIST, Txt->getPosition().y + Txt->getSize().getHeight() + 4 ), ChkFlags ); + mChkMirrored = UICheckBox::New(); + mChkMirrored->setParent( mSubTextureCont )->setPosition( TAB_CONT_X_DIST, Txt->getPosition().y + Txt->getSize().getHeight() + 4 )->resetFlags( ChkFlags ); mChkMirrored->setText( "Mirrored" ); mChkMirrored->addEventListener( UIEvent::EventMouseClick, cb::Make1( this, &MapEditor::ChkClickMirrored ) ); - mChkFliped = mTheme->createCheckBox( mSubTextureCont, Sizei(), Vector2i( mChkMirrored->getPosition().x + mChkMirrored->getSize().getWidth() + 32, mChkMirrored->getPosition().y ), ChkFlags ); + mChkFliped = UICheckBox::New(); + mChkFliped->setParent( mSubTextureCont )->setPosition( mChkMirrored->getPosition().x + mChkMirrored->getSize().getWidth() + 32, mChkMirrored->getPosition().y )->resetFlags( ChkFlags ); mChkFliped->setText( "Fliped" ); mChkFliped->addEventListener( UIEvent::EventMouseClick, cb::Make1( this, &MapEditor::ChkClickFliped ) ); - mChkBlocked = mTheme->createCheckBox( mSubTextureCont, Sizei(), Vector2i( mChkMirrored->getPosition().x, mChkMirrored->getPosition().y + mChkMirrored->getSize().getHeight() + 4 ), ChkFlags ); + mChkBlocked = UICheckBox::New(); + mChkBlocked->setParent( mSubTextureCont )->setPosition( mChkMirrored->getPosition().x, mChkMirrored->getPosition().y + mChkMirrored->getSize().getHeight() + 4 )->resetFlags( ChkFlags ); mChkBlocked->setText( "Blocked" ); mChkBlocked->setTooltipText( "Blocks the tile occupied by the sprite." ); mChkBlocked->addEventListener( UIEvent::EventMouseClick, cb::Make1( this, &MapEditor::ChkClickBlocked ) ); - mChkAnim = mTheme->createCheckBox( mSubTextureCont, Sizei(), Vector2i( mChkFliped->getPosition().x, mChkFliped->getPosition().y + mChkFliped->getSize().getHeight() + 4 ), ChkFlags ); + mChkAnim = UICheckBox::New(); + mChkAnim->setParent( mSubTextureCont )->setPosition( mChkFliped->getPosition().x, mChkFliped->getPosition().y + mChkFliped->getSize().getHeight() + 4 )->resetFlags( ChkFlags ); mChkAnim->setText( "Animated" ); mChkAnim->setTooltipText( "Indicates if the Sprite is animated." ); mChkAnim->addEventListener( UIEvent::EventMouseClick, cb::Make1( this, &MapEditor::ChkClickAnimated ) ); - mChkRot90 = mTheme->createCheckBox( mSubTextureCont, Sizei(), Vector2i( mChkBlocked->getPosition().x, mChkBlocked->getPosition().y + mChkBlocked->getSize().getHeight() + 4 ), ChkFlags ); + mChkRot90 = UICheckBox::New(); + mChkRot90->setParent( mSubTextureCont )->setPosition( mChkBlocked->getPosition().x, mChkBlocked->getPosition().y + mChkBlocked->getSize().getHeight() + 4 )->resetFlags( ChkFlags ); mChkRot90->setText( String::fromUtf8( "Rotate 90ยบ" ) ); mChkRot90->addEventListener( UIEvent::EventMouseClick, cb::Make1( this, &MapEditor::ChkClickRot90 ) ); - mChkAutoFix = mTheme->createCheckBox( mSubTextureCont, Sizei(), Vector2i( mChkAnim->getPosition().x, mChkAnim->getPosition().y + mChkAnim->getSize().getHeight() + 4 ), ChkFlags ); + mChkAutoFix = UICheckBox::New(); + mChkAutoFix->setParent( mSubTextureCont )->setPosition( mChkAnim->getPosition().x, mChkAnim->getPosition().y + mChkAnim->getSize().getHeight() + 4 )->resetFlags( ChkFlags ); mChkAutoFix->setText( "AutoFix TilePos" ); mChkAutoFix->setTooltipText( "In a tiled layer if the sprite is moved,\nit will update the current tile position automatically." ); mChkAutoFix->addEventListener( UIEvent::EventMouseClick, cb::Make1( this, &MapEditor::ChkClickAutoFix ) ); Txt = mTheme->createTextBox( "Game Object Data:", mSubTextureCont, Sizei( Width, 16 ), Vector2i( TAB_CONT_X_DIST, mChkRot90->getPosition().y + mChkRot90->getSize().getHeight() + 8 ), TxtFlags ); - mChkDI = mTheme->createCheckBox( mSubTextureCont, Sizei(), Vector2i( TAB_CONT_X_DIST, Txt->getPosition().y + Txt->getSize().getHeight() + 4 ), ChkFlags ); + mChkDI = UICheckBox::New(); + mChkDI->setParent( mSubTextureCont )->setPosition( TAB_CONT_X_DIST, Txt->getPosition().y + Txt->getSize().getHeight() + 4 )->resetFlags( ChkFlags ); mChkDI->setText( "Add as DataId" ); mChkDI->setTooltipText( "If the resource it's not a sprite,\nyou can reference it with a data id" ); mChkDI->addEventListener( UIEvent::EventMouseClick, cb::Make1( this, &MapEditor::ChkClickDI ) ); @@ -404,15 +411,17 @@ void MapEditor::CreateLighContainer() { mLightRadius->setMaxValue( 2000 ); mLightRadius->addEventListener( UIEvent::EventOnValueChange, cb::Make1( this, &MapEditor::OnLightRadiusChangeVal ) ); - mLightTypeChk = mTheme->createCheckBox( mLightCont, Sizei(), Vector2i( mLightRadius->getPosition().x, mLightRadius->getPosition().y + mLightRadius->getSize().getHeight() + 8 ), UI_CONTROL_DEFAULT_FLAGS | UI_AUTO_SIZE ); + mLightTypeChk = UICheckBox::New(); + mLightTypeChk->setParent( mLightCont )->setPosition( mLightRadius->getPosition().x, mLightRadius->getPosition().y + mLightRadius->getSize().getHeight() + 8 )->setFlags( UI_AUTO_SIZE ); mLightTypeChk->setText( "Isometric Light" ); mLightTypeChk->setActive( false ); mLightTypeChk->addEventListener( UIEvent::EventOnValueChange, cb::Make1( this, &MapEditor::OnLightTypeChange ) ); } UISelectButton * MapEditor::AddObjContButton( String text, Uint32 mode ) { - UISelectButton * Button = mTheme->createSelectButton( mObjectCont, Sizei( mObjectCont->getSize().getWidth() - TAB_CONT_X_DIST * 2, 22 ), Vector2i( TAB_CONT_X_DIST, mLastSelButtonY ) ); - + UISelectButton * Button = UISelectButton::New(); + Button->setParent( mObjectCont ); + Button->setSize( mObjectCont->getSize().getWidth() - TAB_CONT_X_DIST * 2, 0 )->setPosition( TAB_CONT_X_DIST, mLastSelButtonY )->setFlags( UI_AUTO_SIZE ); Button->setText( text ); Button->setData( mode ); @@ -436,7 +445,8 @@ void MapEditor::CreateObjectsContainer() { Uint32 ChkFlags = UI_CONTROL_DEFAULT_ALIGN | UI_AUTO_SIZE | UI_ANCHOR_RIGHT | UI_ANCHOR_TOP; - mChkClampToTile = mTheme->createCheckBox( mObjectCont, Sizei(), Vector2i( 12, nextY ), ChkFlags ); + mChkClampToTile = UICheckBox::New(); + mChkClampToTile->setParent( mObjectCont )->setPosition( 12, nextY )->resetFlags( ChkFlags ); mChkClampToTile->setText( "Clamp Position to Tile" ); mChkClampToTile->addEventListener( UIEvent::EventMouseClick, cb::Make1( this, &MapEditor::ChkClickClampToTile ) ); mChkClampToTile->setActive( true ); diff --git a/src/eepp/gaming/mapeditor/uimapnew.cpp b/src/eepp/gaming/mapeditor/uimapnew.cpp index 98e4faf39..a36f176b8 100644 --- a/src/eepp/gaming/mapeditor/uimapnew.cpp +++ b/src/eepp/gaming/mapeditor/uimapnew.cpp @@ -80,7 +80,10 @@ UIMapNew::UIMapNew( UIMap * Map, cb::Callback0 NewMapCb, bool ResizeMap ) Txt = mTheme->createTextBox( "Map Flags:", mUIWindow->getContainer(), Sizei(), Vector2i( Txt->getPosition().x, mUIMapMaxLayers->getPosition().y + mUIMapMaxLayers->getSize().getHeight() + 8 ), UI_CONTROL_DEFAULT_FLAGS | UI_DRAW_SHADOW | UI_AUTO_SIZE ); - mUILightsEnabled = mTheme->createCheckBox( mUIWindow->getContainer(), Sizei(), Vector2i( Txt->getPosition().x + DistFromTitle, Txt->getPosition().y + Txt->getSize().getHeight() + 16 ), UI_CONTROL_DEFAULT_FLAGS | UI_AUTO_SIZE ); + mUILightsEnabled = UICheckBox::New(); + mUILightsEnabled->setParent( mUIWindow->getContainer() ) + ->setPosition( Txt->getPosition().x + DistFromTitle, Txt->getPosition().y + Txt->getSize().getHeight() + 16 ) + ->setFlags( UI_AUTO_SIZE ); mUILightsEnabled->setText( "Lights Enabled" ); mUILightsEnabled->setActive( true ); @@ -88,7 +91,10 @@ UIMapNew::UIMapNew( UIMap * Map, cb::Callback0 NewMapCb, bool ResizeMap ) mUILightsEnabled->setActive( 0 != mUIMap->Map()->getLightsEnabled() ); } - mUILightsByVertex = mTheme->createCheckBox( mUIWindow->getContainer(), Sizei(), Vector2i( mUIWindow->getContainer()->getSize().getWidth() / 2, mUILightsEnabled->getPosition().y ), UI_CONTROL_DEFAULT_FLAGS | UI_AUTO_SIZE ); + mUILightsByVertex = UICheckBox::New(); + mUILightsByVertex->setParent( mUIWindow->getContainer() ) + ->setPosition( mUIWindow->getContainer()->getSize().getWidth() / 2, mUILightsEnabled->getPosition().y ) + ->setFlags( UI_AUTO_SIZE ); mUILightsByVertex->setText( "Lights By Vertex" ); mUILightsByVertex->setActive( true ); @@ -96,7 +102,10 @@ UIMapNew::UIMapNew( UIMap * Map, cb::Callback0 NewMapCb, bool ResizeMap ) mUILightsByVertex->setActive( 0 != mUIMap->Map()->getLightsByVertex() ); } - mUIClampBorders = mTheme->createCheckBox( mUIWindow->getContainer(), Sizei(), Vector2i( Txt->getPosition().x + DistFromTitle, mUILightsEnabled->getPosition().y + mUILightsEnabled->getSize().getHeight() + 16 ), UI_CONTROL_DEFAULT_FLAGS | UI_AUTO_SIZE ); + mUIClampBorders = UICheckBox::New(); + mUIClampBorders->setParent( mUIWindow->getContainer() ) + ->setPosition( Txt->getPosition().x + DistFromTitle, mUILightsEnabled->getPosition().y + mUILightsEnabled->getSize().getHeight() + 16 ) + ->setFlags( UI_AUTO_SIZE ); mUIClampBorders->setText( "Clamp Borders" ); mUIClampBorders->setActive( true ); @@ -104,7 +113,10 @@ UIMapNew::UIMapNew( UIMap * Map, cb::Callback0 NewMapCb, bool ResizeMap ) mUIClampBorders->setActive( 0 != mUIMap->Map()->getClampBorders() ); } - mUIClipArea = mTheme->createCheckBox( mUIWindow->getContainer(), Sizei(), Vector2i( mUIWindow->getContainer()->getSize().getWidth() / 2, mUIClampBorders->getPosition().y ), UI_CONTROL_DEFAULT_FLAGS | UI_AUTO_SIZE ); + mUIClipArea = UICheckBox::New(); + mUIClipArea->setParent( mUIWindow->getContainer() ) + ->setPosition( mUIWindow->getContainer()->getSize().getWidth() / 2, mUIClampBorders->getPosition().y ) + ->setFlags( UI_AUTO_SIZE ); mUIClipArea->setText( "Clip View Area" ); mUIClipArea->setActive( true ); diff --git a/src/eepp/ui/uicheckbox.cpp b/src/eepp/ui/uicheckbox.cpp index 54b96a03d..14f9b2a00 100644 --- a/src/eepp/ui/uicheckbox.cpp +++ b/src/eepp/ui/uicheckbox.cpp @@ -5,6 +5,10 @@ namespace EE { namespace UI { +UICheckBox * UICheckBox::New() { + return eeNew( UICheckBox, () ); +} + UICheckBox::UICheckBox( const UITextBox::CreateParams& Params ) : UITextBox( Params ), mActive( false ), @@ -92,9 +96,9 @@ void UICheckBox::doAfterSetTheme() { setPadding( Recti(0,0,0,0) ); } -void UICheckBox::autoSize() { +void UICheckBox::onAutoSize() { if ( mFlags & UI_AUTO_SIZE ) { - setInternalPixelsWidth( (int)mTextCache->getTextWidth() + mActiveButton->getRealSize().getWidth() ); + setInternalPixelsWidth( (int)mTextCache->getTextWidth() + mActiveButton->getRealSize().getWidth() + mTextSeparation ); if ( mSize.getHeight() == 0 ) { setInternalHeight( mActiveButton->getSize().getHeight() ); diff --git a/src/eepp/ui/uicombobox.cpp b/src/eepp/ui/uicombobox.cpp index b59d3043a..b86bcf3ad 100644 --- a/src/eepp/ui/uicombobox.cpp +++ b/src/eepp/ui/uicombobox.cpp @@ -75,7 +75,7 @@ const String& UIComboBox::getText() { void UIComboBox::updateControls() { if ( ( mFlags & UI_AUTO_SIZE ) || mSize.getHeight() < mDropDownList->getSkin()->getSize().getHeight() ) { - setInternalHeight( mDropDownList->getSkin()->getSize().getHeight() ); + onAutoSize(); } mDropDownList->setPosition( 0, 0 ); @@ -106,4 +106,8 @@ void UIComboBox::onPositionChange() { updateControls(); } +void UIComboBox::onAutoSize() { + setInternalHeight( mDropDownList->getSkin()->getSize().getHeight() ); +} + }} diff --git a/src/eepp/ui/uicomplexcontrol.cpp b/src/eepp/ui/uicomplexcontrol.cpp index 9b166b428..0c6f1eb42 100644 --- a/src/eepp/ui/uicomplexcontrol.cpp +++ b/src/eepp/ui/uicomplexcontrol.cpp @@ -146,6 +146,10 @@ UIControl * UIComplexControl::setFlags(const Uint32 & flags) { updateAnchorsDistances(); } + if ( flags & UI_AUTO_SIZE ) { + onAutoSize(); + } + return UIControlAnim::setFlags( flags ); } @@ -216,4 +220,7 @@ void UIComplexControl::onPositionChange() { UIControlAnim::onPositionChange(); } +void UIComplexControl::onAutoSize() { +} + }} diff --git a/src/eepp/ui/uidropdownlist.cpp b/src/eepp/ui/uidropdownlist.cpp index f84c2d640..d37477609 100644 --- a/src/eepp/ui/uidropdownlist.cpp +++ b/src/eepp/ui/uidropdownlist.cpp @@ -78,7 +78,7 @@ void UIDropDownList::setFriendControl( UIControl * friendCtrl ) { mFriendCtrl = friendCtrl; } -void UIDropDownList::autoSize() { +void UIDropDownList::onAutoSize() { } UIListBox * UIDropDownList::getListBox() const { diff --git a/src/eepp/ui/uigenericgrid.cpp b/src/eepp/ui/uigenericgrid.cpp index ffffaa248..f489798b8 100644 --- a/src/eepp/ui/uigenericgrid.cpp +++ b/src/eepp/ui/uigenericgrid.cpp @@ -399,7 +399,7 @@ void UIGenericGrid::add( UIGridCell * Cell ) { setDefaultCollumnsWidth(); - Cell->autoSize(); + Cell->onAutoSize(); updateSize(); diff --git a/src/eepp/ui/uigfx.cpp b/src/eepp/ui/uigfx.cpp index 7edfee865..7b5d5a06e 100644 --- a/src/eepp/ui/uigfx.cpp +++ b/src/eepp/ui/uigfx.cpp @@ -19,7 +19,7 @@ UIGfx::UIGfx( const UIGfx::CreateParams& Params ) : mColor.Alpha = (Uint8)mAlpha; - autoSize(); + onAutoSize(); } UIGfx::UIGfx() : @@ -31,7 +31,7 @@ UIGfx::UIGfx() : { mFlags |= UI_FIT_TO_CONTROL | UI_AUTO_SIZE; - autoSize(); + onAutoSize(); } UIGfx::~UIGfx() { @@ -48,7 +48,7 @@ bool UIGfx::isType( const Uint32& type ) const { void UIGfx::setSubTexture( Graphics::SubTexture * subTexture ) { mSubTexture = subTexture; - autoSize(); + onAutoSize(); if ( NULL != mSubTexture && mSize.x == 0 && mSize.y == 0 ) { setSize( mSubTexture->getDpSize() ); @@ -57,7 +57,7 @@ void UIGfx::setSubTexture( Graphics::SubTexture * subTexture ) { autoAlign(); } -void UIGfx::autoSize() { +void UIGfx::onAutoSize() { if ( mFlags & UI_AUTO_SIZE ) { if ( NULL != mSubTexture ) { setSize( mSubTexture->getDpSize() ); @@ -180,13 +180,13 @@ void UIGfx::autoAlign() { } void UIGfx::onSizeChange() { - autoSize(); + onAutoSize(); autoAlign(); UIControlAnim::onSizeChange(); } void UIGfx::onAlignChange() { - autoSize(); + onAutoSize(); autoAlign(); } diff --git a/src/eepp/ui/uigridcell.cpp b/src/eepp/ui/uigridcell.cpp index 455eda865..ac2c3a591 100644 --- a/src/eepp/ui/uigridcell.cpp +++ b/src/eepp/ui/uigridcell.cpp @@ -62,7 +62,7 @@ UIControl * UIGridCell::getCell( const Uint32& CollumnIndex ) const { } void UIGridCell::fixCell() { - autoSize(); + onAutoSize(); UIGenericGrid * P = gridParent(); @@ -167,7 +167,7 @@ Uint32 UIGridCell::onMessage( const UIMessage * Msg ) { return 0; } -void UIGridCell::autoSize() { +void UIGridCell::onAutoSize() { UIGenericGrid * MyParent = reinterpret_cast ( getParent()->getParent() ); setSize( MyParent->mTotalWidth, MyParent->mRowHeight ); diff --git a/src/eepp/ui/uilistbox.cpp b/src/eepp/ui/uilistbox.cpp index fd6c0b93f..d31f079fa 100644 --- a/src/eepp/ui/uilistbox.cpp +++ b/src/eepp/ui/uilistbox.cpp @@ -218,7 +218,7 @@ UIListBoxItem * UIListBox::createListBoxItem( const String& Name ) { UITextBox::CreateParams TextParams; TextParams.setParent( mContainer ); TextParams.Flags = UI_VALIGN_CENTER | UI_HALIGN_LEFT; - TextParams.fontStyleConfig = mFontStyleConfig; + TextParams.FontStyleConfig = mFontStyleConfig; UIListBoxItem * tItem = eeNew( UIListBoxItem, ( TextParams ) ); tItem->setText( Name ); diff --git a/src/eepp/ui/uimenu.cpp b/src/eepp/ui/uimenu.cpp index 11c0f7246..20d90ce49 100644 --- a/src/eepp/ui/uimenu.cpp +++ b/src/eepp/ui/uimenu.cpp @@ -18,7 +18,7 @@ UIMenu::UIMenu() : mClickHide( false ), mLastTickMove( 0 ) { - setFlags( UI_AUTO_SIZE ); + mFlags |= UI_AUTO_SIZE; mStyleConfig = UIThemeManager::instance()->getDefaultFontStyleConfig(); @@ -59,7 +59,7 @@ void UIMenu::doAfterSetTheme() { UIMenuItem * UIMenu::createMenuItem( const String& Text, SubTexture * Icon ) { UIMenuItem::CreateParams Params; Params.setParent( this ); - Params.fontStyleConfig = mStyleConfig; + Params.FontStyleConfig = mStyleConfig; Params.Icon = Icon; Params.IconMinSize = Sizei( mStyleConfig.MinSpaceForIcons, mStyleConfig.MinSpaceForIcons ); @@ -85,7 +85,7 @@ Uint32 UIMenu::add( const String& Text, SubTexture * Icon ) { UIMenuCheckBox * UIMenu::createMenuCheckBox( const String& Text, const bool &Active ) { UIMenuCheckBox::CreateParams Params; Params.setParent( this ); - Params.fontStyleConfig = mStyleConfig; + Params.FontStyleConfig = mStyleConfig; Params.IconMinSize = Sizei( mStyleConfig.MinSpaceForIcons, mStyleConfig.MinSpaceForIcons ); if ( mFlags & UI_AUTO_SIZE ) { @@ -113,7 +113,7 @@ Uint32 UIMenu::addCheckBox( const String& Text, const bool& Active ) { UIMenuSubMenu * UIMenu::createSubMenu( const String& Text, SubTexture * Icon, UIMenu * SubMenu ) { UIMenuSubMenu::CreateParams Params; Params.setParent( this ); - Params.fontStyleConfig = mStyleConfig; + Params.FontStyleConfig = mStyleConfig; Params.SubMenu = SubMenu; Params.Icon = Icon; Params.IconMinSize = Sizei( mStyleConfig.MinSpaceForIcons, mStyleConfig.MinSpaceForIcons ); diff --git a/src/eepp/ui/uimessagebox.cpp b/src/eepp/ui/uimessagebox.cpp index decf70d3b..d7ab76a30 100644 --- a/src/eepp/ui/uimessagebox.cpp +++ b/src/eepp/ui/uimessagebox.cpp @@ -8,47 +8,32 @@ UIMessageBox::UIMessageBox( const UIMessageBox::CreateParams& Params ) : mMsgBoxType( Params.Type ), mCloseWithKey( Params.CloseWithKey ) { - UITheme * Theme = UIThemeManager::instance()->getDefaultTheme(); + mButtonOK = UIPushButton::New(); + mButtonOK->setParent( getContainer() ) + ->setFlags( UI_AUTO_SIZE ) + ->setSize( 90, 0 ) + ->setPosition( getContainer()->getSize().getWidth() - 96, getContainer()->getSize().getHeight() - mButtonOK->getSize().getHeight() - 8 ); + mButtonOK->setAnchors( UI_ANCHOR_RIGHT ); - if ( NULL == Theme ) - { - UIPushButton::CreateParams ButtonParams; - ButtonParams.setParent( getContainer() ); - ButtonParams.setSize( 90, 22 ); - ButtonParams.setPosition( getContainer()->getSize().getWidth() - 96, getContainer()->getSize().getHeight() - ButtonParams.Size.getHeight() - 8 ); - ButtonParams.Flags = UI_HALIGN_CENTER | UI_ANCHOR_RIGHT | UI_VALIGN_CENTER | UI_AUTO_SIZE; - mButtonOK = eeNew( UIPushButton, ( ButtonParams ) ); - mButtonOK->setVisible( true ); - mButtonOK->setEnabled( true ); + mButtonCancel = UIPushButton::New(); + mButtonCancel->setParent( getContainer() ) + ->setFlags( UI_AUTO_SIZE ) + ->setSize( 90, 0 ) + ->setPosition( mButtonOK->getPosition().x - mButtonOK->getSize().getWidth() - 8, getContainer()->getSize().getHeight() - mButtonOK->getSize().getHeight() - 8 ); + mButtonCancel->setAnchors( UI_ANCHOR_RIGHT ); - ButtonParams.Pos.x = mButtonOK->getPosition().x - mButtonOK->getSize().getWidth() - 8; - mButtonCancel = eeNew( UIPushButton, ( ButtonParams ) ); - mButtonCancel->setVisible( true ); - mButtonCancel->setEnabled( true ); - } - else - { - mButtonOK = Theme->createPushButton( getContainer(), - Sizei( 90, 22 ), - Vector2i( getContainer()->getSize().getWidth() - 96, getContainer()->getSize().getHeight() - 22 - 8 ), - UI_HALIGN_CENTER | UI_ANCHOR_RIGHT | UI_VALIGN_CENTER | UI_AUTO_SIZE ); + applyDefaultTheme(); - mButtonCancel = Theme->createPushButton( getContainer(), - mButtonOK->getSize(), - Vector2i( mButtonOK->getPosition().x - mButtonOK->getSize().getWidth() - 8, mButtonOK->getPosition().y ), - mButtonOK->getFlags() ); - } - - UITextBox::CreateParams TxtParams; - TxtParams.setParent( getContainer() ); - TxtParams.Flags = UI_CONTROL_DEFAULT_FLAGS_CENTERED | UI_ANCHOR_RIGHT | UI_ANCHOR_BOTTOM; - TxtParams.setSize( getContainer()->getSize().getWidth(), mButtonOK->getPosition().y ); - - mTextBox = eeNew( UITextBox, ( TxtParams ) ); - mTextBox->setVisible( true ); - mTextBox->setEnabled( true ); + mTextBox = UITextBox::New(); + mTextBox->setParent( getContainer() ) + ->setSize( getContainer()->getSize().getWidth(), mButtonOK->getPosition().y ) + ->setHorizontalAlign( UI_HALIGN_CENTER ); mTextBox->setText( Params.Message ); + setSize( getContainer()->getSize().getWidth(), mTextBox->getTextHeight() + mButtonOK->getSize().getHeight() + 8 ); + + mTextBox->setAnchors( UI_ANCHOR_LEFT | UI_ANCHOR_TOP | UI_ANCHOR_RIGHT | UI_ANCHOR_BOTTOM ); + switch ( mMsgBoxType ) { case MSGBOX_OKCANCEL: { @@ -80,9 +65,8 @@ UIMessageBox::UIMessageBox( const UIMessageBox::CreateParams& Params ) : mButtonCancel->toFront(); mButtonOK->toFront(); - autoSize(); + onAutoSize(); - applyDefaultTheme(); } UIMessageBox::~UIMessageBox() { @@ -144,7 +128,7 @@ UIPushButton * UIMessageBox::getButtonCancel() const { return mButtonCancel; } -void UIMessageBox::autoSize() { +void UIMessageBox::onAutoSize() { Sizei nSize( mTextBox->getTextWidth() + 48, mTextBox->getTextHeight() + mButtonOK->getSize().getHeight() + mStyleConfig.DecorationSize.getHeight() + 8 ); if ( !( nSize.getWidth() > getContainer()->getSize().getWidth() ) ) { @@ -158,7 +142,7 @@ void UIMessageBox::autoSize() { if ( nSize.x != getContainer()->getSize().getWidth() || nSize.y != getContainer()->getSize().getHeight() ) { setSize( nSize ); - mStyleConfig.MinWindowSize = nSize; + mStyleConfig.MinWindowSize = nSize; } } diff --git a/src/eepp/ui/uipushbutton.cpp b/src/eepp/ui/uipushbutton.cpp index 4e7504cec..1b41735dc 100644 --- a/src/eepp/ui/uipushbutton.cpp +++ b/src/eepp/ui/uipushbutton.cpp @@ -9,7 +9,7 @@ UIPushButton * UIPushButton::New() { UIPushButton::UIPushButton( const UIPushButton::CreateParams& Params ) : UIComplexControl( Params ), - mFontStyleConfig( Params.fontStyleConfig ), + mFontStyleConfig( Params.FontStyleConfig ), mIcon( NULL ), mTextBox( NULL ), mIconSpace( Params.IconHorizontalMargin ) @@ -38,7 +38,7 @@ UIPushButton::UIPushButton( const UIPushButton::CreateParams& Params ) : UITextBox::CreateParams TxtParams = Params; TxtParams.setParent( this ); TxtParams.Flags = HAlignGet( Params.Flags ) | VAlignGet( Params.Flags ); - TxtParams.fontStyleConfig = Params.fontStyleConfig; + TxtParams.FontStyleConfig = Params.FontStyleConfig; if ( TxtParams.Flags & UI_CLIP_ENABLE ) TxtParams.Flags &= ~UI_CLIP_ENABLE; diff --git a/src/eepp/ui/uiradiobutton.cpp b/src/eepp/ui/uiradiobutton.cpp index e457cabbb..da39943df 100644 --- a/src/eepp/ui/uiradiobutton.cpp +++ b/src/eepp/ui/uiradiobutton.cpp @@ -93,7 +93,7 @@ void UIRadioButton::setTheme( UITheme * Theme ) { setPadding( Recti(0,0,0,0) ); } -void UIRadioButton::autoSize() { +void UIRadioButton::onAutoSize() { if ( mFlags & UI_AUTO_SIZE ) { mActiveButton->centerVertical(); mInactiveButton->centerVertical(); diff --git a/src/eepp/ui/uiscrollbar.cpp b/src/eepp/ui/uiscrollbar.cpp index 219edaa26..a71c49b33 100644 --- a/src/eepp/ui/uiscrollbar.cpp +++ b/src/eepp/ui/uiscrollbar.cpp @@ -45,7 +45,7 @@ UIScrollBar::UIScrollBar( const UIScrollBar::CreateParams& Params ) : UIScrollBar::UIScrollBar() : UIComplexControl() { - setFlags( UI_AUTO_SIZE ); + mFlags |= UI_AUTO_SIZE; mBtnDown = eeNew( UIControlAnim, () ); mBtnUp = eeNew( UIControlAnim, () ); @@ -117,7 +117,7 @@ void UIScrollBar::setTheme( UITheme * Theme ) { mSlider->adjustChilds(); } -void UIScrollBar::autoSize() { +void UIScrollBar::onAutoSize() { UISkin * tSkin = mSlider->getBackSlider()->getSkin(); if ( NULL != tSkin ) { @@ -146,7 +146,7 @@ void UIScrollBar::onSizeChange() { } void UIScrollBar::adjustChilds() { - autoSize(); + onAutoSize(); mBtnUp->setPosition( 0, 0 ); diff --git a/src/eepp/ui/uitab.cpp b/src/eepp/ui/uitab.cpp index f9b7d7ca0..2adb9e115 100644 --- a/src/eepp/ui/uitab.cpp +++ b/src/eepp/ui/uitab.cpp @@ -110,7 +110,7 @@ void UITab::setText( const String &text ) { if ( text.size() > tTabW->getMaxTextLength() ) { UIPushButton::setText( text.substr( 0, tTabW->getMaxTextLength() ) ); - autoSize(); + onAutoSize(); return; } @@ -118,10 +118,10 @@ void UITab::setText( const String &text ) { UIPushButton::setText( text ); - autoSize(); + onAutoSize(); } -void UITab::autoSize() { +void UITab::onAutoSize() { if ( mFlags & UI_AUTO_SIZE ) { Uint32 w = PixelDensity::pxToDpI( mTextBox->getTextWidth() ) + mIconSpace + ( NULL != mIcon ? mIcon->getSize().getWidth() : 0 ) + getSkinSize().getWidth(); diff --git a/src/eepp/ui/uitextbox.cpp b/src/eepp/ui/uitextbox.cpp index 9a7bd88ec..16779ac74 100644 --- a/src/eepp/ui/uitextbox.cpp +++ b/src/eepp/ui/uitextbox.cpp @@ -14,7 +14,7 @@ UITextBox *UITextBox::New() { UITextBox::UITextBox( const UITextBox::CreateParams& Params ) : UIComplexControl( Params ), - mFontStyleConfig( Params.fontStyleConfig ), + mFontStyleConfig( Params.FontStyleConfig ), mRealAlignOffset( 0.f, 0.f ), mSelCurInit( -1 ), mSelCurEnd( -1 ) @@ -90,7 +90,7 @@ void UITextBox::setFont( Graphics::Font * font ) { if ( mTextCache->getFont() != font ) { mTextCache->setFont( font ); autoShrink(); - autoSize(); + onAutoSize(); autoAlign(); onFontChanged(); } @@ -111,12 +111,8 @@ void UITextBox::setText( const String& text ) { mTextCache->setText( text ); } - if ( mSize == Sizei::Zero ) { - setFlags( UI_AUTO_SIZE ); - } - autoShrink(); - autoSize(); + onAutoSize(); autoAlign(); onTextChanged(); } @@ -172,7 +168,7 @@ void UITextBox::shrinkText( const Uint32& MaxWidth ) { mTextCache->cacheWidth(); } -void UITextBox::autoSize() { +void UITextBox::onAutoSize() { if ( ( mFlags & UI_AUTO_SIZE ) ) { setInternalPixelsSize( Sizei( (int)mTextCache->getTextWidth(), (int)mTextCache->getTextHeight() ) ); } @@ -215,7 +211,7 @@ Uint32 UITextBox::onFocusLoss() { void UITextBox::onSizeChange() { autoShrink(); - autoSize(); + onAutoSize(); autoAlign(); UIControlAnim::onSizeChange(); diff --git a/src/eepp/ui/uitextedit.cpp b/src/eepp/ui/uitextedit.cpp index 84181509f..217fad0e7 100644 --- a/src/eepp/ui/uitextedit.cpp +++ b/src/eepp/ui/uitextedit.cpp @@ -37,7 +37,7 @@ UITextEdit::UITextEdit( UITextEdit::CreateParams& Params ) : TIParams.Size = mSize; TIParams.Flags = UI_VALIGN_TOP | UI_HALIGN_LEFT | UI_TEXT_SELECTION_ENABLED | extraFlags; TIParams.MaxLength = 1024 * 1024 * 10; - TIParams.fontStyleConfig = Params.fontStyleConfig; + TIParams.FontStyleConfig = Params.FontStyleConfig; if ( Params.WordWrap && !( mFlags & UI_WORD_WRAP ) ) mFlags |= UI_WORD_WRAP; diff --git a/src/eepp/ui/uitextinput.cpp b/src/eepp/ui/uitextinput.cpp index 603db5c17..2524b4b0a 100644 --- a/src/eepp/ui/uitextinput.cpp +++ b/src/eepp/ui/uitextinput.cpp @@ -34,7 +34,7 @@ UITextInput::UITextInput() : mAllowEditing( true ), mShowingWait( true ) { - resetFlags( UI_HALIGN_LEFT | UI_VALIGN_TOP | UI_CLIP_ENABLE | UI_AUTO_PADDING | UI_AUTO_SIZE | UI_TEXT_SELECTION_ENABLED ); + setFlags( UI_CLIP_ENABLE | UI_AUTO_PADDING | UI_AUTO_SIZE | UI_TEXT_SELECTION_ENABLED ); mTextBuffer.start(); mTextBuffer.setActive( false ); @@ -195,10 +195,10 @@ void UITextInput::setTheme( UITheme * Theme ) { UIControl::setThemeControl( Theme, "textinput" ); autoPadding(); - autoSize(); + onAutoSize(); } -void UITextInput::autoSize() { +void UITextInput::onAutoSize() { if ( ( mFlags & UI_AUTO_SIZE ) && 0 == mSize.getHeight() ) { setSize( mSize.x, getSkinSize().getHeight() ); } diff --git a/src/eepp/ui/uitheme.cpp b/src/eepp/ui/uitheme.cpp index 412828b7a..2cecfc26b 100644 --- a/src/eepp/ui/uitheme.cpp +++ b/src/eepp/ui/uitheme.cpp @@ -388,18 +388,6 @@ SubTexture * UITheme::getIconByName( const std::string& name ) { return NULL; } -UICheckBox * UITheme::createCheckBox( UIControl * Parent, const Sizei& Size, const Vector2i& Pos, const Uint32& Flags ) { - UICheckBox::CreateParams CheckBoxParams; - CheckBoxParams.setParent( Parent ); - CheckBoxParams.setPosition( Pos ); - CheckBoxParams.setSize( Size ); - CheckBoxParams.Flags = Flags; - UICheckBox * Ctrl = eeNew( UICheckBox, ( CheckBoxParams ) ); - Ctrl->setVisible( true ); - Ctrl->setEnabled( true ); - return Ctrl; -} - UITextBox * UITheme::createTextBox( const String& Text, UIControl * Parent, const Sizei& Size, const Vector2i& Pos, const Uint32& Flags ) { UITextBox::CreateParams TextBoxParams; TextBoxParams.setParent( Parent ); diff --git a/src/eepp/ui/uitooltip.cpp b/src/eepp/ui/uitooltip.cpp index 3524db7ae..cda7cc111 100644 --- a/src/eepp/ui/uitooltip.cpp +++ b/src/eepp/ui/uitooltip.cpp @@ -29,8 +29,9 @@ UITooltip::UITooltip() : setFontShadowColor( mFontStyleConfig.FontShadowColor ); } - if ( NULL == getFont() && NULL != UIThemeManager::instance()->getDefaultFont() ) { - setFont( UIThemeManager::instance()->getDefaultFont() ); + if ( NULL == getFont() ) { + if ( NULL != UIThemeManager::instance()->getDefaultFont() ) + setFont( UIThemeManager::instance()->getDefaultFont() ); } else { eePRINTL( "UITooltip::UITooltip : Created a UI TextBox without a defined font." ); } @@ -73,6 +74,7 @@ void UITooltip::show() { toFront(); setVisible( true ); + setEnabled( true ); if ( UIThemeManager::instance()->getDefaultEffectsEnabled() ) { startAlphaAnim( 255.f == mAlpha ? 0.f : mAlpha, 255.f, UIThemeManager::instance()->getControlsFadeInTime() ); @@ -86,6 +88,7 @@ void UITooltip::hide() { disableFadeOut( UIThemeManager::instance()->getControlsFadeOutTime() ); } else { setVisible( false ); + setEnabled( false ); } } } @@ -109,7 +112,7 @@ void UITooltip::setFont( Graphics::Font * font ) { if ( mTextCache->getFont() != font ) { mTextCache->setFont( font ); autoPadding(); - autoSize(); + onAutoSize(); autoAlign(); onFontChanged(); } @@ -122,7 +125,7 @@ const String& UITooltip::getText() { void UITooltip::setText( const String& text ) { mTextCache->setText( text ); autoPadding(); - autoSize(); + onAutoSize(); autoAlign(); onTextChanged(); } @@ -155,7 +158,7 @@ void UITooltip::setAlpha( const Float& alpha ) { mTextCache->setColor( mFontStyleConfig.FontColor ); } -void UITooltip::autoSize() { +void UITooltip::onAutoSize() { if ( mFlags & UI_AUTO_SIZE ) { setPixelsSize( (int)mTextCache->getTextWidth() + mRealPadding.Left + mRealPadding.Right, @@ -195,7 +198,7 @@ void UITooltip::autoAlign() { void UITooltip::onSizeChange() { autoPadding(); - autoSize(); + onAutoSize(); autoAlign(); UIControlAnim::onSizeChange(); diff --git a/src/test/eetest.cpp b/src/test/eetest.cpp index 8082cc421..8b977fc6f 100644 --- a/src/test/eetest.cpp +++ b/src/test/eetest.cpp @@ -363,15 +363,9 @@ void EETest::createUI() { Input->setVisible( true ); Input->setEnabled( true ); - UIPushButton::CreateParams ButtonParams; - ButtonParams.setParent( C ); - ButtonParams.Flags = UI_VALIGN_CENTER | UI_HALIGN_CENTER | UI_AUTO_SIZE; - ButtonParams.setPosition( 225, 216 ); - ButtonParams.Size = Sizei( 90, 0 ); - ButtonParams.setIcon( mTheme->getIconByName( "ok" ) ); - UIPushButton * Button = eeNew( UIPushButton, ( ButtonParams ) ); - Button->setVisible( true ); - Button->setEnabled( true ); + UIPushButton * Button = UIPushButton::New(); + Button->setParent( C )->setPosition( 225, 215 )->setSize( 90, 0 ); + Button->setIcon( mTheme->getIconByName( "ok" ) ); Button->setText( "Click Me" ); Button->addEventListener( UIEvent::EventMouseClick, cb::Make1( this, &EETest::onButtonClick ) ); Button->setTooltipText( "Click and see what happens..." );