mirror of
https://github.com/SpartanJ/eepp.git
synced 2026-08-11 17:17:42 +03:00
Fixes.
--HG-- branch : dev
This commit is contained in:
@@ -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();
|
||||
};
|
||||
|
||||
}}
|
||||
|
||||
@@ -43,6 +43,8 @@ class EE_API UIComboBox : public UIComplexControl {
|
||||
virtual void onSizeChange();
|
||||
|
||||
virtual void onPositionChange();
|
||||
|
||||
virtual void onAutoSize();
|
||||
};
|
||||
|
||||
}}
|
||||
|
||||
@@ -82,6 +82,8 @@ class EE_API UIComplexControl : public UIControlAnim {
|
||||
virtual void onParentSizeChange( const Vector2i& SizeChange );
|
||||
|
||||
virtual void onPositionChange();
|
||||
|
||||
virtual void onAutoSize();
|
||||
};
|
||||
|
||||
}}
|
||||
|
||||
@@ -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 );
|
||||
|
||||
|
||||
@@ -64,7 +64,7 @@ class EE_API UIDropDownList : public UITextInput {
|
||||
|
||||
virtual void onSizeChange();
|
||||
|
||||
virtual void autoSize();
|
||||
virtual void onAutoSize();
|
||||
|
||||
virtual void autoSizeControl();
|
||||
|
||||
|
||||
@@ -63,7 +63,7 @@ class EE_API UIGfx : public UIComplexControl {
|
||||
|
||||
virtual void onAlignChange();
|
||||
|
||||
void autoSize();
|
||||
void onAutoSize();
|
||||
|
||||
void autoAlign();
|
||||
|
||||
|
||||
@@ -33,8 +33,6 @@ class EE_API UIGridCell : public UIComplexControl {
|
||||
void select();
|
||||
|
||||
virtual Uint32 onMessage( const UIMessage * Msg );
|
||||
|
||||
void autoSize();
|
||||
protected:
|
||||
friend class UIItemContainer<UIGenericGrid>;
|
||||
friend class UIGenericGrid;
|
||||
@@ -50,6 +48,8 @@ class EE_API UIGridCell : public UIComplexControl {
|
||||
virtual void onStateChange();
|
||||
|
||||
virtual void onParentChange();
|
||||
|
||||
virtual void onAutoSize();
|
||||
};
|
||||
|
||||
}}
|
||||
|
||||
@@ -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 );
|
||||
};
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -54,7 +54,7 @@ class EE_API UIRadioButton : public UITextBox {
|
||||
|
||||
virtual Uint32 onMessage( const UIMessage * Msg );
|
||||
|
||||
virtual void autoSize();
|
||||
virtual void onAutoSize();
|
||||
};
|
||||
|
||||
}}
|
||||
|
||||
@@ -77,7 +77,7 @@ class EE_API UIScrollBar : public UIComplexControl {
|
||||
|
||||
virtual void onSizeChange();
|
||||
|
||||
void autoSize();
|
||||
virtual void onAutoSize();
|
||||
|
||||
void adjustChilds();
|
||||
|
||||
|
||||
@@ -37,7 +37,7 @@ class EE_API UITab : public UISelectButton {
|
||||
|
||||
virtual void onStateChange();
|
||||
|
||||
void autoSize();
|
||||
virtual void onAutoSize();
|
||||
|
||||
UITabWidget * getTabWidget();
|
||||
|
||||
|
||||
@@ -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();
|
||||
|
||||
|
||||
@@ -77,7 +77,7 @@ class EE_API UITextInput : public UITextBox {
|
||||
|
||||
virtual void alignFix();
|
||||
|
||||
virtual void autoSize();
|
||||
virtual void onAutoSize();
|
||||
|
||||
void privOnPressEnter();
|
||||
|
||||
|
||||
@@ -83,8 +83,6 @@ class EE_API UITheme : protected ResourceManager<UISkin> {
|
||||
|
||||
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 );
|
||||
|
||||
@@ -87,7 +87,7 @@ class EE_API UITooltip : public UIControlAnim {
|
||||
|
||||
virtual void onSizeChange();
|
||||
|
||||
virtual void autoSize();
|
||||
virtual void onAutoSize();
|
||||
|
||||
virtual void autoAlign();
|
||||
|
||||
|
||||
@@ -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 );
|
||||
|
||||
@@ -80,7 +80,10 @@ UIMapNew::UIMapNew( UIMap * Map, cb::Callback0<void> 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<void> 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<void> 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<void> 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 );
|
||||
|
||||
|
||||
@@ -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() );
|
||||
|
||||
@@ -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() );
|
||||
}
|
||||
|
||||
}}
|
||||
|
||||
@@ -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() {
|
||||
}
|
||||
|
||||
}}
|
||||
|
||||
@@ -78,7 +78,7 @@ void UIDropDownList::setFriendControl( UIControl * friendCtrl ) {
|
||||
mFriendCtrl = friendCtrl;
|
||||
}
|
||||
|
||||
void UIDropDownList::autoSize() {
|
||||
void UIDropDownList::onAutoSize() {
|
||||
}
|
||||
|
||||
UIListBox * UIDropDownList::getListBox() const {
|
||||
|
||||
@@ -399,7 +399,7 @@ void UIGenericGrid::add( UIGridCell * Cell ) {
|
||||
|
||||
setDefaultCollumnsWidth();
|
||||
|
||||
Cell->autoSize();
|
||||
Cell->onAutoSize();
|
||||
|
||||
updateSize();
|
||||
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
|
||||
|
||||
@@ -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<UIGenericGrid*> ( getParent()->getParent() );
|
||||
|
||||
setSize( MyParent->mTotalWidth, MyParent->mRowHeight );
|
||||
|
||||
@@ -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 );
|
||||
|
||||
|
||||
@@ -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 );
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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();
|
||||
|
||||
@@ -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 );
|
||||
|
||||
|
||||
@@ -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();
|
||||
|
||||
|
||||
@@ -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();
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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() );
|
||||
}
|
||||
|
||||
@@ -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 );
|
||||
|
||||
@@ -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();
|
||||
|
||||
@@ -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..." );
|
||||
|
||||
Reference in New Issue
Block a user