diff --git a/include/eepp/ui/uimenu.hpp b/include/eepp/ui/uimenu.hpp index 8f3ae7c10..6d4d7549c 100644 --- a/include/eepp/ui/uimenu.hpp +++ b/include/eepp/ui/uimenu.hpp @@ -57,6 +57,8 @@ class EE_API UIMenu : public UIComplexControl { UIMenu( UIMenu::CreateParams& Params ); + UIMenu(); + virtual ~UIMenu(); virtual Uint32 getType() const; @@ -98,6 +100,31 @@ class EE_API UIMenu : public UIComplexControl { virtual bool hide(); const Recti& getPadding() const; + + Font * getFont() const; + + void setFont(Font * font); + + ColorA getFontColor() const; + + void setFontColor(const ColorA & fontColor); + + ColorA getFontShadowColor() const; + + void setFontShadowColor(const ColorA & fontShadowColor); + + ColorA getFontOverColor() const; + + void setFontOverColor(const ColorA & fontOverColor); + + ColorA getFontSelectedColor() const; + + void setFontSelectedColor(const ColorA & fontSelectedColor); + + Uint32 getMinRightMargin() const; + + void setMinRightMargin(const Uint32 & minRightMargin); + protected: friend class UIMenuItem; friend class UIMenuCheckBox; diff --git a/include/eepp/ui/uimenusubmenu.hpp b/include/eepp/ui/uimenusubmenu.hpp index a88c0c69b..be8fddd4b 100644 --- a/include/eepp/ui/uimenusubmenu.hpp +++ b/include/eepp/ui/uimenusubmenu.hpp @@ -26,6 +26,8 @@ class EE_API UIMenuSubMenu : public UIMenuItem { UIMenuSubMenu( UIMenuSubMenu::CreateParams& Params ); + UIMenuSubMenu(); + virtual ~UIMenuSubMenu(); virtual Uint32 getType() const; @@ -43,6 +45,11 @@ class EE_API UIMenuSubMenu : public UIMenuItem { void showSubMenu(); virtual bool inheritsFrom( const Uint32 getType ); + + Float getMouseOverTimeShowMenu() const; + + void setMouseOverTimeShowMenu(const Float & maxTime); + protected: UIMenu * mSubMenu; UISkin * mSkinArrow; diff --git a/include/eepp/ui/uipopupmenu.hpp b/include/eepp/ui/uipopupmenu.hpp index 464210d8f..c2cca548c 100644 --- a/include/eepp/ui/uipopupmenu.hpp +++ b/include/eepp/ui/uipopupmenu.hpp @@ -9,6 +9,8 @@ class EE_API UIPopUpMenu : public UIMenu { public: UIPopUpMenu( UIPopUpMenu::CreateParams Params ); + UIPopUpMenu(); + virtual ~UIPopUpMenu(); virtual Uint32 getType() const; diff --git a/include/eepp/ui/uiselectbutton.hpp b/include/eepp/ui/uiselectbutton.hpp index 7dd8ff8f6..7f31521a9 100644 --- a/include/eepp/ui/uiselectbutton.hpp +++ b/include/eepp/ui/uiselectbutton.hpp @@ -9,6 +9,8 @@ class EE_API UISelectButton : public UIPushButton { public: UISelectButton( const UIPushButton::CreateParams& Params ); + UISelectButton(); + virtual ~UISelectButton(); virtual Uint32 getType() const; diff --git a/include/eepp/ui/uiseparator.hpp b/include/eepp/ui/uiseparator.hpp index 67f2376e6..9378dd9da 100644 --- a/include/eepp/ui/uiseparator.hpp +++ b/include/eepp/ui/uiseparator.hpp @@ -8,6 +8,8 @@ namespace EE { namespace UI { class EE_API UISeparator : public UIControlAnim { public: UISeparator( UIControlAnim::CreateParams Params ); + + UISeparator(); virtual ~UISeparator(); diff --git a/include/eepp/ui/uisprite.hpp b/include/eepp/ui/uisprite.hpp index 8de77f365..fb33dbd17 100644 --- a/include/eepp/ui/uisprite.hpp +++ b/include/eepp/ui/uisprite.hpp @@ -17,7 +17,7 @@ class EE_API UISprite : public UIComplexControl { UIComplexControl::CreateParams(), Sprite( NULL ), SpriteRender( RN_NORMAL ), - DealloSprite( true ) + DeallocSprite( true ) { } @@ -25,11 +25,13 @@ class EE_API UISprite : public UIComplexControl { Graphics::Sprite * Sprite; EE_RENDER_MODE SpriteRender; - bool DealloSprite; + bool DeallocSprite; }; UISprite( const UISprite::CreateParams& Params ); + UISprite(); + virtual ~UISprite(); virtual Uint32 getType() const; @@ -55,6 +57,10 @@ class EE_API UISprite : public UIComplexControl { void setRenderMode( const EE_RENDER_MODE& render ); const Vector2i& getAlignOffset() const; + + void setDeallocSprite( const bool& dealloc ); + + bool getDeallocSprite(); protected: Graphics::Sprite * mSprite; EE_RENDER_MODE mRender; diff --git a/include/eepp/ui/uitextbox.hpp b/include/eepp/ui/uitextbox.hpp index d16b5d7b9..0480c670b 100644 --- a/include/eepp/ui/uitextbox.hpp +++ b/include/eepp/ui/uitextbox.hpp @@ -101,7 +101,7 @@ class EE_API UITextBox : public UIComplexControl { Int32 mSelCurInit; Int32 mSelCurEnd; - virtual void drawSelection(); + virtual void drawSelection(TextCache * textCache); virtual void onSizeChange(); diff --git a/include/eepp/ui/uitextinputpassword.hpp b/include/eepp/ui/uitextinputpassword.hpp index fb2e54594..80a348634 100644 --- a/include/eepp/ui/uitextinputpassword.hpp +++ b/include/eepp/ui/uitextinputpassword.hpp @@ -10,6 +10,8 @@ class UITextInputPassword : public UITextInput public: UITextInputPassword( const UITextInput::CreateParams& Params ); + UITextInputPassword(); + virtual void draw(); virtual const String& getText(); diff --git a/include/eepp/ui/uitheme.hpp b/include/eepp/ui/uitheme.hpp index faf94dfcc..f1a35608c 100644 --- a/include/eepp/ui/uitheme.hpp +++ b/include/eepp/ui/uitheme.hpp @@ -155,6 +155,14 @@ class EE_API UITheme : protected ResourceManager { virtual UIMessageBox * createMessageBox( UI_MSGBOX_TYPE Type = MSGBOX_OKCANCEL, const String& Message = String(), Uint32 WinFlags = UI_WIN_DEFAULT_FLAGS | UI_WIN_MODAL, UIControl * Parent = NULL, const Sizei& Size = Sizei(), const Vector2i& Pos = Vector2i(), const Uint32& Flags = UI_CONTROL_DEFAULT_FLAGS_CENTERED, Sizei MinWindowSize = Sizei(0,0), Uint8 BaseAlpha = 255 ); virtual UITabWidget * createTabWidget( UIControl * Parent = NULL, const Sizei& Size = Sizei(), const Vector2i& Pos = Vector2i(), const Uint32& Flags = UI_HALIGN_CENTER | UI_VALIGN_BOTTOM | UI_CONTROL_DEFAULT_ANCHOR, const bool& TabsClosable = false, const bool& SpecialBorderTabs = false , const Int32& TabSeparation = 0, const Uint32& MaxTextLength = 30, const Uint32& TabWidgetHeight = 0, const Uint32& TabTextAlign = UI_HALIGN_CENTER | UI_VALIGN_CENTER, const Uint32& MinTabWidth = 32, const Uint32& MaxTabWidth = 210 ); + + ColorA getMenuFontColor() const; + + void setMenuFontColor(const ColorA & menuFontColor); + + ColorA getMenuFontColorOver() const; + + void setMenuFontColorOver(const ColorA & menuFontColorOver); protected: std::string mName; Uint32 mNameHash; @@ -166,7 +174,9 @@ class EE_API UITheme : protected ResourceManager { ColorA mFontOverColor; ColorA mFontSelectedColor; ColorA mFontSelectionBackColor; - bool mUsedefaultThemeValues; + ColorA mMenuFontColor; + ColorA mMenuFontColorOver; + bool mUseDefaultThemeValues; std::list mUIElements; std::list mUIIcons; diff --git a/src/eepp/graphics/subtexture.cpp b/src/eepp/graphics/subtexture.cpp index 7138a356f..09dccb115 100644 --- a/src/eepp/graphics/subtexture.cpp +++ b/src/eepp/graphics/subtexture.cpp @@ -138,6 +138,10 @@ const Sizef& SubTexture::getDestSize() const { void SubTexture::setDestSize( const Sizef& destSize ) { mDestSize = destSize; + + if ( mOriDestSize.x == 0 && mOriDestSize.y == 0 ) { + mOriDestSize = destSize; + } } const Vector2i& SubTexture::getOffset() const { diff --git a/src/eepp/ui/uidefaulttheme.cpp b/src/eepp/ui/uidefaulttheme.cpp index d17848492..f71266cc8 100644 --- a/src/eepp/ui/uidefaulttheme.cpp +++ b/src/eepp/ui/uidefaulttheme.cpp @@ -17,6 +17,8 @@ UIDefaultTheme::UIDefaultTheme( const std::string& name, const std::string& Abbr setFontSelectedColor( ColorA( 255, 255, 255, 255 ) ); setFontShadowColor( ColorA( 50, 50, 50, 150 ) ); setFontSelectionBackColor( ColorA( 150, 150, 150, 255 ) ); + setMenuFontColor( ColorA( 230, 230, 230, 255 ) ); + setMenuFontColorOver( ColorA( 255, 255, 255, 255 ) ); } UIPopUpMenu * UIDefaultTheme::createPopUpMenu( UIControl * Parent, const Sizei& Size, const Vector2i& Pos, const Uint32& Flags, Recti PaddingContainer, Uint32 MinWidth, Uint32 MinSpaceForIcons, Uint32 MinRightMargin ) { diff --git a/src/eepp/ui/uilistbox.cpp b/src/eepp/ui/uilistbox.cpp index bd35a498c..a2c434227 100644 --- a/src/eepp/ui/uilistbox.cpp +++ b/src/eepp/ui/uilistbox.cpp @@ -73,7 +73,6 @@ UIListBox::UIListBox( UIListBox::CreateParams& Params ) : applyDefaultTheme(); } - UIListBox::UIListBox() : UIComplexControl(), mRowHeight(0), diff --git a/src/eepp/ui/uimenu.cpp b/src/eepp/ui/uimenu.cpp index 4679fe531..86e855cc8 100644 --- a/src/eepp/ui/uimenu.cpp +++ b/src/eepp/ui/uimenu.cpp @@ -28,6 +28,45 @@ UIMenu::UIMenu( UIMenu::CreateParams& Params ) : applyDefaultTheme(); } +UIMenu::UIMenu() : + UIComplexControl(), + mPadding(), + mFont( NULL ), + mFontColor(), + mFontShadowColor(), + mFontOverColor(), + mFontSelectedColor(), + mMinWidth( 100 ), + mMinSpaceForIcons( 24 ), + mMinRightMargin( 8 ), + mMaxWidth( 0 ), + mNextPosY( 0 ), + mBiggestIcon( mMinSpaceForIcons ), + mItemSelected( NULL ), + mItemSelectedIndex( eeINDEX_NOT_FOUND ), + mClickHide( false ), + mLastTickMove( 0 ) +{ + setFlags( UI_AUTO_SIZE ); + + UITheme * Theme = UIThemeManager::instance()->getDefaultTheme(); + + if ( NULL != Theme ) { + mFont = Theme->getFont(); + mFontColor = Theme->getMenuFontColor(); + mFontShadowColor = Theme->getFontShadowColor(); + mFontOverColor = Theme->getMenuFontColorOver(); + mFontSelectedColor = Theme->getFontSelectedColor(); + } + + if ( NULL == mFont ) + mFont = UIThemeManager::instance()->getDefaultFont(); + + onSizeChange(); + + applyDefaultTheme(); +} + UIMenu::~UIMenu() { } @@ -538,6 +577,55 @@ const Recti& UIMenu::getPadding() const { return mPadding; } +Font * UIMenu::getFont() const { + return mFont; +} + +void UIMenu::setFont(Font * font) { + mFont = font; +} + +ColorA UIMenu::getFontColor() const { + return mFontColor; +} + +void UIMenu::setFontColor(const ColorA & fontColor) { + mFontColor = fontColor; +} + +ColorA UIMenu::getFontShadowColor() const { + return mFontShadowColor; +} + +void UIMenu::setFontShadowColor(const ColorA & fontShadowColor) { + mFontShadowColor = fontShadowColor; +} + +ColorA UIMenu::getFontOverColor() const { + return mFontOverColor; +} + +void UIMenu::setFontOverColor(const ColorA & fontOverColor) { + mFontOverColor = fontOverColor; +} + +ColorA UIMenu::getFontSelectedColor() const { + return mFontSelectedColor; +} + +void UIMenu::setFontSelectedColor(const ColorA & fontSelectedColor) { + mFontSelectedColor = fontSelectedColor; +} + +Uint32 UIMenu::getMinRightMargin() const { + return mMinRightMargin; +} + +void UIMenu::setMinRightMargin(const Uint32 & minRightMargin) { + mMinRightMargin = minRightMargin; + rePosControls(); +} + void UIMenu::fixMenuPos( Vector2i& Pos, UIMenu * Menu, UIMenu * Parent, UIMenuSubMenu * SubMenu ) { eeAABB qScreen( 0.f, 0.f, UIManager::instance()->getMainControl()->getRealSize().getWidth(), UIManager::instance()->getMainControl()->getRealSize().getHeight() ); eeAABB qPos( Pos.x, Pos.y, Pos.x + Menu->getRealSize().getWidth(), Pos.y + Menu->getRealSize().getHeight() ); diff --git a/src/eepp/ui/uimenusubmenu.cpp b/src/eepp/ui/uimenusubmenu.cpp index c7a8b64bb..9dd225a04 100644 --- a/src/eepp/ui/uimenusubmenu.cpp +++ b/src/eepp/ui/uimenusubmenu.cpp @@ -27,6 +27,25 @@ UIMenuSubMenu::UIMenuSubMenu( UIMenuSubMenu::CreateParams& Params ) : applyDefaultTheme(); } +UIMenuSubMenu::UIMenuSubMenu() : + UIMenuItem(), + mSubMenu( NULL ), + mSkinArrow( NULL ), + mArrow( NULL ), + mTimeOver( 0.f ), + mMaxTime( 200.f ), + mCbId( 0 ), + mCbId2( 0 ) +{ + mArrow = eeNew( UIGfx, () ); + mArrow->setParent( this ); + mArrow->setFlags( UI_AUTO_SIZE ); + mArrow->setVisible( true ); + mArrow->setEnabled( false ); + + applyDefaultTheme(); +} + UIMenuSubMenu::~UIMenuSubMenu() { } @@ -155,4 +174,12 @@ bool UIMenuSubMenu::inheritsFrom( const Uint32 Type ) { return false; } +Float UIMenuSubMenu::getMouseOverTimeShowMenu() const { + return mMaxTime; +} + +void UIMenuSubMenu::setMouseOverTimeShowMenu(const Float & maxTime) { + mMaxTime = maxTime; +} + }} diff --git a/src/eepp/ui/uipopupmenu.cpp b/src/eepp/ui/uipopupmenu.cpp index 2dfd4d98b..1573a7201 100644 --- a/src/eepp/ui/uipopupmenu.cpp +++ b/src/eepp/ui/uipopupmenu.cpp @@ -11,6 +11,14 @@ UIPopUpMenu::UIPopUpMenu( UIPopUpMenu::CreateParams Params ) : applyDefaultTheme(); } +UIPopUpMenu::UIPopUpMenu() : + UIMenu() +{ + setVisible( false ); + setEnabled( false ); + applyDefaultTheme(); +} + UIPopUpMenu::~UIPopUpMenu() { onClose(); } diff --git a/src/eepp/ui/uiselectbutton.cpp b/src/eepp/ui/uiselectbutton.cpp index 2c377d977..2e4ddaf4e 100644 --- a/src/eepp/ui/uiselectbutton.cpp +++ b/src/eepp/ui/uiselectbutton.cpp @@ -8,6 +8,11 @@ UISelectButton::UISelectButton( const UIPushButton::CreateParams& Params ) : { } +UISelectButton::UISelectButton() : + UIPushButton() +{ +} + UISelectButton::~UISelectButton() { } diff --git a/src/eepp/ui/uiseparator.cpp b/src/eepp/ui/uiseparator.cpp index ae6d5d8d4..d85f1a37f 100644 --- a/src/eepp/ui/uiseparator.cpp +++ b/src/eepp/ui/uiseparator.cpp @@ -9,6 +9,12 @@ UISeparator::UISeparator( UIControlAnim::CreateParams Params ) : applyDefaultTheme(); } +UISeparator::UISeparator() : + UIControlAnim() +{ + applyDefaultTheme(); +} + UISeparator::~UISeparator() { } diff --git a/src/eepp/ui/uisprite.cpp b/src/eepp/ui/uisprite.cpp index 54ac0bb9b..92833d91a 100644 --- a/src/eepp/ui/uisprite.cpp +++ b/src/eepp/ui/uisprite.cpp @@ -10,7 +10,7 @@ UISprite::UISprite( const UISprite::CreateParams& Params ) : mAlignOffset(0,0), mSubTextureLast(NULL) { - if ( Params.DealloSprite ) + if ( Params.DeallocSprite ) mControlFlags |= UI_CTRL_FLAG_FREE_USE; if ( NULL != mSprite ) { @@ -20,6 +20,15 @@ UISprite::UISprite( const UISprite::CreateParams& Params ) : } } +UISprite::UISprite() : + UIComplexControl(), + mSprite( NULL ), + mRender( RN_NORMAL ), + mAlignOffset(0,0), + mSubTextureLast(NULL) +{ +} + UISprite::~UISprite() { if ( deallocSprite() ) eeSAFE_DELETE( mSprite ); @@ -156,6 +165,14 @@ const Vector2i& UISprite::getAlignOffset() const { return mAlignOffset; } +void UISprite::setDeallocSprite( const bool& dealloc ) { + writeCtrlFlag( UI_CTRL_FLAG_FREE_USE, dealloc ? 1 : 0 ); +} + +bool UISprite::getDeallocSprite() { + return mControlFlags & UI_CTRL_FLAG_FREE_USE; +} + void UISprite::onSizeChange() { autoAlign(); } diff --git a/src/eepp/ui/uitextbox.cpp b/src/eepp/ui/uitextbox.cpp index b76c947be..f4697a593 100644 --- a/src/eepp/ui/uitextbox.cpp +++ b/src/eepp/ui/uitextbox.cpp @@ -23,10 +23,11 @@ UITextBox::UITextBox( const UITextBox::CreateParams& Params ) : mTextCache->setShadowColor( mFontShadowColor ); if ( NULL == Params.Font ) { - if ( NULL != UIThemeManager::instance()->getDefaultFont() ) + if ( NULL != UIThemeManager::instance()->getDefaultFont() ) { mTextCache->setFont( UIThemeManager::instance()->getDefaultFont() ); - else + } else { eePRINTL( "UITextBox::UITextBox : Created a UI TextBox without a defined font." ); + } } autoAlign(); @@ -43,20 +44,21 @@ UITextBox::UITextBox() : { mTextCache = eeNew( TextCache, () ); - if ( NULL != UIThemeManager::instance()->getDefaultFont() ) { - setFont( UIThemeManager::instance()->getDefaultFont() ); - } else { - eePRINTL( "UITextBox::UITextBox : Created a UI TextBox without a defined font." ); - } - UITheme * Theme = UIThemeManager::instance()->getDefaultTheme(); if ( NULL != UIThemeManager::instance()->getDefaultTheme() ) { + setFont( Theme->getFont() ); setFontColor( Theme->getFontColor() ); setFontShadowColor( Theme->getFontShadowColor() ); setSelectionBackColor( Theme->getFontSelectionBackColor() ); } + if ( NULL == getFont() && NULL != UIThemeManager::instance()->getDefaultFont() ) { + setFont( UIThemeManager::instance()->getDefaultFont() ); + } else { + eePRINTL( "UITextBox::UITextBox : Created a UI TextBox without a defined font." ); + } + autoAlign(); } @@ -76,7 +78,7 @@ void UITextBox::draw() { if ( mVisible && 0.f != mAlpha ) { UIControlAnim::draw(); - drawSelection(); + drawSelection( mTextCache ); if ( mTextCache->getTextWidth() ) { if ( mFlags & UI_CLIP_ENABLE ) { @@ -337,12 +339,12 @@ Uint32 UITextBox::onMouseDown( const Vector2i& Pos, const Uint32 Flags ) { return UIComplexControl::onMouseDown( Pos, Flags ); } -void UITextBox::drawSelection() { +void UITextBox::drawSelection( TextCache * textCache ) { if ( selCurInit() != selCurEnd() ) { Int32 init = eemin( selCurInit(), selCurEnd() ); Int32 end = eemax( selCurInit(), selCurEnd() ); - if ( init < 0 && end > (Int32)mTextCache->getText().size() ) { + if ( init < 0 && end > (Int32)textCache->getText().size() ) { return; } @@ -353,19 +355,19 @@ void UITextBox::drawSelection() { P.setColor( mFontSelectionBackColor ); do { - initPos = mTextCache->getFont()->getCursorPos( mTextCache->getText(), init ); - lastEnd = mTextCache->getText().find_first_of( '\n', init ); + initPos = textCache->getFont()->getCursorPos( textCache->getText(), init ); + lastEnd = textCache->getText().find_first_of( '\n', init ); if ( lastEnd < end && -1 != lastEnd ) { - endPos = mTextCache->getFont()->getCursorPos( mTextCache->getText(), lastEnd ); + endPos = textCache->getFont()->getCursorPos( textCache->getText(), lastEnd ); init = lastEnd + 1; } else { - endPos = mTextCache->getFont()->getCursorPos( mTextCache->getText(), end ); + endPos = textCache->getFont()->getCursorPos( textCache->getText(), end ); lastEnd = end; } P.drawRectangle( Rectf( mScreenPos.x + initPos.x + mAlignOffset.x + mRealPadding.Left, - mScreenPos.y + initPos.y - mTextCache->getFont()->getFontHeight() + mAlignOffset.y + mRealPadding.Top, + mScreenPos.y + initPos.y - textCache->getFont()->getFontHeight() + mAlignOffset.y + mRealPadding.Top, mScreenPos.x + endPos.x + mAlignOffset.x + mRealPadding.Left, mScreenPos.y + endPos.y + mAlignOffset.y + mRealPadding.Top ) ); diff --git a/src/eepp/ui/uitextinputpassword.cpp b/src/eepp/ui/uitextinputpassword.cpp index 93d27d9ed..6c6fcc208 100644 --- a/src/eepp/ui/uitextinputpassword.cpp +++ b/src/eepp/ui/uitextinputpassword.cpp @@ -10,16 +10,20 @@ UITextInputPassword::UITextInputPassword( const UITextInput::CreateParams& Param UITextInput( Params ) { mPassCache = eeNew( TextCache, () ); - mPassCache->setFont( Params.Font ); + mPassCache->setFont( mTextCache->getFont() ); mPassCache->setColor( mFontColor ); mPassCache->setShadowColor( mFontShadowColor ); - if ( NULL == Params.Font ) { - if ( NULL != UIThemeManager::instance()->getDefaultFont() ) - mPassCache->setFont( UIThemeManager::instance()->getDefaultFont() ); - else - eePRINTL( "UITextInputPassword::UITextInputPassword : Created a UI TextInputPassword without a defined font." ); - } + autoAlign(); +} + +UITextInputPassword::UITextInputPassword() : + UITextInput() +{ + mPassCache = eeNew( TextCache, () ); + mPassCache->setFont( mTextCache->getFont() ); + mPassCache->setColor( mFontColor ); + mPassCache->setShadowColor( mFontShadowColor ); autoAlign(); } @@ -28,6 +32,8 @@ void UITextInputPassword::draw() { if ( mVisible && 0.f != mAlpha ) { UIControlAnim::draw(); + drawSelection( mPassCache ); + if ( mPassCache->getTextWidth() ) { if ( mFlags & UI_CLIP_ENABLE ) { UIManager::instance()->clipSmartEnable( @@ -82,10 +88,10 @@ void UITextInputPassword::alignFix() { void UITextInputPassword::autoAlign() { switch ( fontHAlignGet( getFlags() ) ) { case UI_HALIGN_CENTER: - mAlignOffset.x = (Float)( (Int32)( mSize.x - mPassCache->getTextWidth() ) / 2 ); + mAlignOffset.x = (Float)( (Int32)( mRealSize.x - mPassCache->getTextWidth() ) / 2 ); break; case UI_HALIGN_RIGHT: - mAlignOffset.x = ( (Float)mSize.x - (Float)mPassCache->getTextWidth() ); + mAlignOffset.x = ( (Float)mRealSize.x - (Float)mPassCache->getTextWidth() ); break; case UI_HALIGN_LEFT: mAlignOffset.x = 0.f; @@ -94,10 +100,10 @@ void UITextInputPassword::autoAlign() { switch ( fontVAlignGet( getFlags() ) ) { case UI_VALIGN_CENTER: - mAlignOffset.y = (Float)( ( (Int32)( mSize.y - mPassCache->getTextHeight() ) ) / 2 ) - 1; + mAlignOffset.y = (Float)( ( (Int32)( mRealSize.y - mPassCache->getTextHeight() ) ) / 2 ) - 1; break; case UI_VALIGN_BOTTOM: - mAlignOffset.y = ( (Float)mSize.y - (Float)mPassCache->getTextHeight() ); + mAlignOffset.y = ( (Float)mRealSize.y - (Float)mPassCache->getTextHeight() ); break; case UI_VALIGN_TOP: mAlignOffset.y = 0.f; diff --git a/src/eepp/ui/uitheme.cpp b/src/eepp/ui/uitheme.cpp index ccfd19d9f..d1aad3b53 100644 --- a/src/eepp/ui/uitheme.cpp +++ b/src/eepp/ui/uitheme.cpp @@ -332,7 +332,7 @@ UITheme::UITheme(const std::string& name, const std::string& Abbr, Graphics::Fon mFontOverColor( 0, 0, 0, 255 ), mFontSelectedColor( 0, 0, 0, 255 ), mFontSelectionBackColor( 150, 150, 150, 255 ), - mUsedefaultThemeValues( true ) + mUseDefaultThemeValues( true ) { } @@ -404,11 +404,11 @@ void UITheme::setFontSelectedColor( const ColorA& Color ) { } void UITheme::setUseDefaultThemeValues( const bool& Use ) { - mUsedefaultThemeValues = Use; + mUseDefaultThemeValues = Use; } const bool& UITheme::getUseDefaultThemeValues() const { - return mUsedefaultThemeValues; + return mUseDefaultThemeValues; } Graphics::TextureAtlas * UITheme::getTextureAtlas() const { @@ -449,7 +449,7 @@ UISprite * UITheme::createSprite( Sprite * Sprite, UIControl * Parent, const Siz SpriteParams.Flags = Flags; SpriteParams.Sprite = Sprite; SpriteParams.SpriteRender = SpriteRender; - SpriteParams.DealloSprite = DealloSprite; + SpriteParams.DeallocSprite = DealloSprite; UISprite * Spr = eeNew( UISprite, ( SpriteParams ) ); Spr->setVisible( true ); Spr->setEnabled( true ); @@ -799,6 +799,26 @@ UITabWidget * UITheme::createTabWidget( UIControl *Parent, const Sizei &Size, co return Ctrl; } +ColorA UITheme::getMenuFontColor() const +{ + return mMenuFontColor; +} + +void UITheme::setMenuFontColor(const ColorA & menuFontColor) +{ + mMenuFontColor = menuFontColor; +} + +ColorA UITheme::getMenuFontColorOver() const +{ + return mMenuFontColorOver; +} + +void UITheme::setMenuFontColorOver(const ColorA & menuFontColorOver) +{ + mMenuFontColorOver = menuFontColorOver; +} + ColorA UITheme::getFontSelectionBackColor() const { return mFontSelectionBackColor; diff --git a/src/test/eetest.cpp b/src/test/eetest.cpp index ded0be2c2..cccd7c976 100644 --- a/src/test/eetest.cpp +++ b/src/test/eetest.cpp @@ -616,7 +616,7 @@ void EETest::createNewUI() { cbox->setFontColor( 0x000000FF ); UIGfx * gfx = eeNew( UIGfx, () ); - gfx->setPosition( 50, 132 )->setSize( 16, 16 ); + gfx->setPosition( 50, 140 )->setSize( 16, 16 ); gfx->setBackgroundFillEnabled( true )->setColor( 0x33333333 ); gfx->setSubTexture( mTheme->getIconByName( "ok" ) ); @@ -631,10 +631,17 @@ void EETest::createNewUI() { UITextInput * textInput = eeNew( UITextInput, () ); textInput->setPosition( 50, 210 )->setSize( 200, 0 ); + UITextInputPassword * textInputPass = eeNew( UITextInputPassword, () ); + textInputPass->setPosition( 50, 245 )->setSize( 200, 0 ); + UIListBox * listBox = eeNew( UIListBox, () ); - listBox->setPosition( 50, 320 )->setSize( 200, 160 ); + listBox->setPosition( 50, 360 )->setSize( 200, 160 ); listBox->addListBoxItems( str ); + UISprite * sprite = eeNew( UISprite, () ); + sprite->setPosition( 50, 540 ); + sprite->setSprite( &SP ); + UIScrollBar * scrollBar = eeNew( UIScrollBar, () ); scrollBar->setOrientation( UI_HORIZONTAL )->setPosition( 200, 0 )->setSize( 100, 0 ); @@ -642,7 +649,7 @@ void EETest::createNewUI() { scrollBar2->setOrientation( UI_VERTICAL )->setPosition( 300, 0 )->setSize( 0, 100 ); UIDropDownList * dropdownList = eeNew( UIDropDownList, () ); - dropdownList->setPosition( 50, 240 )->setSize( 200, 0 ); + dropdownList->setPosition( 50, 320 )->setSize( 200, 0 ); dropdownList->getListBox()->addListBoxItem( "Test 1" ); dropdownList->getListBox()->addListBoxItem( "Test 2" ); dropdownList->getListBox()->addListBoxItem( "Test 3" ); @@ -684,7 +691,6 @@ void EETest::createNewUI() { Cell->setCell( 2, TxtInput ); genGrid->add( Cell ); } - /**/ UIWindow * MenuCont = eeNew( UIWindow, () ); MenuCont->setPosition( 350, 400 )->setSize( 200, 125 ); @@ -692,13 +698,13 @@ void EETest::createNewUI() { UIWinMenu * WinMenu = eeNew( UIWinMenu, () ); WinMenu->setParent( MenuCont->getContainer() ); - UIPopUpMenu * PopMenu = mTheme->createPopUpMenu(); + UIPopUpMenu * PopMenu = eeNew( UIPopUpMenu, () ); PopMenu->add( "File" ); PopMenu->add( "Open" ); PopMenu->add( "Close" ); PopMenu->add( "Quit" ); - UIPopUpMenu * PopMenu2 = mTheme->createPopUpMenu(); + UIPopUpMenu * PopMenu2 = eeNew( UIPopUpMenu, () ); PopMenu2->add( "Bla" ); PopMenu2->add( "Bla 2" ); PopMenu2->add( "Bla 3" ); @@ -706,6 +712,7 @@ void EETest::createNewUI() { WinMenu->addMenuButton( "File", PopMenu ); WinMenu->addMenuButton( "Edit", PopMenu2 ); + /**/ } void EETest::createMapEditor() {