mirror of
https://github.com/SpartanJ/eepp.git
synced 2026-05-30 10:06:35 +03:00
More refactor and fixes.
--HG-- branch : dev-font
This commit is contained in:
@@ -5,6 +5,16 @@
|
||||
#include <eepp/ui/uiwindow.hpp>
|
||||
#include <eepp/ui/uimenucheckbox.hpp>
|
||||
#include <eepp/ui/uiselectbutton.hpp>
|
||||
#include <eepp/ui/uimanager.hpp>
|
||||
#include <eepp/ui/uithememanager.hpp>
|
||||
#include <eepp/ui/uiwinmenu.hpp>
|
||||
#include <eepp/ui/uipopupmenu.hpp>
|
||||
#include <eepp/ui/uispinbox.hpp>
|
||||
#include <eepp/ui/uicheckbox.hpp>
|
||||
#include <eepp/ui/uicommondialog.hpp>
|
||||
#include <eepp/ui/uimessagebox.hpp>
|
||||
#include <eepp/ui/uitabwidget.hpp>
|
||||
#include <eepp/ui/tools/textureatlaseditor.hpp>
|
||||
#include <eepp/gaming/maplayer.hpp>
|
||||
#include <eepp/gaming/maplight.hpp>
|
||||
#include <eepp/gaming/gameobject.hpp>
|
||||
|
||||
@@ -19,16 +19,17 @@
|
||||
#include <eepp/graphics/sprite.hpp>
|
||||
#include <eepp/graphics/particle.hpp>
|
||||
#include <eepp/graphics/particlesystem.hpp>
|
||||
#include <eepp/graphics/fontstyleconfig.hpp>
|
||||
#include <eepp/graphics/font.hpp>
|
||||
#include <eepp/graphics/fonttruetype.hpp>
|
||||
#include <eepp/graphics/fonttruetypeloader.hpp>
|
||||
#include <eepp/graphics/fontmanager.hpp>
|
||||
#include <eepp/graphics/text.hpp>
|
||||
#include <eepp/graphics/primitives.hpp>
|
||||
#include <eepp/graphics/scrollparallax.hpp>
|
||||
#include <eepp/graphics/console.hpp>
|
||||
#include <eepp/graphics/batchrenderer.hpp>
|
||||
#include <eepp/graphics/globalbatchrenderer.hpp>
|
||||
#include <eepp/graphics/text.hpp>
|
||||
#include <eepp/graphics/shader.hpp>
|
||||
#include <eepp/graphics/shaderprogram.hpp>
|
||||
#include <eepp/graphics/shaderprogrammanager.hpp>
|
||||
|
||||
@@ -30,9 +30,6 @@ inline Uint32 fontVAlignGet( Uint32 Flags ) {
|
||||
return Flags & FONT_DRAW_VALIGN_MASK;
|
||||
}
|
||||
|
||||
#define FONT_DRAW_SHADOW (1 << 5)
|
||||
#define FONT_DRAW_VERTICAL (1 << 6)
|
||||
|
||||
#define FONT_DRAW_ALIGN_MASK ( FONT_DRAW_VALIGN_MASK | FONT_DRAW_HALIGN_MASK )
|
||||
|
||||
struct VertexCoords {
|
||||
|
||||
75
include/eepp/graphics/fontstyleconfig.hpp
Normal file
75
include/eepp/graphics/fontstyleconfig.hpp
Normal file
@@ -0,0 +1,75 @@
|
||||
#ifndef EE_GRAPHICS_FONTSTYLECONFIG_HPP
|
||||
#define EE_GRAPHICS_FONTSTYLECONFIG_HPP
|
||||
|
||||
#include <eepp/config.hpp>
|
||||
#include <eepp/system/colors.hpp>
|
||||
using namespace EE::System;
|
||||
|
||||
namespace EE { namespace Graphics {
|
||||
|
||||
class Font;
|
||||
|
||||
class FontStyleConfig {
|
||||
public:
|
||||
Graphics::Font * getFont() const {
|
||||
return Font;
|
||||
}
|
||||
|
||||
const ColorA& getFontColor() const {
|
||||
return Color;
|
||||
}
|
||||
|
||||
const ColorA& getFontShadowColor() const {
|
||||
return ShadowColor;
|
||||
}
|
||||
|
||||
Uint32 getFontCharacterSize() const {
|
||||
return CharacterSize;
|
||||
}
|
||||
|
||||
Uint32 getFontStyle() const {
|
||||
return Style;
|
||||
}
|
||||
|
||||
Float getOutlineThickness() const {
|
||||
return OutlineThickness;
|
||||
}
|
||||
|
||||
ColorA getOutlineColor() const {
|
||||
return OutlineColor;
|
||||
}
|
||||
|
||||
FontStyleConfig() {}
|
||||
|
||||
FontStyleConfig( const FontStyleConfig& fontStyleConfig ) :
|
||||
Font( fontStyleConfig.Font ),
|
||||
CharacterSize( fontStyleConfig.CharacterSize ),
|
||||
Style( fontStyleConfig.Style ),
|
||||
Color( fontStyleConfig.Color ),
|
||||
ShadowColor( fontStyleConfig.ShadowColor ),
|
||||
OutlineThickness( fontStyleConfig.OutlineThickness ),
|
||||
OutlineColor( fontStyleConfig.OutlineColor )
|
||||
{}
|
||||
|
||||
virtual void updateFontStyleConfig( const FontStyleConfig& fontStyleConfig ) {
|
||||
Font = fontStyleConfig.Font;
|
||||
Style = fontStyleConfig.Style;
|
||||
CharacterSize = fontStyleConfig.CharacterSize;
|
||||
Color = fontStyleConfig.Color;
|
||||
ShadowColor = fontStyleConfig.ShadowColor;
|
||||
OutlineThickness = fontStyleConfig.OutlineThickness;
|
||||
OutlineColor = fontStyleConfig.OutlineColor;
|
||||
}
|
||||
|
||||
Graphics::Font * Font = NULL;
|
||||
Uint32 CharacterSize = 12;
|
||||
Uint32 Style = 0;
|
||||
ColorA Color = ColorA(255,255,255,255);
|
||||
ColorA ShadowColor = ColorA(50,50,50,230);
|
||||
Float OutlineThickness = 0;
|
||||
ColorA OutlineColor = ColorA(0,0,0,255);
|
||||
};
|
||||
|
||||
}}
|
||||
|
||||
#endif
|
||||
@@ -4,9 +4,6 @@
|
||||
#include <eepp/graphics/base.hpp>
|
||||
#include <eepp/graphics/texture.hpp>
|
||||
#include <eepp/graphics/font.hpp>
|
||||
#include <map>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
namespace EE { namespace System {
|
||||
class Pack;
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
|
||||
#include <eepp/graphics/font.hpp>
|
||||
#include <eepp/graphics/fonthelper.hpp>
|
||||
#include <eepp/graphics/fontstyleconfig.hpp>
|
||||
|
||||
namespace EE { namespace Graphics {
|
||||
|
||||
@@ -14,7 +15,8 @@ class EE_API Text {
|
||||
Bold = 1 << 0, ///< Bold characters
|
||||
Italic = 1 << 1, ///< Italic characters
|
||||
Underlined = 1 << 2, ///< Underlined characters
|
||||
StrikeThrough = 1 << 3 ///< Strike through characters
|
||||
StrikeThrough = 1 << 3, ///< Strike through characters
|
||||
Shadow = 1 << 4 ///< Draw a shadow below the text
|
||||
};
|
||||
|
||||
Text();
|
||||
@@ -99,6 +101,8 @@ class EE_API Text {
|
||||
|
||||
/** Force to cache the width of the current text */
|
||||
void cacheWidth();
|
||||
|
||||
void setStyleConfig( const FontStyleConfig& styleConfig );
|
||||
protected:
|
||||
void ensureGeometryUpdate();
|
||||
|
||||
|
||||
@@ -31,6 +31,8 @@ class EE_API UICheckBox : public UITextView {
|
||||
Int32 getTextSeparation() const;
|
||||
|
||||
void setTextSeparation(const Int32 & textSeparation);
|
||||
|
||||
virtual void loadFromXmlNode( const pugi::xml_node& node );
|
||||
protected:
|
||||
UIControlAnim * mActiveButton;
|
||||
UIControlAnim * mInactiveButton;
|
||||
|
||||
@@ -28,6 +28,8 @@ class EE_API UIComboBox : public UIWidget {
|
||||
InputTextBuffer * getInputTextBuffer();
|
||||
|
||||
const String& getText();
|
||||
|
||||
void loadFromXmlNode(const pugi::xml_node & node);
|
||||
protected:
|
||||
UIDropDownList * mDropDownList;
|
||||
UIControlAnim * mButton;
|
||||
|
||||
@@ -34,15 +34,15 @@ class EE_API UIDropDownList : public UITextInput {
|
||||
|
||||
void setMaxNumVisibleItems(const Uint32 & maxNumVisibleItems);
|
||||
|
||||
DropDownListStyleConfig getStyleConfig() const;
|
||||
UIDropDownListStyleConfig getStyleConfig() const;
|
||||
|
||||
void setStyleConfig(const DropDownListStyleConfig & styleConfig);
|
||||
void setStyleConfig(const UIDropDownListStyleConfig & styleConfig);
|
||||
|
||||
void loadFromXmlNode(const pugi::xml_node & node);
|
||||
protected:
|
||||
friend class UIComboBox;
|
||||
|
||||
DropDownListStyleConfig mStyleConfig;
|
||||
UIDropDownListStyleConfig mStyleConfig;
|
||||
UIListBox * mListBox;
|
||||
UIControl * mFriendCtrl;
|
||||
|
||||
|
||||
@@ -45,8 +45,6 @@ enum UI_FLAGS {
|
||||
UI_HALIGN_CENTER = FONT_DRAW_CENTER,
|
||||
UI_VALIGN_BOTTOM = FONT_DRAW_BOTTOM,
|
||||
UI_VALIGN_CENTER = FONT_DRAW_MIDDLE,
|
||||
UI_DRAW_SHADOW = FONT_DRAW_SHADOW,
|
||||
UI_TEXT_DRAW_VERTICAL = FONT_DRAW_VERTICAL,
|
||||
UI_AUTO_SIZE = (1 << 7),
|
||||
UI_FILL_BACKGROUND = (1 << 9),
|
||||
UI_BORDER = (1 << 10),
|
||||
@@ -103,7 +101,8 @@ enum UI_CONTROL_TYPES {
|
||||
UI_TYPE_TAB,
|
||||
UI_TYPE_TABWIDGET,
|
||||
UI_TYPE_LINEAR_LAYOUT,
|
||||
UI_TYPE_USER = 100
|
||||
UI_TYPE_RELATIVE_LAYOUT,
|
||||
UI_TYPE_USER = 10000
|
||||
};
|
||||
|
||||
enum UI_SCROLLBAR_MODE {
|
||||
|
||||
@@ -120,9 +120,9 @@ class EE_API UIListBox : public UIWidget {
|
||||
|
||||
void setTouchDragDeceleration(const Float & touchDragDeceleration);
|
||||
|
||||
FontStyleConfig getFontStyleConfig() const;
|
||||
UIFontStyleConfig getFontStyleConfig() const;
|
||||
|
||||
void setFontStyleConfig(const FontStyleConfig & fontStyleConfig);
|
||||
void setFontStyleConfig(const UIFontStyleConfig & fontStyleConfig);
|
||||
|
||||
void loadFromXmlNode(const pugi::xml_node & node);
|
||||
protected:
|
||||
@@ -130,7 +130,7 @@ class EE_API UIListBox : public UIWidget {
|
||||
friend class UIItemContainer<UIListBox>;
|
||||
friend class UIDropDownList;
|
||||
|
||||
FontStyleConfig mFontStyleConfig;
|
||||
UIFontStyleConfig mFontStyleConfig;
|
||||
Uint32 mRowHeight;
|
||||
UI_SCROLLBAR_MODE mVScrollMode;
|
||||
UI_SCROLLBAR_MODE mHScrollMode;
|
||||
|
||||
@@ -121,7 +121,7 @@ class EE_API UIManager {
|
||||
|
||||
void setCursor( EE_CURSOR_TYPE cursor );
|
||||
|
||||
void loadLayout( const std::string& layoutPath );
|
||||
void loadLayoutFromFile( const std::string& layoutPath );
|
||||
|
||||
void loadLayoutFromString( const std::string& layoutString );
|
||||
|
||||
|
||||
@@ -64,9 +64,9 @@ class EE_API UIMenu : public UIWidget {
|
||||
|
||||
void setMinRightMargin(const Uint32 & minRightMargin);
|
||||
|
||||
TooltipStyleConfig getFontStyleConfig() const;
|
||||
UITooltipStyleConfig getFontStyleConfig() const;
|
||||
|
||||
void setFontStyleConfig(const TooltipStyleConfig & fontStyleConfig);
|
||||
void setFontStyleConfig(const UITooltipStyleConfig & fontStyleConfig);
|
||||
|
||||
protected:
|
||||
friend class UIMenuItem;
|
||||
@@ -74,7 +74,7 @@ class EE_API UIMenu : public UIWidget {
|
||||
friend class UIMenuSubMenu;
|
||||
|
||||
std::deque<UIControl *> mItems;
|
||||
MenuStyleConfig mStyleConfig;
|
||||
UIMenuStyleConfig mStyleConfig;
|
||||
Uint32 mMaxWidth;
|
||||
Uint32 mNextPosY;
|
||||
Uint32 mBiggestIcon;
|
||||
|
||||
@@ -39,7 +39,7 @@ class EE_API UIProgressBar : public UIWidget {
|
||||
|
||||
const bool& getVerticalExpand() const;
|
||||
|
||||
void setFillerPadding( const Rectf& margin );
|
||||
void setFillerPadding( const Rectf& padding );
|
||||
|
||||
const Rectf& getFillerPadding() const;
|
||||
|
||||
@@ -48,8 +48,10 @@ class EE_API UIProgressBar : public UIWidget {
|
||||
const bool& getDisplayPercent() const;
|
||||
|
||||
UITextView * getTextBox() const;
|
||||
|
||||
virtual void loadFromXmlNode( const pugi::xml_node& node );
|
||||
protected:
|
||||
ProgressBarStyleConfig mStyleConfig;
|
||||
UIProgressBarStyleConfig mStyleConfig;
|
||||
Float mProgress;
|
||||
Float mTotalSteps;
|
||||
ScrollParallax * mParallax;
|
||||
|
||||
@@ -55,13 +55,29 @@ class EE_API UIPushButton : public UIWidget {
|
||||
|
||||
void setFontShadowColor( const ColorA& color );
|
||||
|
||||
TooltipStyleConfig getStyleConfig() const;
|
||||
Uint32 getCharacterSize();
|
||||
|
||||
void setStyleConfig(const PushButtonStyleConfig & styleConfig);
|
||||
void setCharacterSize( const Uint32& characterSize );
|
||||
|
||||
const Uint32& getFontStyle() const;
|
||||
|
||||
UIPushButton * setFontStyle( const Uint32& fontStyle );
|
||||
|
||||
const Float & getOutlineThickness() const;
|
||||
|
||||
UIPushButton * setOutlineThickness( const Float& outlineThickness );
|
||||
|
||||
const ColorA& getOutlineColor() const;
|
||||
|
||||
UIPushButton * setOutlineColor( const ColorA& outlineColor );
|
||||
|
||||
UITooltipStyleConfig getStyleConfig() const;
|
||||
|
||||
void setStyleConfig(const UIPushButtonStyleConfig & styleConfig);
|
||||
|
||||
virtual void loadFromXmlNode( const pugi::xml_node& node );
|
||||
protected:
|
||||
PushButtonStyleConfig mStyleConfig;
|
||||
UIPushButtonStyleConfig mStyleConfig;
|
||||
UIImage * mIcon;
|
||||
UITextView * mTextBox;
|
||||
|
||||
|
||||
@@ -31,6 +31,8 @@ class EE_API UIRadioButton : public UITextView {
|
||||
Int32 getTextSeparation() const;
|
||||
|
||||
void setTextSeparation(const Int32 & textSeparation);
|
||||
|
||||
virtual void loadFromXmlNode( const pugi::xml_node& node );
|
||||
protected:
|
||||
UIControlAnim * mActiveButton;
|
||||
UIControlAnim * mInactiveButton;
|
||||
|
||||
@@ -11,6 +11,10 @@ class EE_API UIRelativeLayout : public UIWidget {
|
||||
|
||||
UIRelativeLayout();
|
||||
|
||||
virtual Uint32 getType() const;
|
||||
|
||||
virtual bool isType( const Uint32& type ) const;
|
||||
|
||||
UIRelativeLayout * add( UIWidget * widget );
|
||||
protected:
|
||||
virtual Uint32 onMessage(const UIMessage * Msg);
|
||||
|
||||
@@ -57,6 +57,8 @@ class EE_API UIScrollBar : public UIWidget {
|
||||
bool getExpandBackground() const;
|
||||
|
||||
void setExpandBackground( bool expandBackground );
|
||||
|
||||
virtual void loadFromXmlNode( const pugi::xml_node& node );
|
||||
protected:
|
||||
UISlider * mSlider;
|
||||
UIControlAnim * mBtnUp;
|
||||
|
||||
@@ -26,6 +26,8 @@ class EE_API UISelectButton : public UIPushButton {
|
||||
void setFontSelectedColor( const ColorA& color );
|
||||
|
||||
const ColorA& getFontSelectedColor() const;
|
||||
|
||||
virtual void loadFromXmlNode( const pugi::xml_node& node );
|
||||
protected:
|
||||
virtual void onStateChange();
|
||||
};
|
||||
|
||||
@@ -63,11 +63,13 @@ class EE_API UISlider : public UIWidget {
|
||||
Float getPageStep() const;
|
||||
|
||||
void setPageStep( const Float & pageStep );
|
||||
|
||||
virtual void loadFromXmlNode( const pugi::xml_node& node );
|
||||
protected:
|
||||
friend class Private::UISliderButton;
|
||||
|
||||
UI_ORIENTATION mOrientation;
|
||||
SliderStyleConfig mStyleConfig;
|
||||
UISliderStyleConfig mStyleConfig;
|
||||
UIControlAnim * mBackSlider;
|
||||
Private::UISliderButton * mSlider;
|
||||
Float mMinValue;
|
||||
|
||||
@@ -55,6 +55,8 @@ class EE_API UISpinBox : public UIWidget {
|
||||
UISpinBox * setAllowOnlyNumbers( bool allow );
|
||||
|
||||
bool dotsInNumbersAllowed();
|
||||
|
||||
virtual void loadFromXmlNode( const pugi::xml_node& node );
|
||||
protected:
|
||||
UITextInput * mInput;
|
||||
UIControlAnim * mPushUp;
|
||||
|
||||
@@ -30,8 +30,11 @@ class EE_API UITab : public UISelectButton {
|
||||
virtual UIPushButton * setText( const String& text );
|
||||
|
||||
virtual void update();
|
||||
|
||||
virtual void loadFromXmlNode( const pugi::xml_node& node );
|
||||
protected:
|
||||
UIControl * mControlOwned;
|
||||
std::string mOwnedName;
|
||||
|
||||
virtual Uint32 onMouseClick( const Vector2i &position, const Uint32 flags );
|
||||
|
||||
@@ -42,6 +45,8 @@ class EE_API UITab : public UISelectButton {
|
||||
UITabWidget * getTabWidget();
|
||||
|
||||
virtual void onParentChange();
|
||||
|
||||
void setOwnedControl();
|
||||
};
|
||||
|
||||
}}
|
||||
|
||||
@@ -19,9 +19,9 @@ class EE_API UITabWidget : public UIWidget {
|
||||
|
||||
virtual bool isType( const Uint32& type ) const;
|
||||
|
||||
Uint32 add( const String& Text, UIControl * CtrlOwned, SubTexture * Icon = NULL );
|
||||
UITabWidget * add( const String& Text, UIControl * CtrlOwned, SubTexture * Icon = NULL );
|
||||
|
||||
Uint32 add( UITab * Tab );
|
||||
UITabWidget * add( UITab * Tab );
|
||||
|
||||
UITab * getTab( const Uint32& Index );
|
||||
|
||||
@@ -73,6 +73,22 @@ class EE_API UITabWidget : public UIWidget {
|
||||
|
||||
void setFontSelectedColor(const ColorA & fontSelectedColor);
|
||||
|
||||
Uint32 getCharacterSize();
|
||||
|
||||
void setCharacterSize(const Uint32 & characterSize);
|
||||
|
||||
const Uint32& getFontStyle() const;
|
||||
|
||||
UITabWidget * setFontStyle( const Uint32& fontStyle );
|
||||
|
||||
const Float & getOutlineThickness() const;
|
||||
|
||||
UITabWidget * setOutlineThickness( const Float& outlineThickness );
|
||||
|
||||
const ColorA& getOutlineColor() const;
|
||||
|
||||
UITabWidget * setOutlineColor( const ColorA& outlineColor );
|
||||
|
||||
Int32 getTabSeparation() const;
|
||||
|
||||
void setTabSeparation(const Int32 & tabSeparation);
|
||||
@@ -111,19 +127,21 @@ class EE_API UITabWidget : public UIWidget {
|
||||
|
||||
void setLineBelowTabsYOffset(const Int32 & lineBelowTabsYOffset);
|
||||
|
||||
TooltipStyleConfig getFontStyleConfig() const;
|
||||
UITooltipStyleConfig getFontStyleConfig() const;
|
||||
|
||||
void setFontStyleConfig(const TooltipStyleConfig & fontStyleConfig);
|
||||
void setFontStyleConfig(const UITooltipStyleConfig & fontStyleConfig);
|
||||
|
||||
TabWidgetStyleConfig getStyleConfig() const;
|
||||
UITabWidgetStyleConfig getStyleConfig() const;
|
||||
|
||||
void setStyleConfig(const TabWidgetStyleConfig & styleConfig);
|
||||
void setStyleConfig(const UITabWidgetStyleConfig & styleConfig);
|
||||
|
||||
virtual void loadFromXmlNode( const pugi::xml_node& node );
|
||||
protected:
|
||||
friend class UITab;
|
||||
|
||||
UIWidget * mCtrlContainer;
|
||||
UIWidget * mTabContainer;
|
||||
TabWidgetStyleConfig mStyleConfig;
|
||||
UITabWidgetStyleConfig mStyleConfig;
|
||||
std::deque<UITab*> mTabs;
|
||||
UITab * mTabSelected;
|
||||
Uint32 mTabSelectedIndex;
|
||||
@@ -134,6 +152,8 @@ class EE_API UITabWidget : public UIWidget {
|
||||
|
||||
virtual void onSizeChange();
|
||||
|
||||
virtual void onChildCountChange();
|
||||
|
||||
void setTabSelected( UITab * Tab );
|
||||
|
||||
void setTabContainerSize();
|
||||
@@ -151,6 +171,8 @@ class EE_API UITabWidget : public UIWidget {
|
||||
void selectNext();
|
||||
|
||||
void applyThemeToTabs();
|
||||
|
||||
void refreshControlOwned( UITab * tab );
|
||||
};
|
||||
|
||||
}}
|
||||
|
||||
@@ -45,9 +45,9 @@ class EE_API UITextEdit : public UIWidget {
|
||||
|
||||
const UI_SCROLLBAR_MODE& getHorizontalScrollMode();
|
||||
|
||||
FontStyleConfig getFontStyleConfig() const;
|
||||
UIFontStyleConfig getFontStyleConfig() const;
|
||||
|
||||
void setFontStyleConfig(const FontStyleConfig & fontStyleConfig);
|
||||
void setFontStyleConfig(const UIFontStyleConfig & fontStyleConfig);
|
||||
|
||||
virtual void loadFromXmlNode( const pugi::xml_node& node );
|
||||
protected:
|
||||
|
||||
@@ -22,7 +22,7 @@ class UITextInputPassword : public UITextInput
|
||||
|
||||
Text * getPassCache() const;
|
||||
|
||||
void setFontStyleConfig( const TooltipStyleConfig& fontStyleConfig );
|
||||
void setFontStyleConfig( const UITooltipStyleConfig& fontStyleConfig );
|
||||
protected:
|
||||
Text * mPassCache;
|
||||
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
#define EE_UICUITEXTBOX_H
|
||||
|
||||
#include <eepp/ui/uiwidget.hpp>
|
||||
#include <eepp/graphics/text.hpp>
|
||||
|
||||
namespace EE { namespace UI {
|
||||
|
||||
@@ -59,8 +60,6 @@ class EE_API UITextView : public UIWidget {
|
||||
|
||||
virtual void setTheme( UITheme * Theme );
|
||||
|
||||
Text * getTextCache();
|
||||
|
||||
Float getTextWidth();
|
||||
|
||||
Float getTextHeight();
|
||||
@@ -73,9 +72,9 @@ class EE_API UITextView : public UIWidget {
|
||||
|
||||
bool isTextSelectionEnabled() const;
|
||||
|
||||
virtual void setFontStyleConfig( const TooltipStyleConfig& fontStyleConfig );
|
||||
virtual void setFontStyleConfig( const UITooltipStyleConfig& fontStyleConfig );
|
||||
|
||||
TooltipStyleConfig getFontStyleConfig() const;
|
||||
UITooltipStyleConfig getFontStyleConfig() const;
|
||||
|
||||
const Recti& getPadding() const;
|
||||
|
||||
@@ -85,7 +84,7 @@ class EE_API UITextView : public UIWidget {
|
||||
protected:
|
||||
Text * mTextCache;
|
||||
String mString;
|
||||
TooltipStyleConfig mFontStyleConfig;
|
||||
UITooltipStyleConfig mFontStyleConfig;
|
||||
Vector2i mAlignOffset;
|
||||
Vector2f mRealAlignOffset;
|
||||
Int32 mSelCurInit;
|
||||
|
||||
@@ -15,33 +15,6 @@ class Font;
|
||||
|
||||
namespace EE { namespace UI {
|
||||
|
||||
class UIControl;
|
||||
class UICheckBox;
|
||||
class UIComboBox;
|
||||
class UIDropDownList;
|
||||
class UIListBox;
|
||||
class UIPopUpMenu;
|
||||
class UIProgressBar;
|
||||
class UIPushButton;
|
||||
class UISelectButton;
|
||||
class UIRadioButton;
|
||||
class UIScrollBar;
|
||||
class UISlider;
|
||||
class UISpinBox;
|
||||
class UITextView;
|
||||
class UITextEdit;
|
||||
class UITextInput;
|
||||
class UITextInputPassword;
|
||||
class UITooltip;
|
||||
class UIWindow;
|
||||
class UIWinMenu;
|
||||
class UIImage;
|
||||
class UISprite;
|
||||
class UIMenu;
|
||||
class UICommonDialog;
|
||||
class UIMessageBox;
|
||||
class UITabWidget;
|
||||
|
||||
class EE_API UITheme : protected ResourceManager<UISkin> {
|
||||
public:
|
||||
using ResourceManager<UISkin>::getById;
|
||||
@@ -79,33 +52,33 @@ class EE_API UITheme : protected ResourceManager<UISkin> {
|
||||
|
||||
SubTexture * getIconByName( const std::string& name );
|
||||
|
||||
TooltipStyleConfig getFontStyleConfig() const;
|
||||
UITooltipStyleConfig getFontStyleConfig() const;
|
||||
|
||||
void setFontStyleConfig(const TooltipStyleConfig & fontConfig);
|
||||
void setFontStyleConfig(const UITooltipStyleConfig & fontConfig);
|
||||
|
||||
virtual TabWidgetStyleConfig getTabWidgetStyleConfig();
|
||||
virtual UITabWidgetStyleConfig getTabWidgetStyleConfig();
|
||||
|
||||
virtual ProgressBarStyleConfig getProgressBarStyleConfig();
|
||||
virtual UIProgressBarStyleConfig getProgressBarStyleConfig();
|
||||
|
||||
virtual WinMenuStyleConfig getWinMenuStyleConfig();
|
||||
virtual UIWinMenuStyleConfig getWinMenuStyleConfig();
|
||||
|
||||
virtual DropDownListStyleConfig getDropDownListStyleConfig();
|
||||
virtual UIDropDownListStyleConfig getDropDownListStyleConfig();
|
||||
|
||||
virtual WindowStyleConfig getWindowStyleConfig();
|
||||
virtual UIWindowStyleConfig getWindowStyleConfig();
|
||||
|
||||
virtual MenuStyleConfig getMenuStyleConfig();
|
||||
virtual UIMenuStyleConfig getMenuStyleConfig();
|
||||
|
||||
virtual PushButtonStyleConfig getPushButtonStyleConfig();
|
||||
virtual UIPushButtonStyleConfig getPushButtonStyleConfig();
|
||||
|
||||
virtual SliderStyleConfig getSliderStyleConfig();
|
||||
virtual UISliderStyleConfig getSliderStyleConfig();
|
||||
|
||||
virtual TooltipStyleConfig getTooltipStyleConfig();
|
||||
virtual UITooltipStyleConfig getTooltipStyleConfig();
|
||||
protected:
|
||||
std::string mName;
|
||||
Uint32 mNameHash;
|
||||
std::string mAbbr;
|
||||
Graphics::TextureAtlas *mTextureAtlas;
|
||||
TooltipStyleConfig mFontStyleConfig;
|
||||
UITooltipStyleConfig mFontStyleConfig;
|
||||
std::list<std::string> mUIElements;
|
||||
std::list<std::string> mUIIcons;
|
||||
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
|
||||
#include <eepp/ui/base.hpp>
|
||||
#include <eepp/ui/uihelper.hpp>
|
||||
#include <eepp/graphics/fontstyleconfig.hpp>
|
||||
|
||||
namespace EE { namespace Graphics {
|
||||
class Font;
|
||||
@@ -10,20 +11,8 @@ class Font;
|
||||
|
||||
namespace EE { namespace UI {
|
||||
|
||||
class FontStyleConfig {
|
||||
class UIFontStyleConfig : public FontStyleConfig {
|
||||
public:
|
||||
Graphics::Font * getFont() const {
|
||||
return Font;
|
||||
}
|
||||
|
||||
const ColorA& getFontColor() const {
|
||||
return FontColor;
|
||||
}
|
||||
|
||||
const ColorA& getFontShadowColor() const {
|
||||
return FontShadowColor;
|
||||
}
|
||||
|
||||
const ColorA& getFontOverColor() const {
|
||||
return FontOverColor;
|
||||
}
|
||||
@@ -36,16 +25,8 @@ class FontStyleConfig {
|
||||
return FontSelectionBackColor;
|
||||
}
|
||||
|
||||
void setFont( Font * font ) {
|
||||
Font = font;
|
||||
}
|
||||
|
||||
void setFontColor( const ColorA& color ) {
|
||||
FontColor = color;
|
||||
}
|
||||
|
||||
void setFontShadowColor( const ColorA& color ) {
|
||||
FontShadowColor = color;
|
||||
ShadowColor = color;
|
||||
}
|
||||
|
||||
void setFontOverColor( const ColorA& color ) {
|
||||
@@ -60,84 +41,33 @@ class FontStyleConfig {
|
||||
FontSelectionBackColor = color;
|
||||
}
|
||||
|
||||
Uint32 getFontCharacterSize() const {
|
||||
return FontCharacterSize;
|
||||
}
|
||||
UIFontStyleConfig() : FontStyleConfig() {}
|
||||
|
||||
void setFontCharacterSize(const Uint32 & value) {
|
||||
FontCharacterSize = value;
|
||||
}
|
||||
|
||||
Uint32 getFontStyle() const {
|
||||
return FontStyle;
|
||||
}
|
||||
|
||||
void setFontStyle( const Uint32& style ) {
|
||||
FontStyle = style;
|
||||
}
|
||||
|
||||
Float getOutlineThickness() const {
|
||||
return OutlineThickness;
|
||||
}
|
||||
|
||||
void setOutlineThickness( const Uint32& outlineThickness ) {
|
||||
OutlineThickness = outlineThickness;
|
||||
}
|
||||
|
||||
ColorA getOutlineColor() const {
|
||||
return OutlineColor;
|
||||
}
|
||||
|
||||
void setOutlineColor(const ColorA & value) {
|
||||
OutlineColor = value;
|
||||
}
|
||||
|
||||
FontStyleConfig() {}
|
||||
|
||||
FontStyleConfig( const FontStyleConfig& fontStyleConfig ) :
|
||||
Font( fontStyleConfig.Font ),
|
||||
FontCharacterSize( fontStyleConfig.FontCharacterSize ),
|
||||
FontStyle( fontStyleConfig.FontStyle ),
|
||||
FontColor( fontStyleConfig.FontColor ),
|
||||
FontShadowColor( fontStyleConfig.FontShadowColor ),
|
||||
UIFontStyleConfig( const UIFontStyleConfig& fontStyleConfig ) :
|
||||
FontStyleConfig( fontStyleConfig ),
|
||||
FontOverColor( fontStyleConfig.FontOverColor ),
|
||||
FontSelectedColor( fontStyleConfig.FontSelectedColor ),
|
||||
FontSelectionBackColor( fontStyleConfig.FontSelectionBackColor ),
|
||||
OutlineThickness( fontStyleConfig.OutlineThickness ),
|
||||
OutlineColor( fontStyleConfig.OutlineColor )
|
||||
FontSelectionBackColor( fontStyleConfig.FontSelectionBackColor )
|
||||
{}
|
||||
|
||||
void updateFontStyleConfig( const FontStyleConfig& fontStyleConfig ) {
|
||||
Font = fontStyleConfig.Font;
|
||||
FontStyle = fontStyleConfig.FontStyle;
|
||||
FontCharacterSize = fontStyleConfig.FontCharacterSize;
|
||||
FontColor = fontStyleConfig.FontColor;
|
||||
FontShadowColor = fontStyleConfig.FontShadowColor;
|
||||
virtual void updateFontStyleConfig( const UIFontStyleConfig& fontStyleConfig ) {
|
||||
FontStyleConfig::updateFontStyleConfig( fontStyleConfig );
|
||||
FontOverColor = fontStyleConfig.FontOverColor;
|
||||
FontSelectedColor = fontStyleConfig.FontSelectedColor;
|
||||
FontSelectionBackColor = fontStyleConfig.FontSelectionBackColor;
|
||||
OutlineThickness = fontStyleConfig.OutlineThickness;
|
||||
OutlineColor = fontStyleConfig.OutlineColor;
|
||||
}
|
||||
|
||||
Graphics::Font * Font = NULL;
|
||||
Uint32 FontCharacterSize = 12;
|
||||
Uint32 FontStyle = 0;
|
||||
ColorA FontColor = ColorA(255,255,255,255);
|
||||
ColorA FontShadowColor = ColorA(50,50,50,230);
|
||||
ColorA FontOverColor = ColorA(255,255,255,255);
|
||||
ColorA FontSelectedColor = ColorA(255,255,255,255);
|
||||
ColorA FontSelectionBackColor = ColorA(255,255,255,255);
|
||||
Float OutlineThickness = 0;
|
||||
ColorA OutlineColor = ColorA(0,0,0,255);
|
||||
};
|
||||
|
||||
class TabWidgetStyleConfig : public FontStyleConfig {
|
||||
class UITabWidgetStyleConfig : public UIFontStyleConfig {
|
||||
public:
|
||||
TabWidgetStyleConfig() {}
|
||||
UITabWidgetStyleConfig() {}
|
||||
|
||||
TabWidgetStyleConfig( FontStyleConfig fontStyleConfig ) :
|
||||
FontStyleConfig( fontStyleConfig )
|
||||
UITabWidgetStyleConfig( UIFontStyleConfig fontStyleConfig ) :
|
||||
UIFontStyleConfig( fontStyleConfig )
|
||||
{}
|
||||
|
||||
Int32 TabSeparation = 0;
|
||||
@@ -153,12 +83,12 @@ class TabWidgetStyleConfig : public FontStyleConfig {
|
||||
Int32 LineBelowTabsYOffset = 0;
|
||||
};
|
||||
|
||||
class ProgressBarStyleConfig : public FontStyleConfig {
|
||||
class UIProgressBarStyleConfig : public UIFontStyleConfig {
|
||||
public:
|
||||
ProgressBarStyleConfig() {}
|
||||
UIProgressBarStyleConfig() {}
|
||||
|
||||
ProgressBarStyleConfig( FontStyleConfig fontStyleConfig ) :
|
||||
FontStyleConfig( fontStyleConfig )
|
||||
UIProgressBarStyleConfig( UIFontStyleConfig fontStyleConfig ) :
|
||||
UIFontStyleConfig( fontStyleConfig )
|
||||
{}
|
||||
|
||||
bool DisplayPercent = false;
|
||||
@@ -167,12 +97,12 @@ class ProgressBarStyleConfig : public FontStyleConfig {
|
||||
Rectf FillerPadding;
|
||||
};
|
||||
|
||||
class WinMenuStyleConfig : public FontStyleConfig {
|
||||
class UIWinMenuStyleConfig : public UIFontStyleConfig {
|
||||
public:
|
||||
WinMenuStyleConfig() {}
|
||||
UIWinMenuStyleConfig() {}
|
||||
|
||||
WinMenuStyleConfig( FontStyleConfig fontStyleConfig ) :
|
||||
FontStyleConfig( fontStyleConfig )
|
||||
UIWinMenuStyleConfig( UIFontStyleConfig fontStyleConfig ) :
|
||||
UIFontStyleConfig( fontStyleConfig )
|
||||
{}
|
||||
|
||||
Uint32 MarginBetweenButtons = 0;
|
||||
@@ -181,24 +111,24 @@ class WinMenuStyleConfig : public FontStyleConfig {
|
||||
Uint32 FirstButtonMargin = 1;
|
||||
};
|
||||
|
||||
class DropDownListStyleConfig : public FontStyleConfig {
|
||||
class UIDropDownListStyleConfig : public UIFontStyleConfig {
|
||||
public:
|
||||
DropDownListStyleConfig() {}
|
||||
UIDropDownListStyleConfig() {}
|
||||
|
||||
DropDownListStyleConfig( FontStyleConfig fontStyleConfig ) :
|
||||
FontStyleConfig( fontStyleConfig )
|
||||
UIDropDownListStyleConfig( UIFontStyleConfig fontStyleConfig ) :
|
||||
UIFontStyleConfig( fontStyleConfig )
|
||||
{}
|
||||
|
||||
Uint32 MaxNumVisibleItems = 10;
|
||||
bool PopUpToMainControl = false;
|
||||
};
|
||||
|
||||
class WindowStyleConfig : public FontStyleConfig {
|
||||
class UIWindowStyleConfig : public UIFontStyleConfig {
|
||||
public:
|
||||
WindowStyleConfig() {}
|
||||
UIWindowStyleConfig() {}
|
||||
|
||||
WindowStyleConfig( FontStyleConfig fontStyleConfig ) :
|
||||
FontStyleConfig( fontStyleConfig )
|
||||
UIWindowStyleConfig( UIFontStyleConfig fontStyleConfig ) :
|
||||
UIFontStyleConfig( fontStyleConfig )
|
||||
{}
|
||||
|
||||
Uint32 WinFlags = UI_WIN_DEFAULT_FLAGS;
|
||||
@@ -214,12 +144,12 @@ class WindowStyleConfig : public FontStyleConfig {
|
||||
bool BorderAutoSize = true;
|
||||
};
|
||||
|
||||
class MenuStyleConfig : public FontStyleConfig {
|
||||
class UIMenuStyleConfig : public UIFontStyleConfig {
|
||||
public:
|
||||
MenuStyleConfig() {}
|
||||
UIMenuStyleConfig() {}
|
||||
|
||||
MenuStyleConfig( FontStyleConfig fontStyleConfig ) :
|
||||
FontStyleConfig( fontStyleConfig )
|
||||
UIMenuStyleConfig( UIFontStyleConfig fontStyleConfig ) :
|
||||
UIFontStyleConfig( fontStyleConfig )
|
||||
{}
|
||||
|
||||
Recti Padding = Recti(0, 0, 0, 0);
|
||||
@@ -229,12 +159,12 @@ class MenuStyleConfig : public FontStyleConfig {
|
||||
|
||||
};
|
||||
|
||||
class PushButtonStyleConfig : public FontStyleConfig {
|
||||
class UIPushButtonStyleConfig : public UIFontStyleConfig {
|
||||
public:
|
||||
PushButtonStyleConfig() {}
|
||||
UIPushButtonStyleConfig() {}
|
||||
|
||||
PushButtonStyleConfig( FontStyleConfig fontStyleConfig ) :
|
||||
FontStyleConfig( fontStyleConfig )
|
||||
UIPushButtonStyleConfig( UIFontStyleConfig fontStyleConfig ) :
|
||||
UIFontStyleConfig( fontStyleConfig )
|
||||
{}
|
||||
|
||||
Int32 IconHorizontalMargin = 4;
|
||||
@@ -242,20 +172,20 @@ class PushButtonStyleConfig : public FontStyleConfig {
|
||||
Sizei IconMinSize;
|
||||
};
|
||||
|
||||
class SliderStyleConfig {
|
||||
class UISliderStyleConfig {
|
||||
public:
|
||||
SliderStyleConfig() {}
|
||||
UISliderStyleConfig() {}
|
||||
|
||||
bool AllowHalfSliderOut = false;
|
||||
bool ExpandBackground = false;
|
||||
};
|
||||
|
||||
class TooltipStyleConfig : public FontStyleConfig {
|
||||
class UITooltipStyleConfig : public UIFontStyleConfig {
|
||||
public:
|
||||
TooltipStyleConfig() {}
|
||||
UITooltipStyleConfig() {}
|
||||
|
||||
TooltipStyleConfig( FontStyleConfig fontStyleConfig ) :
|
||||
FontStyleConfig( fontStyleConfig )
|
||||
UITooltipStyleConfig( UIFontStyleConfig fontStyleConfig ) :
|
||||
UIFontStyleConfig( fontStyleConfig )
|
||||
{}
|
||||
|
||||
Recti Padding;
|
||||
|
||||
@@ -9,19 +9,19 @@ class EE_API UIThemeDefault : public UITheme {
|
||||
public:
|
||||
UIThemeDefault( const std::string& name, const std::string& abbr, Graphics::Font * defaultFont = NULL );
|
||||
|
||||
TabWidgetStyleConfig getTabWidgetStyleConfig();
|
||||
UITabWidgetStyleConfig getTabWidgetStyleConfig();
|
||||
|
||||
ProgressBarStyleConfig getProgressBarStyleConfig();
|
||||
UIProgressBarStyleConfig getProgressBarStyleConfig();
|
||||
|
||||
WinMenuStyleConfig getWinMenuStyleConfig();
|
||||
UIWinMenuStyleConfig getWinMenuStyleConfig();
|
||||
|
||||
WindowStyleConfig getWindowStyleConfig();
|
||||
UIWindowStyleConfig getWindowStyleConfig();
|
||||
|
||||
MenuStyleConfig getMenuStyleConfig();
|
||||
UIMenuStyleConfig getMenuStyleConfig();
|
||||
|
||||
SliderStyleConfig getSliderStyleConfig();
|
||||
UISliderStyleConfig getSliderStyleConfig();
|
||||
|
||||
TooltipStyleConfig getTooltipStyleConfig();
|
||||
UITooltipStyleConfig getTooltipStyleConfig();
|
||||
};
|
||||
|
||||
}}
|
||||
|
||||
@@ -58,7 +58,7 @@ class EE_API UIThemeManager : public ResourceManager<UITheme> {
|
||||
|
||||
const Sizei& getCursorSize() const;
|
||||
|
||||
FontStyleConfig getDefaultFontStyleConfig();
|
||||
UIFontStyleConfig getDefaultFontStyleConfig();
|
||||
protected:
|
||||
Font * mFont;
|
||||
UITheme * mThemeDefault;
|
||||
|
||||
@@ -75,12 +75,12 @@ class EE_API UITooltip : public UIControlAnim {
|
||||
|
||||
void setTooltipOf(UIControl * tooltipOf);
|
||||
|
||||
TooltipStyleConfig getStyleConfig() const;
|
||||
UITooltipStyleConfig getStyleConfig() const;
|
||||
|
||||
void setStyleConfig(const TooltipStyleConfig & styleConfig);
|
||||
void setStyleConfig(const UITooltipStyleConfig & styleConfig);
|
||||
protected:
|
||||
Text * mTextCache;
|
||||
TooltipStyleConfig mStyleConfig;
|
||||
UITooltipStyleConfig mStyleConfig;
|
||||
Vector2f mAlignOffset;
|
||||
Recti mRealPadding;
|
||||
Time mTooltipTime;
|
||||
|
||||
@@ -85,9 +85,9 @@ class EE_API UIWindow : public UIWidget {
|
||||
|
||||
UIWindow * setWinFlags(const Uint32 & winFlags);
|
||||
|
||||
WindowStyleConfig getStyleConfig() const;
|
||||
UIWindowStyleConfig getStyleConfig() const;
|
||||
|
||||
UIWindow * setStyleConfig(const WindowStyleConfig & styleConfig);
|
||||
UIWindow * setStyleConfig(const UIWindowStyleConfig & styleConfig);
|
||||
|
||||
UIWindow * setMinWindowSize( Sizei size );
|
||||
|
||||
@@ -130,7 +130,7 @@ class EE_API UIWindow : public UIWidget {
|
||||
RESIZE_TOPRIGHT
|
||||
};
|
||||
|
||||
WindowStyleConfig mStyleConfig;
|
||||
UIWindowStyleConfig mStyleConfig;
|
||||
UIControlAnim * mWindowDecoration;
|
||||
UIControlAnim * mBorderLeft;
|
||||
UIControlAnim * mBorderRight;
|
||||
|
||||
@@ -34,18 +34,18 @@ class EE_API UIWinMenu : public UIWidget {
|
||||
|
||||
void setMarginBetweenButtons(const Uint32 & marginBetweenButtons);
|
||||
|
||||
TooltipStyleConfig getFontStyleConfig() const;
|
||||
UITooltipStyleConfig getFontStyleConfig() const;
|
||||
|
||||
void setFontStyleConfig(const TooltipStyleConfig & fontStyleConfig);
|
||||
void setFontStyleConfig(const UITooltipStyleConfig & fontStyleConfig);
|
||||
|
||||
WinMenuStyleConfig getStyleConfig() const;
|
||||
UIWinMenuStyleConfig getStyleConfig() const;
|
||||
|
||||
void setStyleConfig(const WinMenuStyleConfig & styleConfig);
|
||||
void setStyleConfig(const UIWinMenuStyleConfig & styleConfig);
|
||||
|
||||
protected:
|
||||
typedef std::list< std::pair< UISelectButton *, UIPopUpMenu * > > WinMenuList;
|
||||
|
||||
WinMenuStyleConfig mStyleConfig;
|
||||
UIWinMenuStyleConfig mStyleConfig;
|
||||
UIPopUpMenu * mCurrentMenu;
|
||||
WinMenuList mButtons;
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE QtCreatorProject>
|
||||
<!-- Written by QtCreator 4.2.0, 2017-03-07T21:37:36. -->
|
||||
<!-- Written by QtCreator 4.2.0, 2017-03-14T12:05:07. -->
|
||||
<qtcreator>
|
||||
<data>
|
||||
<variable>EnvironmentId</variable>
|
||||
@@ -161,7 +161,7 @@
|
||||
<valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0">
|
||||
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
|
||||
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
|
||||
<value type="QString" key="ProjectExplorer.ProcessStep.Arguments">--with-static-backend --with-ssl --with-backend=SDL2,SFML gmake</value>
|
||||
<value type="QString" key="ProjectExplorer.ProcessStep.Arguments">--with-static-backend --with-static-freetype --with-ssl --with-backend=SDL2,SFML gmake</value>
|
||||
<value type="QString" key="ProjectExplorer.ProcessStep.Command">premake4</value>
|
||||
<value type="QString" key="ProjectExplorer.ProcessStep.WorkingDirectory">%{buildDir}../../../</value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Custom Process Step</value>
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
../../include/eepp/graphics/font.hpp
|
||||
../../include/eepp/graphics/fontstyleconfig.hpp
|
||||
../../include/eepp/graphics/fonttruetype.hpp
|
||||
../../include/eepp/graphics/fonttruetypeloader.hpp
|
||||
../../include/eepp/graphics/text.hpp
|
||||
|
||||
@@ -15,16 +15,6 @@
|
||||
#include <eepp/gaming/gameobjectobject.hpp>
|
||||
#include <eepp/gaming/gameobjectpolygon.hpp>
|
||||
#include <eepp/gaming/gameobjectpolyline.hpp>
|
||||
#include <eepp/ui/uimanager.hpp>
|
||||
#include <eepp/ui/uithememanager.hpp>
|
||||
#include <eepp/ui/uiwinmenu.hpp>
|
||||
#include <eepp/ui/uipopupmenu.hpp>
|
||||
#include <eepp/ui/uispinbox.hpp>
|
||||
#include <eepp/ui/uicheckbox.hpp>
|
||||
#include <eepp/ui/uicommondialog.hpp>
|
||||
#include <eepp/ui/uimessagebox.hpp>
|
||||
#include <eepp/ui/uitabwidget.hpp>
|
||||
#include <eepp/ui/tools/textureatlaseditor.hpp>
|
||||
#include <eepp/graphics/sprite.hpp>
|
||||
#include <eepp/graphics/textureatlasmanager.hpp>
|
||||
#include <eepp/graphics/globaltextureatlas.hpp>
|
||||
@@ -39,8 +29,9 @@ using namespace EE::Gaming::Private;
|
||||
|
||||
namespace EE { namespace Gaming {
|
||||
|
||||
static UITextView * 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 ) {
|
||||
static UITextView * 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, const Uint32& fontStyle = Text::Regular ) {
|
||||
UITextView * Ctrl = UITextView::New();
|
||||
Ctrl->setFontStyle( fontStyle );
|
||||
Ctrl->resetFlags( Flags )->setParent( Parent )->setPosition( Pos )->setSize( Size )->setVisible( true )->setEnabled( false );
|
||||
Ctrl->setText( Text );
|
||||
return Ctrl;
|
||||
@@ -260,12 +251,12 @@ void MapEditor::fillGotyList() {
|
||||
|
||||
void MapEditor::createSubTextureContainer( Int32 Width ) {
|
||||
UITextView * Txt;
|
||||
Uint32 TxtFlags = UI_CONTROL_DEFAULT_ALIGN | UI_ANCHOR_RIGHT | UI_ANCHOR_TOP | UI_DRAW_SHADOW;
|
||||
Uint32 TxtFlags = UI_CONTROL_DEFAULT_ALIGN | UI_ANCHOR_RIGHT | UI_ANCHOR_TOP;
|
||||
|
||||
Txt = createTextBox( "Add Game Object as...", mSubTextureCont, Sizei( Width, 16 ), Vector2i( TAB_CONT_X_DIST, 4 ), TxtFlags );
|
||||
Txt = createTextBox( "Add Game Object as...", mSubTextureCont, Sizei( Width, 16 ), Vector2i( TAB_CONT_X_DIST, 4 ), TxtFlags, Text::Shadow );
|
||||
|
||||
mGOTypeList = UIDropDownList::New();
|
||||
mGOTypeList->setParent( mSubTextureCont )->setSize( Width - 26, 0 )->setPosition( TAB_CONT_X_DIST, Txt->getPosition().y + Txt->getSize().getHeight() + 4 )->setFlags( UI_DRAW_SHADOW );
|
||||
mGOTypeList->setFontStyle( Text::Shadow )->setParent( mSubTextureCont )->setSize( Width - 26, 0 )->setPosition( TAB_CONT_X_DIST, Txt->getPosition().y + Txt->getSize().getHeight() + 4 );
|
||||
|
||||
mGOTypeList->addEventListener( UIEvent::EventOnItemSelected, cb::Make1( this, &MapEditor::onTypeChange ) );
|
||||
fillGotyList();
|
||||
@@ -280,54 +271,54 @@ void MapEditor::createSubTextureContainer( Int32 Width ) {
|
||||
if ( NULL == mBtnGOTypeAdd->getIcon()->getSubTexture() )
|
||||
mBtnGOTypeAdd->setText( "..." );
|
||||
|
||||
Txt = createTextBox( "Layers:", mSubTextureCont, Sizei( Width, 16 ), Vector2i( TAB_CONT_X_DIST, mGOTypeList->getPosition().y + mGOTypeList->getSize().getHeight() + 4 ), TxtFlags );
|
||||
Txt = createTextBox( "Layers:", mSubTextureCont, Sizei( Width, 16 ), Vector2i( TAB_CONT_X_DIST, mGOTypeList->getPosition().y + mGOTypeList->getSize().getHeight() + 4 ), TxtFlags, Text::Shadow );
|
||||
|
||||
mLayerList = UIDropDownList::New();
|
||||
mLayerList->setParent( mSubTextureCont )->setSize( Width, 0 )->setPosition( TAB_CONT_X_DIST, Txt->getPosition().y + Txt->getSize().getHeight() + 4 )->setFlags( UI_DRAW_SHADOW );
|
||||
mLayerList->setFontStyle( Text::Shadow )->setParent( mSubTextureCont )->setSize( Width, 0 )->setPosition( TAB_CONT_X_DIST, Txt->getPosition().y + Txt->getSize().getHeight() + 4 );
|
||||
|
||||
mLayerList->addEventListener( UIEvent::EventOnItemSelected, cb::Make1( this, &MapEditor::onLayerSelect ) );
|
||||
|
||||
Txt = createTextBox( "Game Object Flags:", mSubTextureCont, Sizei( Width, 16 ), Vector2i( TAB_CONT_X_DIST, mLayerList->getPosition().y + mLayerList->getSize().getHeight() + 4 ), TxtFlags );
|
||||
Txt = createTextBox( "Game Object Flags:", mSubTextureCont, Sizei( Width, 16 ), Vector2i( TAB_CONT_X_DIST, mLayerList->getPosition().y + mLayerList->getSize().getHeight() + 4 ), TxtFlags, Text::Shadow );
|
||||
|
||||
Uint32 ChkFlags = UI_CONTROL_DEFAULT_ALIGN | UI_AUTO_SIZE | UI_ANCHOR_RIGHT | UI_ANCHOR_TOP;
|
||||
|
||||
mChkMirrored = UICheckBox::New();
|
||||
mChkMirrored->setParent( mSubTextureCont )->setPosition( TAB_CONT_X_DIST, Txt->getPosition().y + Txt->getSize().getHeight() + 4 )->resetFlags( ChkFlags )->setFlags( UI_DRAW_SHADOW );
|
||||
mChkMirrored->setFontStyle( Text::Shadow )->setParent( mSubTextureCont )->setPosition( TAB_CONT_X_DIST, Txt->getPosition().y + Txt->getSize().getHeight() + 4 )->resetFlags( ChkFlags );
|
||||
mChkMirrored->setText( "Mirrored" );
|
||||
mChkMirrored->addEventListener( UIEvent::EventOnValueChange, cb::Make1( this, &MapEditor::chkClickMirrored ) );
|
||||
|
||||
mChkFliped = UICheckBox::New();
|
||||
mChkFliped->setParent( mSubTextureCont )->setPosition( mChkMirrored->getPosition().x + mChkMirrored->getSize().getWidth() + 32, mChkMirrored->getPosition().y )->resetFlags( ChkFlags )->setFlags( UI_DRAW_SHADOW );
|
||||
mChkFliped->setFontStyle( Text::Shadow )->setParent( mSubTextureCont )->setPosition( mChkMirrored->getPosition().x + mChkMirrored->getSize().getWidth() + 32, mChkMirrored->getPosition().y )->resetFlags( ChkFlags );
|
||||
mChkFliped->setText( "Fliped" );
|
||||
mChkFliped->addEventListener( UIEvent::EventOnValueChange, cb::Make1( this, &MapEditor::chkClickFlipped ) );
|
||||
|
||||
mChkBlocked = UICheckBox::New();
|
||||
mChkBlocked->setParent( mSubTextureCont )->setPosition( mChkMirrored->getPosition().x, mChkMirrored->getPosition().y + mChkMirrored->getSize().getHeight() + 4 )->resetFlags( ChkFlags )->setFlags( UI_DRAW_SHADOW );
|
||||
mChkBlocked->setFontStyle( Text::Shadow )->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::EventOnValueChange, cb::Make1( this, &MapEditor::chkClickBlocked ) );
|
||||
|
||||
mChkAnim = UICheckBox::New();
|
||||
mChkAnim->setParent( mSubTextureCont )->setPosition( mChkFliped->getPosition().x, mChkFliped->getPosition().y + mChkFliped->getSize().getHeight() + 4 )->resetFlags( ChkFlags )->setFlags( UI_DRAW_SHADOW );
|
||||
mChkAnim->setFontStyle( Text::Shadow )->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::EventOnValueChange, cb::Make1( this, &MapEditor::chkClickAnimated ) );
|
||||
|
||||
mChkRot90 = UICheckBox::New();
|
||||
mChkRot90->setParent( mSubTextureCont )->setPosition( mChkBlocked->getPosition().x, mChkBlocked->getPosition().y + mChkBlocked->getSize().getHeight() + 4 )->resetFlags( ChkFlags )->setFlags( UI_DRAW_SHADOW );
|
||||
mChkRot90->setFontStyle( Text::Shadow )->setParent( mSubTextureCont )->setPosition( mChkBlocked->getPosition().x, mChkBlocked->getPosition().y + mChkBlocked->getSize().getHeight() + 4 )->resetFlags( ChkFlags );
|
||||
mChkRot90->setText( String::fromUtf8( "Rotate 90º" ) );
|
||||
mChkRot90->addEventListener( UIEvent::EventOnValueChange, cb::Make1( this, &MapEditor::chkClickRot90 ) );
|
||||
|
||||
mChkAutoFix = UICheckBox::New();
|
||||
mChkAutoFix->setParent( mSubTextureCont )->setPosition( mChkAnim->getPosition().x, mChkAnim->getPosition().y + mChkAnim->getSize().getHeight() + 4 )->resetFlags( ChkFlags )->setFlags( UI_DRAW_SHADOW );
|
||||
mChkAutoFix->setFontStyle( Text::Shadow )->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::EventOnValueChange, cb::Make1( this, &MapEditor::chkClickAutoFix ) );
|
||||
|
||||
Txt = createTextBox( "Game Object Data:", mSubTextureCont, Sizei( Width, 16 ), Vector2i( TAB_CONT_X_DIST, mChkRot90->getPosition().y + mChkRot90->getSize().getHeight() + 8 ), TxtFlags );
|
||||
Txt = createTextBox( "Game Object Data:", mSubTextureCont, Sizei( Width, 16 ), Vector2i( TAB_CONT_X_DIST, mChkRot90->getPosition().y + mChkRot90->getSize().getHeight() + 8 ), TxtFlags, Text::Shadow );
|
||||
|
||||
mChkDI = UICheckBox::New();
|
||||
mChkDI->setParent( mSubTextureCont )->setPosition( TAB_CONT_X_DIST, Txt->getPosition().y + Txt->getSize().getHeight() + 4 )->resetFlags( ChkFlags )->setFlags( UI_DRAW_SHADOW );;
|
||||
mChkDI->setFontStyle( Text::Shadow )->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::EventOnValueChange, cb::Make1( this, &MapEditor::chkClickDI ) );
|
||||
@@ -338,10 +329,10 @@ void MapEditor::createSubTextureContainer( Int32 Width ) {
|
||||
mSGCont->setEnabled( true );
|
||||
mSGCont->setVisible( true );
|
||||
|
||||
Txt = createTextBox( "Texture Atlases:", mSGCont, Sizei( Width, 16 ), Vector2i( TAB_CONT_X_DIST, 0 ), TxtFlags );
|
||||
Txt = createTextBox( "Texture Atlases:", mSGCont, Sizei( Width, 16 ), Vector2i( TAB_CONT_X_DIST, 0 ), TxtFlags, Text::Shadow );
|
||||
|
||||
mTextureAtlasesList = UIDropDownList::New();
|
||||
mTextureAtlasesList->setParent( mSGCont )->setSize( Width, 0 )->setPosition( 0, Txt->getPosition().y +Txt->getSize().getHeight() + 4 )->setFlags( UI_DRAW_SHADOW );
|
||||
mTextureAtlasesList->setFontStyle( Text::Shadow )->setParent( mSGCont )->setSize( Width, 0 )->setPosition( 0, Txt->getPosition().y +Txt->getSize().getHeight() + 4 );
|
||||
mTextureAtlasesList->addEventListener( UIEvent::EventOnItemSelected, cb::Make1( this, &MapEditor::onTextureAtlasChange ) );
|
||||
|
||||
mSubTextureList = UIListBox::New();
|
||||
@@ -365,7 +356,7 @@ void MapEditor::createSubTextureContainer( Int32 Width ) {
|
||||
mDICont->setEnabled( false );
|
||||
mDICont->setVisible( false );
|
||||
|
||||
Txt = createTextBox( "DataId String:", mDICont, Sizei( Width, 16 ), Vector2i( TAB_CONT_X_DIST, 0 ), TxtFlags );
|
||||
Txt = createTextBox( "DataId String:", mDICont, Sizei( Width, 16 ), Vector2i( TAB_CONT_X_DIST, 0 ), TxtFlags, Text::Shadow );
|
||||
|
||||
mDataIdInput = UITextInput::New();
|
||||
mDataIdInput->setParent( mDICont )->setSize( Width / 4 * 3, 0 )->setPosition( TAB_CONT_X_DIST + 8, Txt->getPosition().y + Txt->getSize().getHeight() + 8 );
|
||||
@@ -379,7 +370,8 @@ void MapEditor::createLighContainer() {
|
||||
NewLightBut->setText( "New Light" );
|
||||
NewLightBut->addEventListener( UIEvent::EventMouseClick, cb::Make1( this, &MapEditor::onNewLight ) );
|
||||
|
||||
UITextView * Txt = createTextBox( "Light Color:", mLightCont, Sizei(), Vector2i( TAB_CONT_X_DIST, 32 ), UI_CONTROL_DEFAULT_FLAGS | UI_DRAW_SHADOW | UI_AUTO_SIZE );
|
||||
UITextView * Txt = createTextBox( "Light Color:", mLightCont, Sizei(), Vector2i( TAB_CONT_X_DIST, 32 ), UI_CONTROL_DEFAULT_FLAGS | UI_AUTO_SIZE );
|
||||
Txt->setFontStyle( Text::Shadow );
|
||||
|
||||
mUIBaseColor = UIWidget::New();
|
||||
mUIBaseColor->setFlags( UI_FILL_BACKGROUND | UI_BORDER );
|
||||
@@ -389,7 +381,7 @@ void MapEditor::createLighContainer() {
|
||||
mUIBaseColor->getBackground()->setColor( ColorA(255,255,255,255) );
|
||||
mUIBaseColor->getBorder()->setColor( ColorA( 100, 100, 100, 200 ) );
|
||||
|
||||
Txt = createTextBox( "R:", mLightCont, Sizei(), Vector2i( mUIBaseColor->getPosition().x + mUIBaseColor->getSize().getWidth() + 4, mUIBaseColor->getPosition().y ), UI_CONTROL_DEFAULT_FLAGS | UI_DRAW_SHADOW | UI_AUTO_SIZE );
|
||||
Txt = createTextBox( "R:", mLightCont, Sizei(), Vector2i( mUIBaseColor->getPosition().x + mUIBaseColor->getSize().getWidth() + 4, mUIBaseColor->getPosition().y ), UI_CONTROL_DEFAULT_FLAGS | UI_AUTO_SIZE, Text::Shadow );
|
||||
|
||||
mUIRedSlider = UISlider::New()->setOrientation( UI_HORIZONTAL );
|
||||
mUIRedSlider->setParent( mLightCont )->setSize( 100, 20 )->setPosition( Txt->getPosition().x + Txt->getSize().getWidth(), Txt->getPosition().y );
|
||||
@@ -397,27 +389,27 @@ void MapEditor::createLighContainer() {
|
||||
mUIRedSlider->setValue( 255 );
|
||||
mUIRedSlider->addEventListener( UIEvent::EventOnValueChange, cb::Make1( this, &MapEditor::onRedChange ) );
|
||||
|
||||
mUIRedTxt = createTextBox( String::toStr( (Uint32)255 ), mLightCont, Sizei(), Vector2i( mUIRedSlider->getPosition().x + mUIRedSlider->getSize().getWidth() + 4, mUIRedSlider->getPosition().y ), UI_CONTROL_DEFAULT_FLAGS | UI_DRAW_SHADOW | UI_AUTO_SIZE );
|
||||
mUIRedTxt = createTextBox( String::toStr( (Uint32)255 ), mLightCont, Sizei(), Vector2i( mUIRedSlider->getPosition().x + mUIRedSlider->getSize().getWidth() + 4, mUIRedSlider->getPosition().y ), UI_CONTROL_DEFAULT_FLAGS | UI_AUTO_SIZE, Text::Shadow );
|
||||
|
||||
Txt = createTextBox( "G:", mLightCont, Sizei(), Vector2i( mUIBaseColor->getPosition().x + mUIBaseColor->getSize().getWidth() + 4, mUIRedSlider->getPosition().y + mUIRedSlider->getSize().getHeight() + 4 ), UI_CONTROL_DEFAULT_FLAGS | UI_DRAW_SHADOW | UI_AUTO_SIZE );
|
||||
Txt = createTextBox( "G:", mLightCont, Sizei(), Vector2i( mUIBaseColor->getPosition().x + mUIBaseColor->getSize().getWidth() + 4, mUIRedSlider->getPosition().y + mUIRedSlider->getSize().getHeight() + 4 ), UI_CONTROL_DEFAULT_FLAGS | UI_AUTO_SIZE, Text::Shadow );
|
||||
mUIGreenSlider = UISlider::New()->setOrientation( UI_HORIZONTAL );
|
||||
mUIGreenSlider->setParent( mLightCont )->setSize( 100, 20 )->setPosition( mUIRedSlider->getPosition().x, Txt->getPosition().y );
|
||||
mUIGreenSlider->setMaxValue( 255 );
|
||||
mUIGreenSlider->setValue( 255 );
|
||||
mUIGreenSlider->addEventListener( UIEvent::EventOnValueChange, cb::Make1( this, &MapEditor::onGreenChange ) );
|
||||
|
||||
mUIGreenTxt = createTextBox( String::toStr( (Uint32)255 ), mLightCont, Sizei(), Vector2i( mUIGreenSlider->getPosition().x + mUIGreenSlider->getSize().getWidth() + 4, mUIGreenSlider->getPosition().y ), UI_CONTROL_DEFAULT_FLAGS | UI_DRAW_SHADOW | UI_AUTO_SIZE );
|
||||
mUIGreenTxt = createTextBox( String::toStr( (Uint32)255 ), mLightCont, Sizei(), Vector2i( mUIGreenSlider->getPosition().x + mUIGreenSlider->getSize().getWidth() + 4, mUIGreenSlider->getPosition().y ), UI_CONTROL_DEFAULT_FLAGS | UI_AUTO_SIZE, Text::Shadow );
|
||||
|
||||
Txt = createTextBox( "B:", mLightCont, Sizei(), Vector2i( mUIBaseColor->getPosition().x + mUIBaseColor->getSize().getWidth() + 4, mUIGreenSlider->getPosition().y + mUIGreenSlider->getSize().getHeight() + 4 ), UI_CONTROL_DEFAULT_FLAGS | UI_DRAW_SHADOW | UI_AUTO_SIZE );
|
||||
Txt = createTextBox( "B:", mLightCont, Sizei(), Vector2i( mUIBaseColor->getPosition().x + mUIBaseColor->getSize().getWidth() + 4, mUIGreenSlider->getPosition().y + mUIGreenSlider->getSize().getHeight() + 4 ), UI_CONTROL_DEFAULT_FLAGS | UI_AUTO_SIZE, Text::Shadow );
|
||||
mUIBlueSlider = UISlider::New()->setOrientation( UI_HORIZONTAL );
|
||||
mUIBlueSlider->setParent( mLightCont )->setSize( 100, 20 )->setPosition( mUIRedSlider->getPosition().x, Txt->getPosition().y );
|
||||
mUIBlueSlider->setMaxValue( 255 );
|
||||
mUIBlueSlider->setValue( 255 );
|
||||
mUIBlueSlider->addEventListener( UIEvent::EventOnValueChange, cb::Make1( this, &MapEditor::onBlueChange ) );
|
||||
|
||||
mUIBlueTxt = createTextBox( String::toStr( (Uint32)255 ), mLightCont, Sizei(), Vector2i( mUIBlueSlider->getPosition().x + mUIBlueSlider->getSize().getWidth() + 4, mUIBlueSlider->getPosition().y ), UI_CONTROL_DEFAULT_FLAGS | UI_DRAW_SHADOW | UI_AUTO_SIZE );
|
||||
mUIBlueTxt = createTextBox( String::toStr( (Uint32)255 ), mLightCont, Sizei(), Vector2i( mUIBlueSlider->getPosition().x + mUIBlueSlider->getSize().getWidth() + 4, mUIBlueSlider->getPosition().y ), UI_CONTROL_DEFAULT_FLAGS | UI_AUTO_SIZE, Text::Shadow );
|
||||
|
||||
Txt = createTextBox( "Light Radius:", mLightCont, Sizei(), Vector2i( TAB_CONT_X_DIST, mUIBlueTxt->getPosition().y + mUIBlueTxt->getSize().getHeight() + 16 ), UI_CONTROL_DEFAULT_FLAGS | UI_DRAW_SHADOW | UI_AUTO_SIZE );
|
||||
Txt = createTextBox( "Light Radius:", mLightCont, Sizei(), Vector2i( TAB_CONT_X_DIST, mUIBlueTxt->getPosition().y + mUIBlueTxt->getSize().getHeight() + 16 ), UI_CONTROL_DEFAULT_FLAGS | UI_AUTO_SIZE, Text::Shadow );
|
||||
|
||||
mLightRadius = UISpinBox::New()->setAllowOnlyNumbers( false )->setValue( 100 );
|
||||
mLightRadius->setParent( mLightCont )->setSize( 100, 0 )->setPosition( Txt->getPosition().x, Txt->getPosition().y + Txt->getSize().getHeight() + 8 );
|
||||
|
||||
@@ -30,7 +30,7 @@ MapLayerProperties::MapLayerProperties( MapLayer * Map, RefreshLayerListCb Cb )
|
||||
Int32 DistFromTitle = 18;
|
||||
|
||||
UITextView * Txt = UITextView::New();
|
||||
Txt->setFlags( UI_DRAW_SHADOW | UI_AUTO_SIZE )->setParent( mUIWindow->getContainer() )->setPosition( 50, InitialY );
|
||||
Txt->setFontStyle( Text::Shadow )->setFlags( UI_AUTO_SIZE )->setParent( mUIWindow->getContainer() )->setPosition( 50, InitialY );
|
||||
Txt->setText( "Layer name:" );
|
||||
|
||||
mUIInput = UITextInput::New()->setMaxLength( 64 );
|
||||
@@ -39,12 +39,12 @@ MapLayerProperties::MapLayerProperties( MapLayer * Map, RefreshLayerListCb Cb )
|
||||
mUIInput->addEventListener( UIEvent::EventOnPressEnter, cb::Make1( this, &MapLayerProperties::onOKClick ) );
|
||||
|
||||
UITextView * TxtBox = UITextView::New();
|
||||
TxtBox->setParent( mUIWindow->getContainer() )->setSize( 192, 24 )->setHorizontalAlign( UI_HALIGN_CENTER )->setFlags( UI_DRAW_SHADOW )
|
||||
TxtBox->setFontStyle( Text::Shadow )->setParent( mUIWindow->getContainer() )->setSize( 192, 24 )->setHorizontalAlign( UI_HALIGN_CENTER )
|
||||
->setPosition( 50, mUIInput->getPosition().y + mUIInput->getSize().getHeight() + 12 );
|
||||
TxtBox->setText( "Property Name" );
|
||||
|
||||
TxtBox = UITextView::New();
|
||||
TxtBox->setParent( mUIWindow->getContainer() )->setSize( 192, 24 )->setHorizontalAlign( UI_HALIGN_CENTER )->setFlags( UI_DRAW_SHADOW )
|
||||
TxtBox->setFontStyle( Text::Shadow )->setParent( mUIWindow->getContainer() )->setSize( 192, 24 )->setHorizontalAlign( UI_HALIGN_CENTER )
|
||||
->setPosition( 50+192, mUIInput->getPosition().y + mUIInput->getSize().getHeight() + 12 );
|
||||
TxtBox->setText( "Property Value" );
|
||||
|
||||
|
||||
@@ -3,8 +3,9 @@
|
||||
|
||||
namespace EE { namespace Gaming { namespace Private {
|
||||
|
||||
static UITextView * 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 ) {
|
||||
static UITextView * 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, const Uint32& fontStyle = Text::Regular ) {
|
||||
UITextView * Ctrl = UITextView::New();
|
||||
Ctrl->setFontStyle( fontStyle );
|
||||
Ctrl->resetFlags( Flags )->setParent( Parent )->setPosition( Pos )->setSize( Size )->setVisible( true )->setEnabled( false );
|
||||
Ctrl->setText( Text );
|
||||
return Ctrl;
|
||||
@@ -35,23 +36,23 @@ MapObjectProperties::MapObjectProperties( GameObjectObject * Obj ) :
|
||||
Int32 InitialY = 16;
|
||||
Int32 DistFromTitle = 18;
|
||||
|
||||
UITextView * Txt = createTextBox( "Object name:", mUIWindow->getContainer(), Sizei(), Vector2i( 50, InitialY ), UI_CONTROL_DEFAULT_FLAGS | UI_DRAW_SHADOW | UI_AUTO_SIZE );
|
||||
UITextView * Txt = createTextBox( "Object name:", mUIWindow->getContainer(), Sizei(), Vector2i( 50, InitialY ), UI_CONTROL_DEFAULT_FLAGS | UI_AUTO_SIZE, Text::Shadow );
|
||||
mUIInput = UITextInput::New();
|
||||
mUIInput->setParent( mUIWindow->getContainer() )->setSize( 120, 0 )->setPosition( Txt->getPosition().x + DistFromTitle, Txt->getPosition().y + DistFromTitle );
|
||||
mUIInput->setMaxLength( 64 );
|
||||
mUIInput->setText( mObj->getName() );
|
||||
mUIInput->addEventListener( UIEvent::EventOnPressEnter, cb::Make1( this, &MapObjectProperties::onOKClick ) );
|
||||
|
||||
UITextView * Txt2 = createTextBox( "Object type:", mUIWindow->getContainer(), Sizei(), Vector2i( 50+192, InitialY ), UI_CONTROL_DEFAULT_FLAGS | UI_DRAW_SHADOW | UI_AUTO_SIZE );
|
||||
UITextView * Txt2 = createTextBox( "Object type:", mUIWindow->getContainer(), Sizei(), Vector2i( 50+192, InitialY ), UI_CONTROL_DEFAULT_FLAGS | UI_AUTO_SIZE, Text::Shadow );
|
||||
mUIInput2 = UITextInput::New();
|
||||
mUIInput2->setParent( mUIWindow->getContainer() )->setSize( 120, 0 )->setPosition( Txt2->getPosition().x + DistFromTitle, Txt2->getPosition().y + DistFromTitle );
|
||||
mUIInput2->setMaxLength( 64 );
|
||||
mUIInput2->setText( mObj->getTypeName() );
|
||||
mUIInput2->addEventListener( UIEvent::EventOnPressEnter, cb::Make1( this, &MapObjectProperties::onOKClick ) );
|
||||
|
||||
Uint32 TxtBoxFlags = UI_CONTROL_DEFAULT_FLAGS | UI_DRAW_SHADOW | UI_HALIGN_CENTER | UI_VALIGN_CENTER;
|
||||
createTextBox( "Property Name", mUIWindow->getContainer(), Sizei(192, 24), Vector2i( 50, mUIInput->getPosition().y + mUIInput->getSize().getHeight() + 12 ), TxtBoxFlags );
|
||||
UITextView * TxtBox = createTextBox( "Property Value", mUIWindow->getContainer(), Sizei(192, 24), Vector2i( 50+192, mUIInput->getPosition().y + mUIInput->getSize().getHeight() + 12 ), TxtBoxFlags );
|
||||
Uint32 TxtBoxFlags = UI_CONTROL_DEFAULT_FLAGS | UI_HALIGN_CENTER | UI_VALIGN_CENTER;
|
||||
createTextBox( "Property Name", mUIWindow->getContainer(), Sizei(192, 24), Vector2i( 50, mUIInput->getPosition().y + mUIInput->getSize().getHeight() + 12 ), TxtBoxFlags, Text::Shadow );
|
||||
UITextView * TxtBox = createTextBox( "Property Value", mUIWindow->getContainer(), Sizei(192, 24), Vector2i( 50+192, mUIInput->getPosition().y + mUIInput->getSize().getHeight() + 12 ), TxtBoxFlags, Text::Shadow );
|
||||
|
||||
UIPushButton * OKButton = UIPushButton::New();
|
||||
OKButton->setParent( mUIWindow->getContainer() )->setSize( 80, 0 );
|
||||
|
||||
@@ -2,8 +2,9 @@
|
||||
|
||||
namespace EE { namespace Gaming { namespace Private {
|
||||
|
||||
static UITextView * 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 ) {
|
||||
static UITextView * 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, const Uint32& fontStyle = Text::Regular ) {
|
||||
UITextView * Ctrl = UITextView::New();
|
||||
Ctrl->setFontStyle( fontStyle );
|
||||
Ctrl->resetFlags( Flags )->setParent( Parent )->setPosition( Pos )->setSize( Size )->setVisible( true )->setEnabled( false );
|
||||
Ctrl->setText( Text );
|
||||
return Ctrl;
|
||||
@@ -37,7 +38,7 @@ TileMapProperties::TileMapProperties( TileMap * Map ) :
|
||||
if ( mMap->getLightsEnabled() ) {
|
||||
DiffIfLights = 100;
|
||||
|
||||
UITextView * Txt = createTextBox( "Map Base Color:", mUIWindow->getContainer(), Sizei(), Vector2i( 50, 16 ), UI_CONTROL_DEFAULT_FLAGS | UI_DRAW_SHADOW | UI_AUTO_SIZE );
|
||||
UITextView * Txt = createTextBox( "Map Base Color:", mUIWindow->getContainer(), Sizei(), Vector2i( 50, 16 ), UI_CONTROL_DEFAULT_FLAGS | UI_AUTO_SIZE, Text::Shadow );
|
||||
|
||||
mUIBaseColor = UIWidget::New();
|
||||
mUIBaseColor->setFlags( UI_FILL_BACKGROUND | UI_BORDER );
|
||||
@@ -47,16 +48,16 @@ TileMapProperties::TileMapProperties( TileMap * Map ) :
|
||||
mUIBaseColor->getBackground()->setColor( mMap->getBaseColor() );
|
||||
mUIBaseColor->getBorder()->setColor( ColorA( 100, 100, 100, 200 ) );
|
||||
|
||||
Txt = createTextBox( "Red Color:", mUIWindow->getContainer(), Sizei(), Vector2i( mUIBaseColor->getPosition().x + mUIBaseColor->getSize().getWidth() + 4, mUIBaseColor->getPosition().y ), UI_CONTROL_DEFAULT_FLAGS | UI_DRAW_SHADOW | UI_AUTO_SIZE );
|
||||
Txt = createTextBox( "Red Color:", mUIWindow->getContainer(), Sizei(), Vector2i( mUIBaseColor->getPosition().x + mUIBaseColor->getSize().getWidth() + 4, mUIBaseColor->getPosition().y ), UI_CONTROL_DEFAULT_FLAGS | UI_AUTO_SIZE, Text::Shadow );
|
||||
mUIRedSlider = UISlider::New()->setOrientation( UI_HORIZONTAL );
|
||||
mUIRedSlider->setParent( mUIWindow->getContainer() )->setSize( 255, 20 )->setPosition( Txt->getPosition().x + Txt->getSize().getWidth() + 16, Txt->getPosition().y );
|
||||
mUIRedSlider->setMaxValue( 255 );
|
||||
mUIRedSlider->setValue( mMap->getBaseColor().r() );
|
||||
mUIRedSlider->addEventListener( UIEvent::EventOnValueChange, cb::Make1( this, &TileMapProperties::onRedChange ) );
|
||||
|
||||
mUIRedTxt = createTextBox( String::toStr( (Uint32)mMap->getBaseColor().r() ), mUIWindow->getContainer(), Sizei(), Vector2i( mUIRedSlider->getPosition().x + mUIRedSlider->getSize().getWidth() + 4, mUIRedSlider->getPosition().y ), UI_CONTROL_DEFAULT_FLAGS | UI_DRAW_SHADOW | UI_AUTO_SIZE );
|
||||
mUIRedTxt = createTextBox( String::toStr( (Uint32)mMap->getBaseColor().r() ), mUIWindow->getContainer(), Sizei(), Vector2i( mUIRedSlider->getPosition().x + mUIRedSlider->getSize().getWidth() + 4, mUIRedSlider->getPosition().y ), UI_CONTROL_DEFAULT_FLAGS | UI_AUTO_SIZE, Text::Shadow );
|
||||
|
||||
Txt = createTextBox( "Green Color:", mUIWindow->getContainer(), Sizei(), Vector2i( mUIBaseColor->getPosition().x + mUIBaseColor->getSize().getWidth() + 4, mUIRedSlider->getPosition().y + mUIRedSlider->getSize().getHeight() + 4 ), UI_CONTROL_DEFAULT_FLAGS | UI_DRAW_SHADOW | UI_AUTO_SIZE );
|
||||
Txt = createTextBox( "Green Color:", mUIWindow->getContainer(), Sizei(), Vector2i( mUIBaseColor->getPosition().x + mUIBaseColor->getSize().getWidth() + 4, mUIRedSlider->getPosition().y + mUIRedSlider->getSize().getHeight() + 4 ), UI_CONTROL_DEFAULT_FLAGS | UI_AUTO_SIZE, Text::Shadow );
|
||||
|
||||
mUIGreenSlider = UISlider::New()->setOrientation( UI_HORIZONTAL );
|
||||
mUIGreenSlider->setParent( mUIWindow->getContainer() )->setSize( 255, 20 )->setPosition( mUIRedSlider->getPosition().x, Txt->getPosition().y );
|
||||
@@ -64,20 +65,20 @@ TileMapProperties::TileMapProperties( TileMap * Map ) :
|
||||
mUIGreenSlider->setValue( mMap->getBaseColor().g() );
|
||||
mUIGreenSlider->addEventListener( UIEvent::EventOnValueChange, cb::Make1( this, &TileMapProperties::onGreenChange ) );
|
||||
|
||||
mUIGreenTxt = createTextBox( String::toStr( (Uint32)mMap->getBaseColor().g() ), mUIWindow->getContainer(), Sizei(), Vector2i( mUIGreenSlider->getPosition().x + mUIGreenSlider->getSize().getWidth() + 4, mUIGreenSlider->getPosition().y ), UI_CONTROL_DEFAULT_FLAGS | UI_DRAW_SHADOW | UI_AUTO_SIZE );
|
||||
mUIGreenTxt = createTextBox( String::toStr( (Uint32)mMap->getBaseColor().g() ), mUIWindow->getContainer(), Sizei(), Vector2i( mUIGreenSlider->getPosition().x + mUIGreenSlider->getSize().getWidth() + 4, mUIGreenSlider->getPosition().y ), UI_CONTROL_DEFAULT_FLAGS | UI_AUTO_SIZE, Text::Shadow );
|
||||
|
||||
Txt = createTextBox( "Blue Color:", mUIWindow->getContainer(), Sizei(), Vector2i( mUIBaseColor->getPosition().x + mUIBaseColor->getSize().getWidth() + 4, mUIGreenSlider->getPosition().y + mUIGreenSlider->getSize().getHeight() + 4 ), UI_CONTROL_DEFAULT_FLAGS | UI_DRAW_SHADOW | UI_AUTO_SIZE );
|
||||
Txt = createTextBox( "Blue Color:", mUIWindow->getContainer(), Sizei(), Vector2i( mUIBaseColor->getPosition().x + mUIBaseColor->getSize().getWidth() + 4, mUIGreenSlider->getPosition().y + mUIGreenSlider->getSize().getHeight() + 4 ), UI_CONTROL_DEFAULT_FLAGS | UI_AUTO_SIZE, Text::Shadow );
|
||||
mUIBlueSlider = UISlider::New()->setOrientation( UI_HORIZONTAL );
|
||||
mUIBlueSlider->setParent( mUIWindow->getContainer() )->setSize( 255, 20 )->setPosition( mUIRedSlider->getPosition().x, Txt->getPosition().y );
|
||||
mUIBlueSlider->setMaxValue( 255 );
|
||||
mUIBlueSlider->setValue( mMap->getBaseColor().b() );
|
||||
mUIBlueSlider->addEventListener( UIEvent::EventOnValueChange, cb::Make1( this, &TileMapProperties::onBlueChange ) );
|
||||
|
||||
mUIBlueTxt = createTextBox( String::toStr( (Uint32)mMap->getBaseColor().b() ), mUIWindow->getContainer(), Sizei(), Vector2i( mUIBlueSlider->getPosition().x + mUIBlueSlider->getSize().getWidth() + 4, mUIBlueSlider->getPosition().y ), UI_CONTROL_DEFAULT_FLAGS | UI_DRAW_SHADOW | UI_AUTO_SIZE );
|
||||
mUIBlueTxt = createTextBox( String::toStr( (Uint32)mMap->getBaseColor().b() ), mUIWindow->getContainer(), Sizei(), Vector2i( mUIBlueSlider->getPosition().x + mUIBlueSlider->getSize().getWidth() + 4, mUIBlueSlider->getPosition().y ), UI_CONTROL_DEFAULT_FLAGS | UI_AUTO_SIZE, Text::Shadow );
|
||||
}
|
||||
|
||||
Uint32 TxtBoxFlags = UI_CONTROL_DEFAULT_FLAGS | UI_DRAW_SHADOW | UI_HALIGN_CENTER | UI_VALIGN_CENTER;
|
||||
UITextView * TxtBox = createTextBox( "Property Name", mUIWindow->getContainer(), Sizei(192, 24), Vector2i( 50, 10 + DiffIfLights ), TxtBoxFlags );
|
||||
Uint32 TxtBoxFlags = UI_CONTROL_DEFAULT_FLAGS | UI_HALIGN_CENTER | UI_VALIGN_CENTER;
|
||||
UITextView * TxtBox = createTextBox( "Property Name", mUIWindow->getContainer(), Sizei(192, 24), Vector2i( 50, 10 + DiffIfLights ), TxtBoxFlags, Text::Shadow );
|
||||
createTextBox( "Property Value", mUIWindow->getContainer(), Sizei(192, 24), Vector2i(50+192, TxtBox->getPosition().y ), TxtBoxFlags );
|
||||
|
||||
UIPushButton * OKButton = UIPushButton::New();
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
#include <eepp/gaming/mapeditor/uigotypenew.hpp>
|
||||
#include <eepp/ui/uitextinput.hpp>
|
||||
|
||||
namespace EE { namespace Gaming { namespace Private {
|
||||
|
||||
@@ -24,7 +23,7 @@ UIGOTypeNew::UIGOTypeNew( cb::Callback2<void, std::string, Uint32> Cb ) :
|
||||
Int32 DistFromTitle = 18;
|
||||
|
||||
UITextView * Txt = UITextView::New();
|
||||
Txt->setFlags( UI_DRAW_SHADOW | UI_AUTO_SIZE )->setParent( mUIWindow->getContainer() )->setPosition( 16, InitialY );
|
||||
Txt->setFontStyle( Text::Shadow )->setFlags( UI_AUTO_SIZE )->setParent( mUIWindow->getContainer() )->setPosition( 16, InitialY );
|
||||
Txt->setText( "GameObject Type Name" );
|
||||
|
||||
mUIInput = UITextInput::New()->setMaxLength( 64 );
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
|
||||
#include <eepp/gaming/base.hpp>
|
||||
#include <eepp/ui/uiwindow.hpp>
|
||||
#include <eepp/ui/uitextinput.hpp>
|
||||
|
||||
using namespace EE::UI;
|
||||
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
#include <eepp/gaming/mapeditor/uimaplayernew.hpp>
|
||||
#include <eepp/ui/uitextinput.hpp>
|
||||
|
||||
namespace EE { namespace Gaming { namespace Private {
|
||||
|
||||
@@ -30,7 +29,7 @@ UIMapLayerNew::UIMapLayerNew( UIMap * Map, EE_LAYER_TYPE Type, NewLayerCb newLay
|
||||
Int32 DistFromTitle = 18;
|
||||
|
||||
UITextView * Txt = UITextView::New();
|
||||
Txt->setFlags( UI_DRAW_SHADOW | UI_AUTO_SIZE )->setParent( mUIWindow->getContainer() )->setPosition( 16, InitialY );
|
||||
Txt->setFontStyle( Text::Shadow )->setFlags( UI_AUTO_SIZE )->setParent( mUIWindow->getContainer() )->setPosition( 16, InitialY );
|
||||
Txt->setText( "Layer Name" );
|
||||
|
||||
mUILayerName = UITextInput::New()->setMaxLength( 64 );
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
#include <eepp/gaming/base.hpp>
|
||||
#include <eepp/ui/uiwindow.hpp>
|
||||
#include <eepp/gaming/mapeditor/uimap.hpp>
|
||||
#include <eepp/ui/uitextinput.hpp>
|
||||
|
||||
using namespace EE::UI;
|
||||
|
||||
|
||||
@@ -1,12 +1,10 @@
|
||||
#include <eepp/gaming/mapeditor/uimapnew.hpp>
|
||||
#include <eepp/ui/uispinbox.hpp>
|
||||
#include <eepp/ui/uicheckbox.hpp>
|
||||
#include <eepp/ui/uislider.hpp>
|
||||
|
||||
namespace EE { namespace Gaming { namespace Private {
|
||||
|
||||
static UITextView * 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 ) {
|
||||
static UITextView * 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, const Uint32& fontStyle = Text::Regular ) {
|
||||
UITextView * Ctrl = UITextView::New();
|
||||
Ctrl->setFontStyle( fontStyle );
|
||||
Ctrl->resetFlags( Flags )->setParent( Parent )->setPosition( Pos )->setSize( Size )->setVisible( true )->setEnabled( false );
|
||||
Ctrl->setText( Text );
|
||||
return Ctrl;
|
||||
@@ -40,9 +38,9 @@ UIMapNew::UIMapNew( UIMap * Map, cb::Callback0<void> NewMapCb, bool ResizeMap )
|
||||
Int32 InitialY = 16;
|
||||
Int32 DistFromTitle = 18;
|
||||
|
||||
UITextView * Txt = createTextBox( "Map Size", mUIWindow->getContainer(), Sizei(), Vector2i( 16, InitialY ), UI_CONTROL_DEFAULT_FLAGS | UI_DRAW_SHADOW | UI_AUTO_SIZE );
|
||||
UITextView * Txt = createTextBox( "Map Size", mUIWindow->getContainer(), Sizei(), Vector2i( 16, InitialY ), UI_CONTROL_DEFAULT_FLAGS | UI_AUTO_SIZE, Text::Shadow );
|
||||
|
||||
Txt = createTextBox( "Width:", mUIWindow->getContainer(), Sizei( 46, 24 ), Vector2i( Txt->getPosition().x + DistFromTitle, Txt->getPosition().y + DistFromTitle ), UI_CONTROL_DEFAULT_FLAGS | UI_DRAW_SHADOW );
|
||||
Txt = createTextBox( "Width:", mUIWindow->getContainer(), Sizei( 46, 24 ), Vector2i( Txt->getPosition().x + DistFromTitle, Txt->getPosition().y + DistFromTitle ), UI_CONTROL_DEFAULT_FLAGS, Text::Shadow );
|
||||
|
||||
mUIMapWidth = UISpinBox::New()->setAllowOnlyNumbers( false )->setValue( 100 );
|
||||
mUIMapWidth->setParent( mUIWindow->getContainer() )->setSize( 53, 0 )->setPosition( Txt->getPosition().x + Txt->getSize().getWidth(), Txt->getPosition().y );
|
||||
@@ -52,7 +50,7 @@ UIMapNew::UIMapNew( UIMap * Map, cb::Callback0<void> NewMapCb, bool ResizeMap )
|
||||
mUIMapWidth->setValue( mUIMap->Map()->getSize().getWidth() );
|
||||
}
|
||||
|
||||
Txt = createTextBox( "Height:", mUIWindow->getContainer(), Sizei( 46, 24 ), Vector2i( Txt->getPosition().x, Txt->getPosition().y + Txt->getSize().getHeight() + 8 ), UI_CONTROL_DEFAULT_FLAGS | UI_DRAW_SHADOW );
|
||||
Txt = createTextBox( "Height:", mUIWindow->getContainer(), Sizei( 46, 24 ), Vector2i( Txt->getPosition().x, Txt->getPosition().y + Txt->getSize().getHeight() + 8 ), UI_CONTROL_DEFAULT_FLAGS, Text::Shadow );
|
||||
|
||||
mUIMapHeight = UISpinBox::New()->setAllowOnlyNumbers( false )->setValue( 100 );
|
||||
mUIMapHeight->setParent( mUIWindow->getContainer() )->setSize( 53, 0 )->setPosition( Txt->getPosition().x + Txt->getSize().getWidth(), Txt->getPosition().y );
|
||||
@@ -62,9 +60,9 @@ UIMapNew::UIMapNew( UIMap * Map, cb::Callback0<void> NewMapCb, bool ResizeMap )
|
||||
mUIMapHeight->setValue( mUIMap->Map()->getSize().getHeight() );
|
||||
}
|
||||
|
||||
Txt = createTextBox( "Tile Size", mUIWindow->getContainer(), Sizei(), Vector2i( mUIWindow->getContainer()->getSize().getWidth() / 2, InitialY ), UI_CONTROL_DEFAULT_FLAGS | UI_DRAW_SHADOW | UI_AUTO_SIZE );
|
||||
Txt = createTextBox( "Tile Size", mUIWindow->getContainer(), Sizei(), Vector2i( mUIWindow->getContainer()->getSize().getWidth() / 2, InitialY ), UI_CONTROL_DEFAULT_FLAGS | UI_AUTO_SIZE, Text::Shadow );
|
||||
|
||||
Txt = createTextBox( "Width:", mUIWindow->getContainer(), Sizei( 46, 24 ), Vector2i( Txt->getPosition().x + DistFromTitle, Txt->getPosition().y + DistFromTitle ), UI_CONTROL_DEFAULT_FLAGS | UI_DRAW_SHADOW );
|
||||
Txt = createTextBox( "Width:", mUIWindow->getContainer(), Sizei( 46, 24 ), Vector2i( Txt->getPosition().x + DistFromTitle, Txt->getPosition().y + DistFromTitle ), UI_CONTROL_DEFAULT_FLAGS, Text::Shadow );
|
||||
|
||||
mUIMapTWidth = UISpinBox::New()->setAllowOnlyNumbers( false )->setValue( 32 );
|
||||
mUIMapTWidth->setParent( mUIWindow->getContainer() )->setSize( 53, 0 )->setPosition( Txt->getPosition().x + Txt->getSize().getWidth(), Txt->getPosition().y );
|
||||
@@ -74,7 +72,7 @@ UIMapNew::UIMapNew( UIMap * Map, cb::Callback0<void> NewMapCb, bool ResizeMap )
|
||||
mUIMapTWidth->setValue( mUIMap->Map()->getTileSize().getWidth() );
|
||||
}
|
||||
|
||||
Txt = createTextBox( "Height:", mUIWindow->getContainer(), Sizei( 46, 24 ), Vector2i( Txt->getPosition().x, Txt->getPosition().y + Txt->getSize().getHeight() + 8 ), UI_CONTROL_DEFAULT_FLAGS | UI_DRAW_SHADOW );
|
||||
Txt = createTextBox( "Height:", mUIWindow->getContainer(), Sizei( 46, 24 ), Vector2i( Txt->getPosition().x, Txt->getPosition().y + Txt->getSize().getHeight() + 8 ), UI_CONTROL_DEFAULT_FLAGS, Text::Shadow );
|
||||
|
||||
mUIMapTHeight = UISpinBox::New()->setAllowOnlyNumbers( false )->setValue( 32 );
|
||||
mUIMapTHeight->setParent( mUIWindow->getContainer() )->setSize( 53, 0 )->setPosition( Txt->getPosition().x + Txt->getSize().getWidth(), Txt->getPosition().y );
|
||||
@@ -84,13 +82,13 @@ UIMapNew::UIMapNew( UIMap * Map, cb::Callback0<void> NewMapCb, bool ResizeMap )
|
||||
mUIMapTHeight->setValue( mUIMap->Map()->getTileSize().getHeight() );
|
||||
}
|
||||
|
||||
Txt = createTextBox( "Max Layers", mUIWindow->getContainer(), Sizei(), Vector2i( 16, mUIMapTHeight->getPosition().y + mUIMapTHeight->getSize().getHeight() + 8 ), UI_CONTROL_DEFAULT_FLAGS | UI_DRAW_SHADOW | UI_AUTO_SIZE );
|
||||
Txt = createTextBox( "Max Layers", mUIWindow->getContainer(), Sizei(), Vector2i( 16, mUIMapTHeight->getPosition().y + mUIMapTHeight->getSize().getHeight() + 8 ), UI_CONTROL_DEFAULT_FLAGS | UI_AUTO_SIZE, Text::Shadow );
|
||||
|
||||
mUIMapMaxLayers = UISpinBox::New()->setAllowOnlyNumbers( false )->setValue( 8 );
|
||||
mUIMapMaxLayers->setParent( mUIWindow->getContainer() )->setSize( 53, 0 )->setPosition( Txt->getPosition().x + DistFromTitle, Txt->getPosition().y + DistFromTitle );
|
||||
mUIMapMaxLayers->setMaxValue( 32 );
|
||||
|
||||
Txt = 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 );
|
||||
Txt = createTextBox( "Map Flags:", mUIWindow->getContainer(), Sizei(), Vector2i( Txt->getPosition().x, mUIMapMaxLayers->getPosition().y + mUIMapMaxLayers->getSize().getHeight() + 8 ), UI_CONTROL_DEFAULT_FLAGS | UI_AUTO_SIZE, Text::Shadow );
|
||||
|
||||
mUILightsEnabled = UICheckBox::New();
|
||||
mUILightsEnabled->setParent( mUIWindow->getContainer() )
|
||||
@@ -136,7 +134,7 @@ UIMapNew::UIMapNew( UIMap * Map, cb::Callback0<void> NewMapCb, bool ResizeMap )
|
||||
mUIClipArea->setActive( 0 != mUIMap->Map()->getClipedArea() );
|
||||
}
|
||||
|
||||
Txt = createTextBox( "Map Base Color:", mUIWindow->getContainer(), Sizei(), Vector2i( Txt->getPosition().x, mUIClipArea->getPosition().y + mUIClipArea->getSize().getHeight() + 8 ), UI_CONTROL_DEFAULT_FLAGS | UI_DRAW_SHADOW | UI_AUTO_SIZE );
|
||||
Txt = createTextBox( "Map Base Color:", mUIWindow->getContainer(), Sizei(), Vector2i( Txt->getPosition().x, mUIClipArea->getPosition().y + mUIClipArea->getSize().getHeight() + 8 ), UI_CONTROL_DEFAULT_FLAGS | UI_AUTO_SIZE, Text::Shadow );
|
||||
|
||||
mUIBaseColor = UIWidget::New();
|
||||
mUIBaseColor->setFlags( UI_FILL_BACKGROUND | UI_BORDER );
|
||||
@@ -144,7 +142,7 @@ UIMapNew::UIMapNew( UIMap * Map, cb::Callback0<void> NewMapCb, bool ResizeMap )
|
||||
mUIBaseColor->getBackground()->setColor( ResizeMap ? mUIMap->Map()->getBaseColor() : ColorA( 255, 255, 255, 255 ) );
|
||||
mUIBaseColor->setParent( mUIWindow->getContainer() )->setPosition( Txt->getPosition().x, Txt->getPosition().y + Txt->getSize().getHeight() + 4 )->setSize( 64, 64 );
|
||||
|
||||
Txt = createTextBox( "Red Color:", mUIWindow->getContainer(), Sizei(), Vector2i( mUIBaseColor->getPosition().x + mUIBaseColor->getSize().getWidth() + 4, mUIBaseColor->getPosition().y ), UI_CONTROL_DEFAULT_FLAGS | UI_DRAW_SHADOW | UI_AUTO_SIZE );
|
||||
Txt = createTextBox( "Red Color:", mUIWindow->getContainer(), Sizei(), Vector2i( mUIBaseColor->getPosition().x + mUIBaseColor->getSize().getWidth() + 4, mUIBaseColor->getPosition().y ), UI_CONTROL_DEFAULT_FLAGS | UI_AUTO_SIZE, Text::Shadow );
|
||||
|
||||
mUIRedSlider = UISlider::New()->setOrientation( UI_HORIZONTAL );
|
||||
mUIRedSlider->setParent( mUIWindow->getContainer() )->setSize( 128, 20 )->setPosition( Txt->getPosition().x + Txt->getSize().getWidth() + 16, Txt->getPosition().y );
|
||||
@@ -152,13 +150,13 @@ UIMapNew::UIMapNew( UIMap * Map, cb::Callback0<void> NewMapCb, bool ResizeMap )
|
||||
mUIRedSlider->setValue( 255 );
|
||||
mUIRedSlider->addEventListener( UIEvent::EventOnValueChange, cb::Make1( this, &UIMapNew::onRedChange ) );
|
||||
|
||||
mUIRedTxt = createTextBox( String::toStr( 255 ), mUIWindow->getContainer(), Sizei(), Vector2i( mUIRedSlider->getPosition().x + mUIRedSlider->getSize().getWidth() + 4, mUIRedSlider->getPosition().y ), UI_CONTROL_DEFAULT_FLAGS | UI_DRAW_SHADOW | UI_AUTO_SIZE );
|
||||
mUIRedTxt = createTextBox( String::toStr( 255 ), mUIWindow->getContainer(), Sizei(), Vector2i( mUIRedSlider->getPosition().x + mUIRedSlider->getSize().getWidth() + 4, mUIRedSlider->getPosition().y ), UI_CONTROL_DEFAULT_FLAGS | UI_AUTO_SIZE, Text::Shadow );
|
||||
|
||||
if ( ResizeMap ) {
|
||||
mUIRedSlider->setValue( mUIMap->Map()->getBaseColor().r() );
|
||||
}
|
||||
|
||||
Txt = createTextBox( "Green Color:", mUIWindow->getContainer(), Sizei(), Vector2i( mUIBaseColor->getPosition().x + mUIBaseColor->getSize().getWidth() + 4, mUIRedSlider->getPosition().y + mUIRedSlider->getSize().getHeight() + 4 ), UI_CONTROL_DEFAULT_FLAGS | UI_DRAW_SHADOW | UI_AUTO_SIZE );
|
||||
Txt = createTextBox( "Green Color:", mUIWindow->getContainer(), Sizei(), Vector2i( mUIBaseColor->getPosition().x + mUIBaseColor->getSize().getWidth() + 4, mUIRedSlider->getPosition().y + mUIRedSlider->getSize().getHeight() + 4 ), UI_CONTROL_DEFAULT_FLAGS | UI_AUTO_SIZE, Text::Shadow );
|
||||
|
||||
mUIGreenSlider = UISlider::New()->setOrientation( UI_HORIZONTAL );
|
||||
mUIGreenSlider->setParent( mUIWindow->getContainer() )->setSize( 128, 20 )->setPosition( mUIRedSlider->getPosition().x, Txt->getPosition().y );
|
||||
@@ -166,13 +164,13 @@ UIMapNew::UIMapNew( UIMap * Map, cb::Callback0<void> NewMapCb, bool ResizeMap )
|
||||
mUIGreenSlider->setValue( 255 );
|
||||
mUIGreenSlider->addEventListener( UIEvent::EventOnValueChange, cb::Make1( this, &UIMapNew::onGreenChange ) );
|
||||
|
||||
mUIGreenTxt = createTextBox( String::toStr( 255 ), mUIWindow->getContainer(), Sizei(), Vector2i( mUIGreenSlider->getPosition().x + mUIGreenSlider->getSize().getWidth() + 4, mUIGreenSlider->getPosition().y ), UI_CONTROL_DEFAULT_FLAGS | UI_DRAW_SHADOW | UI_AUTO_SIZE );
|
||||
mUIGreenTxt = createTextBox( String::toStr( 255 ), mUIWindow->getContainer(), Sizei(), Vector2i( mUIGreenSlider->getPosition().x + mUIGreenSlider->getSize().getWidth() + 4, mUIGreenSlider->getPosition().y ), UI_CONTROL_DEFAULT_FLAGS | UI_AUTO_SIZE, Text::Shadow );
|
||||
|
||||
if ( ResizeMap ) {
|
||||
mUIGreenSlider->setValue( mUIMap->Map()->getBaseColor().g() );
|
||||
}
|
||||
|
||||
Txt = createTextBox( "Blue Color:", mUIWindow->getContainer(), Sizei(), Vector2i( mUIBaseColor->getPosition().x + mUIBaseColor->getSize().getWidth() + 4, mUIGreenSlider->getPosition().y + mUIGreenSlider->getSize().getHeight() + 4 ), UI_CONTROL_DEFAULT_FLAGS | UI_DRAW_SHADOW | UI_AUTO_SIZE );
|
||||
Txt = createTextBox( "Blue Color:", mUIWindow->getContainer(), Sizei(), Vector2i( mUIBaseColor->getPosition().x + mUIBaseColor->getSize().getWidth() + 4, mUIGreenSlider->getPosition().y + mUIGreenSlider->getSize().getHeight() + 4 ), UI_CONTROL_DEFAULT_FLAGS | UI_AUTO_SIZE, Text::Shadow );
|
||||
|
||||
mUIBlueSlider = UISlider::New()->setOrientation( UI_HORIZONTAL );
|
||||
mUIBlueSlider->setParent( mUIWindow->getContainer() )->setSize( 128, 20 )->setPosition( mUIRedSlider->getPosition().x, Txt->getPosition().y );
|
||||
@@ -180,7 +178,7 @@ UIMapNew::UIMapNew( UIMap * Map, cb::Callback0<void> NewMapCb, bool ResizeMap )
|
||||
mUIBlueSlider->setValue( 255 );
|
||||
mUIBlueSlider->addEventListener( UIEvent::EventOnValueChange, cb::Make1( this, &UIMapNew::onBlueChange ) );
|
||||
|
||||
mUIBlueTxt = createTextBox( String::toStr( 255 ), mUIWindow->getContainer(), Sizei(), Vector2i( mUIBlueSlider->getPosition().x + mUIBlueSlider->getSize().getWidth() + 4, mUIBlueSlider->getPosition().y ), UI_CONTROL_DEFAULT_FLAGS | UI_DRAW_SHADOW | UI_AUTO_SIZE );
|
||||
mUIBlueTxt = createTextBox( String::toStr( 255 ), mUIWindow->getContainer(), Sizei(), Vector2i( mUIBlueSlider->getPosition().x + mUIBlueSlider->getSize().getWidth() + 4, mUIBlueSlider->getPosition().y ), UI_CONTROL_DEFAULT_FLAGS | UI_AUTO_SIZE, Text::Shadow );
|
||||
|
||||
if ( ResizeMap ) {
|
||||
mUIBlueSlider->setValue( mUIMap->Map()->getBaseColor().b() );
|
||||
|
||||
@@ -3,6 +3,9 @@
|
||||
|
||||
#include <eepp/gaming/base.hpp>
|
||||
#include <eepp/ui/uiwindow.hpp>
|
||||
#include <eepp/ui/uispinbox.hpp>
|
||||
#include <eepp/ui/uicheckbox.hpp>
|
||||
#include <eepp/ui/uislider.hpp>
|
||||
#include <eepp/gaming/mapeditor/uimap.hpp>
|
||||
|
||||
using namespace EE::UI;
|
||||
|
||||
@@ -429,10 +429,10 @@ void Text::draw(const Float & X, const Float & Y, const Vector2f & Scale, const
|
||||
TextureFactory::instance()->bind( mFont->getTexture(mRealCharacterSize) );
|
||||
BlendMode::setMode( Effect );
|
||||
|
||||
if ( mFlags & FONT_DRAW_SHADOW ) {
|
||||
Uint32 f = mFlags;
|
||||
if ( mStyle & Shadow ) {
|
||||
Uint32 f = mStyle;
|
||||
|
||||
mFlags &= ~FONT_DRAW_SHADOW;
|
||||
mStyle &= ~Shadow;
|
||||
|
||||
ColorA Col = getFillColor();
|
||||
|
||||
@@ -450,7 +450,7 @@ void Text::draw(const Float & X, const Float & Y, const Vector2f & Scale, const
|
||||
|
||||
draw( X + pd, Y + pd, Scale, Angle, Effect );
|
||||
|
||||
mFlags = f;
|
||||
mStyle = f;
|
||||
|
||||
setFillColor( Col );
|
||||
}
|
||||
@@ -579,17 +579,15 @@ void Text::ensureGeometryUpdate() {
|
||||
Float centerDiffX = 0;
|
||||
unsigned int Line = 0;
|
||||
|
||||
if ( !( mFlags & FONT_DRAW_VERTICAL ) ) {
|
||||
switch ( fontHAlignGet( mFlags ) ) {
|
||||
case FONT_DRAW_CENTER:
|
||||
centerDiffX = (Float)( (Int32)( ( mCachedWidth - mLinesWidth[ Line ] ) * 0.5f ) );
|
||||
Line++;
|
||||
break;
|
||||
case FONT_DRAW_RIGHT:
|
||||
centerDiffX = mCachedWidth - getLinesWidth()[ Line ];
|
||||
Line++;
|
||||
break;
|
||||
}
|
||||
switch ( fontHAlignGet( mFlags ) ) {
|
||||
case FONT_DRAW_CENTER:
|
||||
centerDiffX = (Float)( (Int32)( ( mCachedWidth - mLinesWidth[ Line ] ) * 0.5f ) );
|
||||
Line++;
|
||||
break;
|
||||
case FONT_DRAW_RIGHT:
|
||||
centerDiffX = mCachedWidth - getLinesWidth()[ Line ];
|
||||
Line++;
|
||||
break;
|
||||
}
|
||||
|
||||
for (std::size_t i = 0; i < mString.size(); ++i) {
|
||||
@@ -749,4 +747,13 @@ void Text::cacheWidth() {
|
||||
}
|
||||
}
|
||||
|
||||
void Text::setStyleConfig( const FontStyleConfig& styleConfig ) {
|
||||
setFont( styleConfig.Font );
|
||||
setCharacterSize( styleConfig.CharacterSize );
|
||||
setFillColor( styleConfig.Color );
|
||||
setStyle( styleConfig.Style );
|
||||
setOutlineThickness( styleConfig.OutlineThickness );
|
||||
setOutlineColor( styleConfig.OutlineColor );
|
||||
}
|
||||
|
||||
}}
|
||||
|
||||
@@ -217,7 +217,8 @@ void TextureAtlasEditor::onDestHChange( const UIEvent * Event ) {
|
||||
|
||||
UITextView * TextureAtlasEditor::createTextBox( Vector2i Pos, const String& Text ) {
|
||||
UITextView * txtBox = UITextView::New();
|
||||
txtBox->resetFlags( UI_CONTROL_DEFAULT_ALIGN | UI_ANCHOR_TOP | UI_ANCHOR_RIGHT | UI_DRAW_SHADOW | UI_AUTO_SIZE );
|
||||
txtBox->setFontStyle( Text::Shadow );
|
||||
txtBox->resetFlags( UI_CONTROL_DEFAULT_ALIGN | UI_ANCHOR_TOP | UI_ANCHOR_RIGHT | UI_AUTO_SIZE );
|
||||
txtBox->setParent( mUIContainer );
|
||||
txtBox->setPosition( Pos );
|
||||
txtBox->setText( Text );
|
||||
|
||||
@@ -104,9 +104,10 @@ TextureAtlasNew::~TextureAtlasNew() {
|
||||
|
||||
UITextView * TextureAtlasNew::createTxtBox( Vector2i Pos, const String& Text ) {
|
||||
UITextView * textBox = UITextView::New();
|
||||
textBox->setParent( mUIWindow->getContainer() )
|
||||
textBox->setFontStyle( Text::Shadow )
|
||||
->setFlags( UI_AUTO_SIZE )
|
||||
->setParent( mUIWindow->getContainer() )
|
||||
->setPosition( Pos )
|
||||
->setFlags( UI_DRAW_SHADOW | UI_AUTO_SIZE )
|
||||
->setVisible( true )
|
||||
->setEnabled( true );
|
||||
textBox->setText( Text );
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
#include <eepp/ui/uimanager.hpp>
|
||||
#include <eepp/graphics/subtexture.hpp>
|
||||
#include <eepp/graphics/text.hpp>
|
||||
#include <eepp/helper/pugixml/pugixml.hpp>
|
||||
|
||||
namespace EE { namespace UI {
|
||||
|
||||
@@ -165,6 +166,19 @@ void UICheckBox::setTextSeparation(const Int32 & textSeparation) {
|
||||
setPadding( getPadding() );
|
||||
}
|
||||
|
||||
void UICheckBox::loadFromXmlNode(const pugi::xml_node & node) {
|
||||
UIWidget::loadFromXmlNode( node );
|
||||
|
||||
for (pugi::xml_attribute_iterator ait = node.attributes_begin(); ait != node.attributes_end(); ++ait) {
|
||||
std::string name = ait->name();
|
||||
String::toLowerInPlace( name );
|
||||
|
||||
if ( "selected" == name || "active" == name ) {
|
||||
setActive( ait->as_bool() );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Uint32 UICheckBox::onKeyDown( const UIEventKey& Event ) {
|
||||
UITextView::onKeyDown( Event );
|
||||
|
||||
|
||||
@@ -75,6 +75,10 @@ const String& UIComboBox::getText() {
|
||||
return mDropDownList->getText();
|
||||
}
|
||||
|
||||
void UIComboBox::loadFromXmlNode(const pugi::xml_node& node) {
|
||||
mDropDownList->loadFromXmlNode( node );
|
||||
}
|
||||
|
||||
void UIComboBox::updateControls() {
|
||||
if ( ( mFlags & UI_AUTO_SIZE ) || mSize.getHeight() < mDropDownList->getSkin()->getSize().getHeight() ) {
|
||||
onAutoSize();
|
||||
|
||||
@@ -637,7 +637,7 @@ EE_BLEND_MODE UIControl::getBlendMode() {
|
||||
}
|
||||
|
||||
void UIControl::toFront() {
|
||||
if ( NULL != mParentCtrl ) {
|
||||
if ( NULL != mParentCtrl && mParentCtrl->mChildLast != this ) {
|
||||
mParentCtrl->childRemove( this );
|
||||
mParentCtrl->childAdd( this );
|
||||
}
|
||||
|
||||
@@ -184,11 +184,11 @@ void UIDropDownList::setMaxNumVisibleItems(const Uint32 & maxNumVisibleItems) {
|
||||
mListBox->setSize( mSize.getWidth(), mStyleConfig.MaxNumVisibleItems * mSize.getHeight() );
|
||||
}
|
||||
|
||||
DropDownListStyleConfig UIDropDownList::getStyleConfig() const {
|
||||
UIDropDownListStyleConfig UIDropDownList::getStyleConfig() const {
|
||||
return mStyleConfig;
|
||||
}
|
||||
|
||||
void UIDropDownList::setStyleConfig(const DropDownListStyleConfig & styleConfig) {
|
||||
void UIDropDownList::setStyleConfig(const UIDropDownListStyleConfig & styleConfig) {
|
||||
mStyleConfig = styleConfig;
|
||||
|
||||
mListBox->setFontStyleConfig( mStyleConfig );
|
||||
|
||||
@@ -35,6 +35,8 @@ UIWidget * UIHelper::createUIWidgetFromName( std::string name ) {
|
||||
return UILinearLayout::NewHorizontal();
|
||||
} else if ( name == "linearlayout" || name == "verticallinearlayout" || name == "vll" ) {
|
||||
return UILinearLayout::NewVertical();
|
||||
} else if ( name == "relativelayout" ) {
|
||||
return UIRelativeLayout::New();
|
||||
} else if ( name == "textview" ) {
|
||||
return UITextView::New();
|
||||
} else if ( name == "pushbutton" ) {
|
||||
|
||||
@@ -144,7 +144,7 @@ Uint32 UIListBox::addListBoxItem( const String& text ) {
|
||||
mItems.push_back( NULL );
|
||||
|
||||
if ( NULL != mFontStyleConfig.Font ) {
|
||||
Text textCache( mFontStyleConfig.Font, mFontStyleConfig.FontCharacterSize );
|
||||
Text textCache( mFontStyleConfig.Font, mFontStyleConfig.CharacterSize );
|
||||
textCache.setString( text );
|
||||
Uint32 twidth = textCache.getTextWidth();
|
||||
|
||||
@@ -299,13 +299,13 @@ void UIListBox::setRowHeight() {
|
||||
Uint32 FontSize = PixelDensity::dpToPxI( 12 );
|
||||
|
||||
if ( NULL != UIThemeManager::instance()->getDefaultFont() )
|
||||
FontSize = UIThemeManager::instance()->getDefaultFont()->getFontHeight( PixelDensity::dpToPxI( UIThemeManager::instance()->getDefaultFontStyleConfig().FontCharacterSize ) );
|
||||
FontSize = UIThemeManager::instance()->getDefaultFont()->getFontHeight( PixelDensity::dpToPxI( UIThemeManager::instance()->getDefaultFontStyleConfig().CharacterSize ) );
|
||||
|
||||
if ( NULL != mSkinState && NULL != mSkinState->getSkin() && NULL != mSkinState->getSkin()->getTheme() && NULL != mSkinState->getSkin()->getTheme()->getFontStyleConfig().getFont() )
|
||||
FontSize = mSkinState->getSkin()->getTheme()->getFontStyleConfig().getFont()->getFontHeight( PixelDensity::dpToPxI( mSkinState->getSkin()->getTheme()->getFontStyleConfig().FontCharacterSize ) );
|
||||
FontSize = mSkinState->getSkin()->getTheme()->getFontStyleConfig().getFont()->getFontHeight( PixelDensity::dpToPxI( mSkinState->getSkin()->getTheme()->getFontStyleConfig().CharacterSize ) );
|
||||
|
||||
if ( NULL != mFontStyleConfig.getFont() )
|
||||
FontSize = mFontStyleConfig.getFont()->getFontHeight( PixelDensity::dpToPxI( mFontStyleConfig.FontCharacterSize ) );
|
||||
FontSize = mFontStyleConfig.getFont()->getFontHeight( PixelDensity::dpToPxI( mFontStyleConfig.CharacterSize ) );
|
||||
|
||||
mRowHeight = (Uint32)PixelDensity::pxToDpI( FontSize );
|
||||
}
|
||||
@@ -332,7 +332,7 @@ void UIListBox::setHScrollStep() {
|
||||
void UIListBox::findMaxWidth() {
|
||||
Uint32 size = (Uint32)mItems.size();
|
||||
Int32 width;
|
||||
Text textCache( mFontStyleConfig.Font, mFontStyleConfig.FontCharacterSize );
|
||||
Text textCache( mFontStyleConfig.Font, mFontStyleConfig.CharacterSize );
|
||||
|
||||
mMaxTextWidth = 0;
|
||||
|
||||
@@ -683,14 +683,14 @@ Uint32 UIListBox::getItemIndex( const String& Text ) {
|
||||
}
|
||||
|
||||
void UIListBox::setFontColor( const ColorA& Color ) {
|
||||
mFontStyleConfig.FontColor = Color;
|
||||
mFontStyleConfig.Color = Color;
|
||||
|
||||
for ( Uint32 i = 0; i < mItems.size(); i++ )
|
||||
mItems[i]->setFontColor( mFontStyleConfig.FontColor );
|
||||
mItems[i]->setFontColor( mFontStyleConfig.Color );
|
||||
}
|
||||
|
||||
const ColorA& UIListBox::getFontColor() const {
|
||||
return mFontStyleConfig.FontColor;
|
||||
return mFontStyleConfig.Color;
|
||||
}
|
||||
|
||||
void UIListBox::setFontOverColor( const ColorA& Color ) {
|
||||
@@ -973,15 +973,15 @@ void UIListBox::setTouchDragDeceleration(const Float & touchDragDeceleration) {
|
||||
mTouchDragDeceleration = touchDragDeceleration;
|
||||
}
|
||||
|
||||
FontStyleConfig UIListBox::getFontStyleConfig() const {
|
||||
UIFontStyleConfig UIListBox::getFontStyleConfig() const {
|
||||
return mFontStyleConfig;
|
||||
}
|
||||
|
||||
void UIListBox::setFontStyleConfig(const FontStyleConfig & fontStyleConfig) {
|
||||
void UIListBox::setFontStyleConfig(const UIFontStyleConfig & fontStyleConfig) {
|
||||
mFontStyleConfig = fontStyleConfig;
|
||||
|
||||
setFont( mFontStyleConfig.Font );
|
||||
setFontColor( mFontStyleConfig.FontColor );
|
||||
setFontColor( mFontStyleConfig.Color );
|
||||
}
|
||||
|
||||
void UIListBox::update() {
|
||||
@@ -1068,7 +1068,7 @@ void UIListBox::loadFromXmlNode(const pugi::xml_node & node) {
|
||||
} else if ( "textcolor" == name ) {
|
||||
setFontColor( ColorA::fromString( ait->as_string() ) );
|
||||
} else if ( "textshadowcolor" == name ) {
|
||||
mFontStyleConfig.FontShadowColor = ( ColorA::fromString( ait->as_string() ) );
|
||||
mFontStyleConfig.ShadowColor = ( ColorA::fromString( ait->as_string() ) );
|
||||
} else if ( "textovercolor" == name ) {
|
||||
setFontOverColor( ColorA::fromString( ait->as_string() ) );
|
||||
} else if ( "textselectedcolor" == name ) {
|
||||
|
||||
@@ -50,7 +50,7 @@ void UIManager::init( Uint32 Flags, EE::Window::Window * window ) {
|
||||
mInit = true;
|
||||
|
||||
|
||||
WindowStyleConfig windowStyleConfig;
|
||||
UIWindowStyleConfig windowStyleConfig;
|
||||
windowStyleConfig.WinFlags = UI_WIN_NO_BORDER | UI_WIN_RESIZEABLE;
|
||||
windowStyleConfig.MinWindowSize = Sizei( 0, 0 );
|
||||
windowStyleConfig.DecorationSize = Sizei( 0, 0 );
|
||||
@@ -519,7 +519,7 @@ void UIManager::loadLayoutNodes( pugi::xml_node node, UIControl * parent ) {
|
||||
}
|
||||
}
|
||||
|
||||
void UIManager::loadLayout( const std::string& layoutPath ) {
|
||||
void UIManager::loadLayoutFromFile( const std::string& layoutPath ) {
|
||||
if ( FileSystem::fileExists( layoutPath ) ) {
|
||||
pugi::xml_document doc;
|
||||
pugi::xml_parse_result result = doc.load_file( layoutPath.c_str() );
|
||||
|
||||
@@ -59,7 +59,7 @@ void UIMenu::onThemeLoaded() {
|
||||
}
|
||||
|
||||
UIMenuItem * UIMenu::createMenuItem( const String& Text, SubTexture * Icon ) {
|
||||
PushButtonStyleConfig styleConfig( mStyleConfig );
|
||||
UIPushButtonStyleConfig styleConfig( mStyleConfig );
|
||||
styleConfig.IconMinSize = Sizei( mStyleConfig.MinSpaceForIcons, mStyleConfig.MinSpaceForIcons );
|
||||
|
||||
UIMenuItem * tCtrl = UIMenuItem::New();
|
||||
@@ -77,7 +77,7 @@ Uint32 UIMenu::add( const String& Text, SubTexture * Icon ) {
|
||||
}
|
||||
|
||||
UIMenuCheckBox * UIMenu::createMenuCheckBox( const String& Text, const bool &Active ) {
|
||||
PushButtonStyleConfig styleConfig( mStyleConfig );
|
||||
UIPushButtonStyleConfig styleConfig( mStyleConfig );
|
||||
styleConfig.IconMinSize = Sizei( mStyleConfig.MinSpaceForIcons, mStyleConfig.MinSpaceForIcons );
|
||||
|
||||
UIMenuCheckBox * tCtrl = UIMenuCheckBox::New();
|
||||
@@ -97,7 +97,7 @@ Uint32 UIMenu::addCheckBox( const String& Text, const bool& Active ) {
|
||||
}
|
||||
|
||||
UIMenuSubMenu * UIMenu::createSubMenu( const String& Text, SubTexture * Icon, UIMenu * SubMenu ) {
|
||||
PushButtonStyleConfig styleConfig( mStyleConfig );
|
||||
UIPushButtonStyleConfig styleConfig( mStyleConfig );
|
||||
styleConfig.IconMinSize = Sizei( mStyleConfig.MinSpaceForIcons, mStyleConfig.MinSpaceForIcons );
|
||||
|
||||
UIMenuSubMenu * tCtrl = UIMenuSubMenu::New();
|
||||
@@ -517,11 +517,11 @@ void UIMenu::setMinRightMargin(const Uint32 & minRightMargin) {
|
||||
rePosControls();
|
||||
}
|
||||
|
||||
TooltipStyleConfig UIMenu::getFontStyleConfig() const {
|
||||
UITooltipStyleConfig UIMenu::getFontStyleConfig() const {
|
||||
return mStyleConfig;
|
||||
}
|
||||
|
||||
void UIMenu::setFontStyleConfig(const TooltipStyleConfig & fontStyleConfig) {
|
||||
void UIMenu::setFontStyleConfig(const UITooltipStyleConfig & fontStyleConfig) {
|
||||
mStyleConfig = fontStyleConfig;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
#include <eepp/ui/uiprogressbar.hpp>
|
||||
#include <eepp/helper/pugixml/pugixml.hpp>
|
||||
#include <eepp/graphics/globaltextureatlas.hpp>
|
||||
|
||||
namespace EE { namespace UI {
|
||||
|
||||
@@ -174,8 +176,8 @@ const bool& UIProgressBar::getVerticalExpand() const {
|
||||
return mStyleConfig.VerticalExpand;
|
||||
}
|
||||
|
||||
void UIProgressBar::setFillerPadding( const Rectf& margin ) {
|
||||
mStyleConfig.FillerPadding = margin;
|
||||
void UIProgressBar::setFillerPadding( const Rectf& padding ) {
|
||||
mStyleConfig.FillerPadding = padding;
|
||||
|
||||
onPositionChange();
|
||||
onSizeChange();
|
||||
@@ -205,6 +207,41 @@ UITextView * UIProgressBar::getTextBox() const {
|
||||
return mTextBox;
|
||||
}
|
||||
|
||||
void UIProgressBar::loadFromXmlNode(const pugi::xml_node & node) {
|
||||
UIWidget::loadFromXmlNode( node );
|
||||
|
||||
for (pugi::xml_attribute_iterator ait = node.attributes_begin(); ait != node.attributes_end(); ++ait) {
|
||||
std::string name = ait->name();
|
||||
String::toLowerInPlace( name );
|
||||
|
||||
if ( "src" == name ) {
|
||||
SubTexture * subTexture = GlobalTextureAtlas::instance()->getByName( ait->as_string() );
|
||||
|
||||
if ( NULL != mParallax && NULL != subTexture )
|
||||
mParallax->setSubTexture( subTexture );
|
||||
} else if ( "totalsteps" == name ) {
|
||||
setTotalSteps( ait->as_float() );
|
||||
} else if ( "progress" == name ) {
|
||||
setProgress( ait->as_float() );
|
||||
} else if ( "verticalexpand" == name ) {
|
||||
setVerticalExpand( ait->as_bool() );
|
||||
} else if ( "displaypercent" == name ) {
|
||||
setDisplayPercent( ait->as_bool() );
|
||||
} else if ( "fillerpadding" == name ) {
|
||||
Float val = PixelDensity::toDpFromString( ait->as_string() );
|
||||
setFillerPadding( Rectf( val, val, val, val ) );
|
||||
} else if ( "fillerpaddingleft" == name ) {
|
||||
setFillerPadding( Rectf( PixelDensity::toDpFromString( ait->as_string() ), mStyleConfig.FillerPadding.Top, mStyleConfig.FillerPadding.Right, mStyleConfig.FillerPadding.Bottom ) );
|
||||
} else if ( "fillerpaddingright" == name ) {
|
||||
setFillerPadding( Rectf( mStyleConfig.FillerPadding.Left, mStyleConfig.FillerPadding.Top, PixelDensity::toDpFromString( ait->as_string() ), mStyleConfig.FillerPadding.Bottom ) );
|
||||
} else if ( "fillerpaddingtop" == name ) {
|
||||
setFillerPadding( Rectf( mStyleConfig.FillerPadding.Left, PixelDensity::toDpFromString( ait->as_string() ), mStyleConfig.FillerPadding.Right, mStyleConfig.FillerPadding.Bottom ) );
|
||||
} else if ( "fillerpaddingbottom" == name ) {
|
||||
setFillerPadding( Rectf( mStyleConfig.FillerPadding.Left, mStyleConfig.FillerPadding.Top, mStyleConfig.FillerPadding.Right, PixelDensity::toDpFromString( ait->as_string() ) ) );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void UIProgressBar::onAlphaChange() {
|
||||
UIControlAnim::onAlphaChange();
|
||||
|
||||
|
||||
@@ -73,7 +73,7 @@ void UIPushButton::onSizeChange() {
|
||||
}
|
||||
|
||||
if ( ( mFlags & UI_AUTO_SIZE ) ) {
|
||||
Int32 txtW = NULL != mTextBox ? PixelDensity::pxToDpI( mTextBox->getTextCache()->getTextWidth() ) : 0;
|
||||
Int32 txtW = NULL != mTextBox ? PixelDensity::pxToDpI( mTextBox->getTextWidth() ) : 0;
|
||||
Int32 minSize = txtW + ( NULL != mIcon ? mIcon->getSize().getWidth() : 0 )
|
||||
+ mStyleConfig.IconHorizontalMargin + mTextBox->getPadding().Left + mTextBox->getPadding().Right +
|
||||
( NULL != getSkin() ? getSkin()->getBorderSize().getWidth() : 0 );
|
||||
@@ -211,7 +211,7 @@ void UIPushButton::onStateChange() {
|
||||
if ( mSkinState->getState() == UISkinState::StateMouseEnter ) {
|
||||
mTextBox->setFontColor( mStyleConfig.FontOverColor );
|
||||
} else {
|
||||
mTextBox->setFontColor( mStyleConfig.FontColor );
|
||||
mTextBox->setFontColor( mStyleConfig.Color );
|
||||
}
|
||||
|
||||
mTextBox->setAlpha( mAlpha );
|
||||
@@ -242,11 +242,11 @@ Uint32 UIPushButton::onKeyUp( const UIEventKey& Event ) {
|
||||
return UIWidget::onKeyUp( Event );
|
||||
}
|
||||
const ColorA& UIPushButton::getFontColor() const {
|
||||
return mStyleConfig.FontColor;
|
||||
return mStyleConfig.Color;
|
||||
}
|
||||
|
||||
void UIPushButton::setFontColor( const ColorA& color ) {
|
||||
mStyleConfig.FontColor = color;
|
||||
mStyleConfig.Color = color;
|
||||
onStateChange();
|
||||
}
|
||||
|
||||
@@ -267,11 +267,59 @@ void UIPushButton::setFontShadowColor( const ColorA& color ) {
|
||||
mTextBox->setFontShadowColor( color );
|
||||
}
|
||||
|
||||
TooltipStyleConfig UIPushButton::getStyleConfig() const {
|
||||
Uint32 UIPushButton::getCharacterSize() {
|
||||
return mTextBox->getCharacterSize();
|
||||
}
|
||||
|
||||
void UIPushButton::setCharacterSize(const Uint32 & characterSize) {
|
||||
mTextBox->setCharacterSize( characterSize );
|
||||
onSizeChange();
|
||||
}
|
||||
|
||||
const Uint32 &UIPushButton::getFontStyle() const {
|
||||
return mStyleConfig.Style;
|
||||
}
|
||||
|
||||
const Float &UIPushButton::getOutlineThickness() const {
|
||||
return mStyleConfig.OutlineThickness;
|
||||
}
|
||||
|
||||
UIPushButton * UIPushButton::setOutlineThickness( const Float & outlineThickness ) {
|
||||
if ( mStyleConfig.OutlineThickness != outlineThickness ) {
|
||||
mTextBox->setOutlineThickness( outlineThickness );
|
||||
mStyleConfig.OutlineThickness = outlineThickness;
|
||||
}
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
const ColorA &UIPushButton::getOutlineColor() const {
|
||||
return mStyleConfig.OutlineColor;
|
||||
}
|
||||
|
||||
UIPushButton * UIPushButton::setOutlineColor(const ColorA & outlineColor) {
|
||||
if ( mStyleConfig.OutlineColor != outlineColor ) {
|
||||
mTextBox->setOutlineColor( outlineColor );
|
||||
mStyleConfig.OutlineColor = outlineColor;
|
||||
}
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
UIPushButton * UIPushButton::setFontStyle(const Uint32 & fontStyle) {
|
||||
if ( mStyleConfig.Style != fontStyle ) {
|
||||
mTextBox->setFontStyle( fontStyle );
|
||||
mStyleConfig.Style = fontStyle;
|
||||
}
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
UITooltipStyleConfig UIPushButton::getStyleConfig() const {
|
||||
return mStyleConfig;
|
||||
}
|
||||
|
||||
void UIPushButton::setStyleConfig(const PushButtonStyleConfig & styleConfig) {
|
||||
void UIPushButton::setStyleConfig(const UIPushButtonStyleConfig & styleConfig) {
|
||||
mStyleConfig = styleConfig;
|
||||
mTextBox->setFontStyleConfig( styleConfig );
|
||||
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
#include <eepp/ui/uimanager.hpp>
|
||||
#include <eepp/graphics/subtexture.hpp>
|
||||
#include <eepp/graphics/text.hpp>
|
||||
#include <eepp/helper/pugixml/pugixml.hpp>
|
||||
|
||||
namespace EE { namespace UI {
|
||||
|
||||
@@ -225,6 +226,19 @@ void UIRadioButton::setTextSeparation(const Int32 & textSeparation) {
|
||||
setPadding( getPadding() );
|
||||
}
|
||||
|
||||
void UIRadioButton::loadFromXmlNode(const pugi::xml_node & node) {
|
||||
UIWidget::loadFromXmlNode( node );
|
||||
|
||||
for (pugi::xml_attribute_iterator ait = node.attributes_begin(); ait != node.attributes_end(); ++ait) {
|
||||
std::string name = ait->name();
|
||||
String::toLowerInPlace( name );
|
||||
|
||||
if ( "selected" == name || "active" == name ) {
|
||||
setActive( ait->as_bool() );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Uint32 UIRadioButton::onKeyDown( const UIEventKey& Event ) {
|
||||
if ( Event.getKeyCode() == KEY_SPACE ) {
|
||||
if ( Sys::getTicks() - mLastTick > 250 ) {
|
||||
|
||||
@@ -11,6 +11,14 @@ UIRelativeLayout::UIRelativeLayout() :
|
||||
{
|
||||
}
|
||||
|
||||
Uint32 UIRelativeLayout::getType() const {
|
||||
return UI_TYPE_RELATIVE_LAYOUT;
|
||||
}
|
||||
|
||||
bool UIRelativeLayout::isType( const Uint32& type ) const {
|
||||
return UIWidget::getType() == type ? true : UIWidget::isType( type );
|
||||
}
|
||||
|
||||
UIRelativeLayout * UIRelativeLayout::add(UIWidget * widget) {
|
||||
widget->setParent( this );
|
||||
return this;
|
||||
|
||||
@@ -240,6 +240,12 @@ void UIScrollBar::setExpandBackground( bool expandBackground ) {
|
||||
adjustChilds();
|
||||
}
|
||||
|
||||
void UIScrollBar::loadFromXmlNode(const pugi::xml_node & node) {
|
||||
UIWidget::loadFromXmlNode( node );
|
||||
|
||||
mSlider->loadFromXmlNode( node );
|
||||
}
|
||||
|
||||
UI_ORIENTATION UIScrollBar::getOrientation() const {
|
||||
return mSlider->getOrientation();
|
||||
}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
#include <eepp/ui/uiselectbutton.hpp>
|
||||
#include <eepp/ui/uiwinmenu.hpp>
|
||||
#include <eepp/helper/pugixml/pugixml.hpp>
|
||||
|
||||
namespace EE { namespace UI {
|
||||
|
||||
@@ -70,7 +71,7 @@ void UISelectButton::onStateChange() {
|
||||
} else if ( mSkinState->getState() == UISkinState::StateMouseEnter ) {
|
||||
getTextBox()->setFontColor( mStyleConfig.FontOverColor );
|
||||
} else {
|
||||
getTextBox()->setFontColor( mStyleConfig.FontColor );
|
||||
getTextBox()->setFontColor( mStyleConfig.Color );
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -83,4 +84,17 @@ const ColorA &UISelectButton::getFontSelectedColor() const {
|
||||
return mStyleConfig.FontSelectedColor;
|
||||
}
|
||||
|
||||
void UISelectButton::loadFromXmlNode(const pugi::xml_node & node) {
|
||||
UIPushButton::loadFromXmlNode( node );
|
||||
|
||||
for (pugi::xml_attribute_iterator ait = node.attributes_begin(); ait != node.attributes_end(); ++ait) {
|
||||
std::string name = ait->name();
|
||||
String::toLowerInPlace( name );
|
||||
|
||||
if ( "textselectedcolor" == name ) {
|
||||
setFontSelectedColor( ColorA::fromString( ait->as_string() ) );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
#include <eepp/ui/uislider.hpp>
|
||||
#include <eepp/ui/uimanager.hpp>
|
||||
#include <eepp/graphics/subtexture.hpp>
|
||||
#include <eepp/helper/pugixml/pugixml.hpp>
|
||||
|
||||
namespace EE { namespace UI {
|
||||
|
||||
@@ -401,4 +402,33 @@ void UISlider::onAlphaChange() {
|
||||
mSlider->setAlpha( mAlpha );
|
||||
}
|
||||
|
||||
void UISlider::loadFromXmlNode(const pugi::xml_node & node) {
|
||||
UIWidget::loadFromXmlNode( node );
|
||||
|
||||
for (pugi::xml_attribute_iterator ait = node.attributes_begin(); ait != node.attributes_end(); ++ait) {
|
||||
std::string name = ait->name();
|
||||
String::toLowerInPlace( name );
|
||||
|
||||
if ( "orientation" == name ) {
|
||||
std::string val = ait->as_string();
|
||||
String::toLowerInPlace( val );
|
||||
|
||||
if ( "horizontal" == val )
|
||||
setOrientation( UI_HORIZONTAL );
|
||||
else if ( "vertical" == val )
|
||||
setOrientation( UI_VERTICAL );
|
||||
} else if ( "minvalue" == name ) {
|
||||
setMinValue( ait->as_float() );
|
||||
} else if ( "maxvalue" == name ) {
|
||||
setMaxValue( ait->as_float() );
|
||||
} else if ( "value" == name ) {
|
||||
setValue( ait->as_float() );
|
||||
} else if ( "clickstep" == name ) {
|
||||
setClickStep( ait->as_float() );
|
||||
} else if ( "pagestep" == name ) {
|
||||
setPageStep( ait->as_float() );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
#include <eepp/ui/uispinbox.hpp>
|
||||
#include <eepp/graphics/subtexture.hpp>
|
||||
#include <eepp/helper/pugixml/pugixml.hpp>
|
||||
|
||||
namespace EE { namespace UI {
|
||||
|
||||
@@ -257,4 +258,25 @@ void UISpinBox::onAlphaChange() {
|
||||
mPushDown->setAlpha( mAlpha );
|
||||
}
|
||||
|
||||
void UISpinBox::loadFromXmlNode(const pugi::xml_node & node) {
|
||||
UIWidget::loadFromXmlNode( node );
|
||||
|
||||
mInput->loadFromXmlNode( node );
|
||||
|
||||
for (pugi::xml_attribute_iterator ait = node.attributes_begin(); ait != node.attributes_end(); ++ait) {
|
||||
std::string name = ait->name();
|
||||
String::toLowerInPlace( name );
|
||||
|
||||
if ( "minvalue" == name ) {
|
||||
setMinValue( ait->as_float() );
|
||||
} else if ( "maxvalue" == name ) {
|
||||
setMaxValue( ait->as_float() );
|
||||
} else if ( "value" == name ) {
|
||||
setValue( ait->as_float() );
|
||||
} else if ( "clickstep" == name ) {
|
||||
setClickStep( ait->as_float() );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
#include <eepp/ui/uitab.hpp>
|
||||
#include <eepp/ui/uitabwidget.hpp>
|
||||
#include <eepp/ui/uimanager.hpp>
|
||||
#include <eepp/helper/pugixml/pugixml.hpp>
|
||||
|
||||
namespace EE { namespace UI {
|
||||
|
||||
@@ -111,13 +112,23 @@ UIPushButton * UITab::setText( const String &text ) {
|
||||
|
||||
onAutoSize();
|
||||
|
||||
tTabW->orderTabs();
|
||||
|
||||
tTabW->setTabSelected( tTabW->getSelectedTab() );
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
UIPushButton::setText( text );
|
||||
|
||||
onAutoSize();
|
||||
|
||||
tTabW->orderTabs();
|
||||
|
||||
tTabW->setTabSelected( tTabW->getSelectedTab() );
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
@@ -140,6 +151,10 @@ void UITab::update() {
|
||||
UISelectButton::update();
|
||||
|
||||
if ( mEnabled && mVisible ) {
|
||||
if ( NULL == mControlOwned && !mOwnedName.empty() ) {
|
||||
setOwnedControl();
|
||||
}
|
||||
|
||||
if ( isMouseOver() ) {
|
||||
UITabWidget * tTabW = getTabWidget();
|
||||
|
||||
@@ -160,12 +175,43 @@ void UITab::update() {
|
||||
}
|
||||
}
|
||||
|
||||
void UITab::loadFromXmlNode(const pugi::xml_node & node) {
|
||||
UISelectButton::loadFromXmlNode( node );
|
||||
|
||||
for (pugi::xml_attribute_iterator ait = node.attributes_begin(); ait != node.attributes_end(); ++ait) {
|
||||
std::string name = ait->name();
|
||||
String::toLowerInPlace( name );
|
||||
|
||||
if ( "controlowned" == name || "owns" == name ) {
|
||||
mOwnedName = ait->as_string();
|
||||
setOwnedControl();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void UITab::setOwnedControl() {
|
||||
UIControl * ctrl = getParent()->getParent()->find( mOwnedName );
|
||||
|
||||
if ( NULL != ctrl ) {
|
||||
setControlOwned( ctrl );
|
||||
}
|
||||
}
|
||||
|
||||
UIControl * UITab::getControlOwned() const {
|
||||
return mControlOwned;
|
||||
}
|
||||
|
||||
void UITab::setControlOwned(UIControl * controlOwned) {
|
||||
mControlOwned = controlOwned;
|
||||
|
||||
UITabWidget * tTabW = getTabWidget();
|
||||
|
||||
if ( NULL != tTabW ) {
|
||||
tTabW->refreshControlOwned( this );
|
||||
|
||||
if ( NULL == tTabW->mTabSelected )
|
||||
tTabW->setTabSelected( this );
|
||||
}
|
||||
}
|
||||
|
||||
}}
|
||||
|
||||
@@ -2,6 +2,8 @@
|
||||
#include <eepp/ui/uimanager.hpp>
|
||||
#include <eepp/graphics/renderer/gl.hpp>
|
||||
#include <eepp/graphics/primitives.hpp>
|
||||
#include <eepp/graphics/fontmanager.hpp>
|
||||
#include <eepp/helper/pugixml/pugixml.hpp>
|
||||
|
||||
namespace EE { namespace UI {
|
||||
|
||||
@@ -23,13 +25,13 @@ UITabWidget::UITabWidget() :
|
||||
}
|
||||
|
||||
mTabContainer = UIWidget::New();
|
||||
mTabContainer->setParent( this )->setPosition( 0, 0 )->setSize( mSize.getWidth(), mStyleConfig.TabWidgetHeight )->setVisible( true )->setEnabled( true );
|
||||
mTabContainer->setFlags( UI_CLIP_ENABLE | UI_ANCHOR_RIGHT );
|
||||
mTabContainer->setParent( this )->setPosition( 0, 0 )->setSize( mSize.getWidth(), mStyleConfig.TabWidgetHeight );
|
||||
mTabContainer->setFlags( UI_CLIP_ENABLE );
|
||||
|
||||
mCtrlContainer = UIWidget::New();
|
||||
mCtrlContainer->setParent( this )->setPosition( 0, mStyleConfig.TabWidgetHeight )
|
||||
->setSize( mSize.getWidth(), mSize.getHeight() - mStyleConfig.TabWidgetHeight )->setVisible( true )->setEnabled( true )
|
||||
->setFlags( UI_CLIP_ENABLE | UI_ANCHOR_BOTTOM | UI_ANCHOR_RIGHT );
|
||||
->setSize( mSize.getWidth(), mSize.getHeight() - mStyleConfig.TabWidgetHeight )
|
||||
->setFlags( UI_CLIP_ENABLE );
|
||||
|
||||
onSizeChange();
|
||||
|
||||
@@ -105,19 +107,73 @@ void UITabWidget::draw() {
|
||||
}
|
||||
}
|
||||
|
||||
TooltipStyleConfig UITabWidget::getFontStyleConfig() const {
|
||||
return TooltipStyleConfig( mStyleConfig );
|
||||
UITooltipStyleConfig UITabWidget::getFontStyleConfig() const {
|
||||
return UITooltipStyleConfig( mStyleConfig );
|
||||
}
|
||||
|
||||
void UITabWidget::setFontStyleConfig(const TooltipStyleConfig & fontStyleConfig) {
|
||||
void UITabWidget::setFontStyleConfig(const UITooltipStyleConfig & fontStyleConfig) {
|
||||
mStyleConfig.updateFontStyleConfig( fontStyleConfig );
|
||||
}
|
||||
|
||||
TabWidgetStyleConfig UITabWidget::getStyleConfig() const {
|
||||
UITabWidgetStyleConfig UITabWidget::getStyleConfig() const {
|
||||
return mStyleConfig;
|
||||
}
|
||||
|
||||
void UITabWidget::setStyleConfig(const TabWidgetStyleConfig & styleConfig) {
|
||||
const Uint32 &UITabWidget::getFontStyle() const {
|
||||
return mStyleConfig.Style;
|
||||
}
|
||||
|
||||
const Float &UITabWidget::getOutlineThickness() const {
|
||||
return mStyleConfig.OutlineThickness;
|
||||
}
|
||||
|
||||
UITabWidget * UITabWidget::setOutlineThickness( const Float & outlineThickness ) {
|
||||
if ( mStyleConfig.OutlineThickness != outlineThickness ) {
|
||||
mStyleConfig.OutlineThickness = outlineThickness;
|
||||
|
||||
if ( mTabs.size() > 0 ) {
|
||||
for ( Uint32 i = 0; i < mTabs.size(); i++ ) {
|
||||
((UITab*)mTabs[ i ])->setOutlineThickness( outlineThickness );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
const ColorA &UITabWidget::getOutlineColor() const {
|
||||
return mStyleConfig.OutlineColor;
|
||||
}
|
||||
|
||||
UITabWidget * UITabWidget::setOutlineColor(const ColorA & outlineColor) {
|
||||
if ( mStyleConfig.OutlineColor != outlineColor ) {
|
||||
mStyleConfig.OutlineColor = outlineColor;
|
||||
|
||||
if ( mTabs.size() > 0 ) {
|
||||
for ( Uint32 i = 0; i < mTabs.size(); i++ ) {
|
||||
((UITab*)mTabs[ i ])->setOutlineColor( outlineColor );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
UITabWidget * UITabWidget::setFontStyle(const Uint32 & fontStyle) {
|
||||
if ( mStyleConfig.Style != fontStyle ) {
|
||||
mStyleConfig.Style = fontStyle;
|
||||
|
||||
if ( mTabs.size() > 0 ) {
|
||||
for ( Uint32 i = 0; i < mTabs.size(); i++ ) {
|
||||
((UITab*)mTabs[ i ])->setFontStyle( fontStyle );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
void UITabWidget::setStyleConfig(const UITabWidgetStyleConfig & styleConfig) {
|
||||
Uint32 tabWidgetHeight = mStyleConfig.TabWidgetHeight;
|
||||
mStyleConfig = styleConfig;
|
||||
mStyleConfig.TabWidgetHeight = tabWidgetHeight;
|
||||
@@ -126,6 +182,77 @@ void UITabWidget::setStyleConfig(const TabWidgetStyleConfig & styleConfig) {
|
||||
orderTabs();
|
||||
}
|
||||
|
||||
void UITabWidget::loadFromXmlNode(const pugi::xml_node & node) {
|
||||
UIWidget::loadFromXmlNode( node );
|
||||
|
||||
for (pugi::xml_attribute_iterator ait = node.attributes_begin(); ait != node.attributes_end(); ++ait) {
|
||||
std::string name = ait->name();
|
||||
String::toLowerInPlace( name );
|
||||
|
||||
if ( "textcolor" == name ) {
|
||||
setFontColor( ColorA::fromString( ait->as_string() ) );
|
||||
} else if ( "textshadowcolor" == name ) {
|
||||
setFontShadowColor( ColorA::fromString( ait->as_string() ) );
|
||||
} else if ( "textovercolor" == name ) {
|
||||
setFontOverColor( ColorA::fromString( ait->as_string() ) );
|
||||
} else if ( "textselectedcolor" == name ) {
|
||||
setFontSelectedColor( ColorA::fromString( ait->as_string() ) );
|
||||
} else if ( "fontfamily" == name || "fontname" == name ) {
|
||||
Font * font = FontManager::instance()->getByName( ait->as_string() );
|
||||
|
||||
if ( NULL != font )
|
||||
setFont( font );
|
||||
} else if ( "textsize" == name || "fontsize" == name || "charactersize" == name ) {
|
||||
setCharacterSize( PixelDensity::toDpFromStringI( ait->as_string() ) );
|
||||
} else if ( "textstyle" == name || "fontstyle" == name ) {
|
||||
std::string valStr = ait->as_string();
|
||||
String::toLowerInPlace( valStr );
|
||||
std::vector<std::string> strings = String::split( valStr, '|' );
|
||||
Uint32 flags = Text::Regular;
|
||||
|
||||
if ( strings.size() ) {
|
||||
for ( std::size_t i = 0; i < strings.size(); i++ ) {
|
||||
std::string cur = strings[i];
|
||||
String::toLowerInPlace( cur );
|
||||
|
||||
if ( "underlined" == cur || "underline" == cur )
|
||||
flags |= Text::Underlined;
|
||||
else if ( "bold" == cur )
|
||||
flags |= Text::Bold;
|
||||
else if ( "italic" == cur )
|
||||
flags |= Text::Italic;
|
||||
else if ( "strikethrough" == cur )
|
||||
flags |= Text::StrikeThrough;
|
||||
else if ( "shadowed" == cur || "shadow" == cur )
|
||||
flags |= Text::Shadow;
|
||||
}
|
||||
|
||||
setFontStyle( flags );
|
||||
}
|
||||
} else if ( "fontoutlinethickness" == name ) {
|
||||
setOutlineThickness( PixelDensity::toDpFromString( ait->as_string() ) );
|
||||
} else if ( "fontoutlinecolor" == name ) {
|
||||
setOutlineColor( ColorA::fromString( ait->as_string() ) );
|
||||
} else if ( "maxtextlength" == name ) {
|
||||
setMaxTextLength( ait->as_uint(1) );
|
||||
} else if ( "mintabwidth" == name ) {
|
||||
setMinTabWidth( ait->as_uint(1) );
|
||||
} else if ( "maxtabwidth" == name ) {
|
||||
setMaxTabWidth( ait->as_uint() );
|
||||
} else if ( "tabclosable" == name ) {
|
||||
setTabsClosable( ait->as_bool() );
|
||||
} else if ( "specialbordertabs" == name ) {
|
||||
setSpecialBorderTabs( ait->as_bool() );
|
||||
} else if ( "drawlinebelowtabs" == name ) {
|
||||
setDrawLineBelowTabs( ait->as_bool() );
|
||||
} else if ( "linebelowtabscolor" == name ) {
|
||||
setLineBelowTabsColor( ColorA::fromString( ait->as_string() ) );
|
||||
} else if ( "linebelowtabsyoffset" == name ) {
|
||||
setLineBelowTabsYOffset( ait->as_int() );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Font * UITabWidget::getFont() const {
|
||||
return mStyleConfig.Font;
|
||||
}
|
||||
@@ -141,29 +268,29 @@ void UITabWidget::setFont(Font * font) {
|
||||
}
|
||||
|
||||
ColorA UITabWidget::getFontColor() const {
|
||||
return mStyleConfig.FontColor;
|
||||
return mStyleConfig.Color;
|
||||
}
|
||||
|
||||
void UITabWidget::setFontColor(const ColorA & fontColor) {
|
||||
mStyleConfig.FontColor = fontColor;
|
||||
mStyleConfig.Color = fontColor;
|
||||
|
||||
if ( mTabs.size() > 0 ) {
|
||||
for ( Uint32 i = 0; i < mTabs.size(); i++ ) {
|
||||
((UITab*)mTabs[ i ])->setFontColor( mStyleConfig.FontColor );
|
||||
((UITab*)mTabs[ i ])->setFontColor( mStyleConfig.Color );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
ColorA UITabWidget::getFontShadowColor() const {
|
||||
return mStyleConfig.FontShadowColor;
|
||||
return mStyleConfig.ShadowColor;
|
||||
}
|
||||
|
||||
void UITabWidget::setFontShadowColor(const ColorA & fontShadowColor) {
|
||||
mStyleConfig.FontShadowColor = fontShadowColor;
|
||||
mStyleConfig.ShadowColor = fontShadowColor;
|
||||
|
||||
if ( mTabs.size() > 0 ) {
|
||||
for ( Uint32 i = 0; i < mTabs.size(); i++ ) {
|
||||
((UITab*)mTabs[ i ])->setFontShadowColor( mStyleConfig.FontShadowColor );
|
||||
((UITab*)mTabs[ i ])->setFontShadowColor( mStyleConfig.ShadowColor );
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -196,6 +323,20 @@ void UITabWidget::setFontSelectedColor(const ColorA & fontSelectedColor) {
|
||||
}
|
||||
}
|
||||
|
||||
Uint32 UITabWidget::getCharacterSize() {
|
||||
return mStyleConfig.CharacterSize;
|
||||
}
|
||||
|
||||
void UITabWidget::setCharacterSize( const Uint32& characterSize ) {
|
||||
mStyleConfig.CharacterSize = characterSize;
|
||||
|
||||
if ( mTabs.size() > 0 ) {
|
||||
for ( Uint32 i = 0; i < mTabs.size(); i++ ) {
|
||||
((UITab*)mTabs[ i ])->setCharacterSize( mStyleConfig.CharacterSize );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Int32 UITabWidget::getTabSeparation() const {
|
||||
return mStyleConfig.TabSeparation;
|
||||
}
|
||||
@@ -364,11 +505,11 @@ UITab * UITabWidget::createTab( const String& Text, UIControl * CtrlOwned, SubTe
|
||||
return tCtrl;
|
||||
}
|
||||
|
||||
Uint32 UITabWidget::add( const String& Text, UIControl * CtrlOwned, SubTexture * Icon ) {
|
||||
UITabWidget * UITabWidget::add( const String& Text, UIControl * CtrlOwned, SubTexture * Icon ) {
|
||||
return add( createTab( Text, CtrlOwned, Icon ) );
|
||||
}
|
||||
|
||||
Uint32 UITabWidget::add( UITab * Tab ) {
|
||||
UITabWidget * UITabWidget::add( UITab * Tab ) {
|
||||
Tab->setParent( mTabContainer );
|
||||
|
||||
mTabs.push_back( Tab );
|
||||
@@ -379,7 +520,7 @@ Uint32 UITabWidget::add( UITab * Tab ) {
|
||||
orderTabs();
|
||||
}
|
||||
|
||||
return mTabs.size() - 1;
|
||||
return this;
|
||||
}
|
||||
|
||||
UITab * UITabWidget::getTab( const Uint32& Index ) {
|
||||
@@ -476,13 +617,19 @@ void UITabWidget::insert( UITab * Tab, const Uint32& Index ) {
|
||||
}
|
||||
|
||||
void UITabWidget::setTabSelected( UITab * Tab ) {
|
||||
if ( NULL == Tab )
|
||||
return;
|
||||
|
||||
if ( Tab == mTabSelected ) {
|
||||
refreshControlOwned( Tab );
|
||||
return;
|
||||
}
|
||||
|
||||
if ( NULL != mTabSelected ) {
|
||||
mTabSelected->unselect();
|
||||
mTabSelected->getControlOwned()->setVisible( false );
|
||||
|
||||
if ( NULL != mTabSelected->getControlOwned() )
|
||||
mTabSelected->getControlOwned()->setVisible( false );
|
||||
}
|
||||
|
||||
if ( NULL != Tab ) {
|
||||
@@ -497,9 +644,7 @@ void UITabWidget::setTabSelected( UITab * Tab ) {
|
||||
mTabSelected = Tab;
|
||||
mTabSelectedIndex = TabIndex;
|
||||
|
||||
mTabSelected->getControlOwned()->setVisible( true );
|
||||
mTabSelected->getControlOwned()->setSize( mCtrlContainer->getSize() );
|
||||
mTabSelected->getControlOwned()->setPosition( 0, 0 );
|
||||
refreshControlOwned( mTabSelected );
|
||||
|
||||
orderTabs();
|
||||
|
||||
@@ -507,6 +652,15 @@ void UITabWidget::setTabSelected( UITab * Tab ) {
|
||||
}
|
||||
}
|
||||
|
||||
void UITabWidget::refreshControlOwned( UITab * tab ) {
|
||||
if ( NULL != tab && NULL != tab->getControlOwned() ) {
|
||||
tab->getControlOwned()->setParent( mCtrlContainer );
|
||||
tab->getControlOwned()->setVisible( tab == mTabSelected );
|
||||
tab->getControlOwned()->setSize( mCtrlContainer->getSize() );
|
||||
tab->getControlOwned()->setPosition( 0, 0 );
|
||||
}
|
||||
}
|
||||
|
||||
void UITabWidget::selectPrev() {
|
||||
if ( eeINDEX_NOT_FOUND != mTabSelectedIndex && mTabSelectedIndex > 0 ) {
|
||||
setTabSelected( getTab( mTabSelectedIndex - 1 ) );
|
||||
@@ -532,13 +686,47 @@ void UITabWidget::onSizeChange() {
|
||||
setTabContainerSize();
|
||||
posTabs();
|
||||
|
||||
if ( NULL != mTabSelected ) {
|
||||
if ( NULL != mTabSelected && NULL != mTabSelected->getControlOwned() ) {
|
||||
mTabSelected->getControlOwned()->setSize( mCtrlContainer->getSize() );
|
||||
}
|
||||
|
||||
UIControl::onSizeChange();
|
||||
}
|
||||
|
||||
void UITabWidget::onChildCountChange() {
|
||||
UIControl * child = mChild;
|
||||
bool found = false;
|
||||
|
||||
while ( NULL != child ) {
|
||||
if ( !( child == mTabContainer || child == mCtrlContainer ) ) {
|
||||
found = true;
|
||||
break;
|
||||
}
|
||||
|
||||
child = child->getNextControl();
|
||||
}
|
||||
|
||||
if ( found ) {
|
||||
if ( child->isType( UI_TYPE_TAB ) ) {
|
||||
UITab * Tab = static_cast<UITab*>( child );
|
||||
|
||||
Tab->setParent( mTabContainer );
|
||||
|
||||
mTabs.push_back( Tab );
|
||||
|
||||
if ( NULL == mTabSelected ) {
|
||||
setTabSelected( Tab );
|
||||
} else {
|
||||
orderTabs();
|
||||
}
|
||||
} else {
|
||||
child->setParent( mCtrlContainer );
|
||||
child->setVisible( false );
|
||||
child->setEnabled( true );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void UITabWidget::applyThemeToTabs() {
|
||||
if ( mStyleConfig.SpecialBorderTabs ) {
|
||||
for ( Uint32 i = 0; i < mTabs.size(); i++ ) {
|
||||
|
||||
@@ -345,7 +345,7 @@ void UITextEdit::fixScrollToCursor() {
|
||||
Uint32 NLPos = 0;
|
||||
Uint32 LineNum = mTextInput->getInputTextBuffer()->getCurPosLinePos( NLPos );
|
||||
|
||||
Text textCache( mTextInput->getTextCache()->getFont(), mTextInput->getFontStyleConfig().FontCharacterSize );
|
||||
Text textCache( mTextInput->getFont(), mTextInput->getFontStyleConfig().CharacterSize );
|
||||
textCache.setString(
|
||||
mTextInput->getInputTextBuffer()->getBuffer().substr(
|
||||
NLPos, mTextInput->getInputTextBuffer()->getCursorPos() - NLPos
|
||||
@@ -425,11 +425,11 @@ const UI_SCROLLBAR_MODE& UITextEdit::getHorizontalScrollMode() {
|
||||
return mHScrollBarMode;
|
||||
}
|
||||
|
||||
FontStyleConfig UITextEdit::getFontStyleConfig() const {
|
||||
UIFontStyleConfig UITextEdit::getFontStyleConfig() const {
|
||||
return mTextInput->getFontStyleConfig();
|
||||
}
|
||||
|
||||
void UITextEdit::setFontStyleConfig(const FontStyleConfig & fontStyleConfig) {
|
||||
void UITextEdit::setFontStyleConfig(const UIFontStyleConfig & fontStyleConfig) {
|
||||
if ( NULL != mTextInput ) {
|
||||
mTextInput->setFontStyleConfig( fontStyleConfig );
|
||||
}
|
||||
|
||||
@@ -92,7 +92,7 @@ void UITextInput::drawWaitingCursor() {
|
||||
GLi->lineSmooth( false );
|
||||
|
||||
Primitives P;
|
||||
P.setColor( mFontStyleConfig.FontColor );
|
||||
P.setColor( mFontStyleConfig.Color );
|
||||
|
||||
Float CurPosX = mScreenPos.x + mRealAlignOffset.x + mCurPos.x + PixelDensity::dpToPxI( 1.f ) + mRealPadding.Left;
|
||||
Float CurPosY = mScreenPos.y + mRealAlignOffset.y + mCurPos.y + mRealPadding.Top;
|
||||
|
||||
@@ -132,10 +132,10 @@ Text *UITextInputPassword::getPassCache() const {
|
||||
return mPassCache;
|
||||
}
|
||||
|
||||
void UITextInputPassword::setFontStyleConfig(const TooltipStyleConfig & fontStyleConfig) {
|
||||
void UITextInputPassword::setFontStyleConfig(const UITooltipStyleConfig & fontStyleConfig) {
|
||||
UITextInput::setFontStyleConfig( fontStyleConfig );
|
||||
|
||||
mPassCache->setCharacterSize( mFontStyleConfig.FontCharacterSize );
|
||||
mPassCache->setCharacterSize( mFontStyleConfig.CharacterSize );
|
||||
mPassCache->setFont( mFontStyleConfig.getFont() );
|
||||
mPassCache->setColor( mFontStyleConfig.getFontColor() );
|
||||
mPassCache->setShadowColor( mFontStyleConfig.getFontShadowColor() );
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
#include <eepp/ui/uitextview.hpp>
|
||||
#include <eepp/ui/uimanager.hpp>
|
||||
#include <eepp/ui/uithememanager.hpp>
|
||||
#include <eepp/graphics/text.hpp>
|
||||
#include <eepp/graphics/font.hpp>
|
||||
#include <eepp/graphics/primitives.hpp>
|
||||
#include <eepp/window/clipboard.hpp>
|
||||
@@ -24,10 +23,10 @@ UITextView::UITextView() :
|
||||
|
||||
mTextCache = eeNew( Text, () );
|
||||
mTextCache->setFont( mFontStyleConfig.Font );
|
||||
mTextCache->setCharacterSize( mFontStyleConfig.FontCharacterSize );
|
||||
mTextCache->setStyle( mFontStyleConfig.FontStyle );
|
||||
mTextCache->setColor( mFontStyleConfig.FontColor );
|
||||
mTextCache->setShadowColor( mFontStyleConfig.FontShadowColor );
|
||||
mTextCache->setCharacterSize( mFontStyleConfig.CharacterSize );
|
||||
mTextCache->setStyle( mFontStyleConfig.Style );
|
||||
mTextCache->setColor( mFontStyleConfig.Color );
|
||||
mTextCache->setShadowColor( mFontStyleConfig.ShadowColor );
|
||||
mTextCache->setOutlineThickness( mFontStyleConfig.OutlineThickness );
|
||||
mTextCache->setOutlineColor( mFontStyleConfig.OutlineColor );
|
||||
|
||||
@@ -105,7 +104,7 @@ UITextView *UITextView::setCharacterSize( const Uint32 & characterSize ) {
|
||||
}
|
||||
|
||||
const Uint32 &UITextView::getFontStyle() const {
|
||||
return mFontStyleConfig.FontStyle;
|
||||
return mFontStyleConfig.Style;
|
||||
}
|
||||
|
||||
const Float &UITextView::getOutlineThickness() const {
|
||||
@@ -138,9 +137,9 @@ UITextView * UITextView::setOutlineColor(const ColorA & outlineColor) {
|
||||
}
|
||||
|
||||
UITextView * UITextView::setFontStyle(const Uint32 & fontStyle) {
|
||||
if ( mFontStyleConfig.FontStyle != fontStyle ) {
|
||||
if ( mFontStyleConfig.Style != fontStyle ) {
|
||||
mTextCache->setStyle( fontStyle );
|
||||
mFontStyleConfig.FontStyle = fontStyle;
|
||||
mFontStyleConfig.Style = fontStyle;
|
||||
autoShrink();
|
||||
onAutoSize();
|
||||
autoAlign();
|
||||
@@ -173,11 +172,11 @@ UITextView * UITextView::setText( const String& text ) {
|
||||
}
|
||||
|
||||
const ColorA& UITextView::getFontColor() const {
|
||||
return mFontStyleConfig.FontColor;
|
||||
return mFontStyleConfig.Color;
|
||||
}
|
||||
|
||||
UITextView * UITextView::setFontColor( const ColorA& color ) {
|
||||
mFontStyleConfig.FontColor = color;
|
||||
mFontStyleConfig.Color = color;
|
||||
mTextCache->setColor( color );
|
||||
|
||||
setAlpha( color.a() );
|
||||
@@ -186,12 +185,12 @@ UITextView * UITextView::setFontColor( const ColorA& color ) {
|
||||
}
|
||||
|
||||
const ColorA& UITextView::getFontShadowColor() const {
|
||||
return mFontStyleConfig.FontShadowColor;
|
||||
return mFontStyleConfig.ShadowColor;
|
||||
}
|
||||
|
||||
UITextView * UITextView::setFontShadowColor( const ColorA& color ) {
|
||||
mFontStyleConfig.FontShadowColor = color;
|
||||
mTextCache->setShadowColor( mFontStyleConfig.FontShadowColor );
|
||||
mFontStyleConfig.ShadowColor = color;
|
||||
mTextCache->setShadowColor( mFontStyleConfig.ShadowColor );
|
||||
|
||||
return this;
|
||||
}
|
||||
@@ -207,10 +206,10 @@ UITextView * UITextView::setSelectionBackColor( const ColorA& color ) {
|
||||
|
||||
void UITextView::setAlpha( const Float& alpha ) {
|
||||
UIControlAnim::setAlpha( alpha );
|
||||
mFontStyleConfig.FontColor.Alpha = (Uint8)alpha;
|
||||
mFontStyleConfig.FontShadowColor.Alpha = (Uint8)alpha;
|
||||
mFontStyleConfig.Color.Alpha = (Uint8)alpha;
|
||||
mFontStyleConfig.ShadowColor.Alpha = (Uint8)alpha;
|
||||
|
||||
mTextCache->setAlpha( mFontStyleConfig.FontColor.Alpha );
|
||||
mTextCache->setAlpha( mFontStyleConfig.Color.Alpha );
|
||||
}
|
||||
|
||||
void UITextView::autoShrink() {
|
||||
@@ -297,10 +296,6 @@ void UITextView::setTheme( UITheme * Theme ) {
|
||||
}
|
||||
}
|
||||
|
||||
Text * UITextView::getTextCache() {
|
||||
return mTextCache;
|
||||
}
|
||||
|
||||
Float UITextView::getTextWidth() {
|
||||
return mTextCache->getTextWidth();
|
||||
}
|
||||
@@ -416,7 +411,7 @@ bool UITextView::isTextSelectionEnabled() const {
|
||||
return 0 != ( mFlags & UI_TEXT_SELECTION_ENABLED );
|
||||
}
|
||||
|
||||
TooltipStyleConfig UITextView::getFontStyleConfig() const
|
||||
UITooltipStyleConfig UITextView::getFontStyleConfig() const
|
||||
{
|
||||
return mFontStyleConfig;
|
||||
}
|
||||
@@ -441,12 +436,16 @@ void UITextView::onAlignChange() {
|
||||
autoAlign();
|
||||
}
|
||||
|
||||
void UITextView::setFontStyleConfig( const TooltipStyleConfig& fontStyleConfig ) {
|
||||
void UITextView::setFontStyleConfig( const UITooltipStyleConfig& fontStyleConfig ) {
|
||||
mFontStyleConfig = fontStyleConfig;
|
||||
|
||||
setFont( mFontStyleConfig.getFont() );
|
||||
setFontColor( mFontStyleConfig.getFontColor() );
|
||||
setCharacterSize( mFontStyleConfig.getFontCharacterSize() );
|
||||
setFontShadowColor( mFontStyleConfig.getFontShadowColor() );
|
||||
setFontStyle( mFontStyleConfig.getFontStyle() );
|
||||
setOutlineThickness( mFontStyleConfig.getOutlineThickness() );
|
||||
setOutlineColor( mFontStyleConfig.getOutlineColor() );
|
||||
}
|
||||
|
||||
const Recti& UITextView::getPadding() const {
|
||||
@@ -511,6 +510,8 @@ void UITextView::loadFromXmlNode(const pugi::xml_node & node) {
|
||||
flags |= Text::Italic;
|
||||
else if ( "strikethrough" == cur )
|
||||
flags |= Text::StrikeThrough;
|
||||
else if ( "shadowed" == cur || "shadow" == cur )
|
||||
flags |= Text::Shadow;
|
||||
}
|
||||
|
||||
setFontStyle( flags );
|
||||
|
||||
@@ -328,8 +328,8 @@ UITheme::UITheme(const std::string& name, const std::string& Abbr, Graphics::Fon
|
||||
mTextureAtlas( NULL )
|
||||
{
|
||||
mFontStyleConfig.Font = defaultFont;
|
||||
mFontStyleConfig.FontShadowColor = ColorA( 255, 255, 255, 200 );
|
||||
mFontStyleConfig.FontColor = mFontStyleConfig.FontOverColor = mFontStyleConfig.FontSelectedColor = ColorA( 0, 0, 0, 255 );
|
||||
mFontStyleConfig.ShadowColor = ColorA( 255, 255, 255, 200 );
|
||||
mFontStyleConfig.Color = mFontStyleConfig.FontOverColor = mFontStyleConfig.FontSelectedColor = ColorA( 0, 0, 0, 255 );
|
||||
mFontStyleConfig.FontSelectionBackColor = ColorA( 150, 150, 150, 255 );
|
||||
|
||||
if ( NULL == defaultFont ) {
|
||||
@@ -379,47 +379,47 @@ SubTexture * UITheme::getIconByName( const std::string& name ) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
void UITheme::setFontStyleConfig(const TooltipStyleConfig & fontConfig) {
|
||||
void UITheme::setFontStyleConfig(const UITooltipStyleConfig & fontConfig) {
|
||||
mFontStyleConfig = fontConfig;
|
||||
}
|
||||
|
||||
TabWidgetStyleConfig UITheme::getTabWidgetStyleConfig() {
|
||||
return TabWidgetStyleConfig( getFontStyleConfig() );
|
||||
UITabWidgetStyleConfig UITheme::getTabWidgetStyleConfig() {
|
||||
return UITabWidgetStyleConfig( getFontStyleConfig() );
|
||||
}
|
||||
|
||||
ProgressBarStyleConfig UITheme::getProgressBarStyleConfig() {
|
||||
return ProgressBarStyleConfig( getFontStyleConfig() );;
|
||||
UIProgressBarStyleConfig UITheme::getProgressBarStyleConfig() {
|
||||
return UIProgressBarStyleConfig( getFontStyleConfig() );;
|
||||
}
|
||||
|
||||
WinMenuStyleConfig UITheme::getWinMenuStyleConfig() {
|
||||
return WinMenuStyleConfig( getFontStyleConfig() );
|
||||
UIWinMenuStyleConfig UITheme::getWinMenuStyleConfig() {
|
||||
return UIWinMenuStyleConfig( getFontStyleConfig() );
|
||||
}
|
||||
|
||||
DropDownListStyleConfig UITheme::getDropDownListStyleConfig() {
|
||||
return DropDownListStyleConfig( getFontStyleConfig() );
|
||||
UIDropDownListStyleConfig UITheme::getDropDownListStyleConfig() {
|
||||
return UIDropDownListStyleConfig( getFontStyleConfig() );
|
||||
}
|
||||
|
||||
WindowStyleConfig UITheme::getWindowStyleConfig() {
|
||||
return WindowStyleConfig( getFontStyleConfig() );
|
||||
UIWindowStyleConfig UITheme::getWindowStyleConfig() {
|
||||
return UIWindowStyleConfig( getFontStyleConfig() );
|
||||
}
|
||||
|
||||
MenuStyleConfig UITheme::getMenuStyleConfig() {
|
||||
return MenuStyleConfig( getFontStyleConfig() );
|
||||
UIMenuStyleConfig UITheme::getMenuStyleConfig() {
|
||||
return UIMenuStyleConfig( getFontStyleConfig() );
|
||||
}
|
||||
|
||||
PushButtonStyleConfig UITheme::getPushButtonStyleConfig() {
|
||||
return PushButtonStyleConfig( getFontStyleConfig() );
|
||||
UIPushButtonStyleConfig UITheme::getPushButtonStyleConfig() {
|
||||
return UIPushButtonStyleConfig( getFontStyleConfig() );
|
||||
}
|
||||
|
||||
SliderStyleConfig UITheme::getSliderStyleConfig() {
|
||||
return SliderStyleConfig();
|
||||
UISliderStyleConfig UITheme::getSliderStyleConfig() {
|
||||
return UISliderStyleConfig();
|
||||
}
|
||||
|
||||
TooltipStyleConfig UITheme::getTooltipStyleConfig() {
|
||||
return TooltipStyleConfig( getFontStyleConfig() );
|
||||
UITooltipStyleConfig UITheme::getTooltipStyleConfig() {
|
||||
return UITooltipStyleConfig( getFontStyleConfig() );
|
||||
}
|
||||
|
||||
TooltipStyleConfig UITheme::getFontStyleConfig() const {
|
||||
UITooltipStyleConfig UITheme::getFontStyleConfig() const {
|
||||
return mFontStyleConfig;
|
||||
}
|
||||
|
||||
|
||||
@@ -12,15 +12,15 @@ namespace EE { namespace UI {
|
||||
UIThemeDefault::UIThemeDefault( const std::string& name, const std::string& Abbr, Graphics::Font * defaultFont ) :
|
||||
UITheme( name, Abbr, defaultFont )
|
||||
{
|
||||
mFontStyleConfig.FontCharacterSize = 12;
|
||||
mFontStyleConfig.FontColor = ColorA( 230, 230, 230, 255 );
|
||||
mFontStyleConfig.CharacterSize = 12;
|
||||
mFontStyleConfig.Color = ColorA( 230, 230, 230, 255 );
|
||||
mFontStyleConfig.FontOverColor = mFontStyleConfig.FontSelectedColor = ColorA( 255, 255, 255, 255 );
|
||||
mFontStyleConfig.FontShadowColor = ColorA( 50, 50, 50, 150 );
|
||||
mFontStyleConfig.ShadowColor = ColorA( 50, 50, 50, 150 );
|
||||
mFontStyleConfig.FontSelectionBackColor = ColorA( 150, 150, 150, 255 );
|
||||
}
|
||||
|
||||
TabWidgetStyleConfig UIThemeDefault::getTabWidgetStyleConfig() {
|
||||
TabWidgetStyleConfig tabWidgetStyleConfig = UITheme::getTabWidgetStyleConfig();
|
||||
UITabWidgetStyleConfig UIThemeDefault::getTabWidgetStyleConfig() {
|
||||
UITabWidgetStyleConfig tabWidgetStyleConfig = UITheme::getTabWidgetStyleConfig();
|
||||
tabWidgetStyleConfig.TabSeparation = -1;
|
||||
tabWidgetStyleConfig.FontSelectedColor = ColorA( 255, 255, 255, 255 );
|
||||
tabWidgetStyleConfig.DrawLineBelowTabs = true;
|
||||
@@ -29,8 +29,8 @@ TabWidgetStyleConfig UIThemeDefault::getTabWidgetStyleConfig() {
|
||||
return tabWidgetStyleConfig;
|
||||
}
|
||||
|
||||
ProgressBarStyleConfig UIThemeDefault::getProgressBarStyleConfig() {
|
||||
ProgressBarStyleConfig progressBarStyleConfig = UITheme::getProgressBarStyleConfig();
|
||||
UIProgressBarStyleConfig UIThemeDefault::getProgressBarStyleConfig() {
|
||||
UIProgressBarStyleConfig progressBarStyleConfig = UITheme::getProgressBarStyleConfig();
|
||||
progressBarStyleConfig.DisplayPercent = true;
|
||||
progressBarStyleConfig.VerticalExpand = true;
|
||||
progressBarStyleConfig.FillerPadding = Rectf( 2, 2, 2, 2 );
|
||||
@@ -38,39 +38,39 @@ ProgressBarStyleConfig UIThemeDefault::getProgressBarStyleConfig() {
|
||||
return progressBarStyleConfig;
|
||||
}
|
||||
|
||||
WinMenuStyleConfig UIThemeDefault::getWinMenuStyleConfig() {
|
||||
WinMenuStyleConfig winMenuStyleConfig = UITheme::getWinMenuStyleConfig();
|
||||
UIWinMenuStyleConfig UIThemeDefault::getWinMenuStyleConfig() {
|
||||
UIWinMenuStyleConfig winMenuStyleConfig = UITheme::getWinMenuStyleConfig();
|
||||
winMenuStyleConfig.ButtonMargin = 12;
|
||||
return winMenuStyleConfig;
|
||||
}
|
||||
|
||||
WindowStyleConfig UIThemeDefault::getWindowStyleConfig() {
|
||||
WindowStyleConfig windowStyleConfig = UITheme::getWindowStyleConfig();
|
||||
UIWindowStyleConfig UIThemeDefault::getWindowStyleConfig() {
|
||||
UIWindowStyleConfig windowStyleConfig = UITheme::getWindowStyleConfig();
|
||||
windowStyleConfig.WinFlags |= UI_WIN_DRAW_SHADOW;
|
||||
windowStyleConfig.ButtonsPositionFixer.x = -2;
|
||||
windowStyleConfig.TitleFontColor = ColorA( 230, 230, 230, 255 );
|
||||
return windowStyleConfig;
|
||||
}
|
||||
|
||||
MenuStyleConfig UIThemeDefault::getMenuStyleConfig() {
|
||||
MenuStyleConfig menuStyleConfig = UITheme::getMenuStyleConfig();
|
||||
UIMenuStyleConfig UIThemeDefault::getMenuStyleConfig() {
|
||||
UIMenuStyleConfig menuStyleConfig = UITheme::getMenuStyleConfig();
|
||||
menuStyleConfig.MinWidth = 100;
|
||||
menuStyleConfig.MinSpaceForIcons = 24;
|
||||
menuStyleConfig.MinRightMargin = 8;
|
||||
menuStyleConfig.FontColor = ColorA( 230, 230, 230, 255 );
|
||||
menuStyleConfig.Color = ColorA( 230, 230, 230, 255 );
|
||||
menuStyleConfig.FontOverColor = ColorA( 255, 255, 255, 255 );
|
||||
return menuStyleConfig;
|
||||
}
|
||||
|
||||
SliderStyleConfig UIThemeDefault::getSliderStyleConfig() {
|
||||
SliderStyleConfig sliderStyleConfig;
|
||||
UISliderStyleConfig UIThemeDefault::getSliderStyleConfig() {
|
||||
UISliderStyleConfig sliderStyleConfig;
|
||||
sliderStyleConfig.AllowHalfSliderOut = true;
|
||||
return sliderStyleConfig;
|
||||
}
|
||||
|
||||
TooltipStyleConfig UIThemeDefault::getTooltipStyleConfig() {
|
||||
TooltipStyleConfig tooltipStyleConfig = UITheme::getTooltipStyleConfig();
|
||||
tooltipStyleConfig.FontColor = ColorA( 0, 0, 0, 255 );
|
||||
UITooltipStyleConfig UIThemeDefault::getTooltipStyleConfig() {
|
||||
UITooltipStyleConfig tooltipStyleConfig = UITheme::getTooltipStyleConfig();
|
||||
tooltipStyleConfig.Color = ColorA( 0, 0, 0, 255 );
|
||||
tooltipStyleConfig.Padding = Recti( 4, 6, 4, 6 );
|
||||
return tooltipStyleConfig;
|
||||
}
|
||||
|
||||
@@ -27,7 +27,7 @@ void UIThemeManager::setDefaultFont( Font * Font ) {
|
||||
mFont = Font;
|
||||
|
||||
if ( NULL != mThemeDefault ) {
|
||||
TooltipStyleConfig fontStyleConfig = mThemeDefault->getFontStyleConfig();
|
||||
UITooltipStyleConfig fontStyleConfig = mThemeDefault->getFontStyleConfig();
|
||||
|
||||
if ( NULL == fontStyleConfig.getFont() && NULL != mFont ) {
|
||||
fontStyleConfig.Font = mFont;
|
||||
@@ -56,7 +56,7 @@ void UIThemeManager::setTheme( UITheme * Theme ) {
|
||||
void UIThemeManager::setDefaultTheme( UITheme * Theme ) {
|
||||
mThemeDefault = Theme;
|
||||
|
||||
TooltipStyleConfig fontStyleConfig = mThemeDefault->getFontStyleConfig();
|
||||
UITooltipStyleConfig fontStyleConfig = mThemeDefault->getFontStyleConfig();
|
||||
|
||||
if ( NULL == fontStyleConfig.getFont() && NULL != mFont ) {
|
||||
fontStyleConfig.Font = mFont;
|
||||
@@ -133,12 +133,12 @@ const Sizei& UIThemeManager::getCursorSize() const {
|
||||
return mCursorSize;
|
||||
}
|
||||
|
||||
FontStyleConfig UIThemeManager::getDefaultFontStyleConfig() {
|
||||
UIFontStyleConfig UIThemeManager::getDefaultFontStyleConfig() {
|
||||
if ( NULL != getDefaultTheme() ) {
|
||||
return getDefaultTheme()->getFontStyleConfig();
|
||||
}
|
||||
|
||||
return FontStyleConfig();
|
||||
return UIFontStyleConfig();
|
||||
}
|
||||
|
||||
}}
|
||||
|
||||
@@ -127,31 +127,31 @@ void UITooltip::setText( const String& text ) {
|
||||
}
|
||||
|
||||
const ColorA& UITooltip::getFontColor() const {
|
||||
return mStyleConfig.FontColor;
|
||||
return mStyleConfig.Color;
|
||||
}
|
||||
|
||||
void UITooltip::setFontColor( const ColorA& color ) {
|
||||
mStyleConfig.FontColor = color;
|
||||
mTextCache->setColor( mStyleConfig.FontColor );
|
||||
mStyleConfig.Color = color;
|
||||
mTextCache->setColor( mStyleConfig.Color );
|
||||
setAlpha( color.a() );
|
||||
}
|
||||
|
||||
const ColorA& UITooltip::getFontShadowColor() const {
|
||||
return mStyleConfig.FontShadowColor;
|
||||
return mStyleConfig.ShadowColor;
|
||||
}
|
||||
|
||||
void UITooltip::setFontShadowColor( const ColorA& color ) {
|
||||
mStyleConfig.FontShadowColor = color;
|
||||
mStyleConfig.ShadowColor = color;
|
||||
setAlpha( color.a() );
|
||||
mTextCache->setShadowColor( mStyleConfig.FontShadowColor );
|
||||
mTextCache->setShadowColor( mStyleConfig.ShadowColor );
|
||||
}
|
||||
|
||||
void UITooltip::setAlpha( const Float& alpha ) {
|
||||
UIControlAnim::setAlpha( alpha );
|
||||
mStyleConfig.FontColor.Alpha = (Uint8)alpha;
|
||||
mStyleConfig.FontShadowColor.Alpha = (Uint8)alpha;
|
||||
mStyleConfig.Color.Alpha = (Uint8)alpha;
|
||||
mStyleConfig.ShadowColor.Alpha = (Uint8)alpha;
|
||||
|
||||
mTextCache->setColor( mStyleConfig.FontColor );
|
||||
mTextCache->setColor( mStyleConfig.Color );
|
||||
}
|
||||
|
||||
void UITooltip::onAutoSize() {
|
||||
@@ -259,20 +259,23 @@ void UITooltip::setTooltipOf(UIControl * tooltipOf) {
|
||||
mTooltipOf = tooltipOf;
|
||||
}
|
||||
|
||||
TooltipStyleConfig UITooltip::getStyleConfig() const {
|
||||
UITooltipStyleConfig UITooltip::getStyleConfig() const {
|
||||
return mStyleConfig;
|
||||
}
|
||||
|
||||
void UITooltip::setStyleConfig(const TooltipStyleConfig & styleConfig) {
|
||||
void UITooltip::setStyleConfig(const UITooltipStyleConfig & styleConfig) {
|
||||
mStyleConfig = styleConfig;
|
||||
|
||||
if ( mStyleConfig.Padding != Recti() )
|
||||
setPadding( mStyleConfig.Padding );
|
||||
|
||||
setFont( mStyleConfig.Font );
|
||||
setFontColor( mStyleConfig.FontColor );
|
||||
setFontShadowColor( mStyleConfig.FontShadowColor );
|
||||
mTextCache->setCharacterSize( mStyleConfig.FontCharacterSize );
|
||||
setFontColor( mStyleConfig.Color );
|
||||
setFontShadowColor( mStyleConfig.ShadowColor );
|
||||
mTextCache->setCharacterSize( mStyleConfig.CharacterSize );
|
||||
mTextCache->setStyle( mStyleConfig.Style );
|
||||
mTextCache->setOutlineThickness( mStyleConfig.OutlineThickness );
|
||||
mTextCache->setOutlineColor( mStyleConfig.OutlineColor );
|
||||
}
|
||||
|
||||
}}
|
||||
|
||||
@@ -409,9 +409,7 @@ void UIWidget::loadFromXmlNode( const pugi::xml_node& node ) {
|
||||
std::string cur = strings[i];
|
||||
String::toLowerInPlace( cur );
|
||||
|
||||
if ( "draw_shadow" == cur || "drawshadow" == cur ) {
|
||||
setFlags( UI_DRAW_SHADOW );
|
||||
} else if ( "auto_size" == cur || "autosize" == cur ) {
|
||||
if ( "auto_size" == cur || "autosize" == cur ) {
|
||||
setFlags( UI_AUTO_SIZE );
|
||||
notifyLayoutAttrChange();
|
||||
} else if ( "clip" == cur ) {
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
#include <eepp/ui/uiwindow.hpp>
|
||||
#include <eepp/ui/uimanager.hpp>
|
||||
#include <eepp/graphics/primitives.hpp>
|
||||
#include <eepp/graphics/text.hpp>
|
||||
#include <eepp/ui/uilinearlayout.hpp>
|
||||
#include <eepp/ui/uirelativelayout.hpp>
|
||||
#include <eepp/helper/pugixml/pugixml.hpp>
|
||||
@@ -915,7 +916,7 @@ const Uint8& UIWindow::getBaseAlpha() const {
|
||||
return mStyleConfig.BaseAlpha;
|
||||
}
|
||||
|
||||
void UIWindow::setTitle( const String& Text ) {
|
||||
void UIWindow::setTitle( const String& text ) {
|
||||
if ( NULL == mTitle ) {
|
||||
mTitle = UITextView::New();
|
||||
mTitle->writeCtrlFlag( UI_CTRL_FLAG_OWNED_BY_WINDOW, 1 );
|
||||
@@ -924,8 +925,11 @@ void UIWindow::setTitle( const String& Text ) {
|
||||
mTitle->setVerticalAlign( getVerticalAlign() );
|
||||
mTitle->setFontColor( mStyleConfig.TitleFontColor );
|
||||
|
||||
if ( mFlags & UI_DRAW_SHADOW )
|
||||
mTitle->setFlags( UI_DRAW_SHADOW );
|
||||
if ( mStyleConfig.Style & Text::Shadow ) {
|
||||
UIFontStyleConfig fsc = mTitle->getFontStyleConfig();
|
||||
fsc.Style |= Text::Shadow;
|
||||
mTitle->setFontStyleConfig( fsc );
|
||||
}
|
||||
|
||||
mTitle->setEnabled( false );
|
||||
mTitle->setVisible( true );
|
||||
@@ -933,7 +937,7 @@ void UIWindow::setTitle( const String& Text ) {
|
||||
|
||||
fixTitleSize();
|
||||
|
||||
mTitle->setText( Text );
|
||||
mTitle->setText( text );
|
||||
}
|
||||
|
||||
void UIWindow::fixTitleSize() {
|
||||
@@ -1041,11 +1045,11 @@ UIWindow * UIWindow::setWinFlags(const Uint32 & winFlags) {
|
||||
return this;
|
||||
}
|
||||
|
||||
WindowStyleConfig UIWindow::getStyleConfig() const {
|
||||
UIWindowStyleConfig UIWindow::getStyleConfig() const {
|
||||
return mStyleConfig;
|
||||
}
|
||||
|
||||
UIWindow * UIWindow::setStyleConfig(const WindowStyleConfig & styleConfig) {
|
||||
UIWindow * UIWindow::setStyleConfig(const UIWindowStyleConfig & styleConfig) {
|
||||
mStyleConfig = styleConfig;
|
||||
|
||||
updateWinFlags();
|
||||
|
||||
@@ -42,9 +42,6 @@ void UIWinMenu::addMenuButton( const String& ButtonText, UIPopUpMenu * Menu ) {
|
||||
|
||||
UISelectButton * Button = UISelectButton::New();
|
||||
|
||||
if ( mFlags & UI_DRAW_SHADOW )
|
||||
Button->setFlags( UI_DRAW_SHADOW );
|
||||
|
||||
Button->setStyleConfig( mStyleConfig );
|
||||
Button->setParent( this );
|
||||
Button->setText( ButtonText );
|
||||
@@ -123,20 +120,20 @@ void UIWinMenu::setMarginBetweenButtons(const Uint32 & marginBetweenButtons) {
|
||||
refreshButtons();
|
||||
}
|
||||
|
||||
TooltipStyleConfig UIWinMenu::getFontStyleConfig() const {
|
||||
return TooltipStyleConfig(mStyleConfig);
|
||||
UITooltipStyleConfig UIWinMenu::getFontStyleConfig() const {
|
||||
return UITooltipStyleConfig(mStyleConfig);
|
||||
}
|
||||
|
||||
void UIWinMenu::setFontStyleConfig(const TooltipStyleConfig & fontStyleConfig) {
|
||||
void UIWinMenu::setFontStyleConfig(const UITooltipStyleConfig & fontStyleConfig) {
|
||||
mStyleConfig = fontStyleConfig;
|
||||
refreshButtons();
|
||||
}
|
||||
|
||||
WinMenuStyleConfig UIWinMenu::getStyleConfig() const {
|
||||
UIWinMenuStyleConfig UIWinMenu::getStyleConfig() const {
|
||||
return mStyleConfig;
|
||||
}
|
||||
|
||||
void UIWinMenu::setStyleConfig(const WinMenuStyleConfig & styleConfig) {
|
||||
void UIWinMenu::setStyleConfig(const UIWinMenuStyleConfig & styleConfig) {
|
||||
mStyleConfig = styleConfig;
|
||||
refreshButtons();
|
||||
}
|
||||
|
||||
@@ -293,7 +293,7 @@ void EETest::createUI() {
|
||||
/**/
|
||||
UIWindow * tWin = UIWindow::New();
|
||||
tWin->setSize( 530, 405 )->setPosition( 320, 240 );
|
||||
WindowStyleConfig windowStyleConfig = tWin->getStyleConfig();
|
||||
UIWindowStyleConfig windowStyleConfig = tWin->getStyleConfig();
|
||||
windowStyleConfig.WinFlags = UI_WIN_DRAGABLE_CONTAINER;
|
||||
windowStyleConfig.MinWindowSize = Sizei( 530, 405 );
|
||||
windowStyleConfig.BaseAlpha = 200;
|
||||
@@ -721,6 +721,7 @@ void EETest::createNewUI() {
|
||||
" </LinearLayout>"
|
||||
"</window>"
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
void EETest::createMapEditor() {
|
||||
@@ -729,7 +730,7 @@ void EETest::createMapEditor() {
|
||||
|
||||
UIWindow * tWin = UIWindow::New();
|
||||
tWin->setSizeWithDecoration( 1024, 768 )->setPosition( 0, 0 );
|
||||
WindowStyleConfig windowStyleConfig = tWin->getStyleConfig();
|
||||
UIWindowStyleConfig windowStyleConfig = tWin->getStyleConfig();
|
||||
windowStyleConfig.WinFlags = UI_WIN_DEFAULT_FLAGS | UI_WIN_MAXIMIZE_BUTTON | UI_WIN_DRAGABLE_CONTAINER;
|
||||
windowStyleConfig.MinWindowSize = Sizei( 1024, 768 );
|
||||
tWin->setStyleConfig( windowStyleConfig );
|
||||
@@ -746,7 +747,7 @@ void EETest::onMapEditorClose() {
|
||||
void EETest::createETGEditor() {
|
||||
UIWindow * tWin = UIWindow::New();
|
||||
tWin->setSizeWithDecoration( 1024, 768 )->setPosition( 0, 0 );
|
||||
WindowStyleConfig windowStyleConfig = tWin->getStyleConfig();
|
||||
UIWindowStyleConfig windowStyleConfig = tWin->getStyleConfig();
|
||||
windowStyleConfig.WinFlags = UI_WIN_DEFAULT_FLAGS | UI_WIN_MAXIMIZE_BUTTON | UI_WIN_DRAGABLE_CONTAINER;
|
||||
windowStyleConfig.MinWindowSize = Sizei( 1024, 768 );
|
||||
tWin->setStyleConfig( windowStyleConfig );
|
||||
|
||||
Reference in New Issue
Block a user