diff --git a/include/eepp/gaming/mapeditor/mapeditor.hpp b/include/eepp/gaming/mapeditor/mapeditor.hpp index bccc4c3a7..954391550 100644 --- a/include/eepp/gaming/mapeditor/mapeditor.hpp +++ b/include/eepp/gaming/mapeditor/mapeditor.hpp @@ -2,16 +2,16 @@ #define EE_GAMINGCMAPEDITOR_HPP #include -#include -#include -#include +#include +#include +#include #include #include #include namespace EE { namespace UI { -class cUIMessageBox; -class cUITextBox; +class UIMessageBox; +class UITextBox; }} using namespace EE::UI; @@ -27,82 +27,82 @@ class EE_API MapEditor { public: typedef cb::Callback0 MapEditorCloseCb; - MapEditor( cUIWindow * AttatchTo = NULL, const MapEditorCloseCb& callback = MapEditorCloseCb() ); + MapEditor( UIWindow * AttatchTo = NULL, const MapEditorCloseCb& callback = MapEditorCloseCb() ); ~MapEditor(); protected: - cUIWindow * mUIWindow; - cUIControl * mUIContainer; - cUITheme * mTheme; + UIWindow * mUIWindow; + UIControl * mUIContainer; + UITheme * mTheme; Private::UIMap * mUIMap; MapEditorCloseCb mCloseCb; - cUIDropDownList * mTextureAtlasesList; - cUIControl * mWinContainer; - cUIListBox * mSubTextureList; - cUIGfx * mGfxPreview; + UIDropDownList * mTextureAtlasesList; + UIControl * mWinContainer; + UIListBox * mSubTextureList; + UIGfx * mGfxPreview; TextureAtlas * mCurSG; - cUIScrollBar * mMapHScroll; - cUIScrollBar * mMapVScroll; - cUIDropDownList * mGOTypeList; - cUIDropDownList * mLayerList; - cUICheckBox * mChkMirrored; - cUICheckBox * mChkFliped; - cUICheckBox * mChkBlocked; - cUICheckBox * mChkAnim; - cUICheckBox * mChkRot90; - cUICheckBox * mChkAutoFix; + UIScrollBar * mMapHScroll; + UIScrollBar * mMapVScroll; + UIDropDownList * mGOTypeList; + UIDropDownList * mLayerList; + UICheckBox * mChkMirrored; + UICheckBox * mChkFliped; + UICheckBox * mChkBlocked; + UICheckBox * mChkAnim; + UICheckBox * mChkRot90; + UICheckBox * mChkAutoFix; MapLayer * mCurLayer; - cUIPushButton * mBtnGOTypeAdd; + UIPushButton * mBtnGOTypeAdd; Uint32 mCurGOType; Uint32 mCurGOFlags; - cUIComplexControl * mSubTextureCont; - cUIComplexControl * mLightCont; - cUIComplexControl * mObjectCont; - cUIComplexControl * mSGCont; - cUIComplexControl * mDICont; - cUICheckBox * mChkDI; - cUITextInput * mDataIdInput; - cUIMenuCheckBox * mLayerChkVisible; - cUIMenuCheckBox * mLayerChkLights; - cUITabWidget * mTabWidget; - cUIMenuCheckBox * mChkShowGrid; - cUIMenuCheckBox * mChkMarkTileOver; - cUIMenuCheckBox * mChkShowBlocked; - cUICheckBox * mChkClampToTile; + UIComplexControl * mSubTextureCont; + UIComplexControl * mLightCont; + UIComplexControl * mObjectCont; + UIComplexControl * mSGCont; + UIComplexControl * mDICont; + UICheckBox * mChkDI; + UITextInput * mDataIdInput; + UIMenuCheckBox * mLayerChkVisible; + UIMenuCheckBox * mLayerChkLights; + UITabWidget * mTabWidget; + UIMenuCheckBox * mChkShowGrid; + UIMenuCheckBox * mChkMarkTileOver; + UIMenuCheckBox * mChkShowBlocked; + UICheckBox * mChkClampToTile; //! Light Color - cUIComplexControl * mUIBaseColor; - cUISlider * mUIRedSlider; - cUISlider * mUIGreenSlider; - cUISlider * mUIBlueSlider; - cUITextBox * mUIRedTxt; - cUITextBox * mUIGreenTxt; - cUITextBox * mUIBlueTxt; - cUISpinBox * mLightRadius; - cUICheckBox * mLightTypeChk; - cUITextBox * mTileBox; + UIComplexControl * mUIBaseColor; + UISlider * mUIRedSlider; + UISlider * mUIGreenSlider; + UISlider * mUIBlueSlider; + UITextBox * mUIRedTxt; + UITextBox * mUIGreenTxt; + UITextBox * mUIBlueTxt; + UISpinBox * mLightRadius; + UICheckBox * mLightTypeChk; + UITextBox * mTileBox; Int32 mLastSelButtonY; bool mMouseScrolling; - std::list mObjContButton; + std::list mObjContButton; - void OnRedChange( const cUIEvent * Event ); + void OnRedChange( const UIEvent * Event ); - void OnGreenChange( const cUIEvent * Event ); + void OnGreenChange( const UIEvent * Event ); - void OnBlueChange( const cUIEvent * Event ); + void OnBlueChange( const UIEvent * Event ); void CreateLighContainer(); - cUISelectButton * AddObjContButton( String text , Uint32 mode ); + UISelectButton * AddObjContButton( String text , Uint32 mode ); void CreateObjectsContainer(); void CreateSubTextureContainer( Int32 Width ); - void WindowClose( const cUIEvent * Event ); + void WindowClose( const UIEvent * Event ); - void TextureAtlasOpen( const cUIEvent * Event ); + void TextureAtlasOpen( const UIEvent * Event ); void CreateME(); @@ -118,71 +118,71 @@ class EE_API MapEditor { void CreateNewMap(); - void FileMenuClick( const cUIEvent * Event ); + void FileMenuClick( const UIEvent * Event ); - void ViewMenuClick( const cUIEvent * Event ); + void ViewMenuClick( const UIEvent * Event ); - void MapMenuClick( const cUIEvent * Event ); + void MapMenuClick( const UIEvent * Event ); - void LayerMenuClick( const cUIEvent * Event ); + void LayerMenuClick( const UIEvent * Event ); - void OnTextureAtlasChange( const cUIEvent * Event ); + void OnTextureAtlasChange( const UIEvent * Event ); - void MapOpen( const cUIEvent * Event ); + void MapOpen( const UIEvent * Event ); - void MapSave( const cUIEvent * Event ); + void MapSave( const UIEvent * Event ); - void OnSubTextureChange( const cUIEvent * Event ); + void OnSubTextureChange( const UIEvent * Event ); - void OnTypeChange( const cUIEvent * Event ); + void OnTypeChange( const UIEvent * Event ); - void OnScrollMapH( const cUIEvent * Event ); + void OnScrollMapH( const UIEvent * Event ); - void OnScrollMapV( const cUIEvent * Event ); + void OnScrollMapV( const UIEvent * Event ); - void OnMapSizeChange( const cUIEvent * Event = NULL ); + void OnMapSizeChange( const UIEvent * Event = NULL ); - void OnLayerSelect( const cUIEvent * Event ); + void OnLayerSelect( const UIEvent * Event ); void MapCreated(); - void ChkClickMirrored( const cUIEvent * Event ); + void ChkClickMirrored( const UIEvent * Event ); - void ChkClickFliped( const cUIEvent * Event ); + void ChkClickFliped( const UIEvent * Event ); - void ChkClickBlocked( const cUIEvent * Event ); + void ChkClickBlocked( const UIEvent * Event ); - void ChkClickAnimated( const cUIEvent * Event ); + void ChkClickAnimated( const UIEvent * Event ); - void ChkClickRot90( const cUIEvent * Event ); + void ChkClickRot90( const UIEvent * Event ); - void ChkClickAutoFix( const cUIEvent * Event ); + void ChkClickAutoFix( const UIEvent * Event ); - void ChkClickDI( const cUIEvent * Event ); + void ChkClickDI( const UIEvent * Event ); - void ChkClickClampToTile( const cUIEvent * Event ); + void ChkClickClampToTile( const UIEvent * Event ); - void OnMapMouseDown( const cUIEvent * Event ); + void OnMapMouseDown( const UIEvent * Event ); - void OnMapMouseClick( const cUIEvent * Event ); + void OnMapMouseClick( const UIEvent * Event ); void OnLayerAdd( Private::UIMapLayerNew * UILayer ); - void AddNewGOType( const cUIEvent * Event ); + void AddNewGOType( const UIEvent * Event ); - void OnMapClose( const cUIEvent * Event ); + void OnMapClose( const UIEvent * Event ); - void OnNewLight( const cUIEvent * Event ); + void OnNewLight( const UIEvent * Event ); - void OnLightRadiusChangeVal( const cUIEvent * Event ); + void OnLightRadiusChangeVal( const UIEvent * Event ); - void OnLightTypeChange( const cUIEvent * Event ); + void OnLightTypeChange( const UIEvent * Event ); void OnLightSelect( MapLight * Light ); void OnLightRadiusChange( MapLight * Light ); - void OnObjectModeSel( const cUIEvent * Event ); + void OnObjectModeSel( const UIEvent * Event ); void OnNewGOTypeAdded( std::string name, Uint32 hash ); @@ -224,11 +224,11 @@ class EE_API MapEditor { void ZoomOut(); - cUIMessageBox * CreateAlert( const String& title, const String& text ); + UIMessageBox * CreateAlert( const String& title, const String& text ); - cUIMessageBox * CreateNoLayerAlert( const String title ); + UIMessageBox * CreateNoLayerAlert( const String title ); - void OnTabSelected( const cUIEvent * Event ); + void OnTabSelected( const UIEvent * Event ); void CreateTabs(); diff --git a/include/eepp/ui.hpp b/include/eepp/ui.hpp index 765dcb9dc..5d6a57209 100644 --- a/include/eepp/ui.hpp +++ b/include/eepp/ui.hpp @@ -1,53 +1,53 @@ #ifndef EEPP_UI_HPP #define EEPP_UI_HPP -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include -#include +#include #endif diff --git a/include/eepp/ui/cuicombobox.hpp b/include/eepp/ui/cuicombobox.hpp deleted file mode 100644 index 53f53c1e6..000000000 --- a/include/eepp/ui/cuicombobox.hpp +++ /dev/null @@ -1,37 +0,0 @@ -#ifndef EE_UICUICOMBOBOX_HPP -#define EE_UICUICOMBOBOX_HPP - -#include - -namespace EE { namespace UI { - -class EE_API cUIComboBox : public cUIDropDownList { - public: - cUIComboBox( cUIComboBox::CreateParams& Params ); - - virtual ~cUIComboBox(); - - virtual Uint32 Type() const; - - virtual bool IsType( const Uint32& type ) const; - - virtual void SetTheme( cUITheme * Theme ); - protected: - cUIControl * mButton; - - void OnButtonClick( const cUIEvent * Event ); - - void OnButtonEnter( const cUIEvent * Event ); - - void OnButtonExit( const cUIEvent * Event ); - - Uint32 OnMouseClick( const Vector2i& Pos, const Uint32 Flags ); - - void CreateButton(); - - virtual void OnControlClear( const cUIEvent *Event ); -}; - -}} - -#endif diff --git a/include/eepp/ui/cuidefaulttheme.hpp b/include/eepp/ui/cuidefaulttheme.hpp deleted file mode 100644 index c802182b8..000000000 --- a/include/eepp/ui/cuidefaulttheme.hpp +++ /dev/null @@ -1,35 +0,0 @@ -#ifndef EE_UICUIDEFAULTTHEME_HPP -#define EE_UICUIDEFAULTTHEME_HPP - -#include - -namespace EE { namespace UI { - -class EE_API cUIDefaultTheme : public cUITheme { - public: - cUIDefaultTheme( const std::string& Name, const std::string& Abbr, Graphics::Font * DefaultFont = NULL ); - - virtual cUIPopUpMenu * CreatePopUpMenu( cUIControl * Parent = NULL, const Sizei& Size = Sizei(), const Vector2i& Pos = Vector2i(), const Uint32& Flags = UI_CONTROL_DEFAULT_FLAGS | UI_AUTO_SIZE | UI_AUTO_PADDING, Uint32 RowHeight = 0, Recti PaddingContainer = Recti(), Uint32 MinWidth = 100, Uint32 MinSpaceForIcons = 16, Uint32 MinRightMargin = 8 ); - - virtual cUIProgressBar * CreateProgressBar( cUIControl * Parent = NULL, const Sizei& Size = Sizei(), const Vector2i& Pos = Vector2i(), const Uint32& Flags = UI_CONTROL_DEFAULT_FLAGS, bool DisplayPercent = true, bool VerticalExpand = false, Vector2f MovementSpeed = Vector2f( -64, 0 ), Rectf FillerMargin = Rectf() ); - - virtual cUIWinMenu * CreateWinMenu( cUIControl * Parent = NULL, const Sizei& Size = Sizei(), const Vector2i& Pos = Vector2i(), const Uint32& Flags = UI_CONTROL_DEFAULT_FLAGS, Uint32 MarginBetweenButtons = 0, Uint32 ButtonMargin = 12, Uint32 MenuHeight = 0, Uint32 FirstButtonMargin = 1 ); - - virtual cUIWindow * CreateWindow( cUIControl * Parent = NULL, const Sizei& Size = Sizei(), const Vector2i& Pos = Vector2i(), const Uint32& Flags = UI_CONTROL_DEFAULT_FLAGS_CENTERED, Uint32 WinFlags = UI_WIN_DEFAULT_FLAGS, Sizei MinWindowSize = Sizei(0,0), Uint8 BaseAlpha = 255 ); - - virtual cUICommonDialog * CreateCommonDialog( cUIControl * Parent = NULL, const Sizei& Size = Sizei(), const Vector2i& Pos = Vector2i(), const Uint32& Flags = UI_CONTROL_DEFAULT_FLAGS_CENTERED, Uint32 WinFlags = UI_WIN_DEFAULT_FLAGS | UI_WIN_MAXIMIZE_BUTTON, Sizei MinWindowSize = Sizei(0,0), Uint8 BaseAlpha = 255, Uint32 CDLFlags = UI_CDL_DEFAULT_FLAGS, std::string DefaultFilePattern = "*", std::string DefaultDirectory = Sys::GetProcessPath() ); - - virtual cUIComboBox * CreateComboBox( cUIControl * Parent = NULL, const Sizei& Size = Sizei(), const Vector2i& Pos = Vector2i(), const Uint32& Flags = UI_CONTROL_DEFAULT_FLAGS | UI_CLIP_ENABLE | UI_AUTO_PADDING | UI_AUTO_SIZE, Uint32 MinNumVisibleItems = 6, bool PopUpToMainControl = false, cUIListBox * ListBox = NULL ); - - virtual cUIDropDownList * CreateDropDownList( cUIControl * Parent = NULL, const Sizei& Size = Sizei(), const Vector2i& Pos = Vector2i(), const Uint32& Flags = UI_CONTROL_DEFAULT_FLAGS | UI_CLIP_ENABLE | UI_AUTO_PADDING | UI_AUTO_SIZE, Uint32 MinNumVisibleItems = 6, bool PopUpToMainControl = false, cUIListBox * ListBox = NULL ); - - virtual cUIMessageBox * CreateMessageBox( UI_MSGBOX_TYPE Type = MSGBOX_OKCANCEL, const String& Message = String(), Uint32 WinFlags = UI_WIN_DEFAULT_FLAGS | UI_WIN_MODAL, cUIControl * Parent = NULL, const Sizei& Size = Sizei(), const Vector2i& Pos = Vector2i(), const Uint32& Flags = UI_CONTROL_DEFAULT_FLAGS_CENTERED, Sizei MinWindowSize = Sizei(0,0), Uint8 BaseAlpha = 255 ); - - virtual cUITabWidget * CreateTabWidget( cUIControl * Parent = NULL, const Sizei& Size = Sizei(), const Vector2i& Pos = Vector2i(), const Uint32& Flags = UI_HALIGN_CENTER | UI_VALIGN_BOTTOM | UI_CONTROL_DEFAULT_ANCHOR, const bool& TabsClosable = false, const bool& SpecialBorderTabs = false , const Int32& TabSeparation = 0, const Uint32& MaxTextLength = 30, const Uint32& TabWidgetHeight = 0, const Uint32& TabTextAlign = UI_HALIGN_CENTER | UI_VALIGN_CENTER, const Uint32& MinTabWidth = 32, const Uint32& MaxTabWidth = 210 ); - - virtual cUITooltip * CreateTooltip( cUIControl * TooltipOf, cUIControl * Parent = NULL, const Sizei& Size = Sizei(), const Vector2i& Pos = Vector2i(), const Uint32& Flags = UI_CONTROL_DEFAULT_FLAGS_CENTERED | UI_AUTO_PADDING | UI_AUTO_SIZE ); -}; - -}} - -#endif diff --git a/include/eepp/ui/cuigridcell.hpp b/include/eepp/ui/cuigridcell.hpp deleted file mode 100644 index 5add9c336..000000000 --- a/include/eepp/ui/cuigridcell.hpp +++ /dev/null @@ -1,51 +0,0 @@ -#ifndef EE_UICUIGRIDCELL_HPP -#define EE_UICUIGRIDCELL_HPP - -#include -#include - -namespace EE { namespace UI { - -class cUIGenericGrid; - -class EE_API cUIGridCell : public cUIComplexControl { - public: - cUIGridCell( cUIGridCell::CreateParams& Params ); - - virtual ~cUIGridCell(); - - virtual void SetTheme( cUITheme * Theme ); - - void Cell( const Uint32& CollumnIndex, cUIControl * Ctrl ); - - cUIControl * Cell( const Uint32& CollumnIndex ) const; - - virtual void Update(); - - bool Selected() const; - - void Unselect(); - - void Select(); - - virtual Uint32 OnMessage( const cUIMessage * Msg ); - - void AutoSize(); - protected: - friend class tUIItemContainer; - friend class cUIGenericGrid; - - std::vector mCells; - - cUIGenericGrid * GridParent() const; - - void FixCell(); - - virtual Uint32 OnMouseExit( const Vector2i& Pos, const Uint32 Flags ); - - virtual void OnStateChange(); -}; - -}} - -#endif diff --git a/include/eepp/ui/cuimessagebox.hpp b/include/eepp/ui/cuimessagebox.hpp deleted file mode 100644 index 8fd895f87..000000000 --- a/include/eepp/ui/cuimessagebox.hpp +++ /dev/null @@ -1,57 +0,0 @@ -#ifndef EE_UICUIMESSAGEBOX_HPP -#define EE_UICUIMESSAGEBOX_HPP - -#include -#include -#include - -namespace EE { namespace UI { - -class EE_API cUIMessageBox : public cUIWindow { - public: - class CreateParams : public cUIWindow::CreateParams { - public: - inline CreateParams() : - cUIWindow::CreateParams(), - Type( MSGBOX_OKCANCEL ), - CloseWithKey( KEY_UNKNOWN ) - { - } - - inline ~CreateParams() {} - - UI_MSGBOX_TYPE Type; - String Message; - Uint32 CloseWithKey; - }; - - cUIMessageBox( const cUIMessageBox::CreateParams& Params ); - - virtual ~cUIMessageBox(); - - virtual Uint32 OnMessage( const cUIMessage * Msg ); - - virtual void SetTheme( cUITheme * Theme ); - - cUITextBox * TextBox() const; - - cUIPushButton * ButtonOK() const; - - cUIPushButton * ButtonCancel() const; - - virtual bool Show(); - protected: - UI_MSGBOX_TYPE mMsgBoxType; - cUITextBox * mTextBox; - cUIPushButton * mButtonOK; - cUIPushButton * mButtonCancel; - Uint32 mCloseWithKey; - - void AutoSize(); - - virtual Uint32 OnKeyUp( const cUIEventKey& Event ); -}; - -}} - -#endif diff --git a/include/eepp/ui/cuiseparator.hpp b/include/eepp/ui/cuiseparator.hpp deleted file mode 100644 index de6c31f3e..000000000 --- a/include/eepp/ui/cuiseparator.hpp +++ /dev/null @@ -1,25 +0,0 @@ -#ifndef EE_UICUISEPARATOR -#define EE_UICUISEPARATOR - -#include - -namespace EE { namespace UI { - -class EE_API cUISeparator : public cUIControlAnim { - public: - cUISeparator( cUIControlAnim::CreateParams Params ); - - virtual ~cUISeparator(); - - virtual Uint32 Type() const; - - virtual bool IsType( const Uint32& type ) const; - - virtual void SetTheme( cUITheme * Theme ); - protected: -}; - -}} - -#endif - diff --git a/include/eepp/ui/cuisliderbutton.hpp b/include/eepp/ui/cuisliderbutton.hpp deleted file mode 100644 index a184da175..000000000 --- a/include/eepp/ui/cuisliderbutton.hpp +++ /dev/null @@ -1,19 +0,0 @@ -#ifndef EE_UICUISLIDERBUTTON_HPP -#define EE_UICUISLIDERBUTTON_HPP - -#include - -namespace EE { namespace UI { namespace Private { - -class EE_API cUISliderButton : public cUIControlAnim { - public: - cUISliderButton( const cUIControlAnim::CreateParams& Params ); - - virtual ~cUISliderButton(); - protected: - virtual void OnPosChange(); -}; - -}}} - -#endif diff --git a/include/eepp/ui/cuitheme.hpp b/include/eepp/ui/cuitheme.hpp deleted file mode 100644 index ad0507f3d..000000000 --- a/include/eepp/ui/cuitheme.hpp +++ /dev/null @@ -1,177 +0,0 @@ -#ifndef EE_UICUITHEME_HPP -#define EE_UICUITHEME_HPP - -#include -#include -#include -#include - -namespace EE { namespace Graphics { -class Sprite; -class TextureAtlas; -class Font; -}} - -namespace EE { namespace UI { - -class cUIControl; -class cUICheckBox; -class cUIComboBox; -class cUIDropDownList; -class cUIListBox; -class cUIPopUpMenu; -class cUIProgressBar; -class cUIPushButton; -class cUISelectButton; -class cUIRadioButton; -class cUIScrollBar; -class cUISlider; -class cUISpinBox; -class cUITextBox; -class cUITextEdit; -class cUITextInput; -class cUITextInputPassword; -class cUITooltip; -class cUIWindow; -class cUIWinMenu; -class cUIGfx; -class cUISprite; -class cUIMenu; -class cUICommonDialog; -class cUIMessageBox; -class cUITabWidget; - -class EE_API cUITheme : protected ResourceManager { - public: - using ResourceManager::GetById; - using ResourceManager::GetByName; - using ResourceManager::Exists; - using ResourceManager::ExistsId; - - static cUITheme * LoadFromTextureAtlas( cUITheme * tTheme, Graphics::TextureAtlas * TextureAtlas ); - - static cUITheme * LoadFromPath( cUITheme * tTheme, const std::string& Path, const std::string ImgExt = "png" ); - - static cUITheme * LoadFromTextureAtlas( Graphics::TextureAtlas * TextureAtlas, const std::string& Name, const std::string NameAbbr ); - - static cUITheme * LoadFromPath( const std::string& Path, const std::string& Name, const std::string& NameAbbr, const std::string ImgExt = "png" ); - - void AddThemeElement( const std::string& Element ); - - void AddThemeIcon( const std::string& Icon ); - - cUITheme( const std::string& Name, const std::string& Abbr, Graphics::Font * DefaultFont = NULL ); - - virtual ~cUITheme(); - - const std::string& Name() const; - - void Name( const std::string& name ); - - const Uint32& Id() const; - - const std::string& Abbr() const; - - virtual cUISkin * Add( cUISkin * Resource ); - - void Font( Graphics::Font * Font ); - - Graphics::Font * Font() const; - - const ColorA& FontColor() const; - - const ColorA& FontShadowColor() const; - - const ColorA& FontOverColor() const; - - const ColorA& FontSelectedColor() const; - - void FontColor( const ColorA& Color ); - - void FontShadowColor( const ColorA& Color ); - - void FontOverColor( const ColorA& Color ); - - void FontSelectedColor( const ColorA& Color ); - - void UseDefaultThemeValues( const bool& Use ); - - const bool& UseDefaultThemeValues() const; - - Graphics::TextureAtlas * TextureAtlas() const; - - SubTexture * GetIconByName( const std::string& name ); - - virtual cUIGfx * CreateGfx( SubTexture * SubTexture, cUIControl * Parent = NULL, const Sizei& Size = Sizei(), const Vector2i& Pos = Vector2i(), const Uint32& Flags = UI_CONTROL_DEFAULT_FLAGS_CENTERED | UI_AUTO_SIZE, ColorA SubTextureColor = ColorA(255,255,255,255), EE_RENDER_MODE SubTextureRender = RN_NORMAL ); - - virtual cUISprite * CreateSprite( Sprite * Sprite, cUIControl * Parent = NULL, const Sizei& Size = Sizei(), const Vector2i& Pos = Vector2i(), const Uint32& Flags = UI_CONTROL_DEFAULT_FLAGS_CENTERED | UI_AUTO_SIZE, bool DealloSprite = true, EE_RENDER_MODE SpriteRender = RN_NORMAL ); - - virtual cUICheckBox * CreateCheckBox( cUIControl * Parent = NULL, const Sizei& Size = Sizei(), const Vector2i& Pos = Vector2i(), const Uint32& Flags = UI_CONTROL_DEFAULT_FLAGS ); - - virtual cUIRadioButton * CreateRadioButton( cUIControl * Parent = NULL, const Sizei& Size = Sizei(), const Vector2i& Pos = Vector2i(), const Uint32& Flags = UI_CONTROL_DEFAULT_FLAGS ); - - virtual cUITextBox * CreateTextBox( const String& Text = "", cUIControl * Parent = NULL, const Sizei& Size = Sizei(), const Vector2i& Pos = Vector2i(), const Uint32& Flags = UI_CONTROL_DEFAULT_FLAGS | UI_AUTO_SIZE ); - - virtual cUITextEdit * CreateTextEdit( cUIControl * Parent = NULL, const Sizei& Size = Sizei(), const Vector2i& Pos = Vector2i(), const Uint32& Flags = UI_CONTROL_DEFAULT_FLAGS | UI_AUTO_PADDING | UI_CLIP_ENABLE | UI_AUTO_SIZE | UI_TEXT_SELECTION_ENABLED, UI_SCROLLBAR_MODE HScrollBar = UI_SCROLLBAR_AUTO, UI_SCROLLBAR_MODE VScrollBar = UI_SCROLLBAR_AUTO, bool WordWrap = true ); - - virtual cUITextInput * CreateTextInput( cUIControl * Parent = NULL, const Sizei& Size = Sizei(), const Vector2i& Pos = Vector2i(), const Uint32& Flags = UI_CONTROL_DEFAULT_FLAGS | UI_CLIP_ENABLE | UI_AUTO_PADDING | UI_TEXT_SELECTION_ENABLED, bool SupportFreeEditing = true, Uint32 MaxLength = 256 ); - - virtual cUITextInputPassword * CreateTextInputPassword( cUIControl * Parent = NULL, const Sizei& Size = Sizei(), const Vector2i& Pos = Vector2i(), const Uint32& Flags = UI_CONTROL_DEFAULT_FLAGS | UI_CLIP_ENABLE | UI_AUTO_PADDING | UI_TEXT_SELECTION_ENABLED, bool SupportFreeEditing = true, Uint32 MaxLength = 256 ); - - virtual cUITooltip * CreateTooltip( cUIControl * TooltipOf, cUIControl * Parent = NULL, const Sizei& Size = Sizei(), const Vector2i& Pos = Vector2i(), const Uint32& Flags = UI_CONTROL_DEFAULT_FLAGS_CENTERED | UI_AUTO_PADDING | UI_AUTO_SIZE ); - - virtual cUIScrollBar * CreateScrollBar( cUIControl * Parent = NULL, const Sizei& Size = Sizei(), const Vector2i& Pos = Vector2i(), const Uint32& Flags = UI_CONTROL_DEFAULT_FLAGS | UI_AUTO_SIZE, bool VerticalScrollBar = false ); - - virtual cUISlider * CreateSlider( cUIControl * Parent = NULL, const Sizei& Size = Sizei(), const Vector2i& Pos = Vector2i(), const Uint32& Flags = UI_CONTROL_DEFAULT_FLAGS, bool VerticalSlider = false, bool AllowHalfSliderOut = true, bool ExpandBackground = false ); - - virtual cUISpinBox * CreateSpinBox( cUIControl * Parent = NULL, const Sizei& Size = Sizei(), const Vector2i& Pos = Vector2i(), const Uint32& Flags = UI_CONTROL_DEFAULT_FLAGS | UI_CLIP_ENABLE | UI_AUTO_SIZE | UI_TEXT_SELECTION_ENABLED, Float DefaultValue = 0.f, bool AllowDotsInNumbers = true ); - - virtual cUIComboBox * CreateComboBox( cUIControl * Parent = NULL, const Sizei& Size = Sizei(), const Vector2i& Pos = Vector2i(), const Uint32& Flags = UI_CONTROL_DEFAULT_FLAGS | UI_CLIP_ENABLE | UI_AUTO_PADDING | UI_TEXT_SELECTION_ENABLED, Uint32 MinNumVisibleItems = 6, bool PopUpToMainControl = false, cUIListBox * ListBox = NULL ); - - virtual cUIDropDownList * CreateDropDownList( cUIControl * Parent = NULL, const Sizei& Size = Sizei(), const Vector2i& Pos = Vector2i(), const Uint32& Flags = UI_CONTROL_DEFAULT_FLAGS | UI_CLIP_ENABLE | UI_AUTO_PADDING, Uint32 MinNumVisibleItems = 6, bool PopUpToMainControl = false, cUIListBox * ListBox = NULL ); - - virtual cUIListBox * CreateListBox( cUIControl * Parent = NULL, const Sizei& Size = Sizei(), const Vector2i& Pos = Vector2i(), const Uint32& Flags = UI_CONTROL_DEFAULT_FLAGS | UI_CLIP_ENABLE | UI_AUTO_PADDING, bool SmoothScroll = true, Uint32 RowHeight = 0, UI_SCROLLBAR_MODE VScrollMode = UI_SCROLLBAR_AUTO, UI_SCROLLBAR_MODE HScrollMode = UI_SCROLLBAR_AUTO, Recti PaddingContainer = Recti() ); - - virtual cUIMenu * CreateMenu( cUIControl * Parent = NULL, const Sizei& Size = Sizei(), const Vector2i& Pos = Vector2i(), const Uint32& Flags = UI_CONTROL_DEFAULT_FLAGS | UI_AUTO_SIZE | UI_AUTO_PADDING, Uint32 RowHeight = 0, Recti PaddingContainer = Recti(), Uint32 MinWidth = 0, Uint32 MinSpaceForIcons = 0, Uint32 MinRightMargin = 0 ); - - virtual cUIPopUpMenu * CreatePopUpMenu( cUIControl * Parent = NULL, const Sizei& Size = Sizei(), const Vector2i& Pos = Vector2i(), const Uint32& Flags = UI_CONTROL_DEFAULT_FLAGS | UI_AUTO_SIZE | UI_AUTO_PADDING, Uint32 RowHeight = 0, Recti PaddingContainer = Recti(), Uint32 MinWidth = 0, Uint32 MinSpaceForIcons = 0, Uint32 MinRightMargin = 0 ); - - virtual cUIProgressBar * CreateProgressBar( cUIControl * Parent = NULL, const Sizei& Size = Sizei(), const Vector2i& Pos = Vector2i(), const Uint32& Flags = UI_CONTROL_DEFAULT_FLAGS, bool DisplayPercent = false, bool VerticalExpand = false, Vector2f MovementSpeed = Vector2f( 64, 0 ), Rectf FillerMargin = Rectf() ); - - virtual cUIPushButton * CreatePushButton( cUIControl * Parent = NULL, const Sizei& Size = Sizei(), const Vector2i& Pos = Vector2i(), const Uint32& Flags = UI_CONTROL_DEFAULT_FLAGS_CENTERED | UI_AUTO_SIZE, SubTexture * Icon = NULL, Int32 IconHorizontalMargin = 0, bool IconAutoMargin = true ); - - virtual cUISelectButton * CreateSelectButton( cUIControl * Parent = NULL, const Sizei& Size = Sizei(), const Vector2i& Pos = Vector2i(), const Uint32& Flags = UI_CONTROL_DEFAULT_FLAGS_CENTERED | UI_AUTO_SIZE, SubTexture * Icon = NULL, Int32 IconHorizontalMargin = 0, bool IconAutoMargin = true ); - - virtual cUIWinMenu * CreateWinMenu( cUIControl * Parent = NULL, const Sizei& Size = Sizei(), const Vector2i& Pos = Vector2i(), const Uint32& Flags = UI_CONTROL_DEFAULT_FLAGS, Uint32 MarginBetweenButtons = 0, Uint32 ButtonMargin = 4, Uint32 MenuHeight = 0, Uint32 FirstButtonMargin = 1 ); - - virtual cUIWindow * CreateWindow( cUIControl * Parent = NULL, const Sizei& Size = Sizei(), const Vector2i& Pos = Vector2i(), const Uint32& Flags = UI_CONTROL_DEFAULT_FLAGS_CENTERED, Uint32 WinFlags = UI_WIN_DEFAULT_FLAGS, Sizei MinWindowSize = Sizei(0,0), Uint8 BaseAlpha = 255 ); - - virtual cUICommonDialog * CreateCommonDialog( cUIControl * Parent = NULL, const Sizei& Size = Sizei(), const Vector2i& Pos = Vector2i(), const Uint32& Flags = UI_CONTROL_DEFAULT_FLAGS_CENTERED, Uint32 WinFlags = UI_WIN_DEFAULT_FLAGS | UI_WIN_MAXIMIZE_BUTTON, Sizei MinWindowSize = Sizei(0,0), Uint8 BaseAlpha = 255, Uint32 CDLFlags = UI_CDL_DEFAULT_FLAGS, std::string DefaultFilePattern = "*", std::string DefaultDirectory = Sys::GetProcessPath() ); - - virtual cUIMessageBox * CreateMessageBox( UI_MSGBOX_TYPE Type = MSGBOX_OKCANCEL, const String& Message = String(), Uint32 WinFlags = UI_WIN_DEFAULT_FLAGS | UI_WIN_MODAL, cUIControl * Parent = NULL, const Sizei& Size = Sizei(), const Vector2i& Pos = Vector2i(), const Uint32& Flags = UI_CONTROL_DEFAULT_FLAGS_CENTERED, Sizei MinWindowSize = Sizei(0,0), Uint8 BaseAlpha = 255 ); - - virtual cUITabWidget * CreateTabWidget( cUIControl * Parent = NULL, const Sizei& Size = Sizei(), const Vector2i& Pos = Vector2i(), const Uint32& Flags = UI_HALIGN_CENTER | UI_VALIGN_BOTTOM | UI_CONTROL_DEFAULT_ANCHOR, const bool& TabsClosable = false, const bool& SpecialBorderTabs = false , const Int32& TabSeparation = 0, const Uint32& MaxTextLength = 30, const Uint32& TabWidgetHeight = 0, const Uint32& TabTextAlign = UI_HALIGN_CENTER | UI_VALIGN_CENTER, const Uint32& MinTabWidth = 32, const Uint32& MaxTabWidth = 210 ); - protected: - std::string mName; - Uint32 mNameHash; - std::string mAbbr; - Graphics::TextureAtlas * mTextureAtlas; - Graphics::Font * mFont; - ColorA mFontColor; - ColorA mFontShadowColor; - ColorA mFontOverColor; - ColorA mFontSelectedColor; - bool mUseDefaultThemeValues; - std::list mUIElements; - std::list mUIIcons; - - void TextureAtlas( Graphics::TextureAtlas * SG ); - - static bool SearchFilesOfElement( Graphics::TextureAtlas * SG, const std::string& Path, std::string Element, Uint32& IsComplex, const std::string ImgExt ); - - static bool SearchFilesInAtlas( Graphics::TextureAtlas * SG, std::string Element, Uint32& IsComplex ); -}; - -}} - -#endif diff --git a/include/eepp/ui/tools/ctextureatlaseditor.hpp b/include/eepp/ui/tools/ctextureatlaseditor.hpp deleted file mode 100644 index 7bb862619..000000000 --- a/include/eepp/ui/tools/ctextureatlaseditor.hpp +++ /dev/null @@ -1,102 +0,0 @@ -#ifndef EE_UITOOLSCTEXTUREATLASEDITOR_HPP -#define EE_UITOOLSCTEXTUREATLASEDITOR_HPP - -#include -#include -#include -#include -#include -#include -#include -#include - -namespace EE { namespace UI { namespace Tools { - -class TextureAtlasSubTextureEditor; - -class EE_API TextureAtlasEditor { - public: - typedef cb::Callback0 TGEditorCloseCb; - - TextureAtlasEditor( cUIWindow * AttatchTo = NULL, const TGEditorCloseCb& callback = TGEditorCloseCb() ); - - virtual ~TextureAtlasEditor(); - - cUISpinBox * SpinOffX() const { return mSpinOffX; } - - cUISpinBox * SpinOffY() const { return mSpinOffY; } - protected: - class cUITGEUpdater : public cUIControl - { - public: - cUITGEUpdater( const CreateParams& Params, TextureAtlasEditor * TGEditor ) : cUIControl( Params ), mTGEditor( TGEditor ) {} - virtual void Update() { mTGEditor->Update(); } - protected: - TextureAtlasEditor * mTGEditor; - }; - friend class cUITGEUpdater; - - cUIWindow * mUIWindow; - cUIControl * mUIContainer; - cUITheme * mTheme; - TGEditorCloseCb mCloseCb; - TexturePacker * mTexturePacker; - TextureAtlasLoader * mTextureAtlasLoader; - SubTexture * mCurSubTexture; - cUISpinBox * mSpinOffX; - cUISpinBox * mSpinOffY; - cUISpinBox * mSpinDestW; - cUISpinBox * mSpinDestH; - cUIListBox * mSubTextureList; - cUIWinMenu * mWinMenu; - TextureAtlasSubTextureEditor * mSubTextureEditor; - cUITGEUpdater * mTGEU; - - void WindowClose( const cUIEvent * Event ); - - void CreateTGEditor(); - - void CreateWinMenu(); - - void FileMenuClick( const cUIEvent * Event ); - - void OnTextureAtlasCreate( TexturePacker * TexPacker ); - - void OpenTextureAtlas( const cUIEvent * Event ); - - void SaveTextureAtlas( const cUIEvent * Event ); - - void OnTextureAtlasClose( const cUIEvent * Event ); - - void OnSubTextureChange( const cUIEvent * Event ); - - cUITextBox * CreateTxtBox( Vector2i Pos, const String& Text ); - - void UpdateControls(); - - void FillSubTextureList(); - - void OnOffXChange( const cUIEvent * Event ); - - void OnOffYChange( const cUIEvent * Event ); - - void OnDestWChange( const cUIEvent * Event ); - - void OnDestHChange( const cUIEvent * Event ); - - void OnResetDestSize( const cUIEvent * Event ); - - void OnResetOffset( const cUIEvent * Event ); - - void OnCenterOffset( const cUIEvent * Event ); - - void OnHBOffset( const cUIEvent * Event ); - - void OnTextureAtlasLoaded( TextureAtlasLoader * TGLoader ); - - void Update(); -}; - -}}} - -#endif diff --git a/include/eepp/ui/tools/textureatlaseditor.hpp b/include/eepp/ui/tools/textureatlaseditor.hpp new file mode 100644 index 000000000..dd59b54c2 --- /dev/null +++ b/include/eepp/ui/tools/textureatlaseditor.hpp @@ -0,0 +1,102 @@ +#ifndef EE_UITOOLSCTEXTUREATLASEDITOR_HPP +#define EE_UITOOLSCTEXTUREATLASEDITOR_HPP + +#include +#include +#include +#include +#include +#include +#include +#include + +namespace EE { namespace UI { namespace Tools { + +class TextureAtlasSubTextureEditor; + +class EE_API TextureAtlasEditor { + public: + typedef cb::Callback0 TGEditorCloseCb; + + TextureAtlasEditor( UIWindow * AttatchTo = NULL, const TGEditorCloseCb& callback = TGEditorCloseCb() ); + + virtual ~TextureAtlasEditor(); + + UISpinBox * SpinOffX() const { return mSpinOffX; } + + UISpinBox * SpinOffY() const { return mSpinOffY; } + protected: + class UITGEUpdater : public UIControl + { + public: + UITGEUpdater( const CreateParams& Params, TextureAtlasEditor * TGEditor ) : UIControl( Params ), mTGEditor( TGEditor ) {} + virtual void Update() { mTGEditor->Update(); } + protected: + TextureAtlasEditor * mTGEditor; + }; + friend class UITGEUpdater; + + UIWindow * mUIWindow; + UIControl * mUIContainer; + UITheme * mTheme; + TGEditorCloseCb mCloseCb; + TexturePacker * mTexturePacker; + TextureAtlasLoader * mTextureAtlasLoader; + SubTexture * mCurSubTexture; + UISpinBox * mSpinOffX; + UISpinBox * mSpinOffY; + UISpinBox * mSpinDestW; + UISpinBox * mSpinDestH; + UIListBox * mSubTextureList; + UIWinMenu * mWinMenu; + TextureAtlasSubTextureEditor * mSubTextureEditor; + UITGEUpdater * mTGEU; + + void WindowClose( const UIEvent * Event ); + + void CreateTGEditor(); + + void CreateWinMenu(); + + void FileMenuClick( const UIEvent * Event ); + + void OnTextureAtlasCreate( TexturePacker * TexPacker ); + + void OpenTextureAtlas( const UIEvent * Event ); + + void SaveTextureAtlas( const UIEvent * Event ); + + void OnTextureAtlasClose( const UIEvent * Event ); + + void OnSubTextureChange( const UIEvent * Event ); + + UITextBox * CreateTxtBox( Vector2i Pos, const String& Text ); + + void UpdateControls(); + + void FillSubTextureList(); + + void OnOffXChange( const UIEvent * Event ); + + void OnOffYChange( const UIEvent * Event ); + + void OnDestWChange( const UIEvent * Event ); + + void OnDestHChange( const UIEvent * Event ); + + void OnResetDestSize( const UIEvent * Event ); + + void OnResetOffset( const UIEvent * Event ); + + void OnCenterOffset( const UIEvent * Event ); + + void OnHBOffset( const UIEvent * Event ); + + void OnTextureAtlasLoaded( TextureAtlasLoader * TGLoader ); + + void Update(); +}; + +}}} + +#endif diff --git a/include/eepp/ui/cuibackground.hpp b/include/eepp/ui/uibackground.hpp similarity index 63% rename from include/eepp/ui/cuibackground.hpp rename to include/eepp/ui/uibackground.hpp index baf90fdaa..245c75e48 100644 --- a/include/eepp/ui/cuibackground.hpp +++ b/include/eepp/ui/uibackground.hpp @@ -5,12 +5,12 @@ namespace EE { namespace UI { -class EE_API cUIBackground { +class EE_API UIBackground { public: - cUIBackground(); - cUIBackground( const ColorA& Color, const unsigned int& Corners = 0, const EE_BLEND_MODE& BlendMode = ALPHA_NORMAL ); - cUIBackground( const cUIBackground& Back ); - cUIBackground( const ColorA& TopLeftColor, const ColorA& BottomLeftColor, const ColorA& BottomRightColor, const ColorA& TopRightColor, const unsigned int& Corners, const EE_BLEND_MODE& BlendMode ); + UIBackground(); + UIBackground( const ColorA& Color, const unsigned int& Corners = 0, const EE_BLEND_MODE& BlendMode = ALPHA_NORMAL ); + UIBackground( const UIBackground& Back ); + UIBackground( const ColorA& TopLeftColor, const ColorA& BottomLeftColor, const ColorA& BottomRightColor, const ColorA& TopRightColor, const unsigned int& Corners, const EE_BLEND_MODE& BlendMode ); ColorA& Color( const unsigned int& index = 0 ); diff --git a/include/eepp/ui/cuiborder.hpp b/include/eepp/ui/uiborder.hpp similarity index 81% rename from include/eepp/ui/cuiborder.hpp rename to include/eepp/ui/uiborder.hpp index 18691c500..caa6b3d47 100644 --- a/include/eepp/ui/cuiborder.hpp +++ b/include/eepp/ui/uiborder.hpp @@ -5,10 +5,10 @@ namespace EE { namespace UI { -class EE_API cUIBorder { +class EE_API UIBorder { public: - cUIBorder(); - cUIBorder( const cUIBorder& border ); + UIBorder(); + UIBorder( const UIBorder& border ); const ColorA& Color() const; void Color( const ColorA& Col ); diff --git a/include/eepp/ui/cuicheckbox.hpp b/include/eepp/ui/uicheckbox.hpp similarity index 51% rename from include/eepp/ui/cuicheckbox.hpp rename to include/eepp/ui/uicheckbox.hpp index f02522dd6..d84e885eb 100644 --- a/include/eepp/ui/cuicheckbox.hpp +++ b/include/eepp/ui/uicheckbox.hpp @@ -1,22 +1,22 @@ #ifndef EE_UICUICHECKBOX_H #define EE_UICUICHECKBOX_H -#include -#include +#include +#include namespace EE { namespace UI { -class EE_API cUICheckBox : public cUITextBox { +class EE_API UICheckBox : public UITextBox { public: - cUICheckBox( const cUITextBox::CreateParams& Params ); + UICheckBox( const UITextBox::CreateParams& Params ); - virtual ~cUICheckBox(); + virtual ~UICheckBox(); virtual Uint32 Type() const; virtual bool IsType( const Uint32& type ) const; - virtual void SetTheme( cUITheme * Theme ); + virtual void SetTheme( UITheme * Theme ); const bool& IsActive() const; @@ -26,12 +26,12 @@ class EE_API cUICheckBox : public cUITextBox { virtual void Padding( const Recti& padding ); - cUIControlAnim * ActiveButton() const; + UIControlAnim * ActiveButton() const; - cUIControlAnim * InactiveButton() const; + UIControlAnim * InactiveButton() const; protected: - cUIControlAnim * mActiveButton; - cUIControlAnim * mInactiveButton; + UIControlAnim * mActiveButton; + UIControlAnim * mInactiveButton; bool mActive; Uint32 mLastTick; @@ -41,9 +41,9 @@ class EE_API cUICheckBox : public cUITextBox { virtual void OnAlphaChange(); - virtual Uint32 OnKeyDown( const cUIEventKey& Event ); + virtual Uint32 OnKeyDown( const UIEventKey& Event ); - virtual Uint32 OnMessage( const cUIMessage * Msg ); + virtual Uint32 OnMessage( const UIMessage * Msg ); void DoAfterSetTheme(); diff --git a/include/eepp/ui/uicombobox.hpp b/include/eepp/ui/uicombobox.hpp new file mode 100644 index 000000000..a1d7fd8f9 --- /dev/null +++ b/include/eepp/ui/uicombobox.hpp @@ -0,0 +1,37 @@ +#ifndef EE_UICUICOMBOBOX_HPP +#define EE_UICUICOMBOBOX_HPP + +#include + +namespace EE { namespace UI { + +class EE_API UIComboBox : public UIDropDownList { + public: + UIComboBox( UIComboBox::CreateParams& Params ); + + virtual ~UIComboBox(); + + virtual Uint32 Type() const; + + virtual bool IsType( const Uint32& type ) const; + + virtual void SetTheme( UITheme * Theme ); + protected: + UIControl * mButton; + + void OnButtonClick( const UIEvent * Event ); + + void OnButtonEnter( const UIEvent * Event ); + + void OnButtonExit( const UIEvent * Event ); + + Uint32 OnMouseClick( const Vector2i& Pos, const Uint32 Flags ); + + void CreateButton(); + + virtual void OnControlClear( const UIEvent *Event ); +}; + +}} + +#endif diff --git a/include/eepp/ui/cuicommondialog.hpp b/include/eepp/ui/uicommondialog.hpp similarity index 52% rename from include/eepp/ui/cuicommondialog.hpp rename to include/eepp/ui/uicommondialog.hpp index cf9bef9cd..1f25035f4 100644 --- a/include/eepp/ui/cuicommondialog.hpp +++ b/include/eepp/ui/uicommondialog.hpp @@ -2,21 +2,21 @@ #define EE_UICUICOMMONDIALOG_HPP #include -#include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include +#include namespace EE { namespace UI { -class EE_API cUICommonDialog : public cUIWindow { +class EE_API UICommonDialog : public UIWindow { public: - class CreateParams : public cUIWindow::CreateParams { + class CreateParams : public UIWindow::CreateParams { public: inline CreateParams() : - cUIWindow::CreateParams(), + UIWindow::CreateParams(), DefaultDirectory( Sys::GetProcessPath() ), DefaultFilePattern( "*" ), CDLFlags( UI_CDL_DEFAULT_FLAGS ) @@ -30,19 +30,19 @@ class EE_API cUICommonDialog : public cUIWindow { Uint32 CDLFlags; }; - cUICommonDialog( const cUICommonDialog::CreateParams& Params ); + UICommonDialog( const UICommonDialog::CreateParams& Params ); - virtual ~cUICommonDialog(); + virtual ~UICommonDialog(); virtual Uint32 Type() const; virtual bool IsType( const Uint32& type ) const; - virtual void SetTheme( cUITheme * Theme ); + virtual void SetTheme( UITheme * Theme ); void RefreshFolder(); - virtual Uint32 OnMessage( const cUIMessage *Msg ); + virtual Uint32 OnMessage( const UIMessage *Msg ); virtual void Open(); @@ -54,19 +54,19 @@ class EE_API cUICommonDialog : public cUIWindow { std::string GetFullPath(); - cUIPushButton * GetButtonOpen() const; + UIPushButton * GetButtonOpen() const; - cUIPushButton * GetButtonCancel() const; + UIPushButton * GetButtonCancel() const; - cUIPushButton * GetButtonUp() const; + UIPushButton * GetButtonUp() const; - cUIListBox * GetList() const; + UIListBox * GetList() const; - cUITextInput * GetPathInput() const; + UITextInput * GetPathInput() const; - cUITextInput * GetFileInput() const; + UITextInput * GetFileInput() const; - cUIDropDownList * GetFiletypeList() const; + UIDropDownList * GetFiletypeList() const; void AddFilePattern( std::string pattern, bool select = false ); @@ -85,18 +85,18 @@ class EE_API cUICommonDialog : public cUIWindow { void AllowFolderSelect( const bool& allowFolderSelect ); protected: std::string mCurPath; - cUIPushButton * mButtonOpen; - cUIPushButton * mButtonCancel; - cUIPushButton * mButtonUp; - cUIListBox * mList; - cUITextInput * mPath; - cUITextInput * mFile; - cUIDropDownList * mFiletype; + UIPushButton * mButtonOpen; + UIPushButton * mButtonCancel; + UIPushButton * mButtonUp; + UIListBox * mList; + UITextInput * mPath; + UITextInput * mFile; + UIDropDownList * mFiletype; Uint32 mCDLFlags; - void OnPressEnter( const cUIEvent * Event ); + void OnPressEnter( const UIEvent * Event ); - void OnPressFileEnter( const cUIEvent * Event ); + void OnPressFileEnter( const UIEvent * Event ); void OpenSaveClick(); diff --git a/include/eepp/ui/cuicomplexcontrol.hpp b/include/eepp/ui/uicomplexcontrol.hpp similarity index 65% rename from include/eepp/ui/cuicomplexcontrol.hpp rename to include/eepp/ui/uicomplexcontrol.hpp index 54d8a3b72..701b19dcc 100644 --- a/include/eepp/ui/cuicomplexcontrol.hpp +++ b/include/eepp/ui/uicomplexcontrol.hpp @@ -1,32 +1,32 @@ #ifndef EE_UICUICOMPLEXCONTROL_HPP #define EE_UICUICOMPLEXCONTROL_HPP -#include -#include +#include +#include namespace EE { namespace UI { -class EE_API cUIComplexControl : public cUIControlAnim { +class EE_API UIComplexControl : public UIControlAnim { public: - class CreateParams : public cUIControlAnim::CreateParams { + class CreateParams : public UIControlAnim::CreateParams { public: inline CreateParams() : - cUIControlAnim::CreateParams(), + UIControlAnim::CreateParams(), MinControlSize( 0, 0 ) { } inline CreateParams( - cUIControl * parentCtrl, + UIControl * parentCtrl, const Vector2i& pos = Vector2i( 0, 0 ), const Sizei& size = Sizei( -1, -1 ), const Uint32& flags = UI_CONTROL_DEFAULT_FLAGS, const EE_BLEND_MODE& blend = ALPHA_NORMAL, - const cUIBackground& Back = cUIBackground(), - const cUIBorder& Bord = cUIBorder(), + const UIBackground& Back = UIBackground(), + const UIBorder& Bord = UIBorder(), const Sizei& MinCtrlSize = Sizei(0,0) ) : - cUIControlAnim::CreateParams( parentCtrl, pos, size, flags, blend, Back, Bord ), + UIControlAnim::CreateParams( parentCtrl, pos, size, flags, blend, Back, Bord ), MinControlSize( MinCtrlSize ) { } @@ -37,9 +37,9 @@ class EE_API cUIComplexControl : public cUIControlAnim { Sizei MinControlSize; }; - cUIComplexControl( const cUIComplexControl::CreateParams& Params ); + UIComplexControl( const UIComplexControl::CreateParams& Params ); - virtual ~cUIComplexControl(); + virtual ~UIComplexControl(); virtual Uint32 Type() const; @@ -53,7 +53,7 @@ class EE_API cUIComplexControl : public cUIControlAnim { const Sizei& Size(); - cUITooltip * Tooltip(); + UITooltip * Tooltip(); void TooltipRemove(); @@ -63,7 +63,7 @@ class EE_API cUIComplexControl : public cUIControlAnim { void UpdateAnchorsDistances(); protected: - cUITooltip * mTooltip; + UITooltip * mTooltip; Sizei mMinControlSize; Recti mDistToBorder; diff --git a/include/eepp/ui/cuicontrol.hpp b/include/eepp/ui/uicontrol.hpp similarity index 66% rename from include/eepp/ui/cuicontrol.hpp rename to include/eepp/ui/uicontrol.hpp index b98a29da9..fb5261d99 100644 --- a/include/eepp/ui/cuicontrol.hpp +++ b/include/eepp/ui/uicontrol.hpp @@ -3,37 +3,37 @@ #include #include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include namespace EE { namespace UI { -class cUITheme; -class cUIManager; +class UITheme; +class UIManager; -class EE_API cUIControl { +class EE_API UIControl { public: - typedef cb::Callback1 UIEventCallback; + typedef cb::Callback1 UIEventCallback; class CreateParams { public: CreateParams( - cUIControl * parentCtrl, + UIControl * parentCtrl, const Vector2i& pos = Vector2i( 0, 0 ), const Sizei& size = Sizei( -1, -1 ), const Uint32& flags = UI_CONTROL_DEFAULT_FLAGS, const EE_BLEND_MODE& blend = ALPHA_NORMAL, - const cUIBackground& Back = cUIBackground(), - const cUIBorder& Bord = cUIBorder() + const UIBackground& Back = UIBackground(), + const UIBorder& Bord = UIBorder() ) : ParentCtrl( parentCtrl ), Pos( pos ), @@ -57,22 +57,22 @@ class EE_API cUIControl { void PosSet( const Vector2i& pos ) { Pos.x = pos.x; Pos.y = pos.y; } void PosSet( const Int32& X, const Int32& Y ) { Pos.x = X; Pos.y = Y; } - void Parent( cUIControl * Ctrl ) { ParentCtrl = Ctrl; } + void Parent( UIControl * Ctrl ) { ParentCtrl = Ctrl; } void SizeSet( const Sizei& size ) { Size.x = size.x; Size.y = size.y; } void SizeSet( const Int32& Width, const Int32& Height ) { Size.x = Width; Size.y = Height; } - cUIControl * ParentCtrl; + UIControl * ParentCtrl; Vector2i Pos; Sizei Size; Uint32 Flags; - cUIBackground Background; - cUIBorder Border; + UIBackground Background; + UIBorder Border; EE_BLEND_MODE Blend; }; - cUIControl( const CreateParams& Params ); + UIControl( const CreateParams& Params ); - virtual ~cUIControl(); + virtual ~UIControl(); void ScreenToControl( Vector2i& Pos ) const; @@ -86,7 +86,7 @@ class EE_API cUIControl { virtual bool IsType( const Uint32& type ) const; - virtual void MessagePost( const cUIMessage * Msg ); + virtual void MessagePost( const UIMessage * Msg ); bool IsInside( const Vector2i& Pos ) const; @@ -116,9 +116,9 @@ class EE_API cUIControl { bool Disabled() const; - cUIControl * Parent() const; + UIControl * Parent() const; - void Parent( cUIControl * parent ); + void Parent( UIControl * parent ); void CenterHorizontal(); @@ -144,17 +144,17 @@ class EE_API cUIControl { void Border( bool enabled ); - cUIControl * NextGet() const; + UIControl * NextGet() const; - cUIControl * PrevGet() const; + UIControl * PrevGet() const; - cUIControl * NextGetLoop() const; + UIControl * NextGetLoop() const; void Data( const UintPtr& data ); const UintPtr& Data() const; - cUIControl * ChildGetAt( Vector2i CtrlPos, unsigned int RecursiveLevel = 0 ); + UIControl * ChildGetAt( Vector2i CtrlPos, unsigned int RecursiveLevel = 0 ); const Uint32& Flags() const; @@ -187,27 +187,27 @@ class EE_API cUIControl { void RemoveEventListener( const Uint32& CallbackId ); - cUIBackground * Background(); + UIBackground * Background(); - cUIBorder * Border(); + UIBorder * Border(); void SetThemeByName( const std::string& Theme ); - virtual void SetTheme( cUITheme * Theme ); + virtual void SetTheme( UITheme * Theme ); - void SetThemeControl( cUITheme * Theme, const std::string& ControlName ); + void SetThemeControl( UITheme * Theme, const std::string& ControlName ); - void SetThemeToChilds( cUITheme * Theme ); + void SetThemeToChilds( UITheme * Theme ); - cUISkin * GetSkin(); + UISkin * GetSkin(); - void SetSkinFromTheme( cUITheme * Theme, const std::string& ControlName ); + void SetSkinFromTheme( UITheme * Theme, const std::string& ControlName ); - virtual void SetSkin( const cUISkin& Skin ); + virtual void SetSkin( const UISkin& Skin ); - cUIControl * ChildGetFirst() const; + UIControl * ChildGetFirst() const; - cUIControl * ChildGetLast() const; + UIControl * ChildGetLast() const; bool IsMouseOver(); @@ -223,9 +223,9 @@ class EE_API cUIControl { virtual void SetFocus(); - bool IsParentOf( cUIControl * Ctrl ); + bool IsParentOf( UIControl * Ctrl ); - void SendEvent( const cUIEvent * Event ); + void SendEvent( const UIEvent * Event ); void SendMouseEvent( const Uint32& Event, const Vector2i& Pos, const Uint32& Flags ); @@ -233,7 +233,7 @@ class EE_API cUIControl { Sizei GetSkinSize(); - cUIControl * NextComplexControl(); + UIControl * NextComplexControl(); void ApplyDefaultTheme(); @@ -242,8 +242,8 @@ class EE_API cUIControl { void ChildsCloseAll(); protected: typedef std::map< Uint32, std::map > UIEventsMap; - friend class cUIManager; - friend class cUIWindow; + friend class UIManager; + friend class UIWindow; Vector2i mPos; Vector2i mScreenPos; @@ -252,15 +252,15 @@ class EE_API cUIControl { Uint32 mFlags; UintPtr mData; - cUIControl * mParentCtrl; - cUIControl * mChild; //! Pointer to the first child of the control - cUIControl * mChildLast; //! Pointer to the last child added - cUIControl * mNext; //! Pointer to the next child of the father - cUIControl * mPrev; //! Pointer to the prev child of the father - cUISkinState * mSkinState; + UIControl * mParentCtrl; + UIControl * mChild; //! Pointer to the first child of the control + UIControl * mChildLast; //! Pointer to the last child added + UIControl * mNext; //! Pointer to the next child of the father + UIControl * mPrev; //! Pointer to the prev child of the father + UISkinState * mSkinState; - cUIBackground * mBackground; - cUIBorder * mBorder; + UIBackground * mBackground; + UIBorder * mBorder; Uint32 mControlFlags; Uint16 mBlend; @@ -274,11 +274,11 @@ class EE_API cUIControl { bool mVisible; bool mEnabled; - virtual Uint32 OnMessage( const cUIMessage * Msg ); + virtual Uint32 OnMessage( const UIMessage * Msg ); - virtual Uint32 OnKeyDown( const cUIEventKey& Event ); + virtual Uint32 OnKeyDown( const UIEventKey& Event ); - virtual Uint32 OnKeyUp( const cUIEventKey& Event ); + virtual Uint32 OnKeyUp( const UIEventKey& Event ); virtual Uint32 OnMouseMove( const Vector2i& Pos, const Uint32 Flags ); @@ -330,7 +330,7 @@ class EE_API cUIControl { virtual void DoAfterSetTheme(); - virtual cUIControl * OverFind( const Vector2f& Point ); + virtual UIControl * OverFind( const Vector2f& Point ); void ClipMe(); @@ -340,23 +340,23 @@ class EE_API cUIControl { void ChildDeleteAll(); - void ChildAdd( cUIControl * ChildCtrl ); + void ChildAdd( UIControl * ChildCtrl ); - void ChildAddAt( cUIControl * ChildCtrl, Uint32 Pos ); + void ChildAddAt( UIControl * ChildCtrl, Uint32 Pos ); - void ChildRemove( cUIControl * ChildCtrl ); + void ChildRemove( UIControl * ChildCtrl ); - bool IsChild( cUIControl * ChildCtrl ) const; + bool IsChild( UIControl * ChildCtrl ) const; - bool InParentTreeOf( cUIControl * Child ) const; + bool InParentTreeOf( UIControl * Child ) const; Uint32 ChildCount() const; - cUIControl * ChildAt( Uint32 Index ) const; + UIControl * ChildAt( Uint32 Index ) const; - cUIControl * ChildPrev( cUIControl * Ctrl, bool Loop = false ) const; + UIControl * ChildPrev( UIControl * Ctrl, bool Loop = false ) const; - cUIControl * ChildNext( cUIControl * Ctrl, bool Loop = false ) const; + UIControl * ChildNext( UIControl * Ctrl, bool Loop = false ) const; void ClipDisable(); @@ -380,7 +380,7 @@ class EE_API cUIControl { void SafeDeleteSkinState(); - Sizei GetSkinSize( cUISkin * Skin, const Uint32& State = cUISkinState::StateNormal ); + Sizei GetSkinSize( UISkin * Skin, const Uint32& State = UISkinState::StateNormal ); Rectf GetRectf(); }; diff --git a/include/eepp/ui/cuicontrolanim.hpp b/include/eepp/ui/uicontrolanim.hpp similarity index 92% rename from include/eepp/ui/cuicontrolanim.hpp rename to include/eepp/ui/uicontrolanim.hpp index 1ce201721..01c6bf220 100644 --- a/include/eepp/ui/cuicontrolanim.hpp +++ b/include/eepp/ui/uicontrolanim.hpp @@ -2,16 +2,16 @@ #define EE_UICUICONTROLANIM_H #include -#include -#include +#include +#include namespace EE { namespace UI { -class EE_API cUIControlAnim : public cUIDragable { +class EE_API UIControlAnim : public UIDragable { public: - cUIControlAnim( const CreateParams& Params ); + UIControlAnim( const CreateParams& Params ); - virtual ~cUIControlAnim(); + virtual ~UIControlAnim(); virtual Uint32 Type() const; @@ -67,7 +67,7 @@ class EE_API cUIControlAnim : public cUIDragable { bool FadingOut(); protected: - friend class cUIManager; + friend class UIManager; Float mAngle; Vector2f mScale; diff --git a/include/eepp/ui/uidefaulttheme.hpp b/include/eepp/ui/uidefaulttheme.hpp new file mode 100644 index 000000000..94bb1380b --- /dev/null +++ b/include/eepp/ui/uidefaulttheme.hpp @@ -0,0 +1,35 @@ +#ifndef EE_UICUIDEFAULTTHEME_HPP +#define EE_UICUIDEFAULTTHEME_HPP + +#include + +namespace EE { namespace UI { + +class EE_API UIDefaultTheme : public UITheme { + public: + UIDefaultTheme( const std::string& Name, const std::string& Abbr, Graphics::Font * DefaultFont = NULL ); + + virtual UIPopUpMenu * CreatePopUpMenu( UIControl * Parent = NULL, const Sizei& Size = Sizei(), const Vector2i& Pos = Vector2i(), const Uint32& Flags = UI_CONTROL_DEFAULT_FLAGS | UI_AUTO_SIZE | UI_AUTO_PADDING, Uint32 RowHeight = 0, Recti PaddingContainer = Recti(), Uint32 MinWidth = 100, Uint32 MinSpaceForIcons = 16, Uint32 MinRightMargin = 8 ); + + virtual UIProgressBar * CreateProgressBar( UIControl * Parent = NULL, const Sizei& Size = Sizei(), const Vector2i& Pos = Vector2i(), const Uint32& Flags = UI_CONTROL_DEFAULT_FLAGS, bool DisplayPercent = true, bool VerticalExpand = false, Vector2f MovementSpeed = Vector2f( -64, 0 ), Rectf FillerMargin = Rectf() ); + + virtual UIWinMenu * CreateWinMenu( UIControl * Parent = NULL, const Sizei& Size = Sizei(), const Vector2i& Pos = Vector2i(), const Uint32& Flags = UI_CONTROL_DEFAULT_FLAGS, Uint32 MarginBetweenButtons = 0, Uint32 ButtonMargin = 12, Uint32 MenuHeight = 0, Uint32 FirstButtonMargin = 1 ); + + virtual UIWindow * CreateWindow( UIControl * Parent = NULL, const Sizei& Size = Sizei(), const Vector2i& Pos = Vector2i(), const Uint32& Flags = UI_CONTROL_DEFAULT_FLAGS_CENTERED, Uint32 WinFlags = UI_WIN_DEFAULT_FLAGS, Sizei MinWindowSize = Sizei(0,0), Uint8 BaseAlpha = 255 ); + + virtual UICommonDialog * CreateCommonDialog( UIControl * Parent = NULL, const Sizei& Size = Sizei(), const Vector2i& Pos = Vector2i(), const Uint32& Flags = UI_CONTROL_DEFAULT_FLAGS_CENTERED, Uint32 WinFlags = UI_WIN_DEFAULT_FLAGS | UI_WIN_MAXIMIZE_BUTTON, Sizei MinWindowSize = Sizei(0,0), Uint8 BaseAlpha = 255, Uint32 CDLFlags = UI_CDL_DEFAULT_FLAGS, std::string DefaultFilePattern = "*", std::string DefaultDirectory = Sys::GetProcessPath() ); + + virtual UIComboBox * CreateComboBox( UIControl * Parent = NULL, const Sizei& Size = Sizei(), const Vector2i& Pos = Vector2i(), const Uint32& Flags = UI_CONTROL_DEFAULT_FLAGS | UI_CLIP_ENABLE | UI_AUTO_PADDING | UI_AUTO_SIZE, Uint32 MinNumVisibleItems = 6, bool PopUpToMainControl = false, UIListBox * ListBox = NULL ); + + virtual UIDropDownList * CreateDropDownList( UIControl * Parent = NULL, const Sizei& Size = Sizei(), const Vector2i& Pos = Vector2i(), const Uint32& Flags = UI_CONTROL_DEFAULT_FLAGS | UI_CLIP_ENABLE | UI_AUTO_PADDING | UI_AUTO_SIZE, Uint32 MinNumVisibleItems = 6, bool PopUpToMainControl = false, UIListBox * ListBox = NULL ); + + virtual UIMessageBox * CreateMessageBox( UI_MSGBOX_TYPE Type = MSGBOX_OKCANCEL, const String& Message = String(), Uint32 WinFlags = UI_WIN_DEFAULT_FLAGS | UI_WIN_MODAL, UIControl * Parent = NULL, const Sizei& Size = Sizei(), const Vector2i& Pos = Vector2i(), const Uint32& Flags = UI_CONTROL_DEFAULT_FLAGS_CENTERED, Sizei MinWindowSize = Sizei(0,0), Uint8 BaseAlpha = 255 ); + + virtual UITabWidget * CreateTabWidget( UIControl * Parent = NULL, const Sizei& Size = Sizei(), const Vector2i& Pos = Vector2i(), const Uint32& Flags = UI_HALIGN_CENTER | UI_VALIGN_BOTTOM | UI_CONTROL_DEFAULT_ANCHOR, const bool& TabsClosable = false, const bool& SpecialBorderTabs = false , const Int32& TabSeparation = 0, const Uint32& MaxTextLength = 30, const Uint32& TabWidgetHeight = 0, const Uint32& TabTextAlign = UI_HALIGN_CENTER | UI_VALIGN_CENTER, const Uint32& MinTabWidth = 32, const Uint32& MaxTabWidth = 210 ); + + virtual UITooltip * CreateTooltip( UIControl * TooltipOf, UIControl * Parent = NULL, const Sizei& Size = Sizei(), const Vector2i& Pos = Vector2i(), const Uint32& Flags = UI_CONTROL_DEFAULT_FLAGS_CENTERED | UI_AUTO_PADDING | UI_AUTO_SIZE ); +}; + +}} + +#endif diff --git a/include/eepp/ui/cuidragable.hpp b/include/eepp/ui/uidragable.hpp similarity index 84% rename from include/eepp/ui/cuidragable.hpp rename to include/eepp/ui/uidragable.hpp index e3508f137..cc335de0c 100644 --- a/include/eepp/ui/cuidragable.hpp +++ b/include/eepp/ui/uidragable.hpp @@ -1,13 +1,13 @@ #ifndef EE_UICUIDRAGABLE_H #define EE_UICUIDRAGABLE_H -#include +#include namespace EE { namespace UI { -class EE_API cUIDragable : public cUIControl { +class EE_API UIDragable : public UIControl { public: - cUIDragable( const cUIControl::CreateParams& Params ); + UIDragable( const UIControl::CreateParams& Params ); virtual Uint32 Type() const; @@ -27,7 +27,7 @@ class EE_API cUIDragable : public cUIControl { void DragButton( const Uint32& Button ); const Uint32& DragButton() const; protected: - virtual ~cUIDragable(); + virtual ~UIDragable(); Vector2i mDragPoint; Uint32 mDragButton; diff --git a/include/eepp/ui/cuidropdownlist.hpp b/include/eepp/ui/uidropdownlist.hpp similarity index 51% rename from include/eepp/ui/cuidropdownlist.hpp rename to include/eepp/ui/uidropdownlist.hpp index 50a55cad8..cc693be3b 100644 --- a/include/eepp/ui/cuidropdownlist.hpp +++ b/include/eepp/ui/uidropdownlist.hpp @@ -1,17 +1,17 @@ #ifndef EE_UICUIDROPDOWNLIST_HPP #define EE_UICUIDROPDOWNLIST_HPP -#include -#include +#include +#include namespace EE { namespace UI { -class EE_API cUIDropDownList : public cUITextInput { +class EE_API UIDropDownList : public UITextInput { public: - class CreateParams : public cUITextInput::CreateParams { + class CreateParams : public UITextInput::CreateParams { public: inline CreateParams() : - cUITextInput::CreateParams(), + UITextInput::CreateParams(), ListBox( NULL ), MinNumVisibleItems( 6 ), PopUpToMainControl( false ) @@ -20,34 +20,34 @@ class EE_API cUIDropDownList : public cUITextInput { inline ~CreateParams() {} - cUIListBox * ListBox; + UIListBox * ListBox; Uint32 MinNumVisibleItems; bool PopUpToMainControl; }; - cUIDropDownList( cUIDropDownList::CreateParams& Params ); + UIDropDownList( UIDropDownList::CreateParams& Params ); - virtual ~cUIDropDownList(); + virtual ~UIDropDownList(); virtual Uint32 Type() const; virtual bool IsType( const Uint32& type ) const; - virtual void SetTheme( cUITheme * Theme ); + virtual void SetTheme( UITheme * Theme ); - cUIListBox * ListBox() const; + UIListBox * ListBox() const; virtual void Update(); protected: - cUIListBox * mListBox; + UIListBox * mListBox; Uint32 mMinNumVisibleItems; bool mPopUpToMainControl; void ShowListBox(); - void OnListBoxFocusLoss( const cUIEvent * Event ); + void OnListBoxFocusLoss( const UIEvent * Event ); - virtual void OnItemSelected( const cUIEvent * Event ); + virtual void OnItemSelected( const UIEvent * Event ); virtual void Show(); @@ -55,13 +55,13 @@ class EE_API cUIDropDownList : public cUITextInput { Uint32 OnMouseClick( const Vector2i& Pos, const Uint32 Flags ); - virtual void OnItemClicked( const cUIEvent * Event ); + virtual void OnItemClicked( const UIEvent * Event ); - virtual void OnItemKeyDown( const cUIEvent * Event ); + virtual void OnItemKeyDown( const UIEvent * Event ); - virtual void OnControlClear( const cUIEvent * Event ); + virtual void OnControlClear( const UIEvent * Event ); - Uint32 OnKeyDown( const cUIEventKey &Event ); + Uint32 OnKeyDown( const UIEventKey &Event ); virtual void OnSizeChange(); diff --git a/include/eepp/ui/cuievent.hpp b/include/eepp/ui/uievent.hpp similarity index 85% rename from include/eepp/ui/cuievent.hpp rename to include/eepp/ui/uievent.hpp index daa5f7940..003b2f11e 100644 --- a/include/eepp/ui/cuievent.hpp +++ b/include/eepp/ui/uievent.hpp @@ -5,11 +5,11 @@ namespace EE { namespace UI { -class cUIControl; +class UIControl; -class EE_API cUIEvent { +class EE_API UIEvent { public: - enum UIEvent { + enum Event { EventKeyDown = 0, EventKeyUp, EventMouseMove, @@ -54,15 +54,15 @@ class EE_API cUIEvent { EventForceDWord = eeINDEX_NOT_FOUND }; - cUIEvent( cUIControl * Ctrl, const Uint32& EventType = EventForceDWord ); + UIEvent( UIControl * Ctrl, const Uint32& EventType = EventForceDWord ); - ~cUIEvent(); + ~UIEvent(); - cUIControl * Ctrl() const; + UIControl * Ctrl() const; const Uint32& EventType() const; protected: - cUIControl * mCtrl; + UIControl * mCtrl; Uint32 mEventType; }; diff --git a/include/eepp/ui/cuieventkey.hpp b/include/eepp/ui/uieventkey.hpp similarity index 56% rename from include/eepp/ui/cuieventkey.hpp rename to include/eepp/ui/uieventkey.hpp index 23b2c6ed7..a1f704588 100644 --- a/include/eepp/ui/cuieventkey.hpp +++ b/include/eepp/ui/uieventkey.hpp @@ -2,17 +2,17 @@ #define EE_UICUIEVENTKEY_HPP #include -#include +#include namespace EE { namespace UI { -class cUIControl; +class UIControl; -class EE_API cUIEventKey : public cUIEvent { +class EE_API UIEventKey : public UIEvent { public: - cUIEventKey( cUIControl * Ctrl, const Uint32& EventNum, const Uint32& KeyCode, const Uint16& Char, const Uint32& Mod ); + UIEventKey( UIControl * Ctrl, const Uint32& EventNum, const Uint32& KeyCode, const Uint16& Char, const Uint32& Mod ); - ~cUIEventKey(); + ~UIEventKey(); const Uint32& KeyCode() const; diff --git a/include/eepp/ui/cuieventmouse.hpp b/include/eepp/ui/uieventmouse.hpp similarity index 54% rename from include/eepp/ui/cuieventmouse.hpp rename to include/eepp/ui/uieventmouse.hpp index d6a63c7c2..912138137 100644 --- a/include/eepp/ui/cuieventmouse.hpp +++ b/include/eepp/ui/uieventmouse.hpp @@ -2,17 +2,17 @@ #define EE_UICUIEVENTMOUSE_HPP #include -#include +#include namespace EE { namespace UI { -class cUIControl; +class UIControl; -class EE_API cUIEventMouse : public cUIEvent { +class EE_API UIEventMouse : public UIEvent { public: - cUIEventMouse( cUIControl * Ctrl, const Uint32& EventNum, const Vector2i& Pos, const Uint32& Flags ); + UIEventMouse( UIControl * Ctrl, const Uint32& EventNum, const Vector2i& Pos, const Uint32& Flags ); - ~cUIEventMouse(); + ~UIEventMouse(); const Vector2i& Pos() const; diff --git a/include/eepp/ui/cuigenericgrid.hpp b/include/eepp/ui/uigenericgrid.hpp similarity index 70% rename from include/eepp/ui/cuigenericgrid.hpp rename to include/eepp/ui/uigenericgrid.hpp index d428471db..1cce6aa6e 100644 --- a/include/eepp/ui/cuigenericgrid.hpp +++ b/include/eepp/ui/uigenericgrid.hpp @@ -1,19 +1,19 @@ #ifndef EE_UICUIGENERICGRID_HPP #define EE_UICUIGENERICGRID_HPP -#include -#include -#include -#include +#include +#include +#include +#include namespace EE { namespace UI { -class EE_API cUIGenericGrid : public cUIComplexControl { +class EE_API UIGenericGrid : public UIComplexControl { public: - class CreateParams : public cUIComplexControl::CreateParams { + class CreateParams : public UIComplexControl::CreateParams { public: inline CreateParams() : - cUIComplexControl::CreateParams(), + UIComplexControl::CreateParams(), SmoothScroll( true ), VScrollMode( UI_SCROLLBAR_AUTO ), HScrollMode( UI_SCROLLBAR_AUTO ), @@ -36,19 +36,19 @@ class EE_API cUIGenericGrid : public cUIComplexControl { Float TouchDragDeceleration; }; - cUIGenericGrid( const cUIGenericGrid::CreateParams& Params ); + UIGenericGrid( const UIGenericGrid::CreateParams& Params ); - ~cUIGenericGrid(); + ~UIGenericGrid(); virtual Uint32 Type() const; virtual bool IsType( const Uint32& type ) const; - virtual void SetTheme( cUITheme * Theme ); + virtual void SetTheme( UITheme * Theme ); - void Add( cUIGridCell * Cell ); + void Add( UIGridCell * Cell ); - void Remove( cUIGridCell * Cell ); + void Remove( UIGridCell * Cell ); void Remove( std::vector ItemsIndex ); @@ -66,7 +66,7 @@ class EE_API cUIGenericGrid : public cUIComplexControl { const Uint32& RowHeight() const; - cUIGridCell * GetCell( const Uint32& CellIndex ) const; + UIGridCell * GetCell( const Uint32& CellIndex ) const; void VerticalScrollMode( const UI_SCROLLBAR_MODE& Mode ); @@ -78,19 +78,19 @@ class EE_API cUIGenericGrid : public cUIComplexControl { Uint32 GetCellPos( const Uint32& CollumnIndex ); - cUIScrollBar * VerticalScrollBar() const; + UIScrollBar * VerticalScrollBar() const; - cUIScrollBar * HorizontalScrollBar() const; + UIScrollBar * HorizontalScrollBar() const; - Uint32 GetItemIndex( cUIGridCell * Item ); + Uint32 GetItemIndex( UIGridCell * Item ); - cUIGridCell * GetItemSelected(); + UIGridCell * GetItemSelected(); Uint32 GetItemSelectedIndex() const; - Uint32 OnMessage( const cUIMessage * Msg ); + Uint32 OnMessage( const UIMessage * Msg ); - tUIItemContainer * Container() const; + UIItemContainer * Container() const; virtual void Update(); @@ -102,17 +102,17 @@ class EE_API cUIGenericGrid : public cUIComplexControl { void TouchDragging( const bool& dragging ); protected: - friend class tUIItemContainer; - friend class cUIGridCell; + friend class UIItemContainer; + friend class UIGridCell; Recti mPadding; bool mSmoothScroll; - tUIItemContainer * mContainer; - cUIScrollBar * mVScrollBar; - cUIScrollBar * mHScrollBar; + UIItemContainer * mContainer; + UIScrollBar * mVScrollBar; + UIScrollBar * mHScrollBar; UI_SCROLLBAR_MODE mVScrollMode; UI_SCROLLBAR_MODE mHScrollMode; - std::vector mItems; + std::vector mItems; Uint32 mCollumnsCount; Uint32 mRowHeight; std::vector mCollumnsWidth; @@ -144,7 +144,7 @@ class EE_API cUIGenericGrid : public cUIComplexControl { void ContainerResize(); - void OnScrollValueChange( const cUIEvent * Event ); + void OnScrollValueChange( const UIEvent * Event ); void SetDefaultCollumnsWidth(); diff --git a/include/eepp/ui/cuigfx.hpp b/include/eepp/ui/uigfx.hpp similarity index 80% rename from include/eepp/ui/cuigfx.hpp rename to include/eepp/ui/uigfx.hpp index 221440b0a..9282e4c88 100644 --- a/include/eepp/ui/cuigfx.hpp +++ b/include/eepp/ui/uigfx.hpp @@ -1,16 +1,16 @@ #ifndef EE_UICUIGFX_H #define EE_UICUIGFX_H -#include +#include namespace EE { namespace UI { -class EE_API cUIGfx : public cUIComplexControl { +class EE_API UIGfx : public UIComplexControl { public: - class CreateParams : public cUIComplexControl::CreateParams { + class CreateParams : public UIComplexControl::CreateParams { public: inline CreateParams() : - cUIComplexControl::CreateParams(), + UIComplexControl::CreateParams(), SubTexture( NULL ), SubTextureColor(), SubTextureRender( RN_NORMAL ) @@ -24,9 +24,9 @@ class EE_API cUIGfx : public cUIComplexControl { EE_RENDER_MODE SubTextureRender; }; - cUIGfx( const cUIGfx::CreateParams& Params ); + UIGfx( const UIGfx::CreateParams& Params ); - virtual ~cUIGfx(); + virtual ~UIGfx(); virtual Uint32 Type() const; diff --git a/include/eepp/ui/uigridcell.hpp b/include/eepp/ui/uigridcell.hpp new file mode 100644 index 000000000..392d4e6cb --- /dev/null +++ b/include/eepp/ui/uigridcell.hpp @@ -0,0 +1,51 @@ +#ifndef EE_UICUIGRIDCELL_HPP +#define EE_UICUIGRIDCELL_HPP + +#include +#include + +namespace EE { namespace UI { + +class UIGenericGrid; + +class EE_API UIGridCell : public UIComplexControl { + public: + UIGridCell( UIGridCell::CreateParams& Params ); + + virtual ~UIGridCell(); + + virtual void SetTheme( UITheme * Theme ); + + void Cell( const Uint32& CollumnIndex, UIControl * Ctrl ); + + UIControl * Cell( const Uint32& CollumnIndex ) const; + + virtual void Update(); + + bool Selected() const; + + void Unselect(); + + void Select(); + + virtual Uint32 OnMessage( const UIMessage * Msg ); + + void AutoSize(); + protected: + friend class UIItemContainer; + friend class UIGenericGrid; + + std::vector mCells; + + UIGenericGrid * GridParent() const; + + void FixCell(); + + virtual Uint32 OnMouseExit( const Vector2i& Pos, const Uint32 Flags ); + + virtual void OnStateChange(); +}; + +}} + +#endif diff --git a/include/eepp/ui/tuiitemcontainer.hpp b/include/eepp/ui/uiitemcontainer.hpp similarity index 65% rename from include/eepp/ui/tuiitemcontainer.hpp rename to include/eepp/ui/uiitemcontainer.hpp index 044217dc3..be11e1b07 100644 --- a/include/eepp/ui/tuiitemcontainer.hpp +++ b/include/eepp/ui/uiitemcontainer.hpp @@ -1,37 +1,37 @@ #ifndef EE_UITUIITEMCONTAINER_HPP #define EE_UITUIITEMCONTAINER_HPP -#include +#include namespace EE { namespace UI { template -class tUIItemContainer : public cUIControl { +class UIItemContainer : public UIControl { public: - tUIItemContainer( cUIControl::CreateParams& Params ); + UIItemContainer( UIControl::CreateParams& Params ); - ~tUIItemContainer(); + ~UIItemContainer(); void Update(); void DrawChilds(); protected: - cUIControl * OverFind( const Vector2f& Point ); + UIControl * OverFind( const Vector2f& Point ); }; template -tUIItemContainer::tUIItemContainer( cUIControl::CreateParams& Params ) : - cUIControl( Params ) +UIItemContainer::UIItemContainer( UIControl::CreateParams& Params ) : + UIControl( Params ) { } template -tUIItemContainer::~tUIItemContainer() +UIItemContainer::~UIItemContainer() { } template -void tUIItemContainer::Update() { +void UIItemContainer::Update() { TContainer * tParent = reinterpret_cast ( Parent() ); if ( tParent->mItems.size() ) { @@ -43,7 +43,7 @@ void tUIItemContainer::Update() { } template -void tUIItemContainer::DrawChilds() { +void UIItemContainer::DrawChilds() { TContainer * tParent = reinterpret_cast ( Parent() ); if ( tParent->mItems.size() ) { @@ -54,10 +54,10 @@ void tUIItemContainer::DrawChilds() { } template -cUIControl * tUIItemContainer::OverFind( const Vector2f& Point ) { +UIControl * UIItemContainer::OverFind( const Vector2f& Point ) { TContainer * tParent = reinterpret_cast ( Parent() ); - cUIControl * pOver = NULL; + UIControl * pOver = NULL; if ( mEnabled && mVisible && tParent->mItems.size() ) { UpdateQuad(); @@ -67,7 +67,7 @@ cUIControl * tUIItemContainer::OverFind( const Vector2f& Point ) { for ( Uint32 i = tParent->mVisibleFirst; i <= tParent->mVisibleLast; i++ ) { if ( NULL != tParent->mItems[i] ) { - cUIControl * ChildOver = tParent->mItems[i]->OverFind( Point ); + UIControl * ChildOver = tParent->mItems[i]->OverFind( Point ); if ( NULL != ChildOver ) { pOver = ChildOver; @@ -78,7 +78,7 @@ cUIControl * tUIItemContainer::OverFind( const Vector2f& Point ) { } if ( NULL == pOver ) - pOver = const_cast( reinterpret_cast( this ) ); + pOver = const_cast( reinterpret_cast( this ) ); } } diff --git a/include/eepp/ui/cuilistbox.hpp b/include/eepp/ui/uilistbox.hpp similarity index 70% rename from include/eepp/ui/cuilistbox.hpp rename to include/eepp/ui/uilistbox.hpp index 8636ec943..fd67f6bb4 100644 --- a/include/eepp/ui/cuilistbox.hpp +++ b/include/eepp/ui/uilistbox.hpp @@ -1,19 +1,19 @@ #ifndef EE_UICUILISTBOX_HPP #define EE_UICUILISTBOX_HPP -#include -#include -#include -#include +#include +#include +#include +#include namespace EE { namespace UI { -class EE_API cUIListBox : public cUIComplexControl { +class EE_API UIListBox : public UIComplexControl { public: - class CreateParams : public cUIComplexControl::CreateParams { + class CreateParams : public UIComplexControl::CreateParams { public: inline CreateParams() : - cUIComplexControl::CreateParams(), + UIComplexControl::CreateParams(), RowHeight( 0 ), SmoothScroll( true ), VScrollMode( UI_SCROLLBAR_AUTO ), @@ -25,7 +25,7 @@ class EE_API cUIListBox : public cUIComplexControl { FontSelectedColor( 0, 0, 0, 255 ), TouchDragDeceleration( 0.01f ) { - cUITheme * Theme = cUIThemeManager::instance()->DefaultTheme(); + UITheme * Theme = UIThemeManager::instance()->DefaultTheme(); if ( NULL != Theme ) { Font = Theme->Font(); @@ -35,7 +35,7 @@ class EE_API cUIListBox : public cUIComplexControl { } if ( NULL == Font ) - Font = cUIThemeManager::instance()->DefaultFont(); + Font = UIThemeManager::instance()->DefaultFont(); } inline ~CreateParams() {} @@ -54,9 +54,9 @@ class EE_API cUIListBox : public cUIComplexControl { Float TouchDragDeceleration; }; - cUIListBox( cUIListBox::CreateParams& Params ); + UIListBox( UIListBox::CreateParams& Params ); - virtual ~cUIListBox(); + virtual ~UIListBox(); virtual Uint32 Type() const; @@ -68,31 +68,31 @@ class EE_API cUIListBox : public cUIComplexControl { Uint32 AddListBoxItem( const String& Text ); - Uint32 AddListBoxItem( cUIListBoxItem * Item ); + Uint32 AddListBoxItem( UIListBoxItem * Item ); Uint32 RemoveListBoxItem( const String& Text ); - Uint32 RemoveListBoxItem( cUIListBoxItem * Item ); + Uint32 RemoveListBoxItem( UIListBoxItem * Item ); Uint32 RemoveListBoxItem( Uint32 ItemIndex ); void RemoveListBoxItems( std::vector ItemsIndex ); - virtual void SetTheme( cUITheme * Theme ); + virtual void SetTheme( UITheme * Theme ); bool IsMultiSelect() const; - cUIScrollBar * VerticalScrollBar() const; + UIScrollBar * VerticalScrollBar() const; - cUIScrollBar * HorizontalScrollBar() const; + UIScrollBar * HorizontalScrollBar() const; - cUIListBoxItem * GetItem( const Uint32& Index ) const; + UIListBoxItem * GetItem( const Uint32& Index ) const; - Uint32 GetItemIndex( cUIListBoxItem * Item ); + Uint32 GetItemIndex( UIListBoxItem * Item ); Uint32 GetItemIndex( const String& Text ); - cUIListBoxItem * GetItemSelected(); + UIListBoxItem * GetItemSelected(); String GetItemSelectedText() const; @@ -100,7 +100,7 @@ class EE_API cUIListBox : public cUIComplexControl { std::list GetItemsSelectedIndex() const; - std::list GetItemsSelected(); + std::list GetItemsSelected(); void FontColor( const ColorA& Color ); @@ -162,9 +162,9 @@ class EE_API cUIListBox : public cUIComplexControl { void TouchDragging( const bool& dragging ); protected: - friend class cUIListBoxItem; - friend class tUIItemContainer; - friend class cUIDropDownList; + friend class UIListBoxItem; + friend class UIItemContainer; + friend class UIDropDownList; Uint32 mRowHeight; UI_SCROLLBAR_MODE mVScrollMode; @@ -173,9 +173,9 @@ class EE_API cUIListBox : public cUIComplexControl { Recti mPaddingContainer; Recti mHScrollPadding; Recti mVScrollPadding; - tUIItemContainer * mContainer; - cUIScrollBar * mVScrollBar; - cUIScrollBar * mHScrollBar; + UIItemContainer * mContainer; + UIScrollBar * mVScrollBar; + UIScrollBar * mHScrollBar; Graphics::Font * mFont; ColorA mFontColor; ColorA mFontOverColor; @@ -194,14 +194,14 @@ class EE_API cUIListBox : public cUIComplexControl { Float mTouchDragDeceleration; std::list mSelected; - std::vector mItems; + std::vector mItems; std::vector mTexts; void UpdateScroll( bool FromScrollChange = false ); - void OnScrollValueChange( const cUIEvent * Event ); + void OnScrollValueChange( const UIEvent * Event ); - void OnHScrollValueChange( const cUIEvent * Event ); + void OnHScrollValueChange( const UIEvent * Event ); virtual void OnSizeChange(); @@ -211,9 +211,9 @@ class EE_API cUIListBox : public cUIComplexControl { Uint32 GetListBoxItemIndex( const String& Name ); - Uint32 GetListBoxItemIndex( cUIListBoxItem * Item ); + Uint32 GetListBoxItemIndex( UIListBoxItem * Item ); - void ItemClicked( cUIListBoxItem * Item ); + void ItemClicked( UIListBoxItem * Item ); void ResetItemsStates(); @@ -221,23 +221,23 @@ class EE_API cUIListBox : public cUIComplexControl { void ContainerResize(); - void ItemUpdateSize( cUIListBoxItem * Item ); + void ItemUpdateSize( UIListBoxItem * Item ); void AutoPadding(); void FindMaxWidth(); - cUIListBoxItem * CreateListBoxItem( const String& Name ); + UIListBoxItem * CreateListBoxItem( const String& Name ); void CreateItemIndex( const Uint32& i ); virtual void OnAlphaChange(); - virtual Uint32 OnMessage( const cUIMessage * Msg ); + virtual Uint32 OnMessage( const UIMessage * Msg ); - virtual Uint32 OnKeyDown( const cUIEventKey &Event ); + virtual Uint32 OnKeyDown( const UIEventKey &Event ); - void ItemKeyEvent( const cUIEventKey &Event ); + void ItemKeyEvent( const UIEventKey &Event ); }; }} diff --git a/include/eepp/ui/cuilistboxitem.hpp b/include/eepp/ui/uilistboxitem.hpp similarity index 60% rename from include/eepp/ui/cuilistboxitem.hpp rename to include/eepp/ui/uilistboxitem.hpp index 633b909fe..6f833e1b3 100644 --- a/include/eepp/ui/cuilistboxitem.hpp +++ b/include/eepp/ui/uilistboxitem.hpp @@ -1,24 +1,24 @@ #ifndef EE_UICUILISTBOXITEM_HPP #define EE_UICUILISTBOXITEM_HPP -#include -#include +#include +#include namespace EE { namespace UI { -class cUIListBox; +class UIListBox; -class EE_API cUIListBoxItem : public cUITextBox { +class EE_API UIListBoxItem : public UITextBox { public: - cUIListBoxItem( const cUITextBox::CreateParams& Params ); + UIListBoxItem( const UITextBox::CreateParams& Params ); - virtual ~cUIListBoxItem(); + virtual ~UIListBoxItem(); virtual Uint32 Type() const; virtual bool IsType( const Uint32& type ) const; - virtual void SetTheme( cUITheme * Theme ); + virtual void SetTheme( UITheme * Theme ); virtual void Update(); @@ -28,7 +28,7 @@ class EE_API cUIListBoxItem : public cUITextBox { void Select(); protected: - friend class tUIItemContainer; + friend class UIItemContainer; virtual void OnStateChange(); diff --git a/include/eepp/ui/cuimanager.hpp b/include/eepp/ui/uimanager.hpp similarity index 63% rename from include/eepp/ui/cuimanager.hpp rename to include/eepp/ui/uimanager.hpp index 8322fc8bd..a02463dc5 100644 --- a/include/eepp/ui/cuimanager.hpp +++ b/include/eepp/ui/uimanager.hpp @@ -1,29 +1,29 @@ #ifndef EE_UICUIMANAGER_H #define EE_UICUIMANAGER_H -#include -#include +#include +#include #include #include #include namespace EE { namespace UI { -class EE_API cUIManager { - SINGLETON_DECLARE_HEADERS(cUIManager) +class EE_API UIManager { + SINGLETON_DECLARE_HEADERS(UIManager) public: - ~cUIManager(); + ~UIManager(); - cUIWindow * MainControl() const; + UIWindow * MainControl() const; - cUIControl * FocusControl() const; + UIControl * FocusControl() const; - void FocusControl( cUIControl * Ctrl ); + void FocusControl( UIControl * Ctrl ); - cUIControl * OverControl() const; + UIControl * OverControl() const; - void OverControl( cUIControl * Ctrl ); + void OverControl( UIControl * Ctrl ); void Init( Uint32 Flags = 0, EE::Window::Window * window = NULL ); @@ -37,7 +37,7 @@ class EE_API cUIManager { void ResizeControl( EE::Window::Window * win ); - void SendMsg( cUIControl * Ctrl, const Uint32& Msg, const Uint32& Flags = 0 ); + void SendMsg( UIControl * Ctrl, const Uint32& Msg, const Uint32& Flags = 0 ); Vector2i GetMousePos(); @@ -71,18 +71,18 @@ class EE_API cUIManager { const ColorA& HighlightOverColor() const; - void SendMouseClick( cUIControl * ToCtrl, const Vector2i& Pos, const Uint32 Flags ); + void SendMouseClick( UIControl * ToCtrl, const Vector2i& Pos, const Uint32 Flags ); - void SendMouseUp( cUIControl * ToCtrl, const Vector2i& Pos, const Uint32 Flags ); + void SendMouseUp( UIControl * ToCtrl, const Vector2i& Pos, const Uint32 Flags ); - void SendMouseDown( cUIControl * ToCtrl, const Vector2i& Pos, const Uint32 Flags ); + void SendMouseDown( UIControl * ToCtrl, const Vector2i& Pos, const Uint32 Flags ); EE::Window::Window * GetWindow() const; /** Control where the mouse click started to be down */ - cUIControl * DownControl() const; + UIControl * DownControl() const; - cUIControl * LossFocusControl() const; + UIControl * LossFocusControl() const; const bool& IsShootingDown() const; @@ -100,18 +100,18 @@ class EE_API cUIManager { void SetCursor( EE_CURSOR_TYPE cursor ); protected: - friend class cUIControl; - friend class cUIWindow; + friend class UIControl; + friend class UIWindow; EE::Window::Window * mWindow; Input * mKM; - cUIWindow * mControl; - cUIControl * mFocusControl; - cUIControl * mOverControl; - cUIControl * mDownControl; - cUIControl * mLossFocusControl; - std::list mWindowsList; - std::list mCloseList; + UIWindow * mControl; + UIControl * mFocusControl; + UIControl * mOverControl; + UIControl * mDownControl; + UIControl * mLossFocusControl; + std::list mWindowsList; + std::list mCloseList; Time mElapsed; Int32 mCbId; @@ -128,23 +128,23 @@ class EE_API cUIManager { bool mControlDragging; bool mUseGlobalCursors; - cUIManager(); + UIManager(); void InputCallback( InputEvent * Event ); void CheckTabPress( const Uint32& KeyCode ); - void SetActiveWindow( cUIWindow * window ); + void SetActiveWindow( UIWindow * window ); - void SetFocusLastWindow( cUIWindow * window ); + void SetFocusLastWindow( UIWindow * window ); - void WindowAdd( cUIWindow * win ); + void WindowAdd( UIWindow * win ); - void WindowRemove( cUIWindow * win ); + void WindowRemove( UIWindow * win ); - bool WindowExists( cUIWindow * win ); + bool WindowExists( UIWindow * win ); - void AddToCloseQueue( cUIControl * Ctrl ); + void AddToCloseQueue( UIControl * Ctrl ); void CheckClose(); }; diff --git a/include/eepp/ui/cuimenu.hpp b/include/eepp/ui/uimenu.hpp similarity index 55% rename from include/eepp/ui/cuimenu.hpp rename to include/eepp/ui/uimenu.hpp index 3fd5ba675..24fc7694e 100644 --- a/include/eepp/ui/cuimenu.hpp +++ b/include/eepp/ui/uimenu.hpp @@ -1,21 +1,21 @@ #ifndef EE_UICUIMENU_HPP #define EE_UICUIMENU_HPP -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include #include namespace EE { namespace UI { -class EE_API cUIMenu : public cUIComplexControl { +class EE_API UIMenu : public UIComplexControl { public: - class CreateParams : public cUIComplexControl::CreateParams { + class CreateParams : public UIComplexControl::CreateParams { public: inline CreateParams() : - cUIComplexControl::CreateParams(), + UIComplexControl::CreateParams(), RowHeight( 0 ), PaddingContainer(), MinWidth( 0 ), @@ -26,7 +26,7 @@ class EE_API cUIMenu : public cUIComplexControl { FontOverColor( 0, 0, 0, 255 ), FontSelectedColor( 0, 0, 0, 255 ) { - cUITheme * Theme = cUIThemeManager::instance()->DefaultTheme(); + UITheme * Theme = UIThemeManager::instance()->DefaultTheme(); if ( NULL != Theme ) { Font = Theme->Font(); @@ -37,7 +37,7 @@ class EE_API cUIMenu : public cUIComplexControl { } if ( NULL == Font ) - Font = cUIThemeManager::instance()->DefaultFont(); + Font = UIThemeManager::instance()->DefaultFont(); } inline ~CreateParams() {} @@ -55,11 +55,11 @@ class EE_API cUIMenu : public cUIComplexControl { }; - static void FixMenuPos( Vector2i& Pos, cUIMenu * Menu, cUIMenu * Parent = NULL, cUIMenuSubMenu * SubMenu = NULL ); + static void FixMenuPos( Vector2i& Pos, UIMenu * Menu, UIMenu * Parent = NULL, UIMenuSubMenu * SubMenu = NULL ); - cUIMenu( cUIMenu::CreateParams& Params ); + UIMenu( UIMenu::CreateParams& Params ); - virtual ~cUIMenu(); + virtual ~UIMenu(); virtual Uint32 Type() const; @@ -67,33 +67,33 @@ class EE_API cUIMenu : public cUIComplexControl { Uint32 Add( const String& Text, SubTexture * Icon = NULL ); - Uint32 Add( cUIControl * Control ); + Uint32 Add( UIControl * Control ); Uint32 AddSeparator(); Uint32 AddCheckBox( const String& Text, const bool& Active = false ); - Uint32 AddSubMenu( const String& Text, SubTexture * Icon = NULL, cUIMenu * SubMenu = NULL ); + Uint32 AddSubMenu( const String& Text, SubTexture * Icon = NULL, UIMenu * SubMenu = NULL ); - cUIControl * GetItem( const Uint32& Index ); + UIControl * GetItem( const Uint32& Index ); - cUIControl * GetItem( const String& Text ); + UIControl * GetItem( const String& Text ); - Uint32 GetItemIndex( cUIControl * Item ); + Uint32 GetItemIndex( UIControl * Item ); Uint32 Count() const; void Remove( const Uint32& Index ); - void Remove( cUIControl * Ctrl ); + void Remove( UIControl * Ctrl ); void RemoveAll(); void Insert( const String& Text, SubTexture * Icon, const Uint32& Index ); - void Insert( cUIControl * Control, const Uint32& Index ); + void Insert( UIControl * Control, const Uint32& Index ); - virtual void SetTheme( cUITheme * Theme ); + virtual void SetTheme( UITheme * Theme ); virtual bool Show(); @@ -101,11 +101,11 @@ class EE_API cUIMenu : public cUIComplexControl { const Recti& Padding() const; protected: - friend class cUIMenuItem; - friend class cUIMenuCheckBox; - friend class cUIMenuSubMenu; + friend class UIMenuItem; + friend class UIMenuCheckBox; + friend class UIMenuSubMenu; - std::deque mItems; + std::deque mItems; Recti mPadding; Font * mFont; ColorA mFontColor; @@ -119,7 +119,7 @@ class EE_API cUIMenu : public cUIComplexControl { Uint32 mRowHeight; Uint32 mNextPosY; Uint32 mBiggestIcon; - cUIControl * mItemSelected; + UIControl * mItemSelected; Uint32 mItemSelectedIndex; bool mClickHide; Uint32 mLastTickMove; @@ -128,9 +128,9 @@ class EE_API cUIMenu : public cUIComplexControl { void AutoPadding(); - virtual Uint32 OnMessage( const cUIMessage * Msg ); + virtual Uint32 OnMessage( const UIMessage * Msg ); - void SetControlSize( cUIControl * Control, const Uint32& Pos ); + void SetControlSize( UIControl * Control, const Uint32& Pos ); void ResizeControls(); @@ -138,27 +138,27 @@ class EE_API cUIMenu : public cUIComplexControl { void ResizeMe(); - cUIMenuItem * CreateMenuItem( const String& Text, SubTexture * Icon ); + UIMenuItem * CreateMenuItem( const String& Text, SubTexture * Icon ); - cUIMenuCheckBox * CreateMenuCheckBox( const String& Text, const bool& Active ); + UIMenuCheckBox * CreateMenuCheckBox( const String& Text, const bool& Active ); - cUIMenuSubMenu * CreateSubMenu( const String& Text, SubTexture * Icon, cUIMenu * SubMenu ); + UIMenuSubMenu * CreateSubMenu( const String& Text, SubTexture * Icon, UIMenu * SubMenu ); void DoAfterSetTheme(); - bool CheckControlSize( cUIControl * Control, const bool& Resize = true ); + bool CheckControlSize( UIControl * Control, const bool& Resize = true ); - bool IsSubMenu( cUIControl * Ctrl ); + bool IsSubMenu( UIControl * Ctrl ); - void SetItemSelected( cUIControl * Item ); + void SetItemSelected( UIControl * Item ); - virtual Uint32 OnKeyDown( const cUIEventKey& Event ); + virtual Uint32 OnKeyDown( const UIEventKey& Event ); void PrevSel(); void NextSel(); - void TrySelect( cUIControl * Ctrl, bool Up ); + void TrySelect( UIControl * Ctrl, bool Up ); }; }} diff --git a/include/eepp/ui/cuimenucheckbox.hpp b/include/eepp/ui/uimenucheckbox.hpp similarity index 65% rename from include/eepp/ui/cuimenucheckbox.hpp rename to include/eepp/ui/uimenucheckbox.hpp index d2f4b276a..0bd3e9921 100644 --- a/include/eepp/ui/cuimenucheckbox.hpp +++ b/include/eepp/ui/uimenucheckbox.hpp @@ -1,21 +1,21 @@ #ifndef EE_UICUIMENUCHECKBOX_HPP #define EE_UICUIMENUCHECKBOX_HPP -#include +#include namespace EE { namespace UI { -class EE_API cUIMenuCheckBox : public cUIMenuItem { +class EE_API UIMenuCheckBox : public UIMenuItem { public: - cUIMenuCheckBox( cUIMenuCheckBox::CreateParams& Params ); + UIMenuCheckBox( UIMenuCheckBox::CreateParams& Params ); - virtual ~cUIMenuCheckBox(); + virtual ~UIMenuCheckBox(); virtual Uint32 Type() const; virtual bool IsType( const Uint32& type ) const; - virtual void SetTheme( cUITheme * Theme ); + virtual void SetTheme( UITheme * Theme ); const bool& Active() const; @@ -28,8 +28,8 @@ class EE_API cUIMenuCheckBox : public cUIMenuItem { virtual bool InheritsFrom( const Uint32 Type ); protected: bool mActive; - cUISkin * mSkinActive; - cUISkin * mSkinInactive; + UISkin * mSkinActive; + UISkin * mSkinInactive; virtual Uint32 OnMouseUp( const Vector2i &Pos, const Uint32 Flags ); diff --git a/include/eepp/ui/cuimenuitem.hpp b/include/eepp/ui/uimenuitem.hpp similarity index 60% rename from include/eepp/ui/cuimenuitem.hpp rename to include/eepp/ui/uimenuitem.hpp index 878b1a53d..4c45a412c 100644 --- a/include/eepp/ui/cuimenuitem.hpp +++ b/include/eepp/ui/uimenuitem.hpp @@ -1,21 +1,21 @@ #ifndef EE_UICUIMENUITEM_HPP #define EE_UICUIMENUITEM_HPP -#include +#include namespace EE { namespace UI { -class EE_API cUIMenuItem : public cUIPushButton { +class EE_API UIMenuItem : public UIPushButton { public: - cUIMenuItem( cUIMenuItem::CreateParams& Params ); + UIMenuItem( UIMenuItem::CreateParams& Params ); - virtual ~cUIMenuItem(); + virtual ~UIMenuItem(); virtual Uint32 Type() const; virtual bool IsType( const Uint32& type ) const; - virtual void SetTheme( cUITheme * Theme ); + virtual void SetTheme( UITheme * Theme ); protected: virtual Uint32 OnMouseEnter( const Vector2i &Pos, const Uint32 Flags ); diff --git a/include/eepp/ui/cuimenusubmenu.hpp b/include/eepp/ui/uimenusubmenu.hpp similarity index 55% rename from include/eepp/ui/cuimenusubmenu.hpp rename to include/eepp/ui/uimenusubmenu.hpp index 90d8cdc30..6694077e2 100644 --- a/include/eepp/ui/cuimenusubmenu.hpp +++ b/include/eepp/ui/uimenusubmenu.hpp @@ -1,18 +1,18 @@ #ifndef EE_CUIMENUSUBMENU_HPP #define EE_CUIMENUSUBMENU_HPP -#include +#include namespace EE { namespace UI { -class cUIMenu; +class UIMenu; -class EE_API cUIMenuSubMenu : public cUIMenuItem { +class EE_API UIMenuSubMenu : public UIMenuItem { public: - class CreateParams : public cUIMenuItem::CreateParams { + class CreateParams : public UIMenuItem::CreateParams { public: inline CreateParams() : - cUIMenuItem::CreateParams(), + UIMenuItem::CreateParams(), SubMenu( NULL ), MouseOverTimeShowMenu( 200.f ) { @@ -20,33 +20,33 @@ class EE_API cUIMenuSubMenu : public cUIMenuItem { inline ~CreateParams() {} - cUIMenu * SubMenu; + UIMenu * SubMenu; Float MouseOverTimeShowMenu; }; - cUIMenuSubMenu( cUIMenuSubMenu::CreateParams& Params ); + UIMenuSubMenu( UIMenuSubMenu::CreateParams& Params ); - virtual ~cUIMenuSubMenu(); + virtual ~UIMenuSubMenu(); virtual Uint32 Type() const; virtual bool IsType( const Uint32& type ) const; - virtual void SetTheme( cUITheme * Theme ); + virtual void SetTheme( UITheme * Theme ); - void SubMenu( cUIMenu * SubMenu ); + void SubMenu( UIMenu * SubMenu ); - cUIMenu * SubMenu() const; + UIMenu * SubMenu() const; - cUIGfx * Arrow() const; + UIGfx * Arrow() const; void ShowSubMenu(); virtual bool InheritsFrom( const Uint32 Type ); protected: - cUIMenu * mSubMenu; - cUISkin * mSkinArrow; - cUIGfx * mArrow; + UIMenu * mSubMenu; + UISkin * mSkinArrow; + UIGfx * mArrow; Float mTimeOver; Float mMaxTime; Uint32 mCbId; @@ -60,9 +60,9 @@ class EE_API cUIMenuSubMenu : public cUIMenuItem { virtual void OnSizeChange(); - void OnSubMenuFocusLoss( const cUIEvent * Event ); + void OnSubMenuFocusLoss( const UIEvent * Event ); - void OnHideByClick( const cUIEvent * Event ); + void OnHideByClick( const UIEvent * Event ); }; }} diff --git a/include/eepp/ui/cuimessage.hpp b/include/eepp/ui/uimessage.hpp similarity index 70% rename from include/eepp/ui/cuimessage.hpp rename to include/eepp/ui/uimessage.hpp index 75b26451b..172c560fb 100644 --- a/include/eepp/ui/cuimessage.hpp +++ b/include/eepp/ui/uimessage.hpp @@ -5,11 +5,11 @@ namespace EE { namespace UI { -class cUIControl; +class UIControl; -class EE_API cUIMessage { +class EE_API UIMessage { public: - enum UIMessage + enum Message { MsgClick = 0, MsgDoubleClick, @@ -28,17 +28,17 @@ class EE_API cUIMessage { MsgForceDWord = eeINDEX_NOT_FOUND }; - cUIMessage( cUIControl * Ctrl, const Uint32& Msg, const Uint32& Flags = MsgForceDWord ); + UIMessage( UIControl * Ctrl, const Uint32& Msg, const Uint32& Flags = MsgForceDWord ); - ~cUIMessage(); + ~UIMessage(); - cUIControl * Sender() const; + UIControl * Sender() const; const Uint32& Msg() const; const Uint32& Flags() const; private: - cUIControl * mCtrl; + UIControl * mCtrl; Uint32 mMsg; Uint32 mFlags; }; diff --git a/include/eepp/ui/uimessagebox.hpp b/include/eepp/ui/uimessagebox.hpp new file mode 100644 index 000000000..ad3952c62 --- /dev/null +++ b/include/eepp/ui/uimessagebox.hpp @@ -0,0 +1,57 @@ +#ifndef EE_UICUIMESSAGEBOX_HPP +#define EE_UICUIMESSAGEBOX_HPP + +#include +#include +#include + +namespace EE { namespace UI { + +class EE_API UIMessageBox : public UIWindow { + public: + class CreateParams : public UIWindow::CreateParams { + public: + inline CreateParams() : + UIWindow::CreateParams(), + Type( MSGBOX_OKCANCEL ), + CloseWithKey( KEY_UNKNOWN ) + { + } + + inline ~CreateParams() {} + + UI_MSGBOX_TYPE Type; + String Message; + Uint32 CloseWithKey; + }; + + UIMessageBox( const UIMessageBox::CreateParams& Params ); + + virtual ~UIMessageBox(); + + virtual Uint32 OnMessage( const UIMessage * Msg ); + + virtual void SetTheme( UITheme * Theme ); + + UITextBox * TextBox() const; + + UIPushButton * ButtonOK() const; + + UIPushButton * ButtonCancel() const; + + virtual bool Show(); + protected: + UI_MSGBOX_TYPE mMsgBoxType; + UITextBox * mTextBox; + UIPushButton * mButtonOK; + UIPushButton * mButtonCancel; + Uint32 mCloseWithKey; + + void AutoSize(); + + virtual Uint32 OnKeyUp( const UIEventKey& Event ); +}; + +}} + +#endif diff --git a/include/eepp/ui/cuipopupmenu.hpp b/include/eepp/ui/uipopupmenu.hpp similarity index 57% rename from include/eepp/ui/cuipopupmenu.hpp rename to include/eepp/ui/uipopupmenu.hpp index 2b6ae835a..e601dc6d6 100644 --- a/include/eepp/ui/cuipopupmenu.hpp +++ b/include/eepp/ui/uipopupmenu.hpp @@ -1,21 +1,21 @@ #ifndef EE_UICUIPOPUPMENU #define EE_UICUIPOPUPMENU -#include +#include namespace EE { namespace UI { -class EE_API cUIPopUpMenu : public cUIMenu { +class EE_API UIPopUpMenu : public UIMenu { public: - cUIPopUpMenu( cUIPopUpMenu::CreateParams Params ); + UIPopUpMenu( UIPopUpMenu::CreateParams Params ); - virtual ~cUIPopUpMenu(); + virtual ~UIPopUpMenu(); virtual Uint32 Type() const; virtual bool IsType( const Uint32& type ) const; - virtual void SetTheme( cUITheme * Theme ); + virtual void SetTheme( UITheme * Theme ); virtual bool Show(); @@ -23,7 +23,7 @@ class EE_API cUIPopUpMenu : public cUIMenu { protected: virtual void OnComplexControlFocusLoss(); - virtual Uint32 OnMessage( const cUIMessage * Msg ); + virtual Uint32 OnMessage( const UIMessage * Msg ); #ifdef EE_PLATFORM_TOUCH Clock mTE; diff --git a/include/eepp/ui/cuiprogressbar.hpp b/include/eepp/ui/uiprogressbar.hpp similarity index 77% rename from include/eepp/ui/cuiprogressbar.hpp rename to include/eepp/ui/uiprogressbar.hpp index aef68e726..fe73af6af 100644 --- a/include/eepp/ui/cuiprogressbar.hpp +++ b/include/eepp/ui/uiprogressbar.hpp @@ -1,18 +1,18 @@ #ifndef EE_UICPROGRESSBAR_HPP #define EE_UICPROGRESSBAR_HPP -#include -#include +#include +#include #include namespace EE { namespace UI { -class EE_API cUIProgressBar : public cUIComplexControl { +class EE_API UIProgressBar : public UIComplexControl { public: - class CreateParams : public cUITextBox::CreateParams { + class CreateParams : public UITextBox::CreateParams { public: inline CreateParams() : - cUITextBox::CreateParams(), + UITextBox::CreateParams(), DisplayPercent( false ), VerticalExpand( false ), MovementSpeed( 64.f, 0.f ) @@ -27,15 +27,15 @@ class EE_API cUIProgressBar : public cUIComplexControl { Rectf FillerMargin; }; - cUIProgressBar( const cUIProgressBar::CreateParams& Params ); + UIProgressBar( const UIProgressBar::CreateParams& Params ); - virtual ~cUIProgressBar(); + virtual ~UIProgressBar(); virtual Uint32 Type() const; virtual bool IsType( const Uint32& type ) const; - virtual void SetTheme( cUITheme * Theme ); + virtual void SetTheme( UITheme * Theme ); virtual void Progress( Float Val ); @@ -63,7 +63,7 @@ class EE_API cUIProgressBar : public cUIComplexControl { const bool& DisplayPercent() const; - cUITextBox * TextBox() const; + UITextBox * TextBox() const; protected: bool mVerticalExpand; @@ -76,7 +76,7 @@ class EE_API cUIProgressBar : public cUIComplexControl { ScrollParallax * mParallax; - cUITextBox * mTextBox; + UITextBox * mTextBox; virtual Uint32 OnValueChange(); diff --git a/include/eepp/ui/cuipushbutton.hpp b/include/eepp/ui/uipushbutton.hpp similarity index 71% rename from include/eepp/ui/cuipushbutton.hpp rename to include/eepp/ui/uipushbutton.hpp index 5489c7751..dfe575551 100644 --- a/include/eepp/ui/cuipushbutton.hpp +++ b/include/eepp/ui/uipushbutton.hpp @@ -1,18 +1,18 @@ #ifndef EE_UICUIPUSHBUTTON_HPP #define EE_UICUIPUSHBUTTON_HPP -#include -#include -#include +#include +#include +#include namespace EE { namespace UI { -class EE_API cUIPushButton : public cUIComplexControl { +class EE_API UIPushButton : public UIComplexControl { public: - class CreateParams : public cUITextBox::CreateParams { + class CreateParams : public UITextBox::CreateParams { public: inline CreateParams() : - cUITextBox::CreateParams(), + UITextBox::CreateParams(), Font( NULL ), FontColor( 0, 0, 0, 255 ), FontShadowColor( 0, 0, 0, 255 ), @@ -22,7 +22,7 @@ class EE_API cUIPushButton : public cUIComplexControl { IconAutoMargin( true ), IconMinSize( 0, 0 ) { - cUITheme * Theme = cUIThemeManager::instance()->DefaultTheme(); + UITheme * Theme = UIThemeManager::instance()->DefaultTheme(); if ( NULL != Theme ) { Font = Theme->Font(); @@ -32,7 +32,7 @@ class EE_API cUIPushButton : public cUIComplexControl { } if ( NULL == Font ) - Font = cUIThemeManager::instance()->DefaultFont(); + Font = UIThemeManager::instance()->DefaultFont(); } inline ~CreateParams() {} @@ -54,19 +54,19 @@ class EE_API cUIPushButton : public cUIComplexControl { Sizei IconMinSize; }; - cUIPushButton( const cUIPushButton::CreateParams& Params ); + UIPushButton( const UIPushButton::CreateParams& Params ); - virtual ~cUIPushButton(); + virtual ~UIPushButton(); virtual Uint32 Type() const; virtual bool IsType( const Uint32& type ) const; - virtual void SetTheme( cUITheme * Theme ); + virtual void SetTheme( UITheme * Theme ); virtual void Icon( SubTexture * Icon ); - virtual cUIGfx * Icon() const; + virtual UIGfx * Icon() const; virtual void Text( const String& text ); @@ -80,7 +80,7 @@ class EE_API cUIPushButton : public cUIComplexControl { const Int32& IconHorizontalMargin() const; - cUITextBox * TextBox() const; + UITextBox * TextBox() const; const ColorA& FontColor() const; @@ -92,8 +92,8 @@ class EE_API cUIPushButton : public cUIComplexControl { protected: ColorA mFontColor; ColorA mFontOverColor; - cUIGfx * mIcon; - cUITextBox * mTextBox; + UIGfx * mIcon; + UITextBox * mTextBox; Int32 mIconSpace; virtual void OnSizeChange(); @@ -106,9 +106,9 @@ class EE_API cUIPushButton : public cUIComplexControl { virtual void DoAfterSetTheme(); - virtual Uint32 OnKeyDown( const cUIEventKey& Event ); + virtual Uint32 OnKeyDown( const UIEventKey& Event ); - virtual Uint32 OnKeyUp( const cUIEventKey& Event ); + virtual Uint32 OnKeyUp( const UIEventKey& Event ); }; }} diff --git a/include/eepp/ui/cuiradiobutton.hpp b/include/eepp/ui/uiradiobutton.hpp similarity index 52% rename from include/eepp/ui/cuiradiobutton.hpp rename to include/eepp/ui/uiradiobutton.hpp index 7f22e0a86..1f707f377 100644 --- a/include/eepp/ui/cuiradiobutton.hpp +++ b/include/eepp/ui/uiradiobutton.hpp @@ -1,22 +1,22 @@ #ifndef EE_UICUIRADIOBUTTON_H #define EE_UICUIRADIOBUTTON_H -#include -#include +#include +#include namespace EE { namespace UI { -class EE_API cUIRadioButton : public cUITextBox { +class EE_API UIRadioButton : public UITextBox { public: - cUIRadioButton( const cUITextBox::CreateParams& Params ); + UIRadioButton( const UITextBox::CreateParams& Params ); - virtual ~cUIRadioButton(); + virtual ~UIRadioButton(); virtual Uint32 Type() const; virtual bool IsType( const Uint32& type ) const; - virtual void SetTheme( cUITheme * Theme ); + virtual void SetTheme( UITheme * Theme ); const bool& IsActive() const; @@ -26,12 +26,12 @@ class EE_API cUIRadioButton : public cUITextBox { virtual void Padding( const Recti& padding ); - cUIControlAnim * ActiveButton() const; + UIControlAnim * ActiveButton() const; - cUIControlAnim * InactiveButton() const; + UIControlAnim * InactiveButton() const; protected: - cUIControlAnim * mActiveButton; - cUIControlAnim * mInactiveButton; + UIControlAnim * mActiveButton; + UIControlAnim * mInactiveButton; bool mActive; Uint32 mLastTick; @@ -45,9 +45,9 @@ class EE_API cUIRadioButton : public cUITextBox { virtual void OnAlphaChange(); - virtual Uint32 OnKeyDown( const cUIEventKey& Event ); + virtual Uint32 OnKeyDown( const UIEventKey& Event ); - virtual Uint32 OnMessage( const cUIMessage * Msg ); + virtual Uint32 OnMessage( const UIMessage * Msg ); virtual void AutoSize(); }; diff --git a/include/eepp/ui/cuiscrollbar.hpp b/include/eepp/ui/uiscrollbar.hpp similarity index 57% rename from include/eepp/ui/cuiscrollbar.hpp rename to include/eepp/ui/uiscrollbar.hpp index fc4d86347..6e0985791 100644 --- a/include/eepp/ui/cuiscrollbar.hpp +++ b/include/eepp/ui/uiscrollbar.hpp @@ -1,17 +1,17 @@ #ifndef EE_UICUISCROLLBAR_HPP #define EE_UICUISCROLLBAR_HPP -#include -#include +#include +#include namespace EE { namespace UI { -class EE_API cUIScrollBar : public cUIComplexControl { +class EE_API UIScrollBar : public UIComplexControl { public: - class CreateParams : public cUIComplexControl::CreateParams { + class CreateParams : public UIComplexControl::CreateParams { public: inline CreateParams() : - cUIComplexControl::CreateParams(), + UIComplexControl::CreateParams(), VerticalScrollBar( false ) { } @@ -21,9 +21,9 @@ class EE_API cUIScrollBar : public cUIComplexControl { bool VerticalScrollBar; }; - cUIScrollBar( const cUIScrollBar::CreateParams& Params ); + UIScrollBar( const UIScrollBar::CreateParams& Params ); - virtual ~cUIScrollBar(); + virtual ~UIScrollBar(); virtual Uint32 Type() const; @@ -45,31 +45,31 @@ class EE_API cUIScrollBar : public cUIComplexControl { const Float& ClickStep() const; - virtual void SetTheme( cUITheme * Theme ); + virtual void SetTheme( UITheme * Theme ); const bool& IsVertical() const; virtual void Update(); - cUISlider * Slider() const; + UISlider * Slider() const; - cUIControlAnim * ButtonUp() const; + UIControlAnim * ButtonUp() const; - cUIControlAnim * ButtonDown() const; + UIControlAnim * ButtonDown() const; protected: - cUISlider * mSlider; - cUIControlAnim * mBtnUp; - cUIControlAnim * mBtnDown; + UISlider * mSlider; + UIControlAnim * mBtnUp; + UIControlAnim * mBtnDown; virtual void OnSizeChange(); void AdjustChilds(); - void OnValueChangeCb( const cUIEvent * Event ); + void OnValueChangeCb( const UIEvent * Event ); virtual void OnAlphaChange(); - virtual Uint32 OnMessage( const cUIMessage * Msg ); + virtual Uint32 OnMessage( const UIMessage * Msg ); void ManageClick( const Uint32& Flags ); }; diff --git a/include/eepp/ui/cuiselectbutton.hpp b/include/eepp/ui/uiselectbutton.hpp similarity index 64% rename from include/eepp/ui/cuiselectbutton.hpp rename to include/eepp/ui/uiselectbutton.hpp index 198985109..764865df3 100644 --- a/include/eepp/ui/cuiselectbutton.hpp +++ b/include/eepp/ui/uiselectbutton.hpp @@ -1,15 +1,15 @@ #ifndef EE_UICUISELECTBUTTON_HPP #define EE_UICUISELECTBUTTON_HPP -#include +#include namespace EE { namespace UI { -class EE_API cUISelectButton : public cUIPushButton { +class EE_API UISelectButton : public UIPushButton { public: - cUISelectButton( const cUIPushButton::CreateParams& Params ); + UISelectButton( const UIPushButton::CreateParams& Params ); - virtual ~cUISelectButton(); + virtual ~UISelectButton(); virtual Uint32 Type() const; diff --git a/include/eepp/ui/uiseparator.hpp b/include/eepp/ui/uiseparator.hpp new file mode 100644 index 000000000..ce5aaad67 --- /dev/null +++ b/include/eepp/ui/uiseparator.hpp @@ -0,0 +1,25 @@ +#ifndef EE_UICUISEPARATOR +#define EE_UICUISEPARATOR + +#include + +namespace EE { namespace UI { + +class EE_API UISeparator : public UIControlAnim { + public: + UISeparator( UIControlAnim::CreateParams Params ); + + virtual ~UISeparator(); + + virtual Uint32 Type() const; + + virtual bool IsType( const Uint32& type ) const; + + virtual void SetTheme( UITheme * Theme ); + protected: +}; + +}} + +#endif + diff --git a/include/eepp/ui/cuiskin.hpp b/include/eepp/ui/uiskin.hpp similarity index 72% rename from include/eepp/ui/cuiskin.hpp rename to include/eepp/ui/uiskin.hpp index c968bc52c..024c98f46 100644 --- a/include/eepp/ui/cuiskin.hpp +++ b/include/eepp/ui/uiskin.hpp @@ -2,7 +2,7 @@ #define EE_UICUISKIN_HPP #include -#include +#include namespace EE { namespace Graphics { class SubTexture; @@ -10,21 +10,21 @@ class SubTexture; namespace EE { namespace UI { -class cUITheme; +class UITheme; -class EE_API cUISkin { +class EE_API UISkin { public: enum UISkinType { - UISkinSimple, - UISkinComplex, - UISkinTypeCount + SkinSimple, + SkinComplex, + SkinTypeCount }; static const char * GetSkinStateName( const Uint32& State ); - cUISkin( const std::string& Name, const Uint32& Type ); + UISkin( const std::string& Name, const Uint32& Type ); - virtual ~cUISkin(); + virtual ~UISkin(); virtual void Draw( const Float& X, const Float& Y, const Float& Width, const Float& Height, const Uint32& Alpha, const Uint32& State ) = 0; @@ -44,23 +44,23 @@ class EE_API cUISkin { const Uint32& Id() const; - cUITheme * Theme() const; + UITheme * Theme() const; - void Theme( cUITheme * theme ); + void Theme( UITheme * theme ); - virtual cUISkin * Copy() = 0; + virtual UISkin * Copy() = 0; const Uint32& GetType() const; protected: - friend class cUIControl; - friend class cUISkinState; + friend class UIControl; + friend class UISkinState; Uint32 mType; std::string mName; Uint32 mNameHash; Uint32 mColorDefault; - ColorA mColor[ cUISkinState::StateCount ]; - cUITheme * mTheme; + ColorA mColor[ UISkinState::StateCount ]; + UITheme * mTheme; void StateBack( const Uint32& State ); diff --git a/include/eepp/ui/cuiskincomplex.hpp b/include/eepp/ui/uiskincomplex.hpp similarity index 69% rename from include/eepp/ui/cuiskincomplex.hpp rename to include/eepp/ui/uiskincomplex.hpp index 753da1b36..6a7caf2e2 100644 --- a/include/eepp/ui/cuiskincomplex.hpp +++ b/include/eepp/ui/uiskincomplex.hpp @@ -2,11 +2,11 @@ #define EE_UICUISKINCOMPLEX_HPP #include -#include +#include namespace EE { namespace UI { -class EE_API cUISkinComplex : public cUISkin { +class EE_API UISkinComplex : public UISkin { public: static std::string GetSideSuffix( const Uint32& Side ); @@ -23,9 +23,9 @@ class EE_API cUISkinComplex : public cUISkin { SideCount }; - cUISkinComplex( const std::string& Name ); + UISkinComplex( const std::string& Name ); - virtual ~cUISkinComplex(); + virtual ~UISkinComplex(); virtual void Draw( const Float& X, const Float& Y, const Float& Width, const Float& Height, const Uint32& Alpha, const Uint32& State ); @@ -35,11 +35,11 @@ class EE_API cUISkinComplex : public cUISkin { SubTexture * GetSubTextureSide( const Uint32& State, const Uint32& Side ); - cUISkinComplex * Copy( const std::string& NewName, const bool& CopyColorsState = true ); + UISkinComplex * Copy( const std::string& NewName, const bool& CopyColorsState = true ); - virtual cUISkin * Copy(); + virtual UISkin * Copy(); protected: - SubTexture * mSubTexture[ cUISkinState::StateCount ][ SideCount ]; + SubTexture * mSubTexture[ UISkinState::StateCount ][ SideCount ]; ColorA mTempColor; void StateNormalToState( const Uint32& State ); diff --git a/include/eepp/ui/cuiskinsimple.hpp b/include/eepp/ui/uiskinsimple.hpp similarity index 59% rename from include/eepp/ui/cuiskinsimple.hpp rename to include/eepp/ui/uiskinsimple.hpp index 9254c645a..bf8362336 100644 --- a/include/eepp/ui/cuiskinsimple.hpp +++ b/include/eepp/ui/uiskinsimple.hpp @@ -2,15 +2,15 @@ #define EE_UICUISKINSIMPLE_HPP #include -#include +#include namespace EE { namespace UI { -class EE_API cUISkinSimple : public cUISkin { +class EE_API UISkinSimple : public UISkin { public: - cUISkinSimple( const std::string& Name ); + UISkinSimple( const std::string& Name ); - virtual ~cUISkinSimple(); + virtual ~UISkinSimple(); virtual void Draw( const Float& X, const Float& Y, const Float& Width, const Float& Height, const Uint32& Alpha, const Uint32& State ); @@ -18,11 +18,11 @@ class EE_API cUISkinSimple : public cUISkin { SubTexture * GetSubTexture( const Uint32& State ) const; - cUISkinSimple * Copy( const std::string& NewName, const bool& CopyColorsState = true ); + UISkinSimple * Copy( const std::string& NewName, const bool& CopyColorsState = true ); - virtual cUISkin * Copy(); + virtual UISkin * Copy(); protected: - SubTexture * mSubTexture[ cUISkinState::StateCount ]; + SubTexture * mSubTexture[ UISkinState::StateCount ]; ColorA mTempColor; void StateNormalToState( const Uint32& State ); diff --git a/include/eepp/ui/cuiskinstate.hpp b/include/eepp/ui/uiskinstate.hpp similarity index 82% rename from include/eepp/ui/cuiskinstate.hpp rename to include/eepp/ui/uiskinstate.hpp index a0487677b..e5ed1634c 100644 --- a/include/eepp/ui/cuiskinstate.hpp +++ b/include/eepp/ui/uiskinstate.hpp @@ -5,9 +5,9 @@ namespace EE { namespace UI { -class cUISkin; +class UISkin; -class EE_API cUISkinState { +class EE_API UISkinState { public: enum UISkinStates { StateNormal = 0, @@ -19,15 +19,15 @@ class EE_API cUISkinState { StateCount }; - cUISkinState( cUISkin * Skin ); + UISkinState( UISkin * Skin ); - ~cUISkinState(); + ~UISkinState(); const Uint32& GetState() const; void SetState( const Uint32& State ); - cUISkin * GetSkin() const; + UISkin * GetSkin() const; void Draw( const Float& X, const Float& Y, const Float& Width, const Float& Height, const Uint32& Alpha ); @@ -35,9 +35,9 @@ class EE_API cUISkinState { const Uint32& GetPrevState() const; protected: - friend class cUIControl; + friend class UIControl; - cUISkin * mSkin; + UISkin * mSkin; Uint32 mCurState; Uint32 mLastState; diff --git a/include/eepp/ui/cuislider.hpp b/include/eepp/ui/uislider.hpp similarity index 66% rename from include/eepp/ui/cuislider.hpp rename to include/eepp/ui/uislider.hpp index 190f2aaba..adf9f1ee9 100644 --- a/include/eepp/ui/cuislider.hpp +++ b/include/eepp/ui/uislider.hpp @@ -1,17 +1,17 @@ -#ifndef EE_UIcUISlider_HPP -#define EE_UIcUISlider_HPP +#ifndef EE_UIUISlider_HPP +#define EE_UIUISlider_HPP -#include -#include +#include +#include namespace EE { namespace UI { -class EE_API cUISlider : public cUIComplexControl { +class EE_API UISlider : public UIComplexControl { public: - class CreateParams : public cUIComplexControl::CreateParams { + class CreateParams : public UIComplexControl::CreateParams { public: inline CreateParams() : - cUIComplexControl::CreateParams(), + UIComplexControl::CreateParams(), VerticalSlider( false ), AllowHalfSliderOut( true ), ExpandBackground( false ) @@ -25,15 +25,15 @@ class EE_API cUISlider : public cUIComplexControl { bool ExpandBackground; }; - cUISlider( const cUISlider::CreateParams& Params ); + UISlider( const UISlider::CreateParams& Params ); - virtual ~cUISlider(); + virtual ~UISlider(); virtual Uint32 Type() const; virtual bool IsType( const Uint32& type ) const; - virtual void SetTheme( cUITheme * Theme ); + virtual void SetTheme( UITheme * Theme ); virtual void Value( Float Val ); @@ -55,9 +55,9 @@ class EE_API cUISlider : public cUIComplexControl { virtual void Update(); - cUIControl * GetBackSlider() const; + UIControl * GetBackSlider() const; - cUIDragable * GetSliderButton() const; + UIDragable * GetSliderButton() const; void AdjustChilds(); @@ -67,13 +67,13 @@ class EE_API cUISlider : public cUIComplexControl { void ManageClick( const Uint32& Flags ); protected: - friend class Private::cUISliderButton; + friend class Private::UISliderButton; bool mVertical; bool mAllowHalfSliderOut; bool mExpandBackground; - cUIControlAnim * mBackSlider; - cUIControlAnim * mSlider; + UIControlAnim * mBackSlider; + UIControlAnim * mSlider; Float mMinValue; Float mMaxValue; Float mValue; @@ -87,7 +87,7 @@ class EE_API cUISlider : public cUIComplexControl { void FixSliderPos(); - virtual Uint32 OnKeyDown( const cUIEventKey &Event ); + virtual Uint32 OnKeyDown( const UIEventKey &Event ); virtual void OnAlphaChange(); }; diff --git a/include/eepp/ui/uisliderbutton.hpp b/include/eepp/ui/uisliderbutton.hpp new file mode 100644 index 000000000..18d5ba83d --- /dev/null +++ b/include/eepp/ui/uisliderbutton.hpp @@ -0,0 +1,19 @@ +#ifndef EE_UICUISLIDERBUTTON_HPP +#define EE_UICUISLIDERBUTTON_HPP + +#include + +namespace EE { namespace UI { namespace Private { + +class EE_API UISliderButton : public UIControlAnim { + public: + UISliderButton( const UIControlAnim::CreateParams& Params ); + + virtual ~UISliderButton(); + protected: + virtual void OnPosChange(); +}; + +}}} + +#endif diff --git a/include/eepp/ui/cuispinbox.hpp b/include/eepp/ui/uispinbox.hpp similarity index 64% rename from include/eepp/ui/cuispinbox.hpp rename to include/eepp/ui/uispinbox.hpp index 8d7e10b96..d1bd4d5dc 100644 --- a/include/eepp/ui/cuispinbox.hpp +++ b/include/eepp/ui/uispinbox.hpp @@ -1,17 +1,17 @@ #ifndef EE_UICUISPINBOX_HPP #define EE_UICUISPINBOX_HPP -#include -#include +#include +#include namespace EE { namespace UI { -class EE_API cUISpinBox : public cUIComplexControl { +class EE_API UISpinBox : public UIComplexControl { public: - class CreateParams : public cUITextInput::CreateParams { + class CreateParams : public UITextInput::CreateParams { public: inline CreateParams() : - cUITextInput::CreateParams(), + UITextInput::CreateParams(), DefaultValue( 0.f ), AllowDotsInNumbers( false ) { @@ -24,15 +24,15 @@ class EE_API cUISpinBox : public cUIComplexControl { bool AllowDotsInNumbers; }; - cUISpinBox( const cUISpinBox::CreateParams& Params ); + UISpinBox( const UISpinBox::CreateParams& Params ); - virtual ~cUISpinBox(); + virtual ~UISpinBox(); virtual Uint32 Type() const; virtual bool IsType( const Uint32& type ) const; - virtual void SetTheme( cUITheme * Theme ); + virtual void SetTheme( UITheme * Theme ); virtual void Padding( const Recti& padding ); @@ -42,7 +42,7 @@ class EE_API cUISpinBox : public cUIComplexControl { const Float& ClickStep() const; - virtual Uint32 OnMessage( const cUIMessage * Msg ); + virtual Uint32 OnMessage( const UIMessage * Msg ); void AddValue( const Float& value ); @@ -60,15 +60,15 @@ class EE_API cUISpinBox : public cUIComplexControl { virtual void Update(); - cUIControlAnim * ButtonPushUp() const; + UIControlAnim * ButtonPushUp() const; - cUIControlAnim * ButtonPushDown() const; + UIControlAnim * ButtonPushDown() const; - cUITextInput * TextInput() const; + UITextInput * TextInput() const; protected: - cUITextInput * mInput; - cUIControlAnim * mPushUp; - cUIControlAnim * mPushDown; + UITextInput * mInput; + UIControlAnim * mPushUp; + UIControlAnim * mPushDown; Float mMinValue; Float mMaxValue; Float mValue; diff --git a/include/eepp/ui/cuisprite.hpp b/include/eepp/ui/uisprite.hpp similarity index 80% rename from include/eepp/ui/cuisprite.hpp rename to include/eepp/ui/uisprite.hpp index 46d1c363d..3ba867a76 100644 --- a/include/eepp/ui/cuisprite.hpp +++ b/include/eepp/ui/uisprite.hpp @@ -1,7 +1,7 @@ #ifndef EE_UICUISPRITE_HPP #define EE_UICUISPRITE_HPP -#include +#include namespace EE { namespace Graphics { class Sprite; @@ -9,12 +9,12 @@ class Sprite; namespace EE { namespace UI { -class EE_API cUISprite : public cUIComplexControl { +class EE_API UISprite : public UIComplexControl { public: - class CreateParams : public cUIComplexControl::CreateParams { + class CreateParams : public UIComplexControl::CreateParams { public: inline CreateParams() : - cUIComplexControl::CreateParams(), + UIComplexControl::CreateParams(), Sprite( NULL ), SpriteRender( RN_NORMAL ), DealloSprite( true ) @@ -28,9 +28,9 @@ class EE_API cUISprite : public cUIComplexControl { bool DealloSprite; }; - cUISprite( const cUISprite::CreateParams& Params ); + UISprite( const UISprite::CreateParams& Params ); - virtual ~cUISprite(); + virtual ~UISprite(); virtual Uint32 Type() const; diff --git a/include/eepp/ui/cuitab.hpp b/include/eepp/ui/uitab.hpp similarity index 56% rename from include/eepp/ui/cuitab.hpp rename to include/eepp/ui/uitab.hpp index f72a518a6..e7bdf84f3 100644 --- a/include/eepp/ui/cuitab.hpp +++ b/include/eepp/ui/uitab.hpp @@ -1,25 +1,25 @@ #ifndef EE_UICUITAB_HPP #define EE_UICUITAB_HPP -#include +#include namespace EE { namespace UI { -class cUITabWidget; +class UITabWidget; -class EE_API cUITab : public cUISelectButton { +class EE_API UITab : public UISelectButton { public: - cUITab( cUISelectButton::CreateParams& Params, cUIControl * CtrlOwned ); + UITab( UISelectButton::CreateParams& Params, UIControl * CtrlOwned ); - cUIControl * CtrlOwned() const; + UIControl * CtrlOwned() const; - virtual ~cUITab(); + virtual ~UITab(); virtual Uint32 Type() const; virtual bool IsType( const Uint32& type ) const; - virtual void SetTheme( cUITheme * Theme ); + virtual void SetTheme( UITheme * Theme ); virtual const String& Text(); @@ -27,7 +27,7 @@ class EE_API cUITab : public cUISelectButton { virtual void Update(); protected: - cUIControl * mCtrlOwned; + UIControl * mCtrlOwned; virtual Uint32 OnMouseClick( const Vector2i &Pos, const Uint32 Flags ); @@ -35,7 +35,7 @@ class EE_API cUITab : public cUISelectButton { void SetRealSize(); - cUITabWidget * GetTabWidget(); + UITabWidget * GetTabWidget(); }; }} diff --git a/include/eepp/ui/cuitabwidget.hpp b/include/eepp/ui/uitabwidget.hpp similarity index 66% rename from include/eepp/ui/cuitabwidget.hpp rename to include/eepp/ui/uitabwidget.hpp index a4c02a6b8..5ac51a155 100644 --- a/include/eepp/ui/cuitabwidget.hpp +++ b/include/eepp/ui/uitabwidget.hpp @@ -1,18 +1,18 @@ #ifndef EE_UICUITABWIDGET_HPP #define EE_UICUITABWIDGET_HPP -#include -#include +#include +#include #include namespace EE { namespace UI { -class EE_API cUITabWidget : public cUIComplexControl { +class EE_API UITabWidget : public UIComplexControl { public: - class CreateParams : public cUIComplexControl::CreateParams { + class CreateParams : public UIComplexControl::CreateParams { public: inline CreateParams() : - cUIComplexControl::CreateParams(), + UIComplexControl::CreateParams(), Font( NULL ), FontColor( 0, 0, 0, 255 ), FontOverColor( 0, 0, 0, 255 ), @@ -30,7 +30,7 @@ class EE_API cUITabWidget : public cUIComplexControl { { Flags = ( UI_VALIGN_BOTTOM | UI_HALIGN_LEFT | UI_ANCHOR_LEFT | UI_ANCHOR_TOP ); - cUITheme * Theme = cUIThemeManager::instance()->DefaultTheme(); + UITheme * Theme = UIThemeManager::instance()->DefaultTheme(); if ( NULL != Theme ) { Font = Theme->Font(); @@ -41,7 +41,7 @@ class EE_API cUITabWidget : public cUIComplexControl { } if ( NULL == Font ) - Font = cUIThemeManager::instance()->DefaultFont(); + Font = UIThemeManager::instance()->DefaultFont(); } inline ~CreateParams() {} @@ -65,52 +65,52 @@ class EE_API cUITabWidget : public cUIComplexControl { }; - cUITabWidget( cUITabWidget::CreateParams& Params ); + UITabWidget( UITabWidget::CreateParams& Params ); - virtual ~cUITabWidget(); + virtual ~UITabWidget(); virtual Uint32 Type() const; virtual bool IsType( const Uint32& type ) const; - Uint32 Add( const String& Text, cUIControl * CtrlOwned, SubTexture * Icon = NULL ); + Uint32 Add( const String& Text, UIControl * CtrlOwned, SubTexture * Icon = NULL ); - Uint32 Add( cUITab * Tab ); + Uint32 Add( UITab * Tab ); - cUITab * GetTab( const Uint32& Index ); + UITab * GetTab( const Uint32& Index ); - cUITab * GetTab( const String& Text ); + UITab * GetTab( const String& Text ); - Uint32 GetTabIndex( cUITab * Tab ); + Uint32 GetTabIndex( UITab * Tab ); Uint32 Count() const; void Remove( const Uint32& Index ); - void Remove( cUITab * Tab ); + void Remove( UITab * Tab ); void RemoveAll(); - void Insert( const String& Text, cUIControl * CtrlOwned, SubTexture * Icon, const Uint32& Index ); + void Insert( const String& Text, UIControl * CtrlOwned, SubTexture * Icon, const Uint32& Index ); - void Insert( cUITab * Tab, const Uint32& Index ); + void Insert( UITab * Tab, const Uint32& Index ); - virtual void SetTheme( cUITheme * Theme ); + virtual void SetTheme( UITheme * Theme ); - cUITab * GetSelectedTab() const; + UITab * GetSelectedTab() const; Uint32 GetSelectedTabIndex() const; - cUIComplexControl * TabContainer() const; + UIComplexControl * TabContainer() const; - cUIComplexControl * ControlContainer() const; + UIComplexControl * ControlContainer() const; virtual void Draw(); protected: - friend class cUITab; + friend class UITab; - cUIComplexControl * mCtrlContainer; - cUIComplexControl * mTabContainer; + UIComplexControl * mCtrlContainer; + UIComplexControl * mTabContainer; Font * mFont; ColorA mFontColor; ColorA mFontShadowColor; @@ -127,17 +127,17 @@ class EE_API cUITabWidget : public cUIComplexControl { ColorA mLineBelowTabsColor; Int32 mLineBewowTabsYOffset; - std::deque mTabs; - cUITab * mTabSelected; + std::deque mTabs; + UITab * mTabSelected; Uint32 mTabSelectedIndex; void DoAfterSetTheme(); - cUITab * CreateTab( const String& Text, cUIControl * CtrlOwned, SubTexture * Icon ); + UITab * CreateTab( const String& Text, UIControl * CtrlOwned, SubTexture * Icon ); virtual void OnSizeChange(); - void SetTabSelected( cUITab * Tab ); + void SetTabSelected( UITab * Tab ); void SetTabContainerSize(); diff --git a/include/eepp/ui/cuitextbox.hpp b/include/eepp/ui/uitextbox.hpp similarity index 84% rename from include/eepp/ui/cuitextbox.hpp rename to include/eepp/ui/uitextbox.hpp index eef77a347..58ada58ef 100644 --- a/include/eepp/ui/cuitextbox.hpp +++ b/include/eepp/ui/uitextbox.hpp @@ -1,22 +1,22 @@ #ifndef EE_UICUITEXTBOX_H #define EE_UICUITEXTBOX_H -#include +#include namespace EE { namespace UI { -class EE_API cUITextBox : public cUIComplexControl { +class EE_API UITextBox : public UIComplexControl { public: - class CreateParams : public cUIComplexControl::CreateParams { + class CreateParams : public UIComplexControl::CreateParams { public: inline CreateParams() : - cUIComplexControl::CreateParams(), + UIComplexControl::CreateParams(), Font( NULL ), FontColor( 0, 0, 0, 255 ), FontShadowColor( 255, 255, 255, 150 ), FontSelectionBackColor( 150, 150, 150, 150 ) { - cUITheme * Theme = cUIThemeManager::instance()->DefaultTheme(); + UITheme * Theme = UIThemeManager::instance()->DefaultTheme(); if ( NULL != Theme ) { Font = Theme->Font(); @@ -25,7 +25,7 @@ class EE_API cUITextBox : public cUIComplexControl { } if ( NULL == Font ) - Font = cUIThemeManager::instance()->DefaultFont(); + Font = UIThemeManager::instance()->DefaultFont(); } inline ~CreateParams() {} @@ -36,9 +36,9 @@ class EE_API cUITextBox : public cUIComplexControl { ColorA FontSelectionBackColor; }; - cUITextBox( const cUITextBox::CreateParams& Params ); + UITextBox( const UITextBox::CreateParams& Params ); - virtual ~cUITextBox(); + virtual ~UITextBox(); virtual Uint32 Type() const; @@ -76,7 +76,7 @@ class EE_API cUITextBox : public cUIComplexControl { const Recti& Padding() const; - virtual void SetTheme( cUITheme * Theme ); + virtual void SetTheme( UITheme * Theme ); TextCache * GetTextCache(); diff --git a/include/eepp/ui/cuitextedit.hpp b/include/eepp/ui/uitextedit.hpp similarity index 56% rename from include/eepp/ui/cuitextedit.hpp rename to include/eepp/ui/uitextedit.hpp index fd0d220eb..1cac46811 100644 --- a/include/eepp/ui/cuitextedit.hpp +++ b/include/eepp/ui/uitextedit.hpp @@ -1,17 +1,17 @@ #ifndef EE_UICUITEXTEDIT_HPP #define EE_UICUITEXTEDIT_HPP -#include -#include -#include +#include +#include +#include namespace EE { namespace UI { -class EE_API cUITextEdit : public cUIComplexControl { +class EE_API UITextEdit : public UIComplexControl { public: - class CreateParams : public cUITextBox::CreateParams { + class CreateParams : public UITextBox::CreateParams { public: - inline CreateParams() : cUITextBox::CreateParams(), + inline CreateParams() : UITextBox::CreateParams(), HScrollBar( UI_SCROLLBAR_AUTO ), VScrollBar( UI_SCROLLBAR_AUTO ), WordWrap( true ) @@ -25,25 +25,25 @@ class EE_API cUITextEdit : public cUIComplexControl { bool WordWrap; }; - cUITextEdit( cUITextEdit::CreateParams& Params ); + UITextEdit( UITextEdit::CreateParams& Params ); - virtual ~cUITextEdit(); + virtual ~UITextEdit(); virtual Uint32 Type() const; virtual bool IsType( const Uint32& type ) const; - virtual void SetTheme( cUITheme * Theme ); + virtual void SetTheme( UITheme * Theme ); const String& Text() const; void Text( const String& Txt ); - cUITextInput * TextInput() const; + UITextInput * TextInput() const; - cUIScrollBar * HScrollBar() const; + UIScrollBar * HScrollBar() const; - cUIScrollBar * VScrollBar() const; + UIScrollBar * VScrollBar() const; virtual void Update(); @@ -51,9 +51,9 @@ class EE_API cUITextEdit : public cUIComplexControl { const bool& AllowEditing() const; protected: - cUITextInput * mTextInput; - cUIScrollBar * mHScrollBar; - cUIScrollBar * mVScrollBar; + UITextInput * mTextInput; + UIScrollBar * mHScrollBar; + UIScrollBar * mVScrollBar; UI_SCROLLBAR_MODE mHScrollBarMode; UI_SCROLLBAR_MODE mVScrollBarMode; Recti mPadding; @@ -66,13 +66,13 @@ class EE_API cUITextEdit : public cUIComplexControl { virtual void OnParentSizeChange( const Vector2i& SizeChange ); - void OnVScrollValueChange( const cUIEvent * Event ); + void OnVScrollValueChange( const UIEvent * Event ); - void OnHScrollValueChange( const cUIEvent * Event ); + void OnHScrollValueChange( const UIEvent * Event ); - void OnInputSizeChange( const cUIEvent * Event = NULL ); + void OnInputSizeChange( const UIEvent * Event = NULL ); - void OnCursorPosChange( const cUIEvent * Event ); + void OnCursorPosChange( const UIEvent * Event ); void AutoPadding(); diff --git a/include/eepp/ui/cuitextinput.hpp b/include/eepp/ui/uitextinput.hpp similarity index 83% rename from include/eepp/ui/cuitextinput.hpp rename to include/eepp/ui/uitextinput.hpp index e6888525d..f5785a79d 100644 --- a/include/eepp/ui/cuitextinput.hpp +++ b/include/eepp/ui/uitextinput.hpp @@ -1,18 +1,18 @@ #ifndef EE_UICUITEXTINPUT_H #define EE_UICUITEXTINPUT_H -#include -#include +#include +#include #include namespace EE { namespace UI { -class EE_API cUITextInput : public cUITextBox { +class EE_API UITextInput : public UITextBox { public: - class CreateParams : public cUITextBox::CreateParams { + class CreateParams : public UITextBox::CreateParams { public: inline CreateParams() : - cUITextBox::CreateParams(), + UITextBox::CreateParams(), SupportFreeEditing( true ), MaxLength( 256 ), PassInput( false ) @@ -26,9 +26,9 @@ class EE_API cUITextInput : public cUITextBox { bool PassInput; }; - cUITextInput( const cUITextInput::CreateParams& Params ); + UITextInput( const UITextInput::CreateParams& Params ); - virtual ~cUITextInput(); + virtual ~UITextInput(); virtual Uint32 Type() const; @@ -40,7 +40,7 @@ class EE_API cUITextInput : public cUITextBox { void PushIgnoredChar( const Uint32& ch ); - virtual void SetTheme( cUITheme * Theme ); + virtual void SetTheme( UITheme * Theme ); InputTextBuffer * GetInputTextBuffer(); diff --git a/include/eepp/ui/cuitextinputpassword.hpp b/include/eepp/ui/uitextinputpassword.hpp similarity index 73% rename from include/eepp/ui/cuitextinputpassword.hpp rename to include/eepp/ui/uitextinputpassword.hpp index 21d3c1bfd..76ccc379b 100644 --- a/include/eepp/ui/cuitextinputpassword.hpp +++ b/include/eepp/ui/uitextinputpassword.hpp @@ -1,14 +1,14 @@ #ifndef EE_UICUITEXTINPUTPASSWORD_HPP #define EE_UICUITEXTINPUTPASSWORD_HPP -#include +#include namespace EE { namespace UI { -class cUITextInputPassword : public cUITextInput +class UITextInputPassword : public UITextInput { public: - cUITextInputPassword( const cUITextInput::CreateParams& Params ); + UITextInputPassword( const UITextInput::CreateParams& Params ); virtual void Draw(); diff --git a/include/eepp/ui/uitheme.hpp b/include/eepp/ui/uitheme.hpp new file mode 100644 index 000000000..f111a503c --- /dev/null +++ b/include/eepp/ui/uitheme.hpp @@ -0,0 +1,177 @@ +#ifndef EE_UICUITHEME_HPP +#define EE_UICUITHEME_HPP + +#include +#include +#include +#include + +namespace EE { namespace Graphics { +class Sprite; +class TextureAtlas; +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 UITextBox; +class UITextEdit; +class UITextInput; +class UITextInputPassword; +class UITooltip; +class UIWindow; +class UIWinMenu; +class UIGfx; +class UISprite; +class UIMenu; +class UICommonDialog; +class UIMessageBox; +class UITabWidget; + +class EE_API UITheme : protected ResourceManager { + public: + using ResourceManager::GetById; + using ResourceManager::GetByName; + using ResourceManager::Exists; + using ResourceManager::ExistsId; + + static UITheme * LoadFromTextureAtlas( UITheme * tTheme, Graphics::TextureAtlas * TextureAtlas ); + + static UITheme * LoadFromPath( UITheme * tTheme, const std::string& Path, const std::string ImgExt = "png" ); + + static UITheme * LoadFromTextureAtlas( Graphics::TextureAtlas * TextureAtlas, const std::string& Name, const std::string NameAbbr ); + + static UITheme * LoadFromPath( const std::string& Path, const std::string& Name, const std::string& NameAbbr, const std::string ImgExt = "png" ); + + void AddThemeElement( const std::string& Element ); + + void AddThemeIcon( const std::string& Icon ); + + UITheme( const std::string& Name, const std::string& Abbr, Graphics::Font * DefaultFont = NULL ); + + virtual ~UITheme(); + + const std::string& Name() const; + + void Name( const std::string& name ); + + const Uint32& Id() const; + + const std::string& Abbr() const; + + virtual UISkin * Add( UISkin * Resource ); + + void Font( Graphics::Font * Font ); + + Graphics::Font * Font() const; + + const ColorA& FontColor() const; + + const ColorA& FontShadowColor() const; + + const ColorA& FontOverColor() const; + + const ColorA& FontSelectedColor() const; + + void FontColor( const ColorA& Color ); + + void FontShadowColor( const ColorA& Color ); + + void FontOverColor( const ColorA& Color ); + + void FontSelectedColor( const ColorA& Color ); + + void UseDefaultThemeValues( const bool& Use ); + + const bool& UseDefaultThemeValues() const; + + Graphics::TextureAtlas * TextureAtlas() const; + + SubTexture * GetIconByName( const std::string& name ); + + virtual UIGfx * CreateGfx( SubTexture * SubTexture, UIControl * Parent = NULL, const Sizei& Size = Sizei(), const Vector2i& Pos = Vector2i(), const Uint32& Flags = UI_CONTROL_DEFAULT_FLAGS_CENTERED | UI_AUTO_SIZE, ColorA SubTextureColor = ColorA(255,255,255,255), EE_RENDER_MODE SubTextureRender = RN_NORMAL ); + + virtual UISprite * CreateSprite( Sprite * Sprite, UIControl * Parent = NULL, const Sizei& Size = Sizei(), const Vector2i& Pos = Vector2i(), const Uint32& Flags = UI_CONTROL_DEFAULT_FLAGS_CENTERED | UI_AUTO_SIZE, bool DealloSprite = true, EE_RENDER_MODE SpriteRender = RN_NORMAL ); + + virtual UICheckBox * CreateCheckBox( UIControl * Parent = NULL, const Sizei& Size = Sizei(), const Vector2i& Pos = Vector2i(), const Uint32& Flags = UI_CONTROL_DEFAULT_FLAGS ); + + virtual UIRadioButton * CreateRadioButton( UIControl * Parent = NULL, const Sizei& Size = Sizei(), const Vector2i& Pos = Vector2i(), const Uint32& Flags = UI_CONTROL_DEFAULT_FLAGS ); + + virtual UITextBox * CreateTextBox( const String& Text = "", UIControl * Parent = NULL, const Sizei& Size = Sizei(), const Vector2i& Pos = Vector2i(), const Uint32& Flags = UI_CONTROL_DEFAULT_FLAGS | UI_AUTO_SIZE ); + + virtual UITextEdit * CreateTextEdit( UIControl * Parent = NULL, const Sizei& Size = Sizei(), const Vector2i& Pos = Vector2i(), const Uint32& Flags = UI_CONTROL_DEFAULT_FLAGS | UI_AUTO_PADDING | UI_CLIP_ENABLE | UI_AUTO_SIZE | UI_TEXT_SELECTION_ENABLED, UI_SCROLLBAR_MODE HScrollBar = UI_SCROLLBAR_AUTO, UI_SCROLLBAR_MODE VScrollBar = UI_SCROLLBAR_AUTO, bool WordWrap = true ); + + virtual UITextInput * CreateTextInput( UIControl * Parent = NULL, const Sizei& Size = Sizei(), const Vector2i& Pos = Vector2i(), const Uint32& Flags = UI_CONTROL_DEFAULT_FLAGS | UI_CLIP_ENABLE | UI_AUTO_PADDING | UI_TEXT_SELECTION_ENABLED, bool SupportFreeEditing = true, Uint32 MaxLength = 256 ); + + virtual UITextInputPassword * CreateTextInputPassword( UIControl * Parent = NULL, const Sizei& Size = Sizei(), const Vector2i& Pos = Vector2i(), const Uint32& Flags = UI_CONTROL_DEFAULT_FLAGS | UI_CLIP_ENABLE | UI_AUTO_PADDING | UI_TEXT_SELECTION_ENABLED, bool SupportFreeEditing = true, Uint32 MaxLength = 256 ); + + virtual UITooltip * CreateTooltip( UIControl * TooltipOf, UIControl * Parent = NULL, const Sizei& Size = Sizei(), const Vector2i& Pos = Vector2i(), const Uint32& Flags = UI_CONTROL_DEFAULT_FLAGS_CENTERED | UI_AUTO_PADDING | UI_AUTO_SIZE ); + + virtual UIScrollBar * CreateScrollBar( UIControl * Parent = NULL, const Sizei& Size = Sizei(), const Vector2i& Pos = Vector2i(), const Uint32& Flags = UI_CONTROL_DEFAULT_FLAGS | UI_AUTO_SIZE, bool VerticalScrollBar = false ); + + virtual UISlider * CreateSlider( UIControl * Parent = NULL, const Sizei& Size = Sizei(), const Vector2i& Pos = Vector2i(), const Uint32& Flags = UI_CONTROL_DEFAULT_FLAGS, bool VerticalSlider = false, bool AllowHalfSliderOut = true, bool ExpandBackground = false ); + + virtual UISpinBox * CreateSpinBox( UIControl * Parent = NULL, const Sizei& Size = Sizei(), const Vector2i& Pos = Vector2i(), const Uint32& Flags = UI_CONTROL_DEFAULT_FLAGS | UI_CLIP_ENABLE | UI_AUTO_SIZE | UI_TEXT_SELECTION_ENABLED, Float DefaultValue = 0.f, bool AllowDotsInNumbers = true ); + + virtual UIComboBox * CreateComboBox( UIControl * Parent = NULL, const Sizei& Size = Sizei(), const Vector2i& Pos = Vector2i(), const Uint32& Flags = UI_CONTROL_DEFAULT_FLAGS | UI_CLIP_ENABLE | UI_AUTO_PADDING | UI_TEXT_SELECTION_ENABLED, Uint32 MinNumVisibleItems = 6, bool PopUpToMainControl = false, UIListBox * ListBox = NULL ); + + virtual UIDropDownList * CreateDropDownList( UIControl * Parent = NULL, const Sizei& Size = Sizei(), const Vector2i& Pos = Vector2i(), const Uint32& Flags = UI_CONTROL_DEFAULT_FLAGS | UI_CLIP_ENABLE | UI_AUTO_PADDING, Uint32 MinNumVisibleItems = 6, bool PopUpToMainControl = false, UIListBox * ListBox = NULL ); + + virtual UIListBox * CreateListBox( UIControl * Parent = NULL, const Sizei& Size = Sizei(), const Vector2i& Pos = Vector2i(), const Uint32& Flags = UI_CONTROL_DEFAULT_FLAGS | UI_CLIP_ENABLE | UI_AUTO_PADDING, bool SmoothScroll = true, Uint32 RowHeight = 0, UI_SCROLLBAR_MODE VScrollMode = UI_SCROLLBAR_AUTO, UI_SCROLLBAR_MODE HScrollMode = UI_SCROLLBAR_AUTO, Recti PaddingContainer = Recti() ); + + virtual UIMenu * CreateMenu( UIControl * Parent = NULL, const Sizei& Size = Sizei(), const Vector2i& Pos = Vector2i(), const Uint32& Flags = UI_CONTROL_DEFAULT_FLAGS | UI_AUTO_SIZE | UI_AUTO_PADDING, Uint32 RowHeight = 0, Recti PaddingContainer = Recti(), Uint32 MinWidth = 0, Uint32 MinSpaceForIcons = 0, Uint32 MinRightMargin = 0 ); + + virtual UIPopUpMenu * CreatePopUpMenu( UIControl * Parent = NULL, const Sizei& Size = Sizei(), const Vector2i& Pos = Vector2i(), const Uint32& Flags = UI_CONTROL_DEFAULT_FLAGS | UI_AUTO_SIZE | UI_AUTO_PADDING, Uint32 RowHeight = 0, Recti PaddingContainer = Recti(), Uint32 MinWidth = 0, Uint32 MinSpaceForIcons = 0, Uint32 MinRightMargin = 0 ); + + virtual UIProgressBar * CreateProgressBar( UIControl * Parent = NULL, const Sizei& Size = Sizei(), const Vector2i& Pos = Vector2i(), const Uint32& Flags = UI_CONTROL_DEFAULT_FLAGS, bool DisplayPercent = false, bool VerticalExpand = false, Vector2f MovementSpeed = Vector2f( 64, 0 ), Rectf FillerMargin = Rectf() ); + + virtual UIPushButton * CreatePushButton( UIControl * Parent = NULL, const Sizei& Size = Sizei(), const Vector2i& Pos = Vector2i(), const Uint32& Flags = UI_CONTROL_DEFAULT_FLAGS_CENTERED | UI_AUTO_SIZE, SubTexture * Icon = NULL, Int32 IconHorizontalMargin = 0, bool IconAutoMargin = true ); + + virtual UISelectButton * CreateSelectButton( UIControl * Parent = NULL, const Sizei& Size = Sizei(), const Vector2i& Pos = Vector2i(), const Uint32& Flags = UI_CONTROL_DEFAULT_FLAGS_CENTERED | UI_AUTO_SIZE, SubTexture * Icon = NULL, Int32 IconHorizontalMargin = 0, bool IconAutoMargin = true ); + + virtual UIWinMenu * CreateWinMenu( UIControl * Parent = NULL, const Sizei& Size = Sizei(), const Vector2i& Pos = Vector2i(), const Uint32& Flags = UI_CONTROL_DEFAULT_FLAGS, Uint32 MarginBetweenButtons = 0, Uint32 ButtonMargin = 4, Uint32 MenuHeight = 0, Uint32 FirstButtonMargin = 1 ); + + virtual UIWindow * CreateWindow( UIControl * Parent = NULL, const Sizei& Size = Sizei(), const Vector2i& Pos = Vector2i(), const Uint32& Flags = UI_CONTROL_DEFAULT_FLAGS_CENTERED, Uint32 WinFlags = UI_WIN_DEFAULT_FLAGS, Sizei MinWindowSize = Sizei(0,0), Uint8 BaseAlpha = 255 ); + + virtual UICommonDialog * CreateCommonDialog( UIControl * Parent = NULL, const Sizei& Size = Sizei(), const Vector2i& Pos = Vector2i(), const Uint32& Flags = UI_CONTROL_DEFAULT_FLAGS_CENTERED, Uint32 WinFlags = UI_WIN_DEFAULT_FLAGS | UI_WIN_MAXIMIZE_BUTTON, Sizei MinWindowSize = Sizei(0,0), Uint8 BaseAlpha = 255, Uint32 CDLFlags = UI_CDL_DEFAULT_FLAGS, std::string DefaultFilePattern = "*", std::string DefaultDirectory = Sys::GetProcessPath() ); + + virtual UIMessageBox * CreateMessageBox( UI_MSGBOX_TYPE Type = MSGBOX_OKCANCEL, const String& Message = String(), Uint32 WinFlags = UI_WIN_DEFAULT_FLAGS | UI_WIN_MODAL, UIControl * Parent = NULL, const Sizei& Size = Sizei(), const Vector2i& Pos = Vector2i(), const Uint32& Flags = UI_CONTROL_DEFAULT_FLAGS_CENTERED, Sizei MinWindowSize = Sizei(0,0), Uint8 BaseAlpha = 255 ); + + virtual UITabWidget * CreateTabWidget( UIControl * Parent = NULL, const Sizei& Size = Sizei(), const Vector2i& Pos = Vector2i(), const Uint32& Flags = UI_HALIGN_CENTER | UI_VALIGN_BOTTOM | UI_CONTROL_DEFAULT_ANCHOR, const bool& TabsClosable = false, const bool& SpecialBorderTabs = false , const Int32& TabSeparation = 0, const Uint32& MaxTextLength = 30, const Uint32& TabWidgetHeight = 0, const Uint32& TabTextAlign = UI_HALIGN_CENTER | UI_VALIGN_CENTER, const Uint32& MinTabWidth = 32, const Uint32& MaxTabWidth = 210 ); + protected: + std::string mName; + Uint32 mNameHash; + std::string mAbbr; + Graphics::TextureAtlas * mTextureAtlas; + Graphics::Font * mFont; + ColorA mFontColor; + ColorA mFontShadowColor; + ColorA mFontOverColor; + ColorA mFontSelectedColor; + bool mUseDefaultThemeValues; + std::list mUIElements; + std::list mUIIcons; + + void TextureAtlas( Graphics::TextureAtlas * SG ); + + static bool SearchFilesOfElement( Graphics::TextureAtlas * SG, const std::string& Path, std::string Element, Uint32& IsComplex, const std::string ImgExt ); + + static bool SearchFilesInAtlas( Graphics::TextureAtlas * SG, std::string Element, Uint32& IsComplex ); +}; + +}} + +#endif diff --git a/include/eepp/ui/cuithememanager.hpp b/include/eepp/ui/uithememanager.hpp similarity index 74% rename from include/eepp/ui/cuithememanager.hpp rename to include/eepp/ui/uithememanager.hpp index e33ccc656..5187a94eb 100644 --- a/include/eepp/ui/cuithememanager.hpp +++ b/include/eepp/ui/uithememanager.hpp @@ -2,17 +2,17 @@ #define EE_UICTHEMEMANAGER #include -#include +#include namespace EE { namespace UI { -class cUIControl; +class UIControl; -class EE_API cUIThemeManager : public ResourceManager { - SINGLETON_DECLARE_HEADERS(cUIThemeManager) +class EE_API UIThemeManager : public ResourceManager { + SINGLETON_DECLARE_HEADERS(UIThemeManager) public: - virtual ~cUIThemeManager(); + virtual ~UIThemeManager(); void DefaultFont( Font * Font ); @@ -20,15 +20,15 @@ class EE_API cUIThemeManager : public ResourceManager { void SetTheme( const std::string& Theme ); - void SetTheme( cUITheme * Theme ); + void SetTheme( UITheme * Theme ); - void DefaultTheme( cUITheme * Theme ); + void DefaultTheme( UITheme * Theme ); void DefaultTheme( const std::string& Theme ); - cUITheme * DefaultTheme() const; + UITheme * DefaultTheme() const; - void ApplyDefaultTheme( cUIControl * Control ); + void ApplyDefaultTheme( UIControl * Control ); void AutoApplyDefaultTheme( const bool& apply ); @@ -59,7 +59,7 @@ class EE_API cUIThemeManager : public ResourceManager { const Sizei& CursorSize() const; protected: Font * mFont; - cUITheme * mThemeDefault; + UITheme * mThemeDefault; bool mAutoApplyDefaultTheme; bool mEnableDefaultEffects; @@ -71,7 +71,7 @@ class EE_API cUIThemeManager : public ResourceManager { Sizei mCursorSize; - cUIThemeManager(); + UIThemeManager(); }; }} diff --git a/include/eepp/ui/cuitooltip.hpp b/include/eepp/ui/uitooltip.hpp similarity index 79% rename from include/eepp/ui/cuitooltip.hpp rename to include/eepp/ui/uitooltip.hpp index eb70539a7..96c817b15 100644 --- a/include/eepp/ui/cuitooltip.hpp +++ b/include/eepp/ui/uitooltip.hpp @@ -1,7 +1,7 @@ #ifndef EE_UICUITOOLTIP_HPP #define EE_UICUITOOLTIP_HPP -#include +#include namespace EE { namespace Graphics { class TextCache; @@ -9,17 +9,17 @@ class TextCache; namespace EE { namespace UI { -class EE_API cUITooltip : public cUIControlAnim { +class EE_API UITooltip : public UIControlAnim { public: - class CreateParams : public cUIControlAnim::CreateParams { + class CreateParams : public UIControlAnim::CreateParams { public: inline CreateParams() : - cUIControlAnim::CreateParams(), + UIControlAnim::CreateParams(), Font( NULL ), FontColor( 0, 0, 0, 255 ), FontShadowColor( 255, 255, 255, 150 ) { - cUITheme * Theme = cUIThemeManager::instance()->DefaultTheme(); + UITheme * Theme = UIThemeManager::instance()->DefaultTheme(); if ( NULL != Theme ) { Font = Theme->Font(); @@ -28,7 +28,7 @@ class EE_API cUITooltip : public cUIControlAnim { } if ( NULL == Font ) - Font = cUIThemeManager::instance()->DefaultFont(); + Font = UIThemeManager::instance()->DefaultFont(); } inline ~CreateParams() {} @@ -39,15 +39,15 @@ class EE_API cUITooltip : public cUIControlAnim { Recti Padding; }; - cUITooltip( cUITooltip::CreateParams& Params, cUIControl * TooltipOf ); + UITooltip( UITooltip::CreateParams& Params, UIControl * TooltipOf ); - virtual ~cUITooltip(); + virtual ~UITooltip(); virtual Uint32 Type() const; virtual bool IsType( const Uint32& type ) const; - virtual void SetTheme( cUITheme * Theme ); + virtual void SetTheme( UITheme * Theme ); void Show(); @@ -103,7 +103,7 @@ class EE_API cUITooltip : public cUIControlAnim { Vector2f mAlignOffset; Recti mPadding; Time mTooltipTime; - cUIControl * mTooltipOf; + UIControl * mTooltipOf; virtual void OnSizeChange(); diff --git a/include/eepp/ui/cuiwindow.hpp b/include/eepp/ui/uiwindow.hpp similarity index 66% rename from include/eepp/ui/cuiwindow.hpp rename to include/eepp/ui/uiwindow.hpp index 5361171bd..bda9947f8 100644 --- a/include/eepp/ui/cuiwindow.hpp +++ b/include/eepp/ui/uiwindow.hpp @@ -1,18 +1,18 @@ #ifndef EE_UICUIWINDOW_HPP #define EE_UICUIWINDOW_HPP -#include -#include -#include +#include +#include +#include namespace EE { namespace UI { -class EE_API cUIWindow : public cUIComplexControl { +class EE_API UIWindow : public UIComplexControl { public: - class CreateParams : public cUIComplexControl::CreateParams { + class CreateParams : public UIComplexControl::CreateParams { public: inline CreateParams() : - cUIComplexControl::CreateParams(), + UIComplexControl::CreateParams(), WinFlags( UI_WIN_DEFAULT_FLAGS ), ButtonsSeparation( 4 ), MinCornerDistance( 24 ), @@ -38,9 +38,9 @@ class EE_API cUIWindow : public cUIComplexControl { bool BorderAutoSize; }; - cUIWindow( const cUIWindow::CreateParams& Params ); + UIWindow( const UIWindow::CreateParams& Params ); - virtual ~cUIWindow(); + virtual ~UIWindow(); virtual Uint32 Type() const; @@ -52,17 +52,17 @@ class EE_API cUIWindow : public cUIComplexControl { const Sizei& Size(); - virtual void SetTheme( cUITheme * Theme ); + virtual void SetTheme( UITheme * Theme ); - virtual Uint32 OnMessage( const cUIMessage *Msg ); + virtual Uint32 OnMessage( const UIMessage *Msg ); - cUIControlAnim * Container() const; + UIControlAnim * Container() const; - cUIComplexControl * ButtonClose() const; + UIComplexControl * ButtonClose() const; - cUIComplexControl * ButtonMaximize() const; + UIComplexControl * ButtonMaximize() const; - cUIComplexControl * ButtonMinimize() const; + UIComplexControl * ButtonMinimize() const; virtual void Draw(); @@ -84,15 +84,15 @@ class EE_API cUIWindow : public cUIComplexControl { String Title() const; - cUITextBox * TitleTextBox() const; + UITextBox * TitleTextBox() const; - bool AddShortcut( const Uint32& KeyCode, const Uint32& Mod, cUIPushButton * Button ); + bool AddShortcut( const Uint32& KeyCode, const Uint32& Mod, UIPushButton * Button ); bool RemoveShortcut( const Uint32& KeyCode, const Uint32& Mod ); bool IsModal(); - cUIControlAnim * GetModalControl() const; + UIControlAnim * GetModalControl() const; void Maximize(); @@ -106,7 +106,7 @@ class EE_API cUIWindow : public cUIComplexControl { Button(NULL) {} - KeyboardShortcut( const Uint32& KeyCode, const Uint32& Mod, cUIPushButton * Button ) : + KeyboardShortcut( const Uint32& KeyCode, const Uint32& Mod, UIPushButton * Button ) : KeyCode( KeyCode ), Mod( Mod ), Button( Button ) @@ -114,7 +114,7 @@ class EE_API cUIWindow : public cUIComplexControl { Uint32 KeyCode; Uint32 Mod; - cUIPushButton * Button; + UIPushButton * Button; }; typedef std::list< KeyboardShortcut > KeyboardShortcuts; @@ -133,18 +133,18 @@ class EE_API cUIWindow : public cUIComplexControl { Uint32 mWinFlags; - cUIControlAnim * mWindowDecoration; - cUIControlAnim * mBorderLeft; - cUIControlAnim * mBorderRight; - cUIControlAnim * mBorderBottom; - cUIComplexControl * mContainer; + UIControlAnim * mWindowDecoration; + UIControlAnim * mBorderLeft; + UIControlAnim * mBorderRight; + UIControlAnim * mBorderBottom; + UIComplexControl * mContainer; - cUIComplexControl * mButtonClose; - cUIComplexControl * mButtonMinimize; - cUIComplexControl * mButtonMaximize; - cUITextBox * mTitle; + UIComplexControl * mButtonClose; + UIComplexControl * mButtonMinimize; + UIComplexControl * mButtonMaximize; + UITextBox * mTitle; - cUIControlAnim * mModalCtrl; + UIControlAnim * mModalCtrl; Sizei mDecoSize; Sizei mBorderSize; @@ -171,21 +171,21 @@ class EE_API cUIWindow : public cUIComplexControl { virtual void OnAlphaChange(); - virtual Uint32 OnKeyDown( const cUIEventKey &Event ); + virtual Uint32 OnKeyDown( const UIEventKey &Event ); - void ButtonCloseClick( const cUIEvent * Event ); + void ButtonCloseClick( const UIEvent * Event ); - void ButtonMaximizeClick( const cUIEvent * Event ); + void ButtonMaximizeClick( const UIEvent * Event ); - void ButtonMinimizeClick( const cUIEvent * Event ); + void ButtonMinimizeClick( const UIEvent * Event ); - void ContainerPosChange( const cUIEvent * Event ); + void ContainerPosChange( const UIEvent * Event ); void FixChildsSize(); - void DoResize ( const cUIMessage * Msg ); + void DoResize ( const UIMessage * Msg ); - void DecideResizeType( cUIControl * Control ); + void DecideResizeType( UIControl * Control ); void TryResize( const UI_RESIZE_TYPE& Type ); diff --git a/include/eepp/ui/cuiwinmenu.hpp b/include/eepp/ui/uiwinmenu.hpp similarity index 64% rename from include/eepp/ui/cuiwinmenu.hpp rename to include/eepp/ui/uiwinmenu.hpp index e5ee397f4..0ea723403 100644 --- a/include/eepp/ui/cuiwinmenu.hpp +++ b/include/eepp/ui/uiwinmenu.hpp @@ -2,18 +2,18 @@ #define EE_UICUIWINMENU_HPP #include -#include -#include -#include +#include +#include +#include namespace EE { namespace UI { -class EE_API cUIWinMenu : public cUIComplexControl { +class EE_API UIWinMenu : public UIComplexControl { public: - class CreateParams : public cUIComplexControl::CreateParams { + class CreateParams : public UIComplexControl::CreateParams { public: inline CreateParams() : - cUIComplexControl::CreateParams(), + UIComplexControl::CreateParams(), Font( NULL ), FontColor( 0, 0, 0, 255 ), FontShadowColor( 0, 0, 0, 255 ), @@ -24,7 +24,7 @@ class EE_API cUIWinMenu : public cUIComplexControl { MenuHeight(0), FirstButtonMargin(1) { - cUITheme * Theme = cUIThemeManager::instance()->DefaultTheme(); + UITheme * Theme = UIThemeManager::instance()->DefaultTheme(); if ( NULL != Theme ) { Font = Theme->Font(); @@ -35,7 +35,7 @@ class EE_API cUIWinMenu : public cUIComplexControl { } if ( NULL == Font ) - Font = cUIThemeManager::instance()->DefaultFont(); + Font = UIThemeManager::instance()->DefaultFont(); } Graphics::Font * Font; @@ -49,19 +49,19 @@ class EE_API cUIWinMenu : public cUIComplexControl { Uint32 FirstButtonMargin; }; - cUIWinMenu( const cUIWinMenu::CreateParams& Params ); + UIWinMenu( const UIWinMenu::CreateParams& Params ); - virtual ~cUIWinMenu(); + virtual ~UIWinMenu(); virtual Uint32 Type() const; virtual bool IsType( const Uint32& type ) const; - void AddMenuButton( const String& ButtonText, cUIPopUpMenu * Menu ); + void AddMenuButton( const String& ButtonText, UIPopUpMenu * Menu ); void RemoveMenuButton( const String& ButtonText ); - virtual void SetTheme( cUITheme * Theme ); + virtual void SetTheme( UITheme * Theme ); void FontColor( const ColorA& Color ); @@ -77,18 +77,18 @@ class EE_API cUIWinMenu : public cUIComplexControl { Graphics::Font * Font() const; - cUISelectButton * GetButton( const String& ButtonText ); + UISelectButton * GetButton( const String& ButtonText ); - cUIPopUpMenu * GetPopUpMenu( const String& ButtonText ); + UIPopUpMenu * GetPopUpMenu( const String& ButtonText ); protected: - typedef std::list< std::pair< cUISelectButton *, cUIPopUpMenu * > > WinMenuList; + typedef std::list< std::pair< UISelectButton *, UIPopUpMenu * > > WinMenuList; Graphics::Font *mFont; ColorA mFontColor; ColorA mFontShadowColor; ColorA mFontOverColor; ColorA mFontSelectedColor; - cUIPopUpMenu * mCurrentMenu; + UIPopUpMenu * mCurrentMenu; Uint32 mMarginBetweenButtons; Uint32 mButtonMargin; Uint32 mFirstButtonMargin; @@ -97,15 +97,15 @@ class EE_API cUIWinMenu : public cUIComplexControl { void RefreshButtons(); - virtual Uint32 OnMessage( const cUIMessage * Msg ); + virtual Uint32 OnMessage( const UIMessage * Msg ); virtual void OnComplexControlFocusLoss(); - cUIPopUpMenu * GetMenuFromButton( cUISelectButton * Button ); + UIPopUpMenu * GetMenuFromButton( UISelectButton * Button ); - bool IsPopUpMenuChild( cUIControl * Ctrl ); + bool IsPopUpMenuChild( UIControl * Ctrl ); - void OnMenuFocusLoss( const cUIEvent * Event ); + void OnMenuFocusLoss( const UIEvent * Event ); void UnselectButtons(); diff --git a/projects/linux/ee.creator.user b/projects/linux/ee.creator.user index ce272d408..06fb21207 100644 --- a/projects/linux/ee.creator.user +++ b/projects/linux/ee.creator.user @@ -1,6 +1,6 @@ - + ProjectExplorer.Project.ActiveTarget diff --git a/projects/linux/ee.files b/projects/linux/ee.files index 183fb85df..a109d306c 100644 --- a/projects/linux/ee.files +++ b/projects/linux/ee.files @@ -211,114 +211,114 @@ ../../src/eepp/physics/constraints/dampedrotaryspring.cpp ../../src/eepp/physics/constraints/constraint.cpp ../../include/eepp/ui/uihelper.hpp -../../include/eepp/ui/tuiitemcontainer.hpp -../../include/eepp/ui/cuiwinmenu.hpp -../../include/eepp/ui/cuiwindow.hpp -../../include/eepp/ui/cuitooltip.hpp -../../include/eepp/ui/cuithememanager.hpp -../../include/eepp/ui/cuitheme.hpp -../../include/eepp/ui/cuitextinput.hpp -../../include/eepp/ui/cuitextedit.hpp -../../include/eepp/ui/cuitextbox.hpp -../../include/eepp/ui/cuitabwidget.hpp -../../include/eepp/ui/cuitab.hpp -../../include/eepp/ui/cuisprite.hpp -../../include/eepp/ui/cuispinbox.hpp -../../include/eepp/ui/cuisliderbutton.hpp -../../include/eepp/ui/cuislider.hpp -../../include/eepp/ui/cuiskinstate.hpp -../../include/eepp/ui/cuiskinsimple.hpp -../../include/eepp/ui/cuiskincomplex.hpp -../../include/eepp/ui/cuiskin.hpp -../../include/eepp/ui/cuiseparator.hpp -../../include/eepp/ui/cuiselectbutton.hpp -../../include/eepp/ui/cuiscrollbar.hpp -../../include/eepp/ui/cuiradiobutton.hpp -../../include/eepp/ui/cuipushbutton.hpp -../../include/eepp/ui/cuiprogressbar.hpp -../../include/eepp/ui/cuipopupmenu.hpp -../../include/eepp/ui/cuimessagebox.hpp -../../include/eepp/ui/cuimessage.hpp -../../include/eepp/ui/cuimenusubmenu.hpp -../../include/eepp/ui/cuimenuitem.hpp -../../include/eepp/ui/cuimenucheckbox.hpp -../../include/eepp/ui/cuimenu.hpp -../../include/eepp/ui/cuimanager.hpp -../../include/eepp/ui/cuilistboxitem.hpp -../../include/eepp/ui/cuilistbox.hpp -../../include/eepp/ui/cuigridcell.hpp -../../include/eepp/ui/cuigfx.hpp -../../include/eepp/ui/cuigenericgrid.hpp -../../include/eepp/ui/cuieventmouse.hpp -../../include/eepp/ui/cuieventkey.hpp -../../include/eepp/ui/cuievent.hpp -../../include/eepp/ui/cuidropdownlist.hpp -../../include/eepp/ui/cuidragable.hpp -../../include/eepp/ui/cuicontrolanim.hpp -../../include/eepp/ui/cuicontrol.hpp -../../include/eepp/ui/cuicomplexcontrol.hpp -../../include/eepp/ui/cuicommondialog.hpp -../../include/eepp/ui/cuicombobox.hpp -../../include/eepp/ui/cuicheckbox.hpp -../../include/eepp/ui/cuiborder.hpp -../../include/eepp/ui/cuibackground.hpp +../../include/eepp/ui/uiitemcontainer.hpp +../../include/eepp/ui/uiwinmenu.hpp +../../include/eepp/ui/uiwindow.hpp +../../include/eepp/ui/uitooltip.hpp +../../include/eepp/ui/uithememanager.hpp +../../include/eepp/ui/uitheme.hpp +../../include/eepp/ui/uitextinput.hpp +../../include/eepp/ui/uitextedit.hpp +../../include/eepp/ui/uitextbox.hpp +../../include/eepp/ui/uitabwidget.hpp +../../include/eepp/ui/uitab.hpp +../../include/eepp/ui/uisprite.hpp +../../include/eepp/ui/uispinbox.hpp +../../include/eepp/ui/uisliderbutton.hpp +../../include/eepp/ui/uislider.hpp +../../include/eepp/ui/uiskinstate.hpp +../../include/eepp/ui/uiskinsimple.hpp +../../include/eepp/ui/uiskincomplex.hpp +../../include/eepp/ui/uiskin.hpp +../../include/eepp/ui/uiseparator.hpp +../../include/eepp/ui/uiselectbutton.hpp +../../include/eepp/ui/uiscrollbar.hpp +../../include/eepp/ui/uiradiobutton.hpp +../../include/eepp/ui/uipushbutton.hpp +../../include/eepp/ui/uiprogressbar.hpp +../../include/eepp/ui/uipopupmenu.hpp +../../include/eepp/ui/uimessagebox.hpp +../../include/eepp/ui/uimessage.hpp +../../include/eepp/ui/uimenusubmenu.hpp +../../include/eepp/ui/uimenuitem.hpp +../../include/eepp/ui/uimenucheckbox.hpp +../../include/eepp/ui/uimenu.hpp +../../include/eepp/ui/uimanager.hpp +../../include/eepp/ui/uilistboxitem.hpp +../../include/eepp/ui/uilistbox.hpp +../../include/eepp/ui/uigridcell.hpp +../../include/eepp/ui/uigfx.hpp +../../include/eepp/ui/uigenericgrid.hpp +../../include/eepp/ui/uieventmouse.hpp +../../include/eepp/ui/uieventkey.hpp +../../include/eepp/ui/uievent.hpp +../../include/eepp/ui/uidropdownlist.hpp +../../include/eepp/ui/uidragable.hpp +../../include/eepp/ui/uicontrolanim.hpp +../../include/eepp/ui/uicontrol.hpp +../../include/eepp/ui/uicomplexcontrol.hpp +../../include/eepp/ui/uicommondialog.hpp +../../include/eepp/ui/uicombobox.hpp +../../include/eepp/ui/uicheckbox.hpp +../../include/eepp/ui/uiborder.hpp +../../include/eepp/ui/uibackground.hpp ../../include/eepp/ui/base.hpp -../../src/eepp/ui/tools/ctextureatlassubtextureeditor.hpp -../../src/eepp/ui/tools/ctextureatlasnew.hpp -../../include/eepp/ui/tools/ctextureatlaseditor.hpp -../../src/eepp/ui/cuiwinmenu.cpp -../../src/eepp/ui/cuiwindow.cpp -../../src/eepp/ui/cuitooltip.cpp -../../src/eepp/ui/cuithememanager.cpp -../../src/eepp/ui/cuitheme.cpp -../../src/eepp/ui/cuitextinput.cpp -../../src/eepp/ui/cuitextedit.cpp -../../src/eepp/ui/cuitextbox.cpp -../../src/eepp/ui/cuitabwidget.cpp -../../src/eepp/ui/cuitab.cpp -../../src/eepp/ui/cuisprite.cpp -../../src/eepp/ui/cuispinbox.cpp -../../src/eepp/ui/cuisliderbutton.cpp -../../src/eepp/ui/cuislider.cpp -../../src/eepp/ui/cuiskinstate.cpp -../../src/eepp/ui/cuiskinsimple.cpp -../../src/eepp/ui/cuiskincomplex.cpp -../../src/eepp/ui/cuiskin.cpp -../../src/eepp/ui/cuiseparator.cpp -../../src/eepp/ui/cuiselectbutton.cpp -../../src/eepp/ui/cuiscrollbar.cpp -../../src/eepp/ui/cuiradiobutton.cpp -../../src/eepp/ui/cuipushbutton.cpp -../../src/eepp/ui/cuiprogressbar.cpp -../../src/eepp/ui/cuipopupmenu.cpp -../../src/eepp/ui/cuimessagebox.cpp -../../src/eepp/ui/cuimessage.cpp -../../src/eepp/ui/cuimenusubmenu.cpp -../../src/eepp/ui/cuimenuitem.cpp -../../src/eepp/ui/cuimenucheckbox.cpp -../../src/eepp/ui/cuimenu.cpp -../../src/eepp/ui/cuimanager.cpp -../../src/eepp/ui/cuilistboxitem.cpp -../../src/eepp/ui/cuilistbox.cpp -../../src/eepp/ui/cuigridcell.cpp -../../src/eepp/ui/cuigfx.cpp -../../src/eepp/ui/cuigenericgrid.cpp -../../src/eepp/ui/cuieventmouse.cpp -../../src/eepp/ui/cuieventkey.cpp -../../src/eepp/ui/cuievent.cpp -../../src/eepp/ui/cuidropdownlist.cpp -../../src/eepp/ui/cuidragable.cpp -../../src/eepp/ui/cuicontrolanim.cpp -../../src/eepp/ui/cuicontrol.cpp -../../src/eepp/ui/cuicomplexcontrol.cpp -../../src/eepp/ui/cuicommondialog.cpp -../../src/eepp/ui/cuicombobox.cpp -../../src/eepp/ui/cuicheckbox.cpp -../../src/eepp/ui/cuiborder.cpp -../../src/eepp/ui/cuibackground.cpp -../../src/eepp/ui/tools/ctextureatlassubtextureeditor.cpp -../../src/eepp/ui/tools/ctextureatlasnew.cpp -../../src/eepp/ui/tools/ctextureatlaseditor.cpp +../../src/eepp/ui/tools/textureatlassubtextureeditor.hpp +../../src/eepp/ui/tools/textureatlasnew.hpp +../../include/eepp/ui/tools/textureatlaseditor.hpp +../../src/eepp/ui/uiwinmenu.cpp +../../src/eepp/ui/uiwindow.cpp +../../src/eepp/ui/uitooltip.cpp +../../src/eepp/ui/uithememanager.cpp +../../src/eepp/ui/uitheme.cpp +../../src/eepp/ui/uitextinput.cpp +../../src/eepp/ui/uitextedit.cpp +../../src/eepp/ui/uitextbox.cpp +../../src/eepp/ui/uitabwidget.cpp +../../src/eepp/ui/uitab.cpp +../../src/eepp/ui/uisprite.cpp +../../src/eepp/ui/uispinbox.cpp +../../src/eepp/ui/uisliderbutton.cpp +../../src/eepp/ui/uislider.cpp +../../src/eepp/ui/uiskinstate.cpp +../../src/eepp/ui/uiskinsimple.cpp +../../src/eepp/ui/uiskincomplex.cpp +../../src/eepp/ui/uiskin.cpp +../../src/eepp/ui/uiseparator.cpp +../../src/eepp/ui/uiselectbutton.cpp +../../src/eepp/ui/uiscrollbar.cpp +../../src/eepp/ui/uiradiobutton.cpp +../../src/eepp/ui/uipushbutton.cpp +../../src/eepp/ui/uiprogressbar.cpp +../../src/eepp/ui/uipopupmenu.cpp +../../src/eepp/ui/uimessagebox.cpp +../../src/eepp/ui/uimessage.cpp +../../src/eepp/ui/uimenusubmenu.cpp +../../src/eepp/ui/uimenuitem.cpp +../../src/eepp/ui/uimenucheckbox.cpp +../../src/eepp/ui/uimenu.cpp +../../src/eepp/ui/uimanager.cpp +../../src/eepp/ui/uilistboxitem.cpp +../../src/eepp/ui/uilistbox.cpp +../../src/eepp/ui/uigridcell.cpp +../../src/eepp/ui/uigfx.cpp +../../src/eepp/ui/uigenericgrid.cpp +../../src/eepp/ui/uieventmouse.cpp +../../src/eepp/ui/uieventkey.cpp +../../src/eepp/ui/uievent.cpp +../../src/eepp/ui/uidropdownlist.cpp +../../src/eepp/ui/uidragable.cpp +../../src/eepp/ui/uicontrolanim.cpp +../../src/eepp/ui/uicontrol.cpp +../../src/eepp/ui/uicomplexcontrol.cpp +../../src/eepp/ui/uicommondialog.cpp +../../src/eepp/ui/uicombobox.cpp +../../src/eepp/ui/uicheckbox.cpp +../../src/eepp/ui/uiborder.cpp +../../src/eepp/ui/uibackground.cpp +../../src/eepp/ui/tools/textureatlassubtextureeditor.cpp +../../src/eepp/ui/tools/textureatlasnew.cpp +../../src/eepp/ui/tools/textureatlaseditor.cpp ../../include/eepp/math/vector3.hpp ../../include/eepp/math/vector2.hpp ../../include/eepp/system/bitop.hpp @@ -572,8 +572,8 @@ ../../include/eepp/core/noncopyable.hpp ../../include/eepp/system/clock.hpp ../../src/eepp/system/lock.cpp -../../src/eepp/ui/cuidefaulttheme.cpp -../../include/eepp/ui/cuidefaulttheme.hpp +../../src/eepp/ui/uidefaulttheme.cpp +../../include/eepp/ui/uidefaulttheme.hpp ../../src/eepp/helper/SOIL2/src/SOIL2/stbi_pvr_c.h ../../src/eepp/helper/SOIL2/src/SOIL2/stbi_pvr.h ../../src/eepp/helper/SOIL2/src/SOIL2/stbi_pkm_c.h @@ -655,8 +655,8 @@ ../../src/eepp/system/platform/posix/threadlocalimpl.cpp ../../include/eepp/system/threadlocalptr.hpp ../../external_projects.lua -../../src/eepp/ui/cuitextinputpassword.cpp -../../include/eepp/ui/cuitextinputpassword.hpp +../../src/eepp/ui/uitextinputpassword.cpp +../../include/eepp/ui/uitextinputpassword.hpp ../../src/eepp/graphics/renderer/renderergl3cp.cpp ../../include/eepp/graphics/renderer/renderergl3cp.hpp ../../src/eepp/graphics/renderer/shaders/basegl3cp.vert diff --git a/src/eepp/gaming/mapeditor/mapeditor.cpp b/src/eepp/gaming/mapeditor/mapeditor.cpp index 339f2fd5c..c73284ed7 100644 --- a/src/eepp/gaming/mapeditor/mapeditor.cpp +++ b/src/eepp/gaming/mapeditor/mapeditor.cpp @@ -15,16 +15,16 @@ #include #include #include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include #include #include #include @@ -39,9 +39,9 @@ using namespace EE::Gaming::Private; namespace EE { namespace Gaming { -MapEditor::MapEditor( cUIWindow * AttatchTo, const MapEditorCloseCb& callback ) : +MapEditor::MapEditor( UIWindow * AttatchTo, const MapEditorCloseCb& callback ) : mUIWindow( AttatchTo ), - mTheme( cUIThemeManager::instance()->DefaultTheme() ), + mTheme( UIThemeManager::instance()->DefaultTheme() ), mUIMap( NULL ), mCloseCb( callback ), mGOTypeList( NULL ), @@ -56,18 +56,18 @@ MapEditor::MapEditor( cUIWindow * AttatchTo, const MapEditorCloseCb& callback ) } if ( NULL == mUIWindow ) { - mUIWindow = cUIManager::instance()->MainControl(); + mUIWindow = UIManager::instance()->MainControl(); mUIWindow->SetSkinFromTheme( mTheme, "winback" ); } - if ( cUIManager::instance()->MainControl() == mUIWindow ) { + if ( UIManager::instance()->MainControl() == mUIWindow ) { mUIContainer = mUIWindow; } else { mUIContainer = mUIWindow->Container(); } mUIWindow->Title( "Map Editor" ); - mUIWindow->AddEventListener( cUIEvent::EventOnWindowClose, cb::Make1( this, &MapEditor::WindowClose ) ); + mUIWindow->AddEventListener( UIEvent::EventOnWindowClose, cb::Make1( this, &MapEditor::WindowClose ) ); CreateME(); } @@ -84,14 +84,14 @@ void MapEditor::CreateME() { } void MapEditor::CreateWinMenu() { - cUIWinMenu * WinMenu = mTheme->CreateWinMenu( mUIContainer ); + UIWinMenu * WinMenu = mTheme->CreateWinMenu( mUIContainer ); mTileBox = mTheme->CreateTextBox( "", mUIContainer, Sizei(), Vector2i(), UI_HALIGN_RIGHT | UI_VALIGN_CENTER | UI_ANCHOR_TOP | UI_ANCHOR_RIGHT ); mTileBox->Size( 100, WinMenu->Size().Height() ); mTileBox->Pos( Vector2i( mUIContainer->Size().Width() - mTileBox->Size().Width(), 0 ) ); mTileBox->UpdateAnchorsDistances(); - cUIPopUpMenu * PU1 = mTheme->CreatePopUpMenu( mUIContainer ); + UIPopUpMenu * PU1 = mTheme->CreatePopUpMenu( mUIContainer ); PU1->Add( "New...", mTheme->GetIconByName( "document-new" ) ); PU1->Add( "Open...", mTheme->GetIconByName( "document-open" ) ); PU1->AddSeparator(); @@ -102,35 +102,35 @@ void MapEditor::CreateWinMenu() { PU1->AddSeparator(); PU1->Add( "Quit", mTheme->GetIconByName( "quit" ) ); - PU1->AddEventListener( cUIEvent::EventOnItemClicked, cb::Make1( this, &MapEditor::FileMenuClick ) ); + PU1->AddEventListener( UIEvent::EventOnItemClicked, cb::Make1( this, &MapEditor::FileMenuClick ) ); WinMenu->AddMenuButton( "File", PU1 ); - cUIPopUpMenu * PU3 = mTheme->CreatePopUpMenu( mUIContainer ); - mChkShowGrid = reinterpret_cast( PU3->GetItem( PU3->AddCheckBox( "Show Grid" ) ) ); + UIPopUpMenu * PU3 = mTheme->CreatePopUpMenu( mUIContainer ); + mChkShowGrid = reinterpret_cast( PU3->GetItem( PU3->AddCheckBox( "Show Grid" ) ) ); mChkShowGrid->Active( true ); - mChkMarkTileOver = reinterpret_cast( PU3->GetItem( PU3->AddCheckBox( "Mark Tile Over" ) ) ); + mChkMarkTileOver = reinterpret_cast( PU3->GetItem( PU3->AddCheckBox( "Mark Tile Over" ) ) ); - mChkShowBlocked = reinterpret_cast( PU3->GetItem( PU3->AddCheckBox( "Show Blocked" ) ) ); + mChkShowBlocked = reinterpret_cast( PU3->GetItem( PU3->AddCheckBox( "Show Blocked" ) ) ); PU3->AddSeparator(); - mUIWindow->AddShortcut( KEY_KP_PLUS , KEYMOD_CTRL, reinterpret_cast ( PU3->GetItem( PU3->Add( "Zoom In", mTheme->GetIconByName( "zoom-in" ) ) ) ) ); - mUIWindow->AddShortcut( KEY_KP_MINUS, KEYMOD_CTRL, reinterpret_cast ( PU3->GetItem( PU3->Add( "Zoom Out", mTheme->GetIconByName( "zoom-out" ) ) ) ) ); - mUIWindow->AddShortcut( KEY_KP0 , KEYMOD_CTRL, reinterpret_cast ( PU3->GetItem( PU3->Add( "Normal Size", mTheme->GetIconByName( "zoom-original" ) ) ) ) ); + mUIWindow->AddShortcut( KEY_KP_PLUS , KEYMOD_CTRL, reinterpret_cast ( PU3->GetItem( PU3->Add( "Zoom In", mTheme->GetIconByName( "zoom-in" ) ) ) ) ); + mUIWindow->AddShortcut( KEY_KP_MINUS, KEYMOD_CTRL, reinterpret_cast ( PU3->GetItem( PU3->Add( "Zoom Out", mTheme->GetIconByName( "zoom-out" ) ) ) ) ); + mUIWindow->AddShortcut( KEY_KP0 , KEYMOD_CTRL, reinterpret_cast ( PU3->GetItem( PU3->Add( "Normal Size", mTheme->GetIconByName( "zoom-original" ) ) ) ) ); PU3->AddSeparator(); - PU3->AddEventListener( cUIEvent::EventOnItemClicked, cb::Make1( this, &MapEditor::ViewMenuClick ) ); + PU3->AddEventListener( UIEvent::EventOnItemClicked, cb::Make1( this, &MapEditor::ViewMenuClick ) ); WinMenu->AddMenuButton( "View", PU3 ); - cUIPopUpMenu * PU4 = mTheme->CreatePopUpMenu( mUIContainer ); + UIPopUpMenu * PU4 = mTheme->CreatePopUpMenu( mUIContainer ); PU4->Add( "Properties..." ); PU4->Add( "Resize..." ); - PU4->AddEventListener( cUIEvent::EventOnItemClicked, cb::Make1( this, &MapEditor::MapMenuClick ) ); + PU4->AddEventListener( UIEvent::EventOnItemClicked, cb::Make1( this, &MapEditor::MapMenuClick ) ); WinMenu->AddMenuButton( "Map", PU4 ); - cUIPopUpMenu * PU5 = mTheme->CreatePopUpMenu( mUIContainer ); + UIPopUpMenu * PU5 = mTheme->CreatePopUpMenu( mUIContainer ); PU5->Add( "Add Tile Layer..." ); PU5->Add( "Add Object Layer..." ); PU5->AddSeparator(); @@ -143,28 +143,28 @@ void MapEditor::CreateWinMenu() { PU5->AddSeparator(); Uint32 LayerChkBoxIndex = PU5->AddCheckBox( "Lights Enabled" ); - mLayerChkLights = reinterpret_cast ( PU5->GetItem( LayerChkBoxIndex ) ); + mLayerChkLights = reinterpret_cast ( PU5->GetItem( LayerChkBoxIndex ) ); PU5->AddSeparator(); LayerChkBoxIndex = PU5->AddCheckBox( "Visible" ); - mLayerChkVisible = reinterpret_cast ( PU5->GetItem( LayerChkBoxIndex ) ); + mLayerChkVisible = reinterpret_cast ( PU5->GetItem( LayerChkBoxIndex ) ); - PU5->AddEventListener( cUIEvent::EventOnItemClicked, cb::Make1( this, &MapEditor::LayerMenuClick ) ); + PU5->AddEventListener( UIEvent::EventOnItemClicked, cb::Make1( this, &MapEditor::LayerMenuClick ) ); WinMenu->AddMenuButton( "Layer", PU5 ); - cUIPopUpMenu * PU6 = mTheme->CreatePopUpMenu( mUIContainer ); + UIPopUpMenu * PU6 = mTheme->CreatePopUpMenu( mUIContainer ); PU6->Add( "New Texture Atlas..." ); PU6->Add( "Add External Texture Atlas..." ); WinMenu->AddMenuButton( "Atlases", PU6 ); - PU6->AddEventListener( cUIEvent::EventOnItemClicked, cb::Make1( this, &MapEditor::MapMenuClick ) ); + PU6->AddEventListener( UIEvent::EventOnItemClicked, cb::Make1( this, &MapEditor::MapMenuClick ) ); - cUIComplexControl::CreateParams Params; + UIComplexControl::CreateParams Params; Params.Parent( mUIContainer ); Params.PosSet( 0, WinMenu->Size().Height() ); Params.SizeSet( mUIContainer->Size().Width(), mUIContainer->Size().Height() - WinMenu->Size().Height() ); Params.Flags = UI_ANCHOR_TOP | UI_ANCHOR_BOTTOM | UI_ANCHOR_LEFT | UI_ANCHOR_RIGHT | UI_REPORT_SIZE_CHANGE_TO_CHILDS; - mWinContainer = eeNew( cUIComplexControl, ( Params ) ); + mWinContainer = eeNew( UIComplexControl, ( Params ) ); mWinContainer->Visible( true ); mWinContainer->Enabled( true ); } @@ -175,20 +175,20 @@ void MapEditor::CreateETGMenu() { Int32 ContPosX = mWinContainer->Size().Width() - Width - DistToBorder; Int32 DistFromTopMenu = 4; - cUIComplexControl::CreateParams CParams; + UIComplexControl::CreateParams CParams; CParams.Parent( mWinContainer ); CParams.SizeSet( Sizei( Width + DistToBorder, mWinContainer->Size().Height() ) ); CParams.Flags = UI_CONTROL_DEFAULT_ALIGN | UI_ANCHOR_RIGHT | UI_ANCHOR_TOP; - mSubTextureCont = eeNew( cUIComplexControl, ( CParams ) ); + mSubTextureCont = eeNew( UIComplexControl, ( CParams ) ); mSubTextureCont->Enabled( true ); mSubTextureCont->Visible( true ); - mLightCont = eeNew( cUIComplexControl, ( CParams ) ); + mLightCont = eeNew( UIComplexControl, ( CParams ) ); - mObjectCont = eeNew( cUIComplexControl, ( CParams ) ); + mObjectCont = eeNew( UIComplexControl, ( CParams ) ); mTabWidget = mTheme->CreateTabWidget( mWinContainer, Sizei( Width + DistToBorder, mWinContainer->Size().Height() - DistFromTopMenu ), Vector2i( ContPosX, DistFromTopMenu ), UI_HALIGN_CENTER | UI_VALIGN_BOTTOM | UI_ANCHOR_RIGHT | UI_ANCHOR_TOP | UI_ANCHOR_BOTTOM ); - mTabWidget->AddEventListener( cUIEvent::EventOnTabSelected, cb::Make1( this, &MapEditor::OnTabSelected ) ); + mTabWidget->AddEventListener( UIEvent::EventOnTabSelected, cb::Make1( this, &MapEditor::OnTabSelected ) ); CreateTabs(); CreateLighContainer(); @@ -211,7 +211,7 @@ void MapEditor::CreateTabs() { mTabWidget->Add( "Objects", mObjectCont ); } -void MapEditor::OnTabSelected( const cUIEvent * Event ) { +void MapEditor::OnTabSelected( const UIEvent * Event ) { if ( NULL != mUIMap ) { switch ( mTabWidget->GetSelectedTabIndex() ) { case 0: @@ -238,18 +238,18 @@ void MapEditor::FillGotyList() { } void MapEditor::CreateSubTextureContainer( Int32 Width ) { - cUITextBox * Txt; + UITextBox * Txt; Uint32 TxtFlags = UI_CONTROL_DEFAULT_ALIGN | UI_ANCHOR_RIGHT | UI_ANCHOR_TOP | UI_DRAW_SHADOW; Txt = mTheme->CreateTextBox( "Add Game Object as...", mSubTextureCont, Sizei( Width, 16 ), Vector2i( TAB_CONT_X_DIST, 4 ), TxtFlags ); mGOTypeList = mTheme->CreateDropDownList( mSubTextureCont, Sizei( Width - 26, 21 ), Vector2i( TAB_CONT_X_DIST, Txt->Pos().y + Txt->Size().Height() + 4 ), UI_CONTROL_DEFAULT_ALIGN | UI_CLIP_ENABLE | UI_AUTO_PADDING | UI_ANCHOR_RIGHT | UI_ANCHOR_TOP ); - mGOTypeList->AddEventListener( cUIEvent::EventOnItemSelected, cb::Make1( this, &MapEditor::OnTypeChange ) ); + mGOTypeList->AddEventListener( UIEvent::EventOnItemSelected, cb::Make1( this, &MapEditor::OnTypeChange ) ); FillGotyList(); mBtnGOTypeAdd = mTheme->CreatePushButton( mSubTextureCont, Sizei( 24, 21 ), Vector2i( mGOTypeList->Pos().x + mGOTypeList->Size().Width() + 2, mGOTypeList->Pos().y ), UI_CONTROL_ALIGN_CENTER | UI_AUTO_SIZE | UI_ANCHOR_RIGHT | UI_ANCHOR_TOP, mTheme->GetIconByName( "add" ) ); mBtnGOTypeAdd->TooltipText( "Adds a new game object type\nunknown by the map editor." ); - mBtnGOTypeAdd->AddEventListener( cUIEvent::EventMouseClick, cb::Make1( this, &MapEditor::AddNewGOType ) ); + mBtnGOTypeAdd->AddEventListener( UIEvent::EventMouseClick, cb::Make1( this, &MapEditor::AddNewGOType ) ); if ( NULL == mBtnGOTypeAdd->Icon()->SubTexture() ) mBtnGOTypeAdd->Text( "..." ); @@ -257,7 +257,7 @@ void MapEditor::CreateSubTextureContainer( Int32 Width ) { Txt = mTheme->CreateTextBox( "Layers:", mSubTextureCont, Sizei( Width, 16 ), Vector2i( TAB_CONT_X_DIST, mGOTypeList->Pos().y + mGOTypeList->Size().Height() + 4 ), TxtFlags ); mLayerList = mTheme->CreateDropDownList( mSubTextureCont, Sizei( Width, 21 ), Vector2i( TAB_CONT_X_DIST, Txt->Pos().y + Txt->Size().Height() + 4 ), UI_CONTROL_DEFAULT_ALIGN | UI_CLIP_ENABLE | UI_AUTO_PADDING | UI_ANCHOR_RIGHT | UI_ANCHOR_TOP ); - mLayerList->AddEventListener( cUIEvent::EventOnItemSelected, cb::Make1( this, &MapEditor::OnLayerSelect ) ); + mLayerList->AddEventListener( UIEvent::EventOnItemSelected, cb::Make1( this, &MapEditor::OnLayerSelect ) ); Txt = mTheme->CreateTextBox( "Game Object Flags:", mSubTextureCont, Sizei( Width, 16 ), Vector2i( TAB_CONT_X_DIST, mLayerList->Pos().y + mLayerList->Size().Height() + 4 ), TxtFlags ); @@ -265,66 +265,66 @@ void MapEditor::CreateSubTextureContainer( Int32 Width ) { mChkMirrored = mTheme->CreateCheckBox( mSubTextureCont, Sizei(), Vector2i( TAB_CONT_X_DIST, Txt->Pos().y + Txt->Size().Height() + 4 ), ChkFlags ); mChkMirrored->Text( "Mirrored" ); - mChkMirrored->AddEventListener( cUIEvent::EventMouseClick, cb::Make1( this, &MapEditor::ChkClickMirrored ) ); + mChkMirrored->AddEventListener( UIEvent::EventMouseClick, cb::Make1( this, &MapEditor::ChkClickMirrored ) ); mChkFliped = mTheme->CreateCheckBox( mSubTextureCont, Sizei(), Vector2i( mChkMirrored->Pos().x + mChkMirrored->Size().Width() + 32, mChkMirrored->Pos().y ), ChkFlags ); mChkFliped->Text( "Fliped" ); - mChkFliped->AddEventListener( cUIEvent::EventMouseClick, cb::Make1( this, &MapEditor::ChkClickFliped ) ); + mChkFliped->AddEventListener( UIEvent::EventMouseClick, cb::Make1( this, &MapEditor::ChkClickFliped ) ); mChkBlocked = mTheme->CreateCheckBox( mSubTextureCont, Sizei(), Vector2i( mChkMirrored->Pos().x, mChkMirrored->Pos().y + mChkMirrored->Size().Height() + 4 ), ChkFlags ); mChkBlocked->Text( "Blocked" ); mChkBlocked->TooltipText( "Blocks the tile occupied by the sprite." ); - mChkBlocked->AddEventListener( cUIEvent::EventMouseClick, cb::Make1( this, &MapEditor::ChkClickBlocked ) ); + mChkBlocked->AddEventListener( UIEvent::EventMouseClick, cb::Make1( this, &MapEditor::ChkClickBlocked ) ); mChkAnim = mTheme->CreateCheckBox( mSubTextureCont, Sizei(), Vector2i( mChkFliped->Pos().x, mChkFliped->Pos().y + mChkFliped->Size().Height() + 4 ), ChkFlags ); mChkAnim->Text( "Animated" ); mChkAnim->TooltipText( "Indicates if the Sprite is animated." ); - mChkAnim->AddEventListener( cUIEvent::EventMouseClick, cb::Make1( this, &MapEditor::ChkClickAnimated ) ); + mChkAnim->AddEventListener( UIEvent::EventMouseClick, cb::Make1( this, &MapEditor::ChkClickAnimated ) ); mChkRot90 = mTheme->CreateCheckBox( mSubTextureCont, Sizei(), Vector2i( mChkBlocked->Pos().x, mChkBlocked->Pos().y + mChkBlocked->Size().Height() + 4 ), ChkFlags ); mChkRot90->Text( String::FromUtf8( "Rotate 90º" ) ); - mChkRot90->AddEventListener( cUIEvent::EventMouseClick, cb::Make1( this, &MapEditor::ChkClickRot90 ) ); + mChkRot90->AddEventListener( UIEvent::EventMouseClick, cb::Make1( this, &MapEditor::ChkClickRot90 ) ); mChkAutoFix = mTheme->CreateCheckBox( mSubTextureCont, Sizei(), Vector2i( mChkAnim->Pos().x, mChkAnim->Pos().y + mChkAnim->Size().Height() + 4 ), ChkFlags ); mChkAutoFix->Text( "AutoFix TilePos" ); mChkAutoFix->TooltipText( "In a tiled layer if the sprite is moved,\nit will update the current tile position automatically." ); - mChkAutoFix->AddEventListener( cUIEvent::EventMouseClick, cb::Make1( this, &MapEditor::ChkClickAutoFix ) ); + mChkAutoFix->AddEventListener( UIEvent::EventMouseClick, cb::Make1( this, &MapEditor::ChkClickAutoFix ) ); Txt = mTheme->CreateTextBox( "Game Object Data:", mSubTextureCont, Sizei( Width, 16 ), Vector2i( TAB_CONT_X_DIST, mChkRot90->Pos().y + mChkRot90->Size().Height() + 8 ), TxtFlags ); mChkDI = mTheme->CreateCheckBox( mSubTextureCont, Sizei(), Vector2i( TAB_CONT_X_DIST, Txt->Pos().y + Txt->Size().Height() + 4 ), ChkFlags ); mChkDI->Text( "Add as DataId" ); mChkDI->TooltipText( "If the resource it's not a sprite,\nyou can reference it with a data id" ); - mChkDI->AddEventListener( cUIEvent::EventMouseClick, cb::Make1( this, &MapEditor::ChkClickDI ) ); + mChkDI->AddEventListener( UIEvent::EventMouseClick, cb::Make1( this, &MapEditor::ChkClickDI ) ); - cUIComplexControl::CreateParams SGParams; + UIComplexControl::CreateParams SGParams; SGParams.Parent( mSubTextureCont ); SGParams.PosSet( Vector2i( TAB_CONT_X_DIST, mChkDI->Pos().y + mChkDI->Size().Height() + 8 ) ); SGParams.SizeSet( Sizei( Width, 400 ) ); SGParams.Flags = UI_CONTROL_DEFAULT_ALIGN | UI_ANCHOR_RIGHT | UI_ANCHOR_TOP; - mSGCont = eeNew( cUIComplexControl, ( SGParams ) ); + mSGCont = eeNew( UIComplexControl, ( SGParams ) ); mSGCont->Enabled( true ); mSGCont->Visible( true ); Txt = mTheme->CreateTextBox( "Texture Atlases:", mSGCont, Sizei( Width, 16 ), Vector2i( TAB_CONT_X_DIST, 0 ), TxtFlags ); mTextureAtlasesList = mTheme->CreateDropDownList( mSGCont, Sizei( Width, 21 ), Vector2i( 0, Txt->Pos().y +Txt->Size().Height() + 4 ), UI_CONTROL_DEFAULT_ALIGN | UI_CLIP_ENABLE | UI_AUTO_PADDING | UI_ANCHOR_RIGHT | UI_ANCHOR_TOP ); - mTextureAtlasesList->AddEventListener( cUIEvent::EventOnItemSelected, cb::Make1( this, &MapEditor::OnTextureAtlasChange ) ); + mTextureAtlasesList->AddEventListener( UIEvent::EventOnItemSelected, cb::Make1( this, &MapEditor::OnTextureAtlasChange ) ); mSubTextureList = mTheme->CreateListBox( mSGCont, Sizei( Width, 156 ), Vector2i( 0, mTextureAtlasesList->Pos().y + mTextureAtlasesList->Size().Height() + 4 ), UI_CONTROL_DEFAULT_ALIGN | UI_CLIP_ENABLE | UI_AUTO_PADDING | UI_ANCHOR_RIGHT | UI_ANCHOR_TOP ); mSubTextureList->Size( mSubTextureList->Size().Width(), mSubTextureList->RowHeight() * 9 + mSubTextureList->PaddingContainer().Top + mSubTextureList->PaddingContainer().Bottom ); - mSubTextureList->AddEventListener( cUIEvent::EventOnItemSelected, cb::Make1( this, &MapEditor::OnSubTextureChange ) ); + mSubTextureList->AddEventListener( UIEvent::EventOnItemSelected, cb::Make1( this, &MapEditor::OnSubTextureChange ) ); mGfxPreview = mTheme->CreateGfx( NULL, mSGCont, Sizei( Width, Width ), Vector2i( 0, mSubTextureList->Pos().y + mSubTextureList->Size().Height() + 4 ), UI_VALIGN_CENTER | UI_HALIGN_CENTER | UI_ANCHOR_RIGHT | UI_ANCHOR_TOP | UI_AUTO_FIT ); mGfxPreview->Border( true ); mGfxPreview->Border()->Color( ColorA( 0, 0, 0, 200 ) ); - cUIComplexControl::CreateParams DIParams; + UIComplexControl::CreateParams DIParams; DIParams.Parent( mSubTextureCont ); DIParams.PosSet( SGParams.Pos ); DIParams.SizeSet( Sizei( Width, 400 ) ); DIParams.Flags = UI_CONTROL_DEFAULT_ALIGN | UI_ANCHOR_RIGHT | UI_ANCHOR_TOP; - mDICont = eeNew( cUIComplexControl, ( DIParams ) ); + mDICont = eeNew( UIComplexControl, ( DIParams ) ); mDICont->Enabled( false ); mDICont->Visible( false ); @@ -336,20 +336,20 @@ void MapEditor::CreateSubTextureContainer( Int32 Width ) { } void MapEditor::CreateLighContainer() { - cUIPushButton * NewLightBut = mTheme->CreatePushButton( mLightCont, Sizei( mLightCont->Size().Width() - TAB_CONT_X_DIST * 2, 22 ), Vector2i( TAB_CONT_X_DIST, 0 ) ); + UIPushButton * NewLightBut = mTheme->CreatePushButton( mLightCont, Sizei( mLightCont->Size().Width() - TAB_CONT_X_DIST * 2, 22 ), Vector2i( TAB_CONT_X_DIST, 0 ) ); NewLightBut->Text( "New Light" ); - NewLightBut->AddEventListener( cUIEvent::EventMouseClick, cb::Make1( this, &MapEditor::OnNewLight ) ); + NewLightBut->AddEventListener( UIEvent::EventMouseClick, cb::Make1( this, &MapEditor::OnNewLight ) ); - cUITextBox * Txt = mTheme->CreateTextBox( "Light Color:", mLightCont, Sizei(), Vector2i( TAB_CONT_X_DIST, 32 ), UI_CONTROL_DEFAULT_FLAGS | UI_DRAW_SHADOW | UI_AUTO_SIZE ); + UITextBox * Txt = mTheme->CreateTextBox( "Light Color:", mLightCont, Sizei(), Vector2i( TAB_CONT_X_DIST, 32 ), UI_CONTROL_DEFAULT_FLAGS | UI_DRAW_SHADOW | UI_AUTO_SIZE ); - cUIComplexControl::CreateParams ComParams; + UIComplexControl::CreateParams ComParams; ComParams.Parent( mLightCont ); ComParams.PosSet( Txt->Pos().x, Txt->Pos().y + Txt->Size().Height() + 4 ); ComParams.SizeSet( 58, 64 ); ComParams.Background.Color( ColorA(255,255,255,255) ); ComParams.Border.Color( ColorA( 100, 100, 100, 200 ) ); ComParams.Flags |= UI_FILL_BACKGROUND | UI_BORDER; - mUIBaseColor = eeNew( cUIComplexControl, ( ComParams ) ); + mUIBaseColor = eeNew( UIComplexControl, ( ComParams ) ); mUIBaseColor->Visible( true ); mUIBaseColor->Enabled( true ); @@ -357,7 +357,7 @@ void MapEditor::CreateLighContainer() { mUIRedSlider = mTheme->CreateSlider( mLightCont, Sizei( 100, 20 ), Vector2i( Txt->Pos().x + Txt->Size().Width(), Txt->Pos().y ), UI_CONTROL_DEFAULT_FLAGS | UI_AUTO_SIZE ); mUIRedSlider->MaxValue( 255 ); mUIRedSlider->Value( 255 ); - mUIRedSlider->AddEventListener( cUIEvent::EventOnValueChange, cb::Make1( this, &MapEditor::OnRedChange ) ); + mUIRedSlider->AddEventListener( UIEvent::EventOnValueChange, cb::Make1( this, &MapEditor::OnRedChange ) ); mUIRedTxt = mTheme->CreateTextBox( String::ToStr( (Uint32)255 ), mLightCont, Sizei(), Vector2i( mUIRedSlider->Pos().x + mUIRedSlider->Size().Width() + 4, mUIRedSlider->Pos().y ), UI_CONTROL_DEFAULT_FLAGS | UI_DRAW_SHADOW | UI_AUTO_SIZE ); @@ -365,7 +365,7 @@ void MapEditor::CreateLighContainer() { mUIGreenSlider = mTheme->CreateSlider( mLightCont, Sizei( 100, 20 ), Vector2i( mUIRedSlider->Pos().x, Txt->Pos().y ), UI_CONTROL_DEFAULT_FLAGS | UI_AUTO_SIZE ); mUIGreenSlider->MaxValue( 255 ); mUIGreenSlider->Value( 255 ); - mUIGreenSlider->AddEventListener( cUIEvent::EventOnValueChange, cb::Make1( this, &MapEditor::OnGreenChange ) ); + mUIGreenSlider->AddEventListener( UIEvent::EventOnValueChange, cb::Make1( this, &MapEditor::OnGreenChange ) ); mUIGreenTxt = mTheme->CreateTextBox( String::ToStr( (Uint32)255 ), mLightCont, Sizei(), Vector2i( mUIGreenSlider->Pos().x + mUIGreenSlider->Size().Width() + 4, mUIGreenSlider->Pos().y ), UI_CONTROL_DEFAULT_FLAGS | UI_DRAW_SHADOW | UI_AUTO_SIZE ); @@ -373,7 +373,7 @@ void MapEditor::CreateLighContainer() { mUIBlueSlider = mTheme->CreateSlider( mLightCont, Sizei( 100, 20 ), Vector2i( mUIRedSlider->Pos().x, Txt->Pos().y ), UI_CONTROL_DEFAULT_FLAGS | UI_AUTO_SIZE ); mUIBlueSlider->MaxValue( 255 ); mUIBlueSlider->Value( 255 ); - mUIBlueSlider->AddEventListener( cUIEvent::EventOnValueChange, cb::Make1( this, &MapEditor::OnBlueChange ) ); + mUIBlueSlider->AddEventListener( UIEvent::EventOnValueChange, cb::Make1( this, &MapEditor::OnBlueChange ) ); mUIBlueTxt = mTheme->CreateTextBox( String::ToStr( (Uint32)255 ), mLightCont, Sizei(), Vector2i( mUIBlueSlider->Pos().x + mUIBlueSlider->Size().Width() + 4, mUIBlueSlider->Pos().y ), UI_CONTROL_DEFAULT_FLAGS | UI_DRAW_SHADOW | UI_AUTO_SIZE ); @@ -381,21 +381,21 @@ void MapEditor::CreateLighContainer() { mLightRadius = mTheme->CreateSpinBox( mLightCont, Sizei( 100, 22 ), Vector2i( Txt->Pos().x, Txt->Pos().y + Txt->Size().Height() + 8 ), UI_CONTROL_DEFAULT_FLAGS | UI_CLIP_ENABLE | UI_AUTO_SIZE | UI_TEXT_SELECTION_ENABLED, 100, false ); mLightRadius->MaxValue( 2000 ); - mLightRadius->AddEventListener( cUIEvent::EventOnValueChange, cb::Make1( this, &MapEditor::OnLightRadiusChangeVal ) ); + mLightRadius->AddEventListener( UIEvent::EventOnValueChange, cb::Make1( this, &MapEditor::OnLightRadiusChangeVal ) ); mLightTypeChk = mTheme->CreateCheckBox( mLightCont, Sizei(), Vector2i( mLightRadius->Pos().x, mLightRadius->Pos().y + mLightRadius->Size().Height() + 8 ), UI_CONTROL_DEFAULT_FLAGS | UI_AUTO_SIZE ); mLightTypeChk->Text( "Isometric Light" ); mLightTypeChk->Active( false ); - mLightTypeChk->AddEventListener( cUIEvent::EventOnValueChange, cb::Make1( this, &MapEditor::OnLightTypeChange ) ); + mLightTypeChk->AddEventListener( UIEvent::EventOnValueChange, cb::Make1( this, &MapEditor::OnLightTypeChange ) ); } -cUISelectButton * MapEditor::AddObjContButton( String text, Uint32 mode ) { - cUISelectButton * Button = mTheme->CreateSelectButton( mObjectCont, Sizei( mObjectCont->Size().Width() - TAB_CONT_X_DIST * 2, 22 ), Vector2i( TAB_CONT_X_DIST, mLastSelButtonY ) ); +UISelectButton * MapEditor::AddObjContButton( String text, Uint32 mode ) { + UISelectButton * Button = mTheme->CreateSelectButton( mObjectCont, Sizei( mObjectCont->Size().Width() - TAB_CONT_X_DIST * 2, 22 ), Vector2i( TAB_CONT_X_DIST, mLastSelButtonY ) ); Button->Text( text ); Button->Data( mode ); - Button->AddEventListener( cUIEvent::EventMouseClick, cb::Make1( this, &MapEditor::OnObjectModeSel ) ); + Button->AddEventListener( UIEvent::EventMouseClick, cb::Make1( this, &MapEditor::OnObjectModeSel ) ); mLastSelButtonY += Button->Size().Height() + 4; @@ -409,7 +409,7 @@ void MapEditor::CreateObjectsContainer() { AddObjContButton( "Edit Polygons", UIMap::EDIT_POLYGONS ); AddObjContButton( "Insert Object", UIMap::INSERT_OBJECT ); AddObjContButton( "Insert Polygon", UIMap::INSERT_POLYGON ); - cUISelectButton * Button = AddObjContButton( "Insert Polyline", UIMap::INSERT_POLYLINE ); + UISelectButton * Button = AddObjContButton( "Insert Polyline", UIMap::INSERT_POLYLINE ); Int32 nextY = Button->Pos().y + Button->Size().Height() + 4; @@ -417,15 +417,15 @@ void MapEditor::CreateObjectsContainer() { mChkClampToTile = mTheme->CreateCheckBox( mObjectCont, Sizei(), Vector2i( 12, nextY ), ChkFlags ); mChkClampToTile->Text( "Clamp Position to Tile" ); - mChkClampToTile->AddEventListener( cUIEvent::EventMouseClick, cb::Make1( this, &MapEditor::ChkClickClampToTile ) ); + mChkClampToTile->AddEventListener( UIEvent::EventMouseClick, cb::Make1( this, &MapEditor::ChkClickClampToTile ) ); mChkClampToTile->Active( true ); } -void MapEditor::OnObjectModeSel( const cUIEvent * Event ) { - cUISelectButton * Button = static_cast( Event->Ctrl() ); - cUISelectButton * ButtonT = NULL; +void MapEditor::OnObjectModeSel( const UIEvent * Event ) { + UISelectButton * Button = static_cast( Event->Ctrl() ); + UISelectButton * ButtonT = NULL; - for ( std::list::iterator it = mObjContButton.begin(); it != mObjContButton.end(); it++ ) { + for ( std::list::iterator it = mObjContButton.begin(); it != mObjContButton.end(); it++ ) { ButtonT = *it; ButtonT->Unselect(); @@ -437,14 +437,14 @@ void MapEditor::OnObjectModeSel( const cUIEvent * Event ) { } void MapEditor::CreateUIMap() { - cUISkin * HScrollSkin = mTheme->GetByName( mTheme->Abbr() + "_" + "hscrollbar_bg" ); - cUISkin * VScrollSkin = mTheme->GetByName( mTheme->Abbr() + "_" + "vscrollbar_bg" ); + UISkin * HScrollSkin = mTheme->GetByName( mTheme->Abbr() + "_" + "hscrollbar_bg" ); + UISkin * VScrollSkin = mTheme->GetByName( mTheme->Abbr() + "_" + "vscrollbar_bg" ); Float ScrollH = 16; Float ScrollV = 16; if ( NULL != HScrollSkin ) { - SubTexture * tTex = HScrollSkin->GetSubTexture( cUISkinState::StateNormal ); + SubTexture * tTex = HScrollSkin->GetSubTexture( UISkinState::StateNormal ); if ( NULL != tTex ) { ScrollH = tTex->Size().Height(); @@ -452,14 +452,14 @@ void MapEditor::CreateUIMap() { } if ( NULL != VScrollSkin ) { - SubTexture * tTex = VScrollSkin->GetSubTexture( cUISkinState::StateNormal ); + SubTexture * tTex = VScrollSkin->GetSubTexture( UISkinState::StateNormal ); if ( NULL != tTex ) { ScrollV = tTex->Size().Height(); } } - cUIComplexControl::CreateParams Params; + UIComplexControl::CreateParams Params; Params.Parent( mWinContainer ); Params.PosSet( 0, 0 ); Params.SizeSet( mWinContainer->Size().Width() - 225 - ScrollV, mWinContainer->Size().Height() - ScrollH ); @@ -469,9 +469,9 @@ void MapEditor::CreateUIMap() { mUIMap->Visible( true ); mUIMap->Enabled( true ); CreateNewEmptyMap(); - mUIMap->AddEventListener( cUIEvent::EventOnSizeChange, cb::Make1( this, &MapEditor::OnMapSizeChange ) ); - mUIMap->AddEventListener( cUIEvent::EventMouseDown, cb::Make1( this, &MapEditor::OnMapMouseDown ) ); - mUIMap->AddEventListener( cUIEvent::EventMouseClick, cb::Make1( this, &MapEditor::OnMapMouseClick ) ); + mUIMap->AddEventListener( UIEvent::EventOnSizeChange, cb::Make1( this, &MapEditor::OnMapSizeChange ) ); + mUIMap->AddEventListener( UIEvent::EventMouseDown, cb::Make1( this, &MapEditor::OnMapMouseDown ) ); + mUIMap->AddEventListener( UIEvent::EventMouseClick, cb::Make1( this, &MapEditor::OnMapMouseClick ) ); mUIMap->SetLightSelectCb( cb::Make1( this, &MapEditor::OnLightSelect ) ); mUIMap->SetLightRadiusChangeCb( cb::Make1( this, &MapEditor::OnLightRadiusChange ) ); mUIMap->SetAddObjectCallback( cb::Make2( this, &MapEditor::OnAddObject ) ); @@ -480,10 +480,10 @@ void MapEditor::CreateUIMap() { mUIMap->SetTileBox( mTileBox ); mMapHScroll = mTheme->CreateScrollBar( mWinContainer, Sizei( Params.Size.Width(), ScrollH ), Vector2i( 0, mWinContainer->Size().Height() - ScrollH ), UI_ANCHOR_LEFT | UI_ANCHOR_RIGHT | UI_ANCHOR_BOTTOM | UI_AUTO_SIZE ); - mMapHScroll->AddEventListener( cUIEvent::EventOnValueChange, cb::Make1( this, &MapEditor::OnScrollMapH ) ); + mMapHScroll->AddEventListener( UIEvent::EventOnValueChange, cb::Make1( this, &MapEditor::OnScrollMapH ) ); mMapVScroll = mTheme->CreateScrollBar( mWinContainer, Sizei( ScrollV, Params.Size.Height() ), Vector2i( Params.Size.Width() + ScrollV, 0 ), UI_ANCHOR_TOP | UI_ANCHOR_BOTTOM | UI_AUTO_SIZE , true ); - mMapVScroll->AddEventListener( cUIEvent::EventOnValueChange, cb::Make1( this, &MapEditor::OnScrollMapV ) ); + mMapVScroll->AddEventListener( UIEvent::EventOnValueChange, cb::Make1( this, &MapEditor::OnScrollMapV ) ); MapCreated(); } @@ -514,13 +514,13 @@ void MapEditor::OnAddObject( Uint32 Type, Polygon2f poly ) { } } -void MapEditor::OnLightTypeChange( const cUIEvent * Event ) { +void MapEditor::OnLightTypeChange( const UIEvent * Event ) { if ( NULL != mUIMap->GetSelectedLight() ) { mUIMap->GetSelectedLight()->Type( mLightTypeChk->Active() ? LIGHT_ISOMETRIC : LIGHT_NORMAL ); } } -void MapEditor::OnLightRadiusChangeVal( const cUIEvent * Event ) { +void MapEditor::OnLightRadiusChangeVal( const UIEvent * Event ) { if ( NULL != mUIMap->GetSelectedLight() ) { mUIMap->GetSelectedLight()->Radius( mLightRadius->Value() ); } @@ -540,8 +540,8 @@ void MapEditor::OnLightSelect( MapLight * Light ) { mLightTypeChk->Active( Light->Type() == LIGHT_ISOMETRIC ? true : false ); } -void MapEditor::OnNewLight( const cUIEvent * Event ) { - const cUIEventMouse * MEvent = reinterpret_cast ( Event ); +void MapEditor::OnNewLight( const UIEvent * Event ) { + const UIEventMouse * MEvent = reinterpret_cast ( Event ); if ( MEvent->Flags() & EE_BUTTON_LMASK ) { Vector2i Pos = mUIMap->Map()->GetMouseMapPos(); @@ -549,7 +549,7 @@ void MapEditor::OnNewLight( const cUIEvent * Event ) { } } -void MapEditor::OnRedChange( const cUIEvent * Event ) { +void MapEditor::OnRedChange( const UIEvent * Event ) { ColorA Col = mUIBaseColor->Background()->Color(); Col.Red = (Uint8)mUIRedSlider->Value(); mUIBaseColor->Background()->Color( Col ); @@ -562,7 +562,7 @@ void MapEditor::OnRedChange( const cUIEvent * Event ) { } } -void MapEditor::OnGreenChange( const cUIEvent * Event ) { +void MapEditor::OnGreenChange( const UIEvent * Event ) { ColorA Col = mUIBaseColor->Background()->Color(); Col.Green = (Uint8)mUIGreenSlider->Value(); mUIBaseColor->Background()->Color( Col ); @@ -575,7 +575,7 @@ void MapEditor::OnGreenChange( const cUIEvent * Event ) { } } -void MapEditor::OnBlueChange( const cUIEvent * Event ) { +void MapEditor::OnBlueChange( const UIEvent * Event ) { ColorA Col = mUIBaseColor->Background()->Color(); Col.Blue = (Uint8)mUIBlueSlider->Value(); mUIBaseColor->Background()->Color( Col ); @@ -588,7 +588,7 @@ void MapEditor::OnBlueChange( const cUIEvent * Event ) { } } -void MapEditor::ChkClickDI( const cUIEvent * Event ) { +void MapEditor::ChkClickDI( const UIEvent * Event ) { if ( mChkDI->Active() ) { mSGCont->Enabled( false ); mSGCont->Visible( false ); @@ -602,7 +602,7 @@ void MapEditor::ChkClickDI( const cUIEvent * Event ) { } } -void MapEditor::ChkClickClampToTile( const cUIEvent * Event ) { +void MapEditor::ChkClickClampToTile( const UIEvent * Event ) { mUIMap->ClampToTile( mChkClampToTile->Active() ); } @@ -644,7 +644,7 @@ void MapEditor::UpdateFlags() { mCurGOFlags |= GObjFlags::GAMEOBJECT_AUTO_FIX_TILE_POS; } -void MapEditor::OnTypeChange( const cUIEvent * Event ) { +void MapEditor::OnTypeChange( const UIEvent * Event ) { if ( mGOTypeList->Text() == "SubTexture" ) mCurGOType = GAMEOBJECT_TYPE_SUBTEXTURE; else if ( mGOTypeList->Text() == "SubTextureEx" ) @@ -661,30 +661,30 @@ void MapEditor::OnTypeChange( const cUIEvent * Event ) { } } -void MapEditor::ChkClickMirrored( const cUIEvent * Event ) { +void MapEditor::ChkClickMirrored( const UIEvent * Event ) { UpdateGfx(); UpdateFlags(); } -void MapEditor::ChkClickFliped( const cUIEvent * Event ) { +void MapEditor::ChkClickFliped( const UIEvent * Event ) { UpdateGfx(); UpdateFlags(); } -void MapEditor::ChkClickRot90( const cUIEvent * Event ) { +void MapEditor::ChkClickRot90( const UIEvent * Event ) { UpdateGfx(); UpdateFlags(); } -void MapEditor::ChkClickBlocked( const cUIEvent * Event ) { +void MapEditor::ChkClickBlocked( const UIEvent * Event ) { UpdateFlags(); } -void MapEditor::ChkClickAutoFix( const cUIEvent * Event ) { +void MapEditor::ChkClickAutoFix( const UIEvent * Event ) { UpdateFlags(); } -void MapEditor::ChkClickAnimated( const cUIEvent * Event ) { +void MapEditor::ChkClickAnimated( const UIEvent * Event ) { UpdateFlags(); if ( mChkAnim->Active() && ( mGOTypeList->Text() == "SubTexture" || mGOTypeList->Text() == "SubTextureEx" ) ) { @@ -692,14 +692,14 @@ void MapEditor::ChkClickAnimated( const cUIEvent * Event ) { } } -void MapEditor::AddNewGOType( const cUIEvent * Event ) { +void MapEditor::AddNewGOType( const UIEvent * Event ) { eeNew( UIGOTypeNew, ( cb::Make2( this, &MapEditor::OnNewGOTypeAdded ) ) ); } void MapEditor::OnNewGOTypeAdded( std::string name, Uint32 hash ) { if ( "" != name ) { for ( Uint32 i = 0; i < mGOTypeList->ListBox()->Count(); i++ ) { - cUIListBoxItem * Item = mGOTypeList->ListBox()->GetItem(i); + UIListBoxItem * Item = mGOTypeList->ListBox()->GetItem(i); if ( Item->Text() == name ) return; @@ -760,7 +760,7 @@ void MapEditor::FillSubTextureList() { mSubTextureList->VerticalScrollBar()->ClickStep( 8.f / (Float)mSubTextureList->Count() ); } -void MapEditor::OnSubTextureChange( const cUIEvent * Event ) { +void MapEditor::OnSubTextureChange( const UIEvent * Event ) { if ( NULL != mCurSG ) { SubTexture * tSubTexture = mCurSG->GetByName( mSubTextureList->GetItemSelectedText() ); @@ -770,7 +770,7 @@ void MapEditor::OnSubTextureChange( const cUIEvent * Event ) { } } -void MapEditor::OnTextureAtlasChange( const cUIEvent * Event ) { +void MapEditor::OnTextureAtlasChange( const UIEvent * Event ) { FillSubTextureList(); } @@ -799,7 +799,7 @@ void MapEditor::MapCreated() { CreateTabs(); } -void MapEditor::OnMapSizeChange( const cUIEvent *Event ) { +void MapEditor::OnMapSizeChange( const UIEvent *Event ) { if ( mMouseScrolling ) return; @@ -813,11 +813,11 @@ void MapEditor::OnMapSizeChange( const cUIEvent *Event ) { mMapVScroll->ClickStep( mUIMap->Map()->TileSize().Height() * mUIMap->Map()->Scale() ); } -void MapEditor::OnScrollMapH( const cUIEvent * Event ) { +void MapEditor::OnScrollMapH( const UIEvent * Event ) { if ( mMouseScrolling ) return; - cUIScrollBar * Scr = reinterpret_cast ( Event->Ctrl() ); + UIScrollBar * Scr = reinterpret_cast ( Event->Ctrl() ); Vector2f Off = mUIMap->Map()->Offset(); @@ -826,8 +826,8 @@ void MapEditor::OnScrollMapH( const cUIEvent * Event ) { mUIMap->Map()->Offset( Off ) ; } -void MapEditor::OnScrollMapV( const cUIEvent * Event ) { - cUIScrollBar * Scr = reinterpret_cast ( Event->Ctrl() ); +void MapEditor::OnScrollMapV( const UIEvent * Event ) { + UIScrollBar * Scr = reinterpret_cast ( Event->Ctrl() ); Vector2f Off = mUIMap->Map()->Offset(); @@ -843,8 +843,8 @@ void MapEditor::UpdateScroll() { mMouseScrolling = false; } -void MapEditor::MapOpen( const cUIEvent * Event ) { - cUICommonDialog * CDL = reinterpret_cast ( Event->Ctrl() ); +void MapEditor::MapOpen( const UIEvent * Event ) { + UICommonDialog * CDL = reinterpret_cast ( Event->Ctrl() ); if ( mUIMap->Map()->Load( CDL->GetFullPath() ) ) { OnMapLoad(); @@ -863,8 +863,8 @@ void MapEditor::OnMapLoad() { RefreshGotyList(); } -void MapEditor::MapSave( const cUIEvent * Event ) { - cUICommonDialog * CDL = reinterpret_cast ( Event->Ctrl() ); +void MapEditor::MapSave( const UIEvent * Event ) { + UICommonDialog * CDL = reinterpret_cast ( Event->Ctrl() ); std::string path( CDL->GetFullPath() ); @@ -875,26 +875,26 @@ void MapEditor::MapSave( const cUIEvent * Event ) { mUIMap->Map()->Save( path ); } -void MapEditor::FileMenuClick( const cUIEvent * Event ) { +void MapEditor::FileMenuClick( const UIEvent * Event ) { if ( !Event->Ctrl()->IsType( UI_TYPE_MENUITEM ) ) return; - const String& txt = reinterpret_cast ( Event->Ctrl() )->Text(); + const String& txt = reinterpret_cast ( Event->Ctrl() )->Text(); if ( "New..." == txt ) { CreateNewMap(); } else if ( "Open..." == txt ) { - cUICommonDialog * TGDialog = mTheme->CreateCommonDialog( NULL, Sizei(), Vector2i(), UI_CONTROL_DEFAULT_FLAGS_CENTERED, UI_WIN_DEFAULT_FLAGS | UI_WIN_MAXIMIZE_BUTTON | UI_WIN_MODAL, Sizei(), 255, UI_CDL_DEFAULT_FLAGS, "*.eem" ); + UICommonDialog * TGDialog = mTheme->CreateCommonDialog( NULL, Sizei(), Vector2i(), UI_CONTROL_DEFAULT_FLAGS_CENTERED, UI_WIN_DEFAULT_FLAGS | UI_WIN_MAXIMIZE_BUTTON | UI_WIN_MODAL, Sizei(), 255, UI_CDL_DEFAULT_FLAGS, "*.eem" ); TGDialog->Title( "Open Map" ); - TGDialog->AddEventListener( cUIEvent::EventOpenFile, cb::Make1( this, &MapEditor::MapOpen ) ); + TGDialog->AddEventListener( UIEvent::EventOpenFile, cb::Make1( this, &MapEditor::MapOpen ) ); TGDialog->Center(); TGDialog->Show(); } else if ( "Save As..." == txt ) { - cUICommonDialog * TGDialog = mTheme->CreateCommonDialog( NULL, Sizei(), Vector2i(), UI_CONTROL_DEFAULT_FLAGS_CENTERED, UI_WIN_DEFAULT_FLAGS | UI_WIN_MAXIMIZE_BUTTON | UI_WIN_MODAL, Sizei(), 255, UI_CDL_DEFAULT_FLAGS | CDL_FLAG_SAVE_DIALOG, "*.eem" ); + UICommonDialog * TGDialog = mTheme->CreateCommonDialog( NULL, Sizei(), Vector2i(), UI_CONTROL_DEFAULT_FLAGS_CENTERED, UI_WIN_DEFAULT_FLAGS | UI_WIN_MAXIMIZE_BUTTON | UI_WIN_MODAL, Sizei(), 255, UI_CDL_DEFAULT_FLAGS | CDL_FLAG_SAVE_DIALOG, "*.eem" ); TGDialog->Title( "Save Map" ); - TGDialog->AddEventListener( cUIEvent::EventSaveFile, cb::Make1( this, &MapEditor::MapSave ) ); + TGDialog->AddEventListener( UIEvent::EventSaveFile, cb::Make1( this, &MapEditor::MapSave ) ); TGDialog->Center(); TGDialog->Show(); } else if ( "Save" == txt ) { @@ -902,21 +902,21 @@ void MapEditor::FileMenuClick( const cUIEvent * Event ) { mUIMap->Map()->Save( mUIMap->Map()->Path() ); } } else if ( "Close" == txt ) { - cUIMessageBox * MsgBox = mTheme->CreateMessageBox( MSGBOX_OKCANCEL, "Do you really want to close the current map?\nAll changes will be lost." ); - MsgBox->AddEventListener( cUIEvent::EventMsgBoxConfirmClick, cb::Make1( this, &MapEditor::OnMapClose ) ); + UIMessageBox * MsgBox = mTheme->CreateMessageBox( MSGBOX_OKCANCEL, "Do you really want to close the current map?\nAll changes will be lost." ); + MsgBox->AddEventListener( UIEvent::EventMsgBoxConfirmClick, cb::Make1( this, &MapEditor::OnMapClose ) ); MsgBox->Title( "Close Map?" ); MsgBox->Center(); MsgBox->Show(); } else if ( "Quit" == txt ) { - if ( mUIWindow == cUIManager::instance()->MainControl() ) { - cUIManager::instance()->GetWindow()->Close(); + if ( mUIWindow == UIManager::instance()->MainControl() ) { + UIManager::instance()->GetWindow()->Close(); } else { mUIWindow->CloseWindow(); } } } -void MapEditor::OnMapClose( const cUIEvent * Event ) { +void MapEditor::OnMapClose( const UIEvent * Event ) { CreateNewEmptyMap(); MapCreated(); @@ -926,18 +926,18 @@ void MapEditor::OnMapClose( const cUIEvent * Event ) { RefreshLayersList(); } -void MapEditor::ViewMenuClick( const cUIEvent * Event ) { +void MapEditor::ViewMenuClick( const UIEvent * Event ) { if ( !Event->Ctrl()->IsType( UI_TYPE_MENUITEM ) ) return; - const String& txt = reinterpret_cast ( Event->Ctrl() )->Text(); + const String& txt = reinterpret_cast ( Event->Ctrl() )->Text(); if ( "Show Grid" == txt ) { - mUIMap->Map()->DrawGrid( reinterpret_cast ( Event->Ctrl() )->Active() ); + mUIMap->Map()->DrawGrid( reinterpret_cast ( Event->Ctrl() )->Active() ); } else if ( "Mark Tile Over" == txt ) { - mUIMap->Map()->DrawTileOver( reinterpret_cast ( Event->Ctrl() )->Active() ); + mUIMap->Map()->DrawTileOver( reinterpret_cast ( Event->Ctrl() )->Active() ); } else if ( "Show Blocked" == txt ) { - mUIMap->Map()->ShowBlocked( reinterpret_cast ( Event->Ctrl() )->Active() ); + mUIMap->Map()->ShowBlocked( reinterpret_cast ( Event->Ctrl() )->Active() ); } else if ( "Zoom In" == txt ) { ZoomIn(); } else if ( "Zoom Out" == txt ) { @@ -1005,22 +1005,22 @@ void MapEditor::ZoomOut() { OnMapSizeChange(); } -void MapEditor::MapMenuClick( const cUIEvent * Event ) { +void MapEditor::MapMenuClick( const UIEvent * Event ) { if ( !Event->Ctrl()->IsType( UI_TYPE_MENUITEM ) ) return; - const String& txt = reinterpret_cast ( Event->Ctrl() )->Text(); + const String& txt = reinterpret_cast ( Event->Ctrl() )->Text(); if ( "New Texture Atlas..." == txt ) { - cUIWindow * tWin = mTheme->CreateWindow( NULL, Sizei( 1024, 768 ), Vector2i(), UI_CONTROL_DEFAULT_FLAGS_CENTERED, UI_WIN_DEFAULT_FLAGS | UI_WIN_MAXIMIZE_BUTTON | UI_WIN_DRAGABLE_CONTAINER, Sizei( 1024, 768 ) ); + UIWindow * tWin = mTheme->CreateWindow( NULL, Sizei( 1024, 768 ), Vector2i(), UI_CONTROL_DEFAULT_FLAGS_CENTERED, UI_WIN_DEFAULT_FLAGS | UI_WIN_MAXIMIZE_BUTTON | UI_WIN_DRAGABLE_CONTAINER, Sizei( 1024, 768 ) ); eeNew ( Tools::TextureAtlasEditor, ( tWin ) ); tWin->Center(); tWin->Show(); } else if ( "Add External Texture Atlas..." == txt ) { - cUICommonDialog * TGDialog = mTheme->CreateCommonDialog( NULL, Sizei(), Vector2i(), UI_CONTROL_DEFAULT_FLAGS_CENTERED, UI_WIN_DEFAULT_FLAGS | UI_WIN_MAXIMIZE_BUTTON | UI_WIN_MODAL, Sizei(), 255, UI_CDL_DEFAULT_FLAGS, std::string( "*" ) + EE_TEXTURE_ATLAS_EXTENSION ); + UICommonDialog * TGDialog = mTheme->CreateCommonDialog( NULL, Sizei(), Vector2i(), UI_CONTROL_DEFAULT_FLAGS_CENTERED, UI_WIN_DEFAULT_FLAGS | UI_WIN_MAXIMIZE_BUTTON | UI_WIN_MODAL, Sizei(), 255, UI_CDL_DEFAULT_FLAGS, std::string( "*" ) + EE_TEXTURE_ATLAS_EXTENSION ); TGDialog->Title( "Load Texture Atlas..." ); - TGDialog->AddEventListener( cUIEvent::EventOpenFile, cb::Make1( this, &MapEditor::TextureAtlasOpen ) ); + TGDialog->AddEventListener( UIEvent::EventOpenFile, cb::Make1( this, &MapEditor::TextureAtlasOpen ) ); TGDialog->Center(); TGDialog->Show(); } else if ( "Properties..." == txt ) { @@ -1030,11 +1030,11 @@ void MapEditor::MapMenuClick( const cUIEvent * Event ) { } } -void MapEditor::LayerMenuClick( const cUIEvent * Event ) { +void MapEditor::LayerMenuClick( const UIEvent * Event ) { if ( !Event->Ctrl()->IsType( UI_TYPE_MENUITEM ) ) return; - const String& txt = reinterpret_cast ( Event->Ctrl() )->Text(); + const String& txt = reinterpret_cast ( Event->Ctrl() )->Text(); if ( "Add Tile Layer..." == txt ) { eeNew( UIMapLayerNew, ( mUIMap, MAP_LAYER_TILED, cb::Make1( this, &MapEditor::OnLayerAdd ) ) ); @@ -1063,15 +1063,15 @@ void MapEditor::LayerMenuClick( const cUIEvent * Event ) { } } -cUIMessageBox * MapEditor::CreateAlert( const String& title, const String& text ) { - cUIMessageBox * MsgBox = mTheme->CreateMessageBox( MSGBOX_OK, text ); +UIMessageBox * MapEditor::CreateAlert( const String& title, const String& text ) { + UIMessageBox * MsgBox = mTheme->CreateMessageBox( MSGBOX_OK, text ); MsgBox->Title( title ); MsgBox->Center(); MsgBox->Show(); return MsgBox; } -cUIMessageBox * MapEditor::CreateNoLayerAlert( const String title ) { +UIMessageBox * MapEditor::CreateNoLayerAlert( const String title ) { return CreateAlert( title, "First select and add a new layer." ); } @@ -1125,8 +1125,8 @@ void MapEditor::RefreshLayersList() { } } -void MapEditor::TextureAtlasOpen( const cUIEvent * Event ) { - cUICommonDialog * CDL = reinterpret_cast ( Event->Ctrl() ); +void MapEditor::TextureAtlasOpen( const UIEvent * Event ) { + UICommonDialog * CDL = reinterpret_cast ( Event->Ctrl() ); std::string sgname = FileSystem::FileRemoveExtension( FileSystem::FileNameFromPath( CDL->GetFullPath() ) ); @@ -1159,7 +1159,7 @@ void MapEditor::OnLayerAdd( UIMapLayerNew * UILayer ) { } } -void MapEditor::OnLayerSelect( const cUIEvent * Event ) { +void MapEditor::OnLayerSelect( const UIEvent * Event ) { MapLayer * tLayer = mUIMap->Map()->GetLayer( mLayerList->Text() ); if ( NULL != tLayer ) { @@ -1173,7 +1173,7 @@ void MapEditor::OnLayerSelect( const cUIEvent * Event ) { } } -void MapEditor::WindowClose( const cUIEvent * Event ) { +void MapEditor::WindowClose( const UIEvent * Event ) { if ( mCloseCb.IsSet() ) mCloseCb(); @@ -1247,7 +1247,7 @@ void MapEditor::AddGameObject() { Vector2i p( tMap->GetMouseMapPos() ); - if ( cUIManager::instance()->GetInput()->IsKeyDown( KEY_LCTRL ) ) { + if ( UIManager::instance()->GetInput()->IsKeyDown( KEY_LCTRL ) ) { p = tMap->GetMouseTilePosCoords(); } @@ -1267,11 +1267,11 @@ GameObject * MapEditor::GetCurrentGOOver() { return reinterpret_cast( mCurLayer )->GetGameObject( mUIMap->Map()->GetMouseTilePos() ); } -void MapEditor::OnMapMouseClick( const cUIEvent * Event ) { - const cUIEventMouse * MEvent = reinterpret_cast ( Event ); +void MapEditor::OnMapMouseClick( const UIEvent * Event ) { + const UIEventMouse * MEvent = reinterpret_cast ( Event ); if ( mSubTextureCont->Visible() ) { - if ( NULL == mCurLayer || NULL == mGfxPreview->SubTexture() || cUIManager::instance()->DownControl() != mUIMap ) { + if ( NULL == mCurLayer || NULL == mGfxPreview->SubTexture() || UIManager::instance()->DownControl() != mUIMap ) { if ( NULL == mCurLayer ) CreateNoLayerAlert( "No layers found" ); @@ -1312,11 +1312,11 @@ void MapEditor::OnMapMouseClick( const cUIEvent * Event ) { } } -void MapEditor::OnMapMouseDown( const cUIEvent * Event ) { - const cUIEventMouse * MEvent = reinterpret_cast ( Event ); +void MapEditor::OnMapMouseDown( const UIEvent * Event ) { + const UIEventMouse * MEvent = reinterpret_cast ( Event ); if ( mSubTextureCont->Visible() ) { - if ( NULL == mCurLayer || NULL == mGfxPreview->SubTexture() || cUIManager::instance()->DownControl() != mUIMap ) + if ( NULL == mCurLayer || NULL == mGfxPreview->SubTexture() || UIManager::instance()->DownControl() != mUIMap ) return; diff --git a/src/eepp/gaming/mapeditor/maplayerproperties.cpp b/src/eepp/gaming/mapeditor/maplayerproperties.cpp index 64c3939b0..b18a5fcb4 100644 --- a/src/eepp/gaming/mapeditor/maplayerproperties.cpp +++ b/src/eepp/gaming/mapeditor/maplayerproperties.cpp @@ -15,45 +15,45 @@ MapLayerProperties::MapLayerProperties( MapLayer * Map, RefreshLayerListCb Cb ) return; } - mUITheme = cUIThemeManager::instance()->DefaultTheme(); + mUITheme = UIThemeManager::instance()->DefaultTheme(); if ( NULL == mUITheme ) return; mUIWindow = mUITheme->CreateWindow( NULL, Sizei( 500, 500 ), Vector2i(), UI_CONTROL_DEFAULT_FLAGS_CENTERED, UI_WIN_DEFAULT_FLAGS | UI_WIN_MODAL, Sizei( 500, 500 ) ); - mUIWindow->AddEventListener( cUIEvent::EventOnWindowClose, cb::Make1( this, &MapLayerProperties::WindowClose ) ); + mUIWindow->AddEventListener( UIEvent::EventOnWindowClose, cb::Make1( this, &MapLayerProperties::WindowClose ) ); mUIWindow->Title( "Layer Properties" ); Int32 InitialY = 16; Int32 DistFromTitle = 18; - cUITextBox * Txt = mUITheme->CreateTextBox( "Layer name:", mUIWindow->Container(), Sizei(), Vector2i( 50, InitialY ), UI_CONTROL_DEFAULT_FLAGS | UI_DRAW_SHADOW | UI_AUTO_SIZE ); + UITextBox * Txt = mUITheme->CreateTextBox( "Layer name:", mUIWindow->Container(), Sizei(), Vector2i( 50, InitialY ), UI_CONTROL_DEFAULT_FLAGS | UI_DRAW_SHADOW | UI_AUTO_SIZE ); mUIInput = mUITheme->CreateTextInput( mUIWindow->Container(), Sizei( 120, 22 ), Vector2i( Txt->Pos().x + DistFromTitle, Txt->Pos().y + DistFromTitle ), UI_CONTROL_DEFAULT_FLAGS | UI_CLIP_ENABLE | UI_AUTO_PADDING | UI_AUTO_SIZE, true, 64 ); mUIInput->Text( mLayer->Name() ); - mUIInput->AddEventListener( cUIEvent::EventOnPressEnter, cb::Make1( this, &MapLayerProperties::OKClick ) ); + mUIInput->AddEventListener( UIEvent::EventOnPressEnter, cb::Make1( this, &MapLayerProperties::OKClick ) ); Uint32 TxtBoxFlags = UI_CONTROL_DEFAULT_FLAGS | UI_DRAW_SHADOW | UI_HALIGN_CENTER | UI_VALIGN_CENTER; mUITheme->CreateTextBox( "Property Name", mUIWindow->Container(), Sizei(192, 24), Vector2i( 50, mUIInput->Pos().y + mUIInput->Size().Height() + 12 ), TxtBoxFlags ); - cUITextBox * TxtBox = mUITheme->CreateTextBox( "Property Value", mUIWindow->Container(), Sizei(192, 24), Vector2i( 50+192, mUIInput->Pos().y + mUIInput->Size().Height() + 12 ), TxtBoxFlags ); + UITextBox * TxtBox = mUITheme->CreateTextBox( "Property Value", mUIWindow->Container(), Sizei(192, 24), Vector2i( 50+192, mUIInput->Pos().y + mUIInput->Size().Height() + 12 ), TxtBoxFlags ); - cUIPushButton * OKButton = mUITheme->CreatePushButton( mUIWindow->Container(), Sizei( 80, 22 ), Vector2i(), UI_CONTROL_DEFAULT_FLAGS_CENTERED | UI_AUTO_SIZE, mUITheme->GetIconByName( "ok" ) ); + UIPushButton * OKButton = mUITheme->CreatePushButton( mUIWindow->Container(), Sizei( 80, 22 ), Vector2i(), UI_CONTROL_DEFAULT_FLAGS_CENTERED | UI_AUTO_SIZE, mUITheme->GetIconByName( "ok" ) ); OKButton->Pos( mUIWindow->Container()->Size().Width() - OKButton->Size().Width() - 4, mUIWindow->Container()->Size().Height() - OKButton->Size().Height() - 4 ); - OKButton->AddEventListener( cUIEvent::EventMouseClick, cb::Make1( this, &MapLayerProperties::OKClick ) ); + OKButton->AddEventListener( UIEvent::EventMouseClick, cb::Make1( this, &MapLayerProperties::OKClick ) ); OKButton->Text( "OK" ); - cUIPushButton * CancelButton = mUITheme->CreatePushButton( mUIWindow->Container(), OKButton->Size(), Vector2i( OKButton->Pos().x - OKButton->Size().Width() - 4, OKButton->Pos().y ), UI_CONTROL_DEFAULT_FLAGS_CENTERED | UI_AUTO_SIZE, mUITheme->GetIconByName( "cancel" ) ); - CancelButton->AddEventListener( cUIEvent::EventMouseClick, cb::Make1( this, &MapLayerProperties::CancelClick ) ); + UIPushButton * CancelButton = mUITheme->CreatePushButton( mUIWindow->Container(), OKButton->Size(), Vector2i( OKButton->Pos().x - OKButton->Size().Width() - 4, OKButton->Pos().y ), UI_CONTROL_DEFAULT_FLAGS_CENTERED | UI_AUTO_SIZE, mUITheme->GetIconByName( "cancel" ) ); + CancelButton->AddEventListener( UIEvent::EventMouseClick, cb::Make1( this, &MapLayerProperties::CancelClick ) ); CancelButton->Text( "Cancel" ); - cUIGenericGrid::CreateParams GridParams; + UIGenericGrid::CreateParams GridParams; GridParams.Parent( mUIWindow->Container() ); GridParams.PosSet( 50, TxtBox->Pos().y + TxtBox->Size().Height() ); GridParams.SizeSet( 400, 350 ); GridParams.Flags = UI_AUTO_PADDING; GridParams.RowHeight = 24; GridParams.CollumnsCount = 5; - mGenGrid = eeNew( cUIGenericGrid, ( GridParams ) ); + mGenGrid = eeNew( UIGenericGrid, ( GridParams ) ); mGenGrid->Visible( true ); mGenGrid->Enabled( true ); mGenGrid->CollumnWidth( 0, 10 ); @@ -64,16 +64,16 @@ MapLayerProperties::MapLayerProperties( MapLayer * Map, RefreshLayerListCb Cb ) Vector2i Pos( mGenGrid->Pos().x + mGenGrid->Size().Width() + 10, mGenGrid->Pos().y ); - cUIPushButton * AddButton = mUITheme->CreatePushButton( mUIWindow->Container(), Sizei(24,21), Pos, UI_CONTROL_ALIGN_CENTER | UI_AUTO_SIZE | UI_ANCHOR_RIGHT | UI_ANCHOR_TOP, mUITheme->GetIconByName( "add" ) ); - AddButton->AddEventListener( cUIEvent::EventMouseClick, cb::Make1( this, &MapLayerProperties::AddCellClick ) ); + UIPushButton * AddButton = mUITheme->CreatePushButton( mUIWindow->Container(), Sizei(24,21), Pos, UI_CONTROL_ALIGN_CENTER | UI_AUTO_SIZE | UI_ANCHOR_RIGHT | UI_ANCHOR_TOP, mUITheme->GetIconByName( "add" ) ); + AddButton->AddEventListener( UIEvent::EventMouseClick, cb::Make1( this, &MapLayerProperties::AddCellClick ) ); if ( NULL == AddButton->Icon()->SubTexture() ) AddButton->Text( "+" ); Pos.y += AddButton->Size().Height() + 5; - cUIPushButton * RemoveButton = mUITheme->CreatePushButton( mUIWindow->Container(), Sizei(24,21), Pos, UI_CONTROL_ALIGN_CENTER | UI_AUTO_SIZE | UI_ANCHOR_RIGHT | UI_ANCHOR_TOP, mUITheme->GetIconByName( "remove" ) ); - RemoveButton->AddEventListener( cUIEvent::EventMouseClick, cb::Make1( this, &MapLayerProperties::RemoveCellClick ) ); + UIPushButton * RemoveButton = mUITheme->CreatePushButton( mUIWindow->Container(), Sizei(24,21), Pos, UI_CONTROL_ALIGN_CENTER | UI_AUTO_SIZE | UI_ANCHOR_RIGHT | UI_ANCHOR_TOP, mUITheme->GetIconByName( "remove" ) ); + RemoveButton->AddEventListener( UIEvent::EventMouseClick, cb::Make1( this, &MapLayerProperties::RemoveCellClick ) ); if ( NULL == RemoveButton->Icon()->SubTexture() ) RemoveButton->Text( "-" ); @@ -91,10 +91,10 @@ void MapLayerProperties::SaveProperties() { mLayer->ClearProperties(); for ( Uint32 i = 0; i < mGenGrid->Count(); i++ ) { - cUIGridCell * Cell = mGenGrid->GetCell( i ); + UIGridCell * Cell = mGenGrid->GetCell( i ); - cUITextInput * Input = reinterpret_cast( Cell->Cell( 1 ) ); - cUITextInput * Input2 = reinterpret_cast( Cell->Cell( 3 ) ); + UITextInput * Input = reinterpret_cast( Cell->Cell( 1 ) ); + UITextInput * Input2 = reinterpret_cast( Cell->Cell( 3 ) ); if ( NULL != Cell && Input->Text().size() && Input2->Text().size() ) { mLayer->AddProperty( Input->Text(), Input2->Text() ); @@ -106,10 +106,10 @@ void MapLayerProperties::LoadProperties() { MapLayer::PropertiesMap& Proper = mLayer->GetProperties(); for ( MapLayer::PropertiesMap::iterator it = Proper.begin(); it != Proper.end(); it++ ) { - cUIGridCell * Cell = CreateCell(); + UIGridCell * Cell = CreateCell(); - cUITextInput * Input = reinterpret_cast( Cell->Cell( 1 ) ); - cUITextInput * Input2 = reinterpret_cast( Cell->Cell( 3 ) ); + UITextInput * Input = reinterpret_cast( Cell->Cell( 1 ) ); + UITextInput * Input2 = reinterpret_cast( Cell->Cell( 3 ) ); Input->Text( it->first ); Input2->Text( it->second ); @@ -118,7 +118,7 @@ void MapLayerProperties::LoadProperties() { } } -void MapLayerProperties::OKClick( const cUIEvent * Event ) { +void MapLayerProperties::OKClick( const UIEvent * Event ) { SaveProperties(); mLayer->Name( mUIInput->Text().ToUtf8() ); @@ -130,15 +130,15 @@ void MapLayerProperties::OKClick( const cUIEvent * Event ) { mUIWindow->CloseWindow(); } -void MapLayerProperties::CancelClick( const cUIEvent * Event ) { +void MapLayerProperties::CancelClick( const UIEvent * Event ) { mUIWindow->CloseWindow(); } -void MapLayerProperties::WindowClose( const cUIEvent * Event ) { +void MapLayerProperties::WindowClose( const UIEvent * Event ) { eeDelete( this ); } -void MapLayerProperties::AddCellClick( const cUIEvent * Event ) { +void MapLayerProperties::AddCellClick( const UIEvent * Event ) { mGenGrid->Add( CreateCell() ); Uint32 Index = mGenGrid->GetItemSelectedIndex(); @@ -148,7 +148,7 @@ void MapLayerProperties::AddCellClick( const cUIEvent * Event ) { } } -void MapLayerProperties::RemoveCellClick( const cUIEvent * Event ) { +void MapLayerProperties::RemoveCellClick( const UIEvent * Event ) { Uint32 Index = mGenGrid->GetItemSelectedIndex(); if ( eeINDEX_NOT_FOUND != Index ) { @@ -175,29 +175,29 @@ void MapLayerProperties::CreateGridElems() { } } -cUIGridCell * MapLayerProperties::CreateCell() { - cUIGridCell::CreateParams CellParams; +UIGridCell * MapLayerProperties::CreateCell() { + UIGridCell::CreateParams CellParams; CellParams.Parent( mGenGrid->Container() ); - cUITextInput::CreateParams TxtInputParams; + UITextInput::CreateParams TxtInputParams; TxtInputParams.Flags = UI_CLIP_ENABLE | UI_VALIGN_CENTER | UI_AUTO_PADDING | UI_TEXT_SELECTION_ENABLED; TxtInputParams.MaxLength = LAYER_NAME_SIZE; - cUIComplexControl::CreateParams CControl; + UIComplexControl::CreateParams CControl; - cUIGridCell * Cell = eeNew( cUIGridCell, ( CellParams ) ); - cUITextInput * TxtInput = eeNew( cUITextInput, ( TxtInputParams ) ); - cUITextInput * TxtInput2 = eeNew( cUITextInput, ( TxtInputParams ) ); + UIGridCell * Cell = eeNew( UIGridCell, ( CellParams ) ); + UITextInput * TxtInput = eeNew( UITextInput, ( TxtInputParams ) ); + UITextInput * TxtInput2 = eeNew( UITextInput, ( TxtInputParams ) ); - Cell->Cell( 0, eeNew( cUIComplexControl, ( CControl ) ) ); + Cell->Cell( 0, eeNew( UIComplexControl, ( CControl ) ) ); Cell->Cell( 1, TxtInput ); - Cell->Cell( 2, eeNew( cUIComplexControl, ( CControl ) ) ); + Cell->Cell( 2, eeNew( UIComplexControl, ( CControl ) ) ); Cell->Cell( 3, TxtInput2 ); - Cell->Cell( 4, eeNew( cUIComplexControl, ( CControl ) ) ); + Cell->Cell( 4, eeNew( UIComplexControl, ( CControl ) ) ); return Cell; } diff --git a/src/eepp/gaming/mapeditor/maplayerproperties.hpp b/src/eepp/gaming/mapeditor/maplayerproperties.hpp index 61ec73e37..2ca16a328 100644 --- a/src/eepp/gaming/mapeditor/maplayerproperties.hpp +++ b/src/eepp/gaming/mapeditor/maplayerproperties.hpp @@ -4,9 +4,9 @@ #include #include #include -#include -#include -#include +#include +#include +#include using namespace EE::UI; @@ -23,22 +23,22 @@ class EE_API MapLayerProperties { virtual ~MapLayerProperties(); protected: - cUITheme * mUITheme; - cUIWindow * mUIWindow; - cUIGenericGrid * mGenGrid; + UITheme * mUITheme; + UIWindow * mUIWindow; + UIGenericGrid * mGenGrid; MapLayer * mLayer; - cUITextInput * mUIInput; + UITextInput * mUIInput; RefreshLayerListCb mRefreshCb; - void WindowClose( const cUIEvent * Event ); + void WindowClose( const UIEvent * Event ); - void CancelClick( const cUIEvent * Event ); + void CancelClick( const UIEvent * Event ); - void OKClick( const cUIEvent * Event ); + void OKClick( const UIEvent * Event ); - void AddCellClick( const cUIEvent * Event ); + void AddCellClick( const UIEvent * Event ); - void RemoveCellClick( const cUIEvent * Event ); + void RemoveCellClick( const UIEvent * Event ); void CreateGridElems(); @@ -46,7 +46,7 @@ class EE_API MapLayerProperties { void LoadProperties(); - cUIGridCell * CreateCell(); + UIGridCell * CreateCell(); }; }}} diff --git a/src/eepp/gaming/mapeditor/mapobjectproperties.cpp b/src/eepp/gaming/mapeditor/mapobjectproperties.cpp index 82b278822..0367e43e2 100644 --- a/src/eepp/gaming/mapeditor/mapobjectproperties.cpp +++ b/src/eepp/gaming/mapeditor/mapobjectproperties.cpp @@ -14,50 +14,50 @@ MapObjectProperties::MapObjectProperties( GameObjectObject * Obj ) : return; } - mUITheme = cUIThemeManager::instance()->DefaultTheme(); + mUITheme = UIThemeManager::instance()->DefaultTheme(); if ( NULL == mUITheme ) return; mUIWindow = mUITheme->CreateWindow( NULL, Sizei( 500, 500 ), Vector2i(), UI_CONTROL_DEFAULT_FLAGS_CENTERED, UI_WIN_DEFAULT_FLAGS | UI_WIN_MODAL, Sizei( 500, 500 ) ); - mUIWindow->AddEventListener( cUIEvent::EventOnWindowClose, cb::Make1( this, &MapObjectProperties::WindowClose ) ); + mUIWindow->AddEventListener( UIEvent::EventOnWindowClose, cb::Make1( this, &MapObjectProperties::WindowClose ) ); mUIWindow->Title( "Object Properties" ); Int32 InitialY = 16; Int32 DistFromTitle = 18; - cUITextBox * Txt = mUITheme->CreateTextBox( "Object name:", mUIWindow->Container(), Sizei(), Vector2i( 50, InitialY ), UI_CONTROL_DEFAULT_FLAGS | UI_DRAW_SHADOW | UI_AUTO_SIZE ); + UITextBox * Txt = mUITheme->CreateTextBox( "Object name:", mUIWindow->Container(), Sizei(), Vector2i( 50, InitialY ), UI_CONTROL_DEFAULT_FLAGS | UI_DRAW_SHADOW | UI_AUTO_SIZE ); mUIInput = mUITheme->CreateTextInput( mUIWindow->Container(), Sizei( 120, 22 ), Vector2i( Txt->Pos().x + DistFromTitle, Txt->Pos().y + DistFromTitle ), UI_CONTROL_DEFAULT_FLAGS | UI_CLIP_ENABLE | UI_AUTO_PADDING | UI_AUTO_SIZE, true, 64 ); mUIInput->Text( mObj->Name() ); - mUIInput->AddEventListener( cUIEvent::EventOnPressEnter, cb::Make1( this, &MapObjectProperties::OKClick ) ); + mUIInput->AddEventListener( UIEvent::EventOnPressEnter, cb::Make1( this, &MapObjectProperties::OKClick ) ); - cUITextBox * Txt2 = mUITheme->CreateTextBox( "Object type:", mUIWindow->Container(), Sizei(), Vector2i( 50+192, InitialY ), UI_CONTROL_DEFAULT_FLAGS | UI_DRAW_SHADOW | UI_AUTO_SIZE ); + UITextBox * Txt2 = mUITheme->CreateTextBox( "Object type:", mUIWindow->Container(), Sizei(), Vector2i( 50+192, InitialY ), UI_CONTROL_DEFAULT_FLAGS | UI_DRAW_SHADOW | UI_AUTO_SIZE ); mUIInput2 = mUITheme->CreateTextInput( mUIWindow->Container(), Sizei( 120, 22 ), Vector2i( Txt2->Pos().x + DistFromTitle, Txt2->Pos().y + DistFromTitle ), UI_CONTROL_DEFAULT_FLAGS | UI_CLIP_ENABLE | UI_AUTO_PADDING | UI_AUTO_SIZE, true, 64 ); mUIInput2->Text( mObj->TypeName() ); - mUIInput2->AddEventListener( cUIEvent::EventOnPressEnter, cb::Make1( this, &MapObjectProperties::OKClick ) ); + mUIInput2->AddEventListener( UIEvent::EventOnPressEnter, cb::Make1( this, &MapObjectProperties::OKClick ) ); Uint32 TxtBoxFlags = UI_CONTROL_DEFAULT_FLAGS | UI_DRAW_SHADOW | UI_HALIGN_CENTER | UI_VALIGN_CENTER; mUITheme->CreateTextBox( "Property Name", mUIWindow->Container(), Sizei(192, 24), Vector2i( 50, mUIInput->Pos().y + mUIInput->Size().Height() + 12 ), TxtBoxFlags ); - cUITextBox * TxtBox = mUITheme->CreateTextBox( "Property Value", mUIWindow->Container(), Sizei(192, 24), Vector2i( 50+192, mUIInput->Pos().y + mUIInput->Size().Height() + 12 ), TxtBoxFlags ); + UITextBox * TxtBox = mUITheme->CreateTextBox( "Property Value", mUIWindow->Container(), Sizei(192, 24), Vector2i( 50+192, mUIInput->Pos().y + mUIInput->Size().Height() + 12 ), TxtBoxFlags ); - cUIPushButton * OKButton = mUITheme->CreatePushButton( mUIWindow->Container(), Sizei( 80, 22 ), Vector2i(), UI_CONTROL_DEFAULT_FLAGS_CENTERED | UI_AUTO_SIZE, mUITheme->GetIconByName( "ok" ) ); + UIPushButton * OKButton = mUITheme->CreatePushButton( mUIWindow->Container(), Sizei( 80, 22 ), Vector2i(), UI_CONTROL_DEFAULT_FLAGS_CENTERED | UI_AUTO_SIZE, mUITheme->GetIconByName( "ok" ) ); OKButton->Pos( mUIWindow->Container()->Size().Width() - OKButton->Size().Width() - 4, mUIWindow->Container()->Size().Height() - OKButton->Size().Height() - 4 ); - OKButton->AddEventListener( cUIEvent::EventMouseClick, cb::Make1( this, &MapObjectProperties::OKClick ) ); + OKButton->AddEventListener( UIEvent::EventMouseClick, cb::Make1( this, &MapObjectProperties::OKClick ) ); OKButton->Text( "OK" ); - cUIPushButton * CancelButton = mUITheme->CreatePushButton( mUIWindow->Container(), OKButton->Size(), Vector2i( OKButton->Pos().x - OKButton->Size().Width() - 4, OKButton->Pos().y ), UI_CONTROL_DEFAULT_FLAGS_CENTERED | UI_AUTO_SIZE, mUITheme->GetIconByName( "cancel" ) ); - CancelButton->AddEventListener( cUIEvent::EventMouseClick, cb::Make1( this, &MapObjectProperties::CancelClick ) ); + UIPushButton * CancelButton = mUITheme->CreatePushButton( mUIWindow->Container(), OKButton->Size(), Vector2i( OKButton->Pos().x - OKButton->Size().Width() - 4, OKButton->Pos().y ), UI_CONTROL_DEFAULT_FLAGS_CENTERED | UI_AUTO_SIZE, mUITheme->GetIconByName( "cancel" ) ); + CancelButton->AddEventListener( UIEvent::EventMouseClick, cb::Make1( this, &MapObjectProperties::CancelClick ) ); CancelButton->Text( "Cancel" ); - cUIGenericGrid::CreateParams GridParams; + UIGenericGrid::CreateParams GridParams; GridParams.Parent( mUIWindow->Container() ); GridParams.PosSet( 50, TxtBox->Pos().y + TxtBox->Size().Height() ); GridParams.SizeSet( 400, 350 ); GridParams.Flags = UI_AUTO_PADDING; GridParams.RowHeight = 24; GridParams.CollumnsCount = 5; - mGenGrid = eeNew( cUIGenericGrid, ( GridParams ) ); + mGenGrid = eeNew( UIGenericGrid, ( GridParams ) ); mGenGrid->Visible( true ); mGenGrid->Enabled( true ); mGenGrid->CollumnWidth( 0, 10 ); @@ -68,16 +68,16 @@ MapObjectProperties::MapObjectProperties( GameObjectObject * Obj ) : Vector2i Pos( mGenGrid->Pos().x + mGenGrid->Size().Width() + 10, mGenGrid->Pos().y ); - cUIPushButton * AddButton = mUITheme->CreatePushButton( mUIWindow->Container(), Sizei(24,21), Pos, UI_CONTROL_ALIGN_CENTER | UI_AUTO_SIZE | UI_ANCHOR_RIGHT | UI_ANCHOR_TOP, mUITheme->GetIconByName( "add" ) ); - AddButton->AddEventListener( cUIEvent::EventMouseClick, cb::Make1( this, &MapObjectProperties::AddCellClick ) ); + UIPushButton * AddButton = mUITheme->CreatePushButton( mUIWindow->Container(), Sizei(24,21), Pos, UI_CONTROL_ALIGN_CENTER | UI_AUTO_SIZE | UI_ANCHOR_RIGHT | UI_ANCHOR_TOP, mUITheme->GetIconByName( "add" ) ); + AddButton->AddEventListener( UIEvent::EventMouseClick, cb::Make1( this, &MapObjectProperties::AddCellClick ) ); if ( NULL == AddButton->Icon()->SubTexture() ) AddButton->Text( "+" ); Pos.y += AddButton->Size().Height() + 5; - cUIPushButton * RemoveButton = mUITheme->CreatePushButton( mUIWindow->Container(), Sizei(24,21), Pos, UI_CONTROL_ALIGN_CENTER | UI_AUTO_SIZE | UI_ANCHOR_RIGHT | UI_ANCHOR_TOP, mUITheme->GetIconByName( "remove" ) ); - RemoveButton->AddEventListener( cUIEvent::EventMouseClick, cb::Make1( this, &MapObjectProperties::RemoveCellClick ) ); + UIPushButton * RemoveButton = mUITheme->CreatePushButton( mUIWindow->Container(), Sizei(24,21), Pos, UI_CONTROL_ALIGN_CENTER | UI_AUTO_SIZE | UI_ANCHOR_RIGHT | UI_ANCHOR_TOP, mUITheme->GetIconByName( "remove" ) ); + RemoveButton->AddEventListener( UIEvent::EventMouseClick, cb::Make1( this, &MapObjectProperties::RemoveCellClick ) ); if ( NULL == RemoveButton->Icon()->SubTexture() ) RemoveButton->Text( "-" ); @@ -95,10 +95,10 @@ void MapObjectProperties::SaveProperties() { mObj->ClearProperties(); for ( Uint32 i = 0; i < mGenGrid->Count(); i++ ) { - cUIGridCell * Cell = mGenGrid->GetCell( i ); + UIGridCell * Cell = mGenGrid->GetCell( i ); - cUITextInput * Input = reinterpret_cast( Cell->Cell( 1 ) ); - cUITextInput * Input2 = reinterpret_cast( Cell->Cell( 3 ) ); + UITextInput * Input = reinterpret_cast( Cell->Cell( 1 ) ); + UITextInput * Input2 = reinterpret_cast( Cell->Cell( 3 ) ); if ( NULL != Cell && Input->Text().size() && Input2->Text().size() ) { mObj->AddProperty( Input->Text(), Input2->Text() ); @@ -110,10 +110,10 @@ void MapObjectProperties::LoadProperties() { GameObjectObject::PropertiesMap& Proper = mObj->GetProperties(); for ( GameObjectObject::PropertiesMap::iterator it = Proper.begin(); it != Proper.end(); it++ ) { - cUIGridCell * Cell = CreateCell(); + UIGridCell * Cell = CreateCell(); - cUITextInput * Input = reinterpret_cast( Cell->Cell( 1 ) ); - cUITextInput * Input2 = reinterpret_cast( Cell->Cell( 3 ) ); + UITextInput * Input = reinterpret_cast( Cell->Cell( 1 ) ); + UITextInput * Input2 = reinterpret_cast( Cell->Cell( 3 ) ); Input->Text( it->first ); Input2->Text( it->second ); @@ -122,7 +122,7 @@ void MapObjectProperties::LoadProperties() { } } -void MapObjectProperties::OKClick( const cUIEvent * Event ) { +void MapObjectProperties::OKClick( const UIEvent * Event ) { SaveProperties(); mObj->Name( mUIInput->Text().ToUtf8() ); @@ -131,15 +131,15 @@ void MapObjectProperties::OKClick( const cUIEvent * Event ) { mUIWindow->CloseWindow(); } -void MapObjectProperties::CancelClick( const cUIEvent * Event ) { +void MapObjectProperties::CancelClick( const UIEvent * Event ) { mUIWindow->CloseWindow(); } -void MapObjectProperties::WindowClose( const cUIEvent * Event ) { +void MapObjectProperties::WindowClose( const UIEvent * Event ) { eeDelete( this ); } -void MapObjectProperties::AddCellClick( const cUIEvent * Event ) { +void MapObjectProperties::AddCellClick( const UIEvent * Event ) { mGenGrid->Add( CreateCell() ); Uint32 Index = mGenGrid->GetItemSelectedIndex(); @@ -149,7 +149,7 @@ void MapObjectProperties::AddCellClick( const cUIEvent * Event ) { } } -void MapObjectProperties::RemoveCellClick( const cUIEvent * Event ) { +void MapObjectProperties::RemoveCellClick( const UIEvent * Event ) { Uint32 Index = mGenGrid->GetItemSelectedIndex(); if ( eeINDEX_NOT_FOUND != Index ) { @@ -176,29 +176,29 @@ void MapObjectProperties::CreateGridElems() { } } -cUIGridCell * MapObjectProperties::CreateCell() { - cUIGridCell::CreateParams CellParams; +UIGridCell * MapObjectProperties::CreateCell() { + UIGridCell::CreateParams CellParams; CellParams.Parent( mGenGrid->Container() ); - cUITextInput::CreateParams TxtInputParams; + UITextInput::CreateParams TxtInputParams; TxtInputParams.Flags = UI_CLIP_ENABLE | UI_VALIGN_CENTER | UI_AUTO_PADDING | UI_TEXT_SELECTION_ENABLED; TxtInputParams.MaxLength = LAYER_NAME_SIZE; - cUIComplexControl::CreateParams CControl; + UIComplexControl::CreateParams CControl; - cUIGridCell * Cell = eeNew( cUIGridCell, ( CellParams ) ); - cUITextInput * TxtInput = eeNew( cUITextInput, ( TxtInputParams ) ); - cUITextInput * TxtInput2 = eeNew( cUITextInput, ( TxtInputParams ) ); + UIGridCell * Cell = eeNew( UIGridCell, ( CellParams ) ); + UITextInput * TxtInput = eeNew( UITextInput, ( TxtInputParams ) ); + UITextInput * TxtInput2 = eeNew( UITextInput, ( TxtInputParams ) ); - Cell->Cell( 0, eeNew( cUIComplexControl, ( CControl ) ) ); + Cell->Cell( 0, eeNew( UIComplexControl, ( CControl ) ) ); Cell->Cell( 1, TxtInput ); - Cell->Cell( 2, eeNew( cUIComplexControl, ( CControl ) ) ); + Cell->Cell( 2, eeNew( UIComplexControl, ( CControl ) ) ); Cell->Cell( 3, TxtInput2 ); - Cell->Cell( 4, eeNew( cUIComplexControl, ( CControl ) ) ); + Cell->Cell( 4, eeNew( UIComplexControl, ( CControl ) ) ); return Cell; } diff --git a/src/eepp/gaming/mapeditor/mapobjectproperties.hpp b/src/eepp/gaming/mapeditor/mapobjectproperties.hpp index 4673ec8b5..7be5527c3 100644 --- a/src/eepp/gaming/mapeditor/mapobjectproperties.hpp +++ b/src/eepp/gaming/mapeditor/mapobjectproperties.hpp @@ -4,9 +4,9 @@ #include #include #include -#include -#include -#include +#include +#include +#include using namespace EE::UI; @@ -21,22 +21,22 @@ class MapObjectProperties { virtual ~MapObjectProperties(); protected: - cUITheme * mUITheme; - cUIWindow * mUIWindow; - cUIGenericGrid * mGenGrid; + UITheme * mUITheme; + UIWindow * mUIWindow; + UIGenericGrid * mGenGrid; GameObjectObject * mObj; - cUITextInput * mUIInput; - cUITextInput * mUIInput2; + UITextInput * mUIInput; + UITextInput * mUIInput2; - void WindowClose( const cUIEvent * Event ); + void WindowClose( const UIEvent * Event ); - void CancelClick( const cUIEvent * Event ); + void CancelClick( const UIEvent * Event ); - void OKClick( const cUIEvent * Event ); + void OKClick( const UIEvent * Event ); - void AddCellClick( const cUIEvent * Event ); + void AddCellClick( const UIEvent * Event ); - void RemoveCellClick( const cUIEvent * Event ); + void RemoveCellClick( const UIEvent * Event ); void CreateGridElems(); @@ -44,7 +44,7 @@ class MapObjectProperties { void LoadProperties(); - cUIGridCell * CreateCell(); + UIGridCell * CreateCell(); }; }}} diff --git a/src/eepp/gaming/mapeditor/tilemapproperties.cpp b/src/eepp/gaming/mapeditor/tilemapproperties.cpp index 3f3e684a6..f783432b0 100644 --- a/src/eepp/gaming/mapeditor/tilemapproperties.cpp +++ b/src/eepp/gaming/mapeditor/tilemapproperties.cpp @@ -13,13 +13,13 @@ TileMapProperties::TileMapProperties( TileMap * Map ) : return; } - mUITheme = cUIThemeManager::instance()->DefaultTheme(); + mUITheme = UIThemeManager::instance()->DefaultTheme(); if ( NULL == mUITheme ) return; mUIWindow = mUITheme->CreateWindow( NULL, Sizei( 500, 500 ), Vector2i(), UI_CONTROL_DEFAULT_FLAGS_CENTERED, UI_WIN_DEFAULT_FLAGS | UI_WIN_MODAL, Sizei( 500, 500 ) ); - mUIWindow->AddEventListener( cUIEvent::EventOnWindowClose, cb::Make1( this, &TileMapProperties::WindowClose ) ); + mUIWindow->AddEventListener( UIEvent::EventOnWindowClose, cb::Make1( this, &TileMapProperties::WindowClose ) ); mUIWindow->Title( "Map Properties" ); @@ -28,16 +28,16 @@ TileMapProperties::TileMapProperties( TileMap * Map ) : if ( mMap->LightsEnabled() ) { DiffIfLights = 100; - cUITextBox * Txt = mUITheme->CreateTextBox( "Map Base Color:", mUIWindow->Container(), Sizei(), Vector2i( 50, 16 ), UI_CONTROL_DEFAULT_FLAGS | UI_DRAW_SHADOW | UI_AUTO_SIZE ); + UITextBox * Txt = mUITheme->CreateTextBox( "Map Base Color:", mUIWindow->Container(), Sizei(), Vector2i( 50, 16 ), UI_CONTROL_DEFAULT_FLAGS | UI_DRAW_SHADOW | UI_AUTO_SIZE ); - cUIComplexControl::CreateParams ComParams; + UIComplexControl::CreateParams ComParams; ComParams.Parent( mUIWindow->Container() ); ComParams.PosSet( Txt->Pos().x, Txt->Pos().y + Txt->Size().Height() + 4 ); ComParams.SizeSet( 64, 64 ); ComParams.Background.Color( mMap->BaseColor() ); ComParams.Border.Color( ColorA( 100, 100, 100, 200 ) ); ComParams.Flags |= UI_FILL_BACKGROUND | UI_BORDER; - mUIBaseColor = eeNew( cUIComplexControl, ( ComParams ) ); + mUIBaseColor = eeNew( UIComplexControl, ( ComParams ) ); mUIBaseColor->Visible( true ); mUIBaseColor->Enabled( true ); @@ -45,7 +45,7 @@ TileMapProperties::TileMapProperties( TileMap * Map ) : mUIRedSlider = mUITheme->CreateSlider( mUIWindow->Container(), Sizei( 255, 20 ), Vector2i( Txt->Pos().x + Txt->Size().Width() + 16, Txt->Pos().y ), UI_CONTROL_DEFAULT_FLAGS | UI_AUTO_SIZE ); mUIRedSlider->MaxValue( 255 ); mUIRedSlider->Value( mMap->BaseColor().R() ); - mUIRedSlider->AddEventListener( cUIEvent::EventOnValueChange, cb::Make1( this, &TileMapProperties::OnRedChange ) ); + mUIRedSlider->AddEventListener( UIEvent::EventOnValueChange, cb::Make1( this, &TileMapProperties::OnRedChange ) ); mUIRedTxt = mUITheme->CreateTextBox( String::ToStr( (Uint32)mMap->BaseColor().R() ), mUIWindow->Container(), Sizei(), Vector2i( mUIRedSlider->Pos().x + mUIRedSlider->Size().Width() + 4, mUIRedSlider->Pos().y ), UI_CONTROL_DEFAULT_FLAGS | UI_DRAW_SHADOW | UI_AUTO_SIZE ); @@ -53,7 +53,7 @@ TileMapProperties::TileMapProperties( TileMap * Map ) : mUIGreenSlider = mUITheme->CreateSlider( mUIWindow->Container(), Sizei( 255, 20 ), Vector2i( mUIRedSlider->Pos().x, Txt->Pos().y ), UI_CONTROL_DEFAULT_FLAGS | UI_AUTO_SIZE ); mUIGreenSlider->MaxValue( 255 ); mUIGreenSlider->Value( mMap->BaseColor().G() ); - mUIGreenSlider->AddEventListener( cUIEvent::EventOnValueChange, cb::Make1( this, &TileMapProperties::OnGreenChange ) ); + mUIGreenSlider->AddEventListener( UIEvent::EventOnValueChange, cb::Make1( this, &TileMapProperties::OnGreenChange ) ); mUIGreenTxt = mUITheme->CreateTextBox( String::ToStr( (Uint32)mMap->BaseColor().G() ), mUIWindow->Container(), Sizei(), Vector2i( mUIGreenSlider->Pos().x + mUIGreenSlider->Size().Width() + 4, mUIGreenSlider->Pos().y ), UI_CONTROL_DEFAULT_FLAGS | UI_DRAW_SHADOW | UI_AUTO_SIZE ); @@ -61,33 +61,33 @@ TileMapProperties::TileMapProperties( TileMap * Map ) : mUIBlueSlider = mUITheme->CreateSlider( mUIWindow->Container(), Sizei( 255, 20 ), Vector2i( mUIRedSlider->Pos().x, Txt->Pos().y ), UI_CONTROL_DEFAULT_FLAGS | UI_AUTO_SIZE ); mUIBlueSlider->MaxValue( 255 ); mUIBlueSlider->Value( mMap->BaseColor().B() ); - mUIBlueSlider->AddEventListener( cUIEvent::EventOnValueChange, cb::Make1( this, &TileMapProperties::OnBlueChange ) ); + mUIBlueSlider->AddEventListener( UIEvent::EventOnValueChange, cb::Make1( this, &TileMapProperties::OnBlueChange ) ); mUIBlueTxt = mUITheme->CreateTextBox( String::ToStr( (Uint32)mMap->BaseColor().B() ), mUIWindow->Container(), Sizei(), Vector2i( mUIBlueSlider->Pos().x + mUIBlueSlider->Size().Width() + 4, mUIBlueSlider->Pos().y ), UI_CONTROL_DEFAULT_FLAGS | UI_DRAW_SHADOW | UI_AUTO_SIZE ); } Uint32 TxtBoxFlags = UI_CONTROL_DEFAULT_FLAGS | UI_DRAW_SHADOW | UI_HALIGN_CENTER | UI_VALIGN_CENTER; - cUITextBox * TxtBox = mUITheme->CreateTextBox( "Property Name", mUIWindow->Container(), Sizei(192, 24), Vector2i( 50, 10 + DiffIfLights ), TxtBoxFlags ); + UITextBox * TxtBox = mUITheme->CreateTextBox( "Property Name", mUIWindow->Container(), Sizei(192, 24), Vector2i( 50, 10 + DiffIfLights ), TxtBoxFlags ); mUITheme->CreateTextBox( "Property Value", mUIWindow->Container(), Sizei(192, 24), Vector2i(50+192, TxtBox->Pos().y ), TxtBoxFlags ); - cUIPushButton * OKButton = mUITheme->CreatePushButton( mUIWindow->Container(), Sizei( 80, 22 ), Vector2i(), UI_CONTROL_DEFAULT_FLAGS_CENTERED | UI_AUTO_SIZE, mUITheme->GetIconByName( "ok" ) ); + UIPushButton * OKButton = mUITheme->CreatePushButton( mUIWindow->Container(), Sizei( 80, 22 ), Vector2i(), UI_CONTROL_DEFAULT_FLAGS_CENTERED | UI_AUTO_SIZE, mUITheme->GetIconByName( "ok" ) ); OKButton->Pos( mUIWindow->Container()->Size().Width() - OKButton->Size().Width() - 4, mUIWindow->Container()->Size().Height() - OKButton->Size().Height() - 4 ); - OKButton->AddEventListener( cUIEvent::EventMouseClick, cb::Make1( this, &TileMapProperties::OKClick ) ); + OKButton->AddEventListener( UIEvent::EventMouseClick, cb::Make1( this, &TileMapProperties::OKClick ) ); OKButton->Text( "OK" ); - cUIPushButton * CancelButton = mUITheme->CreatePushButton( mUIWindow->Container(), OKButton->Size(), Vector2i( OKButton->Pos().x - OKButton->Size().Width() - 4, OKButton->Pos().y ), UI_CONTROL_DEFAULT_FLAGS_CENTERED | UI_AUTO_SIZE, mUITheme->GetIconByName( "cancel" ) ); - CancelButton->AddEventListener( cUIEvent::EventMouseClick, cb::Make1( this, &TileMapProperties::CancelClick ) ); + UIPushButton * CancelButton = mUITheme->CreatePushButton( mUIWindow->Container(), OKButton->Size(), Vector2i( OKButton->Pos().x - OKButton->Size().Width() - 4, OKButton->Pos().y ), UI_CONTROL_DEFAULT_FLAGS_CENTERED | UI_AUTO_SIZE, mUITheme->GetIconByName( "cancel" ) ); + CancelButton->AddEventListener( UIEvent::EventMouseClick, cb::Make1( this, &TileMapProperties::CancelClick ) ); CancelButton->Text( "Cancel" ); - cUIGenericGrid::CreateParams GridParams; + UIGenericGrid::CreateParams GridParams; GridParams.Parent( mUIWindow->Container() ); GridParams.PosSet( 50, TxtBox->Pos().y + 20 ); GridParams.SizeSet( 400, 400 - DiffIfLights ); GridParams.Flags = UI_AUTO_PADDING; GridParams.RowHeight = 24; GridParams.CollumnsCount = 5; - mGenGrid = eeNew( cUIGenericGrid, ( GridParams ) ); + mGenGrid = eeNew( UIGenericGrid, ( GridParams ) ); mGenGrid->Visible( true ); mGenGrid->Enabled( true ); mGenGrid->CollumnWidth( 0, 10 ); @@ -98,16 +98,16 @@ TileMapProperties::TileMapProperties( TileMap * Map ) : Vector2i Pos( mGenGrid->Pos().x + mGenGrid->Size().Width() + 10, mGenGrid->Pos().y ); - cUIPushButton * AddButton = mUITheme->CreatePushButton( mUIWindow->Container(), Sizei(24,21), Pos, UI_CONTROL_ALIGN_CENTER | UI_AUTO_SIZE | UI_ANCHOR_RIGHT | UI_ANCHOR_TOP, mUITheme->GetIconByName( "add" ) ); - AddButton->AddEventListener( cUIEvent::EventMouseClick, cb::Make1( this, &TileMapProperties::AddCellClick ) ); + UIPushButton * AddButton = mUITheme->CreatePushButton( mUIWindow->Container(), Sizei(24,21), Pos, UI_CONTROL_ALIGN_CENTER | UI_AUTO_SIZE | UI_ANCHOR_RIGHT | UI_ANCHOR_TOP, mUITheme->GetIconByName( "add" ) ); + AddButton->AddEventListener( UIEvent::EventMouseClick, cb::Make1( this, &TileMapProperties::AddCellClick ) ); if ( NULL == AddButton->Icon()->SubTexture() ) AddButton->Text( "+" ); Pos.y += AddButton->Size().Height() + 5; - cUIPushButton * RemoveButton = mUITheme->CreatePushButton( mUIWindow->Container(), Sizei(24,21), Pos, UI_CONTROL_ALIGN_CENTER | UI_AUTO_SIZE | UI_ANCHOR_RIGHT | UI_ANCHOR_TOP, mUITheme->GetIconByName( "remove" ) ); - RemoveButton->AddEventListener( cUIEvent::EventMouseClick, cb::Make1( this, &TileMapProperties::RemoveCellClick ) ); + UIPushButton * RemoveButton = mUITheme->CreatePushButton( mUIWindow->Container(), Sizei(24,21), Pos, UI_CONTROL_ALIGN_CENTER | UI_AUTO_SIZE | UI_ANCHOR_RIGHT | UI_ANCHOR_TOP, mUITheme->GetIconByName( "remove" ) ); + RemoveButton->AddEventListener( UIEvent::EventMouseClick, cb::Make1( this, &TileMapProperties::RemoveCellClick ) ); if ( NULL == RemoveButton->Icon()->SubTexture() ) RemoveButton->Text( "-" ); @@ -121,7 +121,7 @@ TileMapProperties::TileMapProperties( TileMap * Map ) : TileMapProperties::~TileMapProperties() { } -void TileMapProperties::OnRedChange( const cUIEvent * Event ) { +void TileMapProperties::OnRedChange( const UIEvent * Event ) { ColorA Col = mUIBaseColor->Background()->Color(); Col.Red = (Uint8)mUIRedSlider->Value(); mUIBaseColor->Background()->Color( Col ); @@ -132,7 +132,7 @@ void TileMapProperties::OnRedChange( const cUIEvent * Event ) { mMap->BaseColor( MapCol ); } -void TileMapProperties::OnGreenChange( const cUIEvent * Event ) { +void TileMapProperties::OnGreenChange( const UIEvent * Event ) { ColorA Col = mUIBaseColor->Background()->Color(); Col.Green = (Uint8)mUIGreenSlider->Value(); mUIBaseColor->Background()->Color( Col ); @@ -143,7 +143,7 @@ void TileMapProperties::OnGreenChange( const cUIEvent * Event ) { mMap->BaseColor( MapCol ); } -void TileMapProperties::OnBlueChange( const cUIEvent * Event ) { +void TileMapProperties::OnBlueChange( const UIEvent * Event ) { ColorA Col = mUIBaseColor->Background()->Color(); Col.Blue = (Uint8)mUIBlueSlider->Value(); mUIBaseColor->Background()->Color( Col ); @@ -159,10 +159,10 @@ void TileMapProperties::SaveProperties() { mMap->ClearProperties(); for ( Uint32 i = 0; i < mGenGrid->Count(); i++ ) { - cUIGridCell * Cell = mGenGrid->GetCell( i ); + UIGridCell * Cell = mGenGrid->GetCell( i ); - cUITextInput * Input = reinterpret_cast( Cell->Cell( 1 ) ); - cUITextInput * Input2 = reinterpret_cast( Cell->Cell( 3 ) ); + UITextInput * Input = reinterpret_cast( Cell->Cell( 1 ) ); + UITextInput * Input2 = reinterpret_cast( Cell->Cell( 3 ) ); if ( NULL != Cell && Input->Text().size() && Input2->Text().size() ) { mMap->AddProperty( Input->Text(), Input2->Text() ); @@ -174,10 +174,10 @@ void TileMapProperties::LoadProperties() { TileMap::PropertiesMap& Proper = mMap->GetProperties(); for ( TileMap::PropertiesMap::iterator it = Proper.begin(); it != Proper.end(); it++ ) { - cUIGridCell * Cell = CreateCell(); + UIGridCell * Cell = CreateCell(); - cUITextInput * Input = reinterpret_cast( Cell->Cell( 1 ) ); - cUITextInput * Input2 = reinterpret_cast( Cell->Cell( 3 ) ); + UITextInput * Input = reinterpret_cast( Cell->Cell( 1 ) ); + UITextInput * Input2 = reinterpret_cast( Cell->Cell( 3 ) ); Input->Text( it->first ); Input2->Text( it->second ); @@ -186,21 +186,21 @@ void TileMapProperties::LoadProperties() { } } -void TileMapProperties::OKClick( const cUIEvent * Event ) { +void TileMapProperties::OKClick( const UIEvent * Event ) { SaveProperties(); mUIWindow->CloseWindow(); } -void TileMapProperties::CancelClick( const cUIEvent * Event ) { +void TileMapProperties::CancelClick( const UIEvent * Event ) { mUIWindow->CloseWindow(); } -void TileMapProperties::WindowClose( const cUIEvent * Event ) { +void TileMapProperties::WindowClose( const UIEvent * Event ) { eeDelete( this ); } -void TileMapProperties::AddCellClick( const cUIEvent * Event ) { +void TileMapProperties::AddCellClick( const UIEvent * Event ) { mGenGrid->Add( CreateCell() ); Uint32 Index = mGenGrid->GetItemSelectedIndex(); @@ -210,7 +210,7 @@ void TileMapProperties::AddCellClick( const cUIEvent * Event ) { } } -void TileMapProperties::RemoveCellClick( const cUIEvent * Event ) { +void TileMapProperties::RemoveCellClick( const UIEvent * Event ) { Uint32 Index = mGenGrid->GetItemSelectedIndex(); if ( eeINDEX_NOT_FOUND != Index ) { @@ -237,29 +237,29 @@ void TileMapProperties::CreateGridElems() { } } -cUIGridCell * TileMapProperties::CreateCell() { - cUIGridCell::CreateParams CellParams; +UIGridCell * TileMapProperties::CreateCell() { + UIGridCell::CreateParams CellParams; CellParams.Parent( mGenGrid->Container() ); - cUITextInput::CreateParams TxtInputParams; + UITextInput::CreateParams TxtInputParams; TxtInputParams.Flags = UI_CLIP_ENABLE | UI_VALIGN_CENTER | UI_AUTO_PADDING | UI_TEXT_SELECTION_ENABLED; TxtInputParams.MaxLength = LAYER_NAME_SIZE; - cUIComplexControl::CreateParams CControl; + UIComplexControl::CreateParams CControl; - cUIGridCell * Cell = eeNew( cUIGridCell, ( CellParams ) ); - cUITextInput * TxtInput = eeNew( cUITextInput, ( TxtInputParams ) ); - cUITextInput * TxtInput2 = eeNew( cUITextInput, ( TxtInputParams ) ); + UIGridCell * Cell = eeNew( UIGridCell, ( CellParams ) ); + UITextInput * TxtInput = eeNew( UITextInput, ( TxtInputParams ) ); + UITextInput * TxtInput2 = eeNew( UITextInput, ( TxtInputParams ) ); - Cell->Cell( 0, eeNew( cUIComplexControl, ( CControl ) ) ); + Cell->Cell( 0, eeNew( UIComplexControl, ( CControl ) ) ); Cell->Cell( 1, TxtInput ); - Cell->Cell( 2, eeNew( cUIComplexControl, ( CControl ) ) ); + Cell->Cell( 2, eeNew( UIComplexControl, ( CControl ) ) ); Cell->Cell( 3, TxtInput2 ); - Cell->Cell( 4, eeNew( cUIComplexControl, ( CControl ) ) ); + Cell->Cell( 4, eeNew( UIComplexControl, ( CControl ) ) ); return Cell; } diff --git a/src/eepp/gaming/mapeditor/tilemapproperties.hpp b/src/eepp/gaming/mapeditor/tilemapproperties.hpp index 00526f323..550a30cce 100644 --- a/src/eepp/gaming/mapeditor/tilemapproperties.hpp +++ b/src/eepp/gaming/mapeditor/tilemapproperties.hpp @@ -3,10 +3,10 @@ #include #include -#include -#include -#include -#include +#include +#include +#include +#include using namespace EE::UI; @@ -19,33 +19,33 @@ class EE_API TileMapProperties { virtual ~TileMapProperties(); protected: - cUITheme * mUITheme; - cUIWindow * mUIWindow; - cUIGenericGrid * mGenGrid; + UITheme * mUITheme; + UIWindow * mUIWindow; + UIGenericGrid * mGenGrid; TileMap * mMap; - cUIComplexControl * mUIBaseColor; - cUISlider * mUIRedSlider; - cUISlider * mUIGreenSlider; - cUISlider * mUIBlueSlider; - cUITextBox * mUIRedTxt; - cUITextBox * mUIGreenTxt; - cUITextBox * mUIBlueTxt; + UIComplexControl * mUIBaseColor; + UISlider * mUIRedSlider; + UISlider * mUIGreenSlider; + UISlider * mUIBlueSlider; + UITextBox * mUIRedTxt; + UITextBox * mUIGreenTxt; + UITextBox * mUIBlueTxt; - void WindowClose( const cUIEvent * Event ); + void WindowClose( const UIEvent * Event ); - void CancelClick( const cUIEvent * Event ); + void CancelClick( const UIEvent * Event ); - void OKClick( const cUIEvent * Event ); + void OKClick( const UIEvent * Event ); - void AddCellClick( const cUIEvent * Event ); + void AddCellClick( const UIEvent * Event ); - void RemoveCellClick( const cUIEvent * Event ); + void RemoveCellClick( const UIEvent * Event ); - void OnRedChange( const cUIEvent * Event ); + void OnRedChange( const UIEvent * Event ); - void OnGreenChange( const cUIEvent * Event ); + void OnGreenChange( const UIEvent * Event ); - void OnBlueChange( const cUIEvent * Event ); + void OnBlueChange( const UIEvent * Event ); void CreateGridElems(); @@ -53,7 +53,7 @@ class EE_API TileMapProperties { void LoadProperties(); - cUIGridCell * CreateCell(); + UIGridCell * CreateCell(); }; }}} diff --git a/src/eepp/gaming/mapeditor/uigotypenew.cpp b/src/eepp/gaming/mapeditor/uigotypenew.cpp index af917df5e..230d703e6 100644 --- a/src/eepp/gaming/mapeditor/uigotypenew.cpp +++ b/src/eepp/gaming/mapeditor/uigotypenew.cpp @@ -1,5 +1,5 @@ #include -#include +#include namespace EE { namespace Gaming { namespace Private { @@ -9,31 +9,31 @@ UIGOTypeNew::UIGOTypeNew( cb::Callback2 Cb ) : mUIInput( NULL ), mCb( Cb ) { - mUITheme = cUIThemeManager::instance()->DefaultTheme(); + mUITheme = UIThemeManager::instance()->DefaultTheme(); if ( NULL == mUITheme ) return; mUIWindow = mUITheme->CreateWindow( NULL, Sizei( 278, 114 ), Vector2i(), UI_CONTROL_DEFAULT_FLAGS_CENTERED, UI_WIN_DEFAULT_FLAGS | UI_WIN_MODAL, Sizei( 278, 114 ) ); - mUIWindow->AddEventListener( cUIEvent::EventOnWindowClose, cb::Make1( this, &UIGOTypeNew::WindowClose ) ); + mUIWindow->AddEventListener( UIEvent::EventOnWindowClose, cb::Make1( this, &UIGOTypeNew::WindowClose ) ); mUIWindow->Title( "Add GameObject Type" ); Int32 InitialY = 16; Int32 DistFromTitle = 18; - cUITextBox * Txt = mUITheme->CreateTextBox( "GameObject Type Name", mUIWindow->Container(), Sizei(), Vector2i( 16, InitialY ), UI_CONTROL_DEFAULT_FLAGS | UI_DRAW_SHADOW | UI_AUTO_SIZE ); + UITextBox * Txt = mUITheme->CreateTextBox( "GameObject Type Name", mUIWindow->Container(), Sizei(), Vector2i( 16, InitialY ), UI_CONTROL_DEFAULT_FLAGS | UI_DRAW_SHADOW | UI_AUTO_SIZE ); mUIInput = mUITheme->CreateTextInput( mUIWindow->Container(), Sizei( 120, 22 ), Vector2i( Txt->Pos().x + DistFromTitle, Txt->Pos().y + DistFromTitle ), UI_CONTROL_DEFAULT_FLAGS | UI_CLIP_ENABLE | UI_AUTO_PADDING | UI_AUTO_SIZE, true, 64 ); - cUIPushButton * OKButton = mUITheme->CreatePushButton( mUIWindow->Container(), Sizei( 80, 22 ), Vector2i(), UI_CONTROL_DEFAULT_FLAGS_CENTERED | UI_AUTO_SIZE, mUITheme->GetIconByName( "add" ) ); + UIPushButton * OKButton = mUITheme->CreatePushButton( mUIWindow->Container(), Sizei( 80, 22 ), Vector2i(), UI_CONTROL_DEFAULT_FLAGS_CENTERED | UI_AUTO_SIZE, mUITheme->GetIconByName( "add" ) ); OKButton->Pos( mUIWindow->Container()->Size().Width() - OKButton->Size().Width() - 4, mUIWindow->Container()->Size().Height() - OKButton->Size().Height() - 4 ); - OKButton->AddEventListener( cUIEvent::EventMouseClick, cb::Make1( this, &UIGOTypeNew::OKClick ) ); - mUIInput->AddEventListener( cUIEvent::EventOnPressEnter, cb::Make1( this, &UIGOTypeNew::OKClick ) ); + OKButton->AddEventListener( UIEvent::EventMouseClick, cb::Make1( this, &UIGOTypeNew::OKClick ) ); + mUIInput->AddEventListener( UIEvent::EventOnPressEnter, cb::Make1( this, &UIGOTypeNew::OKClick ) ); OKButton->Text( "Add" ); - cUIPushButton * CancelButton = mUITheme->CreatePushButton( mUIWindow->Container(), OKButton->Size(), Vector2i( OKButton->Pos().x - OKButton->Size().Width() - 4, OKButton->Pos().y ), UI_CONTROL_DEFAULT_FLAGS_CENTERED | UI_AUTO_SIZE, mUITheme->GetIconByName( "cancel" ) ); - CancelButton->AddEventListener( cUIEvent::EventMouseClick, cb::Make1( this, &UIGOTypeNew::CancelClick ) ); + UIPushButton * CancelButton = mUITheme->CreatePushButton( mUIWindow->Container(), OKButton->Size(), Vector2i( OKButton->Pos().x - OKButton->Size().Width() - 4, OKButton->Pos().y ), UI_CONTROL_DEFAULT_FLAGS_CENTERED | UI_AUTO_SIZE, mUITheme->GetIconByName( "cancel" ) ); + CancelButton->AddEventListener( UIEvent::EventMouseClick, cb::Make1( this, &UIGOTypeNew::CancelClick ) ); CancelButton->Text( "Cancel" ); mUIWindow->Center(); @@ -46,7 +46,7 @@ UIGOTypeNew::~UIGOTypeNew() { } -void UIGOTypeNew::OKClick( const cUIEvent * Event ) { +void UIGOTypeNew::OKClick( const UIEvent * Event ) { if ( mUIInput->Text().size() ) { if ( mCb.IsSet() ) mCb( mUIInput->Text().ToUtf8(), String::Hash( mUIInput->Text().ToUtf8() ) ); @@ -55,11 +55,11 @@ void UIGOTypeNew::OKClick( const cUIEvent * Event ) { mUIWindow->CloseWindow(); } -void UIGOTypeNew::CancelClick( const cUIEvent * Event ) { +void UIGOTypeNew::CancelClick( const UIEvent * Event ) { mUIWindow->CloseWindow(); } -void UIGOTypeNew::WindowClose( const cUIEvent * Event ) { +void UIGOTypeNew::WindowClose( const UIEvent * Event ) { eeDelete( this ); } diff --git a/src/eepp/gaming/mapeditor/uigotypenew.hpp b/src/eepp/gaming/mapeditor/uigotypenew.hpp index 253744191..a09538cf5 100644 --- a/src/eepp/gaming/mapeditor/uigotypenew.hpp +++ b/src/eepp/gaming/mapeditor/uigotypenew.hpp @@ -2,7 +2,7 @@ #define EE_GAMINGCUIGOTYPENEW_HPP #include -#include +#include using namespace EE::UI; @@ -14,16 +14,16 @@ class EE_API UIGOTypeNew { virtual ~UIGOTypeNew(); protected: - cUITheme * mUITheme; - cUIWindow * mUIWindow; - cUITextInput * mUIInput; + UITheme * mUITheme; + UIWindow * mUIWindow; + UITextInput * mUIInput; cb::Callback2 mCb; - void WindowClose( const cUIEvent * Event ); + void WindowClose( const UIEvent * Event ); - void CancelClick( const cUIEvent * Event ); + void CancelClick( const UIEvent * Event ); - void OKClick( const cUIEvent * Event ); + void OKClick( const UIEvent * Event ); }; }}} diff --git a/src/eepp/gaming/mapeditor/uimap.cpp b/src/eepp/gaming/mapeditor/uimap.cpp index b53b7ccd7..08a29934e 100644 --- a/src/eepp/gaming/mapeditor/uimap.cpp +++ b/src/eepp/gaming/mapeditor/uimap.cpp @@ -2,13 +2,13 @@ #include #include #include -#include -#include +#include +#include namespace EE { namespace Gaming { namespace Private { -UIMap::UIMap( const cUIComplexControl::CreateParams& Params, cUITheme * Theme, TileMap * Map ) : - cUIComplexControl( Params ), +UIMap::UIMap( const UIComplexControl::CreateParams& Params, UITheme * Theme, TileMap * Map ) : + UIComplexControl( Params ), mMap( Map ), mCurLayer( NULL ), mEditingMode( 0 ), @@ -77,7 +77,7 @@ TileMap * UIMap::Map() const { } void UIMap::Draw() { - cUIComplexControl::Draw(); + UIComplexControl::Draw(); if ( NULL != mMap ) { mMap->Draw(); @@ -85,7 +85,7 @@ void UIMap::Draw() { } void UIMap::UpdateScreenPos() { - cUIComplexControl::UpdateScreenPos(); + UIComplexControl::UpdateScreenPos(); if ( NULL != mMap ) { mMap->Position( mScreenPos ); @@ -93,13 +93,13 @@ void UIMap::UpdateScreenPos() { } void UIMap::Update() { - cUIComplexControl::Update(); + UIComplexControl::Update(); if ( NULL != mMap ) { mMap->Update(); if ( mEnabled && mVisible && IsMouseOver() ) { - Uint32 Flags = cUIManager::instance()->GetInput()->ClickTrigger(); + Uint32 Flags = UIManager::instance()->GetInput()->ClickTrigger(); if ( EDITING_LIGHT == mEditingMode ) { if ( NULL != mSelLight ) { @@ -134,7 +134,7 @@ void UIMap::Update() { } } - Flags = cUIManager::instance()->GetInput()->PressTrigger(); + Flags = UIManager::instance()->GetInput()->PressTrigger(); if ( Flags & EE_BUTTON_MMASK ) { mSelLight->Position( mMap->GetMouseMapPosf() ); @@ -220,8 +220,8 @@ void UIMap::DragPoly( Uint32 Flags, Uint32 PFlags ) { } void UIMap::ManageObject( Uint32 Flags ) { - Uint32 PFlags = cUIManager::instance()->GetInput()->PressTrigger(); - Uint32 LPFlags = cUIManager::instance()->GetInput()->LastPressTrigger(); + Uint32 PFlags = UIManager::instance()->GetInput()->PressTrigger(); + Uint32 LPFlags = UIManager::instance()->GetInput()->LastPressTrigger(); switch ( mEditingObjMode ) { @@ -322,7 +322,7 @@ void UIMap::OnSizeChange() { mMap->ViewSize( mSize ); } - cUIComplexControl::OnSizeChange(); + UIComplexControl::OnSizeChange(); } Uint32 UIMap::OnMouseMove( const Vector2i& Pos, const Uint32 Flags ) { @@ -341,7 +341,7 @@ Uint32 UIMap::OnMouseMove( const Vector2i& Pos, const Uint32 Flags ) { } } - return cUIComplexControl::OnMouseMove( Pos, Flags ); + return UIComplexControl::OnMouseMove( Pos, Flags ); } void UIMap::AddLight( MapLight * Light ) { @@ -498,7 +498,7 @@ void UIMap::ClearLights() { } void UIMap::OnAlphaChange() { - cUIComplexControl::OnAlphaChange(); + UIComplexControl::OnAlphaChange(); if ( NULL != mMap ) { mMap->BackAlpha( (Uint8)mAlpha ); @@ -532,8 +532,8 @@ void UIMap::SetUpdateScrollCb( UpdateScrollCb Cb ) { mUpdateScrollCb = Cb; } -Uint32 UIMap::OnMessage( const cUIMessage * Msg ) { - if ( Msg->Msg() == cUIMessage::MsgClick && Msg->Sender() == this && ( Msg->Flags() & EE_BUTTON_RMASK ) ) { +Uint32 UIMap::OnMessage( const UIMessage * Msg ) { + if ( Msg->Msg() == UIMessage::MsgClick && Msg->Sender() == this && ( Msg->Flags() & EE_BUTTON_RMASK ) ) { if ( SELECT_OBJECTS == mEditingObjMode && NULL != mSelObj && mSelObj->PointInside( mMap->GetMouseMapPosf() ) ) { CreateObjPopUpMenu(); } @@ -542,12 +542,12 @@ Uint32 UIMap::OnMessage( const cUIMessage * Msg ) { return 0; } -void UIMap::ObjItemClick( const cUIEvent * Event ) { +void UIMap::ObjItemClick( const UIEvent * Event ) { if ( !Event->Ctrl()->IsType( UI_TYPE_MENUITEM ) ) return; if ( NULL != mSelObj && NULL != mCurLayer && mCurLayer->Type() == MAP_LAYER_OBJECT && mSelObj->Layer() == mCurLayer ) { - const String& txt = reinterpret_cast ( Event->Ctrl() )->Text(); + const String& txt = reinterpret_cast ( Event->Ctrl() )->Text(); MapObjectLayer * tLayer = reinterpret_cast( mCurLayer ); @@ -565,22 +565,22 @@ void UIMap::ObjItemClick( const cUIEvent * Event ) { } void UIMap::CreateObjPopUpMenu() { - cUIPopUpMenu * Menu = mTheme->CreatePopUpMenu(); + UIPopUpMenu * Menu = mTheme->CreatePopUpMenu(); Menu->Add( "Duplicate Object" ); Menu->Add( "Remove Object" ); Menu->AddSeparator(); Menu->Add( "Object Properties..." ); - Menu->AddEventListener( cUIEvent::EventOnItemClicked, cb::Make1( this, &UIMap::ObjItemClick ) ); + Menu->AddEventListener( UIEvent::EventOnItemClicked, cb::Make1( this, &UIMap::ObjItemClick ) ); if ( Menu->Show() ) { - Vector2i Pos = cUIManager::instance()->GetInput()->GetMousePos(); - cUIMenu::FixMenuPos( Pos , Menu ); + Vector2i Pos = UIManager::instance()->GetInput()->GetMousePos(); + UIMenu::FixMenuPos( Pos , Menu ); Menu->Pos( Pos ); } } -void UIMap::SetTileBox( cUITextBox * tilebox ) { +void UIMap::SetTileBox( UITextBox * tilebox ) { mTileBox = tilebox; } diff --git a/src/eepp/gaming/mapeditor/uimap.hpp b/src/eepp/gaming/mapeditor/uimap.hpp index 4f5faf382..da7b9de5e 100644 --- a/src/eepp/gaming/mapeditor/uimap.hpp +++ b/src/eepp/gaming/mapeditor/uimap.hpp @@ -2,9 +2,9 @@ #define EE_GAMINGCUIMAP_HPP #include -#include -#include -#include +#include +#include +#include #include #include #include @@ -18,7 +18,7 @@ class GameObjectObject; namespace Private { -class EE_API UIMap : public cUIComplexControl { +class EE_API UIMap : public UIComplexControl { public: enum EDITING_OBJ_MODE { SELECT_OBJECTS, @@ -31,11 +31,11 @@ class EE_API UIMap : public cUIComplexControl { typedef cb::Callback1 LightSelectCb; typedef cb::Callback1 LightRadiusChangeCb; typedef cb::Callback2 ObjAddCb; - typedef cb::Callback2 AlertCb; + typedef cb::Callback2 AlertCb; typedef cb::Callback0 OnMapLoadCb; typedef cb::Callback0 UpdateScrollCb; - UIMap( const cUIComplexControl::CreateParams& Params, cUITheme * Theme, TileMap * Map = NULL ); + UIMap( const UIComplexControl::CreateParams& Params, UITheme * Theme, TileMap * Map = NULL ); virtual ~UIMap(); @@ -83,7 +83,7 @@ class EE_API UIMap : public cUIComplexControl { void CreateObjPopUpMenu(); - void SetTileBox( cUITextBox * tilebox ); + void SetTileBox( UITextBox * tilebox ); void ReplaceMap( TileMap * newMap ); protected: @@ -120,18 +120,18 @@ class EE_API UIMap : public cUIComplexControl { Vector2f mObjDragDist; AlertCb mAlertCb; - cUITheme * mTheme; + UITheme * mTheme; Uint32 mSelPointIndex; Rectf mSelPointRect; bool mSelPoint; - cUITextBox * mTileBox; + UITextBox * mTileBox; Vector2i mLastMouseTilePos; UpdateScrollCb mUpdateScrollCb; - virtual Uint32 OnMessage( const cUIMessage * Msg ); + virtual Uint32 OnMessage( const UIMessage * Msg ); virtual Uint32 OnMouseMove( const Vector2i& Pos, const Uint32 Flags ); @@ -143,7 +143,7 @@ class EE_API UIMap : public cUIComplexControl { virtual Uint32 OnDrag( const Vector2i& Pos ); - void ObjItemClick( const cUIEvent * Event ); + void ObjItemClick( const UIEvent * Event ); void MapDraw(); diff --git a/src/eepp/gaming/mapeditor/uimaplayernew.cpp b/src/eepp/gaming/mapeditor/uimaplayernew.cpp index dd03e5c08..c5361f6bc 100644 --- a/src/eepp/gaming/mapeditor/uimaplayernew.cpp +++ b/src/eepp/gaming/mapeditor/uimaplayernew.cpp @@ -1,5 +1,5 @@ #include -#include +#include namespace EE { namespace Gaming { namespace Private { @@ -11,13 +11,13 @@ UIMapLayerNew::UIMapLayerNew( UIMap * Map, EE_LAYER_TYPE Type, NewLayerCb newLay mUIWindow( NULL ), mLayer( NULL ) { - mTheme = cUIThemeManager::instance()->DefaultTheme(); + mTheme = UIThemeManager::instance()->DefaultTheme(); if ( NULL == mTheme ) return; mUIWindow = mTheme->CreateWindow( NULL, Sizei( 278, 114 ), Vector2i(), UI_CONTROL_DEFAULT_FLAGS_CENTERED, UI_WIN_DEFAULT_FLAGS | UI_WIN_MODAL, Sizei( 278, 114 ) ); - mUIWindow->AddEventListener( cUIEvent::EventOnWindowClose, cb::Make1( this, &UIMapLayerNew::WindowClose ) ); + mUIWindow->AddEventListener( UIEvent::EventOnWindowClose, cb::Make1( this, &UIMapLayerNew::WindowClose ) ); if ( MAP_LAYER_TILED == mType ) mUIWindow->Title( "New Tile Layer" ); @@ -27,23 +27,23 @@ UIMapLayerNew::UIMapLayerNew( UIMap * Map, EE_LAYER_TYPE Type, NewLayerCb newLay Int32 InitialY = 16; Int32 DistFromTitle = 18; - cUITextBox * Txt = mTheme->CreateTextBox( "Layer Name", mUIWindow->Container(), Sizei(), Vector2i( 16, InitialY ), UI_CONTROL_DEFAULT_FLAGS | UI_DRAW_SHADOW | UI_AUTO_SIZE ); + UITextBox * Txt = mTheme->CreateTextBox( "Layer Name", mUIWindow->Container(), Sizei(), Vector2i( 16, InitialY ), UI_CONTROL_DEFAULT_FLAGS | UI_DRAW_SHADOW | UI_AUTO_SIZE ); mUILayerName = mTheme->CreateTextInput( mUIWindow->Container(), Sizei( 120, 22 ), Vector2i( Txt->Pos().x + DistFromTitle, Txt->Pos().y + DistFromTitle ), UI_CONTROL_DEFAULT_FLAGS | UI_CLIP_ENABLE | UI_AUTO_PADDING | UI_AUTO_SIZE, true, 64 ); mUILayerName->Text( "Layer " + String::ToStr( mUIMap->Map()->LayerCount() + 1 ) ); - cUIPushButton * OKButton = mTheme->CreatePushButton( mUIWindow->Container(), Sizei( 80, 22 ), Vector2i(), UI_CONTROL_DEFAULT_FLAGS_CENTERED | UI_AUTO_SIZE, mTheme->GetIconByName( "add" ) ); + UIPushButton * OKButton = mTheme->CreatePushButton( mUIWindow->Container(), Sizei( 80, 22 ), Vector2i(), UI_CONTROL_DEFAULT_FLAGS_CENTERED | UI_AUTO_SIZE, mTheme->GetIconByName( "add" ) ); OKButton->Pos( mUIWindow->Container()->Size().Width() - OKButton->Size().Width() - 4, mUIWindow->Container()->Size().Height() - OKButton->Size().Height() - 4 ); - OKButton->AddEventListener( cUIEvent::EventMouseClick, cb::Make1( this, &UIMapLayerNew::OKClick ) ); - mUILayerName->AddEventListener( cUIEvent::EventOnPressEnter, cb::Make1( this, &UIMapLayerNew::OKClick ) ); + OKButton->AddEventListener( UIEvent::EventMouseClick, cb::Make1( this, &UIMapLayerNew::OKClick ) ); + mUILayerName->AddEventListener( UIEvent::EventOnPressEnter, cb::Make1( this, &UIMapLayerNew::OKClick ) ); OKButton->Text( "Add" ); - cUIPushButton * CancelButton = mTheme->CreatePushButton( mUIWindow->Container(), OKButton->Size(), Vector2i( OKButton->Pos().x - OKButton->Size().Width() - 4, OKButton->Pos().y ), UI_CONTROL_DEFAULT_FLAGS_CENTERED | UI_AUTO_SIZE, mTheme->GetIconByName( "cancel" ) ); - CancelButton->AddEventListener( cUIEvent::EventMouseClick, cb::Make1( this, &UIMapLayerNew::CancelClick ) ); + UIPushButton * CancelButton = mTheme->CreatePushButton( mUIWindow->Container(), OKButton->Size(), Vector2i( OKButton->Pos().x - OKButton->Size().Width() - 4, OKButton->Pos().y ), UI_CONTROL_DEFAULT_FLAGS_CENTERED | UI_AUTO_SIZE, mTheme->GetIconByName( "cancel" ) ); + CancelButton->AddEventListener( UIEvent::EventMouseClick, cb::Make1( this, &UIMapLayerNew::CancelClick ) ); CancelButton->Text( "Cancel" ); - mUIWindow->AddEventListener( cUIEvent::EventKeyUp, cb::Make1( this, &UIMapLayerNew::OnKeyUp ) ); + mUIWindow->AddEventListener( UIEvent::EventKeyUp, cb::Make1( this, &UIMapLayerNew::OnKeyUp ) ); mUIWindow->Center(); mUIWindow->Show(); @@ -55,15 +55,15 @@ UIMapLayerNew::~UIMapLayerNew() { } -void UIMapLayerNew::OnKeyUp( const cUIEvent * Event ) { - const cUIEventKey * KeyEvent = reinterpret_cast ( Event ); +void UIMapLayerNew::OnKeyUp( const UIEvent * Event ) { + const UIEventKey * KeyEvent = reinterpret_cast ( Event ); if ( KeyEvent->KeyCode() == KEY_ESCAPE ) { CancelClick( Event ); } } -void UIMapLayerNew::OKClick( const cUIEvent * Event ) { +void UIMapLayerNew::OKClick( const UIEvent * Event ) { if ( mUILayerName->Text().size() ) { mLayer = mUIMap->Map()->AddLayer( mType, LAYER_FLAG_VISIBLE | LAYER_FLAG_LIGHTS_ENABLED, mUILayerName->Text() ); @@ -74,11 +74,11 @@ void UIMapLayerNew::OKClick( const cUIEvent * Event ) { mUIWindow->CloseWindow(); } -void UIMapLayerNew::CancelClick( const cUIEvent * Event ) { +void UIMapLayerNew::CancelClick( const UIEvent * Event ) { mUIWindow->CloseWindow(); } -void UIMapLayerNew::WindowClose( const cUIEvent * Event ) { +void UIMapLayerNew::WindowClose( const UIEvent * Event ) { eeDelete( this ); } @@ -86,7 +86,7 @@ const EE_LAYER_TYPE& UIMapLayerNew::Type() const { return mType; } -cUITextInput * UIMapLayerNew::UILayerName() const { +UITextInput * UIMapLayerNew::UILayerName() const { return mUILayerName; } diff --git a/src/eepp/gaming/mapeditor/uimaplayernew.hpp b/src/eepp/gaming/mapeditor/uimaplayernew.hpp index 5b76b2930..e2088658c 100644 --- a/src/eepp/gaming/mapeditor/uimaplayernew.hpp +++ b/src/eepp/gaming/mapeditor/uimaplayernew.hpp @@ -2,7 +2,7 @@ #define EE_GAMINGCUILAYERNEW_HPP #include -#include +#include #include using namespace EE::UI; @@ -19,27 +19,27 @@ class EE_API UIMapLayerNew { const EE_LAYER_TYPE& Type() const; - cUITextInput * UILayerName() const; + UITextInput * UILayerName() const; const String& Name() const; MapLayer * Layer() const; protected: - cUITheme * mTheme; + UITheme * mTheme; UIMap * mUIMap; EE_LAYER_TYPE mType; NewLayerCb mNewLayerCb; - cUIWindow * mUIWindow; - cUITextInput * mUILayerName; + UIWindow * mUIWindow; + UITextInput * mUILayerName; MapLayer * mLayer; - void WindowClose( const cUIEvent * Event ); + void WindowClose( const UIEvent * Event ); - void CancelClick( const cUIEvent * Event ); + void CancelClick( const UIEvent * Event ); - void OKClick( const cUIEvent * Event ); + void OKClick( const UIEvent * Event ); - void OnKeyUp( const cUIEvent * Event ); + void OnKeyUp( const UIEvent * Event ); }; }}} diff --git a/src/eepp/gaming/mapeditor/uimapnew.cpp b/src/eepp/gaming/mapeditor/uimapnew.cpp index d102d6784..3a5ce6a90 100644 --- a/src/eepp/gaming/mapeditor/uimapnew.cpp +++ b/src/eepp/gaming/mapeditor/uimapnew.cpp @@ -1,7 +1,7 @@ #include -#include -#include -#include +#include +#include +#include namespace EE { namespace Gaming { namespace Private { @@ -12,13 +12,13 @@ UIMapNew::UIMapNew( UIMap * Map, cb::Callback0 NewMapCb, bool ResizeMap ) mNewMapCb( NewMapCb ), mResizeMap( ResizeMap ) { - mTheme = cUIThemeManager::instance()->DefaultTheme(); + mTheme = UIThemeManager::instance()->DefaultTheme(); if ( NULL == mTheme ) return; mUIWindow = mTheme->CreateWindow( NULL, Sizei( 320, 380 ), Vector2i(), UI_CONTROL_DEFAULT_FLAGS_CENTERED, UI_WIN_CLOSE_BUTTON | UI_WIN_USE_DEFAULT_BUTTONS_ACTIONS | UI_WIN_SHARE_ALPHA_WITH_CHILDS | UI_WIN_MODAL, Sizei( 320, 380 ) ); - mUIWindow->AddEventListener( cUIEvent::EventOnWindowClose, cb::Make1( this, &UIMapNew::WindowClose ) ); + mUIWindow->AddEventListener( UIEvent::EventOnWindowClose, cb::Make1( this, &UIMapNew::WindowClose ) ); if ( !mResizeMap ) { mUIWindow->Title( "New Map" ); @@ -29,7 +29,7 @@ UIMapNew::UIMapNew( UIMap * Map, cb::Callback0 NewMapCb, bool ResizeMap ) Int32 InitialY = 16; Int32 DistFromTitle = 18; - cUITextBox * Txt = mTheme->CreateTextBox( "Map Size", mUIWindow->Container(), Sizei(), Vector2i( 16, InitialY ), UI_CONTROL_DEFAULT_FLAGS | UI_DRAW_SHADOW | UI_AUTO_SIZE ); + UITextBox * Txt = mTheme->CreateTextBox( "Map Size", mUIWindow->Container(), Sizei(), Vector2i( 16, InitialY ), UI_CONTROL_DEFAULT_FLAGS | UI_DRAW_SHADOW | UI_AUTO_SIZE ); Txt = mTheme->CreateTextBox( "Width:", mUIWindow->Container(), Sizei( 46, 24 ), Vector2i( Txt->Pos().x + DistFromTitle, Txt->Pos().y + DistFromTitle ), UI_CONTROL_DEFAULT_FLAGS | UI_DRAW_SHADOW ); @@ -110,7 +110,7 @@ UIMapNew::UIMapNew( UIMap * Map, cb::Callback0 NewMapCb, bool ResizeMap ) Txt = mTheme->CreateTextBox( "Map Base Color:", mUIWindow->Container(), Sizei(), Vector2i( Txt->Pos().x, mUIClipArea->Pos().y + mUIClipArea->Size().Height() + 8 ), UI_CONTROL_DEFAULT_FLAGS | UI_DRAW_SHADOW | UI_AUTO_SIZE ); - cUIComplexControl::CreateParams ComParams; + UIComplexControl::CreateParams ComParams; ComParams.Parent( mUIWindow->Container() ); ComParams.PosSet( Txt->Pos().x, Txt->Pos().y + Txt->Size().Height() + 4 ); ComParams.SizeSet( 64, 64 ); @@ -122,7 +122,7 @@ UIMapNew::UIMapNew( UIMap * Map, cb::Callback0 NewMapCb, bool ResizeMap ) ComParams.Border.Color( ColorA( 100, 100, 100, 200 ) ); ComParams.Flags |= UI_FILL_BACKGROUND | UI_BORDER; - mUIBaseColor = eeNew( cUIComplexControl, ( ComParams ) ); + mUIBaseColor = eeNew( UIComplexControl, ( ComParams ) ); mUIBaseColor->Visible( true ); mUIBaseColor->Enabled( true ); @@ -131,7 +131,7 @@ UIMapNew::UIMapNew( UIMap * Map, cb::Callback0 NewMapCb, bool ResizeMap ) mUIRedSlider = mTheme->CreateSlider( mUIWindow->Container(), Sizei( 128, 20 ), Vector2i( Txt->Pos().x + Txt->Size().Width() + 16, Txt->Pos().y ), UI_CONTROL_DEFAULT_FLAGS | UI_AUTO_SIZE ); mUIRedSlider->MaxValue( 255 ); mUIRedSlider->Value( 255 ); - mUIRedSlider->AddEventListener( cUIEvent::EventOnValueChange, cb::Make1( this, &UIMapNew::OnRedChange ) ); + mUIRedSlider->AddEventListener( UIEvent::EventOnValueChange, cb::Make1( this, &UIMapNew::OnRedChange ) ); mUIRedTxt = mTheme->CreateTextBox( String::ToStr( 255 ), mUIWindow->Container(), Sizei(), Vector2i( mUIRedSlider->Pos().x + mUIRedSlider->Size().Width() + 4, mUIRedSlider->Pos().y ), UI_CONTROL_DEFAULT_FLAGS | UI_DRAW_SHADOW | UI_AUTO_SIZE ); @@ -145,7 +145,7 @@ UIMapNew::UIMapNew( UIMap * Map, cb::Callback0 NewMapCb, bool ResizeMap ) mUIGreenSlider->MaxValue( 255 ); mUIGreenSlider->Value( 255 ); - mUIGreenSlider->AddEventListener( cUIEvent::EventOnValueChange, cb::Make1( this, &UIMapNew::OnGreenChange ) ); + mUIGreenSlider->AddEventListener( UIEvent::EventOnValueChange, cb::Make1( this, &UIMapNew::OnGreenChange ) ); mUIGreenTxt = mTheme->CreateTextBox( String::ToStr( 255 ), mUIWindow->Container(), Sizei(), Vector2i( mUIGreenSlider->Pos().x + mUIGreenSlider->Size().Width() + 4, mUIGreenSlider->Pos().y ), UI_CONTROL_DEFAULT_FLAGS | UI_DRAW_SHADOW | UI_AUTO_SIZE ); @@ -158,7 +158,7 @@ UIMapNew::UIMapNew( UIMap * Map, cb::Callback0 NewMapCb, bool ResizeMap ) mUIBlueSlider = mTheme->CreateSlider( mUIWindow->Container(), Sizei( 128, 20 ), Vector2i( mUIRedSlider->Pos().x, Txt->Pos().y ), UI_CONTROL_DEFAULT_FLAGS | UI_AUTO_SIZE ); mUIBlueSlider->MaxValue( 255 ); mUIBlueSlider->Value( 255 ); - mUIBlueSlider->AddEventListener( cUIEvent::EventOnValueChange, cb::Make1( this, &UIMapNew::OnBlueChange ) ); + mUIBlueSlider->AddEventListener( UIEvent::EventOnValueChange, cb::Make1( this, &UIMapNew::OnBlueChange ) ); mUIBlueTxt = mTheme->CreateTextBox( String::ToStr( 255 ), mUIWindow->Container(), Sizei(), Vector2i( mUIBlueSlider->Pos().x + mUIBlueSlider->Size().Width() + 4, mUIBlueSlider->Pos().y ), UI_CONTROL_DEFAULT_FLAGS | UI_DRAW_SHADOW | UI_AUTO_SIZE ); @@ -166,13 +166,13 @@ UIMapNew::UIMapNew( UIMap * Map, cb::Callback0 NewMapCb, bool ResizeMap ) mUIBlueSlider->Value( mUIMap->Map()->BaseColor().B() ); } - cUIPushButton * OKButton = mTheme->CreatePushButton( mUIWindow->Container(), Sizei( 80, 22 ), Vector2i(), UI_CONTROL_DEFAULT_FLAGS_CENTERED | UI_AUTO_SIZE, mTheme->GetIconByName( "ok" ) ); + UIPushButton * OKButton = mTheme->CreatePushButton( mUIWindow->Container(), Sizei( 80, 22 ), Vector2i(), UI_CONTROL_DEFAULT_FLAGS_CENTERED | UI_AUTO_SIZE, mTheme->GetIconByName( "ok" ) ); OKButton->Pos( mUIWindow->Container()->Size().Width() - OKButton->Size().Width() - 4, mUIWindow->Container()->Size().Height() - OKButton->Size().Height() - 4 ); - OKButton->AddEventListener( cUIEvent::EventMouseClick, cb::Make1( this, &UIMapNew::OKClick ) ); + OKButton->AddEventListener( UIEvent::EventMouseClick, cb::Make1( this, &UIMapNew::OKClick ) ); OKButton->Text( "OK" ); - cUIPushButton * CancelButton = mTheme->CreatePushButton( mUIWindow->Container(), OKButton->Size(), Vector2i( OKButton->Pos().x - OKButton->Size().Width() - 4, OKButton->Pos().y ), UI_CONTROL_DEFAULT_FLAGS_CENTERED | UI_AUTO_SIZE, mTheme->GetIconByName( "cancel" ) ); - CancelButton->AddEventListener( cUIEvent::EventMouseClick, cb::Make1( this, &UIMapNew::CancelClick ) ); + UIPushButton * CancelButton = mTheme->CreatePushButton( mUIWindow->Container(), OKButton->Size(), Vector2i( OKButton->Pos().x - OKButton->Size().Width() - 4, OKButton->Pos().y ), UI_CONTROL_DEFAULT_FLAGS_CENTERED | UI_AUTO_SIZE, mTheme->GetIconByName( "cancel" ) ); + CancelButton->AddEventListener( UIEvent::EventMouseClick, cb::Make1( this, &UIMapNew::CancelClick ) ); CancelButton->Text( "Cancel" ); mUIWindow->Center(); @@ -182,28 +182,28 @@ UIMapNew::UIMapNew( UIMap * Map, cb::Callback0 NewMapCb, bool ResizeMap ) UIMapNew::~UIMapNew() { } -void UIMapNew::OnRedChange( const cUIEvent * Event ) { +void UIMapNew::OnRedChange( const UIEvent * Event ) { ColorA Col = mUIBaseColor->Background()->Color(); Col.Red = (Uint8)mUIRedSlider->Value(); mUIBaseColor->Background()->Color( Col ); mUIRedTxt->Text( String::ToStr( (Int32)mUIRedSlider->Value() ) ); } -void UIMapNew::OnGreenChange( const cUIEvent * Event ) { +void UIMapNew::OnGreenChange( const UIEvent * Event ) { ColorA Col = mUIBaseColor->Background()->Color(); Col.Green = (Uint8)mUIGreenSlider->Value(); mUIBaseColor->Background()->Color( Col ); mUIGreenTxt->Text( String::ToStr( (Uint32)mUIGreenSlider->Value() ) ); } -void UIMapNew::OnBlueChange( const cUIEvent * Event ) { +void UIMapNew::OnBlueChange( const UIEvent * Event ) { ColorA Col = mUIBaseColor->Background()->Color(); Col.Blue = (Uint8)mUIBlueSlider->Value(); mUIBaseColor->Background()->Color( Col ); mUIBlueTxt->Text( String::ToStr( (Uint32)mUIBlueSlider->Value() ) ); } -void UIMapNew::OKClick( const cUIEvent * Event ) { +void UIMapNew::OKClick( const UIEvent * Event ) { Int32 w = static_cast( mUIMapWidth->Value() ); Int32 h = static_cast( mUIMapHeight->Value() ); Int32 tw = static_cast( mUIMapTWidth->Value() ); @@ -253,11 +253,11 @@ void UIMapNew::OKClick( const cUIEvent * Event ) { mUIWindow->CloseWindow(); } -void UIMapNew::CancelClick( const cUIEvent * Event ) { +void UIMapNew::CancelClick( const UIEvent * Event ) { mUIWindow->CloseWindow(); } -void UIMapNew::WindowClose( const cUIEvent * Event ) { +void UIMapNew::WindowClose( const UIEvent * Event ) { eeDelete( this ); } diff --git a/src/eepp/gaming/mapeditor/uimapnew.hpp b/src/eepp/gaming/mapeditor/uimapnew.hpp index f61b89160..20184474d 100644 --- a/src/eepp/gaming/mapeditor/uimapnew.hpp +++ b/src/eepp/gaming/mapeditor/uimapnew.hpp @@ -2,7 +2,7 @@ #define EE_GAMINGCUIMAPNEW_HPP #include -#include +#include #include using namespace EE::UI; @@ -15,42 +15,42 @@ class EE_API UIMapNew { virtual ~UIMapNew(); protected: - cUITheme * mTheme; - cUIWindow * mUIWindow; + UITheme * mTheme; + UIWindow * mUIWindow; UIMap * mUIMap; - cUISpinBox * mUIMapWidth; - cUISpinBox * mUIMapHeight; - cUISpinBox * mUIMapTWidth; - cUISpinBox * mUIMapTHeight; - cUISpinBox * mUIMapMaxLayers; - cUICheckBox * mUILightsEnabled; - cUICheckBox * mUILightsByVertex; - cUICheckBox * mUIClampBorders; - cUICheckBox * mUIClipArea; - cUIComplexControl * mUIBaseColor; - cUISlider * mUIRedSlider; - cUISlider * mUIGreenSlider; - cUISlider * mUIBlueSlider; - cUITextBox * mUIRedTxt; - cUITextBox * mUIGreenTxt; - cUITextBox * mUIBlueTxt; + UISpinBox * mUIMapWidth; + UISpinBox * mUIMapHeight; + UISpinBox * mUIMapTWidth; + UISpinBox * mUIMapTHeight; + UISpinBox * mUIMapMaxLayers; + UICheckBox * mUILightsEnabled; + UICheckBox * mUILightsByVertex; + UICheckBox * mUIClampBorders; + UICheckBox * mUIClipArea; + UIComplexControl * mUIBaseColor; + UISlider * mUIRedSlider; + UISlider * mUIGreenSlider; + UISlider * mUIBlueSlider; + UITextBox * mUIRedTxt; + UITextBox * mUIGreenTxt; + UITextBox * mUIBlueTxt; cb::Callback0 mNewMapCb; Sizei mNewSize; bool mResizeMap; - void WindowClose( const cUIEvent * Event ); + void WindowClose( const UIEvent * Event ); - void CancelClick( const cUIEvent * Event ); + void CancelClick( const UIEvent * Event ); - void OKClick( const cUIEvent * Event ); + void OKClick( const UIEvent * Event ); - void OnRedChange( const cUIEvent * Event ); + void OnRedChange( const UIEvent * Event ); - void OnGreenChange( const cUIEvent * Event ); + void OnGreenChange( const UIEvent * Event ); - void OnBlueChange( const cUIEvent * Event ); + void OnBlueChange( const UIEvent * Event ); }; }}} diff --git a/src/eepp/gaming/tilemap.cpp b/src/eepp/gaming/tilemap.cpp index 2a2fcda3d..d6e1c70e9 100644 --- a/src/eepp/gaming/tilemap.cpp +++ b/src/eepp/gaming/tilemap.cpp @@ -18,7 +18,7 @@ #include using namespace EE::Graphics; -#include +#include namespace EE { namespace Gaming { @@ -1379,7 +1379,7 @@ std::vector TileMap::GetTextureAtlases() { //! Ugly ugly ugly, but i don't see another way Uint32 Restricted1 = String::Hash( std::string( "global" ) ); - Uint32 Restricted2 = String::Hash( UI::cUIThemeManager::instance()->DefaultTheme()->TextureAtlas()->Name() ); + Uint32 Restricted2 = String::Hash( UI::UIThemeManager::instance()->DefaultTheme()->TextureAtlas()->Name() ); for ( std::list::iterator it = Res.begin(); it != Res.end(); it++ ) { if ( (*it)->Id() != Restricted1 && (*it)->Id() != Restricted2 ) diff --git a/src/eepp/ui/cuiborder.cpp b/src/eepp/ui/cuiborder.cpp deleted file mode 100644 index 3427c4ec1..000000000 --- a/src/eepp/ui/cuiborder.cpp +++ /dev/null @@ -1,24 +0,0 @@ -#include - -namespace EE { namespace UI { - -cUIBorder::cUIBorder() : mColor( 0xFF404040 ), mWidth( 1 ) {} -cUIBorder::cUIBorder( const cUIBorder& border ) : mColor( border.Color() ), mWidth( border.Width() ) {} - -const ColorA& cUIBorder::Color() const { - return mColor; -} - -void cUIBorder::Color( const ColorA& Col ) { - mColor = Col; -} - -const unsigned int& cUIBorder::Width() const { - return mWidth; -} - -void cUIBorder::Width( const unsigned int& width ) { - mWidth = width; -} - -}} diff --git a/src/eepp/ui/cuicombobox.cpp b/src/eepp/ui/cuicombobox.cpp deleted file mode 100644 index 2af2c84bd..000000000 --- a/src/eepp/ui/cuicombobox.cpp +++ /dev/null @@ -1,97 +0,0 @@ -#include -#include - -namespace EE { namespace UI { - -cUIComboBox::cUIComboBox( cUIComboBox::CreateParams& Params ) : - cUIDropDownList( Params ), - mButton( NULL ) -{ - AllowEditing( true ); - - ApplyDefaultTheme(); -} - -cUIComboBox::~cUIComboBox() { -} - -Uint32 cUIComboBox::Type() const { - return UI_TYPE_COMBOBOX; -} - -bool cUIComboBox::IsType( const Uint32& type ) const { - return cUIComboBox::Type() == type ? true : cUIDropDownList::IsType( type ); -} - -void cUIComboBox::SetTheme( cUITheme * Theme ) { - cUIControl::SetThemeControl( Theme, "combobox" ); - - AutoSizeControl(); - - CreateButton(); - - AutoPadding(); - - OnSizeChange(); -} - -void cUIComboBox::CreateButton() { - eeSAFE_DELETE( mButton ); - - Int32 btnWidth = 0; - - if ( NULL != mSkinState && NULL != mSkinState->GetSkin() ) { - if ( mSkinState->GetSkin()->GetType() == cUISkin::UISkinComplex ) { - cUISkinComplex * tComplex = reinterpret_cast ( mSkinState->GetSkin() ); - - SubTexture * tSubTexture = tComplex->GetSubTextureSide( cUISkinState::StateNormal, cUISkinComplex::Right ); - - if ( NULL != tSubTexture ) - btnWidth = tSubTexture->RealSize().Width(); - } - } - - cUIControl::CreateParams Params; - Params.Parent( this ), - Params.Size = Sizei( btnWidth, mSize.Height() ); - Params.PosSet( mSize.Width() - btnWidth, 0 ); - mButton = eeNew( cUIControl, ( Params ) ); - mButton->Visible( true ); - mButton->Enabled( true ); - mButton->AddEventListener( cUIEvent::EventMouseClick, cb::Make1( this, &cUIComboBox::OnButtonClick ) ); - mButton->AddEventListener( cUIEvent::EventMouseEnter, cb::Make1( this, &cUIComboBox::OnButtonEnter ) ); - mButton->AddEventListener( cUIEvent::EventMouseExit, cb::Make1( this, &cUIComboBox::OnButtonExit ) ); -} - -void cUIComboBox::OnButtonClick( const cUIEvent * Event ) { - const cUIEventMouse * MEvent = reinterpret_cast ( Event ); - - if ( MEvent->Flags() & EE_BUTTON_LMASK ) { - ShowListBox(); - } -} - -void cUIComboBox::OnButtonEnter( const cUIEvent * Event ) { - SetSkinState( cUISkinState::StateMouseEnter ); -} - -void cUIComboBox::OnButtonExit( const cUIEvent * Event ) { - SetSkinState( cUISkinState::StateMouseExit ); -} - -Uint32 cUIComboBox::OnMouseClick( const Vector2i& Pos, const Uint32 Flags ) { - if ( Flags & EE_BUTTON_LMASK ) { - cUITextInput::OnMouseClick( Pos, Flags ); - - if ( mListBox->Visible() ) { - Hide(); - } - } - - return 1; -} - -void cUIComboBox::OnControlClear( const cUIEvent *Event ) { -} - -}} diff --git a/src/eepp/ui/cuidragable.cpp b/src/eepp/ui/cuidragable.cpp deleted file mode 100644 index 0c770b78d..000000000 --- a/src/eepp/ui/cuidragable.cpp +++ /dev/null @@ -1,129 +0,0 @@ -#include -#include -#include - -namespace EE { namespace UI { - -cUIDragable::cUIDragable( const cUIControl::CreateParams& Params ) : - cUIControl( Params ), - mDragButton( EE_BUTTON_LMASK ) -{ - mControlFlags |= UI_CTRL_FLAG_DRAGABLE; -} - -cUIDragable::~cUIDragable() { -} - -Uint32 cUIDragable::Type() const { - return UI_TYPE_CONTROL_DRAGABLE; -} - -bool cUIDragable::IsType( const Uint32& type ) const { - return cUIDragable::Type() == type ? true : cUIControl::IsType( type ); -} - -Uint32 cUIDragable::OnMouseDown( const Vector2i& Pos, const Uint32 Flags ) { - if ( !( cUIManager::instance()->LastPressTrigger() & mDragButton ) && ( Flags & mDragButton ) && DragEnable() && !Dragging() ) { - Dragging( true ); - mDragPoint = Pos; - } - - cUIControl::OnMouseDown( Pos, Flags ); - return 1; -} - -Uint32 cUIDragable::OnMouseUp( const Vector2i& Pos, const Uint32 Flags ) { - if ( DragEnable() && Dragging() && ( Flags & mDragButton ) ) { - Dragging( false ); - } - - cUIControl::OnMouseUp( Pos, Flags ); - return 1; -} - -const Vector2i& cUIDragable::DragPoint() const { - return mDragPoint; -} - -void cUIDragable::DragPoint( const Vector2i& Point ) { - mDragPoint = Point; -} - -void cUIDragable::Update() { - cUIControl::Update(); - - if ( !DragEnable() ) - return; - - if ( Dragging() ) { - if ( !( cUIManager::instance()->PressTrigger() & mDragButton ) ) { - Dragging( false ); - cUIManager::instance()->SetControlDragging( false ); - return; - } - - Vector2i Pos( cUIManager::instance()->GetMousePos() ); - - if ( mDragPoint != Pos ) { - if ( OnDrag( Pos ) ) { - mPos += -( mDragPoint - Pos ); - - mDragPoint = Pos; - - OnPosChange(); - - cUIManager::instance()->SetControlDragging( true ); - } - } - } -} - -Uint32 cUIDragable::OnDrag( const Vector2i& Pos ) { - return 1; -} - -Uint32 cUIDragable::OnDragStart( const Vector2i& Pos ) { - return 1; -} - -Uint32 cUIDragable::OnDragEnd( const Vector2i& Pos ) { - return 1; -} - -bool cUIDragable::DragEnable() const { - return 0 != ( mFlags & UI_DRAG_ENABLE ); -} - -void cUIDragable::DragEnable( const bool& enable ) { - WriteFlag( UI_DRAG_ENABLE, true == enable ); -} - -bool cUIDragable::Dragging() const { - return 0 != ( mControlFlags & UI_CTRL_FLAG_DRAGGING ); -} - -void cUIDragable::Dragging( const bool& dragging ) { - WriteCtrlFlag( UI_CTRL_FLAG_DRAGGING, true == dragging ); - - if ( dragging ) { - cUIMessage tMsg( this, cUIMessage::MsgDragStart, 0 ); - MessagePost( &tMsg ); - - OnDragStart( cUIManager::instance()->GetMousePos() ); - } else { - cUIMessage tMsg( this, cUIMessage::MsgDragEnd, 0 ); - MessagePost( &tMsg ); - - OnDragEnd( cUIManager::instance()->GetMousePos() ); - } -} - -void cUIDragable::DragButton( const Uint32& Button ) { - mDragButton = Button; -} - -const Uint32& cUIDragable::DragButton() const { - return mDragButton; -} - -}} diff --git a/src/eepp/ui/cuidropdownlist.cpp b/src/eepp/ui/cuidropdownlist.cpp deleted file mode 100644 index 71366db5e..000000000 --- a/src/eepp/ui/cuidropdownlist.cpp +++ /dev/null @@ -1,233 +0,0 @@ -#include -#include - -namespace EE { namespace UI { - -cUIDropDownList::cUIDropDownList( cUIDropDownList::CreateParams& Params ) : - cUITextInput( Params ), - mListBox( Params.ListBox ), - mMinNumVisibleItems( Params.MinNumVisibleItems ), - mPopUpToMainControl( Params.PopUpToMainControl ) -{ - AllowEditing( false ); - - ApplyDefaultTheme(); - - if ( NULL == mListBox ) { - Uint32 flags = UI_CLIP_ENABLE | UI_AUTO_PADDING; - - if ( Params.Flags & UI_TOUCH_DRAG_ENABLED ) - flags |= UI_TOUCH_DRAG_ENABLED; - - if ( Params.Flags & UI_TEXT_SELECTION_ENABLED ) - flags |= UI_TEXT_SELECTION_ENABLED; - - cUITheme * Theme = cUIThemeManager::instance()->DefaultTheme(); - - if ( NULL != Theme ) { - mListBox = Theme->CreateListBox( NULL, Sizei( mSize.Width(), mMinNumVisibleItems * mSize.Height() ),Vector2i(), flags ); - } else { - cUIListBox::CreateParams LBParams; - LBParams.Size = Sizei( mSize.Width(), mMinNumVisibleItems * mSize.Height() ); - LBParams.Flags = flags; - LBParams.FontSelectedColor = ColorA( 255, 255, 255, 255 ); - mListBox = eeNew( cUIListBox, ( LBParams ) ); - } - } - - mListBox->Enabled( false ); - mListBox->Visible( false ); - - mListBox->AddEventListener( cUIEvent::EventOnComplexControlFocusLoss, cb::Make1( this, &cUIDropDownList::OnListBoxFocusLoss ) ); - mListBox->AddEventListener( cUIEvent::EventOnItemSelected , cb::Make1( this, &cUIDropDownList::OnItemSelected ) ); - mListBox->AddEventListener( cUIEvent::EventOnItemClicked, cb::Make1( this, &cUIDropDownList::OnItemClicked ) ); - mListBox->AddEventListener( cUIEvent::EventOnItemKeyDown, cb::Make1( this, &cUIDropDownList::OnItemKeyDown ) ); - mListBox->AddEventListener( cUIEvent::EventKeyDown , cb::Make1( this, &cUIDropDownList::OnItemKeyDown ) ); - mListBox->AddEventListener( cUIEvent::EventOnControlClear, cb::Make1( this, &cUIDropDownList::OnControlClear ) ); -} - -cUIDropDownList::~cUIDropDownList() { - DestroyListBox(); -} - -Uint32 cUIDropDownList::Type() const { - return UI_TYPE_DROPDOWNLIST; -} - -bool cUIDropDownList::IsType( const Uint32& type ) const { - return cUIDropDownList::Type() == type ? true : cUITextInput::IsType( type ); -} - -void cUIDropDownList::SetTheme( cUITheme * Theme ) { - cUIControl::SetThemeControl( Theme, "dropdownlist" ); - - AutoSizeControl(); - - AutoPadding(); - - OnSizeChange(); -} - -void cUIDropDownList::OnSizeChange() { - cUIComplexControl::OnSizeChange(); -} - -void cUIDropDownList::AutoSizeControl() { - if ( mFlags & UI_AUTO_SIZE ) { - Size( mSize.x, GetSkinSize().Height() ); - } -} - -void cUIDropDownList::AutoSize() { -} - -cUIListBox * cUIDropDownList::ListBox() const { - return mListBox; -} - -Uint32 cUIDropDownList::OnMouseClick( const Vector2i& Pos, const Uint32 Flags ) { - if ( Flags & EE_BUTTON_LMASK ) - ShowListBox(); - - return 1; -} - -void cUIDropDownList::ShowListBox() { - if ( !mListBox->Visible() ) { - if ( !mPopUpToMainControl ) - mListBox->Parent( Parent() ); - else - mListBox->Parent( cUIManager::instance()->MainControl() ); - - mListBox->ToFront(); - - Vector2i Pos( mPos.x, mPos.y + mSize.Height() ); - - if ( mPopUpToMainControl ) { - Parent()->ControlToWorld( Pos ); - } - - mListBox->Pos( Pos ); - - if ( mListBox->Count() ) { - Recti tPadding = mListBox->PaddingContainer(); - - Float sliderValue = mListBox->VerticalScrollBar()->Value(); - - if ( mMinNumVisibleItems < mListBox->Count() ) - mListBox->Size( mSize.Width(), (Int32)( mMinNumVisibleItems * mListBox->RowHeight() ) + tPadding.Top + tPadding.Bottom ); - else { - mListBox->Size( mSize.Width(), (Int32)( mListBox->Count() * mListBox->RowHeight() ) + tPadding.Top + tPadding.Bottom ); - } - - mListBox->UpdateQuad(); - - Rectf aabb( mListBox->GetPolygon().ToAABB() ); - Recti aabbi( aabb.Left, aabb.Top, aabb.Right, aabb.Bottom ); - - if ( !cUIManager::instance()->MainControl()->GetScreenRect().Contains( aabbi ) ) { - Pos = Vector2i( mPos.x, mPos.y ); - - if ( mPopUpToMainControl ) { - Parent()->ControlToWorld( Pos ); - } - - Pos.y -= mListBox->Size().Height(); - - mListBox->Pos( Pos ); - } - - mListBox->VerticalScrollBar()->Value( sliderValue ); - - Show(); - - mListBox->SetFocus(); - } - } else { - Hide(); - } -} - -void cUIDropDownList::OnControlClear( const cUIEvent * Event ) { - Text( "" ); -} - -void cUIDropDownList::OnItemKeyDown( const cUIEvent * Event ) { - const cUIEventKey * KEvent = reinterpret_cast ( Event ); - - if ( KEvent->KeyCode() == KEY_RETURN ) - OnItemClicked( Event ); -} - -void cUIDropDownList::OnListBoxFocusLoss( const cUIEvent * Event ) { - if ( cUIManager::instance()->FocusControl() != this && !IsChild( cUIManager::instance()->FocusControl() ) ) { - Hide(); - } -} - -void cUIDropDownList::OnItemClicked( const cUIEvent * Event ) { - Hide(); - SetFocus(); -} - -void cUIDropDownList::OnItemSelected( const cUIEvent * Event ) { - Text( mListBox->GetItemSelectedText() ); - - cUIMessage Msg( this, cUIMessage::MsgSelected, mListBox->GetItemSelectedIndex() ); - MessagePost( &Msg ); - - SendCommonEvent( cUIEvent::EventOnItemSelected ); -} - -void cUIDropDownList::Show() { - mListBox->Enabled( true ); - mListBox->Visible( true ); - - if ( cUIThemeManager::instance()->DefaultEffectsEnabled() ) { - if ( 255.f == mListBox->Alpha() ) - mListBox->StartAlphaAnim( 0.f, 255.f, cUIThemeManager::instance()->ControlsFadeInTime() ); - else - mListBox->CreateFadeIn( cUIThemeManager::instance()->ControlsFadeInTime() ); - } -} - -void cUIDropDownList::Hide() { - if ( cUIThemeManager::instance()->DefaultEffectsEnabled() ) { - mListBox->DisableFadeOut( cUIThemeManager::instance()->ControlsFadeOutTime() ); - } else { - mListBox->Enabled( false ); - mListBox->Visible( false ); - } -} - -void cUIDropDownList::Update() { - if ( mEnabled && mVisible ) { - if ( IsMouseOver() ) { - Uint32 Flags = cUIManager::instance()->GetInput()->ClickTrigger(); - - if ( Flags & EE_BUTTONS_WUWD ) { - if ( Flags & EE_BUTTON_WUMASK ) { - mListBox->SelectPrev(); - } else if ( Flags & EE_BUTTON_WDMASK ) { - mListBox->SelectNext(); - } - } - } - } - - cUITextInput::Update(); -} - -Uint32 cUIDropDownList::OnKeyDown( const cUIEventKey &Event ) { - mListBox->OnKeyDown( Event ); - - return cUITextInput::OnKeyDown( Event ); -} - -void cUIDropDownList::DestroyListBox() { - if ( !cUIManager::instance()->IsShootingDown() ) { - mListBox->Close(); - } -} - -}} diff --git a/src/eepp/ui/cuievent.cpp b/src/eepp/ui/cuievent.cpp deleted file mode 100644 index 1fa77afe4..000000000 --- a/src/eepp/ui/cuievent.cpp +++ /dev/null @@ -1,24 +0,0 @@ -#include -#include - -namespace EE { namespace UI { - -cUIEvent::cUIEvent( cUIControl * Ctrl, const Uint32& EventType ) : - mCtrl( Ctrl ), - mEventType( EventType ) -{ -} - -cUIEvent::~cUIEvent() -{ -} - -cUIControl * cUIEvent::Ctrl() const { - return mCtrl; -} - -const Uint32& cUIEvent::EventType() const { - return mEventType; -} - -}} diff --git a/src/eepp/ui/cuieventkey.cpp b/src/eepp/ui/cuieventkey.cpp deleted file mode 100644 index 898b908ab..000000000 --- a/src/eepp/ui/cuieventkey.cpp +++ /dev/null @@ -1,30 +0,0 @@ -#include -#include - -namespace EE { namespace UI { - -cUIEventKey::cUIEventKey( cUIControl * Ctrl, const Uint32& EventNum, const Uint32& KeyCode, const Uint16& Char, const Uint32& Mod ) : - cUIEvent( Ctrl, EventNum ), - mKeyCode( KeyCode ), - mChar( Char ), - mMod( Mod ) -{ -} - -cUIEventKey::~cUIEventKey() -{ -} - -const Uint32& cUIEventKey::KeyCode() const { - return mKeyCode; -} - -const Uint16& cUIEventKey::Char() const { - return mChar; -} - -const Uint32& cUIEventKey::Mod() const { - return mMod; -} - -}} diff --git a/src/eepp/ui/cuieventmouse.cpp b/src/eepp/ui/cuieventmouse.cpp deleted file mode 100644 index f28d18fb0..000000000 --- a/src/eepp/ui/cuieventmouse.cpp +++ /dev/null @@ -1,26 +0,0 @@ -#include -#include - -namespace EE { namespace UI { - -cUIEventMouse::cUIEventMouse( cUIControl * Ctrl, const Uint32& EventNum, const Vector2i& Pos, const Uint32& Flags ) : - cUIEvent( Ctrl, EventNum ), - mPos( Pos ), - mFlags( Flags ) -{ -} - -cUIEventMouse::~cUIEventMouse() -{ -} - -const Vector2i& cUIEventMouse::Pos() const { - return mPos; -} - -const Uint32& cUIEventMouse::Flags() const { - return mFlags; -} - -}} - diff --git a/src/eepp/ui/cuilistboxitem.cpp b/src/eepp/ui/cuilistboxitem.cpp deleted file mode 100644 index 0b9103181..000000000 --- a/src/eepp/ui/cuilistboxitem.cpp +++ /dev/null @@ -1,127 +0,0 @@ -#include -#include -#include - -namespace EE { namespace UI { - -cUIListBoxItem::cUIListBoxItem( const cUITextBox::CreateParams& Params ) : - cUITextBox( Params ) -{ - ApplyDefaultTheme(); -} - -cUIListBoxItem::~cUIListBoxItem() { - if ( cUIManager::instance()->FocusControl() == this ) - mParentCtrl->SetFocus(); - - if ( cUIManager::instance()->OverControl() == this ) - cUIManager::instance()->OverControl( mParentCtrl ); -} - -Uint32 cUIListBoxItem::Type() const { - return UI_TYPE_LISTBOXITEM; -} - -bool cUIListBoxItem::IsType( const Uint32& type ) const { - return cUIListBoxItem::Type() == type ? true : cUITextBox::IsType( type ); -} - -void cUIListBoxItem::SetTheme( cUITheme * Theme ) { - cUIControl::SetThemeControl( Theme, "listboxitem" ); -} - -Uint32 cUIListBoxItem::OnMouseClick( const Vector2i& Pos, const Uint32 Flags ) { - if ( Flags & EE_BUTTONS_LRM ) { - reinterpret_cast ( Parent()->Parent() )->ItemClicked( this ); - - Select(); - } - - return 1; -} - -void cUIListBoxItem::Select() { - cUIListBox * LBParent = reinterpret_cast ( Parent()->Parent() ); - - bool wasSelected = 0 != ( mControlFlags & UI_CTRL_FLAG_SELECTED ); - - if ( LBParent->IsMultiSelect() ) { - if ( !wasSelected ) { - SetSkinState( cUISkinState::StateSelected ); - - mControlFlags |= UI_CTRL_FLAG_SELECTED; - - LBParent->mSelected.push_back( LBParent->GetItemIndex( this ) ); - - LBParent->OnSelected(); - } else { - mControlFlags &= ~UI_CTRL_FLAG_SELECTED; - - LBParent->mSelected.remove( LBParent->GetItemIndex( this ) ); - } - } else { - SetSkinState( cUISkinState::StateSelected ); - - mControlFlags |= UI_CTRL_FLAG_SELECTED; - - LBParent->mSelected.clear(); - LBParent->mSelected.push_back( LBParent->GetItemIndex( this ) ); - - if ( !wasSelected ) { - LBParent->OnSelected(); - } - } -} - -void cUIListBoxItem::Update() { - cUITextBox::Update(); - - if ( mEnabled && mVisible ) { - cUIListBox * LBParent = reinterpret_cast ( Parent()->Parent() ); - Uint32 Flags = cUIManager::instance()->GetInput()->ClickTrigger(); - - if ( IsMouseOver() ) { - if ( Flags & EE_BUTTONS_WUWD && LBParent->VerticalScrollBar()->Visible() ) { - LBParent->VerticalScrollBar()->Slider()->ManageClick( Flags ); - } - } - } -} - -Uint32 cUIListBoxItem::OnMouseExit( const Vector2i& Pos, const Uint32 Flags ) { - cUIControl::OnMouseExit( Pos, Flags ); - - if ( mControlFlags & UI_CTRL_FLAG_SELECTED ) - SetSkinState( cUISkinState::StateSelected ); - - return 1; -} - -void cUIListBoxItem::Unselect() { - if ( mControlFlags & UI_CTRL_FLAG_SELECTED ) - mControlFlags &= ~UI_CTRL_FLAG_SELECTED; - - SetSkinState( cUISkinState::StateNormal ); -} - -bool cUIListBoxItem::Selected() const { - return 0 != ( mControlFlags & UI_CTRL_FLAG_SELECTED ); -} - -void cUIListBoxItem::OnStateChange() { - cUIListBox * LBParent = reinterpret_cast ( Parent()->Parent() ); - - if ( Selected() && mSkinState->GetState() != cUISkinState::StateSelected ) { - SetSkinState( cUISkinState::StateSelected ); - } - - if ( mSkinState->GetState() == cUISkinState::StateSelected ) { - Color( LBParent->FontSelectedColor() ); - } else if ( mSkinState->GetState() == cUISkinState::StateMouseEnter ) { - Color( LBParent->FontOverColor() ); - } else { - Color( LBParent->FontColor() ); - } -} - -}} diff --git a/src/eepp/ui/cuimenucheckbox.cpp b/src/eepp/ui/cuimenucheckbox.cpp deleted file mode 100644 index ec9273430..000000000 --- a/src/eepp/ui/cuimenucheckbox.cpp +++ /dev/null @@ -1,106 +0,0 @@ -#include -#include - -namespace EE { namespace UI { - -cUIMenuCheckBox::cUIMenuCheckBox( cUIMenuCheckBox::CreateParams& Params ) : - cUIMenuItem( Params ), - mActive( false ), - mSkinActive( NULL ), - mSkinInactive( NULL ) -{ - ApplyDefaultTheme(); -} - -cUIMenuCheckBox::~cUIMenuCheckBox() { -} - -Uint32 cUIMenuCheckBox::Type() const { - return UI_TYPE_MENUCHECKBOX; -} - -bool cUIMenuCheckBox::IsType( const Uint32& type ) const { - return cUIMenuCheckBox::Type() == type ? true : cUIMenuItem::IsType( type ); -} - -void cUIMenuCheckBox::SetTheme( cUITheme * Theme ) { - cUIControl::SetThemeControl( Theme, "menuitem" ); - - mSkinActive = Theme->GetByName( Theme->Abbr() + "_" + "menucheckbox_active" ); - mSkinInactive = Theme->GetByName( Theme->Abbr() + "_" + "menucheckbox_inactive" ); - - Active( mActive ); - - DoAfterSetTheme(); -} - -const bool& cUIMenuCheckBox::Active() const { - return mActive; -} - -const bool& cUIMenuCheckBox::IsActive() const { - return Active(); -} - -void cUIMenuCheckBox::Active( const bool& active ) { - bool oActive = mActive; - mActive = active; - - if ( mActive ) { - if ( NULL != mSkinActive ) { - if ( mSkinState->GetState() == cUISkinState::StateSelected ) - Icon( mSkinActive->GetSubTexture( cUISkinState::StateMouseEnter ) ); - else - Icon( mSkinActive->GetSubTexture( cUISkinState::StateNormal ) ); - } else - mIcon->SubTexture( NULL ); - } else { - if ( NULL != mSkinInactive ) - if ( mSkinState->GetState() == cUISkinState::StateSelected ) - Icon( mSkinInactive->GetSubTexture( cUISkinState::StateMouseEnter ) ); - else - Icon( mSkinInactive->GetSubTexture( cUISkinState::StateNormal ) ); - else - mIcon->SubTexture( NULL ); - } - - if ( oActive != active ) { - cUIMenu * Menu = reinterpret_cast ( Parent() ); - - if ( !Menu->CheckControlSize( this ) ) { - if ( NULL != Icon()->SubTexture() ) { - Padding( Recti( 0, 0, 0, 0 ) ); - } - } - - OnValueChange(); - } -} - -void cUIMenuCheckBox::SwitchActive() { - Active( !mActive ); -} - -Uint32 cUIMenuCheckBox::OnMouseUp( const Vector2i &Pos, const Uint32 Flags ) { - cUIMenuItem::OnMouseUp( Pos, Flags ); - - if ( Parent()->Visible() && ( Flags & EE_BUTTONS_LRM ) ) - SwitchActive(); - - return 1; -} - -void cUIMenuCheckBox::OnStateChange() { - cUIMenuItem::OnStateChange(); - - Active( mActive ); -} - -bool cUIMenuCheckBox::InheritsFrom( const Uint32 Type ) { - if ( Type == UI_TYPE_MENUITEM ) - return true; - - return false; -} - -}} diff --git a/src/eepp/ui/cuimenuitem.cpp b/src/eepp/ui/cuimenuitem.cpp deleted file mode 100644 index 010cbc5ae..000000000 --- a/src/eepp/ui/cuimenuitem.cpp +++ /dev/null @@ -1,48 +0,0 @@ -#include -#include - -namespace EE { namespace UI { - -cUIMenuItem::cUIMenuItem( cUIPushButton::CreateParams& Params ) : - cUIPushButton( Params ) -{ - ApplyDefaultTheme(); -} - -cUIMenuItem::~cUIMenuItem() { -} - -Uint32 cUIMenuItem::Type() const { - return UI_TYPE_MENUITEM; -} - -bool cUIMenuItem::IsType( const Uint32& type ) const { - return cUIMenuItem::Type() == type ? true : cUIPushButton::IsType( type ); -} - -void cUIMenuItem::SetTheme( cUITheme * Theme ) { - cUIControl::SetThemeControl( Theme, "menuitem" ); - DoAfterSetTheme(); -} - -Uint32 cUIMenuItem::OnMouseEnter( const Vector2i &Pos, const Uint32 Flags ) { - cUIPushButton::OnMouseEnter( Pos, Flags ); - - reinterpret_cast ( Parent() )->SetItemSelected( this ); - - return 1; -} - -void cUIMenuItem::OnStateChange() { - cUIMenu * tMenu = reinterpret_cast ( Parent() ); - - if ( mSkinState->GetState() == cUISkinState::StateSelected ) { - mTextBox->Color( tMenu->mFontSelectedColor ); - } else if ( mSkinState->GetState() == cUISkinState::StateMouseEnter ) { - mTextBox->Color( tMenu->mFontOverColor ); - } else { - mTextBox->Color( tMenu->mFontColor ); - } -} - -}} diff --git a/src/eepp/ui/cuimenusubmenu.cpp b/src/eepp/ui/cuimenusubmenu.cpp deleted file mode 100644 index 0a120e7c6..000000000 --- a/src/eepp/ui/cuimenusubmenu.cpp +++ /dev/null @@ -1,158 +0,0 @@ -#include -#include -#include - -namespace EE { namespace UI { - -cUIMenuSubMenu::cUIMenuSubMenu( cUIMenuSubMenu::CreateParams& Params ) : - cUIMenuItem( Params ), - mSubMenu( NULL ), - mSkinArrow( NULL ), - mArrow( NULL ), - mTimeOver( 0.f ), - mMaxTime( Params.MouseOverTimeShowMenu ), - mCbId( 0 ), - mCbId2( 0 ) -{ - cUIGfx::CreateParams GfxParams; - GfxParams.Parent( this ); - GfxParams.SubTexture = NULL; - GfxParams.Flags = UI_AUTO_SIZE; - mArrow = eeNew( cUIGfx, ( GfxParams ) ); - mArrow->Visible( true ); - mArrow->Enabled( false ); - - SubMenu( Params.SubMenu ); - - ApplyDefaultTheme(); -} - -cUIMenuSubMenu::~cUIMenuSubMenu() { -} - -Uint32 cUIMenuSubMenu::Type() const { - return UI_TYPE_MENUSUBMENU; -} - -bool cUIMenuSubMenu::IsType( const Uint32& type ) const { - return cUIMenuSubMenu::Type() == type ? true : cUIMenuItem::IsType( type ); -} - -void cUIMenuSubMenu::SetTheme( cUITheme * Theme ) { - cUIMenuItem::SetTheme( Theme ); - - mSkinArrow = Theme->GetByName( Theme->Abbr() + "_" + "menuarrow" ); - - OnStateChange(); -} - -void cUIMenuSubMenu::OnSizeChange() { - cUIMenuItem::OnSizeChange(); - - mArrow->Pos( Parent()->Size().Width() - mArrow->Size().Width() - 1, 0 ); - mArrow->CenterVertical(); -} - -void cUIMenuSubMenu::OnStateChange() { - cUIMenuItem::OnStateChange(); - - if ( NULL != mSkinArrow ) { - if ( mSkinState->GetState() == cUISkinState::StateSelected ) - mArrow->SubTexture( mSkinArrow->GetSubTexture( cUISkinState::StateMouseEnter ) ); - else - mArrow->SubTexture( mSkinArrow->GetSubTexture( cUISkinState::StateNormal ) ); - - OnSizeChange(); - } -} - -void cUIMenuSubMenu::SubMenu( cUIMenu * SubMenu ) { - if ( NULL != mSubMenu && mSubMenu != SubMenu ) { - mSubMenu->RemoveEventListener( mCbId ); - mSubMenu->RemoveEventListener( mCbId2 ); - } - - mSubMenu = SubMenu; - - if ( NULL != mSubMenu ) { - mCbId = mSubMenu->AddEventListener( cUIEvent::EventOnEnabledChange, cb::Make1( this, &cUIMenuSubMenu::OnSubMenuFocusLoss ) ); - mCbId2 = mSubMenu->AddEventListener( cUIEvent::EventOnHideByClick, cb::Make1( this, &cUIMenuSubMenu::OnHideByClick ) ); - } -} - -cUIMenu * cUIMenuSubMenu::SubMenu() const { - return mSubMenu; -} - -Uint32 cUIMenuSubMenu::OnMouseMove( const Vector2i &Pos, const Uint32 Flags ) { - cUIMenuItem::OnMouseMove( Pos, Flags ); - - if ( NULL != mSubMenu && !mSubMenu->Visible() ) { - mTimeOver += cUIManager::instance()->Elapsed().AsMilliseconds(); - - if ( mTimeOver >= mMaxTime ) { - ShowSubMenu(); - } - } - - return 1; -} - -void cUIMenuSubMenu::ShowSubMenu() { - mSubMenu->Parent( Parent()->Parent() ); - - Vector2i Pos = this->Pos(); - ControlToScreen( Pos ); - Pos.x += mSize.Width() + reinterpret_cast ( Parent() )->Padding().Right; - - cUIMenu::FixMenuPos( Pos, mSubMenu, reinterpret_cast ( Parent() ), this ); - - mSubMenu->Parent()->WorldToControl( Pos ); - mSubMenu->Pos( Pos ); - - if ( !mSubMenu->Visible() ) { - mSubMenu->Show(); - } -} - -Uint32 cUIMenuSubMenu::OnMouseExit( const Vector2i &Pos, const Uint32 Flags ) { - cUIMenuItem::OnMouseExit( Pos, Flags ); - - mTimeOver = 0; - - return 1; -} - -cUIGfx * cUIMenuSubMenu::Arrow() const { - return mArrow; -} - -void cUIMenuSubMenu::OnSubMenuFocusLoss( const cUIEvent * Event ) { - cUIControl * FocusCtrl = cUIManager::instance()->FocusControl(); - - if ( Parent() != FocusCtrl && !Parent()->IsParentOf( FocusCtrl ) ) { - Parent()->SetFocus(); - } - - if ( mSubMenu->mClickHide ) { - reinterpret_cast( Parent() )->Hide(); - - mSubMenu->mClickHide = false; - } -} - -void cUIMenuSubMenu::OnHideByClick( const cUIEvent * Event ) { - cUIMenu * tMenu = reinterpret_cast( Parent() ); - - tMenu->mClickHide = true; - tMenu->Hide(); -} - -bool cUIMenuSubMenu::InheritsFrom( const Uint32 Type ) { - if ( Type == UI_TYPE_MENUITEM ) - return true; - - return false; -} - -}} diff --git a/src/eepp/ui/cuimessage.cpp b/src/eepp/ui/cuimessage.cpp deleted file mode 100644 index 9fc601e9b..000000000 --- a/src/eepp/ui/cuimessage.cpp +++ /dev/null @@ -1,29 +0,0 @@ -#include -#include - -namespace EE { namespace UI { - -cUIMessage::cUIMessage( cUIControl * Ctrl, const Uint32& Msg, const Uint32& Flags ) : - mCtrl( Ctrl ), - mMsg( Msg ), - mFlags( Flags ) -{ -} - -cUIMessage::~cUIMessage() -{ -} - -cUIControl * cUIMessage::Sender() const { - return mCtrl; -} - -const Uint32& cUIMessage::Msg() const { - return mMsg; -} - -const Uint32& cUIMessage::Flags() const { - return mFlags; -} - -}} diff --git a/src/eepp/ui/cuipopupmenu.cpp b/src/eepp/ui/cuipopupmenu.cpp deleted file mode 100644 index 270d885d9..000000000 --- a/src/eepp/ui/cuipopupmenu.cpp +++ /dev/null @@ -1,108 +0,0 @@ -#include -#include - -namespace EE { namespace UI { - -cUIPopUpMenu::cUIPopUpMenu( cUIPopUpMenu::CreateParams Params ) : - cUIMenu( Params ) -{ - ApplyDefaultTheme(); -} - -cUIPopUpMenu::~cUIPopUpMenu() { - OnClose(); -} - -Uint32 cUIPopUpMenu::Type() const { - return UI_TYPE_POPUPMENU; -} - -bool cUIPopUpMenu::IsType( const Uint32& type ) const { - return cUIPopUpMenu::Type() == type ? true : cUIMenu::IsType( type ); -} - -void cUIPopUpMenu::SetTheme( cUITheme * Theme ) { - cUIControl::SetThemeControl( Theme, "popupmenu" ); - DoAfterSetTheme(); -} - -bool cUIPopUpMenu::Show() { - if ( !Visible() || 0.f == mAlpha ) { - #ifdef EE_PLATFORM_TOUCH - mTE.Restart(); - #endif - - Enabled( true ); - Visible( true ); - - ToFront(); - - if ( cUIThemeManager::instance()->DefaultEffectsEnabled() ) { - if ( 255.f == Alpha() ) - StartAlphaAnim( 0.f, 255.f, cUIThemeManager::instance()->ControlsFadeInTime() ); - else - CreateFadeIn( cUIThemeManager::instance()->ControlsFadeInTime() ); - } - - SetFocus(); - - return true; - } - - return false; -} - -bool cUIPopUpMenu::Hide() { - if ( Visible() ) { - if ( !FadingOut() ) { - if ( NULL != mItemSelected ) - mItemSelected->SetSkinState( cUISkinState::StateNormal ); - - mItemSelected = NULL; - mItemSelectedIndex = eeINDEX_NOT_FOUND; - - if ( cUIThemeManager::instance()->DefaultEffectsEnabled() ) { - DisableFadeOut( cUIThemeManager::instance()->ControlsFadeOutTime() ); - } else { - Enabled( false ); - Visible( false ); - } - } - - return true; - } - - return false; -} - -void cUIPopUpMenu::OnComplexControlFocusLoss() { - Hide(); - - cUIMenu::OnComplexControlFocusLoss(); -} - -Uint32 cUIPopUpMenu::OnMessage( const cUIMessage * Msg ) { - switch ( Msg->Msg() ) { - case cUIMessage::MsgMouseUp: - { - #ifdef EE_PLATFORM_TOUCH - if ( mTE.Elapsed().AsMilliseconds() > 250.f ) { - #endif - if ( !Msg->Sender()->IsType( UI_TYPE_MENUSUBMENU ) && ( Msg->Flags() & EE_BUTTONS_LRM ) ) { - SendCommonEvent( cUIEvent::EventOnHideByClick ); - - if ( Visible() ) - cUIManager::instance()->MainControl()->SetFocus(); - - Hide(); - } - #ifdef EE_PLATFORM_TOUCH - } - #endif - } - } - - return cUIMenu::OnMessage( Msg ); -} - -}} diff --git a/src/eepp/ui/cuiselectbutton.cpp b/src/eepp/ui/cuiselectbutton.cpp deleted file mode 100644 index d0b01c082..000000000 --- a/src/eepp/ui/cuiselectbutton.cpp +++ /dev/null @@ -1,66 +0,0 @@ -#include -#include - -namespace EE { namespace UI { - -cUISelectButton::cUISelectButton( const cUIPushButton::CreateParams& Params ) : - cUIPushButton( Params ) -{ -} - -cUISelectButton::~cUISelectButton() { -} - -Uint32 cUISelectButton::Type() const { - return UI_TYPE_SELECTBUTTON; -} - -bool cUISelectButton::IsType( const Uint32& type ) const { - return cUISelectButton::Type() == type ? true : cUIPushButton::IsType( type ); -} - -void cUISelectButton::Select() { - bool wasSelected = Selected(); - - SetSkinState( cUISkinState::StateSelected ); - - mControlFlags |= UI_CTRL_FLAG_SELECTED; - - if ( !wasSelected ) { - cUIMessage tMsg( this, cUIMessage::MsgSelected, 0 ); - MessagePost( &tMsg ); - } -} - -void cUISelectButton::Unselect() { - if ( mControlFlags & UI_CTRL_FLAG_SELECTED ) - mControlFlags &= ~UI_CTRL_FLAG_SELECTED; - - SetSkinState( cUISkinState::StateNormal ); -} - -bool cUISelectButton::Selected() const { - return 0 != ( mControlFlags & UI_CTRL_FLAG_SELECTED ); -} - -void cUISelectButton::OnStateChange() { - if ( mSkinState->GetState() != cUISkinState::StateSelected && Selected() ) { - if ( mSkinState->StateExists( cUISkinState::StateSelected ) ) { - SetSkinState( cUISkinState::StateSelected ); - } - } - - if ( Parent()->Type() & UI_TYPE_WINMENU ) { - cUIWinMenu * Menu = reinterpret_cast ( Parent() ); - - if ( mSkinState->GetState() == cUISkinState::StateSelected ) { - TextBox()->Color( Menu->FontSelectedColor() ); - } else if ( mSkinState->GetState() == cUISkinState::StateMouseEnter ) { - TextBox()->Color( Menu->FontOverColor() ); - } else { - TextBox()->Color( Menu->FontColor() ); - } - } -} - -}} diff --git a/src/eepp/ui/cuiseparator.cpp b/src/eepp/ui/cuiseparator.cpp deleted file mode 100644 index 614533e4b..000000000 --- a/src/eepp/ui/cuiseparator.cpp +++ /dev/null @@ -1,31 +0,0 @@ -#include -#include - -namespace EE { namespace UI { - -cUISeparator::cUISeparator( cUIControlAnim::CreateParams Params ) : - cUIControlAnim( Params ) -{ - ApplyDefaultTheme(); -} - -cUISeparator::~cUISeparator() { -} - -Uint32 cUISeparator::Type() const { - return UI_TYPE_SEPARATOR; -} - -bool cUISeparator::IsType( const Uint32& type ) const { - return cUISeparator::Type() == type ? true : cUIControlAnim::IsType( type ); -} - -void cUISeparator::SetTheme( cUITheme * Theme ) { - cUIControl::SetThemeControl( Theme, "separator" ); - - if ( NULL != mSkinState && NULL != mSkinState->GetSkin() && NULL != mSkinState->GetSkin()->GetSubTexture( cUISkinState::StateNormal ) ) { - Size( mSize.Width(), mSkinState->GetSkin()->GetSubTexture( cUISkinState::StateNormal )->RealSize().Height() ); - } -} - -}} diff --git a/src/eepp/ui/cuiskin.cpp b/src/eepp/ui/cuiskin.cpp deleted file mode 100644 index 58ac3d26c..000000000 --- a/src/eepp/ui/cuiskin.cpp +++ /dev/null @@ -1,85 +0,0 @@ -#include -#include - -namespace EE { namespace UI { - -const char * UISkinStatesNames[] = { - "normal", - "focus", - "selected", - "menter", - "mexit", - "mdown" -}; - -const char * cUISkin::GetSkinStateName( const Uint32& State ) { - return UISkinStatesNames[ State ]; -} - -cUISkin::cUISkin( const std::string& Name, const Uint32& Type ) : - mType( Type ), - mName( Name ), - mNameHash( String::Hash( mName ) ), - mTheme(NULL) -{ - ColorA tColor( 255, 255, 255, 255 ); - - mColorDefault = tColor.GetValue(); - - for ( Int32 i = 0; i < cUISkinState::StateCount; i++ ) { - mColor[ i ] = tColor; - } -} - -cUISkin::~cUISkin() { -} - -void cUISkin::SetColor( const Uint32& State, const ColorA& Color ) { - eeASSERT ( State < cUISkinState::StateCount ); - - BitOp::WriteBitKey( &mColorDefault, State, 0 ); - - mColor[ State ] = Color; -} - -const ColorA& cUISkin::GetColor( const Uint32& State ) const { - eeASSERT ( State < cUISkinState::StateCount ); - - return mColor[ State ]; -} - -const std::string& cUISkin::Name() const { - return mName; -} - -void cUISkin::Name( const std::string& name ) { - mName = name; - mNameHash = String::Hash( mName ); -} - -const Uint32& cUISkin::Id() const { - return mNameHash; -} - -void cUISkin::SetSkins() { - for ( Int32 i = 0; i < cUISkinState::StateCount; i++ ) - SetSkin( i ); -} - -cUITheme * cUISkin::Theme() const { - return mTheme; -} - -void cUISkin::Theme( cUITheme * theme ) { - mTheme = theme; -} - -const Uint32& cUISkin::GetType() const { - return mType; -} - -bool cUISkin::GetColorDefault( const Uint32& State ) { - return BitOp::ReadBitKey( &mColorDefault, State ); -} - -}} diff --git a/src/eepp/ui/cuiskinsimple.cpp b/src/eepp/ui/cuiskinsimple.cpp deleted file mode 100644 index 40d2d9b02..000000000 --- a/src/eepp/ui/cuiskinsimple.cpp +++ /dev/null @@ -1,75 +0,0 @@ -#include -#include - -namespace EE { namespace UI { - -cUISkinSimple::cUISkinSimple( const std::string& Name ) : - cUISkin( Name, UISkinSimple ) -{ - for ( Int32 i = 0; i < cUISkinState::StateCount; i++ ) - mSubTexture[ i ] = NULL; - - SetSkins(); -} - -cUISkinSimple::~cUISkinSimple() { -} - -void cUISkinSimple::Draw( const Float& X, const Float& Y, const Float& Width, const Float& Height, const Uint32& Alpha, const Uint32& State ) { - if ( 0 == Alpha ) - return; - - SubTexture * tSubTexture = mSubTexture[ State ]; - mTempColor = mColor[ State ]; - - if ( NULL != tSubTexture ) { - tSubTexture->DestSize( Sizef( Width, Height ) ); - - if ( mTempColor.Alpha != Alpha ) { - mTempColor.Alpha = (Uint8)( (Float)mTempColor.Alpha * ( (Float)Alpha / 255.f ) ); - } - - tSubTexture->Draw( X, Y, mTempColor ); - - tSubTexture->ResetDestSize(); - } -} - -void cUISkinSimple::SetSkin( const Uint32& State ) { - eeASSERT ( State < cUISkinState::StateCount ); - - std::string Name( mName + "_" + cUISkin::GetSkinStateName( State ) ); - - mSubTexture[ State ] = TextureAtlasManager::instance()->GetSubTextureByName( Name ); -} - -SubTexture * cUISkinSimple::GetSubTexture( const Uint32& State ) const { - eeASSERT ( State < cUISkinState::StateCount ); - - return mSubTexture[ State ]; -} - -void cUISkinSimple::StateNormalToState( const Uint32& State ) { - if ( NULL == mSubTexture[ State ] ) - mSubTexture[ State ] = mSubTexture[ cUISkinState::StateNormal ]; -} - -cUISkinSimple * cUISkinSimple::Copy( const std::string& NewName, const bool& CopyColorsState ) { - cUISkinSimple * SkinS = eeNew( cUISkinSimple, ( NewName ) ); - - if ( CopyColorsState ) { - SkinS->mColorDefault = mColorDefault; - - memcpy( &SkinS->mColor[0], &mColor[0], cUISkinState::StateCount * sizeof(ColorA) ); - } - - memcpy( &SkinS->mSubTexture[0], &mSubTexture[0], cUISkinState::StateCount * sizeof(SubTexture*) ); - - return SkinS; -} - -cUISkin * cUISkinSimple::Copy() { - return Copy( mName, true ); -} - -}} diff --git a/src/eepp/ui/cuisliderbutton.cpp b/src/eepp/ui/cuisliderbutton.cpp deleted file mode 100644 index 58a59d30f..000000000 --- a/src/eepp/ui/cuisliderbutton.cpp +++ /dev/null @@ -1,22 +0,0 @@ -#include -#include - -namespace EE { namespace UI { namespace Private { - -cUISliderButton::cUISliderButton( const cUIControlAnim::CreateParams& Params ) : - cUIControlAnim( Params ) -{ - ApplyDefaultTheme(); -} - -cUISliderButton::~cUISliderButton() { -} - -void cUISliderButton::OnPosChange() { - cUIControlAnim::OnPosChange(); - - cUISlider * Slider = reinterpret_cast ( mParentCtrl ); - Slider->FixSliderPos(); -} - -}}} diff --git a/src/eepp/ui/cuithememanager.cpp b/src/eepp/ui/cuithememanager.cpp deleted file mode 100644 index 62c5ba260..000000000 --- a/src/eepp/ui/cuithememanager.cpp +++ /dev/null @@ -1,120 +0,0 @@ -#include -#include -#include - -namespace EE { namespace UI { - -SINGLETON_DECLARE_IMPLEMENTATION(cUIThemeManager) - -cUIThemeManager::cUIThemeManager() : - ResourceManager( true ), - mFont( NULL ), - mThemeDefault( NULL ), - mAutoApplyDefaultTheme( true ), - mEnableDefaultEffects( false ), - mFadeInTime( Milliseconds( 100.f ) ), - mFadeOutTime( Milliseconds ( 100.f ) ), - mTooltipTimeToShow( Milliseconds( 200 ) ), - mTooltipFollowMouse( true ), - mCursorSize( 16, 16 ) -{ -} - -cUIThemeManager::~cUIThemeManager() { -} - -void cUIThemeManager::DefaultFont( Font * Font ) { - mFont = Font; -} - -Font * cUIThemeManager::DefaultFont() const { - return mFont; -} - -void cUIThemeManager::SetTheme( const std::string& Theme ) { - SetTheme( GetByName( Theme ) ); -} - -void cUIThemeManager::SetTheme( cUITheme * Theme ) { - cUIControl * MainCtrl = cUIManager::instance()->MainControl(); - - if ( NULL != MainCtrl ) { - MainCtrl->SetThemeToChilds( Theme ); - MainCtrl->SetTheme( Theme ); - } -} - -void cUIThemeManager::DefaultTheme( cUITheme * Theme ) { - mThemeDefault = Theme; -} - -void cUIThemeManager::DefaultTheme( const std::string& Theme ) { - DefaultTheme( cUIThemeManager::instance()->GetByName( Theme ) ); -} - -cUITheme * cUIThemeManager::DefaultTheme() const { - return mThemeDefault; -} - -void cUIThemeManager::ApplyDefaultTheme( cUIControl * Control ) { - if ( mAutoApplyDefaultTheme && NULL != mThemeDefault && NULL != Control ) - Control->SetTheme( mThemeDefault ); -} - -void cUIThemeManager::AutoApplyDefaultTheme( const bool& apply ) { - mAutoApplyDefaultTheme = apply; -} - -const bool& cUIThemeManager::AutoApplyDefaultTheme() const { - return mAutoApplyDefaultTheme; -} - -void cUIThemeManager::DefaultEffectsEnabled( const bool& Enabled ) { - mEnableDefaultEffects = Enabled; -} - -const bool& cUIThemeManager::DefaultEffectsEnabled() const { - return mEnableDefaultEffects; -} - -const Time& cUIThemeManager::ControlsFadeInTime() const { - return mFadeInTime; -} - -void cUIThemeManager::ControlsFadeInTime( const Time& Time ) { - mFadeInTime = Time; -} - -const Time& cUIThemeManager::ControlsFadeOutTime() const { - return mFadeOutTime; -} - -void cUIThemeManager::ControlsFadeOutTime( const Time& Time ) { - mFadeOutTime = Time; -} - -void cUIThemeManager::TooltipTimeToShow( const Time& Time ) { - mTooltipTimeToShow = Time; -} - -const Time& cUIThemeManager::TooltipTimeToShow() const { - return mTooltipTimeToShow; -} - -void cUIThemeManager::TooltipFollowMouse( const bool& Follow ) { - mTooltipFollowMouse = Follow; -} - -const bool& cUIThemeManager::TooltipFollowMouse() const { - return mTooltipFollowMouse; -} - -void cUIThemeManager::CursorSize( const Sizei& Size ) { - mCursorSize = Size; -} - -const Sizei& cUIThemeManager::CursorSize() const { - return mCursorSize; -} - -}} diff --git a/src/eepp/ui/tools/ctextureatlasnew.hpp b/src/eepp/ui/tools/ctextureatlasnew.hpp deleted file mode 100644 index 0092c12b2..000000000 --- a/src/eepp/ui/tools/ctextureatlasnew.hpp +++ /dev/null @@ -1,48 +0,0 @@ -#ifndef EE_UITOOLSCTEXTUREATLASNEW_HPP -#define EE_UITOOLSCTEXTUREATLASNEW_HPP - -#include -#include -#include -#include -#include -#include - -namespace EE { namespace UI { namespace Tools { - -class EE_API TextureAtlasNew { - public: - typedef cb::Callback1 TGCreateCb; - - TextureAtlasNew( TGCreateCb NewTGCb = TGCreateCb() ); - - virtual ~TextureAtlasNew(); - protected: - cUITheme * mTheme; - cUIWindow * mUIWindow; - TGCreateCb mNewTGCb; - cUIComboBox * mComboWidth; - cUIComboBox * mComboHeight; - cUISpinBox * mPixelSpace; - cUITextInput * mTGPath; - cUIPushButton * mSetPathButton; - cUIDropDownList * mSaveFileType; - - void WindowClose( const cUIEvent * Event ); - - void CancelClick( const cUIEvent * Event ); - - void OKClick( const cUIEvent * Event ); - - cUITextBox * CreateTxtBox( Vector2i Pos, const String& Text ); - - void OnDialogFolderSelect( const cUIEvent * Event ); - - void OnSelectFolder( const cUIEvent * Event ); - - void TextureAtlasSave( const cUIEvent * Event ); -}; - -}}} - -#endif diff --git a/src/eepp/ui/tools/ctextureatlaseditor.cpp b/src/eepp/ui/tools/textureatlaseditor.cpp similarity index 63% rename from src/eepp/ui/tools/ctextureatlaseditor.cpp rename to src/eepp/ui/tools/textureatlaseditor.cpp index 491217f4a..c53618579 100644 --- a/src/eepp/ui/tools/ctextureatlaseditor.cpp +++ b/src/eepp/ui/tools/textureatlaseditor.cpp @@ -1,41 +1,41 @@ -#include -#include -#include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include +#include +#include +#include #include namespace EE { namespace UI { namespace Tools { -TextureAtlasEditor::TextureAtlasEditor( cUIWindow * AttatchTo, const TGEditorCloseCb& callback ) : +TextureAtlasEditor::TextureAtlasEditor( UIWindow * AttatchTo, const TGEditorCloseCb& callback ) : mUIWindow( AttatchTo ), mCloseCb( callback ), mTexturePacker( NULL ), mTextureAtlasLoader( NULL ), mCurSubTexture( NULL ) { - if ( NULL == cUIThemeManager::instance()->DefaultTheme() ) { + if ( NULL == UIThemeManager::instance()->DefaultTheme() ) { eePRINTL( "TextureAtlasEditor needs a default theme assigned to work." ); return; } - mTheme = cUIThemeManager::instance()->DefaultTheme(); + mTheme = UIThemeManager::instance()->DefaultTheme(); if ( NULL == mUIWindow ) { - mUIWindow = cUIManager::instance()->MainControl(); + mUIWindow = UIManager::instance()->MainControl(); mUIWindow->SetSkinFromTheme( mTheme, "winback" ); } - if ( cUIManager::instance()->MainControl() == mUIWindow ) { + if ( UIManager::instance()->MainControl() == mUIWindow ) { mUIContainer = mUIWindow; } else { mUIContainer = mUIWindow->Container(); } - cUITextBox * TxtBox; + UITextBox * TxtBox; Uint32 Flags = UI_CONTROL_DEFAULT_ALIGN | UI_ANCHOR_TOP | UI_ANCHOR_RIGHT | UI_CLIP_ENABLE | UI_AUTO_SIZE | UI_TEXT_SELECTION_ENABLED; Uint32 InitY = 230; @@ -43,7 +43,7 @@ TextureAtlasEditor::TextureAtlasEditor( cUIWindow * AttatchTo, const TGEditorClo mSubTextureList = mTheme->CreateListBox( mUIContainer, Sizei( 200, 156 ), Vector2i( mUIContainer->Size().Width() - 205, 50 ), UI_CONTROL_DEFAULT_ALIGN | UI_CLIP_ENABLE | UI_AUTO_PADDING | UI_ANCHOR_RIGHT | UI_ANCHOR_TOP ); mSubTextureList->Size( mSubTextureList->Size().Width(), mSubTextureList->RowHeight() * 9 + mSubTextureList->PaddingContainer().Top + mSubTextureList->PaddingContainer().Bottom ); - mSubTextureList->AddEventListener( cUIEvent::EventOnItemSelected, cb::Make1( this, &TextureAtlasEditor::OnSubTextureChange ) ); + mSubTextureList->AddEventListener( UIEvent::EventOnItemSelected, cb::Make1( this, &TextureAtlasEditor::OnSubTextureChange ) ); CreateTxtBox( Vector2i( mUIContainer->Size().Width() - 205, InitY ), "Current SubTexture:" ); @@ -53,7 +53,7 @@ TextureAtlasEditor::TextureAtlasEditor( cUIWindow * AttatchTo, const TGEditorClo mSpinOffX->MinValue( -32000 ); mSpinOffX->MaxValue( 32000 ); mSpinOffX->Pos( mUIContainer->Size().Width() - mSpinOffX->Size().Width() - 10, InitY ); - mSpinOffX->AddEventListener( cUIEvent::EventOnValueChange, cb::Make1( this, &TextureAtlasEditor::OnOffXChange ) ); + mSpinOffX->AddEventListener( UIEvent::EventOnValueChange, cb::Make1( this, &TextureAtlasEditor::OnOffXChange ) ); TxtBox = CreateTxtBox( Vector2i(), "Offset X:" ); TxtBox->Pos( mSpinOffX->Pos().x - 10 - TxtBox->Size().Width(), InitY ); @@ -64,7 +64,7 @@ TextureAtlasEditor::TextureAtlasEditor( cUIWindow * AttatchTo, const TGEditorClo mSpinOffY->MinValue( -32000 ); mSpinOffY->MaxValue( 32000 ); mSpinOffY->Pos( mUIContainer->Size().Width() - mSpinOffY->Size().Width() - 10, InitY ); - mSpinOffY->AddEventListener( cUIEvent::EventOnValueChange, cb::Make1( this, &TextureAtlasEditor::OnOffYChange ) ); + mSpinOffY->AddEventListener( UIEvent::EventOnValueChange, cb::Make1( this, &TextureAtlasEditor::OnOffYChange ) ); TxtBox = CreateTxtBox( Vector2i(), "Offset Y:" ); TxtBox->Pos( mSpinOffY->Pos().x - 10 - TxtBox->Size().Width(), InitY ); @@ -73,7 +73,7 @@ TextureAtlasEditor::TextureAtlasEditor( cUIWindow * AttatchTo, const TGEditorClo mSpinDestW = mTheme->CreateSpinBox( mUIContainer, Sizei( 100, 22 ), Vector2i(), Flags, 0, false ); mSpinDestW->MaxValue( 32000 ); mSpinDestW->Pos( mUIContainer->Size().Width() - mSpinDestW->Size().Width() - 10, InitY ); - mSpinDestW->AddEventListener( cUIEvent::EventOnValueChange, cb::Make1( this, &TextureAtlasEditor::OnDestWChange ) ); + mSpinDestW->AddEventListener( UIEvent::EventOnValueChange, cb::Make1( this, &TextureAtlasEditor::OnDestWChange ) ); TxtBox = CreateTxtBox( Vector2i(), "Dest. Width:" ); TxtBox->Pos( mSpinDestW->Pos().x - 10 - TxtBox->Size().Width(), InitY ); @@ -82,34 +82,34 @@ TextureAtlasEditor::TextureAtlasEditor( cUIWindow * AttatchTo, const TGEditorClo mSpinDestH = mTheme->CreateSpinBox( mUIContainer, Sizei( 100, 22 ), Vector2i(), Flags, 0, false ); mSpinDestH->MaxValue( 32000 ); mSpinDestH->Pos( mUIContainer->Size().Width() - mSpinDestH->Size().Width() - 10, InitY ); - mSpinDestH->AddEventListener( cUIEvent::EventOnValueChange, cb::Make1( this, &TextureAtlasEditor::OnDestHChange ) ); + mSpinDestH->AddEventListener( UIEvent::EventOnValueChange, cb::Make1( this, &TextureAtlasEditor::OnDestHChange ) ); TxtBox = CreateTxtBox( Vector2i(), "Dest. Height:" ); TxtBox->Pos( mSpinDestH->Pos().x - 10 - TxtBox->Size().Width(), InitY ); Uint32 ButFlags = UI_CONTROL_ALIGN_CENTER | UI_ANCHOR_TOP | UI_ANCHOR_RIGHT | UI_AUTO_SIZE; - cUIPushButton * ResetButton = mTheme->CreatePushButton( mUIContainer, Sizei( 120, 22 ), Vector2i( mUIContainer->Size().Width() - 120 - 5 , mSpinDestH->Pos().y + mSpinDestH->Size().Height() + 8 ), ButFlags ); + UIPushButton * ResetButton = mTheme->CreatePushButton( mUIContainer, Sizei( 120, 22 ), Vector2i( mUIContainer->Size().Width() - 120 - 5 , mSpinDestH->Pos().y + mSpinDestH->Size().Height() + 8 ), ButFlags ); ResetButton->Text( "Reset Dest. Size" ); - ResetButton->AddEventListener( cUIEvent::EventMouseClick, cb::Make1( this, &TextureAtlasEditor::OnResetDestSize ) ); + ResetButton->AddEventListener( UIEvent::EventMouseClick, cb::Make1( this, &TextureAtlasEditor::OnResetDestSize ) ); - cUIPushButton * ResetOffsetButton = mTheme->CreatePushButton( mUIContainer, Sizei( 120, 22 ), Vector2i( ResetButton->Pos().x, ResetButton->Pos().y + ResetButton->Size().Height() + 8 ), ButFlags ); - ResetOffsetButton->AddEventListener( cUIEvent::EventMouseClick, cb::Make1( this, &TextureAtlasEditor::OnResetOffset ) ); + UIPushButton * ResetOffsetButton = mTheme->CreatePushButton( mUIContainer, Sizei( 120, 22 ), Vector2i( ResetButton->Pos().x, ResetButton->Pos().y + ResetButton->Size().Height() + 8 ), ButFlags ); + ResetOffsetButton->AddEventListener( UIEvent::EventMouseClick, cb::Make1( this, &TextureAtlasEditor::OnResetOffset ) ); ResetOffsetButton->Text( "Reset Offset" ); - cUIPushButton * CenterOffsetButton = mTheme->CreatePushButton( mUIContainer, Sizei( 120, 22 ), Vector2i( ResetOffsetButton->Pos().x, ResetOffsetButton->Pos().y + ResetOffsetButton->Size().Height() + 8 ), ButFlags ); - CenterOffsetButton->AddEventListener( cUIEvent::EventMouseClick, cb::Make1( this, &TextureAtlasEditor::OnCenterOffset ) ); + UIPushButton * CenterOffsetButton = mTheme->CreatePushButton( mUIContainer, Sizei( 120, 22 ), Vector2i( ResetOffsetButton->Pos().x, ResetOffsetButton->Pos().y + ResetOffsetButton->Size().Height() + 8 ), ButFlags ); + CenterOffsetButton->AddEventListener( UIEvent::EventMouseClick, cb::Make1( this, &TextureAtlasEditor::OnCenterOffset ) ); CenterOffsetButton->Text( "Centered Offset" ); - cUIPushButton * HBOffsetButton = mTheme->CreatePushButton( mUIContainer, Sizei( 120, 22 ), Vector2i( CenterOffsetButton->Pos().x, CenterOffsetButton->Pos().y + CenterOffsetButton->Size().Height() + 8 ), ButFlags ); - HBOffsetButton->AddEventListener( cUIEvent::EventMouseClick, cb::Make1( this, &TextureAtlasEditor::OnHBOffset ) ); + UIPushButton * HBOffsetButton = mTheme->CreatePushButton( mUIContainer, Sizei( 120, 22 ), Vector2i( CenterOffsetButton->Pos().x, CenterOffsetButton->Pos().y + CenterOffsetButton->Size().Height() + 8 ), ButFlags ); + HBOffsetButton->AddEventListener( UIEvent::EventMouseClick, cb::Make1( this, &TextureAtlasEditor::OnHBOffset ) ); HBOffsetButton->Text( "Half-Bottom Offset" ); mUIWindow->Title( "Texture Atlas Editor" ); - mUIWindow->AddEventListener( cUIEvent::EventOnWindowClose, cb::Make1( this, &TextureAtlasEditor::WindowClose ) ); + mUIWindow->AddEventListener( UIEvent::EventOnWindowClose, cb::Make1( this, &TextureAtlasEditor::WindowClose ) ); CreateTGEditor(); - cUIComplexControl::CreateParams Params; + UIComplexControl::CreateParams Params; Params.Parent( mUIContainer ); Params.PosSet( 0, mWinMenu->Size().Height() ); Params.SizeSet( 800, 600 ); @@ -119,20 +119,20 @@ TextureAtlasEditor::TextureAtlasEditor( cUIWindow * AttatchTo, const TGEditorClo mSubTextureEditor->Visible( true ); mSubTextureEditor->Enabled( true ); - mTGEU = eeNew( cUITGEUpdater, ( cUITGEUpdater::CreateParams(), this ) ); + mTGEU = eeNew( UITGEUpdater, ( UITGEUpdater::CreateParams(), this ) ); } TextureAtlasEditor::~TextureAtlasEditor() { eeSAFE_DELETE( mTexturePacker ); eeSAFE_DELETE( mTextureAtlasLoader ); - if ( !cUIManager::instance()->IsShootingDown() ) { + if ( !UIManager::instance()->IsShootingDown() ) { mTGEU->Close(); } } -void TextureAtlasEditor::OnResetDestSize( const cUIEvent * Event ) { - const cUIEventMouse * MouseEvent = reinterpret_cast ( Event ); +void TextureAtlasEditor::OnResetDestSize( const UIEvent * Event ) { + const UIEventMouse * MouseEvent = reinterpret_cast ( Event ); if ( NULL != mCurSubTexture && MouseEvent->Flags() & EE_BUTTON_LMASK ) { Sizei RealSize = mCurSubTexture->RealSize(); @@ -144,8 +144,8 @@ void TextureAtlasEditor::OnResetDestSize( const cUIEvent * Event ) { } } -void TextureAtlasEditor::OnResetOffset( const cUIEvent * Event ) { - const cUIEventMouse * MouseEvent = reinterpret_cast ( Event ); +void TextureAtlasEditor::OnResetOffset( const UIEvent * Event ) { + const UIEventMouse * MouseEvent = reinterpret_cast ( Event ); if ( NULL != mCurSubTexture && MouseEvent->Flags() & EE_BUTTON_LMASK ) { mSpinOffX->Value( 0 ); @@ -153,8 +153,8 @@ void TextureAtlasEditor::OnResetOffset( const cUIEvent * Event ) { } } -void TextureAtlasEditor::OnCenterOffset( const cUIEvent * Event ) { - const cUIEventMouse * MouseEvent = reinterpret_cast ( Event ); +void TextureAtlasEditor::OnCenterOffset( const UIEvent * Event ) { + const UIEventMouse * MouseEvent = reinterpret_cast ( Event ); if ( NULL != mCurSubTexture && MouseEvent->Flags() & EE_BUTTON_LMASK ) { Sizei NSize( -( (Int32)mCurSubTexture->DestSize().x / 2 ), -( (Int32)mCurSubTexture->DestSize().y / 2 ) ); @@ -164,8 +164,8 @@ void TextureAtlasEditor::OnCenterOffset( const cUIEvent * Event ) { } } -void TextureAtlasEditor::OnHBOffset( const cUIEvent * Event ) { - const cUIEventMouse * MouseEvent = reinterpret_cast ( Event ); +void TextureAtlasEditor::OnHBOffset( const UIEvent * Event ) { + const UIEventMouse * MouseEvent = reinterpret_cast ( Event ); if ( NULL != mCurSubTexture && MouseEvent->Flags() & EE_BUTTON_LMASK ) { Sizei NSize( -( (Int32)mCurSubTexture->DestSize().x / 2 ), -(Int32)mCurSubTexture->DestSize().y ); @@ -175,35 +175,35 @@ void TextureAtlasEditor::OnHBOffset( const cUIEvent * Event ) { } } -void TextureAtlasEditor::OnOffXChange( const cUIEvent * Event ) { +void TextureAtlasEditor::OnOffXChange( const UIEvent * Event ) { if ( NULL != mCurSubTexture ) { mCurSubTexture->Offset( Vector2i( (Int32)mSpinOffX->Value(), mCurSubTexture->Offset().y ) ); } } -void TextureAtlasEditor::OnOffYChange( const cUIEvent * Event ) { +void TextureAtlasEditor::OnOffYChange( const UIEvent * Event ) { if ( NULL != mCurSubTexture ) { mCurSubTexture->Offset( Vector2i( mCurSubTexture->Offset().x, (Int32)mSpinOffY->Value() ) ); } } -void TextureAtlasEditor::OnDestWChange( const cUIEvent * Event ) { +void TextureAtlasEditor::OnDestWChange( const UIEvent * Event ) { if ( NULL != mCurSubTexture ) { mCurSubTexture->DestSize( Sizef( (Int32)mSpinDestW->Value(), mCurSubTexture->DestSize().y ) ); } } -void TextureAtlasEditor::OnDestHChange( const cUIEvent * Event ) { +void TextureAtlasEditor::OnDestHChange( const UIEvent * Event ) { if ( NULL != mCurSubTexture ) { mCurSubTexture->DestSize( Sizef( mCurSubTexture->DestSize().x, (Int32)mSpinDestH->Value() ) ); } } -cUITextBox * TextureAtlasEditor::CreateTxtBox( Vector2i Pos, const String& Text ) { +UITextBox * TextureAtlasEditor::CreateTxtBox( Vector2i Pos, const String& Text ) { return mTheme->CreateTextBox( Text, mUIContainer, Sizei(), Pos, UI_CONTROL_DEFAULT_ALIGN | UI_ANCHOR_TOP | UI_ANCHOR_RIGHT | UI_DRAW_SHADOW | UI_AUTO_SIZE ); } -void TextureAtlasEditor::WindowClose( const cUIEvent * Event ) { +void TextureAtlasEditor::WindowClose( const UIEvent * Event ) { if ( mCloseCb.IsSet() ) mCloseCb(); @@ -217,7 +217,7 @@ void TextureAtlasEditor::CreateTGEditor() { void TextureAtlasEditor::CreateWinMenu() { mWinMenu = mTheme->CreateWinMenu( mUIContainer ); - cUIPopUpMenu * PU = mTheme->CreatePopUpMenu(); + UIPopUpMenu * PU = mTheme->CreatePopUpMenu(); PU->Add( "New...", mTheme->GetIconByName( "document-new" ) ); PU->Add( "Open...", mTheme->GetIconByName( "document-open" ) ); PU->AddSeparator(); @@ -227,23 +227,23 @@ void TextureAtlasEditor::CreateWinMenu() { PU->AddSeparator(); PU->Add( "Quit", mTheme->GetIconByName( "quit" ) ); - PU->AddEventListener( cUIEvent::EventOnItemClicked, cb::Make1( this, &TextureAtlasEditor::FileMenuClick ) ); + PU->AddEventListener( UIEvent::EventOnItemClicked, cb::Make1( this, &TextureAtlasEditor::FileMenuClick ) ); mWinMenu->AddMenuButton( "File", PU ); } -void TextureAtlasEditor::FileMenuClick( const cUIEvent * Event ) { +void TextureAtlasEditor::FileMenuClick( const UIEvent * Event ) { if ( !Event->Ctrl()->IsType( UI_TYPE_MENUITEM ) ) return; - const String& txt = reinterpret_cast ( Event->Ctrl() )->Text(); + const String& txt = reinterpret_cast ( Event->Ctrl() )->Text(); if ( "New..." == txt ) { eeNew( TextureAtlasNew, ( cb::Make1( this, &TextureAtlasEditor::OnTextureAtlasCreate ) ) ); } else if ( "Open..." == txt ) { - cUICommonDialog * TGDialog = mTheme->CreateCommonDialog( NULL, Sizei(), Vector2i(), UI_CONTROL_DEFAULT_FLAGS_CENTERED, UI_WIN_DEFAULT_FLAGS | UI_WIN_MAXIMIZE_BUTTON | UI_WIN_MODAL, Sizei(), 255, UI_CDL_DEFAULT_FLAGS, std::string( "*" ) + EE_TEXTURE_ATLAS_EXTENSION ); + UICommonDialog * TGDialog = mTheme->CreateCommonDialog( NULL, Sizei(), Vector2i(), UI_CONTROL_DEFAULT_FLAGS_CENTERED, UI_WIN_DEFAULT_FLAGS | UI_WIN_MAXIMIZE_BUTTON | UI_WIN_MODAL, Sizei(), 255, UI_CDL_DEFAULT_FLAGS, std::string( "*" ) + EE_TEXTURE_ATLAS_EXTENSION ); TGDialog->Title( "Open Texture Atlas" ); - TGDialog->AddEventListener( cUIEvent::EventOpenFile, cb::Make1( this, &TextureAtlasEditor::OpenTextureAtlas ) ); + TGDialog->AddEventListener( UIEvent::EventOpenFile, cb::Make1( this, &TextureAtlasEditor::OpenTextureAtlas ) ); TGDialog->Center(); TGDialog->Show(); } else if ( "Save" == txt ) { @@ -252,8 +252,8 @@ void TextureAtlasEditor::FileMenuClick( const cUIEvent * Event ) { } } else if ( "Close" == txt ) { if ( NULL != mTextureAtlasLoader && mTextureAtlasLoader->IsLoaded() ) { - cUIMessageBox * MsgBox = mTheme->CreateMessageBox( MSGBOX_OKCANCEL, "Do you really want to close the current texture atlas?\nAll changes will be lost." ); - MsgBox->AddEventListener( cUIEvent::EventMsgBoxConfirmClick, cb::Make1( this, &TextureAtlasEditor::OnTextureAtlasClose ) ); + UIMessageBox * MsgBox = mTheme->CreateMessageBox( MSGBOX_OKCANCEL, "Do you really want to close the current texture atlas?\nAll changes will be lost." ); + MsgBox->AddEventListener( UIEvent::EventMsgBoxConfirmClick, cb::Make1( this, &TextureAtlasEditor::OnTextureAtlasClose ) ); MsgBox->Title( "Close Texture Atlas?" ); MsgBox->Center(); MsgBox->Show(); @@ -261,8 +261,8 @@ void TextureAtlasEditor::FileMenuClick( const cUIEvent * Event ) { OnTextureAtlasClose( NULL ); } } else if ( "Quit" == txt ) { - if ( mUIWindow == cUIManager::instance()->MainControl() ) { - cUIManager::instance()->GetWindow()->Close(); + if ( mUIWindow == UIManager::instance()->MainControl() ) { + UIManager::instance()->GetWindow()->Close(); } else { mUIWindow->CloseWindow(); } @@ -310,7 +310,7 @@ void TextureAtlasEditor::FillSubTextureList() { mSubTextureList->VerticalScrollBar()->ClickStep( 8.f / (Float)mSubTextureList->Count() ); } -void TextureAtlasEditor::OnSubTextureChange( const cUIEvent * Event ) { +void TextureAtlasEditor::OnSubTextureChange( const UIEvent * Event ) { if ( NULL != mTextureAtlasLoader && NULL != mTextureAtlasLoader->GetTextureAtlas() ) { mCurSubTexture = mTextureAtlasLoader->GetTextureAtlas()->GetByName( mSubTextureList->GetItemSelectedText() ); @@ -330,8 +330,8 @@ void TextureAtlasEditor::Update() { } } -void TextureAtlasEditor::OpenTextureAtlas( const cUIEvent * Event ) { - cUICommonDialog * CDL = reinterpret_cast ( Event->Ctrl() ); +void TextureAtlasEditor::OpenTextureAtlas( const UIEvent * Event ) { + UICommonDialog * CDL = reinterpret_cast ( Event->Ctrl() ); eeSAFE_DELETE( mTextureAtlasLoader ); bool threaded = true; @@ -348,13 +348,13 @@ void TextureAtlasEditor::OnTextureAtlasLoaded( TextureAtlasLoader * TGLoader ) { } } -void TextureAtlasEditor::SaveTextureAtlas( const cUIEvent * Event ) { +void TextureAtlasEditor::SaveTextureAtlas( const UIEvent * Event ) { if ( NULL != mTextureAtlasLoader && mTextureAtlasLoader->IsLoaded() ) { mTextureAtlasLoader->UpdateTextureAtlas(); } } -void TextureAtlasEditor::OnTextureAtlasClose( const cUIEvent * Event ) { +void TextureAtlasEditor::OnTextureAtlasClose( const UIEvent * Event ) { eeSAFE_DELETE( mTextureAtlasLoader ); mSubTextureList->Clear(); mSpinOffX->Value( 0 ); diff --git a/src/eepp/ui/tools/ctextureatlasnew.cpp b/src/eepp/ui/tools/textureatlasnew.cpp similarity index 68% rename from src/eepp/ui/tools/ctextureatlasnew.cpp rename to src/eepp/ui/tools/textureatlasnew.cpp index 3a501a015..82bb062fb 100644 --- a/src/eepp/ui/tools/ctextureatlasnew.cpp +++ b/src/eepp/ui/tools/textureatlasnew.cpp @@ -1,6 +1,6 @@ -#include -#include -#include +#include +#include +#include #include #include @@ -11,13 +11,13 @@ TextureAtlasNew::TextureAtlasNew( TGCreateCb NewTGCb ) : mUIWindow( NULL ), mNewTGCb( NewTGCb ) { - mTheme = cUIThemeManager::instance()->DefaultTheme(); + mTheme = UIThemeManager::instance()->DefaultTheme(); if ( NULL == mTheme ) return; mUIWindow = mTheme->CreateWindow( NULL, Sizei( 378, 244 ), Vector2i(), UI_CONTROL_DEFAULT_FLAGS_CENTERED, UI_WIN_DEFAULT_FLAGS | UI_WIN_MODAL ); - mUIWindow->AddEventListener( cUIEvent::EventOnWindowClose, cb::Make1( this, &TextureAtlasNew::WindowClose ) ); + mUIWindow->AddEventListener( UIEvent::EventOnWindowClose, cb::Make1( this, &TextureAtlasNew::WindowClose ) ); mUIWindow->Title( "New Texture Atlas" ); Int32 PosX = mUIWindow->Container()->Size().Width() - 110; @@ -62,15 +62,15 @@ TextureAtlasNew::TextureAtlasNew( TGCreateCb NewTGCb ) : mSetPathButton = mTheme->CreatePushButton( mUIWindow->Container(), Sizei( 32, 32 ), Vector2i( mUIWindow->Container()->Size().Width() - 10 - 32, 160 ) ); mSetPathButton->Text( "..." ); - mSetPathButton->AddEventListener( cUIEvent::EventMouseClick, cb::Make1( this, &TextureAtlasNew::OnDialogFolderSelect ) ); + mSetPathButton->AddEventListener( UIEvent::EventMouseClick, cb::Make1( this, &TextureAtlasNew::OnDialogFolderSelect ) ); - cUIPushButton * OKButton = mTheme->CreatePushButton( mUIWindow->Container(), Sizei( 80, 22 ), Vector2i(), UI_CONTROL_DEFAULT_FLAGS_CENTERED | UI_AUTO_SIZE, mTheme->GetIconByName( "ok" ) ); + UIPushButton * OKButton = mTheme->CreatePushButton( mUIWindow->Container(), Sizei( 80, 22 ), Vector2i(), UI_CONTROL_DEFAULT_FLAGS_CENTERED | UI_AUTO_SIZE, mTheme->GetIconByName( "ok" ) ); OKButton->Pos( mUIWindow->Container()->Size().Width() - OKButton->Size().Width() - 4, mUIWindow->Container()->Size().Height() - OKButton->Size().Height() - 4 ); - OKButton->AddEventListener( cUIEvent::EventMouseClick, cb::Make1( this, &TextureAtlasNew::OKClick ) ); + OKButton->AddEventListener( UIEvent::EventMouseClick, cb::Make1( this, &TextureAtlasNew::OKClick ) ); OKButton->Text( "OK" ); - cUIPushButton * CancelButton = mTheme->CreatePushButton( mUIWindow->Container(), OKButton->Size(), Vector2i( OKButton->Pos().x - OKButton->Size().Width() - 4, OKButton->Pos().y ), UI_CONTROL_DEFAULT_FLAGS_CENTERED | UI_AUTO_SIZE, mTheme->GetIconByName( "cancel" ) ); - CancelButton->AddEventListener( cUIEvent::EventMouseClick, cb::Make1( this, &TextureAtlasNew::CancelClick ) ); + UIPushButton * CancelButton = mTheme->CreatePushButton( mUIWindow->Container(), OKButton->Size(), Vector2i( OKButton->Pos().x - OKButton->Size().Width() - 4, OKButton->Pos().y ), UI_CONTROL_DEFAULT_FLAGS_CENTERED | UI_AUTO_SIZE, mTheme->GetIconByName( "cancel" ) ); + CancelButton->AddEventListener( UIEvent::EventMouseClick, cb::Make1( this, &TextureAtlasNew::CancelClick ) ); CancelButton->Text( "Cancel" ); mUIWindow->Center(); @@ -80,35 +80,35 @@ TextureAtlasNew::TextureAtlasNew( TGCreateCb NewTGCb ) : TextureAtlasNew::~TextureAtlasNew() { } -cUITextBox * TextureAtlasNew::CreateTxtBox( Vector2i Pos, const String& Text ) { +UITextBox * TextureAtlasNew::CreateTxtBox( Vector2i Pos, const String& Text ) { return mTheme->CreateTextBox( Text, mUIWindow->Container(), Sizei(), Pos, UI_CONTROL_DEFAULT_FLAGS | UI_DRAW_SHADOW | UI_AUTO_SIZE ); } -void TextureAtlasNew::OKClick( const cUIEvent * Event ) { - const cUIEventMouse * MouseEvent = reinterpret_cast( Event ); +void TextureAtlasNew::OKClick( const UIEvent * Event ) { + const UIEventMouse * MouseEvent = reinterpret_cast( Event ); if ( MouseEvent->Flags() & EE_BUTTON_LMASK ) { std::string ext( mSaveFileType->Text() ); String::ToLower( ext ); - cUICommonDialog * TGDialog = mTheme->CreateCommonDialog( NULL, Sizei(), Vector2i(), UI_CONTROL_DEFAULT_FLAGS_CENTERED, UI_WIN_DEFAULT_FLAGS | UI_WIN_MAXIMIZE_BUTTON | UI_WIN_MODAL, Sizei(), 255, UI_CDL_DEFAULT_FLAGS | CDL_FLAG_SAVE_DIALOG, "*." + ext ); + UICommonDialog * TGDialog = mTheme->CreateCommonDialog( NULL, Sizei(), Vector2i(), UI_CONTROL_DEFAULT_FLAGS_CENTERED, UI_WIN_DEFAULT_FLAGS | UI_WIN_MAXIMIZE_BUTTON | UI_WIN_MODAL, Sizei(), 255, UI_CDL_DEFAULT_FLAGS | CDL_FLAG_SAVE_DIALOG, "*." + ext ); TGDialog->Title( "Save Texture Atlas" ); - TGDialog->AddEventListener( cUIEvent::EventSaveFile, cb::Make1( this, &TextureAtlasNew::TextureAtlasSave ) ); + TGDialog->AddEventListener( UIEvent::EventSaveFile, cb::Make1( this, &TextureAtlasNew::TextureAtlasSave ) ); TGDialog->Center(); TGDialog->Show(); } } -void TextureAtlasNew::CancelClick( const cUIEvent * Event ) { - const cUIEventMouse * MouseEvent = reinterpret_cast( Event ); +void TextureAtlasNew::CancelClick( const UIEvent * Event ) { + const UIEventMouse * MouseEvent = reinterpret_cast( Event ); if ( MouseEvent->Flags() & EE_BUTTON_LMASK ) { mUIWindow->CloseWindow(); } } -void TextureAtlasNew::WindowClose( const cUIEvent * Event ) { +void TextureAtlasNew::WindowClose( const UIEvent * Event ) { eeDelete( this ); } @@ -116,8 +116,8 @@ static bool IsValidExtension( const std::string& ext ) { return ext == "png" || ext == "bmp" || ext == "dds" || ext == "tga"; } -void TextureAtlasNew::TextureAtlasSave( const cUIEvent * Event ) { - cUICommonDialog * CDL = reinterpret_cast ( Event->Ctrl() ); +void TextureAtlasNew::TextureAtlasSave( const UIEvent * Event ) { + UICommonDialog * CDL = reinterpret_cast ( Event->Ctrl() ); std::string FPath( CDL->GetFullPath() ); if ( !FileSystem::IsDirectory( FPath ) ) { @@ -155,22 +155,22 @@ void TextureAtlasNew::TextureAtlasSave( const cUIEvent * Event ) { } } -void TextureAtlasNew::OnDialogFolderSelect( const cUIEvent * Event ) { - const cUIEventMouse * MouseEvent = reinterpret_cast( Event ); +void TextureAtlasNew::OnDialogFolderSelect( const UIEvent * Event ) { + const UIEventMouse * MouseEvent = reinterpret_cast( Event ); if ( MouseEvent->Flags() & EE_BUTTON_LMASK ) { - cUICommonDialog * TGDialog = mTheme->CreateCommonDialog( NULL, Sizei(), Vector2i(), UI_CONTROL_DEFAULT_FLAGS_CENTERED, UI_WIN_DEFAULT_FLAGS | UI_WIN_MAXIMIZE_BUTTON | UI_WIN_MODAL, Sizei(), 255, UI_CDL_DEFAULT_FLAGS | CDL_FLAG_ALLOW_FOLDER_SELECT, "*" ); + UICommonDialog * TGDialog = mTheme->CreateCommonDialog( NULL, Sizei(), Vector2i(), UI_CONTROL_DEFAULT_FLAGS_CENTERED, UI_WIN_DEFAULT_FLAGS | UI_WIN_MAXIMIZE_BUTTON | UI_WIN_MODAL, Sizei(), 255, UI_CDL_DEFAULT_FLAGS | CDL_FLAG_ALLOW_FOLDER_SELECT, "*" ); TGDialog->Title( "Create Texture Atlas ( Select Folder Containing Textures )" ); - TGDialog->AddEventListener( cUIEvent::EventOpenFile, cb::Make1( this, &TextureAtlasNew::OnSelectFolder ) ); + TGDialog->AddEventListener( UIEvent::EventOpenFile, cb::Make1( this, &TextureAtlasNew::OnSelectFolder ) ); TGDialog->Center(); TGDialog->Show(); } } -void TextureAtlasNew::OnSelectFolder( const cUIEvent * Event ) { - cUICommonDialog * CDL = reinterpret_cast ( Event->Ctrl() ); - cUIMessageBox * MsgBox; +void TextureAtlasNew::OnSelectFolder( const UIEvent * Event ) { + UICommonDialog * CDL = reinterpret_cast ( Event->Ctrl() ); + UIMessageBox * MsgBox; std::string FPath( CDL->GetFullPath() ); FileSystem::DirPathAddSlashAtEnd( FPath ); diff --git a/src/eepp/ui/tools/textureatlasnew.hpp b/src/eepp/ui/tools/textureatlasnew.hpp new file mode 100644 index 000000000..ecc2c2a2d --- /dev/null +++ b/src/eepp/ui/tools/textureatlasnew.hpp @@ -0,0 +1,48 @@ +#ifndef EE_UITOOLSCTEXTUREATLASNEW_HPP +#define EE_UITOOLSCTEXTUREATLASNEW_HPP + +#include +#include +#include +#include +#include +#include + +namespace EE { namespace UI { namespace Tools { + +class EE_API TextureAtlasNew { + public: + typedef cb::Callback1 TGCreateCb; + + TextureAtlasNew( TGCreateCb NewTGCb = TGCreateCb() ); + + virtual ~TextureAtlasNew(); + protected: + UITheme * mTheme; + UIWindow * mUIWindow; + TGCreateCb mNewTGCb; + UIComboBox * mComboWidth; + UIComboBox * mComboHeight; + UISpinBox * mPixelSpace; + UITextInput * mTGPath; + UIPushButton * mSetPathButton; + UIDropDownList * mSaveFileType; + + void WindowClose( const UIEvent * Event ); + + void CancelClick( const UIEvent * Event ); + + void OKClick( const UIEvent * Event ); + + UITextBox * CreateTxtBox( Vector2i Pos, const String& Text ); + + void OnDialogFolderSelect( const UIEvent * Event ); + + void OnSelectFolder( const UIEvent * Event ); + + void TextureAtlasSave( const UIEvent * Event ); +}; + +}}} + +#endif diff --git a/src/eepp/ui/tools/ctextureatlassubtextureeditor.cpp b/src/eepp/ui/tools/textureatlassubtextureeditor.cpp similarity index 76% rename from src/eepp/ui/tools/ctextureatlassubtextureeditor.cpp rename to src/eepp/ui/tools/textureatlassubtextureeditor.cpp index 31b3ba736..17a7a07a8 100644 --- a/src/eepp/ui/tools/ctextureatlassubtextureeditor.cpp +++ b/src/eepp/ui/tools/textureatlassubtextureeditor.cpp @@ -1,27 +1,27 @@ -#include -#include +#include +#include #include -#include +#include namespace EE { namespace UI { namespace Tools { -TextureAtlasSubTextureEditor::TextureAtlasSubTextureEditor( const cUIComplexControl::CreateParams& Params, TextureAtlasEditor * Editor ) : - cUIComplexControl( Params ), +TextureAtlasSubTextureEditor::TextureAtlasSubTextureEditor( const UIComplexControl::CreateParams& Params, TextureAtlasEditor * Editor ) : + UIComplexControl( Params ), mGfx( NULL ), mEditor( Editor ) { - if ( NULL == cUIThemeManager::instance()->DefaultTheme() ) { + if ( NULL == UIThemeManager::instance()->DefaultTheme() ) { return; } - mTheme = cUIThemeManager::instance()->DefaultTheme(); + mTheme = UIThemeManager::instance()->DefaultTheme(); mGfx = mTheme->CreateGfx( NULL, this ); - cUIDragable::CreateParams DragParams; + UIDragable::CreateParams DragParams; DragParams.Parent( this ); DragParams.SizeSet( 500000, 500000 ); - mDrag = eeNew( cUIDragable, ( DragParams ) ); + mDrag = eeNew( UIDragable, ( DragParams ) ); mDrag->Enabled( true ); mDrag->Visible( true ); mDrag->DragEnable( true ); @@ -38,13 +38,13 @@ void TextureAtlasSubTextureEditor::Draw() { P.DrawLine( Line2f( Vector2f( mScreenPos.x, mScreenPos.y + mUICenter.y ), Vector2f( mScreenPos.x + mSize.Width(), mScreenPos.y + mUICenter.y ) ) ); P.DrawLine( Line2f( Vector2f( mScreenPos.x + mUICenter.x, mScreenPos.y ), Vector2f( mScreenPos.x + mUICenter.x, mScreenPos.y + mSize.Height() ) ) ); - cUIComplexControl::Draw(); + UIComplexControl::Draw(); } void TextureAtlasSubTextureEditor::Update() { Vector2i Pos = mDrag->Pos(); - cUIComplexControl::Update(); + UIComplexControl::Update(); if ( NULL != mGfx->SubTexture() && mDrag->DragEnable() && mDrag->Dragging() && Pos != mDrag->Pos() ) { Vector2i Diff = -( Pos - mDrag->Pos() ); @@ -70,7 +70,7 @@ void TextureAtlasSubTextureEditor::SubTexture( Graphics::SubTexture * subTexture mGfx->SubTexture( subTexture ); } -cUIGfx * TextureAtlasSubTextureEditor::Gfx() const { +UIGfx * TextureAtlasSubTextureEditor::Gfx() const { return mGfx; } diff --git a/src/eepp/ui/tools/ctextureatlassubtextureeditor.hpp b/src/eepp/ui/tools/textureatlassubtextureeditor.hpp similarity index 63% rename from src/eepp/ui/tools/ctextureatlassubtextureeditor.hpp rename to src/eepp/ui/tools/textureatlassubtextureeditor.hpp index f98d3b4a4..1b085d680 100644 --- a/src/eepp/ui/tools/ctextureatlassubtextureeditor.hpp +++ b/src/eepp/ui/tools/textureatlassubtextureeditor.hpp @@ -2,17 +2,17 @@ #define EE_UITOOLSCTEXTUREATLASSUBTEXTUREEDITOR_HPP #include -#include +#include #include -#include +#include namespace EE { namespace UI { namespace Tools { class TextureAtlasEditor; -class EE_API TextureAtlasSubTextureEditor : public cUIComplexControl { +class EE_API TextureAtlasSubTextureEditor : public UIComplexControl { public: - TextureAtlasSubTextureEditor( const cUIComplexControl::CreateParams& Params, TextureAtlasEditor * Editor ); + TextureAtlasSubTextureEditor( const UIComplexControl::CreateParams& Params, TextureAtlasEditor * Editor ); virtual ~TextureAtlasSubTextureEditor(); @@ -24,11 +24,11 @@ class EE_API TextureAtlasSubTextureEditor : public cUIComplexControl { void SubTexture( Graphics::SubTexture * subTexture ); - cUIGfx * Gfx() const; + UIGfx * Gfx() const; protected: - cUITheme * mTheme; - cUIGfx * mGfx; - cUIDragable * mDrag; + UITheme * mTheme; + UIGfx * mGfx; + UIDragable * mDrag; Vector2i mUICenter; TextureAtlasEditor * mEditor; diff --git a/src/eepp/ui/cuibackground.cpp b/src/eepp/ui/uibackground.cpp similarity index 51% rename from src/eepp/ui/cuibackground.cpp rename to src/eepp/ui/uibackground.cpp index 173fc917f..3c294faad 100644 --- a/src/eepp/ui/cuibackground.cpp +++ b/src/eepp/ui/uibackground.cpp @@ -1,49 +1,49 @@ -#include +#include namespace EE { namespace UI { -cUIBackground::cUIBackground() : +UIBackground::UIBackground() : mBlendMode( ALPHA_NORMAL ), mCorners(0) { mColor.push_back( ColorA(0xFF404040) ); } -cUIBackground::cUIBackground( const cUIBackground& Back ) : +UIBackground::UIBackground( const UIBackground& Back ) : mBlendMode( ALPHA_NORMAL ), mCorners( Back.Corners() ) { - cUIBackground * b = const_cast ( &Back ); // cheating + UIBackground * b = const_cast ( &Back ); // cheating mColor = b->Colors(); } -cUIBackground::cUIBackground( const ColorA& Color, const unsigned int& Corners, const EE_BLEND_MODE& BlendMode ) : +UIBackground::UIBackground( const ColorA& Color, const unsigned int& Corners, const EE_BLEND_MODE& BlendMode ) : mBlendMode( BlendMode ), mCorners( Corners ) { mColor.push_back( Color ); } -cUIBackground::cUIBackground( const ColorA& TopLeftColor, const ColorA& BottomLeftColor, const ColorA& BottomRightColor, const ColorA& TopRightColor, const unsigned int& Corners, const EE_BLEND_MODE& BlendMode ) : +UIBackground::UIBackground( const ColorA& TopLeftColor, const ColorA& BottomLeftColor, const ColorA& BottomRightColor, const ColorA& TopRightColor, const unsigned int& Corners, const EE_BLEND_MODE& BlendMode ) : mBlendMode( BlendMode ), mCorners( Corners ) { Colors( TopLeftColor, BottomLeftColor, BottomRightColor, TopRightColor ); } -ColorA& cUIBackground::Color( const unsigned int& index ) { +ColorA& UIBackground::Color( const unsigned int& index ) { if ( index < mColor.size() ) return mColor[ index ]; return mColor[ 0 ]; } -void cUIBackground::ColorsTo( const ColorA& Color ) { +void UIBackground::ColorsTo( const ColorA& Color ) { for ( unsigned int i = 0; i < mColor.size(); i++ ) mColor[i] = Color; } -void cUIBackground::Colors( const ColorA& TopLeftColor, const ColorA& BottomLeftColor, const ColorA& BottomRightColor, const ColorA& TopRightColor ) { +void UIBackground::Colors( const ColorA& TopLeftColor, const ColorA& BottomLeftColor, const ColorA& BottomRightColor, const ColorA& TopRightColor ) { mColor[0] = TopLeftColor; if ( mColor.size() < 2 ) @@ -62,27 +62,27 @@ void cUIBackground::Colors( const ColorA& TopLeftColor, const ColorA& BottomLeft mColor[3] = TopRightColor; } -const std::vector& cUIBackground::Colors() { +const std::vector& UIBackground::Colors() { return mColor; } -void cUIBackground::Color( const ColorA& Col ) { +void UIBackground::Color( const ColorA& Col ) { mColor[0] = Col; } -const EE_BLEND_MODE& cUIBackground::Blend() const { +const EE_BLEND_MODE& UIBackground::Blend() const { return mBlendMode; } -void cUIBackground::Blend( const EE_BLEND_MODE& blend ) { +void UIBackground::Blend( const EE_BLEND_MODE& blend ) { mBlendMode = blend; } -const unsigned int& cUIBackground::Corners() const { +const unsigned int& UIBackground::Corners() const { return mCorners; } -void cUIBackground::Corners( const unsigned int& corners ) { +void UIBackground::Corners( const unsigned int& corners ) { mCorners = corners; } diff --git a/src/eepp/ui/uiborder.cpp b/src/eepp/ui/uiborder.cpp new file mode 100644 index 000000000..6e70ae2f8 --- /dev/null +++ b/src/eepp/ui/uiborder.cpp @@ -0,0 +1,24 @@ +#include + +namespace EE { namespace UI { + +UIBorder::UIBorder() : mColor( 0xFF404040 ), mWidth( 1 ) {} +UIBorder::UIBorder( const UIBorder& border ) : mColor( border.Color() ), mWidth( border.Width() ) {} + +const ColorA& UIBorder::Color() const { + return mColor; +} + +void UIBorder::Color( const ColorA& Col ) { + mColor = Col; +} + +const unsigned int& UIBorder::Width() const { + return mWidth; +} + +void UIBorder::Width( const unsigned int& width ) { + mWidth = width; +} + +}} diff --git a/src/eepp/ui/cuicheckbox.cpp b/src/eepp/ui/uicheckbox.cpp similarity index 56% rename from src/eepp/ui/cuicheckbox.cpp rename to src/eepp/ui/uicheckbox.cpp index b28cae57b..ab5c58925 100644 --- a/src/eepp/ui/cuicheckbox.cpp +++ b/src/eepp/ui/uicheckbox.cpp @@ -1,25 +1,25 @@ -#include -#include +#include +#include #include #include namespace EE { namespace UI { -cUICheckBox::cUICheckBox( const cUITextBox::CreateParams& Params ) : - cUITextBox( Params ), +UICheckBox::UICheckBox( const UITextBox::CreateParams& Params ) : + UITextBox( Params ), mActive( false ) { - cUIControlAnim::CreateParams ButtonParams( Params ); + UIControlAnim::CreateParams ButtonParams( Params ); ButtonParams.Parent( this ); ButtonParams.PosSet( Vector2i( 0, 0 ) ); ButtonParams.Size = Sizei( 16, 16 ); - mActiveButton = eeNew( cUIControlAnim, ( ButtonParams ) ); + mActiveButton = eeNew( UIControlAnim, ( ButtonParams ) ); mActiveButton->Visible( false ); mActiveButton->Enabled( true ); - mInactiveButton = eeNew( cUIControlAnim, ( ButtonParams ) ); + mInactiveButton = eeNew( UIControlAnim, ( ButtonParams ) ); mInactiveButton->Visible( true ); mInactiveButton->Enabled( true ); @@ -28,19 +28,19 @@ cUICheckBox::cUICheckBox( const cUITextBox::CreateParams& Params ) : ApplyDefaultTheme(); } -cUICheckBox::~cUICheckBox() { +UICheckBox::~UICheckBox() { } -Uint32 cUICheckBox::Type() const { +Uint32 UICheckBox::Type() const { return UI_TYPE_CHECKBOX; } -bool cUICheckBox::IsType( const Uint32& type ) const { - return cUICheckBox::Type() == type ? true : cUITextBox::IsType( type ); +bool UICheckBox::IsType( const Uint32& type ) const { + return UICheckBox::Type() == type ? true : UITextBox::IsType( type ); } -void cUICheckBox::SetTheme( cUITheme * Theme ) { - cUIControl::SetThemeControl( Theme, "checkbox" ); +void UICheckBox::SetTheme( UITheme * Theme ) { + UIControl::SetThemeControl( Theme, "checkbox" ); mActiveButton->SetThemeControl ( Theme, "checkbox_active" ); mInactiveButton->SetThemeControl( Theme, "checkbox_inactive" ); @@ -48,12 +48,12 @@ void cUICheckBox::SetTheme( cUITheme * Theme ) { DoAfterSetTheme(); } -void cUICheckBox::DoAfterSetTheme() { +void UICheckBox::DoAfterSetTheme() { SubTexture * tSubTexture = NULL; - cUISkin * tSkin = mActiveButton->GetSkin(); + UISkin * tSkin = mActiveButton->GetSkin(); if ( tSkin ) { - tSubTexture = tSkin->GetSubTexture( cUISkinState::StateNormal ); + tSubTexture = tSkin->GetSubTexture( UISkinState::StateNormal ); if ( NULL != tSubTexture ) { mActiveButton->Size( tSubTexture->RealSize() ); @@ -64,7 +64,7 @@ void cUICheckBox::DoAfterSetTheme() { tSkin = mInactiveButton->GetSkin(); if ( NULL != tSkin ) { - tSubTexture = tSkin->GetSubTexture( cUISkinState::StateNormal ); + tSubTexture = tSkin->GetSubTexture( UISkinState::StateNormal ); if ( NULL != tSubTexture ) { mInactiveButton->Size( tSubTexture->RealSize() ); @@ -75,8 +75,8 @@ void cUICheckBox::DoAfterSetTheme() { Padding( Recti(0,0,0,0) ); } -void cUICheckBox::AutoSize() { - cUITextBox::AutoSize(); +void UICheckBox::AutoSize() { + UITextBox::AutoSize(); if ( mFlags & UI_AUTO_SIZE ) { mActiveButton->CenterVertical(); @@ -86,22 +86,22 @@ void cUICheckBox::AutoSize() { } } -void cUICheckBox::OnSizeChange() { - cUITextBox::OnSizeChange(); +void UICheckBox::OnSizeChange() { + UITextBox::OnSizeChange(); mActiveButton->CenterVertical(); mInactiveButton->CenterVertical(); } -Uint32 cUICheckBox::OnMessage( const cUIMessage * Msg ) { +Uint32 UICheckBox::OnMessage( const UIMessage * Msg ) { switch ( Msg->Msg() ) { - case cUIMessage::MsgClick: { + case UIMessage::MsgClick: { if ( Msg->Flags() & EE_BUTTON_LMASK ) { SwitchState(); } if ( Msg->Sender() == mActiveButton || Msg->Sender() == mInactiveButton ) { - SendMouseEvent( cUIEvent::EventMouseClick, cUIManager::instance()->GetMousePos(), cUIManager::instance()->PressTrigger() ); + SendMouseEvent( UIEvent::EventMouseClick, UIManager::instance()->GetMousePos(), UIManager::instance()->PressTrigger() ); } return 1; @@ -111,11 +111,11 @@ Uint32 cUICheckBox::OnMessage( const cUIMessage * Msg ) { return 0; } -void cUICheckBox::SwitchState() { +void UICheckBox::SwitchState() { Active( !mActive ); } -void cUICheckBox::Active( const bool& active ) { +void UICheckBox::Active( const bool& active ) { if ( !active ) { mActiveButton->Visible( false ); mInactiveButton->Visible( true ); @@ -131,29 +131,29 @@ void cUICheckBox::Active( const bool& active ) { OnValueChange(); } -const bool& cUICheckBox::Active() const { +const bool& UICheckBox::Active() const { return mActive; } -const bool& cUICheckBox::IsActive() const { +const bool& UICheckBox::IsActive() const { return Active(); } -void cUICheckBox::Padding( const Recti& padding ) { +void UICheckBox::Padding( const Recti& padding ) { mPadding = padding; mPadding.Left = mPadding.Left + mActiveButton->Size().Width(); } -cUIControlAnim * cUICheckBox::ActiveButton() const { +UIControlAnim * UICheckBox::ActiveButton() const { return mActiveButton; } -cUIControlAnim * cUICheckBox::InactiveButton() const { +UIControlAnim * UICheckBox::InactiveButton() const { return mInactiveButton; } -Uint32 cUICheckBox::OnKeyDown( const cUIEventKey& Event ) { - cUITextBox::OnKeyDown( Event ); +Uint32 UICheckBox::OnKeyDown( const UIEventKey& Event ) { + UITextBox::OnKeyDown( Event ); if ( Event.KeyCode() == KEY_SPACE ) { if ( Sys::GetTicks() - mLastTick > 250 ) { @@ -166,8 +166,8 @@ Uint32 cUICheckBox::OnKeyDown( const cUIEventKey& Event ) { return 1; } -void cUICheckBox::OnAlphaChange() { - cUITextBox::OnAlphaChange(); +void UICheckBox::OnAlphaChange() { + UITextBox::OnAlphaChange(); mActiveButton->Alpha( mAlpha ); mInactiveButton->Alpha( mAlpha ); diff --git a/src/eepp/ui/uicombobox.cpp b/src/eepp/ui/uicombobox.cpp new file mode 100644 index 000000000..5569fccf6 --- /dev/null +++ b/src/eepp/ui/uicombobox.cpp @@ -0,0 +1,97 @@ +#include +#include + +namespace EE { namespace UI { + +UIComboBox::UIComboBox( UIComboBox::CreateParams& Params ) : + UIDropDownList( Params ), + mButton( NULL ) +{ + AllowEditing( true ); + + ApplyDefaultTheme(); +} + +UIComboBox::~UIComboBox() { +} + +Uint32 UIComboBox::Type() const { + return UI_TYPE_COMBOBOX; +} + +bool UIComboBox::IsType( const Uint32& type ) const { + return UIComboBox::Type() == type ? true : UIDropDownList::IsType( type ); +} + +void UIComboBox::SetTheme( UITheme * Theme ) { + UIControl::SetThemeControl( Theme, "combobox" ); + + AutoSizeControl(); + + CreateButton(); + + AutoPadding(); + + OnSizeChange(); +} + +void UIComboBox::CreateButton() { + eeSAFE_DELETE( mButton ); + + Int32 btnWidth = 0; + + if ( NULL != mSkinState && NULL != mSkinState->GetSkin() ) { + if ( mSkinState->GetSkin()->GetType() == UISkin::SkinComplex ) { + UISkinComplex * tComplex = reinterpret_cast ( mSkinState->GetSkin() ); + + SubTexture * tSubTexture = tComplex->GetSubTextureSide( UISkinState::StateNormal, UISkinComplex::Right ); + + if ( NULL != tSubTexture ) + btnWidth = tSubTexture->RealSize().Width(); + } + } + + UIControl::CreateParams Params; + Params.Parent( this ), + Params.Size = Sizei( btnWidth, mSize.Height() ); + Params.PosSet( mSize.Width() - btnWidth, 0 ); + mButton = eeNew( UIControl, ( Params ) ); + mButton->Visible( true ); + mButton->Enabled( true ); + mButton->AddEventListener( UIEvent::EventMouseClick, cb::Make1( this, &UIComboBox::OnButtonClick ) ); + mButton->AddEventListener( UIEvent::EventMouseEnter, cb::Make1( this, &UIComboBox::OnButtonEnter ) ); + mButton->AddEventListener( UIEvent::EventMouseExit, cb::Make1( this, &UIComboBox::OnButtonExit ) ); +} + +void UIComboBox::OnButtonClick( const UIEvent * Event ) { + const UIEventMouse * MEvent = reinterpret_cast ( Event ); + + if ( MEvent->Flags() & EE_BUTTON_LMASK ) { + ShowListBox(); + } +} + +void UIComboBox::OnButtonEnter( const UIEvent * Event ) { + SetSkinState( UISkinState::StateMouseEnter ); +} + +void UIComboBox::OnButtonExit( const UIEvent * Event ) { + SetSkinState( UISkinState::StateMouseExit ); +} + +Uint32 UIComboBox::OnMouseClick( const Vector2i& Pos, const Uint32 Flags ) { + if ( Flags & EE_BUTTON_LMASK ) { + UITextInput::OnMouseClick( Pos, Flags ); + + if ( mListBox->Visible() ) { + Hide(); + } + } + + return 1; +} + +void UIComboBox::OnControlClear( const UIEvent *Event ) { +} + +}} diff --git a/src/eepp/ui/cuicommondialog.cpp b/src/eepp/ui/uicommondialog.cpp similarity index 73% rename from src/eepp/ui/cuicommondialog.cpp rename to src/eepp/ui/uicommondialog.cpp index 05fdf3749..b4aa72f7d 100644 --- a/src/eepp/ui/cuicommondialog.cpp +++ b/src/eepp/ui/uicommondialog.cpp @@ -1,7 +1,7 @@ -#include -#include -#include -#include +#include +#include +#include +#include #include #include @@ -10,8 +10,8 @@ namespace EE { namespace UI { #define CDLG_MIN_WIDTH 420 #define CDLG_MIN_HEIGHT 300 -cUICommonDialog::cUICommonDialog( const cUICommonDialog::CreateParams& Params ) : - cUIWindow( Params ), +UICommonDialog::UICommonDialog( const UICommonDialog::CreateParams& Params ) : + UIWindow( Params ), mCurPath( Params.DefaultDirectory ), mCDLFlags( Params.CDLFlags ) { @@ -33,21 +33,21 @@ cUICommonDialog::cUICommonDialog( const cUICommonDialog::CreateParams& Params ) Title( "Select a file" ); } - cUITextBox::CreateParams TxtBoxParams; + UITextBox::CreateParams TxtBoxParams; TxtBoxParams.Parent( Container() ); TxtBoxParams.PosSet( 6, 13 ); TxtBoxParams.Flags |= UI_AUTO_SIZE; - cUITextBox * TBox = eeNew( cUITextBox, ( TxtBoxParams ) ); + UITextBox * TBox = eeNew( UITextBox, ( TxtBoxParams ) ); TBox->Visible( true ); TBox->Enabled( false ); TBox->Text( "Look in:" ); - cUIPushButton::CreateParams ButtonParams; + UIPushButton::CreateParams ButtonParams; ButtonParams.Flags = UI_HALIGN_CENTER | UI_ANCHOR_RIGHT | UI_VALIGN_CENTER | UI_AUTO_SIZE; ButtonParams.Parent( Container() ); ButtonParams.PosSet( Container()->Size().Width() - 86, Container()->Size().Height() - 24 ); ButtonParams.SizeSet( 80, 22 ); - mButtonCancel = eeNew( cUIPushButton, ( ButtonParams ) ); + mButtonCancel = eeNew( UIPushButton, ( ButtonParams ) ); mButtonCancel->Visible( true ); mButtonCancel->Enabled( true ); mButtonCancel->Text( "Cancel" ); @@ -55,7 +55,7 @@ cUICommonDialog::cUICommonDialog( const cUICommonDialog::CreateParams& Params ) mButtonCancel->UpdateAnchorsDistances(); ButtonParams.PosSet( mButtonCancel->Pos().x, mButtonCancel->Pos().y - mButtonCancel->Size().Height() ); - mButtonOpen = eeNew( cUIPushButton, ( ButtonParams ) ); + mButtonOpen = eeNew( UIPushButton, ( ButtonParams ) ); mButtonOpen->Visible( true ); mButtonOpen->Enabled( true ); @@ -64,13 +64,13 @@ cUICommonDialog::cUICommonDialog( const cUICommonDialog::CreateParams& Params ) else mButtonOpen->Text( "Open" ); - cUITextInput::CreateParams TInputParams; + UITextInput::CreateParams TInputParams; TInputParams.Parent( Container() ); TInputParams.Flags = UI_AUTO_PADDING | UI_CLIP_ENABLE | UI_ANCHOR_RIGHT | UI_ANCHOR_LEFT | UI_ANCHOR_TOP | UI_VALIGN_CENTER | UI_TEXT_SELECTION_ENABLED; TInputParams.PosSet( 70, 6 ); TInputParams.SizeSet( Container()->Size().Width() - TInputParams.Pos.x - 42, 22 ); - mPath = eeNew( cUITextInput, ( TInputParams ) ); - mPath->AddEventListener( cUIEvent::EventOnPressEnter, cb::Make1( this, &cUICommonDialog::OnPressEnter ) ); + mPath = eeNew( UITextInput, ( TInputParams ) ); + mPath->AddEventListener( UIEvent::EventOnPressEnter, cb::Make1( this, &UICommonDialog::OnPressEnter ) ); mPath->Visible( true ); mPath->Enabled( true ); mPath->Text( mCurPath ); @@ -78,12 +78,12 @@ cUICommonDialog::cUICommonDialog( const cUICommonDialog::CreateParams& Params ) ButtonParams.PosSet( TInputParams.Pos.x + TInputParams.Size.Width() + 6, TInputParams.Pos.y ); ButtonParams.SizeSet( 24, 22 ); ButtonParams.Flags |= UI_ANCHOR_TOP; - mButtonUp = eeNew( cUIPushButton, ( ButtonParams ) ); + mButtonUp = eeNew( UIPushButton, ( ButtonParams ) ); mButtonUp->Visible( true ); mButtonUp->Enabled( true ); mButtonUp->Text( "Up" ); - cUIListBox::CreateParams LBParams; + UIListBox::CreateParams LBParams; LBParams.Parent( Container() ); LBParams.PosSet( 6, mButtonUp->Pos().y + mButtonUp->Size().Height() + 4 ); LBParams.Size = Sizei( Container()->Size().Width() - 12, @@ -98,26 +98,26 @@ cUICommonDialog::cUICommonDialog( const cUICommonDialog::CreateParams& Params ) LBParams.Flags = UI_AUTO_PADDING | UI_ANCHOR_RIGHT | UI_ANCHOR_LEFT | UI_ANCHOR_TOP | UI_ANCHOR_BOTTOM | UI_CLIP_ENABLE; LBParams.FontSelectedColor = ColorA( 255, 255, 255, 255 ); - if ( NULL != cUIThemeManager::instance()->DefaultTheme() ) { - cUITheme * Theme = cUIThemeManager::instance()->DefaultTheme(); + if ( NULL != UIThemeManager::instance()->DefaultTheme() ) { + UITheme * Theme = UIThemeManager::instance()->DefaultTheme(); LBParams.FontSelectedColor = Theme->FontSelectedColor(); } - mList = eeNew( cUIListBox, ( LBParams ) ); + mList = eeNew( UIListBox, ( LBParams ) ); mList->Visible( true ); mList->Enabled( true ); TxtBoxParams.PosSet( 6, Container()->Size().Height() - 54 ); TxtBoxParams.SizeSet( 74, 19 ); TxtBoxParams.Flags = UI_ANCHOR_LEFT | UI_VALIGN_CENTER; - TBox = eeNew( cUITextBox, ( TxtBoxParams ) ); + TBox = eeNew( UITextBox, ( TxtBoxParams ) ); TBox->Visible( true ); TBox->Enabled( false ); TBox->Text( "File Name:" ); TxtBoxParams.PosSet( TBox->Pos().x, TBox->Pos().y + TBox->Size().Height()+ 6 ); - cUITextBox * TBox2 = eeNew( cUITextBox, ( TxtBoxParams ) ); + UITextBox * TBox2 = eeNew( UITextBox, ( TxtBoxParams ) ); TBox2->Visible( true ); TBox2->Enabled( false ); TBox2->Text( "Files of type:" ); @@ -125,18 +125,18 @@ cUICommonDialog::cUICommonDialog( const cUICommonDialog::CreateParams& Params ) TInputParams.Flags &= ~UI_ANCHOR_TOP; TInputParams.PosSet( TBox->Pos().x + TBox->Size().Width(), TBox->Pos().y ); TInputParams.SizeSet( Container()->Size().Width() - mButtonOpen->Size().Width() - TInputParams.Pos.x - 20, TInputParams.Size.Height() ); - mFile = eeNew( cUITextInput, ( TInputParams ) ); + mFile = eeNew( UITextInput, ( TInputParams ) ); mFile->Visible( true ); mFile->Enabled( true ); - mFile->AddEventListener( cUIEvent::EventOnPressEnter, cb::Make1( this, &cUICommonDialog::OnPressFileEnter ) ); + mFile->AddEventListener( UIEvent::EventOnPressEnter, cb::Make1( this, &UICommonDialog::OnPressFileEnter ) ); - cUIDropDownList::CreateParams DDLParams; + UIDropDownList::CreateParams DDLParams; DDLParams.Parent( Container() ); DDLParams.PosSet( TBox2->Pos().x + TBox2->Size().Width(), TBox2->Pos().y ); DDLParams.SizeSet( Container()->Size().Width() - mButtonCancel->Size().Width() - DDLParams.Pos.x - 20, 22 ); DDLParams.Flags = UI_CLIP_ENABLE | UI_AUTO_PADDING | UI_VALIGN_CENTER | UI_HALIGN_LEFT | UI_ANCHOR_LEFT | UI_ANCHOR_RIGHT | UI_AUTO_SIZE; DDLParams.PopUpToMainControl = true; - mFiletype = eeNew( cUIDropDownList, ( DDLParams ) ); + mFiletype = eeNew( UIDropDownList, ( DDLParams ) ); mFiletype->Visible( true ); mFiletype->Enabled( true ); mFiletype->ListBox()->AddListBoxItem( Params.DefaultFilePattern ); @@ -147,19 +147,19 @@ cUICommonDialog::cUICommonDialog( const cUICommonDialog::CreateParams& Params ) RefreshFolder(); } -cUICommonDialog::~cUICommonDialog() { +UICommonDialog::~UICommonDialog() { } -Uint32 cUICommonDialog::Type() const { +Uint32 UICommonDialog::Type() const { return UI_TYPE_COMMONDIALOG; } -bool cUICommonDialog::IsType( const Uint32& type ) const { - return cUICommonDialog::Type() == type ? true : cUIWindow::IsType( type ); +bool UICommonDialog::IsType( const Uint32& type ) const { + return UICommonDialog::Type() == type ? true : UIWindow::IsType( type ); } -void cUICommonDialog::SetTheme( cUITheme * Theme ) { - cUIWindow::SetTheme( Theme ); +void UICommonDialog::SetTheme( UITheme * Theme ) { + UIWindow::SetTheme( Theme ); SubTexture * Icon = Theme->GetIconByName( "go-up" ); @@ -169,7 +169,7 @@ void cUICommonDialog::SetTheme( cUITheme * Theme ) { } } -void cUICommonDialog::RefreshFolder() { +void UICommonDialog::RefreshFolder() { std::vector flist = FileSystem::FilesGetInPath( String( mCurPath ) ); std::vector files; std::vector folders; @@ -224,7 +224,7 @@ void cUICommonDialog::RefreshFolder() { } } -void cUICommonDialog::OpenSaveClick() { +void UICommonDialog::OpenSaveClick() { if ( IsSaveDialog() ) { Save(); } else { @@ -232,11 +232,11 @@ void cUICommonDialog::OpenSaveClick() { } } -void cUICommonDialog::OnPressFileEnter( const cUIEvent * Event ) { +void UICommonDialog::OnPressFileEnter( const UIEvent * Event ) { OpenSaveClick(); } -void cUICommonDialog::DisableButtons() { +void UICommonDialog::DisableButtons() { mButtonOpen->Enabled( false ); mButtonCancel->Enabled( false ); mButtonUp->Enabled( false ); @@ -251,9 +251,9 @@ void cUICommonDialog::DisableButtons() { mButtonMaximize->Enabled( false ); } -Uint32 cUICommonDialog::OnMessage( const cUIMessage * Msg ) { +Uint32 UICommonDialog::OnMessage( const UIMessage * Msg ) { switch ( Msg->Msg() ) { - case cUIMessage::MsgClick: + case UIMessage::MsgClick: { if ( Msg->Flags() & EE_BUTTON_LMASK ) { if ( Msg->Sender() == mButtonOpen ) { @@ -271,7 +271,7 @@ Uint32 cUICommonDialog::OnMessage( const cUIMessage * Msg ) { break; } - case cUIMessage::MsgDoubleClick: + case UIMessage::MsgDoubleClick: { if ( Msg->Flags() & EE_BUTTON_LMASK ) { if ( Msg->Sender()->IsType( UI_TYPE_LISTBOXITEM ) ) { @@ -289,7 +289,7 @@ Uint32 cUICommonDialog::OnMessage( const cUIMessage * Msg ) { break; } - case cUIMessage::MsgSelected: + case UIMessage::MsgSelected: { if ( Msg->Sender() == mList ) { if ( !IsSaveDialog() ) { @@ -313,18 +313,18 @@ Uint32 cUICommonDialog::OnMessage( const cUIMessage * Msg ) { } } - return cUIWindow::OnMessage( Msg ); + return UIWindow::OnMessage( Msg ); } -void cUICommonDialog::Save() { - SendCommonEvent( cUIEvent::EventSaveFile ); +void UICommonDialog::Save() { + SendCommonEvent( UIEvent::EventSaveFile ); DisableButtons(); CloseWindow(); } -void cUICommonDialog::Open() { +void UICommonDialog::Open() { if ( "" != mList->GetItemSelectedText() || AllowFolderSelect() ) { if ( !AllowFolderSelect() ) { if ( FileSystem::IsDirectory( GetFullPath() ) ) @@ -334,7 +334,7 @@ void cUICommonDialog::Open() { return; } - SendCommonEvent( cUIEvent::EventOpenFile ); + SendCommonEvent( UIEvent::EventOpenFile ); DisableButtons(); @@ -342,7 +342,7 @@ void cUICommonDialog::Open() { } } -void cUICommonDialog::OnPressEnter( const cUIEvent * Event ) { +void UICommonDialog::OnPressEnter( const UIEvent * Event ) { if ( FileSystem::IsDirectory( mPath->Text() ) ) { std::string tpath = mPath->Text(); FileSystem::DirPathAddSlashAtEnd( tpath ); @@ -352,7 +352,7 @@ void cUICommonDialog::OnPressEnter( const cUIEvent * Event ) { } } -void cUICommonDialog::AddFilePattern( std::string pattern, bool select ) { +void UICommonDialog::AddFilePattern( std::string pattern, bool select ) { Uint32 index = mFiletype->ListBox()->AddListBoxItem( pattern ); if ( select ) { @@ -362,37 +362,37 @@ void cUICommonDialog::AddFilePattern( std::string pattern, bool select ) { } } -bool cUICommonDialog::IsSaveDialog() { +bool UICommonDialog::IsSaveDialog() { return 0 != ( mCDLFlags & CDL_FLAG_SAVE_DIALOG ); } -bool cUICommonDialog::SortAlphabetically() { +bool UICommonDialog::SortAlphabetically() { return 0 != ( mCDLFlags & CDL_FLAG_SORT_ALPHABETICALLY ); } -bool cUICommonDialog::FoldersFirst() { +bool UICommonDialog::FoldersFirst() { return 0 != ( mCDLFlags & CDL_FLAG_FOLDERS_FISRT ); } -bool cUICommonDialog::AllowFolderSelect() { +bool UICommonDialog::AllowFolderSelect() { return 0 != ( mCDLFlags & CDL_FLAG_ALLOW_FOLDER_SELECT ); } -void cUICommonDialog::SortAlphabetically( const bool& sortAlphabetically ) { +void UICommonDialog::SortAlphabetically( const bool& sortAlphabetically ) { BitOp::SetBitFlagValue( &mCDLFlags, CDL_FLAG_SORT_ALPHABETICALLY, sortAlphabetically ? 1 : 0 ); RefreshFolder(); } -void cUICommonDialog::FoldersFirst( const bool& foldersFirst ) { +void UICommonDialog::FoldersFirst( const bool& foldersFirst ) { BitOp::SetBitFlagValue( &mCDLFlags, CDL_FLAG_FOLDERS_FISRT , foldersFirst ? 1 : 0 ); RefreshFolder(); } -void cUICommonDialog::AllowFolderSelect( const bool& allowFolderSelect ) { +void UICommonDialog::AllowFolderSelect( const bool& allowFolderSelect ) { BitOp::SetBitFlagValue( &mCDLFlags, CDL_FLAG_ALLOW_FOLDER_SELECT, allowFolderSelect ? 1 : 0 ); } -std::string cUICommonDialog::GetFullPath() { +std::string UICommonDialog::GetFullPath() { std::string tPath = mCurPath; FileSystem::DirPathAddSlashAtEnd( tPath ); @@ -402,7 +402,7 @@ std::string cUICommonDialog::GetFullPath() { return tPath; } -std::string cUICommonDialog::GetTempFullPath() { +std::string UICommonDialog::GetTempFullPath() { std::string tPath = mCurPath; FileSystem::DirPathAddSlashAtEnd( tPath ); @@ -412,42 +412,42 @@ std::string cUICommonDialog::GetTempFullPath() { return tPath; } -std::string cUICommonDialog::GetCurPath() const { +std::string UICommonDialog::GetCurPath() const { return mCurPath; } -std::string cUICommonDialog::GetCurFile() const { +std::string UICommonDialog::GetCurFile() const { if ( mCDLFlags & CDL_FLAG_SAVE_DIALOG ) return mFile->Text(); return mList->GetItemSelectedText().ToUtf8(); } -cUIPushButton * cUICommonDialog::GetButtonOpen() const { +UIPushButton * UICommonDialog::GetButtonOpen() const { return mButtonOpen; } -cUIPushButton * cUICommonDialog::GetButtonCancel() const { +UIPushButton * UICommonDialog::GetButtonCancel() const { return mButtonCancel; } -cUIPushButton * cUICommonDialog::GetButtonUp() const { +UIPushButton * UICommonDialog::GetButtonUp() const { return mButtonUp; } -cUIListBox * cUICommonDialog::GetList() const { +UIListBox * UICommonDialog::GetList() const { return mList; } -cUITextInput * cUICommonDialog::GetPathInput() const { +UITextInput * UICommonDialog::GetPathInput() const { return mPath; } -cUITextInput * cUICommonDialog::GetFileInput() const { +UITextInput * UICommonDialog::GetFileInput() const { return mFile; } -cUIDropDownList * cUICommonDialog::GetFiletypeList() const { +UIDropDownList * UICommonDialog::GetFiletypeList() const { return mFiletype; } diff --git a/src/eepp/ui/cuicomplexcontrol.cpp b/src/eepp/ui/uicomplexcontrol.cpp similarity index 52% rename from src/eepp/ui/cuicomplexcontrol.cpp rename to src/eepp/ui/uicomplexcontrol.cpp index 89fa869d9..e08d7b8dd 100644 --- a/src/eepp/ui/cuicomplexcontrol.cpp +++ b/src/eepp/ui/uicomplexcontrol.cpp @@ -1,10 +1,10 @@ -#include -#include +#include +#include namespace EE { namespace UI { -cUIComplexControl::cUIComplexControl( const cUIComplexControl::CreateParams& Params ) : - cUIControlAnim( Params ), +UIComplexControl::UIComplexControl( const UIComplexControl::CreateParams& Params ) : + UIControlAnim( Params ), mTooltip( NULL ), mMinControlSize( Params.MinControlSize ) { @@ -15,50 +15,50 @@ cUIComplexControl::cUIComplexControl( const cUIComplexControl::CreateParams& Par TooltipText( Params.TooltipText ); } -cUIComplexControl::~cUIComplexControl() { +UIComplexControl::~UIComplexControl() { eeSAFE_DELETE( mTooltip ); } -Uint32 cUIComplexControl::Type() const { +Uint32 UIComplexControl::Type() const { return UI_TYPE_CONTROL_COMPLEX; } -bool cUIComplexControl::IsType( const Uint32& type ) const { - return cUIComplexControl::Type() == type ? true : cUIControlAnim::IsType( type ); +bool UIComplexControl::IsType( const Uint32& type ) const { + return UIComplexControl::Type() == type ? true : UIControlAnim::IsType( type ); } -void cUIComplexControl::UpdateAnchorsDistances() { +void UIComplexControl::UpdateAnchorsDistances() { if ( NULL != mParentCtrl ) { mDistToBorder = Recti( mPos.x, mPos.y, mParentCtrl->Size().x - ( mPos.x + mSize.x ), mParentCtrl->Size().y - ( mPos.y + mSize.y ) ); } } -void cUIComplexControl::Update() { +void UIComplexControl::Update() { if ( mVisible && NULL != mTooltip && mTooltip->Text().size() ) { if ( IsMouseOverMeOrChilds() ) { - Vector2i Pos = cUIManager::instance()->GetMousePos(); - Pos.x += cUIThemeManager::instance()->CursorSize().x; - Pos.y += cUIThemeManager::instance()->CursorSize().y; + Vector2i Pos = UIManager::instance()->GetMousePos(); + Pos.x += UIThemeManager::instance()->CursorSize().x; + Pos.y += UIThemeManager::instance()->CursorSize().y; - if ( Pos.x + mTooltip->Size().Width() > cUIManager::instance()->MainControl()->Size().Width() ) { - Pos.x = cUIManager::instance()->GetMousePos().x - mTooltip->Size().Width(); + if ( Pos.x + mTooltip->Size().Width() > UIManager::instance()->MainControl()->Size().Width() ) { + Pos.x = UIManager::instance()->GetMousePos().x - mTooltip->Size().Width(); } - if ( Pos.y + mTooltip->Size().Height() > cUIManager::instance()->MainControl()->Size().Height() ) { - Pos.y = cUIManager::instance()->GetMousePos().y - mTooltip->Size().Height(); + if ( Pos.y + mTooltip->Size().Height() > UIManager::instance()->MainControl()->Size().Height() ) { + Pos.y = UIManager::instance()->GetMousePos().y - mTooltip->Size().Height(); } - if ( Time::Zero == cUIThemeManager::instance()->TooltipTimeToShow() ) { - if ( !mTooltip->Visible() || cUIThemeManager::instance()->TooltipFollowMouse() ) + if ( Time::Zero == UIThemeManager::instance()->TooltipTimeToShow() ) { + if ( !mTooltip->Visible() || UIThemeManager::instance()->TooltipFollowMouse() ) mTooltip->Pos( Pos ); mTooltip->Show(); } else { if ( -1.f != mTooltip->TooltipTime().AsMilliseconds() ) { - mTooltip->TooltipTimeAdd( cUIManager::instance()->Elapsed() ); + mTooltip->TooltipTimeAdd( UIManager::instance()->Elapsed() ); } - if ( mTooltip->TooltipTime() >= cUIThemeManager::instance()->TooltipTimeToShow() ) { + if ( mTooltip->TooltipTime() >= UIThemeManager::instance()->TooltipTimeToShow() ) { if ( mTooltip->TooltipTime().AsMilliseconds() != -1.f ) { mTooltip->Pos( Pos ); @@ -69,7 +69,7 @@ void cUIComplexControl::Update() { } } - if ( cUIThemeManager::instance()->TooltipFollowMouse() ) { + if ( UIThemeManager::instance()->TooltipFollowMouse() ) { mTooltip->Pos( Pos ); } } else { @@ -80,28 +80,28 @@ void cUIComplexControl::Update() { } } - cUIControlAnim::Update(); + UIControlAnim::Update(); } -void cUIComplexControl::CreateTooltip() { +void UIComplexControl::CreateTooltip() { if ( NULL != mTooltip ) return; - cUITheme * tTheme = cUIThemeManager::instance()->DefaultTheme(); + UITheme * tTheme = UIThemeManager::instance()->DefaultTheme(); if ( NULL != tTheme ) { - mTooltip = tTheme->CreateTooltip( this, cUIManager::instance()->MainControl() ); + mTooltip = tTheme->CreateTooltip( this, UIManager::instance()->MainControl() ); mTooltip->Visible( false ); mTooltip->Enabled( false ); } else { - cUITooltip::CreateParams Params; - Params.Parent( cUIManager::instance()->MainControl() ); + UITooltip::CreateParams Params; + Params.Parent( UIManager::instance()->MainControl() ); Params.Flags = UI_VALIGN_CENTER | UI_HALIGN_CENTER | UI_AUTO_PADDING | UI_AUTO_SIZE; - mTooltip = eeNew( cUITooltip, ( Params, this ) ); + mTooltip = eeNew( UITooltip, ( Params, this ) ); } } -void cUIComplexControl::TooltipText( const String& Text ) { +void UIComplexControl::TooltipText( const String& Text ) { if ( NULL == mTooltip ) { // If the tooltip wasn't created it will avoid to create a new one if the string is "" if ( Text.size() ) { CreateTooltip(); @@ -113,18 +113,18 @@ void cUIComplexControl::TooltipText( const String& Text ) { } } -String cUIComplexControl::TooltipText() { +String UIComplexControl::TooltipText() { if ( NULL != mTooltip ) return mTooltip->Text(); return String(); } -void cUIComplexControl::TooltipRemove() { +void UIComplexControl::TooltipRemove() { mTooltip = NULL; } -void cUIComplexControl::Size( const Sizei &Size ) { +void UIComplexControl::Size( const Sizei &Size ) { Sizei s( Size ); if ( s.x < mMinControlSize.x ) @@ -133,18 +133,18 @@ void cUIComplexControl::Size( const Sizei &Size ) { if ( s.y < mMinControlSize.y ) s.y = mMinControlSize.y; - cUIControlAnim::Size( s ); + UIControlAnim::Size( s ); } -void cUIComplexControl::Size( const Int32& Width, const Int32& Height ) { - cUIControlAnim::Size( Width, Height ); +void UIComplexControl::Size( const Int32& Width, const Int32& Height ) { + UIControlAnim::Size( Width, Height ); } -const Sizei& cUIComplexControl::Size() { - return cUIControlAnim::Size(); +const Sizei& UIComplexControl::Size() { + return UIControlAnim::Size(); } -void cUIComplexControl::OnParentSizeChange( const Vector2i& SizeChange ) { +void UIComplexControl::OnParentSizeChange( const Vector2i& SizeChange ) { Sizei newSize( mSize ); if ( mFlags & UI_ANCHOR_LEFT ) { @@ -180,7 +180,7 @@ void cUIComplexControl::OnParentSizeChange( const Vector2i& SizeChange ) { if ( newSize != mSize ) Size( newSize ); - cUIControlAnim::OnParentSizeChange( SizeChange ); + UIControlAnim::OnParentSizeChange( SizeChange ); } }} diff --git a/src/eepp/ui/cuicontrol.cpp b/src/eepp/ui/uicontrol.cpp similarity index 55% rename from src/eepp/ui/cuicontrol.cpp rename to src/eepp/ui/uicontrol.cpp index 4b3433d6b..e64357fa9 100644 --- a/src/eepp/ui/cuicontrol.cpp +++ b/src/eepp/ui/uicontrol.cpp @@ -1,13 +1,13 @@ -#include -#include -#include +#include +#include +#include #include #include #include namespace EE { namespace UI { -cUIControl::cUIControl( const CreateParams& Params ) : +UIControl::UIControl( const CreateParams& Params ) : mPos( Params.Pos ), mSize( Params.Size ), mFlags( Params.Flags ), @@ -26,24 +26,24 @@ cUIControl::cUIControl( const CreateParams& Params ) : mVisible( false ), mEnabled( false ) { - if ( NULL == mParentCtrl && NULL != cUIManager::instance()->MainControl() ) { - mParentCtrl = cUIManager::instance()->MainControl(); + if ( NULL == mParentCtrl && NULL != UIManager::instance()->MainControl() ) { + mParentCtrl = UIManager::instance()->MainControl(); } if ( NULL != mParentCtrl ) mParentCtrl->ChildAdd( this ); if ( mFlags & UI_FILL_BACKGROUND ) - mBackground = eeNew( cUIBackground, ( Params.Background ) ); + mBackground = eeNew( UIBackground, ( Params.Background ) ); if ( mFlags & UI_BORDER ) - mBorder = eeNew( cUIBorder, ( Params.Border ) ); + mBorder = eeNew( UIBorder, ( Params.Border ) ); UpdateScreenPos(); UpdateQuad(); } -cUIControl::~cUIControl() { +UIControl::~UIControl() { SafeDeleteSkinState(); eeSAFE_DELETE( mBackground ); eeSAFE_DELETE( mBorder ); @@ -53,17 +53,17 @@ cUIControl::~cUIControl() { if ( NULL != mParentCtrl ) mParentCtrl->ChildRemove( this ); - if ( cUIManager::instance()->FocusControl() == this && cUIManager::instance()->MainControl() != this ) { - cUIManager::instance()->FocusControl( cUIManager::instance()->MainControl() ); + if ( UIManager::instance()->FocusControl() == this && UIManager::instance()->MainControl() != this ) { + UIManager::instance()->FocusControl( UIManager::instance()->MainControl() ); } - if ( cUIManager::instance()->OverControl() == this && cUIManager::instance()->MainControl() != this ) { - cUIManager::instance()->OverControl( cUIManager::instance()->MainControl() ); + if ( UIManager::instance()->OverControl() == this && UIManager::instance()->MainControl() != this ) { + UIManager::instance()->OverControl( UIManager::instance()->MainControl() ); } } -void cUIControl::ScreenToControl( Vector2i& Pos ) const { - cUIControl * ParentLoop = mParentCtrl; +void UIControl::ScreenToControl( Vector2i& Pos ) const { + UIControl * ParentLoop = mParentCtrl; Pos.x -= mPos.x; Pos.y -= mPos.y; @@ -78,8 +78,8 @@ void cUIControl::ScreenToControl( Vector2i& Pos ) const { } } -void cUIControl::ControlToScreen( Vector2i& Pos ) const { - cUIControl * ParentLoop = mParentCtrl; +void UIControl::ControlToScreen( Vector2i& Pos ) const { + UIControl * ParentLoop = mParentCtrl; while ( NULL != ParentLoop ) { const Vector2i& ParentPos = ParentLoop->Pos(); @@ -91,16 +91,16 @@ void cUIControl::ControlToScreen( Vector2i& Pos ) const { } } -Uint32 cUIControl::Type() const { +Uint32 UIControl::Type() const { return UI_TYPE_CONTROL; } -bool cUIControl::IsType( const Uint32& type ) const { - return cUIControl::Type() == type; +bool UIControl::IsType( const Uint32& type ) const { + return UIControl::Type() == type; } -void cUIControl::MessagePost( const cUIMessage * Msg ) { - cUIControl * Ctrl = this; +void UIControl::MessagePost( const UIMessage * Msg ) { + UIControl * Ctrl = this; while( NULL != Ctrl ) { if ( Ctrl->OnMessage( Msg ) ) @@ -110,29 +110,29 @@ void cUIControl::MessagePost( const cUIMessage * Msg ) { } } -Uint32 cUIControl::OnMessage( const cUIMessage * Msg ) { +Uint32 UIControl::OnMessage( const UIMessage * Msg ) { return 0; } -bool cUIControl::IsInside( const Vector2i& Pos ) const { +bool UIControl::IsInside( const Vector2i& Pos ) const { return ( Pos.x >= 0 && Pos.y >= 0 && Pos.x < mSize.Width() && Pos.y < mSize.Height() ); } -void cUIControl::Pos( const Vector2i& Pos ) { +void UIControl::Pos( const Vector2i& Pos ) { mPos = Pos; OnPosChange(); } -void cUIControl::Pos( const Int32& x, const Int32& y ) { +void UIControl::Pos( const Int32& x, const Int32& y ) { mPos = Vector2i( x, y ); OnPosChange(); } -const Vector2i& cUIControl::Pos() const { +const Vector2i& UIControl::Pos() const { return mPos; } -void cUIControl::Size( const Sizei& Size ) { +void UIControl::Size( const Sizei& Size ) { if ( Size != mSize ) { Vector2i sizeChange( Size.x - mSize.x, Size.y - mSize.y ); @@ -146,49 +146,49 @@ void cUIControl::Size( const Sizei& Size ) { } } -void cUIControl::Size( const Int32& Width, const Int32& Height ) { +void UIControl::Size( const Int32& Width, const Int32& Height ) { Size( Sizei( Width, Height ) ); } -Recti cUIControl::Rect() const { +Recti UIControl::Rect() const { return Recti( mPos, mSize ); } -const Sizei& cUIControl::Size() { +const Sizei& UIControl::Size() { return mSize; } -void cUIControl::Visible( const bool& visible ) { +void UIControl::Visible( const bool& visible ) { mVisible = visible; OnVisibleChange(); } -bool cUIControl::Visible() const { +bool UIControl::Visible() const { return mVisible; } -bool cUIControl::Hided() const { +bool UIControl::Hided() const { return !mVisible; } -void cUIControl::Enabled( const bool& enabled ) { +void UIControl::Enabled( const bool& enabled ) { mEnabled = enabled; OnEnabledChange(); } -bool cUIControl::Enabled() const { +bool UIControl::Enabled() const { return mEnabled; } -bool cUIControl::Disabled() const { +bool UIControl::Disabled() const { return !mEnabled; } -cUIControl * cUIControl::Parent() const { +UIControl * UIControl::Parent() const { return mParentCtrl; } -void cUIControl::Parent( cUIControl * parent ) { +void UIControl::Parent( UIControl * parent ) { if ( parent == mParentCtrl ) return; @@ -201,10 +201,10 @@ void cUIControl::Parent( cUIControl * parent ) { mParentCtrl->ChildAdd( this ); } -bool cUIControl::IsParentOf( cUIControl * Ctrl ) { +bool UIControl::IsParentOf( UIControl * Ctrl ) { eeASSERT( NULL != Ctrl ); - cUIControl * tParent = Ctrl->Parent(); + UIControl * tParent = Ctrl->Parent(); while ( NULL != tParent ) { if ( this == tParent ) @@ -216,32 +216,32 @@ bool cUIControl::IsParentOf( cUIControl * Ctrl ) { return false; } -void cUIControl::CenterHorizontal() { - cUIControl * Ctrl = Parent(); +void UIControl::CenterHorizontal() { + UIControl * Ctrl = Parent(); if ( NULL != Ctrl ) Pos( Vector2i( ( Ctrl->Size().Width() / 2 ) - ( mSize.Width() / 2 ), mPos.y ) ); } -void cUIControl::CenterVertical(){ - cUIControl * Ctrl = Parent(); +void UIControl::CenterVertical(){ + UIControl * Ctrl = Parent(); if ( NULL != Ctrl ) Pos( Vector2i( mPos.x, ( Ctrl->Size().Height() / 2 ) - ( mSize.Height() / 2 ) ) ); } -void cUIControl::Center() { +void UIControl::Center() { CenterHorizontal(); CenterVertical(); } -void cUIControl::Close() { +void UIControl::Close() { mControlFlags |= UI_CTRL_FLAG_CLOSE; - cUIManager::instance()->AddToCloseQueue( this ); + UIManager::instance()->AddToCloseQueue( this ); } -void cUIControl::Draw() { +void UIControl::Draw() { if ( mVisible ) { if ( mFlags & UI_FILL_BACKGROUND ) BackgroundDraw(); @@ -252,26 +252,26 @@ void cUIControl::Draw() { if ( NULL != mSkinState ) mSkinState->Draw( (Float)mScreenPos.x, (Float)mScreenPos.y, (Float)mSize.Width(), (Float)mSize.Height(), 255 ); - if ( cUIManager::instance()->HighlightFocus() && cUIManager::instance()->FocusControl() == this ) { + if ( UIManager::instance()->HighlightFocus() && UIManager::instance()->FocusControl() == this ) { Primitives P; P.FillMode( DRAW_LINE ); P.BlendMode( Blend() ); - P.SetColor( cUIManager::instance()->HighlightFocusColor() ); + P.SetColor( UIManager::instance()->HighlightFocusColor() ); P.DrawRectangle( GetRectf() ); } - if ( cUIManager::instance()->HighlightOver() && cUIManager::instance()->OverControl() == this ) { + if ( UIManager::instance()->HighlightOver() && UIManager::instance()->OverControl() == this ) { Primitives P; P.FillMode( DRAW_LINE ); P.BlendMode( Blend() ); - P.SetColor( cUIManager::instance()->HighlightOverColor() ); + P.SetColor( UIManager::instance()->HighlightOverColor() ); P.DrawRectangle( GetRectf() ); } } } -void cUIControl::Update() { - cUIControl * ChildLoop = mChild; +void UIControl::Update() { + UIControl * ChildLoop = mChild; while ( NULL != ChildLoop ) { ChildLoop->Update(); @@ -282,246 +282,246 @@ void cUIControl::Update() { WriteCtrlFlag( UI_CTRL_FLAG_MOUSEOVER_ME_OR_CHILD, 0 ); } -void cUIControl::SendMouseEvent( const Uint32& Event, const Vector2i& Pos, const Uint32& Flags ) { - cUIEventMouse MouseEvent( this, Event, Pos, Flags ); +void UIControl::SendMouseEvent( const Uint32& Event, const Vector2i& Pos, const Uint32& Flags ) { + UIEventMouse MouseEvent( this, Event, Pos, Flags ); SendEvent( &MouseEvent ); } -void cUIControl::SendCommonEvent( const Uint32& Event ) { - cUIEvent CommonEvent( this, Event ); +void UIControl::SendCommonEvent( const Uint32& Event ) { + UIEvent CommonEvent( this, Event ); SendEvent( &CommonEvent ); } -Uint32 cUIControl::OnKeyDown( const cUIEventKey& Event ) { +Uint32 UIControl::OnKeyDown( const UIEventKey& Event ) { SendEvent( &Event ); return 0; } -Uint32 cUIControl::OnKeyUp( const cUIEventKey& Event ) { +Uint32 UIControl::OnKeyUp( const UIEventKey& Event ) { SendEvent( &Event ); return 0; } -Uint32 cUIControl::OnMouseMove( const Vector2i& Pos, const Uint32 Flags ) { - SendMouseEvent( cUIEvent::EventMouseMove, Pos, Flags ); +Uint32 UIControl::OnMouseMove( const Vector2i& Pos, const Uint32 Flags ) { + SendMouseEvent( UIEvent::EventMouseMove, Pos, Flags ); return 1; } -Uint32 cUIControl::OnMouseDown( const Vector2i& Pos, const Uint32 Flags ) { - SendMouseEvent( cUIEvent::EventMouseDown, Pos, Flags ); +Uint32 UIControl::OnMouseDown( const Vector2i& Pos, const Uint32 Flags ) { + SendMouseEvent( UIEvent::EventMouseDown, Pos, Flags ); - SetSkinState( cUISkinState::StateMouseDown ); + SetSkinState( UISkinState::StateMouseDown ); return 1; } -Uint32 cUIControl::OnMouseUp( const Vector2i& Pos, const Uint32 Flags ) { - SendMouseEvent( cUIEvent::EventMouseUp, Pos, Flags ); +Uint32 UIControl::OnMouseUp( const Vector2i& Pos, const Uint32 Flags ) { + SendMouseEvent( UIEvent::EventMouseUp, Pos, Flags ); SetPrevSkinState(); return 1; } -Uint32 cUIControl::OnMouseClick( const Vector2i& Pos, const Uint32 Flags ) { - SendMouseEvent( cUIEvent::EventMouseClick, Pos, Flags ); +Uint32 UIControl::OnMouseClick( const Vector2i& Pos, const Uint32 Flags ) { + SendMouseEvent( UIEvent::EventMouseClick, Pos, Flags ); return 1; } -bool cUIControl::IsMouseOver() { +bool UIControl::IsMouseOver() { return 0 != ( mControlFlags & UI_CTRL_FLAG_MOUSEOVER ); } -bool cUIControl::IsMouseOverMeOrChilds() { +bool UIControl::IsMouseOverMeOrChilds() { return 0 != ( mControlFlags & UI_CTRL_FLAG_MOUSEOVER_ME_OR_CHILD ); } -Uint32 cUIControl::OnMouseDoubleClick( const Vector2i& Pos, const Uint32 Flags ) { - SendMouseEvent( cUIEvent::EventMouseDoubleClick, Pos, Flags ); +Uint32 UIControl::OnMouseDoubleClick( const Vector2i& Pos, const Uint32 Flags ) { + SendMouseEvent( UIEvent::EventMouseDoubleClick, Pos, Flags ); return 1; } -Uint32 cUIControl::OnMouseEnter( const Vector2i& Pos, const Uint32 Flags ) { +Uint32 UIControl::OnMouseEnter( const Vector2i& Pos, const Uint32 Flags ) { WriteCtrlFlag( UI_CTRL_FLAG_MOUSEOVER, 1 ); - SendMouseEvent( cUIEvent::EventMouseEnter, Pos, Flags ); + SendMouseEvent( UIEvent::EventMouseEnter, Pos, Flags ); - SetSkinState( cUISkinState::StateMouseEnter ); + SetSkinState( UISkinState::StateMouseEnter ); return 1; } -Uint32 cUIControl::OnMouseExit( const Vector2i& Pos, const Uint32 Flags ) { +Uint32 UIControl::OnMouseExit( const Vector2i& Pos, const Uint32 Flags ) { WriteCtrlFlag( UI_CTRL_FLAG_MOUSEOVER, 0 ); - SendMouseEvent( cUIEvent::EventMouseExit, Pos, Flags ); + SendMouseEvent( UIEvent::EventMouseExit, Pos, Flags ); - SetSkinState( cUISkinState::StateMouseExit ); + SetSkinState( UISkinState::StateMouseExit ); return 1; } -Uint32 cUIControl::OnFocus() { +Uint32 UIControl::OnFocus() { mControlFlags |= UI_CTRL_FLAG_HAS_FOCUS; - SendCommonEvent( cUIEvent::EventOnFocus ); + SendCommonEvent( UIEvent::EventOnFocus ); - SetSkinState( cUISkinState::StateFocus ); + SetSkinState( UISkinState::StateFocus ); return 1; } -Uint32 cUIControl::OnFocusLoss() { +Uint32 UIControl::OnFocusLoss() { mControlFlags &= ~UI_CTRL_FLAG_HAS_FOCUS; - SendCommonEvent( cUIEvent::EventOnFocusLoss ); + SendCommonEvent( UIEvent::EventOnFocusLoss ); return 1; } -void cUIControl::OnComplexControlFocusLoss() { - SendCommonEvent( cUIEvent::EventOnComplexControlFocusLoss ); +void UIControl::OnComplexControlFocusLoss() { + SendCommonEvent( UIEvent::EventOnComplexControlFocusLoss ); } -bool cUIControl::HasFocus() const { +bool UIControl::HasFocus() const { return 0 != ( mControlFlags & UI_CTRL_FLAG_HAS_FOCUS ); } -Uint32 cUIControl::OnValueChange() { - SendCommonEvent( cUIEvent::EventOnValueChange ); +Uint32 UIControl::OnValueChange() { + SendCommonEvent( UIEvent::EventOnValueChange ); return 1; } -void cUIControl::OnClose() { - SendCommonEvent( cUIEvent::EventOnClose ); +void UIControl::OnClose() { + SendCommonEvent( UIEvent::EventOnClose ); } -Uint32 cUIControl::HAlign() const { +Uint32 UIControl::HAlign() const { return mFlags & UI_HALIGN_MASK; } -void cUIControl::HAlign( Uint32 halign ) { +void UIControl::HAlign( Uint32 halign ) { mFlags |= halign & UI_HALIGN_MASK; } -Uint32 cUIControl::VAlign() const { +Uint32 UIControl::VAlign() const { return mFlags & UI_VALIGN_MASK; } -void cUIControl::VAlign( Uint32 valign ) { +void UIControl::VAlign( Uint32 valign ) { mFlags |= valign & UI_VALIGN_MASK; } -void cUIControl::FillBackground( bool enabled ) { +void UIControl::FillBackground( bool enabled ) { WriteFlag( UI_FILL_BACKGROUND, enabled ? 1 : 0 ); if ( enabled && NULL == mBackground ) { - mBackground = eeNew( cUIBackground, () ); + mBackground = eeNew( UIBackground, () ); } } -void cUIControl::Border( bool enabled ) { +void UIControl::Border( bool enabled ) { WriteFlag( UI_BORDER, enabled ? 1 : 0 ); if ( enabled && NULL == mBorder ) { - mBorder = eeNew( cUIBorder, () ); + mBorder = eeNew( UIBorder, () ); if ( NULL == mBackground ) { - mBackground = eeNew( cUIBackground, () ); + mBackground = eeNew( UIBackground, () ); } } } -cUIControl * cUIControl::NextGet() const { +UIControl * UIControl::NextGet() const { return mNext; } -cUIControl * cUIControl::PrevGet() const { +UIControl * UIControl::PrevGet() const { return mPrev; } -cUIControl * cUIControl::NextGetLoop() const { +UIControl * UIControl::NextGetLoop() const { if ( NULL == mNext ) return Parent()->ChildGetFirst(); else return mNext; } -void cUIControl::Data(const UintPtr& data ) { +void UIControl::Data(const UintPtr& data ) { mData = data; } -const UintPtr& cUIControl::Data() const { +const UintPtr& UIControl::Data() const { return mData; } -const Uint32& cUIControl::Flags() const { +const Uint32& UIControl::Flags() const { return mFlags; } -void cUIControl::Flags( const Uint32& flags ) { +void UIControl::Flags( const Uint32& flags ) { mFlags |= flags; } -void cUIControl::Blend( const EE_BLEND_MODE& blend ) { +void UIControl::Blend( const EE_BLEND_MODE& blend ) { mBlend = static_cast ( blend ); } -EE_BLEND_MODE cUIControl::Blend() { +EE_BLEND_MODE UIControl::Blend() { return static_cast ( mBlend ); } -void cUIControl::ToFront() { +void UIControl::ToFront() { if ( NULL != mParentCtrl ) { mParentCtrl->ChildRemove( this ); mParentCtrl->ChildAdd( this ); } } -void cUIControl::ToBack() { +void UIControl::ToBack() { if ( NULL != mParentCtrl ) { mParentCtrl->ChildAddAt( this, 0 ); } } -void cUIControl::ToPos( const Uint32& Pos ) { +void UIControl::ToPos( const Uint32& Pos ) { if ( NULL != mParentCtrl ) { mParentCtrl->ChildAddAt( this, Pos ); } } -void cUIControl::OnVisibleChange() { - SendCommonEvent( cUIEvent::EventOnVisibleChange ); +void UIControl::OnVisibleChange() { + SendCommonEvent( UIEvent::EventOnVisibleChange ); } -void cUIControl::OnEnabledChange() { - if ( !Enabled() && NULL != cUIManager::instance()->FocusControl() ) { - if ( IsChild( cUIManager::instance()->FocusControl() ) ) { - cUIManager::instance()->FocusControl( NULL ); +void UIControl::OnEnabledChange() { + if ( !Enabled() && NULL != UIManager::instance()->FocusControl() ) { + if ( IsChild( UIManager::instance()->FocusControl() ) ) { + UIManager::instance()->FocusControl( NULL ); } } - SendCommonEvent( cUIEvent::EventOnEnabledChange ); + SendCommonEvent( UIEvent::EventOnEnabledChange ); } -void cUIControl::OnPosChange() { +void UIControl::OnPosChange() { UpdateScreenPos(); UpdateChildsScreenPos(); - SendCommonEvent( cUIEvent::EventOnPosChange ); + SendCommonEvent( UIEvent::EventOnPosChange ); } -void cUIControl::OnSizeChange() { - SendCommonEvent( cUIEvent::EventOnSizeChange ); +void UIControl::OnSizeChange() { + SendCommonEvent( UIEvent::EventOnSizeChange ); } -Rectf cUIControl::GetRectf() { +Rectf UIControl::GetRectf() { return Rectf( Vector2f( (Float)mScreenPos.x, (Float)mScreenPos.y ), Sizef( (Float)mSize.Width(), (Float)mSize.Height() ) ); } -void cUIControl::BackgroundDraw() { +void UIControl::BackgroundDraw() { Primitives P; Rectf R = GetRectf(); P.BlendMode( mBackground->Blend() ); @@ -542,7 +542,7 @@ void cUIControl::BackgroundDraw() { } } -void cUIControl::BorderDraw() { +void UIControl::BorderDraw() { Primitives P; P.FillMode( DRAW_LINE ); P.BlendMode( Blend() ); @@ -567,16 +567,16 @@ void cUIControl::BorderDraw() { } } -const Uint32& cUIControl::ControlFlags() const { +const Uint32& UIControl::ControlFlags() const { return mControlFlags; } -void cUIControl::ControlFlags( const Uint32& Flags ) { +void UIControl::ControlFlags( const Uint32& Flags ) { mControlFlags = Flags; } -void cUIControl::DrawChilds() { - cUIControl * ChildLoop = mChild; +void UIControl::DrawChilds() { + UIControl * ChildLoop = mChild; while ( NULL != ChildLoop ) { if ( ChildLoop->mVisible ) { @@ -587,7 +587,7 @@ void cUIControl::DrawChilds() { } } -void cUIControl::InternalDraw() { +void UIControl::InternalDraw() { if ( mVisible ) { MatrixSet(); @@ -603,33 +603,33 @@ void cUIControl::InternalDraw() { } } -void cUIControl::ClipMe() { +void UIControl::ClipMe() { if ( mFlags & UI_CLIP_ENABLE ) { if ( mFlags & UI_BORDER ) - cUIManager::instance()->ClipEnable( mScreenPos.x, mScreenPos.y, mSize.Width(), mSize.Height() + 1 ); + UIManager::instance()->ClipEnable( mScreenPos.x, mScreenPos.y, mSize.Width(), mSize.Height() + 1 ); else - cUIManager::instance()->ClipEnable( mScreenPos.x, mScreenPos.y, mSize.Width(), mSize.Height() ); + UIManager::instance()->ClipEnable( mScreenPos.x, mScreenPos.y, mSize.Width(), mSize.Height() ); } } -void cUIControl::ClipDisable() { +void UIControl::ClipDisable() { if ( mFlags & UI_CLIP_ENABLE ) - cUIManager::instance()->ClipDisable(); + UIManager::instance()->ClipDisable(); } -void cUIControl::MatrixSet() { +void UIControl::MatrixSet() { } -void cUIControl::MatrixUnset() { +void UIControl::MatrixUnset() { } -void cUIControl::ChildDeleteAll() { +void UIControl::ChildDeleteAll() { while( NULL != mChild ) { eeDelete( mChild ); } } -void cUIControl::ChildAdd( cUIControl * ChildCtrl ) { +void UIControl::ChildAdd( UIControl * ChildCtrl ) { if ( NULL == mChild ) { mChild = ChildCtrl; mChildLast = ChildCtrl; @@ -641,10 +641,10 @@ void cUIControl::ChildAdd( cUIControl * ChildCtrl ) { } } -void cUIControl::ChildAddAt( cUIControl * ChildCtrl, Uint32 Pos ) { +void UIControl::ChildAddAt( UIControl * ChildCtrl, Uint32 Pos ) { eeASSERT( NULL != ChildCtrl ); - cUIControl * ChildLoop = mChild; + UIControl * ChildLoop = mChild; ChildCtrl->Parent( this ); @@ -673,7 +673,7 @@ void cUIControl::ChildAddAt( cUIControl * ChildCtrl, Uint32 Pos ) { i++; } - cUIControl * ChildTmp = ChildLoop->mNext; + UIControl * ChildTmp = ChildLoop->mNext; ChildLoop->mNext = ChildCtrl; ChildCtrl->mPrev = ChildLoop; ChildCtrl->mNext = ChildTmp; @@ -687,7 +687,7 @@ void cUIControl::ChildAddAt( cUIControl * ChildCtrl, Uint32 Pos ) { } } -void cUIControl::ChildRemove( cUIControl * ChildCtrl ) { +void UIControl::ChildRemove( UIControl * ChildCtrl ) { if ( ChildCtrl == mChild ) { mChild = mChild->mNext; @@ -714,8 +714,8 @@ void cUIControl::ChildRemove( cUIControl * ChildCtrl ) { } } -void cUIControl::ChildsCloseAll() { - cUIControl * ChildLoop = mChild; +void UIControl::ChildsCloseAll() { + UIControl * ChildLoop = mChild; while ( NULL != ChildLoop ) { ChildLoop->Close(); @@ -723,8 +723,8 @@ void cUIControl::ChildsCloseAll() { } } -bool cUIControl::IsChild( cUIControl * ChildCtrl ) const { - cUIControl * ChildLoop = mChild; +bool UIControl::IsChild( UIControl * ChildCtrl ) const { + UIControl * ChildLoop = mChild; while ( NULL != ChildLoop ) { if ( ChildCtrl == ChildLoop ) @@ -736,8 +736,8 @@ bool cUIControl::IsChild( cUIControl * ChildCtrl ) const { return false; } -bool cUIControl::InParentTreeOf( cUIControl * Child ) const { - cUIControl * ParentLoop = Child->mParentCtrl; +bool UIControl::InParentTreeOf( UIControl * Child ) const { + UIControl * ParentLoop = Child->mParentCtrl; while ( NULL != ParentLoop ) { if ( ParentLoop == this ) @@ -749,8 +749,8 @@ bool cUIControl::InParentTreeOf( cUIControl * Child ) const { return false; } -Uint32 cUIControl::ChildCount() const { - cUIControl * ChildLoop = mChild; +Uint32 UIControl::ChildCount() const { + UIControl * ChildLoop = mChild; Uint32 Count = 0; while( NULL != ChildLoop ) { @@ -761,8 +761,8 @@ Uint32 cUIControl::ChildCount() const { return Count; } -cUIControl * cUIControl::ChildAt( Uint32 Index ) const { - cUIControl * ChildLoop = mChild; +UIControl * UIControl::ChildAt( Uint32 Index ) const { + UIControl * ChildLoop = mChild; while( NULL != ChildLoop && Index ) { ChildLoop = ChildLoop->mNext; @@ -772,30 +772,30 @@ cUIControl * cUIControl::ChildAt( Uint32 Index ) const { return ChildLoop; } -cUIControl * cUIControl::ChildPrev( cUIControl * Ctrl, bool Loop ) const { +UIControl * UIControl::ChildPrev( UIControl * Ctrl, bool Loop ) const { if ( Loop && Ctrl == mChild && NULL != mChild->mNext ) return mChildLast; return Ctrl->mPrev; } -cUIControl * cUIControl::ChildNext( cUIControl * Ctrl, bool Loop ) const { +UIControl * UIControl::ChildNext( UIControl * Ctrl, bool Loop ) const { if ( NULL == Ctrl->mNext && Loop ) return mChild; return Ctrl->mNext; } -cUIControl * cUIControl::ChildGetFirst() const { +UIControl * UIControl::ChildGetFirst() const { return mChild; } -cUIControl * cUIControl::ChildGetLast() const { +UIControl * UIControl::ChildGetLast() const { return mChildLast; } -cUIControl * cUIControl::OverFind( const Vector2f& Point ) { - cUIControl * pOver = NULL; +UIControl * UIControl::OverFind( const Vector2f& Point ) { + UIControl * pOver = NULL; if ( mEnabled && mVisible ) { UpdateQuad(); @@ -803,10 +803,10 @@ cUIControl * cUIControl::OverFind( const Vector2f& Point ) { if ( mPoly.PointInside( Point ) ) { WriteCtrlFlag( UI_CTRL_FLAG_MOUSEOVER_ME_OR_CHILD, 1 ); - cUIControl * ChildLoop = mChildLast; + UIControl * ChildLoop = mChildLast; while ( NULL != ChildLoop ) { - cUIControl * ChildOver = ChildLoop->OverFind( Point ); + UIControl * ChildOver = ChildLoop->OverFind( Point ); if ( NULL != ChildOver ) { pOver = ChildOver; @@ -826,10 +826,10 @@ cUIControl * cUIControl::OverFind( const Vector2f& Point ) { return pOver; } -cUIControl * cUIControl::ChildGetAt( Vector2i CtrlPos, unsigned int RecursiveLevel ) { - cUIControl * Ctrl = NULL; +UIControl * UIControl::ChildGetAt( Vector2i CtrlPos, unsigned int RecursiveLevel ) { + UIControl * Ctrl = NULL; - for( cUIControl * pLoop = mChild; NULL != pLoop && NULL == Ctrl; pLoop = pLoop->mNext ) + for( UIControl * pLoop = mChild; NULL != pLoop && NULL == Ctrl; pLoop = pLoop->mNext ) { if ( !pLoop->Visible() ) continue; @@ -846,39 +846,39 @@ cUIControl * cUIControl::ChildGetAt( Vector2i CtrlPos, unsigned int RecursiveLev return Ctrl; } -Uint32 cUIControl::IsAnimated() { +Uint32 UIControl::IsAnimated() { return mControlFlags & UI_CTRL_FLAG_ANIM; } -Uint32 cUIControl::IsDragable() { +Uint32 UIControl::IsDragable() { return mControlFlags & UI_CTRL_FLAG_DRAGABLE; } -Uint32 cUIControl::IsComplex() { +Uint32 UIControl::IsComplex() { return mControlFlags & UI_CTRL_FLAG_COMPLEX; } -Uint32 cUIControl::IsClipped() { +Uint32 UIControl::IsClipped() { return mFlags & UI_CLIP_ENABLE; } -Polygon2f& cUIControl::GetPolygon() { +Polygon2f& UIControl::GetPolygon() { return mPoly; } -const Vector2f& cUIControl::GetPolygonCenter() const { +const Vector2f& UIControl::GetPolygonCenter() const { return mCenter; } -void cUIControl::UpdateQuad() { +void UIControl::UpdateQuad() { mPoly = Polygon2f( eeAABB( (Float)mScreenPos.x, (Float)mScreenPos.y, (Float)mScreenPos.x + mSize.Width(), (Float)mScreenPos.y + mSize.Height() ) ); mCenter = Vector2f( (Float)mScreenPos.x + (Float)mSize.Width() * 0.5f, (Float)mScreenPos.y + (Float)mSize.Height() * 0.5f ); - cUIControl * tParent = Parent(); + UIControl * tParent = Parent(); while ( tParent ) { if ( tParent->IsAnimated() ) { - cUIControlAnim * tP = reinterpret_cast ( tParent ); + UIControlAnim * tP = reinterpret_cast ( tParent ); mPoly.Rotate( tP->Angle(), tP->GetPolygonCenter() ); mPoly.Scale( tP->Scale(), tP->GetPolygonCenter() ); @@ -888,11 +888,11 @@ void cUIControl::UpdateQuad() { }; } -Time cUIControl::Elapsed() { - return cUIManager::instance()->Elapsed(); +Time UIControl::Elapsed() { + return UIManager::instance()->Elapsed(); } -Uint32 cUIControl::AddEventListener( const Uint32& EventType, const UIEventCallback& Callback ) { +Uint32 UIControl::AddEventListener( const Uint32& EventType, const UIEventCallback& Callback ) { mNumCallBacks++; mEvents[ EventType ][ mNumCallBacks ] = Callback; @@ -900,7 +900,7 @@ Uint32 cUIControl::AddEventListener( const Uint32& EventType, const UIEventCallb return mNumCallBacks; } -void cUIControl::RemoveEventListener( const Uint32& CallbackId ) { +void UIControl::RemoveEventListener( const Uint32& CallbackId ) { UIEventsMap::iterator it; for ( it = mEvents.begin(); it != mEvents.end(); ++it ) { @@ -911,7 +911,7 @@ void cUIControl::RemoveEventListener( const Uint32& CallbackId ) { } } -void cUIControl::SendEvent( const cUIEvent * Event ) { +void UIControl::SendEvent( const UIEvent * Event ) { if ( 0 != mEvents.count( Event->EventType() ) ) { std::map event = mEvents[ Event->EventType() ]; std::map::iterator it; @@ -923,25 +923,25 @@ void cUIControl::SendEvent( const cUIEvent * Event ) { } } -cUIBackground * cUIControl::Background() { +UIBackground * UIControl::Background() { return mBackground; } -cUIBorder * cUIControl::Border() { +UIBorder * UIControl::Border() { return mBorder; } -void cUIControl::SetThemeByName( const std::string& Theme ) { - SetTheme( cUIThemeManager::instance()->GetByName( Theme ) ); +void UIControl::SetThemeByName( const std::string& Theme ) { + SetTheme( UIThemeManager::instance()->GetByName( Theme ) ); } -void cUIControl::SetTheme( cUITheme * Theme ) { +void UIControl::SetTheme( UITheme * Theme ) { SetThemeControl( Theme, "control" ); } -void cUIControl::SafeDeleteSkinState() { +void UIControl::SafeDeleteSkinState() { if ( NULL != mSkinState && ( mControlFlags & UI_CTRL_FLAG_SKIN_OWNER ) ) { - cUISkin * tSkin = mSkinState->GetSkin(); + UISkin * tSkin = mSkinState->GetSkin(); eeSAFE_DELETE( tSkin ); } @@ -949,12 +949,12 @@ void cUIControl::SafeDeleteSkinState() { eeSAFE_DELETE( mSkinState ); } -void cUIControl::SetThemeControl( cUITheme * Theme, const std::string& ControlName ) { +void UIControl::SetThemeControl( UITheme * Theme, const std::string& ControlName ) { if ( NULL != Theme ) { - cUISkin * tSkin = Theme->GetByName( Theme->Abbr() + "_" + ControlName ); + UISkin * tSkin = Theme->GetByName( Theme->Abbr() + "_" + ControlName ); if ( NULL != tSkin ) { - Uint32 InitialState = cUISkinState::StateNormal; + Uint32 InitialState = UISkinState::StateNormal; if ( NULL != mSkinState ) { InitialState = mSkinState->GetState(); @@ -962,32 +962,32 @@ void cUIControl::SetThemeControl( cUITheme * Theme, const std::string& ControlNa SafeDeleteSkinState(); - mSkinState = eeNew( cUISkinState, ( tSkin ) ); + mSkinState = eeNew( UISkinState, ( tSkin ) ); mSkinState->SetState( InitialState ); } } } -void cUIControl::SetSkinFromTheme( cUITheme * Theme, const std::string& ControlName ) { +void UIControl::SetSkinFromTheme( UITheme * Theme, const std::string& ControlName ) { SetThemeControl( Theme, ControlName ); } -void cUIControl::SetSkin( const cUISkin& Skin ) { +void UIControl::SetSkin( const UISkin& Skin ) { SafeDeleteSkinState(); WriteCtrlFlag( UI_CTRL_FLAG_SKIN_OWNER, 1 ); - cUISkin * SkinCopy = const_cast( &Skin )->Copy(); + UISkin * SkinCopy = const_cast( &Skin )->Copy(); - mSkinState = eeNew( cUISkinState, ( SkinCopy ) ); + mSkinState = eeNew( UISkinState, ( SkinCopy ) ); DoAfterSetTheme(); } -void cUIControl::OnStateChange() { +void UIControl::OnStateChange() { } -void cUIControl::SetSkinState( const Uint32& State ) { +void UIControl::SetSkinState( const Uint32& State ) { if ( NULL != mSkinState ) { mSkinState->SetState( State ); @@ -995,7 +995,7 @@ void cUIControl::SetSkinState( const Uint32& State ) { } } -void cUIControl::SetPrevSkinState() { +void UIControl::SetPrevSkinState() { if ( NULL != mSkinState ) { mSkinState->SetPrevState(); @@ -1003,8 +1003,8 @@ void cUIControl::SetPrevSkinState() { } } -void cUIControl::SetThemeToChilds( cUITheme * Theme ) { - cUIControl * ChildLoop = mChild; +void UIControl::SetThemeToChilds( UITheme * Theme ) { + UIControl * ChildLoop = mChild; while ( NULL != ChildLoop ) { ChildLoop->SetThemeToChilds( Theme ); @@ -1014,8 +1014,8 @@ void cUIControl::SetThemeToChilds( cUITheme * Theme ) { } } -void cUIControl::UpdateChildsScreenPos() { - cUIControl * ChildLoop = mChild; +void UIControl::UpdateChildsScreenPos() { + UIControl * ChildLoop = mChild; while ( NULL != ChildLoop ) { ChildLoop->UpdateScreenPos(); @@ -1025,7 +1025,7 @@ void cUIControl::UpdateChildsScreenPos() { } } -void cUIControl::UpdateScreenPos() { +void UIControl::UpdateScreenPos() { Vector2i Pos( mPos ); ControlToScreen( Pos ); @@ -1033,18 +1033,18 @@ void cUIControl::UpdateScreenPos() { mScreenPos = Pos; } -cUISkin * cUIControl::GetSkin() { +UISkin * UIControl::GetSkin() { if ( NULL != mSkinState ) return mSkinState->GetSkin(); return NULL; } -void cUIControl::WriteCtrlFlag( const Uint32& Flag, const Uint32& Val ) { +void UIControl::WriteCtrlFlag( const Uint32& Flag, const Uint32& Val ) { BitOp::SetBitFlagValue( &mControlFlags, Flag, Val ); } -void cUIControl::WriteFlag( const Uint32& Flag, const Uint32& Val ) { +void UIControl::WriteFlag( const Uint32& Flag, const Uint32& Val ) { if ( Val ) mFlags |= Flag; else { @@ -1053,47 +1053,47 @@ void cUIControl::WriteFlag( const Uint32& Flag, const Uint32& Val ) { } } -void cUIControl::ApplyDefaultTheme() { - cUIThemeManager::instance()->ApplyDefaultTheme( this ); +void UIControl::ApplyDefaultTheme() { + UIThemeManager::instance()->ApplyDefaultTheme( this ); } -Recti cUIControl::GetScreenRect() { +Recti UIControl::GetScreenRect() { return Recti( mScreenPos, mSize ); } -Recti cUIControl::MakePadding( bool PadLeft, bool PadRight, bool PadTop, bool PadBottom, bool SkipFlags ) { +Recti UIControl::MakePadding( bool PadLeft, bool PadRight, bool PadTop, bool PadBottom, bool SkipFlags ) { Recti tPadding( 0, 0, 0, 0 ); if ( mFlags & UI_AUTO_PADDING || SkipFlags ) { if ( NULL != mSkinState && NULL != mSkinState->GetSkin() ) { - if ( mSkinState->GetSkin()->GetType() == cUISkin::UISkinComplex ) { - cUISkinComplex * tComplex = reinterpret_cast ( mSkinState->GetSkin() ); + if ( mSkinState->GetSkin()->GetType() == UISkin::SkinComplex ) { + UISkinComplex * tComplex = reinterpret_cast ( mSkinState->GetSkin() ); SubTexture * tSubTexture = NULL; if ( PadLeft ) { - tSubTexture = tComplex->GetSubTextureSide( cUISkinState::StateNormal, cUISkinComplex::Left ); + tSubTexture = tComplex->GetSubTextureSide( UISkinState::StateNormal, UISkinComplex::Left ); if ( NULL != tSubTexture ) tPadding.Left = tSubTexture->RealSize().Width(); } if ( PadRight ) { - tSubTexture = tComplex->GetSubTextureSide( cUISkinState::StateNormal, cUISkinComplex::Right ); + tSubTexture = tComplex->GetSubTextureSide( UISkinState::StateNormal, UISkinComplex::Right ); if ( NULL != tSubTexture ) tPadding.Right = tSubTexture->RealSize().Width(); } if ( PadTop ) { - tSubTexture = tComplex->GetSubTextureSide( cUISkinState::StateNormal, cUISkinComplex::Up ); + tSubTexture = tComplex->GetSubTextureSide( UISkinState::StateNormal, UISkinComplex::Up ); if ( NULL != tSubTexture ) tPadding.Top = tSubTexture->RealSize().Height(); } if ( PadBottom ) { - tSubTexture = tComplex->GetSubTextureSide( cUISkinState::StateNormal, cUISkinComplex::Down ); + tSubTexture = tComplex->GetSubTextureSide( UISkinState::StateNormal, UISkinComplex::Down ); if ( NULL != tSubTexture ) tPadding.Bottom = tSubTexture->RealSize().Height(); @@ -1105,13 +1105,13 @@ Recti cUIControl::MakePadding( bool PadLeft, bool PadRight, bool PadTop, bool Pa return tPadding; } -void cUIControl::SetFocus() { - cUIManager::instance()->FocusControl( this ); +void UIControl::SetFocus() { + UIManager::instance()->FocusControl( this ); } -void cUIControl::SendParentSizeChange( const Vector2i& SizeChange ) { +void UIControl::SendParentSizeChange( const Vector2i& SizeChange ) { if ( mFlags & UI_REPORT_SIZE_CHANGE_TO_CHILDS ) { - cUIControl * ChildLoop = mChild; + UIControl * ChildLoop = mChild; while( NULL != ChildLoop ) { ChildLoop->OnParentSizeChange( SizeChange ); @@ -1120,11 +1120,11 @@ void cUIControl::SendParentSizeChange( const Vector2i& SizeChange ) { } } -void cUIControl::OnParentSizeChange( const Vector2i& SizeChange ) { - SendCommonEvent( cUIEvent::EventOnParentSizeChange ); +void UIControl::OnParentSizeChange( const Vector2i& SizeChange ) { + SendCommonEvent( UIEvent::EventOnParentSizeChange ); } -Sizei cUIControl::GetSkinSize( cUISkin * Skin, const Uint32& State ) { +Sizei UIControl::GetSkinSize( UISkin * Skin, const Uint32& State ) { Sizei tSize; if ( NULL != Skin ) { @@ -1134,28 +1134,28 @@ Sizei cUIControl::GetSkinSize( cUISkin * Skin, const Uint32& State ) { tSize = tSubTexture->RealSize(); } - if ( Skin->GetType() == cUISkin::UISkinComplex ) { - cUISkinComplex * SkinC = reinterpret_cast ( Skin ); + if ( Skin->GetType() == UISkin::SkinComplex ) { + UISkinComplex * SkinC = reinterpret_cast ( Skin ); - tSubTexture = SkinC->GetSubTextureSide( State, cUISkinComplex::Up ); + tSubTexture = SkinC->GetSubTextureSide( State, UISkinComplex::Up ); if ( NULL != tSubTexture ) { tSize.y += tSubTexture->RealSize().Height(); } - tSubTexture = SkinC->GetSubTextureSide( State, cUISkinComplex::Down ); + tSubTexture = SkinC->GetSubTextureSide( State, UISkinComplex::Down ); if ( NULL != tSubTexture ) { tSize.y += tSubTexture->RealSize().Height(); } - tSubTexture = SkinC->GetSubTextureSide( State, cUISkinComplex::Left ); + tSubTexture = SkinC->GetSubTextureSide( State, UISkinComplex::Left ); if ( NULL != tSubTexture ) { tSize.x += tSubTexture->RealSize().Width(); } - tSubTexture = SkinC->GetSubTextureSide( State, cUISkinComplex::Right ); + tSubTexture = SkinC->GetSubTextureSide( State, UISkinComplex::Right ); if ( NULL != tSubTexture ) { tSize.x += tSubTexture->RealSize().Width(); @@ -1166,13 +1166,13 @@ Sizei cUIControl::GetSkinSize( cUISkin * Skin, const Uint32& State ) { return tSize; } -Sizei cUIControl::GetSkinSize() { - return GetSkinSize( GetSkin(), cUISkinState::StateNormal ); +Sizei UIControl::GetSkinSize() { + return GetSkinSize( GetSkin(), UISkinState::StateNormal ); } -cUIControl * cUIControl::NextComplexControl() { - cUIControl * Found = NULL; - cUIControl * ChildLoop = mChild; +UIControl * UIControl::NextComplexControl() { + UIControl * Found = NULL; + UIControl * ChildLoop = mChild; while( NULL != ChildLoop ) { if ( ChildLoop->Visible() && ChildLoop->Enabled() ) { @@ -1212,31 +1212,31 @@ cUIControl * cUIControl::NextComplexControl() { } } - return cUIManager::instance()->MainControl(); + return UIManager::instance()->MainControl(); } -void cUIControl::DoAfterSetTheme() { +void UIControl::DoAfterSetTheme() { } -void cUIControl::WorldToControl( Vector2i& pos ) const { +void UIControl::WorldToControl( Vector2i& pos ) const { Vector2f Pos( pos.x, pos.y ); - std::list parents; + std::list parents; - cUIControl * ParentLoop = mParentCtrl; + UIControl * ParentLoop = mParentCtrl; while ( NULL != ParentLoop ) { parents.push_front( ParentLoop ); ParentLoop = ParentLoop->Parent(); } - parents.push_back( const_cast( reinterpret_cast( this ) ) ); + parents.push_back( const_cast( reinterpret_cast( this ) ) ); Vector2f scale(1,1); - for ( std::list::iterator it = parents.begin(); it != parents.end(); it++ ) { - cUIControl * tParent = (*it); - cUIControlAnim * tP = tParent->IsAnimated() ? reinterpret_cast ( tParent ) : NULL; + for ( std::list::iterator it = parents.begin(); it != parents.end(); it++ ) { + UIControl * tParent = (*it); + UIControlAnim * tP = tParent->IsAnimated() ? reinterpret_cast ( tParent ) : NULL; Vector2f pPos ( tParent->mPos.x * scale.x , tParent->mPos.y * scale.y ); Vector2f Center ( tParent->mSize.x * 0.5f * scale.x , tParent->mSize.y * 0.5f * scale.y ); @@ -1257,23 +1257,23 @@ void cUIControl::WorldToControl( Vector2i& pos ) const { pos = Vector2i( Pos.x / scale.x, Pos.y / scale.y ); } -void cUIControl::ControlToWorld( Vector2i& pos ) const { +void UIControl::ControlToWorld( Vector2i& pos ) const { Vector2f Pos( pos.x, pos.y ); - std::list parents; + std::list parents; - cUIControl * ParentLoop = mParentCtrl; + UIControl * ParentLoop = mParentCtrl; while ( NULL != ParentLoop ) { parents.push_back( ParentLoop ); ParentLoop = ParentLoop->Parent(); } - parents.push_front( const_cast( reinterpret_cast( this ) ) ); + parents.push_front( const_cast( reinterpret_cast( this ) ) ); - for ( std::list::iterator it = parents.begin(); it != parents.end(); it++ ) { - cUIControl * tParent = (*it); - cUIControlAnim * tP = tParent->IsAnimated() ? reinterpret_cast ( tParent ) : NULL; + for ( std::list::iterator it = parents.begin(); it != parents.end(); it++ ) { + UIControl * tParent = (*it); + UIControlAnim * tP = tParent->IsAnimated() ? reinterpret_cast ( tParent ) : NULL; Vector2f pPos ( tParent->mPos.x , tParent->mPos.y ); Vector2f Center ( pPos.x + tParent->mSize.x * 0.5f , pPos.y + tParent->mSize.y * 0.5f ); diff --git a/src/eepp/ui/cuicontrolanim.cpp b/src/eepp/ui/uicontrolanim.cpp similarity index 68% rename from src/eepp/ui/cuicontrolanim.cpp rename to src/eepp/ui/uicontrolanim.cpp index f42a08b3b..0ab2c6344 100644 --- a/src/eepp/ui/cuicontrolanim.cpp +++ b/src/eepp/ui/uicontrolanim.cpp @@ -1,13 +1,13 @@ -#include -#include +#include +#include #include #include #include namespace EE { namespace UI { -cUIControlAnim::cUIControlAnim( const CreateParams& Params ) : - cUIDragable( Params ), +UIControlAnim::UIControlAnim( const CreateParams& Params ) : + UIDragable( Params ), mAngle(0.f), mScale(1.f,1.f), mAlpha(255.f), @@ -19,22 +19,22 @@ cUIControlAnim::cUIControlAnim( const CreateParams& Params ) : mControlFlags |= UI_CTRL_FLAG_ANIM; } -cUIControlAnim::~cUIControlAnim() { +UIControlAnim::~UIControlAnim() { eeSAFE_DELETE( mAlphaAnim ); eeSAFE_DELETE( mAngleAnim ); eeSAFE_DELETE( mScaleAnim ); eeSAFE_DELETE( mMoveAnim ); } -Uint32 cUIControlAnim::Type() const { +Uint32 UIControlAnim::Type() const { return UI_TYPE_CONTROL_ANIM; } -bool cUIControlAnim::IsType( const Uint32& type ) const { - return cUIControlAnim::Type() == type ? true : cUIControl::IsType( type ); +bool UIControlAnim::IsType( const Uint32& type ) const { + return UIControlAnim::Type() == type ? true : UIControl::IsType( type ); } -void cUIControlAnim::Draw() { +void UIControlAnim::Draw() { if ( mVisible && 0.f != mAlpha ) { if ( mFlags & UI_FILL_BACKGROUND ) BackgroundDraw(); @@ -45,62 +45,62 @@ void cUIControlAnim::Draw() { if ( NULL != mSkinState ) mSkinState->Draw( (Float)mScreenPos.x, (Float)mScreenPos.y, (Float)mSize.Width(), (Float)mSize.Height(), (Uint32)mAlpha ); - if ( cUIManager::instance()->HighlightFocus() && cUIManager::instance()->FocusControl() == this ) { + if ( UIManager::instance()->HighlightFocus() && UIManager::instance()->FocusControl() == this ) { Primitives P; P.FillMode( DRAW_LINE ); P.BlendMode( Blend() ); - P.SetColor( cUIManager::instance()->HighlightFocusColor() ); + P.SetColor( UIManager::instance()->HighlightFocusColor() ); P.DrawRectangle( GetRectf() ); } - if ( cUIManager::instance()->HighlightOver() && cUIManager::instance()->OverControl() == this ) { + if ( UIManager::instance()->HighlightOver() && UIManager::instance()->OverControl() == this ) { Primitives P; P.FillMode( DRAW_LINE ); P.BlendMode( Blend() ); - P.SetColor( cUIManager::instance()->HighlightOverColor() ); + P.SetColor( UIManager::instance()->HighlightOverColor() ); P.DrawRectangle( GetRectf() ); } } } -const Float& cUIControlAnim::Angle() const { +const Float& UIControlAnim::Angle() const { return mAngle; } -void cUIControlAnim::Angle( const Float& angle ) { +void UIControlAnim::Angle( const Float& angle ) { mAngle = angle; OnAngleChange(); } -const Vector2f& cUIControlAnim::Scale() const { +const Vector2f& UIControlAnim::Scale() const { return mScale; } -void cUIControlAnim::Scale( const Vector2f& scale ) { +void UIControlAnim::Scale( const Vector2f& scale ) { mScale = scale; OnScaleChange(); } -void cUIControlAnim::Scale( const Float& scale ) { +void UIControlAnim::Scale( const Float& scale ) { Scale( Vector2f( scale, scale ) ); } -const Float& cUIControlAnim::Alpha() const { +const Float& UIControlAnim::Alpha() const { return mAlpha; } -void cUIControlAnim::Alpha( const Float& alpha ) { +void UIControlAnim::Alpha( const Float& alpha ) { mAlpha = alpha; OnAlphaChange(); } -void cUIControlAnim::AlphaChilds( const Float &alpha ) { - cUIControlAnim * AnimChild; - cUIControl * CurChild = mChild; +void UIControlAnim::AlphaChilds( const Float &alpha ) { + UIControlAnim * AnimChild; + UIControl * CurChild = mChild; while ( NULL != CurChild ) { if ( CurChild->IsAnimated() ) { - AnimChild = reinterpret_cast ( CurChild ); + AnimChild = reinterpret_cast ( CurChild ); AnimChild->Alpha( alpha ); AnimChild->AlphaChilds( alpha ); @@ -110,7 +110,7 @@ void cUIControlAnim::AlphaChilds( const Float &alpha ) { } } -void cUIControlAnim::MatrixSet() { +void UIControlAnim::MatrixSet() { if ( mScale != 1.f || mAngle != 0.f ) { GlobalBatchRenderer::instance()->Draw(); GLi->PushMatrix(); @@ -122,15 +122,15 @@ void cUIControlAnim::MatrixSet() { } } -void cUIControlAnim::MatrixUnset() { +void UIControlAnim::MatrixUnset() { if ( mScale != 1.f || mAngle != 0.f ) { GlobalBatchRenderer::instance()->Draw(); GLi->PopMatrix(); } } -void cUIControlAnim::Update() { - cUIDragable::Update(); +void UIControlAnim::Update() { + UIDragable::Update(); if ( NULL != mMoveAnim && mMoveAnim->Enabled() ) { mMoveAnim->Update( Elapsed() ); @@ -175,15 +175,15 @@ void cUIControlAnim::Update() { } } -bool cUIControlAnim::FadingOut() { +bool UIControlAnim::FadingOut() { return 0 != ( mControlFlags & UI_CTRL_FLAG_DISABLE_FADE_OUT ); } -bool cUIControlAnim::Animating() { +bool UIControlAnim::Animating() { return ( NULL != mAlphaAnim && mAlphaAnim->Enabled() ) || ( NULL != mAngleAnim && mAngleAnim->Enabled() ) || ( NULL != mScaleAnim && mScaleAnim->Enabled() ) || ( NULL != mMoveAnim && mMoveAnim->Enabled() ); } -void cUIControlAnim::StartAlphaAnim( const Float& From, const Float& To, const Time& TotalTime, const bool& AlphaChilds, const Ease::Interpolation& Type, Interpolation::OnPathEndCallback PathEndCallback ) { +void UIControlAnim::StartAlphaAnim( const Float& From, const Float& To, const Time& TotalTime, const bool& AlphaChilds, const Ease::Interpolation& Type, Interpolation::OnPathEndCallback PathEndCallback ) { if ( NULL == mAlphaAnim ) mAlphaAnim = eeNew( Interpolation, () ); @@ -197,12 +197,12 @@ void cUIControlAnim::StartAlphaAnim( const Float& From, const Float& To, const T Alpha( From ); if ( AlphaChilds ) { - cUIControlAnim * AnimChild; - cUIControl * CurChild = mChild; + UIControlAnim * AnimChild; + UIControl * CurChild = mChild; while ( NULL != CurChild ) { if ( CurChild->IsAnimated() ) { - AnimChild = reinterpret_cast ( CurChild ); + AnimChild = reinterpret_cast ( CurChild ); AnimChild->StartAlphaAnim( From, To, TotalTime, AlphaChilds ); } @@ -212,7 +212,7 @@ void cUIControlAnim::StartAlphaAnim( const Float& From, const Float& To, const T } } -void cUIControlAnim::StartScaleAnim( const Vector2f& From, const Vector2f& To, const Time& TotalTime, const Ease::Interpolation& Type, Interpolation::OnPathEndCallback PathEndCallback ) { +void UIControlAnim::StartScaleAnim( const Vector2f& From, const Vector2f& To, const Time& TotalTime, const Ease::Interpolation& Type, Interpolation::OnPathEndCallback PathEndCallback ) { if ( NULL == mScaleAnim ) mScaleAnim = eeNew( Waypoints, () ); @@ -226,11 +226,11 @@ void cUIControlAnim::StartScaleAnim( const Vector2f& From, const Vector2f& To, c Scale( From ); } -void cUIControlAnim::StartScaleAnim( const Float& From, const Float& To, const Time& TotalTime, const Ease::Interpolation& Type, Interpolation::OnPathEndCallback PathEndCallback ) { +void UIControlAnim::StartScaleAnim( const Float& From, const Float& To, const Time& TotalTime, const Ease::Interpolation& Type, Interpolation::OnPathEndCallback PathEndCallback ) { StartScaleAnim( Vector2f( From, From ), Vector2f( To, To ), TotalTime, Type, PathEndCallback ); } -void cUIControlAnim::StartMovement( const Vector2i& From, const Vector2i& To, const Time& TotalTime, const Ease::Interpolation& Type, Waypoints::OnPathEndCallback PathEndCallback ) { +void UIControlAnim::StartMovement( const Vector2i& From, const Vector2i& To, const Time& TotalTime, const Ease::Interpolation& Type, Waypoints::OnPathEndCallback PathEndCallback ) { if ( NULL == mMoveAnim ) mMoveAnim = eeNew( Waypoints, () ); @@ -244,7 +244,7 @@ void cUIControlAnim::StartMovement( const Vector2i& From, const Vector2i& To, co Pos( From ); } -void cUIControlAnim::StartRotation( const Float& From, const Float& To, const Time& TotalTime, const Ease::Interpolation& Type, Interpolation::OnPathEndCallback PathEndCallback ) { +void UIControlAnim::StartRotation( const Float& From, const Float& To, const Time& TotalTime, const Ease::Interpolation& Type, Interpolation::OnPathEndCallback PathEndCallback ) { if ( NULL == mAngleAnim ) mAngleAnim = eeNew( Interpolation, () ); @@ -258,20 +258,20 @@ void cUIControlAnim::StartRotation( const Float& From, const Float& To, const Ti Angle( From ); } -void cUIControlAnim::CreateFadeIn( const Time& Time, const bool& AlphaChilds, const Ease::Interpolation& Type ) { +void UIControlAnim::CreateFadeIn( const Time& Time, const bool& AlphaChilds, const Ease::Interpolation& Type ) { StartAlphaAnim( mAlpha, 255.f, Time, AlphaChilds, Type ); } -void cUIControlAnim::CreateFadeOut( const Time& Time, const bool& AlphaChilds, const Ease::Interpolation& Type ) { +void UIControlAnim::CreateFadeOut( const Time& Time, const bool& AlphaChilds, const Ease::Interpolation& Type ) { StartAlphaAnim( 255.f, mAlpha, Time, AlphaChilds, Type ); } -void cUIControlAnim::CloseFadeOut( const Time& Time, const bool& AlphaChilds, const Ease::Interpolation& Type ) { +void UIControlAnim::CloseFadeOut( const Time& Time, const bool& AlphaChilds, const Ease::Interpolation& Type ) { StartAlphaAnim ( mAlpha, 0.f, Time, AlphaChilds, Type ); mControlFlags |= UI_CTRL_FLAG_CLOSE_FO; } -void cUIControlAnim::DisableFadeOut( const Time& Time, const bool& AlphaChilds, const Ease::Interpolation& Type ) { +void UIControlAnim::DisableFadeOut( const Time& Time, const bool& AlphaChilds, const Ease::Interpolation& Type ) { Enabled( false ); StartAlphaAnim ( mAlpha, 0.f, Time, AlphaChilds, Type ); @@ -279,7 +279,7 @@ void cUIControlAnim::DisableFadeOut( const Time& Time, const bool& AlphaChilds, mControlFlags |= UI_CTRL_FLAG_DISABLE_FADE_OUT; } -void cUIControlAnim::BackgroundDraw() { +void UIControlAnim::BackgroundDraw() { Primitives P; Rectf R = GetRectf(); P.BlendMode( mBackground->Blend() ); @@ -300,7 +300,7 @@ void cUIControlAnim::BackgroundDraw() { } } -void cUIControlAnim::BorderDraw() { +void UIControlAnim::BorderDraw() { Primitives P; P.FillMode( DRAW_LINE ); P.BlendMode( Blend() ); @@ -325,22 +325,22 @@ void cUIControlAnim::BorderDraw() { } } -ColorA cUIControlAnim::GetColor( const ColorA& Col ) { +ColorA UIControlAnim::GetColor( const ColorA& Col ) { return ColorA( Col.R(), Col.G(), Col.B(), static_cast( (Float)Col.A() * ( mAlpha / 255.f ) ) ); } -void cUIControlAnim::UpdateQuad() { +void UIControlAnim::UpdateQuad() { mPoly = Polygon2f( eeAABB( (Float)mScreenPos.x, (Float)mScreenPos.y, (Float)mScreenPos.x + mSize.Width(), (Float)mScreenPos.y + mSize.Height() ) ); mCenter = Vector2f( (Float)mScreenPos.x + (Float)mSize.Width() * 0.5f, (Float)mScreenPos.y + (Float)mSize.Height() * 0.5f ); mPoly.Rotate( mAngle, mCenter ); mPoly.Scale( mScale, mCenter ); - cUIControl * tParent = Parent(); + UIControl * tParent = Parent(); while ( tParent ) { if ( tParent->IsAnimated() ) { - cUIControlAnim * tP = reinterpret_cast ( tParent ); + UIControlAnim * tP = reinterpret_cast ( tParent ); mPoly.Rotate( tP->Angle(), tP->GetPolygonCenter() ); mPoly.Scale( tP->Scale(), tP->GetPolygonCenter() ); @@ -350,44 +350,44 @@ void cUIControlAnim::UpdateQuad() { }; } -Interpolation * cUIControlAnim::RotationInterpolation() { +Interpolation * UIControlAnim::RotationInterpolation() { if ( NULL == mAngleAnim ) mAngleAnim = eeNew( Interpolation, () ); return mAngleAnim; } -Waypoints * cUIControlAnim::ScaleInterpolation() { +Waypoints * UIControlAnim::ScaleInterpolation() { if ( NULL == mScaleAnim ) mScaleAnim = eeNew( Waypoints, () ); return mScaleAnim; } -Interpolation * cUIControlAnim::AlphaInterpolation() { +Interpolation * UIControlAnim::AlphaInterpolation() { if ( NULL == mAlphaAnim ) mAlphaAnim = eeNew( Interpolation, () ); return mAlphaAnim; } -Waypoints * cUIControlAnim::MovementInterpolation() { +Waypoints * UIControlAnim::MovementInterpolation() { if ( NULL == mMoveAnim ) mMoveAnim = eeNew( Waypoints, () ); return mMoveAnim; } -void cUIControlAnim::OnAngleChange() { - SendCommonEvent( cUIEvent::EventOnAngleChange ); +void UIControlAnim::OnAngleChange() { + SendCommonEvent( UIEvent::EventOnAngleChange ); } -void cUIControlAnim::OnScaleChange() { - SendCommonEvent( cUIEvent::EventOnScaleChange ); +void UIControlAnim::OnScaleChange() { + SendCommonEvent( UIEvent::EventOnScaleChange ); } -void cUIControlAnim::OnAlphaChange() { - SendCommonEvent( cUIEvent::EventOnAlphaChange ); +void UIControlAnim::OnAlphaChange() { + SendCommonEvent( UIEvent::EventOnAlphaChange ); } }} diff --git a/src/eepp/ui/cuidefaulttheme.cpp b/src/eepp/ui/uidefaulttheme.cpp similarity index 58% rename from src/eepp/ui/cuidefaulttheme.cpp rename to src/eepp/ui/uidefaulttheme.cpp index a881da699..7cf2c963d 100644 --- a/src/eepp/ui/cuidefaulttheme.cpp +++ b/src/eepp/ui/uidefaulttheme.cpp @@ -1,16 +1,16 @@ -#include -#include -#include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include +#include +#include +#include namespace EE { namespace UI { -cUIDefaultTheme::cUIDefaultTheme( const std::string& Name, const std::string& Abbr, Graphics::Font * DefaultFont ) : - cUITheme( Name, Abbr, DefaultFont ) +UIDefaultTheme::UIDefaultTheme( const std::string& Name, const std::string& Abbr, Graphics::Font * DefaultFont ) : + UITheme( Name, Abbr, DefaultFont ) { FontColor( ColorA( 230, 230, 230, 255 ) ); FontOverColor( ColorA( 255, 255, 255, 255 ) ); @@ -18,8 +18,8 @@ cUIDefaultTheme::cUIDefaultTheme( const std::string& Name, const std::string& Ab FontShadowColor( ColorA( 50, 50, 50, 150 ) ); } -cUIPopUpMenu * cUIDefaultTheme::CreatePopUpMenu( cUIControl * Parent, const Sizei& Size, const Vector2i& Pos, const Uint32& Flags, Uint32 RowHeight, Recti PaddingContainer, Uint32 MinWidth, Uint32 MinSpaceForIcons, Uint32 MinRightMargin ) { - cUIPopUpMenu::CreateParams MenuParams; +UIPopUpMenu * UIDefaultTheme::CreatePopUpMenu( UIControl * Parent, const Sizei& Size, const Vector2i& Pos, const Uint32& Flags, Uint32 RowHeight, Recti PaddingContainer, Uint32 MinWidth, Uint32 MinSpaceForIcons, Uint32 MinRightMargin ) { + UIPopUpMenu::CreateParams MenuParams; MenuParams.Parent( Parent ); MenuParams.PosSet( Pos ); MenuParams.SizeSet( Size ); @@ -37,11 +37,11 @@ cUIPopUpMenu * cUIDefaultTheme::CreatePopUpMenu( cUIControl * Parent, const Size MenuParams.FontColor = ColorA( 230, 230, 230, 255 ); } - return eeNew( cUIPopUpMenu, ( MenuParams ) ); + return eeNew( UIPopUpMenu, ( MenuParams ) ); } -cUIProgressBar * cUIDefaultTheme::CreateProgressBar( cUIControl * Parent, const Sizei& Size, const Vector2i& Pos, const Uint32& Flags, bool DisplayPercent, bool VerticalExpand, Vector2f MovementSpeed, Rectf FillerMargin ) { - cUIProgressBar::CreateParams PBParams; +UIProgressBar * UIDefaultTheme::CreateProgressBar( UIControl * Parent, const Sizei& Size, const Vector2i& Pos, const Uint32& Flags, bool DisplayPercent, bool VerticalExpand, Vector2f MovementSpeed, Rectf FillerMargin ) { + UIProgressBar::CreateParams PBParams; PBParams.Parent( Parent ); PBParams.PosSet( Pos ); PBParams.SizeSet( Size ); @@ -59,14 +59,14 @@ cUIProgressBar * cUIDefaultTheme::CreateProgressBar( cUIControl * Parent, const PBParams.MovementSpeed = Vector2f( 32, 0 ); } - cUIProgressBar * Ctrl = eeNew( cUIProgressBar, ( PBParams ) ); + UIProgressBar * Ctrl = eeNew( UIProgressBar, ( PBParams ) ); Ctrl->Visible( true ); Ctrl->Enabled( true ); return Ctrl; } -cUIWinMenu * cUIDefaultTheme::CreateWinMenu( cUIControl * Parent, const Sizei& Size, const Vector2i& Pos, const Uint32& Flags, Uint32 MarginBetweenButtons, Uint32 ButtonMargin, Uint32 MenuHeight, Uint32 FirstButtonMargin ) { - cUIWinMenu::CreateParams WinMenuParams; +UIWinMenu * UIDefaultTheme::CreateWinMenu( UIControl * Parent, const Sizei& Size, const Vector2i& Pos, const Uint32& Flags, Uint32 MarginBetweenButtons, Uint32 ButtonMargin, Uint32 MenuHeight, Uint32 FirstButtonMargin ) { + UIWinMenu::CreateParams WinMenuParams; WinMenuParams.Parent( Parent ); WinMenuParams.PosSet( Pos ); WinMenuParams.SizeSet( Size ); @@ -80,14 +80,14 @@ cUIWinMenu * cUIDefaultTheme::CreateWinMenu( cUIControl * Parent, const Sizei& S WinMenuParams.ButtonMargin = 12; } - cUIWinMenu * Ctrl = eeNew( cUIWinMenu, ( WinMenuParams ) ); + UIWinMenu * Ctrl = eeNew( UIWinMenu, ( WinMenuParams ) ); Ctrl->Visible( true ); Ctrl->Enabled( true ); return Ctrl; } -cUIWindow * cUIDefaultTheme::CreateWindow( cUIControl * Parent, const Sizei& Size, const Vector2i& Pos, const Uint32& Flags, Uint32 WinFlags, Sizei MinWindowSize, Uint8 BaseAlpha ) { - cUIWindow::CreateParams WinParams; +UIWindow * UIDefaultTheme::CreateWindow( UIControl * Parent, const Sizei& Size, const Vector2i& Pos, const Uint32& Flags, Uint32 WinFlags, Sizei MinWindowSize, Uint8 BaseAlpha ) { + UIWindow::CreateParams WinParams; WinParams.Parent( Parent ); WinParams.PosSet( Pos ); WinParams.SizeSet( Size ); @@ -103,11 +103,11 @@ cUIWindow * cUIDefaultTheme::CreateWindow( cUIControl * Parent, const Sizei& Siz WinParams.TitleFontColor = ColorA( 230, 230, 230, 255 ); } - return eeNew( cUIWindow, ( WinParams ) ); + return eeNew( UIWindow, ( WinParams ) ); } -cUICommonDialog * cUIDefaultTheme::CreateCommonDialog( cUIControl * Parent, const Sizei& Size, const Vector2i& Pos, const Uint32& Flags, Uint32 WinFlags, Sizei MinWindowSize, Uint8 BaseAlpha, Uint32 CDLFlags, std::string DefaultFilePattern, std::string DefaultDirectory ) { - cUICommonDialog::CreateParams DLGParams; +UICommonDialog * UIDefaultTheme::CreateCommonDialog( UIControl * Parent, const Sizei& Size, const Vector2i& Pos, const Uint32& Flags, Uint32 WinFlags, Sizei MinWindowSize, Uint8 BaseAlpha, Uint32 CDLFlags, std::string DefaultFilePattern, std::string DefaultDirectory ) { + UICommonDialog::CreateParams DLGParams; DLGParams.Parent( Parent ); DLGParams.PosSet( Pos ); DLGParams.SizeSet( Size ); @@ -126,11 +126,11 @@ cUICommonDialog * cUIDefaultTheme::CreateCommonDialog( cUIControl * Parent, cons DLGParams.TitleFontColor = ColorA( 230, 230, 230, 255 ); } - return eeNew( cUICommonDialog, ( DLGParams ) ); + return eeNew( UICommonDialog, ( DLGParams ) ); } -cUIMessageBox * cUIDefaultTheme::CreateMessageBox( UI_MSGBOX_TYPE Type, const String& Message, Uint32 WinFlags, cUIControl * Parent, const Sizei& Size, const Vector2i& Pos, const Uint32& Flags, Sizei MinWindowSize, Uint8 BaseAlpha ) { - cUIMessageBox::CreateParams MsgBoxParams; +UIMessageBox * UIDefaultTheme::CreateMessageBox( UI_MSGBOX_TYPE Type, const String& Message, Uint32 WinFlags, UIControl * Parent, const Sizei& Size, const Vector2i& Pos, const Uint32& Flags, Sizei MinWindowSize, Uint8 BaseAlpha ) { + UIMessageBox::CreateParams MsgBoxParams; MsgBoxParams.Parent( Parent ); MsgBoxParams.PosSet( Pos ); MsgBoxParams.SizeSet( Size ); @@ -148,11 +148,11 @@ cUIMessageBox * cUIDefaultTheme::CreateMessageBox( UI_MSGBOX_TYPE Type, const St MsgBoxParams.TitleFontColor = ColorA( 230, 230, 230, 255 ); } - return eeNew( cUIMessageBox, ( MsgBoxParams ) ); + return eeNew( UIMessageBox, ( MsgBoxParams ) ); } -cUIComboBox * cUIDefaultTheme::CreateComboBox( cUIControl * Parent, const Sizei& Size, const Vector2i& Pos, const Uint32& Flags, Uint32 MinNumVisibleItems, bool PopUpToMainControl, cUIListBox * ListBox ) { - cUIComboBox::CreateParams ComboParams; +UIComboBox * UIDefaultTheme::CreateComboBox( UIControl * Parent, const Sizei& Size, const Vector2i& Pos, const Uint32& Flags, Uint32 MinNumVisibleItems, bool PopUpToMainControl, UIListBox * ListBox ) { + UIComboBox::CreateParams ComboParams; ComboParams.Parent( Parent ); ComboParams.PosSet( Pos ); ComboParams.SizeSet( Size ); @@ -165,14 +165,14 @@ cUIComboBox * cUIDefaultTheme::CreateComboBox( cUIControl * Parent, const Sizei& ComboParams.Flags |= UI_AUTO_SIZE | UI_TEXT_SELECTION_ENABLED; } - cUIComboBox * Ctrl = eeNew( cUIComboBox, ( ComboParams ) ); + UIComboBox * Ctrl = eeNew( UIComboBox, ( ComboParams ) ); Ctrl->Visible( true ); Ctrl->Enabled( true ); return Ctrl; } -cUIDropDownList * cUIDefaultTheme::CreateDropDownList( cUIControl * Parent, const Sizei& Size, const Vector2i& Pos, const Uint32& Flags, Uint32 MinNumVisibleItems, bool PopUpToMainControl, cUIListBox * ListBox ) { - cUIDropDownList::CreateParams DDLParams; +UIDropDownList * UIDefaultTheme::CreateDropDownList( UIControl * Parent, const Sizei& Size, const Vector2i& Pos, const Uint32& Flags, Uint32 MinNumVisibleItems, bool PopUpToMainControl, UIListBox * ListBox ) { + UIDropDownList::CreateParams DDLParams; DDLParams.Parent( Parent ); DDLParams.PosSet( Pos ); DDLParams.SizeSet( Size ); @@ -185,14 +185,14 @@ cUIDropDownList * cUIDefaultTheme::CreateDropDownList( cUIControl * Parent, cons DDLParams.Flags |= UI_AUTO_SIZE; } - cUIDropDownList * Ctrl = eeNew( cUIDropDownList, ( DDLParams ) ); + UIDropDownList * Ctrl = eeNew( UIDropDownList, ( DDLParams ) ); Ctrl->Visible( true ); Ctrl->Enabled( true ); return Ctrl; } -cUITabWidget * cUIDefaultTheme::CreateTabWidget( cUIControl *Parent, const Sizei &Size, const Vector2i &Pos, const Uint32 &Flags, const bool &TabsClosable, const bool &SpecialBorderTabs, const Int32 &TabSeparation, const Uint32 &MaxTextLength, const Uint32 &TabWidgetHeight, const Uint32 &TabTextAlign, const Uint32 &MinTabWidth, const Uint32 &MaxTabWidth ) { - cUITabWidget::CreateParams TabWidgetParams; +UITabWidget * UIDefaultTheme::CreateTabWidget( UIControl *Parent, const Sizei &Size, const Vector2i &Pos, const Uint32 &Flags, const bool &TabsClosable, const bool &SpecialBorderTabs, const Int32 &TabSeparation, const Uint32 &MaxTextLength, const Uint32 &TabWidgetHeight, const Uint32 &TabTextAlign, const Uint32 &MinTabWidth, const Uint32 &MaxTabWidth ) { + UITabWidget::CreateParams TabWidgetParams; TabWidgetParams.Parent( Parent ); TabWidgetParams.PosSet( Pos ); TabWidgetParams.SizeSet( Size ); @@ -214,14 +214,14 @@ cUITabWidget * cUIDefaultTheme::CreateTabWidget( cUIControl *Parent, const Sizei TabWidgetParams.LineBewowTabsYOffset = -1; } - cUITabWidget * Ctrl = eeNew( cUITabWidget, ( TabWidgetParams ) ); + UITabWidget * Ctrl = eeNew( UITabWidget, ( TabWidgetParams ) ); Ctrl->Visible( true ); Ctrl->Enabled( true ); return Ctrl; } -cUITooltip * cUIDefaultTheme::CreateTooltip( cUIControl * TooltipOf, cUIControl * Parent, const Sizei& Size, const Vector2i& Pos, const Uint32& Flags ) { - cUITooltip::CreateParams TooltipParams; +UITooltip * UIDefaultTheme::CreateTooltip( UIControl * TooltipOf, UIControl * Parent, const Sizei& Size, const Vector2i& Pos, const Uint32& Flags ) { + UITooltip::CreateParams TooltipParams; TooltipParams.Parent( Parent ); TooltipParams.PosSet( Pos ); TooltipParams.SizeSet( Size ); @@ -233,7 +233,7 @@ cUITooltip * cUIDefaultTheme::CreateTooltip( cUIControl * TooltipOf, cUIControl TooltipParams.Padding = Recti( 4, 6, 4, 6 ); } - cUITooltip * Ctrl = eeNew( cUITooltip, ( TooltipParams, TooltipOf ) ); + UITooltip * Ctrl = eeNew( UITooltip, ( TooltipParams, TooltipOf ) ); Ctrl->Visible( true ); Ctrl->Enabled( true ); return Ctrl; diff --git a/src/eepp/ui/uidragable.cpp b/src/eepp/ui/uidragable.cpp new file mode 100644 index 000000000..0dcfd8c75 --- /dev/null +++ b/src/eepp/ui/uidragable.cpp @@ -0,0 +1,129 @@ +#include +#include +#include + +namespace EE { namespace UI { + +UIDragable::UIDragable( const UIControl::CreateParams& Params ) : + UIControl( Params ), + mDragButton( EE_BUTTON_LMASK ) +{ + mControlFlags |= UI_CTRL_FLAG_DRAGABLE; +} + +UIDragable::~UIDragable() { +} + +Uint32 UIDragable::Type() const { + return UI_TYPE_CONTROL_DRAGABLE; +} + +bool UIDragable::IsType( const Uint32& type ) const { + return UIDragable::Type() == type ? true : UIControl::IsType( type ); +} + +Uint32 UIDragable::OnMouseDown( const Vector2i& Pos, const Uint32 Flags ) { + if ( !( UIManager::instance()->LastPressTrigger() & mDragButton ) && ( Flags & mDragButton ) && DragEnable() && !Dragging() ) { + Dragging( true ); + mDragPoint = Pos; + } + + UIControl::OnMouseDown( Pos, Flags ); + return 1; +} + +Uint32 UIDragable::OnMouseUp( const Vector2i& Pos, const Uint32 Flags ) { + if ( DragEnable() && Dragging() && ( Flags & mDragButton ) ) { + Dragging( false ); + } + + UIControl::OnMouseUp( Pos, Flags ); + return 1; +} + +const Vector2i& UIDragable::DragPoint() const { + return mDragPoint; +} + +void UIDragable::DragPoint( const Vector2i& Point ) { + mDragPoint = Point; +} + +void UIDragable::Update() { + UIControl::Update(); + + if ( !DragEnable() ) + return; + + if ( Dragging() ) { + if ( !( UIManager::instance()->PressTrigger() & mDragButton ) ) { + Dragging( false ); + UIManager::instance()->SetControlDragging( false ); + return; + } + + Vector2i Pos( UIManager::instance()->GetMousePos() ); + + if ( mDragPoint != Pos ) { + if ( OnDrag( Pos ) ) { + mPos += -( mDragPoint - Pos ); + + mDragPoint = Pos; + + OnPosChange(); + + UIManager::instance()->SetControlDragging( true ); + } + } + } +} + +Uint32 UIDragable::OnDrag( const Vector2i& Pos ) { + return 1; +} + +Uint32 UIDragable::OnDragStart( const Vector2i& Pos ) { + return 1; +} + +Uint32 UIDragable::OnDragEnd( const Vector2i& Pos ) { + return 1; +} + +bool UIDragable::DragEnable() const { + return 0 != ( mFlags & UI_DRAG_ENABLE ); +} + +void UIDragable::DragEnable( const bool& enable ) { + WriteFlag( UI_DRAG_ENABLE, true == enable ); +} + +bool UIDragable::Dragging() const { + return 0 != ( mControlFlags & UI_CTRL_FLAG_DRAGGING ); +} + +void UIDragable::Dragging( const bool& dragging ) { + WriteCtrlFlag( UI_CTRL_FLAG_DRAGGING, true == dragging ); + + if ( dragging ) { + UIMessage tMsg( this, UIMessage::MsgDragStart, 0 ); + MessagePost( &tMsg ); + + OnDragStart( UIManager::instance()->GetMousePos() ); + } else { + UIMessage tMsg( this, UIMessage::MsgDragEnd, 0 ); + MessagePost( &tMsg ); + + OnDragEnd( UIManager::instance()->GetMousePos() ); + } +} + +void UIDragable::DragButton( const Uint32& Button ) { + mDragButton = Button; +} + +const Uint32& UIDragable::DragButton() const { + return mDragButton; +} + +}} diff --git a/src/eepp/ui/uidropdownlist.cpp b/src/eepp/ui/uidropdownlist.cpp new file mode 100644 index 000000000..1d6f8db05 --- /dev/null +++ b/src/eepp/ui/uidropdownlist.cpp @@ -0,0 +1,233 @@ +#include +#include + +namespace EE { namespace UI { + +UIDropDownList::UIDropDownList( UIDropDownList::CreateParams& Params ) : + UITextInput( Params ), + mListBox( Params.ListBox ), + mMinNumVisibleItems( Params.MinNumVisibleItems ), + mPopUpToMainControl( Params.PopUpToMainControl ) +{ + AllowEditing( false ); + + ApplyDefaultTheme(); + + if ( NULL == mListBox ) { + Uint32 flags = UI_CLIP_ENABLE | UI_AUTO_PADDING; + + if ( Params.Flags & UI_TOUCH_DRAG_ENABLED ) + flags |= UI_TOUCH_DRAG_ENABLED; + + if ( Params.Flags & UI_TEXT_SELECTION_ENABLED ) + flags |= UI_TEXT_SELECTION_ENABLED; + + UITheme * Theme = UIThemeManager::instance()->DefaultTheme(); + + if ( NULL != Theme ) { + mListBox = Theme->CreateListBox( NULL, Sizei( mSize.Width(), mMinNumVisibleItems * mSize.Height() ),Vector2i(), flags ); + } else { + UIListBox::CreateParams LBParams; + LBParams.Size = Sizei( mSize.Width(), mMinNumVisibleItems * mSize.Height() ); + LBParams.Flags = flags; + LBParams.FontSelectedColor = ColorA( 255, 255, 255, 255 ); + mListBox = eeNew( UIListBox, ( LBParams ) ); + } + } + + mListBox->Enabled( false ); + mListBox->Visible( false ); + + mListBox->AddEventListener( UIEvent::EventOnComplexControlFocusLoss, cb::Make1( this, &UIDropDownList::OnListBoxFocusLoss ) ); + mListBox->AddEventListener( UIEvent::EventOnItemSelected , cb::Make1( this, &UIDropDownList::OnItemSelected ) ); + mListBox->AddEventListener( UIEvent::EventOnItemClicked, cb::Make1( this, &UIDropDownList::OnItemClicked ) ); + mListBox->AddEventListener( UIEvent::EventOnItemKeyDown, cb::Make1( this, &UIDropDownList::OnItemKeyDown ) ); + mListBox->AddEventListener( UIEvent::EventKeyDown , cb::Make1( this, &UIDropDownList::OnItemKeyDown ) ); + mListBox->AddEventListener( UIEvent::EventOnControlClear, cb::Make1( this, &UIDropDownList::OnControlClear ) ); +} + +UIDropDownList::~UIDropDownList() { + DestroyListBox(); +} + +Uint32 UIDropDownList::Type() const { + return UI_TYPE_DROPDOWNLIST; +} + +bool UIDropDownList::IsType( const Uint32& type ) const { + return UIDropDownList::Type() == type ? true : UITextInput::IsType( type ); +} + +void UIDropDownList::SetTheme( UITheme * Theme ) { + UIControl::SetThemeControl( Theme, "dropdownlist" ); + + AutoSizeControl(); + + AutoPadding(); + + OnSizeChange(); +} + +void UIDropDownList::OnSizeChange() { + UIComplexControl::OnSizeChange(); +} + +void UIDropDownList::AutoSizeControl() { + if ( mFlags & UI_AUTO_SIZE ) { + Size( mSize.x, GetSkinSize().Height() ); + } +} + +void UIDropDownList::AutoSize() { +} + +UIListBox * UIDropDownList::ListBox() const { + return mListBox; +} + +Uint32 UIDropDownList::OnMouseClick( const Vector2i& Pos, const Uint32 Flags ) { + if ( Flags & EE_BUTTON_LMASK ) + ShowListBox(); + + return 1; +} + +void UIDropDownList::ShowListBox() { + if ( !mListBox->Visible() ) { + if ( !mPopUpToMainControl ) + mListBox->Parent( Parent() ); + else + mListBox->Parent( UIManager::instance()->MainControl() ); + + mListBox->ToFront(); + + Vector2i Pos( mPos.x, mPos.y + mSize.Height() ); + + if ( mPopUpToMainControl ) { + Parent()->ControlToWorld( Pos ); + } + + mListBox->Pos( Pos ); + + if ( mListBox->Count() ) { + Recti tPadding = mListBox->PaddingContainer(); + + Float sliderValue = mListBox->VerticalScrollBar()->Value(); + + if ( mMinNumVisibleItems < mListBox->Count() ) + mListBox->Size( mSize.Width(), (Int32)( mMinNumVisibleItems * mListBox->RowHeight() ) + tPadding.Top + tPadding.Bottom ); + else { + mListBox->Size( mSize.Width(), (Int32)( mListBox->Count() * mListBox->RowHeight() ) + tPadding.Top + tPadding.Bottom ); + } + + mListBox->UpdateQuad(); + + Rectf aabb( mListBox->GetPolygon().ToAABB() ); + Recti aabbi( aabb.Left, aabb.Top, aabb.Right, aabb.Bottom ); + + if ( !UIManager::instance()->MainControl()->GetScreenRect().Contains( aabbi ) ) { + Pos = Vector2i( mPos.x, mPos.y ); + + if ( mPopUpToMainControl ) { + Parent()->ControlToWorld( Pos ); + } + + Pos.y -= mListBox->Size().Height(); + + mListBox->Pos( Pos ); + } + + mListBox->VerticalScrollBar()->Value( sliderValue ); + + Show(); + + mListBox->SetFocus(); + } + } else { + Hide(); + } +} + +void UIDropDownList::OnControlClear( const UIEvent * Event ) { + Text( "" ); +} + +void UIDropDownList::OnItemKeyDown( const UIEvent * Event ) { + const UIEventKey * KEvent = reinterpret_cast ( Event ); + + if ( KEvent->KeyCode() == KEY_RETURN ) + OnItemClicked( Event ); +} + +void UIDropDownList::OnListBoxFocusLoss( const UIEvent * Event ) { + if ( UIManager::instance()->FocusControl() != this && !IsChild( UIManager::instance()->FocusControl() ) ) { + Hide(); + } +} + +void UIDropDownList::OnItemClicked( const UIEvent * Event ) { + Hide(); + SetFocus(); +} + +void UIDropDownList::OnItemSelected( const UIEvent * Event ) { + Text( mListBox->GetItemSelectedText() ); + + UIMessage Msg( this, UIMessage::MsgSelected, mListBox->GetItemSelectedIndex() ); + MessagePost( &Msg ); + + SendCommonEvent( UIEvent::EventOnItemSelected ); +} + +void UIDropDownList::Show() { + mListBox->Enabled( true ); + mListBox->Visible( true ); + + if ( UIThemeManager::instance()->DefaultEffectsEnabled() ) { + if ( 255.f == mListBox->Alpha() ) + mListBox->StartAlphaAnim( 0.f, 255.f, UIThemeManager::instance()->ControlsFadeInTime() ); + else + mListBox->CreateFadeIn( UIThemeManager::instance()->ControlsFadeInTime() ); + } +} + +void UIDropDownList::Hide() { + if ( UIThemeManager::instance()->DefaultEffectsEnabled() ) { + mListBox->DisableFadeOut( UIThemeManager::instance()->ControlsFadeOutTime() ); + } else { + mListBox->Enabled( false ); + mListBox->Visible( false ); + } +} + +void UIDropDownList::Update() { + if ( mEnabled && mVisible ) { + if ( IsMouseOver() ) { + Uint32 Flags = UIManager::instance()->GetInput()->ClickTrigger(); + + if ( Flags & EE_BUTTONS_WUWD ) { + if ( Flags & EE_BUTTON_WUMASK ) { + mListBox->SelectPrev(); + } else if ( Flags & EE_BUTTON_WDMASK ) { + mListBox->SelectNext(); + } + } + } + } + + UITextInput::Update(); +} + +Uint32 UIDropDownList::OnKeyDown( const UIEventKey &Event ) { + mListBox->OnKeyDown( Event ); + + return UITextInput::OnKeyDown( Event ); +} + +void UIDropDownList::DestroyListBox() { + if ( !UIManager::instance()->IsShootingDown() ) { + mListBox->Close(); + } +} + +}} diff --git a/src/eepp/ui/uievent.cpp b/src/eepp/ui/uievent.cpp new file mode 100644 index 000000000..4925bbac7 --- /dev/null +++ b/src/eepp/ui/uievent.cpp @@ -0,0 +1,24 @@ +#include +#include + +namespace EE { namespace UI { + +UIEvent::UIEvent( UIControl * Ctrl, const Uint32& EventType ) : + mCtrl( Ctrl ), + mEventType( EventType ) +{ +} + +UIEvent::~UIEvent() +{ +} + +UIControl * UIEvent::Ctrl() const { + return mCtrl; +} + +const Uint32& UIEvent::EventType() const { + return mEventType; +} + +}} diff --git a/src/eepp/ui/uieventkey.cpp b/src/eepp/ui/uieventkey.cpp new file mode 100644 index 000000000..90d175dbc --- /dev/null +++ b/src/eepp/ui/uieventkey.cpp @@ -0,0 +1,30 @@ +#include +#include + +namespace EE { namespace UI { + +UIEventKey::UIEventKey( UIControl * Ctrl, const Uint32& EventNum, const Uint32& KeyCode, const Uint16& Char, const Uint32& Mod ) : + UIEvent( Ctrl, EventNum ), + mKeyCode( KeyCode ), + mChar( Char ), + mMod( Mod ) +{ +} + +UIEventKey::~UIEventKey() +{ +} + +const Uint32& UIEventKey::KeyCode() const { + return mKeyCode; +} + +const Uint16& UIEventKey::Char() const { + return mChar; +} + +const Uint32& UIEventKey::Mod() const { + return mMod; +} + +}} diff --git a/src/eepp/ui/uieventmouse.cpp b/src/eepp/ui/uieventmouse.cpp new file mode 100644 index 000000000..4b119a22c --- /dev/null +++ b/src/eepp/ui/uieventmouse.cpp @@ -0,0 +1,26 @@ +#include +#include + +namespace EE { namespace UI { + +UIEventMouse::UIEventMouse( UIControl * Ctrl, const Uint32& EventNum, const Vector2i& Pos, const Uint32& Flags ) : + UIEvent( Ctrl, EventNum ), + mPos( Pos ), + mFlags( Flags ) +{ +} + +UIEventMouse::~UIEventMouse() +{ +} + +const Vector2i& UIEventMouse::Pos() const { + return mPos; +} + +const Uint32& UIEventMouse::Flags() const { + return mFlags; +} + +}} + diff --git a/src/eepp/ui/cuigenericgrid.cpp b/src/eepp/ui/uigenericgrid.cpp similarity index 75% rename from src/eepp/ui/cuigenericgrid.cpp rename to src/eepp/ui/uigenericgrid.cpp index b8cde46aa..0385d061a 100644 --- a/src/eepp/ui/cuigenericgrid.cpp +++ b/src/eepp/ui/uigenericgrid.cpp @@ -1,10 +1,10 @@ -#include -#include +#include +#include namespace EE { namespace UI { -cUIGenericGrid::cUIGenericGrid( const cUIGenericGrid::CreateParams& Params ) : - cUIComplexControl( Params ), +UIGenericGrid::UIGenericGrid( const UIGenericGrid::CreateParams& Params ) : + UIComplexControl( Params ), mPadding( Params.PaddingContainer ), mSmoothScroll( Params.SmoothScroll ), mContainer( NULL ), @@ -28,30 +28,30 @@ cUIGenericGrid::cUIGenericGrid( const cUIGenericGrid::CreateParams& Params ) : mCollumnsWidth.resize( mCollumnsCount, 0 ); mCollumnsPos.resize( mCollumnsCount, 0 ); - cUIComplexControl::CreateParams CParams; + UIComplexControl::CreateParams CParams; CParams.Parent( this ); CParams.PosSet( mPadding.Left, mPadding.Top ); CParams.Size = Sizei( mSize.Width() - mPadding.Right - mPadding.Left, mSize.Height() - mPadding.Top - mPadding.Bottom ); CParams.Flags = Params.Flags; - mContainer = eeNew( tUIItemContainer , ( CParams ) ); + mContainer = eeNew( UIItemContainer , ( CParams ) ); mContainer->Visible( true ); mContainer->Enabled( true ); if ( mFlags & UI_CLIP_ENABLE ) mFlags &= ~UI_CLIP_ENABLE; - cUIScrollBar::CreateParams ScrollBarP; + UIScrollBar::CreateParams ScrollBarP; ScrollBarP.Parent ( this ); ScrollBarP.PosSet ( mSize.Width() - 15, 0 ); ScrollBarP.Flags = UI_AUTO_SIZE; ScrollBarP.VerticalScrollBar = true; ScrollBarP.Size = Sizei( 15, mSize.Height() ); - mVScrollBar = eeNew( cUIScrollBar, ( ScrollBarP ) ); + mVScrollBar = eeNew( UIScrollBar, ( ScrollBarP ) ); ScrollBarP.PosSet ( 0, mSize.Height() - 15 ); ScrollBarP.Size = Sizei( mSize.Width() - mVScrollBar->Size().Width(), 15 ); ScrollBarP.VerticalScrollBar = false; - mHScrollBar = eeNew( cUIScrollBar, ( ScrollBarP ) ); + mHScrollBar = eeNew( UIScrollBar, ( ScrollBarP ) ); if ( UI_SCROLLBAR_ALWAYS_ON == mHScrollMode ) { mHScrollBar->Visible( true ); @@ -63,24 +63,24 @@ cUIGenericGrid::cUIGenericGrid( const cUIGenericGrid::CreateParams& Params ) : mVScrollBar->Enabled( true ); } - mVScrollBar->AddEventListener( cUIEvent::EventOnValueChange, cb::Make1( this, &cUIGenericGrid::OnScrollValueChange ) ); - mHScrollBar->AddEventListener( cUIEvent::EventOnValueChange, cb::Make1( this, &cUIGenericGrid::OnScrollValueChange ) ); + mVScrollBar->AddEventListener( UIEvent::EventOnValueChange, cb::Make1( this, &UIGenericGrid::OnScrollValueChange ) ); + mHScrollBar->AddEventListener( UIEvent::EventOnValueChange, cb::Make1( this, &UIGenericGrid::OnScrollValueChange ) ); ApplyDefaultTheme(); } -cUIGenericGrid::~cUIGenericGrid() { +UIGenericGrid::~UIGenericGrid() { } -Uint32 cUIGenericGrid::Type() const { +Uint32 UIGenericGrid::Type() const { return UI_TYPE_GENERICGRID; } -bool cUIGenericGrid::IsType( const Uint32& type ) const { - return cUIGenericGrid::Type() == type ? true : cUIControlAnim::IsType( type ); +bool UIGenericGrid::IsType( const Uint32& type ) const { + return UIGenericGrid::Type() == type ? true : UIControlAnim::IsType( type ); } -void cUIGenericGrid::SetDefaultCollumnsWidth() { +void UIGenericGrid::SetDefaultCollumnsWidth() { if ( mCollWidthAssigned ) return; @@ -107,25 +107,25 @@ void cUIGenericGrid::SetDefaultCollumnsWidth() { UpdateCells(); } -void cUIGenericGrid::OnScrollValueChange( const cUIEvent * Event ) { +void UIGenericGrid::OnScrollValueChange( const UIEvent * Event ) { UpdateScroll( true ); } -void cUIGenericGrid::SetTheme( cUITheme * Theme ) { - cUIControl::SetThemeControl( Theme, "genericgrid" ); +void UIGenericGrid::SetTheme( UITheme * Theme ) { + UIControl::SetThemeControl( Theme, "genericgrid" ); AutoPadding(); OnSizeChange(); } -void cUIGenericGrid::AutoPadding() { +void UIGenericGrid::AutoPadding() { if ( mFlags & UI_AUTO_PADDING ) { mPadding = MakePadding(); } } -void cUIGenericGrid::OnSizeChange() { +void UIGenericGrid::OnSizeChange() { mVScrollBar->Pos( mSize.Width() - mVScrollBar->Size().Width(), 0 ); mVScrollBar->Size( mVScrollBar->Size().Width(), mSize.Height() ); @@ -145,7 +145,7 @@ void cUIGenericGrid::OnSizeChange() { UpdateScroll(); } -void cUIGenericGrid::ContainerResize() { +void UIGenericGrid::ContainerResize() { mContainer->Pos( mPadding.Left, mPadding.Top ); if( mHScrollBar->Visible() ) @@ -159,7 +159,7 @@ void cUIGenericGrid::ContainerResize() { SetDefaultCollumnsWidth(); } -void cUIGenericGrid::UpdateVScroll() { +void UIGenericGrid::UpdateVScroll() { if ( mItemsNotVisible <= 0 ) { if ( UI_SCROLLBAR_ALWAYS_ON == mVScrollMode ) { mVScrollBar->Visible( true ); @@ -181,7 +181,7 @@ void cUIGenericGrid::UpdateVScroll() { ContainerResize(); } -void cUIGenericGrid::UpdateHScroll() { +void UIGenericGrid::UpdateHScroll() { if ( mContainer->IsClipped() && ( UI_SCROLLBAR_AUTO == mHScrollMode || UI_SCROLLBAR_ALWAYS_ON == mHScrollMode ) ) { if ( mContainer->Size().Width() < (Int32)mTotalWidth ) { mHScrollBar->Visible( true ); @@ -207,11 +207,11 @@ void cUIGenericGrid::UpdateHScroll() { } } -void cUIGenericGrid::UpdateScroll( bool FromScrollChange ) { +void UIGenericGrid::UpdateScroll( bool FromScrollChange ) { if ( !mItems.size() ) return; - cUIGridCell * Item; + UIGridCell * Item; Uint32 i, RelPos = 0, RelPosMax; Int32 ItemPos, ItemPosMax; Int32 tHLastScroll = mHScrollInit; @@ -311,13 +311,13 @@ void cUIGenericGrid::UpdateScroll( bool FromScrollChange ) { } } -void cUIGenericGrid::UpdateSize() { +void UIGenericGrid::UpdateSize() { UpdateCollumnsPos(); mTotalHeight = mItems.size() * mRowHeight; } -void cUIGenericGrid::Add( cUIGridCell * Cell ) { +void UIGenericGrid::Add( UIGridCell * Cell ) { mItems.push_back( Cell ); if ( mContainer != Cell->Parent() ) @@ -332,13 +332,13 @@ void cUIGenericGrid::Add( cUIGridCell * Cell ) { UpdateScroll(); } -void cUIGenericGrid::Remove( cUIGridCell * Cell ) { +void UIGenericGrid::Remove( UIGridCell * Cell ) { return Remove( GetItemIndex( Cell ) ); } -void cUIGenericGrid::Remove( std::vector ItemsIndex ) { +void UIGenericGrid::Remove( std::vector ItemsIndex ) { if ( ItemsIndex.size() && eeINDEX_NOT_FOUND != ItemsIndex[0] ) { - std::vector ItemsCpy; + std::vector ItemsCpy; bool erase; for ( Uint32 i = 0; i < mItems.size(); i++ ) { @@ -372,11 +372,11 @@ void cUIGenericGrid::Remove( std::vector ItemsIndex ) { } } -void cUIGenericGrid::Remove( Uint32 ItemIndex ) { +void UIGenericGrid::Remove( Uint32 ItemIndex ) { Remove( std::vector ( 1, ItemIndex ) ); } -void cUIGenericGrid::CollumnWidth( const Uint32& CollumnIndex, const Uint32& CollumnWidth ) { +void UIGenericGrid::CollumnWidth( const Uint32& CollumnIndex, const Uint32& CollumnWidth ) { eeASSERT( CollumnIndex < mCollumnsCount ); mCollWidthAssigned = true; @@ -388,21 +388,21 @@ void cUIGenericGrid::CollumnWidth( const Uint32& CollumnIndex, const Uint32& Col UpdateScroll(); } -Uint32 cUIGenericGrid::Count() const { +Uint32 UIGenericGrid::Count() const { return mItems.size(); } -const Uint32& cUIGenericGrid::CollumnsCount() const { +const Uint32& UIGenericGrid::CollumnsCount() const { return mCollumnsCount; } -const Uint32& cUIGenericGrid::CollumnWidth( const Uint32& CollumnIndex ) const { +const Uint32& UIGenericGrid::CollumnWidth( const Uint32& CollumnIndex ) const { eeASSERT( CollumnIndex < mCollumnsCount ); return mCollumnsWidth[ CollumnIndex ]; } -void cUIGenericGrid::RowHeight( const Uint32& height ) { +void UIGenericGrid::RowHeight( const Uint32& height ) { if ( mRowHeight != height ) { mRowHeight = height; @@ -412,29 +412,29 @@ void cUIGenericGrid::RowHeight( const Uint32& height ) { } } -const Uint32& cUIGenericGrid::RowHeight() const { +const Uint32& UIGenericGrid::RowHeight() const { return mRowHeight; } -cUIGridCell * cUIGenericGrid::GetCell( const Uint32& CellIndex ) const { +UIGridCell * UIGenericGrid::GetCell( const Uint32& CellIndex ) const { eeASSERT( CellIndex < mItems.size() ); return mItems[ CellIndex ]; } -Uint32 cUIGenericGrid::GetCellPos( const Uint32& CollumnIndex ) { +Uint32 UIGenericGrid::GetCellPos( const Uint32& CollumnIndex ) { eeASSERT( CollumnIndex < mCollumnsCount ); return mCollumnsPos[ CollumnIndex ]; } -void cUIGenericGrid::UpdateCells() { +void UIGenericGrid::UpdateCells() { for ( Uint32 i = 0; i < mItems.size(); i++ ) { mItems[i]->FixCell(); } } -void cUIGenericGrid::UpdateCollumnsPos() { +void UIGenericGrid::UpdateCollumnsPos() { Uint32 Pos = 0; for ( Uint32 i = 0; i < mCollumnsCount; i++ ) { @@ -446,14 +446,14 @@ void cUIGenericGrid::UpdateCollumnsPos() { mTotalWidth = Pos; } -void cUIGenericGrid::OnAlphaChange() { - cUIControlAnim::OnAlphaChange(); +void UIGenericGrid::OnAlphaChange() { + UIControlAnim::OnAlphaChange(); mVScrollBar->Alpha( mAlpha ); mHScrollBar->Alpha( mAlpha ); } -void cUIGenericGrid::VerticalScrollMode( const UI_SCROLLBAR_MODE& Mode ) { +void UIGenericGrid::VerticalScrollMode( const UI_SCROLLBAR_MODE& Mode ) { if ( Mode != mVScrollMode ) { mVScrollMode = Mode; @@ -461,11 +461,11 @@ void cUIGenericGrid::VerticalScrollMode( const UI_SCROLLBAR_MODE& Mode ) { } } -const UI_SCROLLBAR_MODE& cUIGenericGrid::VerticalScrollMode() { +const UI_SCROLLBAR_MODE& UIGenericGrid::VerticalScrollMode() { return mVScrollMode; } -void cUIGenericGrid::HorizontalScrollMode( const UI_SCROLLBAR_MODE& Mode ) { +void UIGenericGrid::HorizontalScrollMode( const UI_SCROLLBAR_MODE& Mode ) { if ( Mode != mHScrollMode ) { mHScrollMode = Mode; @@ -483,19 +483,19 @@ void cUIGenericGrid::HorizontalScrollMode( const UI_SCROLLBAR_MODE& Mode ) { } } -const UI_SCROLLBAR_MODE& cUIGenericGrid::HorizontalScrollMode() { +const UI_SCROLLBAR_MODE& UIGenericGrid::HorizontalScrollMode() { return mHScrollMode; } -cUIScrollBar * cUIGenericGrid::VerticalScrollBar() const { +UIScrollBar * UIGenericGrid::VerticalScrollBar() const { return mVScrollBar; } -cUIScrollBar * cUIGenericGrid::HorizontalScrollBar() const { +UIScrollBar * UIGenericGrid::HorizontalScrollBar() const { return mHScrollBar; } -Uint32 cUIGenericGrid::GetItemIndex( cUIGridCell * Item ) { +Uint32 UIGenericGrid::GetItemIndex( UIGridCell * Item ) { for ( Uint32 i = 0; i < mItems.size(); i++ ) { if ( Item == mItems[i] ) return i; @@ -504,28 +504,28 @@ Uint32 cUIGenericGrid::GetItemIndex( cUIGridCell * Item ) { return eeINDEX_NOT_FOUND; } -Uint32 cUIGenericGrid::OnSelected() { - SendCommonEvent( cUIEvent::EventOnItemSelected ); +Uint32 UIGenericGrid::OnSelected() { + SendCommonEvent( UIEvent::EventOnItemSelected ); return 1; } -cUIGridCell * cUIGenericGrid::GetItemSelected() { +UIGridCell * UIGenericGrid::GetItemSelected() { if ( -1 != mSelected ) return mItems[ mSelected ]; return NULL; } -Uint32 cUIGenericGrid::GetItemSelectedIndex() const { +Uint32 UIGenericGrid::GetItemSelectedIndex() const { return mSelected; } -Uint32 cUIGenericGrid::OnMessage( const cUIMessage * Msg ) { +Uint32 UIGenericGrid::OnMessage( const UIMessage * Msg ) { switch ( Msg->Msg() ) { - case cUIMessage::MsgFocusLoss: + case UIMessage::MsgFocusLoss: { - cUIControl * FocusCtrl = cUIManager::instance()->FocusControl(); + UIControl * FocusCtrl = UIManager::instance()->FocusControl(); if ( this != FocusCtrl && !IsParentOf( FocusCtrl ) ) { OnComplexControlFocusLoss(); @@ -538,41 +538,41 @@ Uint32 cUIGenericGrid::OnMessage( const cUIMessage * Msg ) { return 0; } -tUIItemContainer * cUIGenericGrid::Container() const { +UIItemContainer * UIGenericGrid::Container() const { return mContainer; } -bool cUIGenericGrid::TouchDragEnable() const { +bool UIGenericGrid::TouchDragEnable() const { return 0 != ( mFlags & UI_TOUCH_DRAG_ENABLED ); } -void cUIGenericGrid::TouchDragEnable( const bool& enable ) { +void UIGenericGrid::TouchDragEnable( const bool& enable ) { WriteFlag( UI_TOUCH_DRAG_ENABLED, true == enable ); } -bool cUIGenericGrid::TouchDragging() const { +bool UIGenericGrid::TouchDragging() const { return 0 != ( mControlFlags & UI_CTRL_FLAG_TOUCH_DRAGGING ); } -void cUIGenericGrid::TouchDragging( const bool& dragging ) { +void UIGenericGrid::TouchDragging( const bool& dragging ) { WriteCtrlFlag( UI_CTRL_FLAG_TOUCH_DRAGGING, true == dragging ); } -void cUIGenericGrid::Update() { +void UIGenericGrid::Update() { if ( mEnabled && mVisible ) { if ( mFlags & UI_TOUCH_DRAG_ENABLED ) { - Uint32 Press = cUIManager::instance()->PressTrigger(); - Uint32 LPress = cUIManager::instance()->LastPressTrigger(); + Uint32 Press = UIManager::instance()->PressTrigger(); + Uint32 LPress = UIManager::instance()->LastPressTrigger(); if ( ( mControlFlags & UI_CTRL_FLAG_TOUCH_DRAGGING ) ) { // Mouse Not Down if ( !( Press & EE_BUTTON_LMASK ) ) { WriteCtrlFlag( UI_CTRL_FLAG_TOUCH_DRAGGING, 0 ); - cUIManager::instance()->SetControlDragging( false ); + UIManager::instance()->SetControlDragging( false ); return; } - Vector2i Pos( cUIManager::instance()->GetMousePos() ); + Vector2i Pos( UIManager::instance()->GetMousePos() ); if ( mTouchDragPoint != Pos ) { Vector2i diff = -( mTouchDragPoint - Pos ); @@ -583,7 +583,7 @@ void cUIGenericGrid::Update() { mTouchDragPoint = Pos; - cUIManager::instance()->SetControlDragging( true ); + UIManager::instance()->SetControlDragging( true ); } else { mTouchDragAcceleration -= Elapsed().AsMilliseconds() * mTouchDragAcceleration * 0.01f; } @@ -593,7 +593,7 @@ void cUIGenericGrid::Update() { if ( !( LPress & EE_BUTTON_LMASK ) && ( Press & EE_BUTTON_LMASK ) ) { WriteCtrlFlag( UI_CTRL_FLAG_TOUCH_DRAGGING, 1 ); - mTouchDragPoint = cUIManager::instance()->GetMousePos(); + mTouchDragPoint = UIManager::instance()->GetMousePos(); mTouchDragAcceleration = 0; } } @@ -601,7 +601,7 @@ void cUIGenericGrid::Update() { // Mouse Up if ( ( LPress & EE_BUTTON_LMASK ) && !( Press & EE_BUTTON_LMASK ) ) { WriteCtrlFlag( UI_CTRL_FLAG_TOUCH_DRAGGING, 0 ); - cUIManager::instance()->SetControlDragging( false ); + UIManager::instance()->SetControlDragging( false ); } // Deaccelerate @@ -614,7 +614,7 @@ void cUIGenericGrid::Update() { } } - cUIComplexControl::Update(); + UIComplexControl::Update(); } }} diff --git a/src/eepp/ui/cuigfx.cpp b/src/eepp/ui/uigfx.cpp similarity index 73% rename from src/eepp/ui/cuigfx.cpp rename to src/eepp/ui/uigfx.cpp index 2c3ef618f..260bd66a2 100644 --- a/src/eepp/ui/cuigfx.cpp +++ b/src/eepp/ui/uigfx.cpp @@ -1,10 +1,10 @@ -#include +#include #include namespace EE { namespace UI { -cUIGfx::cUIGfx( const cUIGfx::CreateParams& Params ) : - cUIComplexControl( Params ), +UIGfx::UIGfx( const UIGfx::CreateParams& Params ) : + UIComplexControl( Params ), mSubTexture( Params.SubTexture ), mColor( Params.SubTextureColor ), mRender( Params.SubTextureRender ), @@ -18,25 +18,25 @@ cUIGfx::cUIGfx( const cUIGfx::CreateParams& Params ) : AutoSize(); } -cUIGfx::~cUIGfx() { +UIGfx::~UIGfx() { } -Uint32 cUIGfx::Type() const { +Uint32 UIGfx::Type() const { return UI_TYPE_GFX; } -bool cUIGfx::IsType( const Uint32& type ) const { - return cUIGfx::Type() == type ? true : cUIComplexControl::IsType( type ); +bool UIGfx::IsType( const Uint32& type ) const { + return UIGfx::Type() == type ? true : UIComplexControl::IsType( type ); } -void cUIGfx::SubTexture( Graphics::SubTexture * subTexture ) { +void UIGfx::SubTexture( Graphics::SubTexture * subTexture ) { mSubTexture = subTexture; AutoSize(); AutoAlign(); } -void cUIGfx::AutoSize() { +void UIGfx::AutoSize() { if ( mFlags & UI_AUTO_SIZE ) { if ( NULL != mSubTexture ) { Size( mSubTexture->Size() ); @@ -46,8 +46,8 @@ void cUIGfx::AutoSize() { } } -void cUIGfx::Draw() { - cUIControlAnim::Draw(); +void UIGfx::Draw() { + UIControlAnim::Draw(); if ( mVisible ) { if ( NULL != mSubTexture && 0.f != mAlpha ) { @@ -95,37 +95,37 @@ void cUIGfx::Draw() { } } -void cUIGfx::DrawSubTexture() { +void UIGfx::DrawSubTexture() { mSubTexture->Draw( (Float)mScreenPos.x + mAlignOffset.x, (Float)mScreenPos.y + mAlignOffset.y, mColor, 0.f, Vector2f::One, Blend(), mRender ); } -void cUIGfx::Alpha( const Float& alpha ) { - cUIControlAnim::Alpha( alpha ); +void UIGfx::Alpha( const Float& alpha ) { + UIControlAnim::Alpha( alpha ); mColor.Alpha = (Uint8)alpha; } -Graphics::SubTexture * cUIGfx::SubTexture() const { +Graphics::SubTexture * UIGfx::SubTexture() const { return mSubTexture; } -const ColorA& cUIGfx::Color() const { +const ColorA& UIGfx::Color() const { return mColor; } -void cUIGfx::Color( const ColorA& color ) { +void UIGfx::Color( const ColorA& color ) { mColor = color; Alpha( color.A() ); } -const EE_RENDER_MODE& cUIGfx::RenderMode() const { +const EE_RENDER_MODE& UIGfx::RenderMode() const { return mRender; } -void cUIGfx::RenderMode( const EE_RENDER_MODE& render ) { +void UIGfx::RenderMode( const EE_RENDER_MODE& render ) { mRender = render; } -void cUIGfx::AutoAlign() { +void UIGfx::AutoAlign() { if ( NULL == mSubTexture ) return; @@ -146,13 +146,13 @@ void cUIGfx::AutoAlign() { } } -void cUIGfx::OnSizeChange() { +void UIGfx::OnSizeChange() { AutoSize(); AutoAlign(); - cUIControlAnim::OnSizeChange(); + UIControlAnim::OnSizeChange(); } -const Vector2i& cUIGfx::AlignOffset() const { +const Vector2i& UIGfx::AlignOffset() const { return mAlignOffset; } diff --git a/src/eepp/ui/cuigridcell.cpp b/src/eepp/ui/uigridcell.cpp similarity index 50% rename from src/eepp/ui/cuigridcell.cpp rename to src/eepp/ui/uigridcell.cpp index 0a0fca7bd..2f0be826a 100644 --- a/src/eepp/ui/cuigridcell.cpp +++ b/src/eepp/ui/uigridcell.cpp @@ -1,37 +1,37 @@ -#include -#include -#include +#include +#include +#include namespace EE { namespace UI { -cUIGridCell::cUIGridCell( cUIGridCell::CreateParams& Params ) : - cUIComplexControl( Params ) +UIGridCell::UIGridCell( UIGridCell::CreateParams& Params ) : + UIComplexControl( Params ) { mCells.resize( GridParent()->CollumnsCount(), NULL ); ApplyDefaultTheme(); } -cUIGridCell::~cUIGridCell() { - if ( cUIManager::instance()->FocusControl() == this ) +UIGridCell::~UIGridCell() { + if ( UIManager::instance()->FocusControl() == this ) mParentCtrl->SetFocus(); - if ( cUIManager::instance()->OverControl() == this ) - cUIManager::instance()->OverControl( mParentCtrl ); + if ( UIManager::instance()->OverControl() == this ) + UIManager::instance()->OverControl( mParentCtrl ); } -void cUIGridCell::SetTheme( cUITheme * Theme ) { - cUIControl::SetThemeControl( Theme, "gridcell" ); +void UIGridCell::SetTheme( UITheme * Theme ) { + UIControl::SetThemeControl( Theme, "gridcell" ); } -cUIGenericGrid * cUIGridCell::GridParent() const { - return reinterpret_cast ( mParentCtrl->Parent() ); +UIGenericGrid * UIGridCell::GridParent() const { + return reinterpret_cast ( mParentCtrl->Parent() ); } -void cUIGridCell::Cell( const Uint32& CollumnIndex, cUIControl * Ctrl ) { +void UIGridCell::Cell( const Uint32& CollumnIndex, UIControl * Ctrl ) { eeASSERT( CollumnIndex < GridParent()->CollumnsCount() ); - cUIGenericGrid * P = GridParent(); + UIGenericGrid * P = GridParent(); mCells[ CollumnIndex ] = Ctrl; @@ -45,16 +45,16 @@ void cUIGridCell::Cell( const Uint32& CollumnIndex, cUIControl * Ctrl ) { Ctrl->Enabled( true ); } -cUIControl * cUIGridCell::Cell( const Uint32& CollumnIndex ) const { +UIControl * UIGridCell::Cell( const Uint32& CollumnIndex ) const { eeASSERT( CollumnIndex < GridParent()->CollumnsCount() ); return mCells[ CollumnIndex ]; } -void cUIGridCell::FixCell() { +void UIGridCell::FixCell() { AutoSize(); - cUIGenericGrid * P = GridParent(); + UIGenericGrid * P = GridParent(); for ( Uint32 i = 0; i < mCells.size(); i++ ) { mCells[i]->Pos ( P->GetCellPos( i ) , 0 ); @@ -62,17 +62,17 @@ void cUIGridCell::FixCell() { } } -void cUIGridCell::Update() { +void UIGridCell::Update() { if ( mEnabled && mVisible ) { - cUIGenericGrid * MyParent = reinterpret_cast ( Parent()->Parent() ); - Uint32 Flags = cUIManager::instance()->GetInput()->ClickTrigger(); + UIGenericGrid * MyParent = reinterpret_cast ( Parent()->Parent() ); + Uint32 Flags = UIManager::instance()->GetInput()->ClickTrigger(); if ( NULL != MyParent && MyParent->Alpha() != mAlpha ) { Alpha( MyParent->Alpha() ); for ( Uint32 i = 0; i < mCells.size(); i++ ) { if ( NULL != mCells[i] && mCells[i]->IsAnimated() ) { - reinterpret_cast( mCells[i] )->Alpha( MyParent->Alpha() ); + reinterpret_cast( mCells[i] )->Alpha( MyParent->Alpha() ); } } } @@ -84,11 +84,11 @@ void cUIGridCell::Update() { } } - cUIComplexControl::Update(); + UIComplexControl::Update(); } -void cUIGridCell::Select() { - cUIGenericGrid * MyParent = reinterpret_cast ( Parent()->Parent() ); +void UIGridCell::Select() { + UIGenericGrid * MyParent = reinterpret_cast ( Parent()->Parent() ); if ( MyParent->GetItemSelected() != this ) { if ( NULL != MyParent->GetItemSelected() ) @@ -96,7 +96,7 @@ void cUIGridCell::Select() { bool wasSelected = 0 != ( mControlFlags & UI_CTRL_FLAG_SELECTED ); - SetSkinState( cUISkinState::StateSelected ); + SetSkinState( UISkinState::StateSelected ); mControlFlags |= UI_CTRL_FLAG_SELECTED; @@ -108,44 +108,44 @@ void cUIGridCell::Select() { } } -void cUIGridCell::Unselect() { +void UIGridCell::Unselect() { if ( mControlFlags & UI_CTRL_FLAG_SELECTED ) mControlFlags &= ~UI_CTRL_FLAG_SELECTED; - SetSkinState( cUISkinState::StateNormal ); + SetSkinState( UISkinState::StateNormal ); } -bool cUIGridCell::Selected() const { +bool UIGridCell::Selected() const { return 0 != ( mControlFlags & UI_CTRL_FLAG_SELECTED ); } -Uint32 cUIGridCell::OnMouseExit( const Vector2i& Pos, const Uint32 Flags ) { - cUIControl::OnMouseExit( Pos, Flags ); +Uint32 UIGridCell::OnMouseExit( const Vector2i& Pos, const Uint32 Flags ) { + UIControl::OnMouseExit( Pos, Flags ); if ( mControlFlags & UI_CTRL_FLAG_SELECTED ) - SetSkinState( cUISkinState::StateSelected ); + SetSkinState( UISkinState::StateSelected ); return 1; } -Uint32 cUIGridCell::OnMessage( const cUIMessage * Msg ) { +Uint32 UIGridCell::OnMessage( const UIMessage * Msg ) { switch( Msg->Msg() ) { - case cUIMessage::MsgMouseEnter: + case UIMessage::MsgMouseEnter: { OnMouseEnter( Vector2i(), Msg->Flags() ); break; } - case cUIMessage::MsgMouseExit: + case UIMessage::MsgMouseExit: { OnMouseExit( Vector2i(), Msg->Flags() ); break; } - case cUIMessage::MsgClick: + case UIMessage::MsgClick: { if ( Msg->Flags() & EE_BUTTONS_LRM ) { Select(); - cUIMessage tMsg( this, cUIMessage::MsgCellClicked, Msg->Flags() ); + UIMessage tMsg( this, UIMessage::MsgCellClicked, Msg->Flags() ); MessagePost( &tMsg ); @@ -157,15 +157,15 @@ Uint32 cUIGridCell::OnMessage( const cUIMessage * Msg ) { return 0; } -void cUIGridCell::AutoSize() { - cUIGenericGrid * MyParent = reinterpret_cast ( Parent()->Parent() ); +void UIGridCell::AutoSize() { + UIGenericGrid * MyParent = reinterpret_cast ( Parent()->Parent() ); Size( MyParent->mTotalWidth, MyParent->mRowHeight ); } -void cUIGridCell::OnStateChange() { - if ( Selected() && mSkinState->GetState() != cUISkinState::StateSelected ) { - SetSkinState( cUISkinState::StateSelected ); +void UIGridCell::OnStateChange() { + if ( Selected() && mSkinState->GetState() != UISkinState::StateSelected ) { + SetSkinState( UISkinState::StateSelected ); } } diff --git a/src/eepp/ui/cuilistbox.cpp b/src/eepp/ui/uilistbox.cpp similarity index 76% rename from src/eepp/ui/cuilistbox.cpp rename to src/eepp/ui/uilistbox.cpp index 57fbb5d07..193aab8fe 100644 --- a/src/eepp/ui/cuilistbox.cpp +++ b/src/eepp/ui/uilistbox.cpp @@ -1,13 +1,13 @@ -#include -#include -#include -#include +#include +#include +#include +#include #include namespace EE { namespace UI { -cUIListBox::cUIListBox( cUIListBox::CreateParams& Params ) : - cUIComplexControl( Params ), +UIListBox::UIListBox( UIListBox::CreateParams& Params ) : + UIComplexControl( Params ), mRowHeight( Params.RowHeight ), mVScrollMode( Params.VScrollMode ), mHScrollMode( Params.HScrollMode ), @@ -32,33 +32,33 @@ cUIListBox::cUIListBox( cUIListBox::CreateParams& Params ) : mTouchDragAcceleration(0), mTouchDragDeceleration( Params.TouchDragDeceleration ) { - if ( NULL == Params.Font && NULL != cUIThemeManager::instance()->DefaultFont() ) - mFont = cUIThemeManager::instance()->DefaultFont(); + if ( NULL == Params.Font && NULL != UIThemeManager::instance()->DefaultFont() ) + mFont = UIThemeManager::instance()->DefaultFont(); - cUIControl::CreateParams CParams; + UIControl::CreateParams CParams; CParams.Parent( this ); CParams.PosSet( mPaddingContainer.Left, mPaddingContainer.Top ); CParams.Size = Sizei( mSize.Width() - mPaddingContainer.Right - mPaddingContainer.Left, mSize.Height() - mPaddingContainer.Top - mPaddingContainer.Bottom ); CParams.Flags = Params.Flags; - mContainer = eeNew( tUIItemContainer, ( CParams ) ); + mContainer = eeNew( UIItemContainer, ( CParams ) ); mContainer->Visible( true ); mContainer->Enabled( true ); if ( mFlags & UI_CLIP_ENABLE ) mFlags &= ~UI_CLIP_ENABLE; - cUIScrollBar::CreateParams ScrollBarP; + UIScrollBar::CreateParams ScrollBarP; ScrollBarP.Parent( this ); ScrollBarP.Size = Sizei( 15, mSize.Height() ); ScrollBarP.PosSet( mSize.Width() - 15, 0 ); ScrollBarP.Flags = UI_AUTO_SIZE; ScrollBarP.VerticalScrollBar = true; - mVScrollBar = eeNew( cUIScrollBar, ( ScrollBarP ) ); + mVScrollBar = eeNew( UIScrollBar, ( ScrollBarP ) ); ScrollBarP.Size = Sizei( mSize.Width() - mVScrollBar->Size().Width(), 15 ); ScrollBarP.PosSet( 0, mSize.Height() - 15 ); ScrollBarP.VerticalScrollBar = false; - mHScrollBar = eeNew( cUIScrollBar, ( ScrollBarP ) ); + mHScrollBar = eeNew( UIScrollBar, ( ScrollBarP ) ); if ( UI_SCROLLBAR_ALWAYS_ON == mHScrollMode ) { mHScrollBar->Visible( true ); @@ -70,27 +70,27 @@ cUIListBox::cUIListBox( cUIListBox::CreateParams& Params ) : mVScrollBar->Enabled( true ); } - mVScrollBar->AddEventListener( cUIEvent::EventOnValueChange, cb::Make1( this, &cUIListBox::OnScrollValueChange ) ); - mHScrollBar->AddEventListener( cUIEvent::EventOnValueChange, cb::Make1( this, &cUIListBox::OnHScrollValueChange ) ); + mVScrollBar->AddEventListener( UIEvent::EventOnValueChange, cb::Make1( this, &UIListBox::OnScrollValueChange ) ); + mHScrollBar->AddEventListener( UIEvent::EventOnValueChange, cb::Make1( this, &UIListBox::OnHScrollValueChange ) ); SetRowHeight(); ApplyDefaultTheme(); } -cUIListBox::~cUIListBox() { +UIListBox::~UIListBox() { } -Uint32 cUIListBox::Type() const { +Uint32 UIListBox::Type() const { return UI_TYPE_LISTBOX; } -bool cUIListBox::IsType( const Uint32& type ) const { - return cUIListBox::Type() == type ? true : cUIComplexControl::IsType( type ); +bool UIListBox::IsType( const Uint32& type ) const { + return UIListBox::Type() == type ? true : UIComplexControl::IsType( type ); } -void cUIListBox::SetTheme( cUITheme * Theme ) { - cUIControl::SetThemeControl( Theme, "listbox" ); +void UIListBox::SetTheme( UITheme * Theme ) { + UIControl::SetThemeControl( Theme, "listbox" ); if ( NULL == mFont && NULL != mSkinState && NULL != mSkinState->GetSkin() && NULL != mSkinState->GetSkin()->Theme() && NULL != mSkinState->GetSkin()->Theme()->Font() ) mFont = mSkinState->GetSkin()->Theme()->Font(); @@ -100,21 +100,21 @@ void cUIListBox::SetTheme( cUITheme * Theme ) { OnSizeChange(); } -void cUIListBox::AutoPadding() { +void UIListBox::AutoPadding() { if ( mFlags & UI_AUTO_PADDING ) { mPaddingContainer = MakePadding(); } } -cUIScrollBar * cUIListBox::VerticalScrollBar() const { +UIScrollBar * UIListBox::VerticalScrollBar() const { return mVScrollBar; } -cUIScrollBar * cUIListBox::HorizontalScrollBar() const { +UIScrollBar * UIListBox::HorizontalScrollBar() const { return mHScrollBar; } -void cUIListBox::AddListBoxItems( std::vector Texts ) { +void UIListBox::AddListBoxItems( std::vector Texts ) { mItems.reserve( mItems.size() + Texts.size() ); mTexts.reserve( mTexts.size() + Texts.size() ); @@ -125,7 +125,7 @@ void cUIListBox::AddListBoxItems( std::vector Texts ) { UpdateScroll(); } -Uint32 cUIListBox::AddListBoxItem( cUIListBoxItem * Item ) { +Uint32 UIListBox::AddListBoxItem( UIListBoxItem * Item ) { mItems.push_back( Item ); mTexts.push_back( Item->Text() ); @@ -147,7 +147,7 @@ Uint32 cUIListBox::AddListBoxItem( cUIListBoxItem * Item ) { return (Uint32)(mItems.size() - 1); } -Uint32 cUIListBox::AddListBoxItem( const String& Text ) { +Uint32 UIListBox::AddListBoxItem( const String& Text ) { mTexts.push_back( Text ); mItems.push_back( NULL ); @@ -166,29 +166,29 @@ Uint32 cUIListBox::AddListBoxItem( const String& Text ) { return (Uint32)(mItems.size() - 1); } -cUIListBoxItem * cUIListBox::CreateListBoxItem( const String& Name ) { - cUITextBox::CreateParams TextParams; +UIListBoxItem * UIListBox::CreateListBoxItem( const String& Name ) { + UITextBox::CreateParams TextParams; TextParams.Parent( mContainer ); TextParams.Flags = UI_VALIGN_CENTER | UI_HALIGN_LEFT; TextParams.Font = mFont; TextParams.FontColor = mFontColor; - cUIListBoxItem * tItem = eeNew( cUIListBoxItem, ( TextParams ) ); + UIListBoxItem * tItem = eeNew( UIListBoxItem, ( TextParams ) ); tItem->Text( Name ); return tItem; } -Uint32 cUIListBox::RemoveListBoxItem( const String& Text ) { +Uint32 UIListBox::RemoveListBoxItem( const String& Text ) { return RemoveListBoxItem( GetListBoxItemIndex( Text ) ); } -Uint32 cUIListBox::RemoveListBoxItem( cUIListBoxItem * Item ) { +Uint32 UIListBox::RemoveListBoxItem( UIListBoxItem * Item ) { return RemoveListBoxItem( GetListBoxItemIndex( Item ) ); } -void cUIListBox::RemoveListBoxItems( std::vector ItemsIndex ) { +void UIListBox::RemoveListBoxItems( std::vector ItemsIndex ) { if ( ItemsIndex.size() && eeINDEX_NOT_FOUND != ItemsIndex[0] ) { - std::vector ItemsCpy; + std::vector ItemsCpy; bool erase; mTexts.clear(); @@ -229,7 +229,7 @@ void cUIListBox::RemoveListBoxItems( std::vector ItemsIndex ) { } } -void cUIListBox::Clear() { +void UIListBox::Clear() { mTexts.clear(); mItems.clear(); mSelected.clear(); @@ -239,16 +239,16 @@ void cUIListBox::Clear() { FindMaxWidth(); UpdateListBoxItemsSize(); - SendCommonEvent( cUIEvent::EventOnControlClear ); + SendCommonEvent( UIEvent::EventOnControlClear ); } -Uint32 cUIListBox::RemoveListBoxItem( Uint32 ItemIndex ) { +Uint32 UIListBox::RemoveListBoxItem( Uint32 ItemIndex ) { RemoveListBoxItems( std::vector( 1, ItemIndex ) ); return ItemIndex; } -Uint32 cUIListBox::GetListBoxItemIndex( const String& Name ) { +Uint32 UIListBox::GetListBoxItemIndex( const String& Name ) { Uint32 size = (Uint32)mItems.size(); for ( Uint32 i = 0; i < size; i++ ) { @@ -259,7 +259,7 @@ Uint32 cUIListBox::GetListBoxItemIndex( const String& Name ) { return eeINDEX_NOT_FOUND; } -Uint32 cUIListBox::GetListBoxItemIndex( cUIListBoxItem * Item ) { +Uint32 UIListBox::GetListBoxItemIndex( UIListBoxItem * Item ) { Uint32 size = (Uint32)mItems.size(); for ( Uint32 i = 0; i < size; i++ ) { @@ -270,15 +270,15 @@ Uint32 cUIListBox::GetListBoxItemIndex( cUIListBoxItem * Item ) { return eeINDEX_NOT_FOUND; } -void cUIListBox::OnScrollValueChange( const cUIEvent * Event ) { +void UIListBox::OnScrollValueChange( const UIEvent * Event ) { UpdateScroll( true ); } -void cUIListBox::OnHScrollValueChange( const cUIEvent * Event ) { +void UIListBox::OnHScrollValueChange( const UIEvent * Event ) { UpdateScroll( true ); } -void cUIListBox::OnSizeChange() { +void UIListBox::OnSizeChange() { mVScrollBar->Pos( mSize.Width() - mVScrollBar->Size().Width() + mVScrollPadding.Left, mVScrollPadding.Top ); mVScrollBar->Size( mVScrollBar->Size().Width() + mVScrollPadding.Right, mSize.Height() + mVScrollPadding.Bottom ); @@ -298,14 +298,14 @@ void cUIListBox::OnSizeChange() { UpdateScroll(); } -void cUIListBox::SetRowHeight() { +void UIListBox::SetRowHeight() { Uint32 tOldRowHeight = mRowHeight; if ( 0 == mRowHeight ) { Uint32 FontSize = 12; - if ( NULL != cUIThemeManager::instance()->DefaultFont() ) - FontSize = cUIThemeManager::instance()->DefaultFont()->GetFontHeight(); + if ( NULL != UIThemeManager::instance()->DefaultFont() ) + FontSize = UIThemeManager::instance()->DefaultFont()->GetFontHeight(); if ( NULL != mSkinState && NULL != mSkinState->GetSkin() && NULL != mSkinState->GetSkin()->Theme() && NULL != mSkinState->GetSkin()->Theme()->Font() ) FontSize = mSkinState->GetSkin()->Theme()->Font()->GetFontHeight(); @@ -322,7 +322,7 @@ void cUIListBox::SetRowHeight() { } } -void cUIListBox::FindMaxWidth() { +void UIListBox::FindMaxWidth() { Uint32 size = (Uint32)mItems.size(); Int32 width; @@ -339,14 +339,14 @@ void cUIListBox::FindMaxWidth() { } } -void cUIListBox::UpdateListBoxItemsSize() { +void UIListBox::UpdateListBoxItemsSize() { Uint32 size = (Uint32)mItems.size(); for ( Uint32 i = 0; i < size; i++ ) ItemUpdateSize( mItems[i] ); } -void cUIListBox::ItemUpdateSize( cUIListBoxItem * Item ) { +void UIListBox::ItemUpdateSize( UIListBoxItem * Item ) { if ( NULL != Item ) { Int32 width = (Int32)Item->GetTextWidth(); @@ -367,7 +367,7 @@ void cUIListBox::ItemUpdateSize( cUIListBoxItem * Item ) { } } -void cUIListBox::ContainerResize() { +void UIListBox::ContainerResize() { mContainer->Pos( mPaddingContainer.Left, mPaddingContainer.Top ); if( mHScrollBar->Visible() ) @@ -376,7 +376,7 @@ void cUIListBox::ContainerResize() { mContainer->Size( mSize.Width() - mPaddingContainer.Right - mPaddingContainer.Left, mSize.Height() - mPaddingContainer.Bottom - mPaddingContainer.Top ); } -void cUIListBox::CreateItemIndex( const Uint32& i ) { +void UIListBox::CreateItemIndex( const Uint32& i ) { if ( NULL == mItems[i] ) { mItems[i] = CreateListBoxItem( mTexts[i] ); @@ -392,11 +392,11 @@ void cUIListBox::CreateItemIndex( const Uint32& i ) { } } -void cUIListBox::UpdateScroll( bool FromScrollChange ) { +void UIListBox::UpdateScroll( bool FromScrollChange ) { if ( !mItems.size() ) return; - cUIListBoxItem * Item; + UIListBoxItem * Item; Uint32 i, RelPos = 0, RelPosMax; Int32 ItemPos, ItemPosMax; Int32 tHLastScroll = mHScrollInit; @@ -567,46 +567,46 @@ void cUIListBox::UpdateScroll( bool FromScrollChange ) { } } -void cUIListBox::ItemKeyEvent( const cUIEventKey &Event ) { - cUIEventKey ItemEvent( Event.Ctrl(), cUIEvent::EventOnItemKeyDown, Event.KeyCode(), Event.Char(), Event.Mod() ); +void UIListBox::ItemKeyEvent( const UIEventKey &Event ) { + UIEventKey ItemEvent( Event.Ctrl(), UIEvent::EventOnItemKeyDown, Event.KeyCode(), Event.Char(), Event.Mod() ); SendEvent( &ItemEvent ); } -void cUIListBox::ItemClicked( cUIListBoxItem * Item ) { - cUIEvent ItemEvent( Item, cUIEvent::EventOnItemClicked ); +void UIListBox::ItemClicked( UIListBoxItem * Item ) { + UIEvent ItemEvent( Item, UIEvent::EventOnItemClicked ); SendEvent( &ItemEvent ); - if ( !( IsMultiSelect() && cUIManager::instance()->GetInput()->IsKeyDown( KEY_LCTRL ) ) ) + if ( !( IsMultiSelect() && UIManager::instance()->GetInput()->IsKeyDown( KEY_LCTRL ) ) ) ResetItemsStates(); } -Uint32 cUIListBox::OnSelected() { - cUIMessage tMsg( this, cUIMessage::MsgSelected, 0 ); +Uint32 UIListBox::OnSelected() { + UIMessage tMsg( this, UIMessage::MsgSelected, 0 ); MessagePost( &tMsg ); - SendCommonEvent( cUIEvent::EventOnItemSelected ); + SendCommonEvent( UIEvent::EventOnItemSelected ); return 1; } -void cUIListBox::ResetItemsStates() { +void UIListBox::ResetItemsStates() { for ( Uint32 i = 0; i < mItems.size(); i++ ) { if ( NULL != mItems[i] ) mItems[i]->Unselect(); } } -bool cUIListBox::IsMultiSelect() const { +bool UIListBox::IsMultiSelect() const { return 0 != ( mFlags & UI_MULTI_SELECT ); } -cUIListBoxItem * cUIListBox::GetItem( const Uint32& Index ) const { +UIListBoxItem * UIListBox::GetItem( const Uint32& Index ) const { eeASSERT( Index < mItems.size() ) return mItems[ Index ]; } -cUIListBoxItem * cUIListBox::GetItemSelected() { +UIListBoxItem * UIListBox::GetItemSelected() { if ( mSelected.size() ) { if ( NULL == mItems[ mSelected.front() ] ) CreateItemIndex( mSelected.front() ); @@ -617,14 +617,14 @@ cUIListBoxItem * cUIListBox::GetItemSelected() { return NULL; } -Uint32 cUIListBox::GetItemSelectedIndex() const { +Uint32 UIListBox::GetItemSelectedIndex() const { if ( mSelected.size() ) return mSelected.front(); return eeINDEX_NOT_FOUND; } -String cUIListBox::GetItemSelectedText() const { +String UIListBox::GetItemSelectedText() const { String tstr; if ( mSelected.size() ) @@ -633,12 +633,12 @@ String cUIListBox::GetItemSelectedText() const { return tstr; } -std::list cUIListBox::GetItemsSelectedIndex() const { +std::list UIListBox::GetItemsSelectedIndex() const { return mSelected; } -std::list cUIListBox::GetItemsSelected() { - std::list tItems; +std::list UIListBox::GetItemsSelected() { + std::list tItems; std::list::iterator it; for ( it = mSelected.begin(); it != mSelected.end(); it++ ) { @@ -651,7 +651,7 @@ std::list cUIListBox::GetItemsSelected() { return tItems; } -Uint32 cUIListBox::GetItemIndex( cUIListBoxItem * Item ) { +Uint32 UIListBox::GetItemIndex( UIListBoxItem * Item ) { for ( Uint32 i = 0; i < mItems.size(); i++ ) { if ( Item == mItems[i] ) return i; @@ -660,7 +660,7 @@ Uint32 cUIListBox::GetItemIndex( cUIListBoxItem * Item ) { return eeINDEX_NOT_FOUND; } -Uint32 cUIListBox::GetItemIndex( const String& Text ) { +Uint32 UIListBox::GetItemIndex( const String& Text ) { for ( Uint32 i = 0; i < mTexts.size(); i++ ) { if ( Text == mTexts[i] ) return i; @@ -669,34 +669,34 @@ Uint32 cUIListBox::GetItemIndex( const String& Text ) { return eeINDEX_NOT_FOUND; } -void cUIListBox::FontColor( const ColorA& Color ) { +void UIListBox::FontColor( const ColorA& Color ) { mFontColor = Color; for ( Uint32 i = 0; i < mItems.size(); i++ ) mItems[i]->Color( mFontColor ); } -const ColorA& cUIListBox::FontColor() const { +const ColorA& UIListBox::FontColor() const { return mFontColor; } -void cUIListBox::FontOverColor( const ColorA& Color ) { +void UIListBox::FontOverColor( const ColorA& Color ) { mFontOverColor = Color; } -const ColorA& cUIListBox::FontOverColor() const { +const ColorA& UIListBox::FontOverColor() const { return mFontOverColor; } -void cUIListBox::FontSelectedColor( const ColorA& Color ) { +void UIListBox::FontSelectedColor( const ColorA& Color ) { mFontSelectedColor = Color; } -const ColorA& cUIListBox::FontSelectedColor() const { +const ColorA& UIListBox::FontSelectedColor() const { return mFontSelectedColor; } -void cUIListBox::Font( Graphics::Font * Font ) { +void UIListBox::Font( Graphics::Font * Font ) { mFont = Font; for ( Uint32 i = 0; i < mItems.size(); i++ ) @@ -707,11 +707,11 @@ void cUIListBox::Font( Graphics::Font * Font ) { UpdateScroll(); } -Graphics::Font * cUIListBox::Font() const { +Graphics::Font * UIListBox::Font() const { return mFont; } -void cUIListBox::PaddingContainer( const Recti& Padding ) { +void UIListBox::PaddingContainer( const Recti& Padding ) { if ( Padding != mPaddingContainer ) { mPaddingContainer = Padding; @@ -720,11 +720,11 @@ void cUIListBox::PaddingContainer( const Recti& Padding ) { } } -const Recti& cUIListBox::PaddingContainer() const { +const Recti& UIListBox::PaddingContainer() const { return mPaddingContainer; } -void cUIListBox::SmoothScroll( const bool& soft ) { +void UIListBox::SmoothScroll( const bool& soft ) { if ( soft != mSmoothScroll ) { mSmoothScroll = soft; @@ -732,11 +732,11 @@ void cUIListBox::SmoothScroll( const bool& soft ) { } } -const bool& cUIListBox::SmoothScroll() const { +const bool& UIListBox::SmoothScroll() const { return mSmoothScroll; } -void cUIListBox::RowHeight( const Uint32& height ) { +void UIListBox::RowHeight( const Uint32& height ) { if ( mRowHeight != height ) { mRowHeight = height; @@ -745,19 +745,19 @@ void cUIListBox::RowHeight( const Uint32& height ) { } } -const Uint32& cUIListBox::RowHeight() const { +const Uint32& UIListBox::RowHeight() const { return mRowHeight; } -Uint32 cUIListBox::Count() { +Uint32 UIListBox::Count() { return (Uint32)mItems.size(); } -void cUIListBox::SetSelected( const String& Text ) { +void UIListBox::SetSelected( const String& Text ) { SetSelected( GetItemIndex( Text ) ); } -void cUIListBox::SetSelected( Uint32 Index ) { +void UIListBox::SetSelected( Uint32 Index ) { if ( Index < mItems.size() ) { if ( IsMultiSelect() ) { for ( std::list::iterator it = mSelected.begin(); it != mSelected.end(); it++ ) { @@ -784,7 +784,7 @@ void cUIListBox::SetSelected( Uint32 Index ) { } } -void cUIListBox::SelectPrev() { +void UIListBox::SelectPrev() { if ( !IsMultiSelect() && mSelected.size() ) { Int32 SelIndex = mSelected.front() - 1; @@ -806,7 +806,7 @@ void cUIListBox::SelectPrev() { } } -void cUIListBox::SelectNext() { +void UIListBox::SelectNext() { if ( !IsMultiSelect() && mSelected.size() ) { Int32 SelIndex = mSelected.front() + 1; @@ -828,8 +828,8 @@ void cUIListBox::SelectNext() { } } -Uint32 cUIListBox::OnKeyDown( const cUIEventKey &Event ) { - cUIControlAnim::OnKeyDown( Event ); +Uint32 UIListBox::OnKeyDown( const UIEventKey &Event ) { + UIControlAnim::OnKeyDown( Event ); if ( !mSelected.size() || mFlags & UI_MULTI_SELECT ) return 0; @@ -871,11 +871,11 @@ Uint32 cUIListBox::OnKeyDown( const cUIEventKey &Event ) { return 1; } -Uint32 cUIListBox::OnMessage( const cUIMessage * Msg ) { +Uint32 UIListBox::OnMessage( const UIMessage * Msg ) { switch ( Msg->Msg() ) { - case cUIMessage::MsgFocusLoss: + case UIMessage::MsgFocusLoss: { - cUIControl * FocusCtrl = cUIManager::instance()->FocusControl(); + UIControl * FocusCtrl = UIManager::instance()->FocusControl(); if ( this != FocusCtrl && !IsParentOf( FocusCtrl ) ) { OnComplexControlFocusLoss(); @@ -888,8 +888,8 @@ Uint32 cUIListBox::OnMessage( const cUIMessage * Msg ) { return 0; } -void cUIListBox::OnAlphaChange() { - cUIComplexControl::OnAlphaChange(); +void UIListBox::OnAlphaChange() { + UIComplexControl::OnAlphaChange(); if ( mItems.size() ) { for ( Uint32 i = mVisibleFirst; i <= mVisibleLast; i++ ) { @@ -902,7 +902,7 @@ void cUIListBox::OnAlphaChange() { mHScrollBar->Alpha( mAlpha ); } -void cUIListBox::VerticalScrollMode( const UI_SCROLLBAR_MODE& Mode ) { +void UIListBox::VerticalScrollMode( const UI_SCROLLBAR_MODE& Mode ) { if ( Mode != mVScrollMode ) { mVScrollMode = Mode; @@ -910,11 +910,11 @@ void cUIListBox::VerticalScrollMode( const UI_SCROLLBAR_MODE& Mode ) { } } -const UI_SCROLLBAR_MODE& cUIListBox::VerticalScrollMode() { +const UI_SCROLLBAR_MODE& UIListBox::VerticalScrollMode() { return mVScrollMode; } -void cUIListBox::HorizontalScrollMode( const UI_SCROLLBAR_MODE& Mode ) { +void UIListBox::HorizontalScrollMode( const UI_SCROLLBAR_MODE& Mode ) { if ( Mode != mHScrollMode ) { mHScrollMode = Mode; @@ -932,41 +932,41 @@ void cUIListBox::HorizontalScrollMode( const UI_SCROLLBAR_MODE& Mode ) { } } -const UI_SCROLLBAR_MODE& cUIListBox::HorizontalScrollMode() { +const UI_SCROLLBAR_MODE& UIListBox::HorizontalScrollMode() { return mHScrollMode; } -bool cUIListBox::TouchDragEnable() const { +bool UIListBox::TouchDragEnable() const { return 0 != ( mFlags & UI_TOUCH_DRAG_ENABLED ); } -void cUIListBox::TouchDragEnable( const bool& enable ) { +void UIListBox::TouchDragEnable( const bool& enable ) { WriteFlag( UI_TOUCH_DRAG_ENABLED, true == enable ); } -bool cUIListBox::TouchDragging() const { +bool UIListBox::TouchDragging() const { return 0 != ( mControlFlags & UI_CTRL_FLAG_TOUCH_DRAGGING ); } -void cUIListBox::TouchDragging( const bool& dragging ) { +void UIListBox::TouchDragging( const bool& dragging ) { WriteCtrlFlag( UI_CTRL_FLAG_TOUCH_DRAGGING, true == dragging ); } -void cUIListBox::Update() { +void UIListBox::Update() { if ( mEnabled && mVisible ) { if ( mFlags & UI_TOUCH_DRAG_ENABLED ) { - Uint32 Press = cUIManager::instance()->PressTrigger(); - Uint32 LPress = cUIManager::instance()->LastPressTrigger(); + Uint32 Press = UIManager::instance()->PressTrigger(); + Uint32 LPress = UIManager::instance()->LastPressTrigger(); if ( ( mControlFlags & UI_CTRL_FLAG_TOUCH_DRAGGING ) ) { // Mouse Not Down if ( !( Press & EE_BUTTON_LMASK ) ) { WriteCtrlFlag( UI_CTRL_FLAG_TOUCH_DRAGGING, 0 ); - cUIManager::instance()->SetControlDragging( false ); + UIManager::instance()->SetControlDragging( false ); return; } - Vector2i Pos( cUIManager::instance()->GetMousePos() ); + Vector2i Pos( UIManager::instance()->GetMousePos() ); if ( mTouchDragPoint != Pos ) { Vector2i diff = -( mTouchDragPoint - Pos ); @@ -977,7 +977,7 @@ void cUIListBox::Update() { mTouchDragPoint = Pos; - cUIManager::instance()->SetControlDragging( true ); + UIManager::instance()->SetControlDragging( true ); } else { mTouchDragAcceleration -= Elapsed().AsMilliseconds() * mTouchDragAcceleration * 0.01f; } @@ -987,7 +987,7 @@ void cUIListBox::Update() { if ( !( LPress & EE_BUTTON_LMASK ) && ( Press & EE_BUTTON_LMASK ) ) { WriteCtrlFlag( UI_CTRL_FLAG_TOUCH_DRAGGING, 1 ); - mTouchDragPoint = cUIManager::instance()->GetMousePos(); + mTouchDragPoint = UIManager::instance()->GetMousePos(); mTouchDragAcceleration = 0; } } @@ -995,7 +995,7 @@ void cUIListBox::Update() { // Mouse Up if ( ( LPress & EE_BUTTON_LMASK ) && !( Press & EE_BUTTON_LMASK ) ) { WriteCtrlFlag( UI_CTRL_FLAG_TOUCH_DRAGGING, 0 ); - cUIManager::instance()->SetControlDragging( false ); + UIManager::instance()->SetControlDragging( false ); } // Deaccelerate @@ -1008,7 +1008,7 @@ void cUIListBox::Update() { } } - cUIComplexControl::Update(); + UIComplexControl::Update(); } }} diff --git a/src/eepp/ui/uilistboxitem.cpp b/src/eepp/ui/uilistboxitem.cpp new file mode 100644 index 000000000..ca30cd816 --- /dev/null +++ b/src/eepp/ui/uilistboxitem.cpp @@ -0,0 +1,127 @@ +#include +#include +#include + +namespace EE { namespace UI { + +UIListBoxItem::UIListBoxItem( const UITextBox::CreateParams& Params ) : + UITextBox( Params ) +{ + ApplyDefaultTheme(); +} + +UIListBoxItem::~UIListBoxItem() { + if ( UIManager::instance()->FocusControl() == this ) + mParentCtrl->SetFocus(); + + if ( UIManager::instance()->OverControl() == this ) + UIManager::instance()->OverControl( mParentCtrl ); +} + +Uint32 UIListBoxItem::Type() const { + return UI_TYPE_LISTBOXITEM; +} + +bool UIListBoxItem::IsType( const Uint32& type ) const { + return UIListBoxItem::Type() == type ? true : UITextBox::IsType( type ); +} + +void UIListBoxItem::SetTheme( UITheme * Theme ) { + UIControl::SetThemeControl( Theme, "listboxitem" ); +} + +Uint32 UIListBoxItem::OnMouseClick( const Vector2i& Pos, const Uint32 Flags ) { + if ( Flags & EE_BUTTONS_LRM ) { + reinterpret_cast ( Parent()->Parent() )->ItemClicked( this ); + + Select(); + } + + return 1; +} + +void UIListBoxItem::Select() { + UIListBox * LBParent = reinterpret_cast ( Parent()->Parent() ); + + bool wasSelected = 0 != ( mControlFlags & UI_CTRL_FLAG_SELECTED ); + + if ( LBParent->IsMultiSelect() ) { + if ( !wasSelected ) { + SetSkinState( UISkinState::StateSelected ); + + mControlFlags |= UI_CTRL_FLAG_SELECTED; + + LBParent->mSelected.push_back( LBParent->GetItemIndex( this ) ); + + LBParent->OnSelected(); + } else { + mControlFlags &= ~UI_CTRL_FLAG_SELECTED; + + LBParent->mSelected.remove( LBParent->GetItemIndex( this ) ); + } + } else { + SetSkinState( UISkinState::StateSelected ); + + mControlFlags |= UI_CTRL_FLAG_SELECTED; + + LBParent->mSelected.clear(); + LBParent->mSelected.push_back( LBParent->GetItemIndex( this ) ); + + if ( !wasSelected ) { + LBParent->OnSelected(); + } + } +} + +void UIListBoxItem::Update() { + UITextBox::Update(); + + if ( mEnabled && mVisible ) { + UIListBox * LBParent = reinterpret_cast ( Parent()->Parent() ); + Uint32 Flags = UIManager::instance()->GetInput()->ClickTrigger(); + + if ( IsMouseOver() ) { + if ( Flags & EE_BUTTONS_WUWD && LBParent->VerticalScrollBar()->Visible() ) { + LBParent->VerticalScrollBar()->Slider()->ManageClick( Flags ); + } + } + } +} + +Uint32 UIListBoxItem::OnMouseExit( const Vector2i& Pos, const Uint32 Flags ) { + UIControl::OnMouseExit( Pos, Flags ); + + if ( mControlFlags & UI_CTRL_FLAG_SELECTED ) + SetSkinState( UISkinState::StateSelected ); + + return 1; +} + +void UIListBoxItem::Unselect() { + if ( mControlFlags & UI_CTRL_FLAG_SELECTED ) + mControlFlags &= ~UI_CTRL_FLAG_SELECTED; + + SetSkinState( UISkinState::StateNormal ); +} + +bool UIListBoxItem::Selected() const { + return 0 != ( mControlFlags & UI_CTRL_FLAG_SELECTED ); +} + +void UIListBoxItem::OnStateChange() { + UIListBox * LBParent = reinterpret_cast ( Parent()->Parent() ); + + if ( Selected() && mSkinState->GetState() != UISkinState::StateSelected ) { + SetSkinState( UISkinState::StateSelected ); + } + + if ( mSkinState->GetState() == UISkinState::StateSelected ) { + Color( LBParent->FontSelectedColor() ); + } else if ( mSkinState->GetState() == UISkinState::StateMouseEnter ) { + Color( LBParent->FontOverColor() ); + } else { + Color( LBParent->FontColor() ); + } +} + +}} diff --git a/src/eepp/ui/cuimanager.cpp b/src/eepp/ui/uimanager.cpp similarity index 60% rename from src/eepp/ui/cuimanager.cpp rename to src/eepp/ui/uimanager.cpp index 1aef82eaa..21a7bfe09 100644 --- a/src/eepp/ui/cuimanager.cpp +++ b/src/eepp/ui/uimanager.cpp @@ -1,4 +1,4 @@ -#include +#include #include #include #include @@ -6,9 +6,9 @@ namespace EE { namespace UI { -SINGLETON_DECLARE_IMPLEMENTATION(cUIManager) +SINGLETON_DECLARE_IMPLEMENTATION(UIManager) -cUIManager::cUIManager() : +UIManager::UIManager() : mWindow( NULL ), mKM( NULL ), mControl( NULL ), @@ -29,11 +29,11 @@ cUIManager::cUIManager() : { } -cUIManager::~cUIManager() { +UIManager::~UIManager() { Shutdown(); } -void cUIManager::Init( Uint32 Flags, EE::Window::Window * window ) { +void UIManager::Init( Uint32 Flags, EE::Window::Window * window ) { if ( mInit ) Shutdown(); @@ -48,7 +48,7 @@ void cUIManager::Init( Uint32 Flags, EE::Window::Window * window ) { mInit = true; - cUIWindow::CreateParams Params; + UIWindow::CreateParams Params; Params.Parent( NULL ); Params.PosSet( 0, 0 ); Params.SizeSet( Engine::instance()->GetWidth(), Engine::instance()->GetHeight() ); @@ -58,7 +58,7 @@ void cUIManager::Init( Uint32 Flags, EE::Window::Window * window ) { Params.DecorationSize = Sizei( 0, 0 ); Params.DecorationAutoSize = false; - mControl = eeNew( cUIWindow, ( Params ) ); + mControl = eeNew( UIWindow, ( Params ) ); mControl->Visible( true ); mControl->Enabled( true ); mControl->Container()->Enabled( false ); @@ -67,11 +67,11 @@ void cUIManager::Init( Uint32 Flags, EE::Window::Window * window ) { mFocusControl = mControl; mOverControl = mControl; - mCbId = mKM->PushCallback( cb::Make1( this, &cUIManager::InputCallback ) ); - mResizeCb = mWindow->PushResizeCallback( cb::Make1( this, &cUIManager::ResizeControl ) ); + mCbId = mKM->PushCallback( cb::Make1( this, &UIManager::InputCallback ) ); + mResizeCb = mWindow->PushResizeCallback( cb::Make1( this, &UIManager::ResizeControl ) ); } -void cUIManager::Shutdown() { +void UIManager::Shutdown() { if ( mInit ) { if ( -1 != mCbId && NULL != Engine::ExistsSingleton() && @@ -94,10 +94,10 @@ void cUIManager::Shutdown() { mInit = false; } - cUIThemeManager::DestroySingleton(); + UIThemeManager::DestroySingleton(); } -void cUIManager::InputCallback( InputEvent * Event ) { +void UIManager::InputCallback( InputEvent * Event ) { switch( Event->Type ) { case InputEvent::KeyUp: SendKeyUp( Event->key.keysym.sym, Event->key.keysym.unicode, Event->key.keysym.mod ); @@ -110,20 +110,20 @@ void cUIManager::InputCallback( InputEvent * Event ) { } } -void cUIManager::ResizeControl( EE::Window::Window * win ) { +void UIManager::ResizeControl( EE::Window::Window * win ) { mControl->Size( mWindow->GetWidth(), mWindow->GetHeight() ); - SendMsg( mControl, cUIMessage::MsgWindowResize ); + SendMsg( mControl, UIMessage::MsgWindowResize ); - std::list::iterator it; + std::list::iterator it; for ( it = mWindowsList.begin(); it != mWindowsList.end(); it++ ) { - SendMsg( *it, cUIMessage::MsgWindowResize ); + SendMsg( *it, UIMessage::MsgWindowResize ); } } -void cUIManager::SendKeyUp( const Uint32& KeyCode, const Uint16& Char, const Uint32& Mod ) { - cUIEventKey KeyEvent = cUIEventKey( mFocusControl, cUIEvent::EventKeyUp, KeyCode, Char, Mod ); - cUIControl * CtrlLoop = mFocusControl; +void UIManager::SendKeyUp( const Uint32& KeyCode, const Uint16& Char, const Uint32& Mod ) { + UIEventKey KeyEvent = UIEventKey( mFocusControl, UIEvent::EventKeyUp, KeyCode, Char, Mod ); + UIControl * CtrlLoop = mFocusControl; while( NULL != CtrlLoop ) { if ( CtrlLoop->Enabled() && CtrlLoop->OnKeyUp( KeyEvent ) ) @@ -133,9 +133,9 @@ void cUIManager::SendKeyUp( const Uint32& KeyCode, const Uint16& Char, const Uin } } -void cUIManager::SendKeyDown( const Uint32& KeyCode, const Uint16& Char, const Uint32& Mod ) { - cUIEventKey KeyEvent = cUIEventKey( mFocusControl, cUIEvent::EventKeyDown, KeyCode, Char, Mod ); - cUIControl * CtrlLoop = mFocusControl; +void UIManager::SendKeyDown( const Uint32& KeyCode, const Uint16& Char, const Uint32& Mod ) { + UIEventKey KeyEvent = UIEventKey( mFocusControl, UIEvent::EventKeyDown, KeyCode, Char, Mod ); + UIControl * CtrlLoop = mFocusControl; while( NULL != CtrlLoop ) { if ( CtrlLoop->Enabled() && CtrlLoop->OnKeyDown( KeyEvent ) ) @@ -145,61 +145,61 @@ void cUIManager::SendKeyDown( const Uint32& KeyCode, const Uint16& Char, const U } } -cUIControl * cUIManager::FocusControl() const { +UIControl * UIManager::FocusControl() const { return mFocusControl; } -cUIControl * cUIManager::LossFocusControl() const { +UIControl * UIManager::LossFocusControl() const { return mLossFocusControl; } -void cUIManager::FocusControl( cUIControl * Ctrl ) { +void UIManager::FocusControl( UIControl * Ctrl ) { if ( NULL != mFocusControl && NULL != Ctrl && Ctrl != mFocusControl ) { mLossFocusControl = mFocusControl; mFocusControl = Ctrl; mLossFocusControl->OnFocusLoss(); - SendMsg( mLossFocusControl, cUIMessage::MsgFocusLoss ); + SendMsg( mLossFocusControl, UIMessage::MsgFocusLoss ); mFocusControl->OnFocus(); - SendMsg( mFocusControl, cUIMessage::MsgFocus ); + SendMsg( mFocusControl, UIMessage::MsgFocus ); } } -cUIControl * cUIManager::OverControl() const { +UIControl * UIManager::OverControl() const { return mOverControl; } -void cUIManager::OverControl( cUIControl * Ctrl ) { +void UIManager::OverControl( UIControl * Ctrl ) { mOverControl = Ctrl; } -void cUIManager::SendMsg( cUIControl * Ctrl, const Uint32& Msg, const Uint32& Flags ) { - cUIMessage tMsg( Ctrl, Msg, Flags ); +void UIManager::SendMsg( UIControl * Ctrl, const Uint32& Msg, const Uint32& Flags ) { + UIMessage tMsg( Ctrl, Msg, Flags ); Ctrl->MessagePost( &tMsg ); } -void cUIManager::Update() { +void UIManager::Update() { mElapsed = mWindow->Elapsed(); bool wasDraggingControl = IsControlDragging(); mControl->Update(); - cUIControl * pOver = mControl->OverFind( mKM->GetMousePosf() ); + UIControl * pOver = mControl->OverFind( mKM->GetMousePosf() ); if ( pOver != mOverControl ) { if ( NULL != mOverControl ) { - SendMsg( mOverControl, cUIMessage::MsgMouseExit ); + SendMsg( mOverControl, UIMessage::MsgMouseExit ); mOverControl->OnMouseExit( mKM->GetMousePos(), 0 ); } mOverControl = pOver; if ( NULL != mOverControl ) { - SendMsg( mOverControl, cUIMessage::MsgMouseEnter ); + SendMsg( mOverControl, UIMessage::MsgMouseEnter ); mOverControl->OnMouseEnter( mKM->GetMousePos(), 0 ); } } else { @@ -213,7 +213,7 @@ void cUIManager::Update() { if ( NULL != mOverControl ) { mOverControl->OnMouseDown( mKM->GetMousePos(), mKM->PressTrigger() ); - SendMsg( mOverControl, cUIMessage::MsgMouseDown, mKM->PressTrigger() ); + SendMsg( mOverControl, UIMessage::MsgMouseDown, mKM->PressTrigger() ); } if ( !mFirstPress ) { @@ -231,14 +231,14 @@ void cUIManager::Update() { FocusControl( mOverControl ); mFocusControl->OnMouseUp( mKM->GetMousePos(), mKM->ReleaseTrigger() ); - SendMsg( mFocusControl, cUIMessage::MsgMouseUp, mKM->ReleaseTrigger() ); + SendMsg( mFocusControl, UIMessage::MsgMouseUp, mKM->ReleaseTrigger() ); if ( mKM->ClickTrigger() ) { // mDownControl == mOverControl && - SendMsg( mFocusControl, cUIMessage::MsgClick, mKM->ClickTrigger() ); + SendMsg( mFocusControl, UIMessage::MsgClick, mKM->ClickTrigger() ); mFocusControl->OnMouseClick( mKM->GetMousePos(), mKM->ClickTrigger() ); if ( mKM->DoubleClickTrigger() ) { - SendMsg( mFocusControl, cUIMessage::MsgDoubleClick, mKM->DoubleClickTrigger() ); + SendMsg( mFocusControl, UIMessage::MsgDoubleClick, mKM->DoubleClickTrigger() ); mFocusControl->OnMouseDoubleClick( mKM->GetMousePos(), mKM->DoubleClickTrigger() ); } } @@ -251,117 +251,117 @@ void cUIManager::Update() { CheckClose(); } -cUIControl * cUIManager::DownControl() const { +UIControl * UIManager::DownControl() const { return mDownControl; } -void cUIManager::Draw() { +void UIManager::Draw() { GlobalBatchRenderer::instance()->Draw(); mControl->InternalDraw(); GlobalBatchRenderer::instance()->Draw(); } -cUIWindow * cUIManager::MainControl() const { +UIWindow * UIManager::MainControl() const { return mControl; } -const Time& cUIManager::Elapsed() const { +const Time& UIManager::Elapsed() const { return mElapsed; } -Vector2i cUIManager::GetMousePos() { +Vector2i UIManager::GetMousePos() { return mKM->GetMousePos(); } -Input * cUIManager::GetInput() const { +Input * UIManager::GetInput() const { return mKM; } -const Uint32& cUIManager::PressTrigger() const { +const Uint32& UIManager::PressTrigger() const { return mKM->PressTrigger(); } -const Uint32& cUIManager::LastPressTrigger() const { +const Uint32& UIManager::LastPressTrigger() const { return mKM->LastPressTrigger(); } -void cUIManager::ClipEnable( const Int32& x, const Int32& y, const Uint32& Width, const Uint32& Height ) { +void UIManager::ClipEnable( const Int32& x, const Int32& y, const Uint32& Width, const Uint32& Height ) { mWindow->ClipPlaneEnable( x, y, Width, Height ); } -void cUIManager::ClipDisable() { +void UIManager::ClipDisable() { mWindow->ClipPlaneDisable(); } -void cUIManager::HighlightFocus( bool Highlight ) { +void UIManager::HighlightFocus( bool Highlight ) { BitOp::SetBitFlagValue( &mFlags, UI_MANAGER_HIGHLIGHT_FOCUS, Highlight ? 1 : 0 ); } -bool cUIManager::HighlightFocus() const { +bool UIManager::HighlightFocus() const { return 0 != ( mFlags & UI_MANAGER_HIGHLIGHT_FOCUS ); } -void cUIManager::HighlightFocusColor( const ColorA& Color ) { +void UIManager::HighlightFocusColor( const ColorA& Color ) { mHighlightFocusColor = Color; } -const ColorA& cUIManager::HighlightFocusColor() const { +const ColorA& UIManager::HighlightFocusColor() const { return mHighlightFocusColor; } -void cUIManager::HighlightOver( bool Highlight ) { +void UIManager::HighlightOver( bool Highlight ) { BitOp::SetBitFlagValue( &mFlags, UI_MANAGER_HIGHLIGHT_OVER, Highlight ? 1 : 0 ); } -bool cUIManager::HighlightOver() const { +bool UIManager::HighlightOver() const { return 0 != ( mFlags & UI_MANAGER_HIGHLIGHT_OVER ); } -void cUIManager::HighlightOverColor( const ColorA& Color ) { +void UIManager::HighlightOverColor( const ColorA& Color ) { mHighlightOverColor = Color; } -const ColorA& cUIManager::HighlightOverColor() const { +const ColorA& UIManager::HighlightOverColor() const { return mHighlightOverColor; } -void cUIManager::CheckTabPress( const Uint32& KeyCode ) { +void UIManager::CheckTabPress( const Uint32& KeyCode ) { eeASSERT( NULL != mFocusControl ); if ( KeyCode == KEY_TAB ) { - cUIControl * Ctrl = mFocusControl->NextComplexControl(); + UIControl * Ctrl = mFocusControl->NextComplexControl(); if ( NULL != Ctrl ) Ctrl->SetFocus(); } } -void cUIManager::SendMouseClick( cUIControl * ToCtrl, const Vector2i& Pos, const Uint32 Flags ) { - SendMsg( ToCtrl, cUIMessage::MsgClick, Flags ); +void UIManager::SendMouseClick( UIControl * ToCtrl, const Vector2i& Pos, const Uint32 Flags ) { + SendMsg( ToCtrl, UIMessage::MsgClick, Flags ); ToCtrl->OnMouseClick( Pos, Flags ); } -void cUIManager::SendMouseUp( cUIControl * ToCtrl, const Vector2i& Pos, const Uint32 Flags ) { - SendMsg( ToCtrl, cUIMessage::MsgMouseUp, Flags ); +void UIManager::SendMouseUp( UIControl * ToCtrl, const Vector2i& Pos, const Uint32 Flags ) { + SendMsg( ToCtrl, UIMessage::MsgMouseUp, Flags ); ToCtrl->OnMouseUp( Pos, Flags ); } -void cUIManager::SendMouseDown( cUIControl * ToCtrl, const Vector2i& Pos, const Uint32 Flags ) { - SendMsg( ToCtrl, cUIMessage::MsgMouseDown, Flags ); +void UIManager::SendMouseDown( UIControl * ToCtrl, const Vector2i& Pos, const Uint32 Flags ) { + SendMsg( ToCtrl, UIMessage::MsgMouseDown, Flags ); ToCtrl->OnMouseDown( Pos, Flags ); } -EE::Window::Window * cUIManager::GetWindow() const { +EE::Window::Window * UIManager::GetWindow() const { return mWindow; } -void cUIManager::SetFocusLastWindow( cUIWindow * window ) { +void UIManager::SetFocusLastWindow( UIWindow * window ) { if ( !mWindowsList.empty() && window != mWindowsList.front() ) { FocusControl( mWindowsList.front() ); } } -void cUIManager::WindowAdd( cUIWindow * win ) { +void UIManager::WindowAdd( UIWindow * win ) { if ( !WindowExists( win ) ) { mWindowsList.push_front( win ); } else { @@ -371,29 +371,29 @@ void cUIManager::WindowAdd( cUIWindow * win ) { } } -void cUIManager::WindowRemove( cUIWindow * win ) { +void UIManager::WindowRemove( UIWindow * win ) { if ( WindowExists( win ) ) { mWindowsList.remove( win ); } } -bool cUIManager::WindowExists( cUIWindow * win ) { +bool UIManager::WindowExists( UIWindow * win ) { return mWindowsList.end() != std::find( mWindowsList.begin(), mWindowsList.end(), win ); } -const bool& cUIManager::IsShootingDown() const { +const bool& UIManager::IsShootingDown() const { return mShootingDown; } -const Vector2i &cUIManager::GetMouseDownPos() const { +const Vector2i &UIManager::GetMouseDownPos() const { return mMouseDownPos; } -void cUIManager::AddToCloseQueue( cUIControl * Ctrl ) { +void UIManager::AddToCloseQueue( UIControl * Ctrl ) { eeASSERT( NULL != Ctrl ); - std::list::iterator it; - cUIControl * itCtrl = NULL; + std::list::iterator it; + UIControl * itCtrl = NULL; for ( it = mCloseList.begin(); it != mCloseList.end(); it++ ) { itCtrl = *it; @@ -406,7 +406,7 @@ void cUIManager::AddToCloseQueue( cUIControl * Ctrl ) { } } - std::list< std::list::iterator > itEraseList; + std::list< std::list::iterator > itEraseList; for ( it = mCloseList.begin(); it != mCloseList.end(); it++ ) { itCtrl = *it; @@ -423,7 +423,7 @@ void cUIManager::AddToCloseQueue( cUIControl * Ctrl ) { // We delete all the controls that don't need to be deleted // because of the new added control to the queue - std::list< std::list::iterator >::iterator ite; + std::list< std::list::iterator >::iterator ite; for ( ite = itEraseList.begin(); ite != itEraseList.end(); ite++ ) { mCloseList.erase( *ite ); @@ -432,9 +432,9 @@ void cUIManager::AddToCloseQueue( cUIControl * Ctrl ) { mCloseList.push_back( Ctrl ); } -void cUIManager::CheckClose() { +void UIManager::CheckClose() { if ( !mCloseList.empty() ) { - for ( std::list::iterator it = mCloseList.begin(); it != mCloseList.end(); it++ ) { + for ( std::list::iterator it = mCloseList.begin(); it != mCloseList.end(); it++ ) { eeDelete( *it ); } @@ -442,23 +442,23 @@ void cUIManager::CheckClose() { } } -void cUIManager::SetControlDragging( bool dragging ) { +void UIManager::SetControlDragging( bool dragging ) { mControlDragging = dragging; } -const bool& cUIManager::IsControlDragging() const { +const bool& UIManager::IsControlDragging() const { return mControlDragging; } -void cUIManager::UseGlobalCursors( const bool& use ) { +void UIManager::UseGlobalCursors( const bool& use ) { mUseGlobalCursors = use; } -const bool& cUIManager::UseGlobalCursors() { +const bool& UIManager::UseGlobalCursors() { return mUseGlobalCursors; } -void cUIManager::SetCursor( EE_CURSOR_TYPE cursor ) { +void UIManager::SetCursor( EE_CURSOR_TYPE cursor ) { if ( mUseGlobalCursors ) { mWindow->GetCursorManager()->Set( cursor ); } diff --git a/src/eepp/ui/cuimenu.cpp b/src/eepp/ui/uimenu.cpp similarity index 74% rename from src/eepp/ui/cuimenu.cpp rename to src/eepp/ui/uimenu.cpp index 781e666d7..568b20d4f 100644 --- a/src/eepp/ui/cuimenu.cpp +++ b/src/eepp/ui/uimenu.cpp @@ -1,11 +1,11 @@ -#include -#include +#include +#include #include namespace EE { namespace UI { -cUIMenu::cUIMenu( cUIMenu::CreateParams& Params ) : - cUIComplexControl( Params ), +UIMenu::UIMenu( UIMenu::CreateParams& Params ) : + UIComplexControl( Params ), mPadding( Params.PaddingContainer ), mFont( Params.Font ), mFontColor( Params.FontColor ), @@ -29,30 +29,30 @@ cUIMenu::cUIMenu( cUIMenu::CreateParams& Params ) : ApplyDefaultTheme(); } -cUIMenu::~cUIMenu() { +UIMenu::~UIMenu() { } -Uint32 cUIMenu::Type() const { +Uint32 UIMenu::Type() const { return UI_TYPE_MENU; } -bool cUIMenu::IsType( const Uint32& type ) const { - return cUIMenu::Type() == type ? true : cUIComplexControl::IsType( type ); +bool UIMenu::IsType( const Uint32& type ) const { + return UIMenu::Type() == type ? true : UIComplexControl::IsType( type ); } -void cUIMenu::SetTheme( cUITheme * Theme ) { - cUIControl::SetThemeControl( Theme, "menu" ); +void UIMenu::SetTheme( UITheme * Theme ) { + UIControl::SetThemeControl( Theme, "menu" ); DoAfterSetTheme(); } -void cUIMenu::DoAfterSetTheme() { +void UIMenu::DoAfterSetTheme() { AutoPadding(); OnSizeChange(); } -cUIMenuItem * cUIMenu::CreateMenuItem( const String& Text, SubTexture * Icon ) { - cUIMenuItem::CreateParams Params; +UIMenuItem * UIMenu::CreateMenuItem( const String& Text, SubTexture * Icon ) { + UIMenuItem::CreateParams Params; Params.Parent( this ); Params.Font = mFont; Params.FontColor = mFontColor; @@ -71,7 +71,7 @@ cUIMenuItem * cUIMenu::CreateMenuItem( const String& Text, SubTexture * Icon ) { Params.Flags = UI_CLIP_ENABLE | UI_VALIGN_CENTER | UI_HALIGN_LEFT; } - cUIMenuItem * tCtrl = eeNew( cUIMenuItem, ( Params ) ); + UIMenuItem * tCtrl = eeNew( UIMenuItem, ( Params ) ); tCtrl->Text( Text ); tCtrl->Visible( true ); @@ -80,12 +80,12 @@ cUIMenuItem * cUIMenu::CreateMenuItem( const String& Text, SubTexture * Icon ) { return tCtrl; } -Uint32 cUIMenu::Add( const String& Text, SubTexture * Icon ) { +Uint32 UIMenu::Add( const String& Text, SubTexture * Icon ) { return Add( CreateMenuItem( Text, Icon ) ); } -cUIMenuCheckBox * cUIMenu::CreateMenuCheckBox( const String& Text, const bool &Active ) { - cUIMenuCheckBox::CreateParams Params; +UIMenuCheckBox * UIMenu::CreateMenuCheckBox( const String& Text, const bool &Active ) { + UIMenuCheckBox::CreateParams Params; Params.Parent( this ); Params.Font = mFont; Params.FontColor = mFontColor; @@ -104,7 +104,7 @@ cUIMenuCheckBox * cUIMenu::CreateMenuCheckBox( const String& Text, const bool &A Params.Flags = UI_CLIP_ENABLE | UI_VALIGN_CENTER | UI_HALIGN_LEFT; } - cUIMenuCheckBox * tCtrl = eeNew( cUIMenuCheckBox, ( Params ) ); + UIMenuCheckBox * tCtrl = eeNew( UIMenuCheckBox, ( Params ) ); tCtrl->Text( Text ); tCtrl->Visible( true ); @@ -116,12 +116,12 @@ cUIMenuCheckBox * cUIMenu::CreateMenuCheckBox( const String& Text, const bool &A return tCtrl; } -Uint32 cUIMenu::AddCheckBox( const String& Text, const bool& Active ) { +Uint32 UIMenu::AddCheckBox( const String& Text, const bool& Active ) { return Add( CreateMenuCheckBox( Text, Active ) ); } -cUIMenuSubMenu * cUIMenu::CreateSubMenu( const String& Text, SubTexture * Icon, cUIMenu * SubMenu ) { - cUIMenuSubMenu::CreateParams Params; +UIMenuSubMenu * UIMenu::CreateSubMenu( const String& Text, SubTexture * Icon, UIMenu * SubMenu ) { + UIMenuSubMenu::CreateParams Params; Params.Parent( this ); Params.Font = mFont; Params.FontColor = mFontColor; @@ -141,7 +141,7 @@ cUIMenuSubMenu * cUIMenu::CreateSubMenu( const String& Text, SubTexture * Icon, Params.Flags = UI_CLIP_ENABLE | UI_VALIGN_CENTER | UI_HALIGN_LEFT; } - cUIMenuSubMenu * tCtrl = eeNew( cUIMenuSubMenu, ( Params ) ); + UIMenuSubMenu * tCtrl = eeNew( UIMenuSubMenu, ( Params ) ); tCtrl->Text( Text ); tCtrl->Visible( true ); @@ -150,13 +150,13 @@ cUIMenuSubMenu * cUIMenu::CreateSubMenu( const String& Text, SubTexture * Icon, return tCtrl; } -Uint32 cUIMenu::AddSubMenu( const String& Text, SubTexture * Icon, cUIMenu * SubMenu ) { +Uint32 UIMenu::AddSubMenu( const String& Text, SubTexture * Icon, UIMenu * SubMenu ) { return Add( CreateSubMenu( Text, Icon, SubMenu ) ); } -bool cUIMenu::CheckControlSize( cUIControl * Control, const bool& Resize ) { +bool UIMenu::CheckControlSize( UIControl * Control, const bool& Resize ) { if ( Control->IsType( UI_TYPE_MENUITEM ) ) { - cUIMenuItem * tItem = reinterpret_cast ( Control ); + UIMenuItem * tItem = reinterpret_cast ( Control ); if ( NULL != tItem->Icon() && tItem->IconHorizontalMargin() + tItem->Icon()->Size().Width() > (Int32)mBiggestIcon ) { mBiggestIcon = tItem->IconHorizontalMargin() + tItem->Icon()->Size().Width(); @@ -164,7 +164,7 @@ bool cUIMenu::CheckControlSize( cUIControl * Control, const bool& Resize ) { if ( mFlags & UI_AUTO_SIZE ) { if ( Control->IsType( UI_TYPE_MENUSUBMENU ) ) { - cUIMenuSubMenu * tMenu = reinterpret_cast ( tItem ); + UIMenuSubMenu * tMenu = reinterpret_cast ( tItem ); if ( tMenu->TextBox()->GetTextWidth() + mBiggestIcon + tMenu->Arrow()->Size().Width() + mMinRightMargin > (Int32)mMaxWidth - mPadding.Left - mPadding.Right ) { mMaxWidth = tMenu->TextBox()->GetTextWidth() + mBiggestIcon + mPadding.Left + mPadding.Right + tMenu->Arrow()->Size().Width() + mMinRightMargin; @@ -193,7 +193,7 @@ bool cUIMenu::CheckControlSize( cUIControl * Control, const bool& Resize ) { return false; } -Uint32 cUIMenu::Add( cUIControl * Control ) { +Uint32 UIMenu::Add( UIControl * Control ) { if ( this != Control->Parent() ) Control->Parent( this ); @@ -212,7 +212,7 @@ Uint32 cUIMenu::Add( cUIControl * Control ) { return mItems.size() - 1; } -void cUIMenu::SetControlSize( cUIControl * Control, const Uint32& Pos ) { +void UIMenu::SetControlSize( UIControl * Control, const Uint32& Pos ) { if ( Control->IsType( UI_TYPE_MENUITEM ) ) { Control->Size( mSize.Width() - mPadding.Left - mPadding.Right, mRowHeight ); } else { @@ -220,13 +220,13 @@ void cUIMenu::SetControlSize( cUIControl * Control, const Uint32& Pos ) { } } -Uint32 cUIMenu::AddSeparator() { - cUISeparator::CreateParams Params; +Uint32 UIMenu::AddSeparator() { + UISeparator::CreateParams Params; Params.Parent( this ); Params.PosSet( mPadding.Left, mPadding.Top + mNextPosY ); Params.Size = Sizei( mSize.Width() - mPadding.Left - mPadding.Right, 3 ); - cUISeparator * Control = eeNew( cUISeparator, ( Params ) ); + UISeparator * Control = eeNew( UISeparator, ( Params ) ); Control->Visible( true ); Control->Enabled( true ); @@ -240,15 +240,15 @@ Uint32 cUIMenu::AddSeparator() { return mItems.size() - 1; } -cUIControl * cUIMenu::GetItem( const Uint32& Index ) { +UIControl * UIMenu::GetItem( const Uint32& Index ) { eeASSERT( Index < mItems.size() ); return mItems[ Index ]; } -cUIControl * cUIMenu::GetItem( const String& Text ) { +UIControl * UIMenu::GetItem( const String& Text ) { for ( Uint32 i = 0; i < mItems.size(); i++ ) { if ( mItems[i]->IsType( UI_TYPE_MENUITEM ) ) { - cUIMenuItem * tMenuItem = reinterpret_cast( mItems[i] ); + UIMenuItem * tMenuItem = reinterpret_cast( mItems[i] ); if ( tMenuItem->Text() == Text ) return tMenuItem; @@ -258,7 +258,7 @@ cUIControl * cUIMenu::GetItem( const String& Text ) { return NULL; } -Uint32 cUIMenu::GetItemIndex( cUIControl * Item ) { +Uint32 UIMenu::GetItemIndex( UIControl * Item ) { for ( Uint32 i = 0; i < mItems.size(); i++ ) { if ( mItems[i] == Item ) return i; @@ -267,11 +267,11 @@ Uint32 cUIMenu::GetItemIndex( cUIControl * Item ) { return eeINDEX_NOT_FOUND; } -Uint32 cUIMenu::Count() const { +Uint32 UIMenu::Count() const { return mItems.size(); } -void cUIMenu::Remove( const Uint32& Index ) { +void UIMenu::Remove( const Uint32& Index ) { eeASSERT( Index < mItems.size() ); eeSAFE_DELETE( mItems[ Index ] ); @@ -282,7 +282,7 @@ void cUIMenu::Remove( const Uint32& Index ) { ResizeControls(); } -void cUIMenu::Remove( cUIControl * Ctrl ) { +void UIMenu::Remove( UIControl * Ctrl ) { for ( Uint32 i = 0; i < mItems.size(); i++ ) { if ( mItems[i] == Ctrl ) { Remove( i ); @@ -291,7 +291,7 @@ void cUIMenu::Remove( cUIControl * Ctrl ) { } } -void cUIMenu::RemoveAll() { +void UIMenu::RemoveAll() { for ( Uint32 i = 0; i < mItems.size(); i++ ) { eeSAFE_DELETE( mItems[ i ] ); } @@ -303,11 +303,11 @@ void cUIMenu::RemoveAll() { ResizeMe(); } -void cUIMenu::Insert( const String& Text, SubTexture * Icon, const Uint32& Index ) { +void UIMenu::Insert( const String& Text, SubTexture * Icon, const Uint32& Index ) { Insert( CreateMenuItem( Text, Icon ), Index ); } -void cUIMenu::Insert( cUIControl * Control, const Uint32& Index ) { +void UIMenu::Insert( UIControl * Control, const Uint32& Index ) { mItems.insert( mItems.begin() + Index, Control ); ChildAddAt( Control, Index ); @@ -316,10 +316,10 @@ void cUIMenu::Insert( cUIControl * Control, const Uint32& Index ) { ResizeControls(); } -bool cUIMenu::IsSubMenu( cUIControl * Ctrl ) { +bool UIMenu::IsSubMenu( UIControl * Ctrl ) { for ( Uint32 i = 0; i < mItems.size(); i++ ) { if ( mItems[i]->IsType( UI_TYPE_MENUSUBMENU ) ) { - cUIMenuSubMenu * tMenu = reinterpret_cast ( mItems[i] ); + UIMenuSubMenu * tMenu = reinterpret_cast ( mItems[i] ); if ( tMenu->SubMenu() == Ctrl ) return true; @@ -329,20 +329,20 @@ bool cUIMenu::IsSubMenu( cUIControl * Ctrl ) { return false; } -Uint32 cUIMenu::OnMessage( const cUIMessage * Msg ) { +Uint32 UIMenu::OnMessage( const UIMessage * Msg ) { switch ( Msg->Msg() ) { - case cUIMessage::MsgMouseUp: + case UIMessage::MsgMouseUp: { if ( Msg->Sender()->Parent() == this && ( Msg->Flags() & EE_BUTTONS_LRM ) ) { - cUIEvent ItemEvent( Msg->Sender(), cUIEvent::EventOnItemClicked ); + UIEvent ItemEvent( Msg->Sender(), UIEvent::EventOnItemClicked ); SendEvent( &ItemEvent ); } return 1; } - case cUIMessage::MsgFocusLoss: + case UIMessage::MsgFocusLoss: { - cUIControl * FocusCtrl = cUIManager::instance()->FocusControl(); + UIControl * FocusCtrl = UIManager::instance()->FocusControl(); if ( this != FocusCtrl && !IsParentOf( FocusCtrl ) && !IsSubMenu( FocusCtrl ) ) { OnComplexControlFocusLoss(); @@ -355,7 +355,7 @@ Uint32 cUIMenu::OnMessage( const cUIMessage * Msg ) { return 0; } -void cUIMenu::OnSizeChange() { +void UIMenu::OnSizeChange() { if ( NULL != mFont && ( ( mFlags & UI_AUTO_SIZE ) || 0 == mRowHeight ) ) { mRowHeight = mFont->GetFontHeight() + 8; } @@ -365,13 +365,13 @@ void cUIMenu::OnSizeChange() { } } -void cUIMenu::AutoPadding() { +void UIMenu::AutoPadding() { if ( mFlags & UI_AUTO_PADDING ) { mPadding = MakePadding(); } } -void cUIMenu::ResizeControls() { +void UIMenu::ResizeControls() { ResizeMe(); for ( Uint32 i = 0; i < mItems.size(); i++ ) { @@ -379,7 +379,7 @@ void cUIMenu::ResizeControls() { } } -void cUIMenu::ReposControls() { +void UIMenu::ReposControls() { Uint32 i; mNextPosY = 0; mBiggestIcon = mMinSpaceForIcons; @@ -401,7 +401,7 @@ void cUIMenu::ReposControls() { ResizeMe(); } -void cUIMenu::ResizeMe() { +void UIMenu::ResizeMe() { if ( mFlags & UI_AUTO_SIZE ) { Size( mMaxWidth, mNextPosY + mPadding.Top + mPadding.Bottom ); } else { @@ -409,18 +409,18 @@ void cUIMenu::ResizeMe() { } } -bool cUIMenu::Show() { +bool UIMenu::Show() { Enabled( true ); Visible( true ); return true; } -bool cUIMenu::Hide() { +bool UIMenu::Hide() { Enabled( false ); Visible( false ); if ( NULL != mItemSelected ) - mItemSelected->SetSkinState( cUISkinState::StateNormal ); + mItemSelected->SetSkinState( UISkinState::StateNormal ); mItemSelected = NULL; mItemSelectedIndex = eeINDEX_NOT_FOUND; @@ -428,20 +428,20 @@ bool cUIMenu::Hide() { return true; } -void cUIMenu::SetItemSelected( cUIControl * Item ) { +void UIMenu::SetItemSelected( UIControl * Item ) { if ( NULL != mItemSelected ) { if ( mItemSelected->IsType( UI_TYPE_MENUSUBMENU ) ) { - cUIMenuSubMenu * tMenu = reinterpret_cast ( mItemSelected ); + UIMenuSubMenu * tMenu = reinterpret_cast ( mItemSelected ); if ( NULL != tMenu->SubMenu() ) tMenu->SubMenu()->Hide(); } - mItemSelected->SetSkinState( cUISkinState::StateNormal ); + mItemSelected->SetSkinState( UISkinState::StateNormal ); } if ( NULL != Item ) - Item->SetSkinState( cUISkinState::StateSelected ); + Item->SetSkinState( UISkinState::StateSelected ); if ( mItemSelected != Item ) { mItemSelected = Item; @@ -449,7 +449,7 @@ void cUIMenu::SetItemSelected( cUIControl * Item ) { } } -void cUIMenu::TrySelect( cUIControl * Ctrl, bool Up ) { +void UIMenu::TrySelect( UIControl * Ctrl, bool Up ) { if ( mItems.size() ) { if ( !Ctrl->IsType( UI_TYPE_SEPARATOR ) ) { SetItemSelected( Ctrl ); @@ -483,7 +483,7 @@ void cUIMenu::TrySelect( cUIControl * Ctrl, bool Up ) { } } -void cUIMenu::NextSel() { +void UIMenu::NextSel() { if ( mItems.size() ) { if ( mItemSelectedIndex != eeINDEX_NOT_FOUND ) { if ( mItemSelectedIndex + 1 < mItems.size() ) { @@ -497,7 +497,7 @@ void cUIMenu::NextSel() { } } -void cUIMenu::PrevSel() { +void UIMenu::PrevSel() { if ( mItems.size() ) { if ( mItemSelectedIndex != eeINDEX_NOT_FOUND ) { if ( mItemSelectedIndex >= 1 ) { @@ -511,7 +511,7 @@ void cUIMenu::PrevSel() { } } -Uint32 cUIMenu::OnKeyDown( const cUIEventKey& Event ) { +Uint32 UIMenu::OnKeyDown( const UIEventKey& Event ) { if ( Sys::GetTicks() - mLastTickMove > 50 ) { switch ( Event.KeyCode() ) { case KEY_DOWN: @@ -526,7 +526,7 @@ Uint32 cUIMenu::OnKeyDown( const cUIEventKey& Event ) { break; case KEY_RIGHT: if ( NULL != mItemSelected && ( mItemSelected->IsType( UI_TYPE_MENUSUBMENU ) ) ) { - cUIMenuSubMenu * tMenu = reinterpret_cast ( mItemSelected ); + UIMenuSubMenu * tMenu = reinterpret_cast ( mItemSelected ); tMenu->ShowSubMenu(); } @@ -542,9 +542,9 @@ Uint32 cUIMenu::OnKeyDown( const cUIEventKey& Event ) { break; case KEY_RETURN: if ( NULL != mItemSelected ) { - mItemSelected->SendMouseEvent(cUIEvent::EventMouseClick, cUIManager::instance()->GetMousePos(), EE_BUTTONS_ALL ); + mItemSelected->SendMouseEvent(UIEvent::EventMouseClick, UIManager::instance()->GetMousePos(), EE_BUTTONS_ALL ); - cUIMessage Msg( mItemSelected, cUIMessage::MsgMouseUp, EE_BUTTONS_ALL ); + UIMessage Msg( mItemSelected, UIMessage::MsgMouseUp, EE_BUTTONS_ALL ); mItemSelected->MessagePost( &Msg ); } @@ -552,15 +552,15 @@ Uint32 cUIMenu::OnKeyDown( const cUIEventKey& Event ) { } } - return cUIComplexControl::OnKeyDown( Event ); + return UIComplexControl::OnKeyDown( Event ); } -const Recti& cUIMenu::Padding() const { +const Recti& UIMenu::Padding() const { return mPadding; } -void cUIMenu::FixMenuPos( Vector2i& Pos, cUIMenu * Menu, cUIMenu * Parent, cUIMenuSubMenu * SubMenu ) { - eeAABB qScreen( 0.f, 0.f, cUIManager::instance()->MainControl()->Size().Width(), cUIManager::instance()->MainControl()->Size().Height() ); +void UIMenu::FixMenuPos( Vector2i& Pos, UIMenu * Menu, UIMenu * Parent, UIMenuSubMenu * SubMenu ) { + eeAABB qScreen( 0.f, 0.f, UIManager::instance()->MainControl()->Size().Width(), UIManager::instance()->MainControl()->Size().Height() ); eeAABB qPos( Pos.x, Pos.y, Pos.x + Menu->Size().Width(), Pos.y + Menu->Size().Height() ); if ( NULL != Parent && NULL != SubMenu ) { diff --git a/src/eepp/ui/uimenucheckbox.cpp b/src/eepp/ui/uimenucheckbox.cpp new file mode 100644 index 000000000..6f14ce911 --- /dev/null +++ b/src/eepp/ui/uimenucheckbox.cpp @@ -0,0 +1,106 @@ +#include +#include + +namespace EE { namespace UI { + +UIMenuCheckBox::UIMenuCheckBox( UIMenuCheckBox::CreateParams& Params ) : + UIMenuItem( Params ), + mActive( false ), + mSkinActive( NULL ), + mSkinInactive( NULL ) +{ + ApplyDefaultTheme(); +} + +UIMenuCheckBox::~UIMenuCheckBox() { +} + +Uint32 UIMenuCheckBox::Type() const { + return UI_TYPE_MENUCHECKBOX; +} + +bool UIMenuCheckBox::IsType( const Uint32& type ) const { + return UIMenuCheckBox::Type() == type ? true : UIMenuItem::IsType( type ); +} + +void UIMenuCheckBox::SetTheme( UITheme * Theme ) { + UIControl::SetThemeControl( Theme, "menuitem" ); + + mSkinActive = Theme->GetByName( Theme->Abbr() + "_" + "menucheckbox_active" ); + mSkinInactive = Theme->GetByName( Theme->Abbr() + "_" + "menucheckbox_inactive" ); + + Active( mActive ); + + DoAfterSetTheme(); +} + +const bool& UIMenuCheckBox::Active() const { + return mActive; +} + +const bool& UIMenuCheckBox::IsActive() const { + return Active(); +} + +void UIMenuCheckBox::Active( const bool& active ) { + bool oActive = mActive; + mActive = active; + + if ( mActive ) { + if ( NULL != mSkinActive ) { + if ( mSkinState->GetState() == UISkinState::StateSelected ) + Icon( mSkinActive->GetSubTexture( UISkinState::StateMouseEnter ) ); + else + Icon( mSkinActive->GetSubTexture( UISkinState::StateNormal ) ); + } else + mIcon->SubTexture( NULL ); + } else { + if ( NULL != mSkinInactive ) + if ( mSkinState->GetState() == UISkinState::StateSelected ) + Icon( mSkinInactive->GetSubTexture( UISkinState::StateMouseEnter ) ); + else + Icon( mSkinInactive->GetSubTexture( UISkinState::StateNormal ) ); + else + mIcon->SubTexture( NULL ); + } + + if ( oActive != active ) { + UIMenu * Menu = reinterpret_cast ( Parent() ); + + if ( !Menu->CheckControlSize( this ) ) { + if ( NULL != Icon()->SubTexture() ) { + Padding( Recti( 0, 0, 0, 0 ) ); + } + } + + OnValueChange(); + } +} + +void UIMenuCheckBox::SwitchActive() { + Active( !mActive ); +} + +Uint32 UIMenuCheckBox::OnMouseUp( const Vector2i &Pos, const Uint32 Flags ) { + UIMenuItem::OnMouseUp( Pos, Flags ); + + if ( Parent()->Visible() && ( Flags & EE_BUTTONS_LRM ) ) + SwitchActive(); + + return 1; +} + +void UIMenuCheckBox::OnStateChange() { + UIMenuItem::OnStateChange(); + + Active( mActive ); +} + +bool UIMenuCheckBox::InheritsFrom( const Uint32 Type ) { + if ( Type == UI_TYPE_MENUITEM ) + return true; + + return false; +} + +}} diff --git a/src/eepp/ui/uimenuitem.cpp b/src/eepp/ui/uimenuitem.cpp new file mode 100644 index 000000000..356af1df7 --- /dev/null +++ b/src/eepp/ui/uimenuitem.cpp @@ -0,0 +1,48 @@ +#include +#include + +namespace EE { namespace UI { + +UIMenuItem::UIMenuItem( UIPushButton::CreateParams& Params ) : + UIPushButton( Params ) +{ + ApplyDefaultTheme(); +} + +UIMenuItem::~UIMenuItem() { +} + +Uint32 UIMenuItem::Type() const { + return UI_TYPE_MENUITEM; +} + +bool UIMenuItem::IsType( const Uint32& type ) const { + return UIMenuItem::Type() == type ? true : UIPushButton::IsType( type ); +} + +void UIMenuItem::SetTheme( UITheme * Theme ) { + UIControl::SetThemeControl( Theme, "menuitem" ); + DoAfterSetTheme(); +} + +Uint32 UIMenuItem::OnMouseEnter( const Vector2i &Pos, const Uint32 Flags ) { + UIPushButton::OnMouseEnter( Pos, Flags ); + + reinterpret_cast ( Parent() )->SetItemSelected( this ); + + return 1; +} + +void UIMenuItem::OnStateChange() { + UIMenu * tMenu = reinterpret_cast ( Parent() ); + + if ( mSkinState->GetState() == UISkinState::StateSelected ) { + mTextBox->Color( tMenu->mFontSelectedColor ); + } else if ( mSkinState->GetState() == UISkinState::StateMouseEnter ) { + mTextBox->Color( tMenu->mFontOverColor ); + } else { + mTextBox->Color( tMenu->mFontColor ); + } +} + +}} diff --git a/src/eepp/ui/uimenusubmenu.cpp b/src/eepp/ui/uimenusubmenu.cpp new file mode 100644 index 000000000..1b84d3edb --- /dev/null +++ b/src/eepp/ui/uimenusubmenu.cpp @@ -0,0 +1,158 @@ +#include +#include +#include + +namespace EE { namespace UI { + +UIMenuSubMenu::UIMenuSubMenu( UIMenuSubMenu::CreateParams& Params ) : + UIMenuItem( Params ), + mSubMenu( NULL ), + mSkinArrow( NULL ), + mArrow( NULL ), + mTimeOver( 0.f ), + mMaxTime( Params.MouseOverTimeShowMenu ), + mCbId( 0 ), + mCbId2( 0 ) +{ + UIGfx::CreateParams GfxParams; + GfxParams.Parent( this ); + GfxParams.SubTexture = NULL; + GfxParams.Flags = UI_AUTO_SIZE; + mArrow = eeNew( UIGfx, ( GfxParams ) ); + mArrow->Visible( true ); + mArrow->Enabled( false ); + + SubMenu( Params.SubMenu ); + + ApplyDefaultTheme(); +} + +UIMenuSubMenu::~UIMenuSubMenu() { +} + +Uint32 UIMenuSubMenu::Type() const { + return UI_TYPE_MENUSUBMENU; +} + +bool UIMenuSubMenu::IsType( const Uint32& type ) const { + return UIMenuSubMenu::Type() == type ? true : UIMenuItem::IsType( type ); +} + +void UIMenuSubMenu::SetTheme( UITheme * Theme ) { + UIMenuItem::SetTheme( Theme ); + + mSkinArrow = Theme->GetByName( Theme->Abbr() + "_" + "menuarrow" ); + + OnStateChange(); +} + +void UIMenuSubMenu::OnSizeChange() { + UIMenuItem::OnSizeChange(); + + mArrow->Pos( Parent()->Size().Width() - mArrow->Size().Width() - 1, 0 ); + mArrow->CenterVertical(); +} + +void UIMenuSubMenu::OnStateChange() { + UIMenuItem::OnStateChange(); + + if ( NULL != mSkinArrow ) { + if ( mSkinState->GetState() == UISkinState::StateSelected ) + mArrow->SubTexture( mSkinArrow->GetSubTexture( UISkinState::StateMouseEnter ) ); + else + mArrow->SubTexture( mSkinArrow->GetSubTexture( UISkinState::StateNormal ) ); + + OnSizeChange(); + } +} + +void UIMenuSubMenu::SubMenu( UIMenu * SubMenu ) { + if ( NULL != mSubMenu && mSubMenu != SubMenu ) { + mSubMenu->RemoveEventListener( mCbId ); + mSubMenu->RemoveEventListener( mCbId2 ); + } + + mSubMenu = SubMenu; + + if ( NULL != mSubMenu ) { + mCbId = mSubMenu->AddEventListener( UIEvent::EventOnEnabledChange, cb::Make1( this, &UIMenuSubMenu::OnSubMenuFocusLoss ) ); + mCbId2 = mSubMenu->AddEventListener( UIEvent::EventOnHideByClick, cb::Make1( this, &UIMenuSubMenu::OnHideByClick ) ); + } +} + +UIMenu * UIMenuSubMenu::SubMenu() const { + return mSubMenu; +} + +Uint32 UIMenuSubMenu::OnMouseMove( const Vector2i &Pos, const Uint32 Flags ) { + UIMenuItem::OnMouseMove( Pos, Flags ); + + if ( NULL != mSubMenu && !mSubMenu->Visible() ) { + mTimeOver += UIManager::instance()->Elapsed().AsMilliseconds(); + + if ( mTimeOver >= mMaxTime ) { + ShowSubMenu(); + } + } + + return 1; +} + +void UIMenuSubMenu::ShowSubMenu() { + mSubMenu->Parent( Parent()->Parent() ); + + Vector2i Pos = this->Pos(); + ControlToScreen( Pos ); + Pos.x += mSize.Width() + reinterpret_cast ( Parent() )->Padding().Right; + + UIMenu::FixMenuPos( Pos, mSubMenu, reinterpret_cast ( Parent() ), this ); + + mSubMenu->Parent()->WorldToControl( Pos ); + mSubMenu->Pos( Pos ); + + if ( !mSubMenu->Visible() ) { + mSubMenu->Show(); + } +} + +Uint32 UIMenuSubMenu::OnMouseExit( const Vector2i &Pos, const Uint32 Flags ) { + UIMenuItem::OnMouseExit( Pos, Flags ); + + mTimeOver = 0; + + return 1; +} + +UIGfx * UIMenuSubMenu::Arrow() const { + return mArrow; +} + +void UIMenuSubMenu::OnSubMenuFocusLoss( const UIEvent * Event ) { + UIControl * FocusCtrl = UIManager::instance()->FocusControl(); + + if ( Parent() != FocusCtrl && !Parent()->IsParentOf( FocusCtrl ) ) { + Parent()->SetFocus(); + } + + if ( mSubMenu->mClickHide ) { + reinterpret_cast( Parent() )->Hide(); + + mSubMenu->mClickHide = false; + } +} + +void UIMenuSubMenu::OnHideByClick( const UIEvent * Event ) { + UIMenu * tMenu = reinterpret_cast( Parent() ); + + tMenu->mClickHide = true; + tMenu->Hide(); +} + +bool UIMenuSubMenu::InheritsFrom( const Uint32 Type ) { + if ( Type == UI_TYPE_MENUITEM ) + return true; + + return false; +} + +}} diff --git a/src/eepp/ui/uimessage.cpp b/src/eepp/ui/uimessage.cpp new file mode 100644 index 000000000..60039263f --- /dev/null +++ b/src/eepp/ui/uimessage.cpp @@ -0,0 +1,29 @@ +#include +#include + +namespace EE { namespace UI { + +UIMessage::UIMessage( UIControl * Ctrl, const Uint32& Msg, const Uint32& Flags ) : + mCtrl( Ctrl ), + mMsg( Msg ), + mFlags( Flags ) +{ +} + +UIMessage::~UIMessage() +{ +} + +UIControl * UIMessage::Sender() const { + return mCtrl; +} + +const Uint32& UIMessage::Msg() const { + return mMsg; +} + +const Uint32& UIMessage::Flags() const { + return mFlags; +} + +}} diff --git a/src/eepp/ui/cuimessagebox.cpp b/src/eepp/ui/uimessagebox.cpp similarity index 75% rename from src/eepp/ui/cuimessagebox.cpp rename to src/eepp/ui/uimessagebox.cpp index 07c79cfed..c769a4e03 100644 --- a/src/eepp/ui/cuimessagebox.cpp +++ b/src/eepp/ui/uimessagebox.cpp @@ -1,28 +1,28 @@ -#include -#include +#include +#include namespace EE { namespace UI { -cUIMessageBox::cUIMessageBox( const cUIMessageBox::CreateParams& Params ) : - cUIWindow( Params ), +UIMessageBox::UIMessageBox( const UIMessageBox::CreateParams& Params ) : + UIWindow( Params ), mMsgBoxType( Params.Type ), mCloseWithKey( Params.CloseWithKey ) { - cUITheme * Theme = cUIThemeManager::instance()->DefaultTheme(); + UITheme * Theme = UIThemeManager::instance()->DefaultTheme(); if ( NULL == Theme ) { - cUIPushButton::CreateParams ButtonParams; + UIPushButton::CreateParams ButtonParams; ButtonParams.Parent( Container() ); ButtonParams.SizeSet( 90, 22 ); ButtonParams.PosSet( Container()->Size().Width() - 96, Container()->Size().Height() - ButtonParams.Size.Height() - 8 ); ButtonParams.Flags = UI_HALIGN_CENTER | UI_ANCHOR_RIGHT | UI_VALIGN_CENTER | UI_AUTO_SIZE; - mButtonOK = eeNew( cUIPushButton, ( ButtonParams ) ); + mButtonOK = eeNew( UIPushButton, ( ButtonParams ) ); mButtonOK->Visible( true ); mButtonOK->Enabled( true ); ButtonParams.Pos.x = mButtonOK->Pos().x - mButtonOK->Size().Width() - 8; - mButtonCancel = eeNew( cUIPushButton, ( ButtonParams ) ); + mButtonCancel = eeNew( UIPushButton, ( ButtonParams ) ); mButtonCancel->Visible( true ); mButtonCancel->Enabled( true ); } @@ -39,12 +39,12 @@ cUIMessageBox::cUIMessageBox( const cUIMessageBox::CreateParams& Params ) : mButtonOK->Flags() ); } - cUITextBox::CreateParams TxtParams; + UITextBox::CreateParams TxtParams; TxtParams.Parent( Container() ); TxtParams.Flags = UI_CONTROL_DEFAULT_FLAGS_CENTERED | UI_ANCHOR_RIGHT | UI_ANCHOR_BOTTOM; TxtParams.SizeSet( Container()->Size().Width(), mButtonOK->Pos().y ); - mTextBox = eeNew( cUITextBox, ( TxtParams ) ); + mTextBox = eeNew( UITextBox, ( TxtParams ) ); mTextBox->Visible( true ); mTextBox->Enabled( true ); mTextBox->Text( Params.Message ); @@ -85,11 +85,11 @@ cUIMessageBox::cUIMessageBox( const cUIMessageBox::CreateParams& Params ) : ApplyDefaultTheme(); } -cUIMessageBox::~cUIMessageBox() { +UIMessageBox::~UIMessageBox() { } -void cUIMessageBox::SetTheme( cUITheme * Theme ) { - cUIWindow::SetTheme( Theme ); +void UIMessageBox::SetTheme( UITheme * Theme ) { + UIWindow::SetTheme( Theme ); if ( "Retry" != mButtonOK->Text() ) { SubTexture * OKIcon = Theme->GetIconByName( "ok" ); @@ -108,16 +108,16 @@ void cUIMessageBox::SetTheme( cUITheme * Theme ) { mButtonCancel->Pos( mButtonCancel->Pos().x, mButtonOK->Pos().y ); } -Uint32 cUIMessageBox::OnMessage( const cUIMessage * Msg ) { +Uint32 UIMessageBox::OnMessage( const UIMessage * Msg ) { switch ( Msg->Msg() ) { - case cUIMessage::MsgClick: + case UIMessage::MsgClick: { if ( Msg->Flags() & EE_BUTTON_LMASK ) { - Vector2i mousei( cUIManager::instance()->GetMousePos() ); + Vector2i mousei( UIManager::instance()->GetMousePos() ); Vector2f mouse( mousei.x, mousei.y ); if ( Msg->Sender() == mButtonOK && mButtonOK->GetPolygon().PointInside( mouse ) ) { - SendCommonEvent( cUIEvent::EventMsgBoxConfirmClick ); + SendCommonEvent( UIEvent::EventMsgBoxConfirmClick ); CloseWindow(); } else if ( Msg->Sender() == mButtonCancel ) { @@ -129,22 +129,22 @@ Uint32 cUIMessageBox::OnMessage( const cUIMessage * Msg ) { } } - return cUIWindow::OnMessage( Msg ); + return UIWindow::OnMessage( Msg ); } -cUITextBox * cUIMessageBox::TextBox() const { +UITextBox * UIMessageBox::TextBox() const { return mTextBox; } -cUIPushButton * cUIMessageBox::ButtonOK() const { +UIPushButton * UIMessageBox::ButtonOK() const { return mButtonOK; } -cUIPushButton * cUIMessageBox::ButtonCancel() const { +UIPushButton * UIMessageBox::ButtonCancel() const { return mButtonCancel; } -void cUIMessageBox::AutoSize() { +void UIMessageBox::AutoSize() { Sizei nSize( mTextBox->GetTextWidth() + 48, mTextBox->GetTextHeight() + mButtonOK->Size().Height() + mDecoSize.Height() + 8 ); if ( !( nSize.Width() > Container()->Size().Width() ) ) { @@ -162,7 +162,7 @@ void cUIMessageBox::AutoSize() { } } -Uint32 cUIMessageBox::OnKeyUp( const cUIEventKey & Event ) { +Uint32 UIMessageBox::OnKeyUp( const UIEventKey & Event ) { if ( mCloseWithKey && Event.KeyCode() == mCloseWithKey ) { CloseWindow(); } @@ -170,8 +170,8 @@ Uint32 cUIMessageBox::OnKeyUp( const cUIEventKey & Event ) { return 1; } -bool cUIMessageBox::Show() { - bool b = cUIWindow::Show(); +bool UIMessageBox::Show() { + bool b = UIWindow::Show(); mButtonOK->SetFocus(); diff --git a/src/eepp/ui/uipopupmenu.cpp b/src/eepp/ui/uipopupmenu.cpp new file mode 100644 index 000000000..855628199 --- /dev/null +++ b/src/eepp/ui/uipopupmenu.cpp @@ -0,0 +1,108 @@ +#include +#include + +namespace EE { namespace UI { + +UIPopUpMenu::UIPopUpMenu( UIPopUpMenu::CreateParams Params ) : + UIMenu( Params ) +{ + ApplyDefaultTheme(); +} + +UIPopUpMenu::~UIPopUpMenu() { + OnClose(); +} + +Uint32 UIPopUpMenu::Type() const { + return UI_TYPE_POPUPMENU; +} + +bool UIPopUpMenu::IsType( const Uint32& type ) const { + return UIPopUpMenu::Type() == type ? true : UIMenu::IsType( type ); +} + +void UIPopUpMenu::SetTheme( UITheme * Theme ) { + UIControl::SetThemeControl( Theme, "popupmenu" ); + DoAfterSetTheme(); +} + +bool UIPopUpMenu::Show() { + if ( !Visible() || 0.f == mAlpha ) { + #ifdef EE_PLATFORM_TOUCH + mTE.Restart(); + #endif + + Enabled( true ); + Visible( true ); + + ToFront(); + + if ( UIThemeManager::instance()->DefaultEffectsEnabled() ) { + if ( 255.f == Alpha() ) + StartAlphaAnim( 0.f, 255.f, UIThemeManager::instance()->ControlsFadeInTime() ); + else + CreateFadeIn( UIThemeManager::instance()->ControlsFadeInTime() ); + } + + SetFocus(); + + return true; + } + + return false; +} + +bool UIPopUpMenu::Hide() { + if ( Visible() ) { + if ( !FadingOut() ) { + if ( NULL != mItemSelected ) + mItemSelected->SetSkinState( UISkinState::StateNormal ); + + mItemSelected = NULL; + mItemSelectedIndex = eeINDEX_NOT_FOUND; + + if ( UIThemeManager::instance()->DefaultEffectsEnabled() ) { + DisableFadeOut( UIThemeManager::instance()->ControlsFadeOutTime() ); + } else { + Enabled( false ); + Visible( false ); + } + } + + return true; + } + + return false; +} + +void UIPopUpMenu::OnComplexControlFocusLoss() { + Hide(); + + UIMenu::OnComplexControlFocusLoss(); +} + +Uint32 UIPopUpMenu::OnMessage( const UIMessage * Msg ) { + switch ( Msg->Msg() ) { + case UIMessage::MsgMouseUp: + { + #ifdef EE_PLATFORM_TOUCH + if ( mTE.Elapsed().AsMilliseconds() > 250.f ) { + #endif + if ( !Msg->Sender()->IsType( UI_TYPE_MENUSUBMENU ) && ( Msg->Flags() & EE_BUTTONS_LRM ) ) { + SendCommonEvent( UIEvent::EventOnHideByClick ); + + if ( Visible() ) + UIManager::instance()->MainControl()->SetFocus(); + + Hide(); + } + #ifdef EE_PLATFORM_TOUCH + } + #endif + } + } + + return UIMenu::OnMessage( Msg ); +} + +}} diff --git a/src/eepp/ui/cuiprogressbar.cpp b/src/eepp/ui/uiprogressbar.cpp similarity index 61% rename from src/eepp/ui/cuiprogressbar.cpp rename to src/eepp/ui/uiprogressbar.cpp index b1a16406f..73ea698be 100644 --- a/src/eepp/ui/cuiprogressbar.cpp +++ b/src/eepp/ui/uiprogressbar.cpp @@ -1,9 +1,9 @@ -#include +#include namespace EE { namespace UI { -cUIProgressBar::cUIProgressBar( const cUIProgressBar::CreateParams& Params ) : - cUIComplexControl( Params ), +UIProgressBar::UIProgressBar( const UIProgressBar::CreateParams& Params ) : + UIComplexControl( Params ), mVerticalExpand( Params.VerticalExpand ), mSpeed( Params.MovementSpeed ), mFillerMargin( Params.FillerMargin ), @@ -12,13 +12,13 @@ cUIProgressBar::cUIProgressBar( const cUIProgressBar::CreateParams& Params ) : mTotalSteps( 100.f ), mParallax( NULL ) { - cUITextBox::CreateParams TxtBoxParams = Params; + UITextBox::CreateParams TxtBoxParams = Params; TxtBoxParams.Parent( this ); TxtBoxParams.Flags = UI_VALIGN_CENTER | UI_HALIGN_CENTER; TxtBoxParams.PosSet( 0, 0 ); - mTextBox = eeNew( cUITextBox, ( TxtBoxParams ) ); + mTextBox = eeNew( UITextBox, ( TxtBoxParams ) ); mTextBox->Enabled( false ); UpdateTextBox(); @@ -26,20 +26,20 @@ cUIProgressBar::cUIProgressBar( const cUIProgressBar::CreateParams& Params ) : ApplyDefaultTheme(); } -cUIProgressBar::~cUIProgressBar() { +UIProgressBar::~UIProgressBar() { eeSAFE_DELETE( mParallax ); } -Uint32 cUIProgressBar::Type() const { +Uint32 UIProgressBar::Type() const { return UI_TYPE_PROGRESSBAR; } -bool cUIProgressBar::IsType( const Uint32& type ) const { - return cUIProgressBar::Type() == type ? true : cUIComplexControl::IsType( type ); +bool UIProgressBar::IsType( const Uint32& type ) const { + return UIProgressBar::Type() == type ? true : UIComplexControl::IsType( type ); } -void cUIProgressBar::Draw() { - cUIControlAnim::Draw(); +void UIProgressBar::Draw() { + UIControlAnim::Draw(); if ( NULL != mParallax && 0.f != mAlpha ) { ColorA C( mParallax->Color() ); @@ -51,17 +51,17 @@ void cUIProgressBar::Draw() { } } -void cUIProgressBar::SetTheme( cUITheme * Theme ) { - cUIControl::SetThemeControl( Theme, "progressbar" ); +void UIProgressBar::SetTheme( UITheme * Theme ) { + UIControl::SetThemeControl( Theme, "progressbar" ); if ( mFlags & UI_AUTO_SIZE ) { Size( mSize.x, GetSkinSize().Height() ); } - cUISkin * tSkin = Theme->GetByName( Theme->Abbr() + "_progressbar_filler" ); + UISkin * tSkin = Theme->GetByName( Theme->Abbr() + "_progressbar_filler" ); if ( tSkin ) { - SubTexture * tSubTexture = tSkin->GetSubTexture( cUISkinState::StateNormal ); + SubTexture * tSubTexture = tSkin->GetSubTexture( UISkinState::StateNormal ); if ( NULL != tSubTexture ) { eeSAFE_DELETE( mParallax ); @@ -79,15 +79,15 @@ void cUIProgressBar::SetTheme( cUITheme * Theme ) { } } -Uint32 cUIProgressBar::OnValueChange() { - cUIControlAnim::OnValueChange(); +Uint32 UIProgressBar::OnValueChange() { + UIControlAnim::OnValueChange(); OnSizeChange(); return 1; } -void cUIProgressBar::OnSizeChange() { +void UIProgressBar::OnSizeChange() { if ( NULL != mParallax ) { Float Height = (Float)mSize.Height(); @@ -103,40 +103,40 @@ void cUIProgressBar::OnSizeChange() { UpdateTextBox(); } -void cUIProgressBar::Progress( Float Val ) { +void UIProgressBar::Progress( Float Val ) { mProgress = Val; OnValueChange(); UpdateTextBox(); } -const Float& cUIProgressBar::Progress() const { +const Float& UIProgressBar::Progress() const { return mProgress; } -void cUIProgressBar::TotalSteps( const Float& Steps ) { +void UIProgressBar::TotalSteps( const Float& Steps ) { mTotalSteps = Steps; OnSizeChange(); UpdateTextBox(); } -const Float& cUIProgressBar::TotalSteps() const { +const Float& UIProgressBar::TotalSteps() const { return mTotalSteps; } -void cUIProgressBar::MovementSpeed( const Vector2f& Speed ) { +void UIProgressBar::MovementSpeed( const Vector2f& Speed ) { mSpeed = Speed; if ( NULL != mParallax ) mParallax->Speed( mSpeed ); } -const Vector2f& cUIProgressBar::MovementSpeed() const { +const Vector2f& UIProgressBar::MovementSpeed() const { return mSpeed; } -void cUIProgressBar::VerticalExpand( const bool& VerticalExpand ) { +void UIProgressBar::VerticalExpand( const bool& VerticalExpand ) { if ( VerticalExpand != mVerticalExpand ) { mVerticalExpand = VerticalExpand; @@ -144,43 +144,43 @@ void cUIProgressBar::VerticalExpand( const bool& VerticalExpand ) { } } -const bool& cUIProgressBar::VerticalExpand() const { +const bool& UIProgressBar::VerticalExpand() const { return mVerticalExpand; } -void cUIProgressBar::FillerMargin( const Rectf& margin ) { +void UIProgressBar::FillerMargin( const Rectf& margin ) { mFillerMargin = margin; OnPosChange(); OnSizeChange(); } -const Rectf& cUIProgressBar::FillerMargin() const { +const Rectf& UIProgressBar::FillerMargin() const { return mFillerMargin; } -void cUIProgressBar::DisplayPercent( const bool& DisplayPercent ) { +void UIProgressBar::DisplayPercent( const bool& DisplayPercent ) { mDisplayPercent = DisplayPercent; UpdateTextBox(); } -const bool& cUIProgressBar::DisplayPercent() const { +const bool& UIProgressBar::DisplayPercent() const { return mDisplayPercent; } -void cUIProgressBar::UpdateTextBox() { +void UIProgressBar::UpdateTextBox() { mTextBox->Visible( mDisplayPercent ); mTextBox->Size( mSize ); mTextBox->Text( String::ToStr( (Int32)( ( mProgress / mTotalSteps ) * 100.f ) ) + "%" ); } -cUITextBox * cUIProgressBar::TextBox() const { +UITextBox * UIProgressBar::TextBox() const { return mTextBox; } -void cUIProgressBar::OnAlphaChange() { - cUIControlAnim::OnAlphaChange(); +void UIProgressBar::OnAlphaChange() { + UIControlAnim::OnAlphaChange(); mTextBox->Alpha( mAlpha ); } diff --git a/src/eepp/ui/cuipushbutton.cpp b/src/eepp/ui/uipushbutton.cpp similarity index 68% rename from src/eepp/ui/cuipushbutton.cpp rename to src/eepp/ui/uipushbutton.cpp index 8365162f8..2046669c8 100644 --- a/src/eepp/ui/cuipushbutton.cpp +++ b/src/eepp/ui/uipushbutton.cpp @@ -1,16 +1,16 @@ -#include +#include namespace EE { namespace UI { -cUIPushButton::cUIPushButton( const cUIPushButton::CreateParams& Params ) : - cUIComplexControl( Params ), +UIPushButton::UIPushButton( const UIPushButton::CreateParams& Params ) : + UIComplexControl( Params ), mFontColor( Params.FontColor ), mFontOverColor( Params.FontOverColor ), mIcon( NULL ), mTextBox( NULL ), mIconSpace( Params.IconHorizontalMargin ) { - cUIGfx::CreateParams GfxParams; + UIGfx::CreateParams GfxParams; GfxParams.Parent( this ); GfxParams.SubTexture = Params.Icon; @@ -20,7 +20,7 @@ cUIPushButton::cUIPushButton( const cUIPushButton::CreateParams& Params ) : GfxParams.Flags = UI_AUTO_SIZE | UI_VALIGN_CENTER | UI_HALIGN_CENTER; } - mIcon = eeNew( cUIGfx, ( GfxParams ) ); + mIcon = eeNew( UIGfx, ( GfxParams ) ); if ( Params.IconMinSize.x != 0 && Params.IconMinSize.y != 0 ) { mIcon->Size( Params.IconMinSize ); @@ -31,7 +31,7 @@ cUIPushButton::cUIPushButton( const cUIPushButton::CreateParams& Params ) : Icon( Params.Icon ); - cUITextBox::CreateParams TxtParams = Params; + UITextBox::CreateParams TxtParams = Params; TxtParams.Parent( this ); TxtParams.Flags = HAlignGet( Params.Flags ) | VAlignGet( Params.Flags ); TxtParams.Font = Params.Font; @@ -41,7 +41,7 @@ cUIPushButton::cUIPushButton( const cUIPushButton::CreateParams& Params ) : if ( TxtParams.Flags & UI_CLIP_ENABLE ) TxtParams.Flags &= ~UI_CLIP_ENABLE; - mTextBox = eeNew( cUITextBox, ( TxtParams ) ); + mTextBox = eeNew( UITextBox, ( TxtParams ) ); mTextBox->Visible( true ); mTextBox->Enabled( false ); @@ -53,18 +53,18 @@ cUIPushButton::cUIPushButton( const cUIPushButton::CreateParams& Params ) : ApplyDefaultTheme(); } -cUIPushButton::~cUIPushButton() { +UIPushButton::~UIPushButton() { } -Uint32 cUIPushButton::Type() const { +Uint32 UIPushButton::Type() const { return UI_TYPE_PUSHBUTTON; } -bool cUIPushButton::IsType( const Uint32& type ) const { - return cUIPushButton::Type() == type ? true : cUIComplexControl::IsType( type ); +bool UIPushButton::IsType( const Uint32& type ) const { + return UIPushButton::Type() == type ? true : UIComplexControl::IsType( type ); } -void cUIPushButton::OnSizeChange() { +void UIPushButton::OnSizeChange() { if ( NULL != mTextBox ) { mTextBox->Size( mSize ); mTextBox->Pos( 0, 0 ); @@ -121,13 +121,13 @@ void cUIPushButton::OnSizeChange() { */ } -void cUIPushButton::SetTheme( cUITheme * Theme ) { - cUIControl::SetThemeControl( Theme, "button" ); +void UIPushButton::SetTheme( UITheme * Theme ) { + UIControl::SetThemeControl( Theme, "button" ); DoAfterSetTheme(); } -void cUIPushButton::DoAfterSetTheme() { +void UIPushButton::DoAfterSetTheme() { if ( NULL != mTextBox && NULL == mTextBox->Font() && NULL != mSkinState && NULL != mSkinState->GetSkin() && NULL != mSkinState->GetSkin()->Theme() && NULL != mSkinState->GetSkin()->Theme()->Font() ) mTextBox->Font( mSkinState->GetSkin()->Theme()->Font() ); @@ -145,60 +145,60 @@ void cUIPushButton::DoAfterSetTheme() { OnSizeChange(); } -void cUIPushButton::AutoPadding() { +void UIPushButton::AutoPadding() { if ( mFlags & UI_AUTO_PADDING ) { Padding( MakePadding( true, false, true, false ) ); } } -void cUIPushButton::Icon( SubTexture * Icon ) { +void UIPushButton::Icon( SubTexture * Icon ) { mIcon->SubTexture( Icon ); OnSizeChange(); } -cUIGfx * cUIPushButton::Icon() const { +UIGfx * UIPushButton::Icon() const { return mIcon; } -void cUIPushButton::Text( const String& text ) { +void UIPushButton::Text( const String& text ) { mTextBox->Text( text ); OnSizeChange(); } -const String& cUIPushButton::Text() { +const String& UIPushButton::Text() { return mTextBox->Text(); } -void cUIPushButton::Padding( const Recti& padding ) { +void UIPushButton::Padding( const Recti& padding ) { mTextBox->Padding( padding ); } -const Recti& cUIPushButton::Padding() const { +const Recti& UIPushButton::Padding() const { return mTextBox->Padding(); } -void cUIPushButton::IconHorizontalMargin( Int32 margin ) { +void UIPushButton::IconHorizontalMargin( Int32 margin ) { mIconSpace = margin; OnSizeChange(); } -const Int32& cUIPushButton::IconHorizontalMargin() const { +const Int32& UIPushButton::IconHorizontalMargin() const { return mIconSpace; } -cUITextBox * cUIPushButton::TextBox() const { +UITextBox * UIPushButton::TextBox() const { return mTextBox; } -void cUIPushButton::OnAlphaChange() { - cUIControlAnim::OnAlphaChange(); +void UIPushButton::OnAlphaChange() { + UIControlAnim::OnAlphaChange(); mIcon->Alpha( mAlpha ); mTextBox->Alpha( mAlpha ); } -void cUIPushButton::OnStateChange() { - if ( mSkinState->GetState() == cUISkinState::StateMouseEnter ) { +void UIPushButton::OnStateChange() { + if ( mSkinState->GetState() == UISkinState::StateMouseEnter ) { mTextBox->Color( mFontOverColor ); } else { mTextBox->Color( mFontColor ); @@ -207,39 +207,39 @@ void cUIPushButton::OnStateChange() { mTextBox->Alpha( mAlpha ); } -Uint32 cUIPushButton::OnKeyDown( const cUIEventKey& Event ) { +Uint32 UIPushButton::OnKeyDown( const UIEventKey& Event ) { if ( Event.KeyCode() == KEY_RETURN ) { - cUIMessage Msg( this, cUIMessage::MsgClick, EE_BUTTON_LMASK ); + UIMessage Msg( this, UIMessage::MsgClick, EE_BUTTON_LMASK ); MessagePost( &Msg ); OnMouseClick( Vector2i(0,0), EE_BUTTON_LMASK ); - SetSkinState( cUISkinState::StateMouseDown ); + SetSkinState( UISkinState::StateMouseDown ); } - return cUIComplexControl::OnKeyDown( Event ); + return UIComplexControl::OnKeyDown( Event ); } -Uint32 cUIPushButton::OnKeyUp( const cUIEventKey& Event ) { +Uint32 UIPushButton::OnKeyUp( const UIEventKey& Event ) { if ( Event.KeyCode() == KEY_RETURN ) { SetPrevSkinState(); } - return cUIComplexControl::OnKeyUp( Event ); + return UIComplexControl::OnKeyUp( Event ); } -const ColorA& cUIPushButton::FontColor() const { +const ColorA& UIPushButton::FontColor() const { return mFontColor; } -void cUIPushButton::FontColor( const ColorA& color ) { +void UIPushButton::FontColor( const ColorA& color ) { mFontColor = color; OnStateChange(); } -const ColorA& cUIPushButton::FontOverColor() const { +const ColorA& UIPushButton::FontOverColor() const { return mFontOverColor; } -void cUIPushButton::FontOverColor( const ColorA& color ) { +void UIPushButton::FontOverColor( const ColorA& color ) { mFontOverColor = color; OnStateChange(); } diff --git a/src/eepp/ui/cuiradiobutton.cpp b/src/eepp/ui/uiradiobutton.cpp similarity index 58% rename from src/eepp/ui/cuiradiobutton.cpp rename to src/eepp/ui/uiradiobutton.cpp index a4896f8f7..aa99ea528 100644 --- a/src/eepp/ui/cuiradiobutton.cpp +++ b/src/eepp/ui/uiradiobutton.cpp @@ -1,27 +1,27 @@ -#include -#include +#include +#include #include #include namespace EE { namespace UI { -cUIRadioButton::cUIRadioButton( const cUITextBox::CreateParams& Params ) : - cUITextBox( Params ), +UIRadioButton::UIRadioButton( const UITextBox::CreateParams& Params ) : + UITextBox( Params ), mActiveButton(NULL), mInactiveButton(NULL), mActive( false ) { - cUIControlAnim::CreateParams ButtonParams( Params ); + UIControlAnim::CreateParams ButtonParams( Params ); ButtonParams.Parent( this ); ButtonParams.PosSet( Vector2i( 0, 0 ) ); ButtonParams.Size = Sizei( 16, 16 ); - mActiveButton = eeNew( cUIControlAnim, ( ButtonParams ) ); + mActiveButton = eeNew( UIControlAnim, ( ButtonParams ) ); mActiveButton->Visible( false ); mActiveButton->Enabled( true ); - mInactiveButton = eeNew( cUIControlAnim, ( ButtonParams ) ); + mInactiveButton = eeNew( UIControlAnim, ( ButtonParams ) ); mInactiveButton->Visible( true ); mInactiveButton->Enabled( true ); @@ -32,28 +32,28 @@ cUIRadioButton::cUIRadioButton( const cUITextBox::CreateParams& Params ) : ApplyDefaultTheme(); } -cUIRadioButton::~cUIRadioButton() { +UIRadioButton::~UIRadioButton() { } -Uint32 cUIRadioButton::Type() const { +Uint32 UIRadioButton::Type() const { return UI_TYPE_RADIOBUTTON; } -bool cUIRadioButton::IsType( const Uint32& type ) const { - return cUIRadioButton::Type() == type ? true : cUITextBox::IsType( type ); +bool UIRadioButton::IsType( const Uint32& type ) const { + return UIRadioButton::Type() == type ? true : UITextBox::IsType( type ); } -void cUIRadioButton::SetTheme( cUITheme * Theme ) { - cUIControl::SetThemeControl( Theme, "radiobutton" ); +void UIRadioButton::SetTheme( UITheme * Theme ) { + UIControl::SetThemeControl( Theme, "radiobutton" ); mActiveButton->SetThemeControl ( Theme, "radiobutton_active" ); mInactiveButton->SetThemeControl( Theme, "radiobutton_inactive" ); SubTexture * tSubTexture = NULL; - cUISkin * tSkin = mActiveButton->GetSkin(); + UISkin * tSkin = mActiveButton->GetSkin(); if ( tSkin ) { - tSubTexture = tSkin->GetSubTexture( cUISkinState::StateNormal ); + tSubTexture = tSkin->GetSubTexture( UISkinState::StateNormal ); if ( NULL != tSubTexture ) { mActiveButton->Size( tSubTexture->RealSize() ); @@ -64,7 +64,7 @@ void cUIRadioButton::SetTheme( cUITheme * Theme ) { tSkin = mInactiveButton->GetSkin(); if ( NULL != tSkin ) { - tSubTexture = tSkin->GetSubTexture( cUISkinState::StateNormal ); + tSubTexture = tSkin->GetSubTexture( UISkinState::StateNormal ); if ( NULL != tSubTexture ) { mInactiveButton->Size( tSubTexture->RealSize() ); @@ -75,8 +75,8 @@ void cUIRadioButton::SetTheme( cUITheme * Theme ) { Padding( Recti(0,0,0,0) ); } -void cUIRadioButton::AutoSize() { - cUITextBox::AutoSize(); +void UIRadioButton::AutoSize() { + UITextBox::AutoSize(); if ( mFlags & UI_AUTO_SIZE ) { mActiveButton->CenterVertical(); @@ -86,22 +86,22 @@ void cUIRadioButton::AutoSize() { } } -void cUIRadioButton::OnSizeChange() { - cUITextBox::OnSizeChange(); +void UIRadioButton::OnSizeChange() { + UITextBox::OnSizeChange(); mActiveButton->CenterVertical(); mInactiveButton->CenterVertical(); } -Uint32 cUIRadioButton::OnMessage( const cUIMessage * Msg ) { +Uint32 UIRadioButton::OnMessage( const UIMessage * Msg ) { switch ( Msg->Msg() ) { - case cUIMessage::MsgClick: { + case UIMessage::MsgClick: { if ( Msg->Flags() & EE_BUTTON_LMASK ) { SwitchState(); } if ( Msg->Sender() == mActiveButton || Msg->Sender() == mInactiveButton ) { - SendMouseEvent( cUIEvent::EventMouseClick, cUIManager::instance()->GetMousePos(), cUIManager::instance()->PressTrigger() ); + SendMouseEvent( UIEvent::EventMouseClick, UIManager::instance()->GetMousePos(), UIManager::instance()->PressTrigger() ); } return 1; @@ -111,11 +111,11 @@ Uint32 cUIRadioButton::OnMessage( const cUIMessage * Msg ) { return 0; } -void cUIRadioButton::SwitchState() { +void UIRadioButton::SwitchState() { Active( !mActive ); } -void cUIRadioButton::Active( const bool& active ) { +void UIRadioButton::Active( const bool& active ) { if ( !active ) { if ( CheckActives() ) { mActiveButton->Visible( false ); @@ -135,12 +135,12 @@ void cUIRadioButton::Active( const bool& active ) { } if ( active && NULL != mParentCtrl ) { - cUIControl * tChild = mParentCtrl->ChildGetFirst(); + UIControl * tChild = mParentCtrl->ChildGetFirst(); while ( NULL != tChild ) { if ( tChild->IsType( UI_TYPE_RADIOBUTTON ) ) { if ( tChild != this ) { - cUIRadioButton * tRB = reinterpret_cast ( tChild ); + UIRadioButton * tRB = reinterpret_cast ( tChild ); if ( tRB->Active() ) tRB->Active( false ); @@ -152,14 +152,14 @@ void cUIRadioButton::Active( const bool& active ) { } } -bool cUIRadioButton::CheckActives() { +bool UIRadioButton::CheckActives() { if ( NULL != mParentCtrl ) { - cUIControl * tChild = mParentCtrl->ChildGetFirst(); + UIControl * tChild = mParentCtrl->ChildGetFirst(); while ( NULL != tChild ) { if ( tChild->IsType( UI_TYPE_RADIOBUTTON ) ) { if ( tChild != this ) { - cUIRadioButton * tRB = reinterpret_cast ( tChild ); + UIRadioButton * tRB = reinterpret_cast ( tChild ); if ( tRB->Active() ) return true; @@ -173,16 +173,16 @@ bool cUIRadioButton::CheckActives() { return false; } -void cUIRadioButton::AutoActivate() { +void UIRadioButton::AutoActivate() { eeASSERT( NULL != mParentCtrl ); if ( NULL != mParentCtrl ) { - cUIControl * tChild = mParentCtrl->ChildGetFirst(); + UIControl * tChild = mParentCtrl->ChildGetFirst(); while ( NULL != tChild ) { if ( tChild->IsType( UI_TYPE_RADIOBUTTON ) ) { if ( tChild != this ) { - cUIRadioButton * tRB = reinterpret_cast ( tChild ); + UIRadioButton * tRB = reinterpret_cast ( tChild ); if ( tRB->Active() ) { return; @@ -197,28 +197,28 @@ void cUIRadioButton::AutoActivate() { Active( true ); } -const bool& cUIRadioButton::Active() const { +const bool& UIRadioButton::Active() const { return mActive; } -const bool& cUIRadioButton::IsActive() const { +const bool& UIRadioButton::IsActive() const { return Active(); } -void cUIRadioButton::Padding( const Recti& padding ) { +void UIRadioButton::Padding( const Recti& padding ) { mPadding = padding; mPadding.Left = mPadding.Left + mActiveButton->Size().Width(); } -cUIControlAnim * cUIRadioButton::ActiveButton() const { +UIControlAnim * UIRadioButton::ActiveButton() const { return mActiveButton; } -cUIControlAnim * cUIRadioButton::InactiveButton() const { +UIControlAnim * UIRadioButton::InactiveButton() const { return mInactiveButton; } -Uint32 cUIRadioButton::OnKeyDown( const cUIEventKey& Event ) { +Uint32 UIRadioButton::OnKeyDown( const UIEventKey& Event ) { if ( Event.KeyCode() == KEY_SPACE ) { if ( Sys::GetTicks() - mLastTick > 250 ) { mLastTick = Sys::GetTicks(); @@ -227,11 +227,11 @@ Uint32 cUIRadioButton::OnKeyDown( const cUIEventKey& Event ) { } } - return cUITextBox::OnKeyDown( Event ); + return UITextBox::OnKeyDown( Event ); } -void cUIRadioButton::OnAlphaChange() { - cUITextBox::OnAlphaChange(); +void UIRadioButton::OnAlphaChange() { + UITextBox::OnAlphaChange(); mActiveButton->Alpha( mAlpha ); mInactiveButton->Alpha( mAlpha ); diff --git a/src/eepp/ui/cuiscrollbar.cpp b/src/eepp/ui/uiscrollbar.cpp similarity index 65% rename from src/eepp/ui/cuiscrollbar.cpp rename to src/eepp/ui/uiscrollbar.cpp index 316a58537..d5688ce33 100644 --- a/src/eepp/ui/cuiscrollbar.cpp +++ b/src/eepp/ui/uiscrollbar.cpp @@ -1,25 +1,25 @@ -#include -#include +#include +#include #include namespace EE { namespace UI { -cUIScrollBar::cUIScrollBar( const cUIScrollBar::CreateParams& Params ) : - cUIComplexControl( Params ) +UIScrollBar::UIScrollBar( const UIScrollBar::CreateParams& Params ) : + UIComplexControl( Params ) { - cUIControlAnim::CreateParams CParams = Params; + UIControlAnim::CreateParams CParams = Params; CParams.Size = Sizei( 16, 16 ); CParams.Parent( this ); - mBtnDown = eeNew( cUIControlAnim, ( CParams ) ); - mBtnUp = eeNew( cUIControlAnim, ( CParams ) ); + mBtnDown = eeNew( UIControlAnim, ( CParams ) ); + mBtnUp = eeNew( UIControlAnim, ( CParams ) ); mBtnDown->Visible( true ); mBtnDown->Enabled( true ); mBtnUp->Visible( true ); mBtnUp->Enabled( true ); - cUISlider::CreateParams SParams; + UISlider::CreateParams SParams; SParams.Background = Params.Background; SParams.Blend = Params.Blend; SParams.Border = Params.Border; @@ -31,38 +31,38 @@ cUIScrollBar::cUIScrollBar( const cUIScrollBar::CreateParams& Params ) : SParams.AllowHalfSliderOut = false; SParams.ExpandBackground = true; - mSlider = eeNew( cUISlider, ( SParams ) ); + mSlider = eeNew( UISlider, ( SParams ) ); mSlider->Visible( true ); mSlider->Enabled( true ); - mSlider->AddEventListener( cUIEvent::EventOnValueChange, cb::Make1( this, &cUIScrollBar::OnValueChangeCb ) ); + mSlider->AddEventListener( UIEvent::EventOnValueChange, cb::Make1( this, &UIScrollBar::OnValueChangeCb ) ); AdjustChilds(); ApplyDefaultTheme(); } -cUIScrollBar::~cUIScrollBar() { +UIScrollBar::~UIScrollBar() { } -Uint32 cUIScrollBar::Type() const { +Uint32 UIScrollBar::Type() const { return UI_TYPE_SCROLLBAR; } -bool cUIScrollBar::IsType( const Uint32& type ) const { - return cUIScrollBar::Type() == type ? true : cUIComplexControl::IsType( type ); +bool UIScrollBar::IsType( const Uint32& type ) const { + return UIScrollBar::Type() == type ? true : UIComplexControl::IsType( type ); } -void cUIScrollBar::SetTheme( cUITheme * Theme ) { +void UIScrollBar::SetTheme( UITheme * Theme ) { if ( !IsVertical() ) { - cUIControl::SetThemeControl( Theme, "hscrollbar" ); + UIControl::SetThemeControl( Theme, "hscrollbar" ); mSlider->SetThemeControl( Theme, "hscrollbar_slider" ); mSlider->GetBackSlider()->SetThemeControl( Theme, "hscrollbar_bg" ); mSlider->GetSliderButton()->SetThemeControl( Theme, "hscrollbar_button" ); mBtnUp->SetThemeControl( Theme, "hscrollbar_btnup" ); mBtnDown->SetThemeControl( Theme, "hscrollbar_btndown" ); } else { - cUIControl::SetThemeControl( Theme, "vscrollbar" ); + UIControl::SetThemeControl( Theme, "vscrollbar" ); mSlider->SetThemeControl( Theme, "vscrollbar_slider" ); mSlider->GetBackSlider()->SetThemeControl( Theme, "vscrollbar_bg" ); mSlider->GetSliderButton()->SetThemeControl( Theme, "vscrollbar_button" ); @@ -71,12 +71,12 @@ void cUIScrollBar::SetTheme( cUITheme * Theme ) { } SubTexture * tSubTexture = NULL; - cUISkin * tSkin = NULL; + UISkin * tSkin = NULL; tSkin = mBtnUp->GetSkin(); if ( NULL != tSkin ) { - tSubTexture = tSkin->GetSubTexture( cUISkinState::StateNormal ); + tSubTexture = tSkin->GetSubTexture( UISkinState::StateNormal ); if ( NULL != tSubTexture ) { mBtnUp->Size( tSubTexture->RealSize() ); @@ -86,7 +86,7 @@ void cUIScrollBar::SetTheme( cUITheme * Theme ) { tSkin = mBtnDown->GetSkin(); if ( NULL != tSkin ) { - tSubTexture = tSkin->GetSubTexture( cUISkinState::StateNormal ); + tSubTexture = tSkin->GetSubTexture( UISkinState::StateNormal ); if ( NULL != tSubTexture ) { mBtnDown->Size( tSubTexture->RealSize() ); @@ -97,7 +97,7 @@ void cUIScrollBar::SetTheme( cUITheme * Theme ) { tSkin = mSlider->GetBackSlider()->GetSkin(); if ( NULL != tSkin ) { - tSubTexture = tSkin->GetSubTexture( cUISkinState::StateNormal ); + tSubTexture = tSkin->GetSubTexture( UISkinState::StateNormal ); if ( NULL != tSubTexture ) { if ( mSlider->IsVertical() ) { @@ -118,13 +118,13 @@ void cUIScrollBar::SetTheme( cUITheme * Theme ) { mSlider->AdjustChilds(); } -void cUIScrollBar::OnSizeChange() { +void UIScrollBar::OnSizeChange() { AdjustChilds(); mSlider->AdjustChilds(); - cUIComplexControl::OnSizeChange(); + UIComplexControl::OnSizeChange(); } -void cUIScrollBar::AdjustChilds() { +void UIScrollBar::AdjustChilds() { mBtnUp->Pos( 0, 0 ); if ( !IsVertical() ) { @@ -146,15 +146,15 @@ void cUIScrollBar::AdjustChilds() { } } -void cUIScrollBar::Update() { - cUIControlAnim::Update(); +void UIScrollBar::Update() { + UIControlAnim::Update(); if ( mBtnUp->IsMouseOver() || mBtnDown->IsMouseOver() ) { - ManageClick( cUIManager::instance()->GetInput()->ClickTrigger() ); + ManageClick( UIManager::instance()->GetInput()->ClickTrigger() ); } } -void cUIScrollBar::ManageClick( const Uint32& Flags ) { +void UIScrollBar::ManageClick( const Uint32& Flags ) { if ( Flags & EE_BUTTONS_WUWD ) { if ( Flags & EE_BUTTON_WUMASK ) mSlider->Value( Value() + ClickStep() ); @@ -163,9 +163,9 @@ void cUIScrollBar::ManageClick( const Uint32& Flags ) { } } -Uint32 cUIScrollBar::OnMessage( const cUIMessage * Msg ) { +Uint32 UIScrollBar::OnMessage( const UIMessage * Msg ) { switch ( Msg->Msg() ) { - case cUIMessage::MsgClick: + case UIMessage::MsgClick: { if ( Msg->Flags() & EE_BUTTON_LMASK ) { if ( Msg->Sender() == mBtnUp ) { @@ -182,60 +182,60 @@ Uint32 cUIScrollBar::OnMessage( const cUIMessage * Msg ) { return 0; } -void cUIScrollBar::Value( Float Val ) { +void UIScrollBar::Value( Float Val ) { mSlider->Value( Val ); } -const Float& cUIScrollBar::Value() const { +const Float& UIScrollBar::Value() const { return mSlider->Value(); } -void cUIScrollBar::MinValue( const Float& MinVal ) { +void UIScrollBar::MinValue( const Float& MinVal ) { mSlider->MinValue( MinVal ); } -const Float& cUIScrollBar::MinValue() const { +const Float& UIScrollBar::MinValue() const { return mSlider->MinValue(); } -void cUIScrollBar::MaxValue( const Float& MaxVal ) { +void UIScrollBar::MaxValue( const Float& MaxVal ) { mSlider->MaxValue( MaxVal ); } -const Float& cUIScrollBar::MaxValue() const { +const Float& UIScrollBar::MaxValue() const { return mSlider->MaxValue(); } -void cUIScrollBar::ClickStep( const Float& step ) { +void UIScrollBar::ClickStep( const Float& step ) { mSlider->ClickStep( step ); } -const Float& cUIScrollBar::ClickStep() const { +const Float& UIScrollBar::ClickStep() const { return mSlider->ClickStep(); } -const bool& cUIScrollBar::IsVertical() const { +const bool& UIScrollBar::IsVertical() const { return mSlider->IsVertical(); } -void cUIScrollBar::OnValueChangeCb( const cUIEvent * Event ) { +void UIScrollBar::OnValueChangeCb( const UIEvent * Event ) { OnValueChange(); } -cUISlider * cUIScrollBar::Slider() const { +UISlider * UIScrollBar::Slider() const { return mSlider; } -cUIControlAnim * cUIScrollBar::ButtonUp() const { +UIControlAnim * UIScrollBar::ButtonUp() const { return mBtnUp; } -cUIControlAnim * cUIScrollBar::ButtonDown() const { +UIControlAnim * UIScrollBar::ButtonDown() const { return mBtnDown; } -void cUIScrollBar::OnAlphaChange() { - cUIControlAnim::OnAlphaChange(); +void UIScrollBar::OnAlphaChange() { + UIControlAnim::OnAlphaChange(); mSlider->Alpha( mAlpha ); mBtnUp->Alpha( mAlpha ); diff --git a/src/eepp/ui/uiselectbutton.cpp b/src/eepp/ui/uiselectbutton.cpp new file mode 100644 index 000000000..3d5c694b2 --- /dev/null +++ b/src/eepp/ui/uiselectbutton.cpp @@ -0,0 +1,66 @@ +#include +#include + +namespace EE { namespace UI { + +UISelectButton::UISelectButton( const UIPushButton::CreateParams& Params ) : + UIPushButton( Params ) +{ +} + +UISelectButton::~UISelectButton() { +} + +Uint32 UISelectButton::Type() const { + return UI_TYPE_SELECTBUTTON; +} + +bool UISelectButton::IsType( const Uint32& type ) const { + return UISelectButton::Type() == type ? true : UIPushButton::IsType( type ); +} + +void UISelectButton::Select() { + bool wasSelected = Selected(); + + SetSkinState( UISkinState::StateSelected ); + + mControlFlags |= UI_CTRL_FLAG_SELECTED; + + if ( !wasSelected ) { + UIMessage tMsg( this, UIMessage::MsgSelected, 0 ); + MessagePost( &tMsg ); + } +} + +void UISelectButton::Unselect() { + if ( mControlFlags & UI_CTRL_FLAG_SELECTED ) + mControlFlags &= ~UI_CTRL_FLAG_SELECTED; + + SetSkinState( UISkinState::StateNormal ); +} + +bool UISelectButton::Selected() const { + return 0 != ( mControlFlags & UI_CTRL_FLAG_SELECTED ); +} + +void UISelectButton::OnStateChange() { + if ( mSkinState->GetState() != UISkinState::StateSelected && Selected() ) { + if ( mSkinState->StateExists( UISkinState::StateSelected ) ) { + SetSkinState( UISkinState::StateSelected ); + } + } + + if ( Parent()->Type() & UI_TYPE_WINMENU ) { + UIWinMenu * Menu = reinterpret_cast ( Parent() ); + + if ( mSkinState->GetState() == UISkinState::StateSelected ) { + TextBox()->Color( Menu->FontSelectedColor() ); + } else if ( mSkinState->GetState() == UISkinState::StateMouseEnter ) { + TextBox()->Color( Menu->FontOverColor() ); + } else { + TextBox()->Color( Menu->FontColor() ); + } + } +} + +}} diff --git a/src/eepp/ui/uiseparator.cpp b/src/eepp/ui/uiseparator.cpp new file mode 100644 index 000000000..3f49603b4 --- /dev/null +++ b/src/eepp/ui/uiseparator.cpp @@ -0,0 +1,31 @@ +#include +#include + +namespace EE { namespace UI { + +UISeparator::UISeparator( UIControlAnim::CreateParams Params ) : + UIControlAnim( Params ) +{ + ApplyDefaultTheme(); +} + +UISeparator::~UISeparator() { +} + +Uint32 UISeparator::Type() const { + return UI_TYPE_SEPARATOR; +} + +bool UISeparator::IsType( const Uint32& type ) const { + return UISeparator::Type() == type ? true : UIControlAnim::IsType( type ); +} + +void UISeparator::SetTheme( UITheme * Theme ) { + UIControl::SetThemeControl( Theme, "separator" ); + + if ( NULL != mSkinState && NULL != mSkinState->GetSkin() && NULL != mSkinState->GetSkin()->GetSubTexture( UISkinState::StateNormal ) ) { + Size( mSize.Width(), mSkinState->GetSkin()->GetSubTexture( UISkinState::StateNormal )->RealSize().Height() ); + } +} + +}} diff --git a/src/eepp/ui/uiskin.cpp b/src/eepp/ui/uiskin.cpp new file mode 100644 index 000000000..d33f12e44 --- /dev/null +++ b/src/eepp/ui/uiskin.cpp @@ -0,0 +1,85 @@ +#include +#include + +namespace EE { namespace UI { + +const char * UISkinStatesNames[] = { + "normal", + "focus", + "selected", + "menter", + "mexit", + "mdown" +}; + +const char * UISkin::GetSkinStateName( const Uint32& State ) { + return UISkinStatesNames[ State ]; +} + +UISkin::UISkin( const std::string& Name, const Uint32& Type ) : + mType( Type ), + mName( Name ), + mNameHash( String::Hash( mName ) ), + mTheme(NULL) +{ + ColorA tColor( 255, 255, 255, 255 ); + + mColorDefault = tColor.GetValue(); + + for ( Int32 i = 0; i < UISkinState::StateCount; i++ ) { + mColor[ i ] = tColor; + } +} + +UISkin::~UISkin() { +} + +void UISkin::SetColor( const Uint32& State, const ColorA& Color ) { + eeASSERT ( State < UISkinState::StateCount ); + + BitOp::WriteBitKey( &mColorDefault, State, 0 ); + + mColor[ State ] = Color; +} + +const ColorA& UISkin::GetColor( const Uint32& State ) const { + eeASSERT ( State < UISkinState::StateCount ); + + return mColor[ State ]; +} + +const std::string& UISkin::Name() const { + return mName; +} + +void UISkin::Name( const std::string& name ) { + mName = name; + mNameHash = String::Hash( mName ); +} + +const Uint32& UISkin::Id() const { + return mNameHash; +} + +void UISkin::SetSkins() { + for ( Int32 i = 0; i < UISkinState::StateCount; i++ ) + SetSkin( i ); +} + +UITheme * UISkin::Theme() const { + return mTheme; +} + +void UISkin::Theme( UITheme * theme ) { + mTheme = theme; +} + +const Uint32& UISkin::GetType() const { + return mType; +} + +bool UISkin::GetColorDefault( const Uint32& State ) { + return BitOp::ReadBitKey( &mColorDefault, State ); +} + +}} diff --git a/src/eepp/ui/cuiskincomplex.cpp b/src/eepp/ui/uiskincomplex.cpp similarity index 69% rename from src/eepp/ui/cuiskincomplex.cpp rename to src/eepp/ui/uiskincomplex.cpp index 3a5023138..e6b1899ef 100644 --- a/src/eepp/ui/cuiskincomplex.cpp +++ b/src/eepp/ui/uiskincomplex.cpp @@ -1,33 +1,33 @@ -#include +#include #include namespace EE { namespace UI { -static const char SideSuffix[ cUISkinComplex::SideCount ][4] = { +static const char SideSuffix[ UISkinComplex::SideCount ][4] = { "ml", "mr","d","u","ul","ur","dl","dr","m" }; -std::string cUISkinComplex::GetSideSuffix( const Uint32& Side ) { - eeASSERT( Side < cUISkinComplex::SideCount ); +std::string UISkinComplex::GetSideSuffix( const Uint32& Side ) { + eeASSERT( Side < UISkinComplex::SideCount ); return std::string( SideSuffix[ Side ] ); } -cUISkinComplex::cUISkinComplex( const std::string& Name ) : - cUISkin( Name, UISkinComplex ) +UISkinComplex::UISkinComplex( const std::string& Name ) : + UISkin( Name, SkinComplex ) { - for ( Int32 x = 0; x < cUISkinState::StateCount; x++ ) + for ( Int32 x = 0; x < UISkinState::StateCount; x++ ) for ( Int32 y = 0; y < SideCount; y++ ) mSubTexture[ x ][ y ] = NULL; SetSkins(); } -cUISkinComplex::~cUISkinComplex() { +UISkinComplex::~UISkinComplex() { } -void cUISkinComplex::Draw( const Float& X, const Float& Y, const Float& Width, const Float& Height, const Uint32& Alpha, const Uint32& State ) { +void UISkinComplex::Draw( const Float& X, const Float& Y, const Float& Width, const Float& Height, const Uint32& Alpha, const Uint32& State ) { if ( 0 == Alpha ) return; @@ -142,53 +142,53 @@ void cUISkinComplex::Draw( const Float& X, const Float& Y, const Float& Width, c } } -void cUISkinComplex::SetSkin( const Uint32& State ) { - eeASSERT ( State < cUISkinState::StateCount ); +void UISkinComplex::SetSkin( const Uint32& State ) { + eeASSERT ( State < UISkinState::StateCount ); for ( Uint32 Side = 0; Side < SideCount; Side++ ) { - SubTexture * SubTexture = TextureAtlasManager::instance()->GetSubTextureByName( std::string( mName + "_" + cUISkin::GetSkinStateName( State ) + "_" + SideSuffix[ Side ] ) ); + SubTexture * SubTexture = TextureAtlasManager::instance()->GetSubTextureByName( std::string( mName + "_" + UISkin::GetSkinStateName( State ) + "_" + SideSuffix[ Side ] ) ); if ( NULL != SubTexture ) mSubTexture[ State ][ Side ] = SubTexture; } } -SubTexture * cUISkinComplex::GetSubTexture( const Uint32& State ) const { - eeASSERT ( State < cUISkinState::StateCount ); +SubTexture * UISkinComplex::GetSubTexture( const Uint32& State ) const { + eeASSERT ( State < UISkinState::StateCount ); return mSubTexture[ State ][ Center ]; } -SubTexture * cUISkinComplex::GetSubTextureSide( const Uint32& State, const Uint32& Side ) { - eeASSERT ( State < cUISkinState::StateCount && Side < cUISkinComplex::SideCount ); +SubTexture * UISkinComplex::GetSubTextureSide( const Uint32& State, const Uint32& Side ) { + eeASSERT ( State < UISkinState::StateCount && Side < UISkinComplex::SideCount ); return mSubTexture[ State ][ Side ]; } -void cUISkinComplex::StateNormalToState( const Uint32& State ) { +void UISkinComplex::StateNormalToState( const Uint32& State ) { if ( NULL == mSubTexture[ State ][ 0 ] ) { for ( Uint32 Side = 0; Side < SideCount; Side++ ) { - mSubTexture[ State ][ Side ] = mSubTexture[ cUISkinState::StateNormal ][ Side ]; + mSubTexture[ State ][ Side ] = mSubTexture[ UISkinState::StateNormal ][ Side ]; } } } -cUISkinComplex * cUISkinComplex::Copy( const std::string& NewName, const bool& CopyColorsState ) { - cUISkinComplex * SkinC = eeNew( cUISkinComplex, ( NewName ) ); +UISkinComplex * UISkinComplex::Copy( const std::string& NewName, const bool& CopyColorsState ) { + UISkinComplex * SkinC = eeNew( UISkinComplex, ( NewName ) ); if ( CopyColorsState ) { SkinC->mColorDefault = mColorDefault; - memcpy( &SkinC->mColor[0], &mColor[0], cUISkinState::StateCount * sizeof(ColorA) ); + memcpy( &SkinC->mColor[0], &mColor[0], UISkinState::StateCount * sizeof(ColorA) ); } - memcpy( &SkinC->mSubTexture[0], &mSubTexture[0], cUISkinState::StateCount * SideCount * sizeof(SubTexture*) ); + memcpy( &SkinC->mSubTexture[0], &mSubTexture[0], UISkinState::StateCount * SideCount * sizeof(SubTexture*) ); return SkinC; } -cUISkin * cUISkinComplex::Copy() { +UISkin * UISkinComplex::Copy() { return Copy( mName, true ); } diff --git a/src/eepp/ui/uiskinsimple.cpp b/src/eepp/ui/uiskinsimple.cpp new file mode 100644 index 000000000..f255614e7 --- /dev/null +++ b/src/eepp/ui/uiskinsimple.cpp @@ -0,0 +1,75 @@ +#include +#include + +namespace EE { namespace UI { + +UISkinSimple::UISkinSimple( const std::string& Name ) : + UISkin( Name, SkinSimple ) +{ + for ( Int32 i = 0; i < UISkinState::StateCount; i++ ) + mSubTexture[ i ] = NULL; + + SetSkins(); +} + +UISkinSimple::~UISkinSimple() { +} + +void UISkinSimple::Draw( const Float& X, const Float& Y, const Float& Width, const Float& Height, const Uint32& Alpha, const Uint32& State ) { + if ( 0 == Alpha ) + return; + + SubTexture * tSubTexture = mSubTexture[ State ]; + mTempColor = mColor[ State ]; + + if ( NULL != tSubTexture ) { + tSubTexture->DestSize( Sizef( Width, Height ) ); + + if ( mTempColor.Alpha != Alpha ) { + mTempColor.Alpha = (Uint8)( (Float)mTempColor.Alpha * ( (Float)Alpha / 255.f ) ); + } + + tSubTexture->Draw( X, Y, mTempColor ); + + tSubTexture->ResetDestSize(); + } +} + +void UISkinSimple::SetSkin( const Uint32& State ) { + eeASSERT ( State < UISkinState::StateCount ); + + std::string Name( mName + "_" + UISkin::GetSkinStateName( State ) ); + + mSubTexture[ State ] = TextureAtlasManager::instance()->GetSubTextureByName( Name ); +} + +SubTexture * UISkinSimple::GetSubTexture( const Uint32& State ) const { + eeASSERT ( State < UISkinState::StateCount ); + + return mSubTexture[ State ]; +} + +void UISkinSimple::StateNormalToState( const Uint32& State ) { + if ( NULL == mSubTexture[ State ] ) + mSubTexture[ State ] = mSubTexture[ UISkinState::StateNormal ]; +} + +UISkinSimple * UISkinSimple::Copy( const std::string& NewName, const bool& CopyColorsState ) { + UISkinSimple * SkinS = eeNew( UISkinSimple, ( NewName ) ); + + if ( CopyColorsState ) { + SkinS->mColorDefault = mColorDefault; + + memcpy( &SkinS->mColor[0], &mColor[0], UISkinState::StateCount * sizeof(ColorA) ); + } + + memcpy( &SkinS->mSubTexture[0], &mSubTexture[0], UISkinState::StateCount * sizeof(SubTexture*) ); + + return SkinS; +} + +UISkin * UISkinSimple::Copy() { + return Copy( mName, true ); +} + +}} diff --git a/src/eepp/ui/cuiskinstate.cpp b/src/eepp/ui/uiskinstate.cpp similarity index 57% rename from src/eepp/ui/cuiskinstate.cpp rename to src/eepp/ui/uiskinstate.cpp index d6467a46b..03abb880e 100644 --- a/src/eepp/ui/cuiskinstate.cpp +++ b/src/eepp/ui/uiskinstate.cpp @@ -1,9 +1,9 @@ -#include -#include +#include +#include namespace EE { namespace UI { -cUISkinState::cUISkinState( cUISkin * Skin ) : +UISkinState::UISkinState( UISkin * Skin ) : mSkin( Skin ), mCurState(0), mLastState(0) @@ -11,15 +11,15 @@ cUISkinState::cUISkinState( cUISkin * Skin ) : eeASSERT( NULL != mSkin ); } -cUISkinState::~cUISkinState() { +UISkinState::~UISkinState() { } -void cUISkinState::Draw( const Float& X, const Float& Y, const Float& Width, const Float& Height, const Uint32& Alpha ) { +void UISkinState::Draw( const Float& X, const Float& Y, const Float& Width, const Float& Height, const Uint32& Alpha ) { if ( NULL != mSkin ) mSkin->Draw( X, Y, Width, Height, Alpha, mCurState ); } -void cUISkinState::StateBack( const Uint32& State ) { +void UISkinState::StateBack( const Uint32& State ) { if ( ( StateFocus == State ) && StateMouseEnter == mCurState && StateNormal == mLastState ) { return; } @@ -34,7 +34,7 @@ void cUISkinState::StateBack( const Uint32& State ) { } } -void cUISkinState::SetPrevState() { +void UISkinState::SetPrevState() { if ( StateMouseDown == mCurState ) { Uint32 State = mCurState; mCurState = mLastState; @@ -42,21 +42,21 @@ void cUISkinState::SetPrevState() { } } -const Uint32& cUISkinState::GetPrevState() const { +const Uint32& UISkinState::GetPrevState() const { return mLastState; } -const Uint32& cUISkinState::GetState() const { +const Uint32& UISkinState::GetState() const { return mCurState; } -void cUISkinState::SetState( const Uint32& State ) { - eeASSERT ( State < cUISkinState::StateCount ); +void UISkinState::SetState( const Uint32& State ) { + eeASSERT ( State < UISkinState::StateCount ); switch ( mSkin->GetType() ) { - case cUISkin::UISkinSimple: - case cUISkin::UISkinComplex: + case UISkin::SkinSimple: + case UISkin::SkinComplex: SetStateTypeSimple( State ); break; default: @@ -64,8 +64,8 @@ void cUISkinState::SetState( const Uint32& State ) { } } -void cUISkinState::SetStateTypeSimple( const Uint32& State ) { - eeASSERT ( State < cUISkinState::StateCount ); +void UISkinState::SetStateTypeSimple( const Uint32& State ) { + eeASSERT ( State < UISkinState::StateCount ); if ( mCurState == State ) return; @@ -79,8 +79,8 @@ void cUISkinState::SetStateTypeSimple( const Uint32& State ) { StateBack( State ); } -void cUISkinState::SetStateTypeDefault( const Uint32& State ) { - eeASSERT ( State < cUISkinState::StateCount ); +void UISkinState::SetStateTypeDefault( const Uint32& State ) { + eeASSERT ( State < UISkinState::StateCount ); if ( !mSkin->GetColorDefault( State ) ) mCurState = State; @@ -88,15 +88,15 @@ void cUISkinState::SetStateTypeDefault( const Uint32& State ) { StateBack( State ); } -cUISkin * cUISkinState::GetSkin() const { +UISkin * UISkinState::GetSkin() const { return mSkin; } -bool cUISkinState::StateExists( const Uint32& State ) { +bool UISkinState::StateExists( const Uint32& State ) { switch ( mSkin->GetType() ) { - case cUISkin::UISkinSimple: - case cUISkin::UISkinComplex: + case UISkin::SkinSimple: + case UISkin::SkinComplex: return NULL != mSkin->GetSubTexture( State ); } diff --git a/src/eepp/ui/cuislider.cpp b/src/eepp/ui/uislider.cpp similarity index 76% rename from src/eepp/ui/cuislider.cpp rename to src/eepp/ui/uislider.cpp index b2434e386..051d59e2e 100644 --- a/src/eepp/ui/cuislider.cpp +++ b/src/eepp/ui/uislider.cpp @@ -1,11 +1,11 @@ -#include -#include +#include +#include #include namespace EE { namespace UI { -cUISlider::cUISlider( const cUISlider::CreateParams& Params ) : - cUIComplexControl( Params ), +UISlider::UISlider( const UISlider::CreateParams& Params ) : + UIComplexControl( Params ), mVertical( Params.VerticalSlider ), mAllowHalfSliderOut( Params.AllowHalfSliderOut ), mExpandBackground( Params.ExpandBackground ), @@ -17,7 +17,7 @@ cUISlider::cUISlider( const cUISlider::CreateParams& Params ) : mClickStep( 0.1f ), mOnPosChange( false ) { - cUIControl::CreateParams BgParams; + UIControl::CreateParams BgParams; BgParams.Parent( this ); if ( !mVertical ) @@ -25,17 +25,17 @@ cUISlider::cUISlider( const cUISlider::CreateParams& Params ) : else BgParams.Size = Sizei( 8, mSize.Width() - 16 ); - mBackSlider = eeNew( cUIControlAnim, ( BgParams ) ); + mBackSlider = eeNew( UIControlAnim, ( BgParams ) ); mBackSlider->Visible( true ); mBackSlider->Enabled( true ); mBackSlider->Center(); - cUIDragable::CreateParams SlideParams; + UIDragable::CreateParams SlideParams; SlideParams.Parent( this ); SlideParams.Size = Sizei( 16, 16 ); SlideParams.PosSet( Vector2i( 0, 0 ) ); - mSlider = eeNew( Private::cUISliderButton, ( SlideParams ) ); + mSlider = eeNew( Private::UISliderButton, ( SlideParams ) ); mSlider->Enabled( true ); mSlider->Visible( true ); mSlider->DragEnable( true ); @@ -48,25 +48,25 @@ cUISlider::cUISlider( const cUISlider::CreateParams& Params ) : ApplyDefaultTheme(); } -cUISlider::~cUISlider() { +UISlider::~UISlider() { } -Uint32 cUISlider::Type() const { +Uint32 UISlider::Type() const { return UI_TYPE_SLIDER; } -bool cUISlider::IsType( const Uint32& type ) const { - return cUISlider::Type() == type ? true : cUIComplexControl::IsType( type ); +bool UISlider::IsType( const Uint32& type ) const { + return UISlider::Type() == type ? true : UIComplexControl::IsType( type ); } -void cUISlider::SetTheme( cUITheme * Theme ) { +void UISlider::SetTheme( UITheme * Theme ) { if ( !mVertical ) { - cUIControl::SetThemeControl( Theme, "hslider" ); + UIControl::SetThemeControl( Theme, "hslider" ); mBackSlider->SetThemeControl( Theme, "hslider_bg" ); mSlider->SetThemeControl( Theme, "hslider_button" ); } else { - cUIControl::SetThemeControl( Theme, "vslider" ); + UIControl::SetThemeControl( Theme, "vslider" ); mBackSlider->SetThemeControl( Theme, "vslider_bg" ); mSlider->SetThemeControl( Theme, "vslider_button" ); @@ -77,19 +77,19 @@ void cUISlider::SetTheme( cUITheme * Theme ) { Value( mValue ); } -void cUISlider::OnSizeChange() { - cUIComplexControl::OnSizeChange(); +void UISlider::OnSizeChange() { + UIComplexControl::OnSizeChange(); AdjustChilds(); } -void cUISlider::AdjustChilds() { +void UISlider::AdjustChilds() { SubTexture * tSubTexture = NULL; - cUISkin * tSkin = NULL; + UISkin * tSkin = NULL; tSkin = mSlider->GetSkin(); if ( NULL != tSkin ) { - tSubTexture = tSkin->GetSubTexture( cUISkinState::StateNormal ); + tSubTexture = tSkin->GetSubTexture( UISkinState::StateNormal ); if ( NULL != tSubTexture ) { mSlider->Size( tSubTexture->RealSize() ); @@ -104,7 +104,7 @@ void cUISlider::AdjustChilds() { tSkin = mBackSlider->GetSkin(); if ( NULL != tSkin ) { - tSubTexture = tSkin->GetSubTexture( cUISkinState::StateNormal ); + tSubTexture = tSkin->GetSubTexture( UISkinState::StateNormal ); if ( NULL != tSubTexture ) { if ( !mVertical ) { @@ -138,7 +138,7 @@ void cUISlider::AdjustChilds() { } } -void cUISlider::FixSliderPos() { +void UISlider::FixSliderPos() { if ( !mOnPosChange ) { mOnPosChange = true; @@ -188,7 +188,7 @@ void cUISlider::FixSliderPos() { } } -void cUISlider::Value( Float Val ) { +void UISlider::Value( Float Val ) { if ( Val < mMinValue ) Val = mMinValue; if ( Val > mMaxValue ) Val = mMaxValue; @@ -219,11 +219,11 @@ void cUISlider::Value( Float Val ) { } } -const Float& cUISlider::Value() const { +const Float& UISlider::Value() const { return mValue; } -void cUISlider::MinValue( const Float& MinVal ) { +void UISlider::MinValue( const Float& MinVal ) { mMinValue = MinVal; if ( mValue < mMinValue ) @@ -232,11 +232,11 @@ void cUISlider::MinValue( const Float& MinVal ) { FixSliderPos(); } -const Float& cUISlider::MinValue() const { +const Float& UISlider::MinValue() const { return mMinValue; } -void cUISlider::MaxValue( const Float& MaxVal ) { +void UISlider::MaxValue( const Float& MaxVal ) { mMaxValue = MaxVal; if ( mValue > mMaxValue ) @@ -245,31 +245,31 @@ void cUISlider::MaxValue( const Float& MaxVal ) { FixSliderPos(); } -const Float& cUISlider::MaxValue() const { +const Float& UISlider::MaxValue() const { return mMaxValue; } -void cUISlider::ClickStep( const Float& step ) { +void UISlider::ClickStep( const Float& step ) { mClickStep = step; } -const Float& cUISlider::ClickStep() const { +const Float& UISlider::ClickStep() const { return mClickStep; } -const bool& cUISlider::IsVertical() const { +const bool& UISlider::IsVertical() const { return mVertical; } -void cUISlider::Update() { - cUIControlAnim::Update(); +void UISlider::Update() { + UIControlAnim::Update(); if ( IsMouseOver() || mBackSlider->IsMouseOver() || mSlider->IsMouseOver() ) { - ManageClick( cUIManager::instance()->GetInput()->ClickTrigger() ); + ManageClick( UIManager::instance()->GetInput()->ClickTrigger() ); } } -Uint32 cUISlider::OnKeyDown( const cUIEventKey &Event ) { +Uint32 UISlider::OnKeyDown( const UIEventKey &Event ) { if ( Sys::GetTicks() - mLastTickMove > 100 ) { if ( Event.KeyCode() == KEY_DOWN ) { mLastTickMove = Sys::GetTicks(); @@ -290,12 +290,12 @@ Uint32 cUISlider::OnKeyDown( const cUIEventKey &Event ) { } } - return cUIComplexControl::OnKeyDown( Event ); + return UIComplexControl::OnKeyDown( Event ); } -void cUISlider::ManageClick( const Uint32& Flags ) { +void UISlider::ManageClick( const Uint32& Flags ) { if ( Flags ) { - Vector2i ControlPos = cUIManager::instance()->GetMousePos(); + Vector2i ControlPos = UIManager::instance()->GetMousePos(); mSlider->WorldToControl( ControlPos ); if ( Flags & EE_BUTTON_LMASK && !mSlider->IsMouseOver() ) { @@ -319,24 +319,24 @@ void cUISlider::ManageClick( const Uint32& Flags ) { } } -cUIControl * cUISlider::GetBackSlider() const { +UIControl * UISlider::GetBackSlider() const { return mBackSlider; } -cUIDragable * cUISlider::GetSliderButton() const { +UIDragable * UISlider::GetSliderButton() const { return mSlider; } -const bool& cUISlider::AllowHalfSliderOut() const { +const bool& UISlider::AllowHalfSliderOut() const { return mAllowHalfSliderOut; } -const bool& cUISlider::ExpandBackground() const { +const bool& UISlider::ExpandBackground() const { return mExpandBackground; } -void cUISlider::OnAlphaChange() { - cUIControlAnim::OnAlphaChange(); +void UISlider::OnAlphaChange() { + UIControlAnim::OnAlphaChange(); mBackSlider->Alpha( mAlpha ); mSlider->Alpha( mAlpha ); diff --git a/src/eepp/ui/uisliderbutton.cpp b/src/eepp/ui/uisliderbutton.cpp new file mode 100644 index 000000000..876de673e --- /dev/null +++ b/src/eepp/ui/uisliderbutton.cpp @@ -0,0 +1,22 @@ +#include +#include + +namespace EE { namespace UI { namespace Private { + +UISliderButton::UISliderButton( const UIControlAnim::CreateParams& Params ) : + UIControlAnim( Params ) +{ + ApplyDefaultTheme(); +} + +UISliderButton::~UISliderButton() { +} + +void UISliderButton::OnPosChange() { + UIControlAnim::OnPosChange(); + + UISlider * Slider = reinterpret_cast ( mParentCtrl ); + Slider->FixSliderPos(); +} + +}}} diff --git a/src/eepp/ui/cuispinbox.cpp b/src/eepp/ui/uispinbox.cpp similarity index 67% rename from src/eepp/ui/cuispinbox.cpp rename to src/eepp/ui/uispinbox.cpp index 0176b9792..99c05c9d1 100644 --- a/src/eepp/ui/cuispinbox.cpp +++ b/src/eepp/ui/uispinbox.cpp @@ -1,16 +1,16 @@ -#include +#include #include namespace EE { namespace UI { -cUISpinBox::cUISpinBox( const cUISpinBox::CreateParams& Params ) : - cUIComplexControl( Params ), +UISpinBox::UISpinBox( const UISpinBox::CreateParams& Params ) : + UIComplexControl( Params ), mMinValue( 0.f ), mMaxValue( 1024.f ), mValue( Params.DefaultValue ), mClickStep( 1.f ) { - cUITextInput::CreateParams InputParams( Params ); + UITextInput::CreateParams InputParams( Params ); InputParams.PosSet( 0, 0 ); InputParams.Parent( this ); @@ -22,17 +22,17 @@ cUISpinBox::cUISpinBox( const cUISpinBox::CreateParams& Params ) : InputParams.Flags |= UI_AUTO_PADDING; - mInput = eeNew( cUITextInput, ( InputParams ) ); + mInput = eeNew( UITextInput, ( InputParams ) ); - cUIControlAnim::CreateParams BtnParams( Params ); + UIControlAnim::CreateParams BtnParams( Params ); BtnParams.Parent( this ); BtnParams.Size = Sizei( 16, 16 ); if ( BtnParams.Flags & UI_CLIP_ENABLE ) BtnParams.Flags &= ~UI_CLIP_ENABLE; - mPushUp = eeNew( cUIControlAnim, ( BtnParams ) ); - mPushDown = eeNew( cUIControlAnim, ( BtnParams ) ); + mPushUp = eeNew( UIControlAnim, ( BtnParams ) ); + mPushDown = eeNew( UIControlAnim, ( BtnParams ) ); mInput->Visible ( true ); mInput->Enabled ( true ); @@ -50,31 +50,31 @@ cUISpinBox::cUISpinBox( const cUISpinBox::CreateParams& Params ) : ApplyDefaultTheme(); } -cUISpinBox::~cUISpinBox() { +UISpinBox::~UISpinBox() { } -Uint32 cUISpinBox::Type() const { +Uint32 UISpinBox::Type() const { return UI_TYPE_SPINBOX; } -bool cUISpinBox::IsType( const Uint32& type ) const { - return cUISpinBox::Type() == type ? true : cUIComplexControl::IsType( type ); +bool UISpinBox::IsType( const Uint32& type ) const { + return UISpinBox::Type() == type ? true : UIComplexControl::IsType( type ); } -void cUISpinBox::SetTheme( cUITheme * Theme ) { - cUIControl::SetThemeControl ( Theme, "spinbox" ); +void UISpinBox::SetTheme( UITheme * Theme ) { + UIControl::SetThemeControl ( Theme, "spinbox" ); mInput->SetThemeControl ( Theme, "spinbox_input" ); mPushUp->SetThemeControl ( Theme, "spinbox_btnup" ); mPushDown->SetThemeControl ( Theme, "spinbox_btndown" ); SubTexture * tSubTexture = NULL; - cUISkin * tSkin = NULL; + UISkin * tSkin = NULL; tSkin = mPushUp->GetSkin(); if ( NULL != tSkin ) { - tSubTexture = tSkin->GetSubTexture( cUISkinState::StateNormal ); + tSubTexture = tSkin->GetSubTexture( UISkinState::StateNormal ); if ( NULL != tSubTexture ) { mPushUp->Size( tSubTexture->RealSize() ); @@ -84,7 +84,7 @@ void cUISpinBox::SetTheme( cUITheme * Theme ) { tSkin = mPushDown->GetSkin(); if ( NULL != tSkin ) { - tSubTexture = tSkin->GetSubTexture( cUISkinState::StateNormal ); + tSubTexture = tSkin->GetSubTexture( UISkinState::StateNormal ); if ( NULL != tSubTexture ) { mPushDown->Size( tSubTexture->RealSize() ); @@ -98,31 +98,31 @@ void cUISpinBox::SetTheme( cUITheme * Theme ) { AdjustChilds(); } -void cUISpinBox::AdjustChilds() { +void UISpinBox::AdjustChilds() { mPushUp->Pos( mSize.Width() - mPushUp->Size().Width(), 0 ); mPushDown->Pos( mSize.Width() - mPushDown->Size().Width(), mPushUp->Size().Height() ); mInput->Size( mSize.Width() - mPushUp->Size().Width(), mSize.Height() ); } -void cUISpinBox::Padding( const Recti& padding ) { +void UISpinBox::Padding( const Recti& padding ) { mInput->Padding( padding ); } -const Recti& cUISpinBox::Padding() const { +const Recti& UISpinBox::Padding() const { return mInput->Padding(); } -void cUISpinBox::ClickStep( const Float& step ) { +void UISpinBox::ClickStep( const Float& step ) { mClickStep = step; } -const Float& cUISpinBox::ClickStep() const { +const Float& UISpinBox::ClickStep() const { return mClickStep; } -Uint32 cUISpinBox::OnMessage( const cUIMessage * Msg ) { +Uint32 UISpinBox::OnMessage( const UIMessage * Msg ) { switch ( Msg->Msg() ) { - case cUIMessage::MsgClick: + case UIMessage::MsgClick: { if ( Msg->Flags() & EE_BUTTON_LMASK ) { if ( Msg->Sender() == mPushUp ) { @@ -144,14 +144,14 @@ Uint32 cUISpinBox::OnMessage( const cUIMessage * Msg ) { return 0; } -void cUISpinBox::AddValue( const Float& value ) { +void UISpinBox::AddValue( const Float& value ) { if ( !mInput->Text().size() ) mInput->Text( String::ToStr( static_cast( mMinValue ) ) ); Value( mValue + value ); } -void cUISpinBox::InternalValue( const Float& Val, const bool& Force ) { +void UISpinBox::InternalValue( const Float& Val, const bool& Force ) { if ( Force || Val != mValue ) { if ( Val >= mMinValue && Val <= mMaxValue ) { Float iValN = (Float)(Int32) Val; @@ -170,40 +170,40 @@ void cUISpinBox::InternalValue( const Float& Val, const bool& Force ) { } } -void cUISpinBox::Value( const Float& Val ) { +void UISpinBox::Value( const Float& Val ) { InternalValue( Val, false ); } -const Float& cUISpinBox::Value() const { +const Float& UISpinBox::Value() const { return mValue; } -void cUISpinBox::MinValue( const Float& MinVal ) { +void UISpinBox::MinValue( const Float& MinVal ) { mMinValue = MinVal; if ( mValue < mMinValue ) mValue = mMinValue; } -const Float& cUISpinBox::MinValue() const { +const Float& UISpinBox::MinValue() const { return mMinValue; } -void cUISpinBox::MaxValue( const Float& MaxVal ) { +void UISpinBox::MaxValue( const Float& MaxVal ) { mMaxValue = MaxVal; if ( mValue > mMaxValue ) mValue = mMaxValue; } -const Float& cUISpinBox::MaxValue() const { +const Float& UISpinBox::MaxValue() const { return mMaxValue; } -void cUISpinBox::Update() { +void UISpinBox::Update() { bool Changed = mInput->GetInputTextBuffer()->ChangedSinceLastUpdate(); - cUIControlAnim::Update(); + UIControlAnim::Update(); if ( Changed ) { if ( !mInput->Text().size() ) { @@ -226,20 +226,20 @@ void cUISpinBox::Update() { } } -cUIControlAnim * cUISpinBox::ButtonPushUp() const { +UIControlAnim * UISpinBox::ButtonPushUp() const { return mPushUp; } -cUIControlAnim * cUISpinBox::ButtonPushDown() const { +UIControlAnim * UISpinBox::ButtonPushDown() const { return mPushDown; } -cUITextInput * cUISpinBox::TextInput() const { +UITextInput * UISpinBox::TextInput() const { return mInput; } -void cUISpinBox::OnAlphaChange() { - cUIControlAnim::OnAlphaChange(); +void UISpinBox::OnAlphaChange() { + UIControlAnim::OnAlphaChange(); mInput->Alpha( mAlpha ); mPushUp->Alpha( mAlpha ); diff --git a/src/eepp/ui/cuisprite.cpp b/src/eepp/ui/uisprite.cpp similarity index 71% rename from src/eepp/ui/cuisprite.cpp rename to src/eepp/ui/uisprite.cpp index 20a0fbdbd..671e96f2c 100644 --- a/src/eepp/ui/cuisprite.cpp +++ b/src/eepp/ui/uisprite.cpp @@ -1,10 +1,10 @@ -#include +#include #include namespace EE { namespace UI { -cUISprite::cUISprite( const cUISprite::CreateParams& Params ) : - cUIComplexControl( Params ), +UISprite::UISprite( const UISprite::CreateParams& Params ) : + UIComplexControl( Params ), mSprite( Params.Sprite ), mRender( Params.SpriteRender ), mAlignOffset(0,0), @@ -20,24 +20,24 @@ cUISprite::cUISprite( const cUISprite::CreateParams& Params ) : } } -cUISprite::~cUISprite() { +UISprite::~UISprite() { if ( DealloSprite() ) eeSAFE_DELETE( mSprite ); } -Uint32 cUISprite::Type() const { +Uint32 UISprite::Type() const { return UI_TYPE_SPRITE; } -bool cUISprite::IsType( const Uint32& type ) const { - return cUISprite::Type() == type ? true : cUIComplexControl::IsType( type ); +bool UISprite::IsType( const Uint32& type ) const { + return UISprite::Type() == type ? true : UIComplexControl::IsType( type ); } -Uint32 cUISprite::DealloSprite() { +Uint32 UISprite::DealloSprite() { return mControlFlags & UI_CTRL_FLAG_FREE_USE; } -void cUISprite::Sprite( Graphics::Sprite * sprite ) { +void UISprite::Sprite( Graphics::Sprite * sprite ) { if ( DealloSprite() ) eeSAFE_DELETE( mSprite ); @@ -46,8 +46,8 @@ void cUISprite::Sprite( Graphics::Sprite * sprite ) { UpdateSize(); } -void cUISprite::Draw() { - cUIControlAnim::Draw(); +void UISprite::Draw() { + UIControlAnim::Draw(); if ( mVisible ) { if ( NULL != mSprite && 0.f != mAlpha ) { @@ -58,7 +58,7 @@ void cUISprite::Draw() { } } -void cUISprite::CheckSubTextureUpdate() { +void UISprite::CheckSubTextureUpdate() { if ( NULL != mSprite && NULL != mSprite->GetCurrentSubTexture() && mSprite->GetCurrentSubTexture() != mSubTextureLast ) { UpdateSize(); AutoAlign(); @@ -66,40 +66,40 @@ void cUISprite::CheckSubTextureUpdate() { } } -void cUISprite::Alpha( const Float& alpha ) { - cUIControlAnim::Alpha( alpha ); +void UISprite::Alpha( const Float& alpha ) { + UIControlAnim::Alpha( alpha ); if ( NULL != mSprite ) mSprite->Alpha( alpha ); } -Graphics::Sprite * cUISprite::Sprite() const { +Graphics::Sprite * UISprite::Sprite() const { return mSprite; } -ColorA cUISprite::Color() const { +ColorA UISprite::Color() const { if ( NULL != mSprite ) return mSprite->Color(); return ColorA(); } -void cUISprite::Color( const ColorA& color ) { +void UISprite::Color( const ColorA& color ) { if ( NULL != mSprite ) mSprite->Color( color ); Alpha( color.A() ); } -const EE_RENDER_MODE& cUISprite::RenderMode() const { +const EE_RENDER_MODE& UISprite::RenderMode() const { return mRender; } -void cUISprite::RenderMode( const EE_RENDER_MODE& render ) { +void UISprite::RenderMode( const EE_RENDER_MODE& render ) { mRender = render; } -void cUISprite::UpdateSize() { +void UISprite::UpdateSize() { if ( Flags() & UI_AUTO_SIZE ) { if ( NULL != mSprite ) { if ( NULL != mSprite->GetCurrentSubTexture() && mSprite->GetCurrentSubTexture()->Size() != mSize ) @@ -108,7 +108,7 @@ void cUISprite::UpdateSize() { } } -void cUISprite::AutoAlign() { +void UISprite::AutoAlign() { if ( NULL == mSprite || NULL == mSprite->GetCurrentSubTexture() ) return; @@ -131,11 +131,11 @@ void cUISprite::AutoAlign() { } } -const Vector2i& cUISprite::AlignOffset() const { +const Vector2i& UISprite::AlignOffset() const { return mAlignOffset; } -void cUISprite::OnSizeChange() { +void UISprite::OnSizeChange() { AutoAlign(); } diff --git a/src/eepp/ui/cuitab.cpp b/src/eepp/ui/uitab.cpp similarity index 52% rename from src/eepp/ui/cuitab.cpp rename to src/eepp/ui/uitab.cpp index 16f80be6f..839feb8ca 100644 --- a/src/eepp/ui/cuitab.cpp +++ b/src/eepp/ui/uitab.cpp @@ -1,39 +1,39 @@ -#include -#include -#include +#include +#include +#include namespace EE { namespace UI { -cUITab::cUITab( cUISelectButton::CreateParams& Params, cUIControl * CtrlOwned ) : - cUISelectButton( Params ), +UITab::UITab( UISelectButton::CreateParams& Params, UIControl * CtrlOwned ) : + UISelectButton( Params ), mCtrlOwned( CtrlOwned ) { ApplyDefaultTheme(); } -cUITab::~cUITab() { +UITab::~UITab() { } -Uint32 cUITab::Type() const { +Uint32 UITab::Type() const { return UI_TYPE_TAB; } -bool cUITab::IsType( const Uint32& type ) const { - return cUITab::Type() == type ? true : cUISelectButton::IsType( type ); +bool UITab::IsType( const Uint32& type ) const { + return UITab::Type() == type ? true : UISelectButton::IsType( type ); } -cUITabWidget * cUITab::GetTabWidget() { +UITabWidget * UITab::GetTabWidget() { if ( Parent()->Parent()->IsType( UI_TYPE_TABWIDGET ) ) { - return reinterpret_cast ( Parent()->Parent() ); + return reinterpret_cast ( Parent()->Parent() ); } return NULL; } -void cUITab::SetTheme( cUITheme * Theme ) { +void UITab::SetTheme( UITheme * Theme ) { std::string tabPos = "tab"; - cUITabWidget * tTabW = GetTabWidget(); + UITabWidget * tTabW = GetTabWidget(); if ( NULL != tTabW ) { if ( tTabW->mSpecialBorderTabs ) { @@ -45,15 +45,15 @@ void cUITab::SetTheme( cUITheme * Theme ) { } } - cUIControl::SetThemeControl( Theme, tabPos ); + UIControl::SetThemeControl( Theme, tabPos ); DoAfterSetTheme(); } -Uint32 cUITab::OnMouseClick( const Vector2i &Pos, const Uint32 Flags ) { - cUISelectButton::OnMouseClick( Pos, Flags ); +Uint32 UITab::OnMouseClick( const Vector2i &Pos, const Uint32 Flags ) { + UISelectButton::OnMouseClick( Pos, Flags ); - cUITabWidget * tTabW = GetTabWidget(); + UITabWidget * tTabW = GetTabWidget(); if ( NULL != tTabW ) { if ( Flags & EE_BUTTON_LMASK ) { @@ -64,17 +64,17 @@ Uint32 cUITab::OnMouseClick( const Vector2i &Pos, const Uint32 Flags ) { return 1; } -void cUITab::OnStateChange() { - cUISelectButton::OnStateChange(); +void UITab::OnStateChange() { + UISelectButton::OnStateChange(); - cUITabWidget * tTabW = GetTabWidget(); + UITabWidget * tTabW = GetTabWidget(); if ( NULL != tTabW ) { Size( mSize.Width(), GetSkinSize( GetSkin(), mSkinState->GetState() ).Height() ); - if ( mSkinState->GetState() == cUISkinState::StateSelected ) { + if ( mSkinState->GetState() == UISkinState::StateSelected ) { mTextBox->Color( tTabW->mFontSelectedColor ); - } else if ( mSkinState->GetState() == cUISkinState::StateMouseEnter ) { + } else if ( mSkinState->GetState() == UISkinState::StateMouseEnter ) { mTextBox->Color( tTabW->mFontOverColor ); } else { mTextBox->Color( tTabW->mFontColor ); @@ -82,16 +82,16 @@ void cUITab::OnStateChange() { } } -const String& cUITab::Text() { - return cUIPushButton::Text(); +const String& UITab::Text() { + return UIPushButton::Text(); } -void cUITab::Text( const String &text ) { - cUITabWidget * tTabW = GetTabWidget(); +void UITab::Text( const String &text ) { + UITabWidget * tTabW = GetTabWidget(); if ( NULL != tTabW ) { if ( text.size() > tTabW->mMaxTextLength ) { - cUIPushButton::Text( text.substr( 0, tTabW->mMaxTextLength ) ); + UIPushButton::Text( text.substr( 0, tTabW->mMaxTextLength ) ); SetRealSize(); @@ -99,16 +99,16 @@ void cUITab::Text( const String &text ) { } } - cUIPushButton::Text( text ); + UIPushButton::Text( text ); SetRealSize(); } -void cUITab::SetRealSize() { +void UITab::SetRealSize() { if ( mFlags & UI_AUTO_SIZE ) { Uint32 w = mTextBox->GetTextWidth() + GetSkinSize().Width(); - cUITabWidget * tTabW = GetTabWidget(); + UITabWidget * tTabW = GetTabWidget(); if ( NULL != tTabW ) { w = eemax( w, tTabW->mMinTabWidth ); @@ -119,19 +119,19 @@ void cUITab::SetRealSize() { } } -cUIControl * cUITab::CtrlOwned() const { +UIControl * UITab::CtrlOwned() const { return mCtrlOwned; } -void cUITab::Update() { - cUISelectButton::Update(); +void UITab::Update() { + UISelectButton::Update(); if ( mEnabled && mVisible ) { if ( IsMouseOver() ) { - cUITabWidget * tTabW = GetTabWidget(); + UITabWidget * tTabW = GetTabWidget(); if ( NULL != tTabW ) { - Uint32 Flags = cUIManager::instance()->GetInput()->ClickTrigger(); + Uint32 Flags = UIManager::instance()->GetInput()->ClickTrigger(); if ( Flags & EE_BUTTONS_WUWD ) { if ( Flags & EE_BUTTON_WUMASK ) { diff --git a/src/eepp/ui/cuitabwidget.cpp b/src/eepp/ui/uitabwidget.cpp similarity index 75% rename from src/eepp/ui/cuitabwidget.cpp rename to src/eepp/ui/uitabwidget.cpp index 2ec04843c..ede05a00f 100644 --- a/src/eepp/ui/cuitabwidget.cpp +++ b/src/eepp/ui/uitabwidget.cpp @@ -1,12 +1,12 @@ -#include -#include +#include +#include #include #include namespace EE { namespace UI { -cUITabWidget::cUITabWidget( cUITabWidget::CreateParams& Params ) : - cUIComplexControl( Params ), +UITabWidget::UITabWidget( UITabWidget::CreateParams& Params ) : + UIComplexControl( Params ), mFont( Params.Font ), mFontColor( Params.FontColor ), mFontShadowColor( Params.FontShadowColor ), @@ -25,23 +25,23 @@ cUITabWidget::cUITabWidget( cUITabWidget::CreateParams& Params ) : mTabSelected( NULL ), mTabSelectedIndex( eeINDEX_NOT_FOUND ) { - cUIComplexControl::CreateParams TabParams; + UIComplexControl::CreateParams TabParams; TabParams.Parent( this ); TabParams.PosSet( 0, 0 ); TabParams.Flags |= UI_CLIP_ENABLE | UI_ANCHOR_RIGHT; TabParams.SizeSet( mSize.Width(), mTabWidgetHeight ); - mTabContainer = eeNew( cUIComplexControl, ( TabParams ) ); + mTabContainer = eeNew( UIComplexControl, ( TabParams ) ); mTabContainer->Visible( true ); mTabContainer->Enabled( true ); - cUIComplexControl::CreateParams CtrlParams; + UIComplexControl::CreateParams CtrlParams; CtrlParams.Parent( this ); CtrlParams.PosSet( 0, mTabWidgetHeight ); CtrlParams.SizeSet( mSize.Width(), mSize.Height() - mTabWidgetHeight ); CtrlParams.Flags |= UI_CLIP_ENABLE | UI_ANCHOR_BOTTOM | UI_ANCHOR_RIGHT; - mCtrlContainer = eeNew( cUIComplexControl, ( CtrlParams ) ); + mCtrlContainer = eeNew( UIComplexControl, ( CtrlParams ) ); mCtrlContainer->Visible( true ); mCtrlContainer->Enabled( true ); @@ -50,27 +50,27 @@ cUITabWidget::cUITabWidget( cUITabWidget::CreateParams& Params ) : ApplyDefaultTheme(); } -cUITabWidget::~cUITabWidget() { +UITabWidget::~UITabWidget() { } -Uint32 cUITabWidget::Type() const { +Uint32 UITabWidget::Type() const { return UI_TYPE_TABWIDGET; } -bool cUITabWidget::IsType( const Uint32& type ) const { - return cUITabWidget::Type() == type ? true : cUIComplexControl::IsType( type ); +bool UITabWidget::IsType( const Uint32& type ) const { + return UITabWidget::Type() == type ? true : UIComplexControl::IsType( type ); } -void cUITabWidget::SetTheme( cUITheme * Theme ) { +void UITabWidget::SetTheme( UITheme * Theme ) { mTabContainer->SetThemeControl( Theme, "tabwidget" ); mCtrlContainer->SetThemeControl( Theme, "tabcontainer" ); if ( 0 == mTabWidgetHeight ) { - cUISkin * tSkin = Theme->GetByName( Theme->Abbr() + "_" + "tab" ); + UISkin * tSkin = Theme->GetByName( Theme->Abbr() + "_" + "tab" ); Sizei tSize1 = GetSkinSize( tSkin ); - Sizei tSize2 = GetSkinSize( tSkin, cUISkinState::StateSelected ); + Sizei tSize2 = GetSkinSize( tSkin, UISkinState::StateSelected ); mTabWidgetHeight = eemax( tSize1.Height(), tSize2.Height() ); @@ -81,17 +81,17 @@ void cUITabWidget::SetTheme( cUITheme * Theme ) { DoAfterSetTheme(); } -void cUITabWidget::DoAfterSetTheme() { +void UITabWidget::DoAfterSetTheme() { OnSizeChange(); } -void cUITabWidget::SeContainerSize() { +void UITabWidget::SeContainerSize() { mTabContainer->Size( mSize.Width(), mTabWidgetHeight ); mCtrlContainer->Pos( 0, mTabWidgetHeight ); mCtrlContainer->Size( mSize.Width(), mSize.Height() - mTabWidgetHeight ); } -void cUITabWidget::Draw() { +void UITabWidget::Draw() { if ( mDrawLineBelowTabs ) { bool smooth = GLi->IsLineSmooth(); if ( smooth ) GLi->LineSmooth( false ); @@ -119,7 +119,7 @@ void cUITabWidget::Draw() { } } -void cUITabWidget::SetTabContainerSize() { +void UITabWidget::SetTabContainerSize() { Uint32 s = 0; if ( mTabs.size() > 0 ) { @@ -146,7 +146,7 @@ void cUITabWidget::SetTabContainerSize() { } } -void cUITabWidget::PosTabs() { +void UITabWidget::PosTabs() { Uint32 w = 0; Uint32 h = 0; Uint32 VA = VAlignGet( mFlags ); @@ -171,7 +171,7 @@ void cUITabWidget::PosTabs() { } } -void cUITabWidget::ZOrderTabs() { +void UITabWidget::ZOrderTabs() { for ( Uint32 i = 0; i < mTabs.size(); i++ ) { mTabs[i]->ToBack(); } @@ -181,7 +181,7 @@ void cUITabWidget::ZOrderTabs() { } } -void cUITabWidget::OrderTabs() { +void UITabWidget::OrderTabs() { ApplyThemeToTabs(); ZOrderTabs(); @@ -191,8 +191,8 @@ void cUITabWidget::OrderTabs() { PosTabs(); } -cUITab * cUITabWidget::CreateTab( const String& Text, cUIControl * CtrlOwned, SubTexture * Icon ) { - cUITab::CreateParams Params; +UITab * UITabWidget::CreateTab( const String& Text, UIControl * CtrlOwned, SubTexture * Icon ) { + UITab::CreateParams Params; Params.Parent( mTabContainer ); Params.Font = mFont; Params.FontColor = mFontColor; @@ -201,7 +201,7 @@ cUITab * cUITabWidget::CreateTab( const String& Text, cUIControl * CtrlOwned, Su Params.Icon = Icon; Params.Flags = UI_VALIGN_CENTER | UI_HALIGN_CENTER | UI_AUTO_SIZE; - cUITab * tCtrl = eeNew( cUITab, ( Params, CtrlOwned ) ); + UITab * tCtrl = eeNew( UITab, ( Params, CtrlOwned ) ); tCtrl->Text( Text ); tCtrl->Visible( true ); @@ -214,11 +214,11 @@ cUITab * cUITabWidget::CreateTab( const String& Text, cUIControl * CtrlOwned, Su return tCtrl; } -Uint32 cUITabWidget::Add( const String& Text, cUIControl * CtrlOwned, SubTexture * Icon ) { +Uint32 UITabWidget::Add( const String& Text, UIControl * CtrlOwned, SubTexture * Icon ) { return Add( CreateTab( Text, CtrlOwned, Icon ) ); } -Uint32 cUITabWidget::Add( cUITab * Tab ) { +Uint32 UITabWidget::Add( UITab * Tab ) { Tab->Parent( mTabContainer ); mTabs.push_back( Tab ); @@ -232,15 +232,15 @@ Uint32 cUITabWidget::Add( cUITab * Tab ) { return mTabs.size() - 1; } -cUITab * cUITabWidget::GetTab( const Uint32& Index ) { +UITab * UITabWidget::GetTab( const Uint32& Index ) { eeASSERT( Index < mTabs.size() ); return mTabs[ Index ]; } -cUITab * cUITabWidget::GetTab( const String& Text ) { +UITab * UITabWidget::GetTab( const String& Text ) { for ( Uint32 i = 0; i < mTabs.size(); i++ ) { if ( mTabs[i]->IsType( UI_TYPE_TAB ) ) { - cUITab * tTab = reinterpret_cast( mTabs[i] ); + UITab * tTab = reinterpret_cast( mTabs[i] ); if ( tTab->Text() == Text ) return tTab; @@ -250,7 +250,7 @@ cUITab * cUITabWidget::GetTab( const String& Text ) { return NULL; } -Uint32 cUITabWidget::GetTabIndex( cUITab * Tab ) { +Uint32 UITabWidget::GetTabIndex( UITab * Tab ) { for ( Uint32 i = 0; i < mTabs.size(); i++ ) { if ( mTabs[i] == Tab ) return i; @@ -259,11 +259,11 @@ Uint32 cUITabWidget::GetTabIndex( cUITab * Tab ) { return eeINDEX_NOT_FOUND; } -Uint32 cUITabWidget::Count() const { +Uint32 UITabWidget::Count() const { return mTabs.size(); } -void cUITabWidget::Remove( const Uint32& Index ) { +void UITabWidget::Remove( const Uint32& Index ) { eeASSERT( Index < mTabs.size() ); if ( mTabs[ Index ] == mTabSelected ) { @@ -296,11 +296,11 @@ void cUITabWidget::Remove( const Uint32& Index ) { OrderTabs(); } -void cUITabWidget::Remove( cUITab * Tab ) { +void UITabWidget::Remove( UITab * Tab ) { Remove( GetTabIndex( Tab ) ); } -void cUITabWidget::RemoveAll() { +void UITabWidget::RemoveAll() { for ( Uint32 i = 0; i < mTabs.size(); i++ ) { eeSAFE_DELETE( mTabs[ i ] ); } @@ -313,11 +313,11 @@ void cUITabWidget::RemoveAll() { OrderTabs(); } -void cUITabWidget::Insert( const String& Text, cUIControl * CtrlOwned, SubTexture * Icon, const Uint32& Index ) { +void UITabWidget::Insert( const String& Text, UIControl * CtrlOwned, SubTexture * Icon, const Uint32& Index ) { Insert( CreateTab( Text, CtrlOwned, Icon ), Index ); } -void cUITabWidget::Insert( cUITab * Tab, const Uint32& Index ) { +void UITabWidget::Insert( UITab * Tab, const Uint32& Index ) { mTabs.insert( mTabs.begin() + Index, Tab ); ChildAddAt( Tab, Index ); @@ -325,7 +325,7 @@ void cUITabWidget::Insert( cUITab * Tab, const Uint32& Index ) { OrderTabs(); } -void cUITabWidget::SetTabSelected( cUITab * Tab ) { +void UITabWidget::SetTabSelected( UITab * Tab ) { if ( Tab == mTabSelected ) { return; } @@ -353,31 +353,31 @@ void cUITabWidget::SetTabSelected( cUITab * Tab ) { OrderTabs(); - SendCommonEvent( cUIEvent::EventOnTabSelected ); + SendCommonEvent( UIEvent::EventOnTabSelected ); } } -void cUITabWidget::SelectPrev() { +void UITabWidget::SelectPrev() { if ( eeINDEX_NOT_FOUND != mTabSelectedIndex && mTabSelectedIndex > 0 ) { SetTabSelected( GetTab( mTabSelectedIndex - 1 ) ); } } -void cUITabWidget::SelectNext() { +void UITabWidget::SelectNext() { if ( mTabSelectedIndex + 1 < mTabs.size() ) { SetTabSelected( GetTab( mTabSelectedIndex + 1 ) ); } } -cUITab * cUITabWidget::GetSelectedTab() const { +UITab * UITabWidget::GetSelectedTab() const { return mTabSelected; } -Uint32 cUITabWidget::GetSelectedTabIndex() const { +Uint32 UITabWidget::GetSelectedTabIndex() const { return mTabSelectedIndex; } -void cUITabWidget::OnSizeChange() { +void UITabWidget::OnSizeChange() { SeContainerSize(); SetTabContainerSize(); PosTabs(); @@ -386,10 +386,10 @@ void cUITabWidget::OnSizeChange() { mTabSelected->CtrlOwned()->Size( mCtrlContainer->Size() ); } - cUIControl::OnSizeChange(); + UIControl::OnSizeChange(); } -void cUITabWidget::ApplyThemeToTabs() { +void UITabWidget::ApplyThemeToTabs() { if ( mSpecialBorderTabs ) { for ( Uint32 i = 0; i < mTabs.size(); i++ ) { mTabs[ i ]->ApplyDefaultTheme(); @@ -397,11 +397,11 @@ void cUITabWidget::ApplyThemeToTabs() { } } -cUIComplexControl * cUITabWidget::TabContainer() const { +UIComplexControl * UITabWidget::TabContainer() const { return mTabContainer; } -cUIComplexControl * cUITabWidget::ControlContainer() const { +UIComplexControl * UITabWidget::ControlContainer() const { return mCtrlContainer; } diff --git a/src/eepp/ui/cuitextbox.cpp b/src/eepp/ui/uitextbox.cpp similarity index 68% rename from src/eepp/ui/cuitextbox.cpp rename to src/eepp/ui/uitextbox.cpp index d722feefe..84dca5d7f 100644 --- a/src/eepp/ui/cuitextbox.cpp +++ b/src/eepp/ui/uitextbox.cpp @@ -1,6 +1,6 @@ -#include -#include -#include +#include +#include +#include #include #include #include @@ -8,8 +8,8 @@ namespace EE { namespace UI { -cUITextBox::cUITextBox( const cUITextBox::CreateParams& Params ) : - cUIComplexControl( Params ), +UITextBox::UITextBox( const UITextBox::CreateParams& Params ) : + UIComplexControl( Params ), mFontColor( Params.FontColor ), mFontShadowColor( Params.FontShadowColor ), mFontSelectionBackColor( Params.FontSelectionBackColor ), @@ -23,36 +23,36 @@ cUITextBox::cUITextBox( const cUITextBox::CreateParams& Params ) : mTextCache->ShadowColor( mFontShadowColor ); if ( NULL == Params.Font ) { - if ( NULL != cUIThemeManager::instance()->DefaultFont() ) - mTextCache->Font( cUIThemeManager::instance()->DefaultFont() ); + if ( NULL != UIThemeManager::instance()->DefaultFont() ) + mTextCache->Font( UIThemeManager::instance()->DefaultFont() ); else - eePRINTL( "cUITextBox::cUITextBox : Created a UI TextBox without a defined font." ); + eePRINTL( "UITextBox::UITextBox : Created a UI TextBox without a defined font." ); } AutoAlign(); } -cUITextBox::~cUITextBox() { +UITextBox::~UITextBox() { eeSAFE_DELETE( mTextCache ); } -Uint32 cUITextBox::Type() const { +Uint32 UITextBox::Type() const { return UI_TYPE_TEXTBOX; } -bool cUITextBox::IsType( const Uint32& type ) const { - return cUITextBox::Type() == type ? true : cUIComplexControl::IsType( type ); +bool UITextBox::IsType( const Uint32& type ) const { + return UITextBox::Type() == type ? true : UIComplexControl::IsType( type ); } -void cUITextBox::Draw() { +void UITextBox::Draw() { if ( mVisible && 0.f != mAlpha ) { - cUIControlAnim::Draw(); + UIControlAnim::Draw(); DrawSelection(); if ( mTextCache->GetTextWidth() ) { if ( mFlags & UI_CLIP_ENABLE ) { - cUIManager::instance()->ClipEnable( + UIManager::instance()->ClipEnable( mScreenPos.x + mPadding.Left, mScreenPos.y + mPadding.Top, mSize.Width() - mPadding.Left - mPadding.Right, @@ -64,17 +64,17 @@ void cUITextBox::Draw() { mTextCache->Draw( (Float)mScreenPos.x + mAlignOffset.x + (Float)mPadding.Left, (Float)mScreenPos.y + mAlignOffset.y + (Float)mPadding.Top, Vector2f::One, 0.f, Blend() ); if ( mFlags & UI_CLIP_ENABLE ) { - cUIManager::instance()->ClipDisable(); + UIManager::instance()->ClipDisable(); } } } } -Graphics::Font * cUITextBox::Font() const { +Graphics::Font * UITextBox::Font() const { return mTextCache->Font(); } -void cUITextBox::Font( Graphics::Font * font ) { +void UITextBox::Font( Graphics::Font * font ) { if ( mTextCache->Font() != font ) { mTextCache->Font( font ); AutoShrink(); @@ -84,14 +84,14 @@ void cUITextBox::Font( Graphics::Font * font ) { } } -const String& cUITextBox::Text() { +const String& UITextBox::Text() { if ( mFlags & UI_AUTO_SHRINK_TEXT ) return mString; return mTextCache->Text(); } -void cUITextBox::Text( const String& text ) { +void UITextBox::Text( const String& text ) { if ( mFlags & UI_AUTO_SHRINK_TEXT ) { mString = text; mTextCache->Text( mString ); @@ -105,49 +105,49 @@ void cUITextBox::Text( const String& text ) { OnTextChanged(); } -const ColorA& cUITextBox::Color() const { +const ColorA& UITextBox::Color() const { return mFontColor; } -void cUITextBox::Color( const ColorA& color ) { +void UITextBox::Color( const ColorA& color ) { mFontColor = color; mTextCache->Color( color ); Alpha( color.A() ); } -const ColorA& cUITextBox::ShadowColor() const { +const ColorA& UITextBox::ShadowColor() const { return mFontShadowColor; } -void cUITextBox::ShadowColor( const ColorA& color ) { +void UITextBox::ShadowColor( const ColorA& color ) { mFontShadowColor = color; mTextCache->ShadowColor( mFontColor ); } -const ColorA& cUITextBox::SelectionBackColor() const { +const ColorA& UITextBox::SelectionBackColor() const { return mFontSelectionBackColor; } -void cUITextBox::SelectionBackColor( const ColorA& color ) { +void UITextBox::SelectionBackColor( const ColorA& color ) { mFontSelectionBackColor = color; } -void cUITextBox::Alpha( const Float& alpha ) { - cUIControlAnim::Alpha( alpha ); +void UITextBox::Alpha( const Float& alpha ) { + UIControlAnim::Alpha( alpha ); mFontColor.Alpha = (Uint8)alpha; mFontShadowColor.Alpha = (Uint8)alpha; mTextCache->Alpha( mFontColor.Alpha ); } -void cUITextBox::AutoShrink() { +void UITextBox::AutoShrink() { if ( mFlags & UI_AUTO_SHRINK_TEXT ) { ShrinkText( mSize.Width() ); } } -void cUITextBox::ShrinkText( const Uint32& MaxWidth ) { +void UITextBox::ShrinkText( const Uint32& MaxWidth ) { if ( mFlags & UI_AUTO_SHRINK_TEXT ) { mTextCache->Text( mString ); } @@ -155,14 +155,14 @@ void cUITextBox::ShrinkText( const Uint32& MaxWidth ) { mTextCache->Font()->ShrinkText( mTextCache->Text(), MaxWidth ); } -void cUITextBox::AutoSize() { +void UITextBox::AutoSize() { if ( mFlags & UI_AUTO_SIZE ) { mSize.Width( (int)mTextCache->GetTextWidth() ); mSize.Height( (int)mTextCache->GetTextHeight() ); } } -void cUITextBox::AutoAlign() { +void UITextBox::AutoAlign() { switch ( FontHAlignGet( Flags() ) ) { case UI_HALIGN_CENTER: mAlignOffset.x = (Float)( (Int32)( mSize.x - mTextCache->GetTextWidth() ) / 2 ); @@ -188,68 +188,68 @@ void cUITextBox::AutoAlign() { } } -Uint32 cUITextBox::OnFocusLoss() { +Uint32 UITextBox::OnFocusLoss() { SelCurInit( -1 ); SelCurEnd( -1 ); return 1; } -void cUITextBox::OnSizeChange() { +void UITextBox::OnSizeChange() { AutoShrink(); AutoSize(); AutoAlign(); - cUIControlAnim::OnSizeChange(); + UIControlAnim::OnSizeChange(); mTextCache->Cache(); } -void cUITextBox::OnTextChanged() { - SendCommonEvent( cUIEvent::EventOnTextChanged ); +void UITextBox::OnTextChanged() { + SendCommonEvent( UIEvent::EventOnTextChanged ); } -void cUITextBox::OnFontChanged() { - SendCommonEvent( cUIEvent::EventOnFontChanged ); +void UITextBox::OnFontChanged() { + SendCommonEvent( UIEvent::EventOnFontChanged ); } -void cUITextBox::Padding( const Recti& padding ) { +void UITextBox::Padding( const Recti& padding ) { mPadding = padding; } -const Recti& cUITextBox::Padding() const { +const Recti& UITextBox::Padding() const { return mPadding; } -void cUITextBox::SetTheme( cUITheme * Theme ) { - cUIControlAnim::SetTheme( Theme ); +void UITextBox::SetTheme( UITheme * Theme ) { + UIControlAnim::SetTheme( Theme ); if ( NULL == mTextCache->Font() && NULL != Theme->Font() ) { mTextCache->Font( Theme->Font() ); } } -TextCache * cUITextBox::GetTextCache() { +TextCache * UITextBox::GetTextCache() { return mTextCache; } -Float cUITextBox::GetTextWidth() { +Float UITextBox::GetTextWidth() { return mTextCache->GetTextWidth(); } -Float cUITextBox::GetTextHeight() { +Float UITextBox::GetTextHeight() { return mTextCache->GetTextHeight(); } -const int& cUITextBox::GetNumLines() const { +const int& UITextBox::GetNumLines() const { return mTextCache->GetNumLines(); } -const Vector2f& cUITextBox::AlignOffset() const { +const Vector2f& UITextBox::AlignOffset() const { return mAlignOffset; } -Uint32 cUITextBox::OnMouseDoubleClick( const Vector2i& Pos, const Uint32 Flags ) { +Uint32 UITextBox::OnMouseDoubleClick( const Vector2i& Pos, const Uint32 Flags ) { if ( IsTextSelectionEnabled() && ( Flags & EE_BUTTON_LMASK ) ) { Vector2i controlPos( Pos ); WorldToControl( controlPos ); @@ -268,10 +268,10 @@ Uint32 cUITextBox::OnMouseDoubleClick( const Vector2i& Pos, const Uint32 Flags ) } } - return cUIComplexControl::OnMouseDoubleClick( Pos, Flags ); + return UIComplexControl::OnMouseDoubleClick( Pos, Flags ); } -Uint32 cUITextBox::OnMouseClick( const Vector2i& Pos, const Uint32 Flags ) { +Uint32 UITextBox::OnMouseClick( const Vector2i& Pos, const Uint32 Flags ) { if ( IsTextSelectionEnabled() && ( Flags & EE_BUTTON_LMASK ) ) { if ( SelCurInit() == SelCurEnd() ) { SelCurInit( -1 ); @@ -284,7 +284,7 @@ Uint32 cUITextBox::OnMouseClick( const Vector2i& Pos, const Uint32 Flags ) { return 1; } -Uint32 cUITextBox::OnMouseDown( const Vector2i& Pos, const Uint32 Flags ) { +Uint32 UITextBox::OnMouseDown( const Vector2i& Pos, const Uint32 Flags ) { if ( IsTextSelectionEnabled() && ( Flags & EE_BUTTON_LMASK ) ) { Vector2i controlPos( Pos ); WorldToControl( controlPos ); @@ -303,10 +303,10 @@ Uint32 cUITextBox::OnMouseDown( const Vector2i& Pos, const Uint32 Flags ) { mControlFlags |= UI_CTRL_FLAG_SELECTING; } - return cUIComplexControl::OnMouseDown( Pos, Flags ); + return UIComplexControl::OnMouseDown( Pos, Flags ); } -void cUITextBox::DrawSelection() { +void UITextBox::DrawSelection() { if ( SelCurInit() != SelCurEnd() ) { Int32 init = eemin( SelCurInit(), SelCurEnd() ); Int32 end = eemax( SelCurInit(), SelCurEnd() ); @@ -342,23 +342,23 @@ void cUITextBox::DrawSelection() { } } -bool cUITextBox::IsTextSelectionEnabled() const { +bool UITextBox::IsTextSelectionEnabled() const { return 0 != ( mFlags & UI_TEXT_SELECTION_ENABLED ); } -void cUITextBox::SelCurInit( const Int32& init ) { +void UITextBox::SelCurInit( const Int32& init ) { mSelCurInit = init; } -void cUITextBox::SelCurEnd( const Int32& end ) { +void UITextBox::SelCurEnd( const Int32& end ) { mSelCurEnd = end; } -Int32 cUITextBox::SelCurInit() { +Int32 UITextBox::SelCurInit() { return mSelCurInit; } -Int32 cUITextBox::SelCurEnd() { +Int32 UITextBox::SelCurEnd() { return mSelCurEnd; } diff --git a/src/eepp/ui/cuitextedit.cpp b/src/eepp/ui/uitextedit.cpp similarity index 75% rename from src/eepp/ui/cuitextedit.cpp rename to src/eepp/ui/uitextedit.cpp index b557d5040..5d5f92c90 100644 --- a/src/eepp/ui/cuitextedit.cpp +++ b/src/eepp/ui/uitextedit.cpp @@ -1,12 +1,12 @@ -#include -#include +#include +#include #include #include namespace EE { namespace UI { -cUITextEdit::cUITextEdit( cUITextEdit::CreateParams& Params ) : - cUIComplexControl( Params ), +UITextEdit::UITextEdit( UITextEdit::CreateParams& Params ) : + UIComplexControl( Params ), mTextInput( NULL ), mHScrollBar( NULL ), mVScrollBar( NULL ), @@ -28,7 +28,7 @@ cUITextEdit::cUITextEdit( cUITextEdit::CreateParams& Params ) : if ( mFlags & UI_ANCHOR_BOTTOM ) extraFlags |= UI_ANCHOR_BOTTOM; - cUITextInput::CreateParams TIParams; + UITextInput::CreateParams TIParams; TIParams.Parent( this ); TIParams.Size = mSize; TIParams.Flags = UI_VALIGN_TOP | UI_HALIGN_LEFT | UI_TEXT_SELECTION_ENABLED | extraFlags; @@ -40,31 +40,31 @@ cUITextEdit::cUITextEdit( cUITextEdit::CreateParams& Params ) : if ( Params.WordWrap && !( mFlags & UI_AUTO_SHRINK_TEXT ) ) mFlags |= UI_AUTO_SHRINK_TEXT; - mTextInput = eeNew( cUITextInput, ( TIParams ) ); + mTextInput = eeNew( UITextInput, ( TIParams ) ); mTextInput->GetInputTextBuffer()->SupportNewLine( true ); mTextInput->Visible( true ); mTextInput->Enabled( true ); - mTextInput->AddEventListener( cUIEvent::EventOnSizeChange , cb::Make1( this, &cUITextEdit::OnInputSizeChange ) ); - mTextInput->AddEventListener( cUIEvent::EventOnTextChanged , cb::Make1( this, &cUITextEdit::OnInputSizeChange ) ); - mTextInput->AddEventListener( cUIEvent::EventOnPressEnter , cb::Make1( this, &cUITextEdit::OnInputSizeChange ) ); - mTextInput->AddEventListener( cUIEvent::EventOnCursorPosChange , cb::Make1( this, &cUITextEdit::OnCursorPosChange ) ); + mTextInput->AddEventListener( UIEvent::EventOnSizeChange , cb::Make1( this, &UITextEdit::OnInputSizeChange ) ); + mTextInput->AddEventListener( UIEvent::EventOnTextChanged , cb::Make1( this, &UITextEdit::OnInputSizeChange ) ); + mTextInput->AddEventListener( UIEvent::EventOnPressEnter , cb::Make1( this, &UITextEdit::OnInputSizeChange ) ); + mTextInput->AddEventListener( UIEvent::EventOnCursorPosChange , cb::Make1( this, &UITextEdit::OnCursorPosChange ) ); - cUIScrollBar::CreateParams ScrollBarP; + UIScrollBar::CreateParams ScrollBarP; ScrollBarP.Parent( this ); ScrollBarP.PosSet( mSize.Width() - 15, 0 ); ScrollBarP.Size = Sizei( 15, mSize.Height() ); ScrollBarP.Flags = UI_AUTO_SIZE; ScrollBarP.VerticalScrollBar = true; - mVScrollBar = eeNew( cUIScrollBar, ( ScrollBarP ) ); + mVScrollBar = eeNew( UIScrollBar, ( ScrollBarP ) ); mVScrollBar->Value( 1 ); ScrollBarP.PosSet( 0, mSize.Height() - 15 ); ScrollBarP.Size = Sizei( mSize.Width() - mVScrollBar->Size().Width(), 15 ); ScrollBarP.VerticalScrollBar = false; - mHScrollBar = eeNew( cUIScrollBar, ( ScrollBarP ) ); + mHScrollBar = eeNew( UIScrollBar, ( ScrollBarP ) ); - mVScrollBar->AddEventListener( cUIEvent::EventOnValueChange, cb::Make1( this, &cUITextEdit::OnVScrollValueChange ) ); - mHScrollBar->AddEventListener( cUIEvent::EventOnValueChange, cb::Make1( this, &cUITextEdit::OnHScrollValueChange ) ); + mVScrollBar->AddEventListener( UIEvent::EventOnValueChange, cb::Make1( this, &UITextEdit::OnVScrollValueChange ) ); + mHScrollBar->AddEventListener( UIEvent::EventOnValueChange, cb::Make1( this, &UITextEdit::OnHScrollValueChange ) ); AutoPadding(); @@ -75,19 +75,19 @@ cUITextEdit::cUITextEdit( cUITextEdit::CreateParams& Params ) : mTextInput->Size( mSize - Sizei( mPadding.Left + mPadding.Right, mPadding.Top + mPadding.Bottom ) ); } -cUITextEdit::~cUITextEdit() { +UITextEdit::~UITextEdit() { } -Uint32 cUITextEdit::Type() const { +Uint32 UITextEdit::Type() const { return UI_TYPE_TEXTEDIT; } -bool cUITextEdit::IsType( const Uint32& type ) const { - return cUITextEdit::Type() == type ? true : cUIComplexControl::IsType( type ); +bool UITextEdit::IsType( const Uint32& type ) const { + return UITextEdit::Type() == type ? true : UIComplexControl::IsType( type ); } -void cUITextEdit::SetTheme( cUITheme * Theme ) { - cUIControl::SetThemeControl( Theme, "textedit" ); +void UITextEdit::SetTheme( UITheme * Theme ) { + UIControl::SetThemeControl( Theme, "textedit" ); mTextInput->SetThemeControl( Theme, "textedit_box" ); @@ -96,7 +96,7 @@ void cUITextEdit::SetTheme( cUITheme * Theme ) { OnSizeChange(); } -void cUITextEdit::OnSizeChange() { +void UITextEdit::OnSizeChange() { mHScrollBar->Pos( 0, mSize.Height() - mHScrollBar->Size().Height() ); mVScrollBar->Pos( mSize.Width() - mVScrollBar->Size().Width(), 0 ); @@ -110,21 +110,21 @@ void cUITextEdit::OnSizeChange() { FixScroll(); } -void cUITextEdit::OnParentSizeChange( const Vector2i& SizeChange ) { - cUIComplexControl::OnParentSizeChange( SizeChange ); +void UITextEdit::OnParentSizeChange( const Vector2i& SizeChange ) { + UIComplexControl::OnParentSizeChange( SizeChange ); OnInputSizeChange( NULL ); } -void cUITextEdit::OnAlphaChange() { +void UITextEdit::OnAlphaChange() { mTextInput->Alpha( mAlpha ); mHScrollBar->Alpha( mAlpha ); mVScrollBar->Alpha( mAlpha ); - cUIComplexControl::OnAlphaChange(); + UIComplexControl::OnAlphaChange(); } -void cUITextEdit::FixScroll() { +void UITextEdit::FixScroll() { int Width = mSize.Width() - mPadding.Left - mPadding.Right; int Height = mSize.Height() - mPadding.Top - mPadding.Bottom; @@ -151,7 +151,7 @@ void cUITextEdit::FixScroll() { } } -void cUITextEdit::ScrollbarsSet() { +void UITextEdit::ScrollbarsSet() { switch ( mHScrollBarMode ) { case UI_SCROLLBAR_ALWAYS_OFF: { @@ -228,39 +228,39 @@ void cUITextEdit::ScrollbarsSet() { } } -void cUITextEdit::AutoPadding() { +void UITextEdit::AutoPadding() { if ( mFlags & UI_AUTO_PADDING ) { mPadding = MakePadding(); } } -void cUITextEdit::OnVScrollValueChange( const cUIEvent * Event ) { +void UITextEdit::OnVScrollValueChange( const UIEvent * Event ) { if ( !mSkipValueChange ) FixScroll(); } -void cUITextEdit::OnHScrollValueChange( const cUIEvent * Event ) { +void UITextEdit::OnHScrollValueChange( const UIEvent * Event ) { if ( !mSkipValueChange ) FixScroll(); } -cUITextInput * cUITextEdit::TextInput() const { +UITextInput * UITextEdit::TextInput() const { return mTextInput; } -cUIScrollBar * cUITextEdit::HScrollBar() const { +UIScrollBar * UITextEdit::HScrollBar() const { return mHScrollBar; } -cUIScrollBar * cUITextEdit::VScrollBar() const { +UIScrollBar * UITextEdit::VScrollBar() const { return mVScrollBar; } -const String& cUITextEdit::Text() const { +const String& UITextEdit::Text() const { return mTextInput->Text(); } -void cUITextEdit::Text( const String& Txt ) { +void UITextEdit::Text( const String& Txt ) { mTextInput->Text( Txt ); OnInputSizeChange(); @@ -268,12 +268,12 @@ void cUITextEdit::Text( const String& Txt ) { OnSizeChange(); } -void cUITextEdit::OnInputSizeChange( const cUIEvent * Event ) { +void UITextEdit::OnInputSizeChange( const UIEvent * Event ) { int Width = mSize.Width() - mPadding.Left - mPadding.Right; int Height = mSize.Height() - mPadding.Top - mPadding.Bottom; if ( NULL != Event ) { - if ( Event->EventType() == cUIEvent::EventOnPressEnter ) { + if ( Event->EventType() == UIEvent::EventOnPressEnter ) { mHScrollBar->Value( 0 ); } } @@ -323,11 +323,11 @@ void cUITextEdit::OnInputSizeChange( const cUIEvent * Event ) { FixScrollToCursor(); } -void cUITextEdit::OnCursorPosChange( const cUIEvent * Event ) { +void UITextEdit::OnCursorPosChange( const UIEvent * Event ) { FixScrollToCursor(); } -void cUITextEdit::FixScrollToCursor() { +void UITextEdit::FixScrollToCursor() { int Width = mSize.Width() - mPadding.Left - mPadding.Right; int Height = mSize.Height() - mPadding.Top - mPadding.Bottom; @@ -371,28 +371,28 @@ void cUITextEdit::FixScrollToCursor() { } } -void cUITextEdit::ShrinkText( const Uint32& Width ) { +void UITextEdit::ShrinkText( const Uint32& Width ) { if ( Flags() & UI_AUTO_SHRINK_TEXT ) { mTextInput->ShrinkText( Width ); } } -void cUITextEdit::Update() { - cUIControlAnim::Update(); +void UITextEdit::Update() { + UIControlAnim::Update(); if ( mTextInput->Enabled() && mTextInput->Visible() && mTextInput->IsMouseOver() && mVScrollBar->Visible() ) { - Uint32 Flags = cUIManager::instance()->GetInput()->ClickTrigger(); + Uint32 Flags = UIManager::instance()->GetInput()->ClickTrigger(); if ( Flags & EE_BUTTONS_WUWD ) mVScrollBar->Slider()->ManageClick( Flags ); } } -void cUITextEdit::AllowEditing( const bool& allow ) { +void UITextEdit::AllowEditing( const bool& allow ) { mTextInput->AllowEditing( allow ); } -const bool& cUITextEdit::AllowEditing() const { +const bool& UITextEdit::AllowEditing() const { return mTextInput->AllowEditing(); } diff --git a/src/eepp/ui/cuitextinput.cpp b/src/eepp/ui/uitextinput.cpp similarity index 62% rename from src/eepp/ui/cuitextinput.cpp rename to src/eepp/ui/uitextinput.cpp index b244d81b0..979de37af 100644 --- a/src/eepp/ui/cuitextinput.cpp +++ b/src/eepp/ui/uitextinput.cpp @@ -1,5 +1,5 @@ -#include -#include +#include +#include #include #include #include @@ -8,8 +8,8 @@ namespace EE { namespace UI { -cUITextInput::cUITextInput( const cUITextInput::CreateParams& Params ) : - cUITextBox( Params ), +UITextInput::UITextInput( const UITextInput::CreateParams& Params ) : + UITextBox( Params ), mCursorPos(0), mAllowEditing( true ), mShowingWait( true ) @@ -19,33 +19,33 @@ cUITextInput::cUITextInput( const cUITextInput::CreateParams& Params ) : mTextBuffer.SupportFreeEditing( Params.SupportFreeEditing ); mTextBuffer.TextSelectionEnabled( IsTextSelectionEnabled() ); mTextBuffer.MaxLength( Params.MaxLength ); - mTextBuffer.SetReturnCallback( cb::Make0( this, &cUITextInput::PrivOnPressEnter ) ); + mTextBuffer.SetReturnCallback( cb::Make0( this, &UITextInput::PrivOnPressEnter ) ); ApplyDefaultTheme(); } -cUITextInput::~cUITextInput() { +UITextInput::~UITextInput() { } -Uint32 cUITextInput::Type() const { +Uint32 UITextInput::Type() const { return UI_TYPE_TEXTINPUT; } -bool cUITextInput::IsType( const Uint32& type ) const { - return cUITextInput::Type() == type ? true : cUITextBox::IsType( type ); +bool UITextInput::IsType( const Uint32& type ) const { + return UITextInput::Type() == type ? true : UITextBox::IsType( type ); } -void cUITextInput::Update() { +void UITextInput::Update() { if ( IsMouseOverMeOrChilds() ) { - cUIManager::instance()->SetCursor( EE_CURSOR_IBEAM ); + UIManager::instance()->SetCursor( EE_CURSOR_IBEAM ); } - cUITextBox::Update(); + UITextBox::Update(); if ( mTextBuffer.ChangedSinceLastUpdate() ) { Vector2f offSet = mAlignOffset; - cUITextBox::Text( mTextBuffer.Buffer() ); + UITextBox::Text( mTextBuffer.Buffer() ); UpdateText(); @@ -69,13 +69,13 @@ void cUITextInput::Update() { } } -void cUITextInput::OnCursorPosChange() { - SendCommonEvent( cUIEvent::EventOnCursorPosChange ); +void UITextInput::OnCursorPosChange() { + SendCommonEvent( UIEvent::EventOnCursorPosChange ); } -void cUITextInput::DrawWaitingCursor() { +void UITextInput::DrawWaitingCursor() { if ( mVisible && mTextBuffer.Active() && mTextBuffer.SupportFreeEditing() ) { - mWaitCursorTime += cUIManager::instance()->Elapsed().AsMilliseconds(); + mWaitCursorTime += UIManager::instance()->Elapsed().AsMilliseconds(); if ( mShowingWait ) { bool disableSmooth = mShowingWait && GLi->IsLineSmooth(); @@ -105,14 +105,14 @@ void cUITextInput::DrawWaitingCursor() { } } -void cUITextInput::Draw() { - cUITextBox::Draw(); +void UITextInput::Draw() { + UITextBox::Draw(); DrawWaitingCursor(); } -Uint32 cUITextInput::OnFocus() { - cUIControlAnim::OnFocus(); +Uint32 UITextInput::OnFocus() { + UIControlAnim::OnFocus(); if ( mAllowEditing ) { mTextBuffer.Active( true ); @@ -123,30 +123,30 @@ Uint32 cUITextInput::OnFocus() { return 1; } -Uint32 cUITextInput::OnFocusLoss() { +Uint32 UITextInput::OnFocusLoss() { mTextBuffer.Active( false ); - return cUITextBox::OnFocusLoss(); + return UITextBox::OnFocusLoss(); } -Uint32 cUITextInput::OnPressEnter() { - SendCommonEvent( cUIEvent::EventOnPressEnter ); +Uint32 UITextInput::OnPressEnter() { + SendCommonEvent( UIEvent::EventOnPressEnter ); return 0; } -void cUITextInput::PrivOnPressEnter() { +void UITextInput::PrivOnPressEnter() { OnPressEnter(); } -void cUITextInput::PushIgnoredChar( const Uint32& ch ) { +void UITextInput::PushIgnoredChar( const Uint32& ch ) { mTextBuffer.PushIgnoredChar( ch ); } -void cUITextInput::ResetWaitCursor() { +void UITextInput::ResetWaitCursor() { mShowingWait = true; mWaitCursorTime = 0.f; } -void cUITextInput::AlignFix() { +void UITextInput::AlignFix() { if ( FontHAlignGet( Flags() ) == UI_HALIGN_LEFT ) { Uint32 NLPos = 0; Uint32 LineNum = mTextBuffer.GetCurPosLinePos( NLPos ); @@ -168,66 +168,66 @@ void cUITextInput::AlignFix() { } } -void cUITextInput::SetTheme( cUITheme * Theme ) { - cUIControl::SetThemeControl( Theme, "textinput" ); +void UITextInput::SetTheme( UITheme * Theme ) { + UIControl::SetThemeControl( Theme, "textinput" ); AutoPadding(); AutoSize(); } -void cUITextInput::AutoSize() { +void UITextInput::AutoSize() { if ( mFlags & UI_AUTO_SIZE ) { Size( mSize.x, GetSkinSize().Height() ); } } -void cUITextInput::AutoPadding() { +void UITextInput::AutoPadding() { if ( mFlags & UI_AUTO_PADDING ) { mPadding = MakePadding( true, true, false, false ); } } -InputTextBuffer * cUITextInput::GetInputTextBuffer() { +InputTextBuffer * UITextInput::GetInputTextBuffer() { return &mTextBuffer; } -void cUITextInput::AllowEditing( const bool& allow ) { +void UITextInput::AllowEditing( const bool& allow ) { mAllowEditing = allow; if ( !mAllowEditing && mTextBuffer.Active() ) mTextBuffer.Active( false ); } -const bool& cUITextInput::AllowEditing() const { +const bool& UITextInput::AllowEditing() const { return mAllowEditing; } -void cUITextInput::Text( const String& text ) { - cUITextBox::Text( text ); +void UITextInput::Text( const String& text ) { + UITextBox::Text( text ); mTextBuffer.Buffer( text ); mTextBuffer.CursorToEnd(); } -const String& cUITextInput::Text() { - return cUITextBox::Text(); +const String& UITextInput::Text() { + return UITextBox::Text(); } -void cUITextInput::ShrinkText( const Uint32& MaxWidth ) { +void UITextInput::ShrinkText( const Uint32& MaxWidth ) { mTextCache->Text( mTextBuffer.Buffer() ); - cUITextBox::ShrinkText( MaxWidth ); + UITextBox::ShrinkText( MaxWidth ); mTextBuffer.Buffer( mTextCache->Text() ); AlignFix(); } -void cUITextInput::UpdateText() { +void UITextInput::UpdateText() { } -Uint32 cUITextInput::OnMouseClick( const Vector2i& Pos, const Uint32 Flags ) { +Uint32 UITextInput::OnMouseClick( const Vector2i& Pos, const Uint32 Flags ) { if ( Flags & EE_BUTTON_LMASK ) { Vector2i controlPos( Pos ); WorldToControl( controlPos ); @@ -240,11 +240,11 @@ Uint32 cUITextInput::OnMouseClick( const Vector2i& Pos, const Uint32 Flags ) { } } - return cUITextBox::OnMouseClick( Pos, Flags ); + return UITextBox::OnMouseClick( Pos, Flags ); } -Uint32 cUITextInput::OnMouseDoubleClick( const Vector2i& Pos, const Uint32 Flags ) { - cUITextBox::OnMouseDoubleClick( Pos, Flags ); +Uint32 UITextInput::OnMouseDoubleClick( const Vector2i& Pos, const Uint32 Flags ) { + UITextBox::OnMouseDoubleClick( Pos, Flags ); if ( IsTextSelectionEnabled() && ( Flags & EE_BUTTON_LMASK ) && SelCurEnd() != -1 ) { mTextBuffer.CurPos( SelCurEnd() ); @@ -254,19 +254,19 @@ Uint32 cUITextInput::OnMouseDoubleClick( const Vector2i& Pos, const Uint32 Flags return 1; } -Uint32 cUITextInput::OnMouseExit( const Vector2i& Pos, const Uint32 Flags ) { - cUIControl::OnMouseExit( Pos, Flags ); +Uint32 UITextInput::OnMouseExit( const Vector2i& Pos, const Uint32 Flags ) { + UIControl::OnMouseExit( Pos, Flags ); - cUIManager::instance()->SetCursor( EE_CURSOR_ARROW ); + UIManager::instance()->SetCursor( EE_CURSOR_ARROW ); return 1; } -void cUITextInput::SelCurInit( const Int32& init ) { +void UITextInput::SelCurInit( const Int32& init ) { mTextBuffer.SelCurInit( init ); } -void cUITextInput::SelCurEnd( const Int32& end ) { +void UITextInput::SelCurEnd( const Int32& end ) { mTextBuffer.SelCurEnd( end ); if ( mTextBuffer.SelCurEnd() != mTextBuffer.SelCurInit() ) { @@ -274,11 +274,11 @@ void cUITextInput::SelCurEnd( const Int32& end ) { } } -Int32 cUITextInput::SelCurInit() { +Int32 UITextInput::SelCurInit() { return mTextBuffer.SelCurInit(); } -Int32 cUITextInput::SelCurEnd() { +Int32 UITextInput::SelCurEnd() { return mTextBuffer.SelCurEnd(); } diff --git a/src/eepp/ui/cuitextinputpassword.cpp b/src/eepp/ui/uitextinputpassword.cpp similarity index 72% rename from src/eepp/ui/cuitextinputpassword.cpp rename to src/eepp/ui/uitextinputpassword.cpp index f334ddc46..fcc80293b 100644 --- a/src/eepp/ui/cuitextinputpassword.cpp +++ b/src/eepp/ui/uitextinputpassword.cpp @@ -1,13 +1,13 @@ -#include -#include -#include +#include +#include +#include #include #include namespace EE { namespace UI { -cUITextInputPassword::cUITextInputPassword( const cUITextInput::CreateParams& Params ) : - cUITextInput( Params ) +UITextInputPassword::UITextInputPassword( const UITextInput::CreateParams& Params ) : + UITextInput( Params ) { mPassCache = eeNew( TextCache, () ); mPassCache->Font( Params.Font ); @@ -15,22 +15,22 @@ cUITextInputPassword::cUITextInputPassword( const cUITextInput::CreateParams& Pa mPassCache->ShadowColor( mFontShadowColor ); if ( NULL == Params.Font ) { - if ( NULL != cUIThemeManager::instance()->DefaultFont() ) - mPassCache->Font( cUIThemeManager::instance()->DefaultFont() ); + if ( NULL != UIThemeManager::instance()->DefaultFont() ) + mPassCache->Font( UIThemeManager::instance()->DefaultFont() ); else - eePRINTL( "cUITextInputPassword::cUITextInputPassword : Created a UI TextInputPassword without a defined font." ); + eePRINTL( "UITextInputPassword::UITextInputPassword : Created a UI TextInputPassword without a defined font." ); } AutoAlign(); } -void cUITextInputPassword::Draw() { +void UITextInputPassword::Draw() { if ( mVisible && 0.f != mAlpha ) { - cUIControlAnim::Draw(); + UIControlAnim::Draw(); if ( mPassCache->GetTextWidth() ) { if ( mFlags & UI_CLIP_ENABLE ) { - cUIManager::instance()->ClipEnable( + UIManager::instance()->ClipEnable( mScreenPos.x + mPadding.Left, mScreenPos.y + mPadding.Top, mSize.Width() - mPadding.Left - mPadding.Right, @@ -42,7 +42,7 @@ void cUITextInputPassword::Draw() { mPassCache->Draw( (Float)mScreenPos.x + mAlignOffset.x + (Float)mPadding.Left, (Float)mScreenPos.y + mAlignOffset.y + (Float)mPadding.Top, Vector2f::One, 0.f, Blend() ); if ( mFlags & UI_CLIP_ENABLE ) { - cUIManager::instance()->ClipDisable(); + UIManager::instance()->ClipDisable(); } } } @@ -50,7 +50,7 @@ void cUITextInputPassword::Draw() { DrawWaitingCursor(); } -void cUITextInputPassword::AlignFix() { +void UITextInputPassword::AlignFix() { if ( FontHAlignGet( Flags() ) == UI_HALIGN_LEFT ) { Uint32 NLPos = 0; Uint32 LineNum = mTextBuffer.GetCurPosLinePos( NLPos ); @@ -78,7 +78,7 @@ void cUITextInputPassword::AlignFix() { } } -void cUITextInputPassword::AutoAlign() { +void UITextInputPassword::AutoAlign() { switch ( FontHAlignGet( Flags() ) ) { case UI_HALIGN_CENTER: mAlignOffset.x = (Float)( (Int32)( mSize.x - mPassCache->GetTextWidth() ) / 2 ); @@ -104,11 +104,11 @@ void cUITextInputPassword::AutoAlign() { } } -void cUITextInputPassword::UpdateText() { +void UITextInputPassword::UpdateText() { UpdatePass( mTextCache->Text() ); } -void cUITextInputPassword::UpdatePass( const String& pass ) { +void UITextInputPassword::UpdatePass( const String& pass ) { mPassCache->Text().clear(); String newTxt; @@ -120,18 +120,18 @@ void cUITextInputPassword::UpdatePass( const String& pass ) { mPassCache->Text( newTxt ); } -void cUITextInputPassword::Text( const String& text ) { - cUITextInput::Text( text ); +void UITextInputPassword::Text( const String& text ) { + UITextInput::Text( text ); UpdatePass( text ); } -TextCache *cUITextInputPassword::GetPassCache() const { +TextCache *UITextInputPassword::GetPassCache() const { return mPassCache; } -const String& cUITextInputPassword::Text() { - return cUITextBox::Text(); +const String& UITextInputPassword::Text() { + return UITextBox::Text(); } diff --git a/src/eepp/ui/cuitheme.cpp b/src/eepp/ui/uitheme.cpp similarity index 59% rename from src/eepp/ui/cuitheme.cpp rename to src/eepp/ui/uitheme.cpp index abc14daf9..a2bbe7202 100644 --- a/src/eepp/ui/cuitheme.cpp +++ b/src/eepp/ui/uitheme.cpp @@ -1,6 +1,6 @@ -#include -#include -#include +#include +#include +#include #include #include #include @@ -8,29 +8,29 @@ #include #include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include namespace EE { namespace UI { @@ -114,15 +114,15 @@ static void LoadThemeElements( std::list& UI_THEME_ELEMENTS, std::l UI_THEME_ICONS.push_back( "document-save-as" ); } -void cUITheme::AddThemeElement( const std::string& Element ) { +void UITheme::AddThemeElement( const std::string& Element ) { mUIElements.push_back( Element ); } -void cUITheme::AddThemeIcon( const std::string& Icon ) { +void UITheme::AddThemeIcon( const std::string& Icon ) { mUIIcons.push_back( Icon ); } -cUITheme * cUITheme::LoadFromTextureAtlas( cUITheme * tTheme, Graphics::TextureAtlas * TextureAtlas ) { +UITheme * UITheme::LoadFromTextureAtlas( UITheme * tTheme, Graphics::TextureAtlas * TextureAtlas ) { eeASSERT( NULL != tTheme && NULL != TextureAtlas ); /** Themes use nearest filter by default, force the filter to the textures. */ @@ -157,9 +157,9 @@ cUITheme * cUITheme::LoadFromTextureAtlas( cUITheme * tTheme, Graphics::TextureA for ( i = 0; i < ElemFound.size(); i++ ) { if ( ElemType[i] ) - tTheme->Add( eeNew( cUISkinComplex, ( ElemFound[i] ) ) ); + tTheme->Add( eeNew( UISkinComplex, ( ElemFound[i] ) ) ); else - tTheme->Add( eeNew( cUISkinSimple, ( ElemFound[i] ) ) ); + tTheme->Add( eeNew( UISkinSimple, ( ElemFound[i] ) ) ); } eePRINTL( "UI Theme Loaded in: %4.3f ms ( from TextureAtlas )", TE.Elapsed().AsMilliseconds() ); @@ -167,7 +167,7 @@ cUITheme * cUITheme::LoadFromTextureAtlas( cUITheme * tTheme, Graphics::TextureA return tTheme; } -cUITheme * cUITheme::LoadFromPath( cUITheme * tTheme, const std::string& Path, const std::string ImgExt ) { +UITheme * UITheme::LoadFromPath( UITheme * tTheme, const std::string& Path, const std::string ImgExt ) { Clock TE; LoadThemeElements( tTheme->mUIElements, tTheme->mUIIcons ); @@ -220,9 +220,9 @@ cUITheme * cUITheme::LoadFromPath( cUITheme * tTheme, const std::string& Path, c for ( i = 0; i < ElemFound.size(); i++ ) { if ( ElemType[i] ) - tTheme->Add( eeNew( cUISkinComplex, ( ElemFound[i] ) ) ); + tTheme->Add( eeNew( UISkinComplex, ( ElemFound[i] ) ) ); else - tTheme->Add( eeNew( cUISkinSimple, ( ElemFound[i] ) ) ); + tTheme->Add( eeNew( UISkinSimple, ( ElemFound[i] ) ) ); } eePRINTL( "UI Theme Loaded in: %4.3f ms ( from path )", TE.Elapsed().AsMilliseconds() ); @@ -230,24 +230,24 @@ cUITheme * cUITheme::LoadFromPath( cUITheme * tTheme, const std::string& Path, c return tTheme; } -cUITheme * cUITheme::LoadFromPath( const std::string& Path, const std::string& Name, const std::string& NameAbbr, const std::string ImgExt ) { - return LoadFromPath( eeNew( cUITheme, ( Name, NameAbbr ) ), Path, ImgExt ); +UITheme * UITheme::LoadFromPath( const std::string& Path, const std::string& Name, const std::string& NameAbbr, const std::string ImgExt ) { + return LoadFromPath( eeNew( UITheme, ( Name, NameAbbr ) ), Path, ImgExt ); } -cUITheme * cUITheme::LoadFromTextureAtlas( Graphics::TextureAtlas * TextureAtlas, const std::string& Name, const std::string NameAbbr ) { - return LoadFromTextureAtlas( eeNew( cUITheme, ( Name, NameAbbr ) ), TextureAtlas ); +UITheme * UITheme::LoadFromTextureAtlas( Graphics::TextureAtlas * TextureAtlas, const std::string& Name, const std::string NameAbbr ) { + return LoadFromTextureAtlas( eeNew( UITheme, ( Name, NameAbbr ) ), TextureAtlas ); } -bool cUITheme::SearchFilesInAtlas( Graphics::TextureAtlas * SG, std::string Element, Uint32& IsComplex ) { +bool UITheme::SearchFilesInAtlas( Graphics::TextureAtlas * SG, std::string Element, Uint32& IsComplex ) { bool Found = false; Uint32 i = 0, s = 0; std::string ElemName; IsComplex = 0; // Search Complex Skin - for ( i = 0; i < cUISkinState::StateCount; i++ ) { - for ( s = 0; s < cUISkinComplex::SideCount; s++ ) { - ElemName = Element + "_" + cUISkin::GetSkinStateName( i ) + "_" + cUISkinComplex::GetSideSuffix( s ); + for ( i = 0; i < UISkinState::StateCount; i++ ) { + for ( s = 0; s < UISkinComplex::SideCount; s++ ) { + ElemName = Element + "_" + UISkin::GetSkinStateName( i ) + "_" + UISkinComplex::GetSideSuffix( s ); if ( SG->GetByName( ElemName ) ) { IsComplex = 1; @@ -263,8 +263,8 @@ bool cUITheme::SearchFilesInAtlas( Graphics::TextureAtlas * SG, std::string Elem // Search Simple Skin if ( !IsComplex ) { - for ( i = 0; i < cUISkinState::StateCount; i++ ) { - ElemName = Element + "_" + cUISkin::GetSkinStateName( i ); + for ( i = 0; i < UISkinState::StateCount; i++ ) { + ElemName = Element + "_" + UISkin::GetSkinStateName( i ); if ( SG->GetByName( ElemName ) ) { Found = true; @@ -276,7 +276,7 @@ bool cUITheme::SearchFilesInAtlas( Graphics::TextureAtlas * SG, std::string Elem return Found; } -bool cUITheme::SearchFilesOfElement( Graphics::TextureAtlas * SG, const std::string& Path, std::string Element, Uint32& IsComplex, const std::string ImgExt ) { +bool UITheme::SearchFilesOfElement( Graphics::TextureAtlas * SG, const std::string& Path, std::string Element, Uint32& IsComplex, const std::string ImgExt ) { bool Found = false; Uint32 i = 0, s = 0; std::string ElemPath; @@ -285,9 +285,9 @@ bool cUITheme::SearchFilesOfElement( Graphics::TextureAtlas * SG, const std::str IsComplex = 0; // Search Complex Skin - for ( i = 0; i < cUISkinState::StateCount; i++ ) { - for ( s = 0; s < cUISkinComplex::SideCount; s++ ) { - ElemName = Element + "_" + cUISkin::GetSkinStateName( i ) + "_" + cUISkinComplex::GetSideSuffix( s ); + for ( i = 0; i < UISkinState::StateCount; i++ ) { + for ( s = 0; s < UISkinComplex::SideCount; s++ ) { + ElemName = Element + "_" + UISkin::GetSkinStateName( i ) + "_" + UISkinComplex::GetSideSuffix( s ); ElemPath = Path + ElemName; ElemFullPath = ElemPath + "." + ImgExt; @@ -303,8 +303,8 @@ bool cUITheme::SearchFilesOfElement( Graphics::TextureAtlas * SG, const std::str // Seach Simple Skin if ( !IsComplex ) { - for ( i = 0; i < cUISkinState::StateCount; i++ ) { - ElemName = Element + "_" + cUISkin::GetSkinStateName( i ); + for ( i = 0; i < UISkinState::StateCount; i++ ) { + ElemName = Element + "_" + UISkin::GetSkinStateName( i ); ElemPath = Path + ElemName; ElemFullPath = ElemPath + "." + ImgExt; @@ -319,8 +319,8 @@ bool cUITheme::SearchFilesOfElement( Graphics::TextureAtlas * SG, const std::str return Found; } -cUITheme::cUITheme( const std::string& Name, const std::string& Abbr, Graphics::Font * DefaultFont ) : - ResourceManager ( false ), +UITheme::UITheme( const std::string& Name, const std::string& Abbr, Graphics::Font * DefaultFont ) : + ResourceManager ( false ), mName( Name ), mNameHash( String::Hash( mName ) ), mAbbr( Abbr ), @@ -334,98 +334,98 @@ cUITheme::cUITheme( const std::string& Name, const std::string& Abbr, Graphics:: { } -cUITheme::~cUITheme() { +UITheme::~UITheme() { } -const std::string& cUITheme::Name() const { +const std::string& UITheme::Name() const { return mName; } -void cUITheme::Name( const std::string& name ) { +void UITheme::Name( const std::string& name ) { mName = name; mNameHash = String::Hash( mName ); } -const Uint32& cUITheme::Id() const { +const Uint32& UITheme::Id() const { return mNameHash; } -const std::string& cUITheme::Abbr() const { +const std::string& UITheme::Abbr() const { return mAbbr; } -cUISkin * cUITheme::Add( cUISkin * Resource ) { +UISkin * UITheme::Add( UISkin * Resource ) { Resource->Theme( this ); - return ResourceManager::Add( Resource ); + return ResourceManager::Add( Resource ); } -void cUITheme::Font( Graphics::Font * Font ) { +void UITheme::Font( Graphics::Font * Font ) { mFont = Font; } -Graphics::Font * cUITheme::Font() const { +Graphics::Font * UITheme::Font() const { return mFont; } -const ColorA& cUITheme::FontColor() const { +const ColorA& UITheme::FontColor() const { return mFontColor; } -const ColorA& cUITheme::FontShadowColor() const { +const ColorA& UITheme::FontShadowColor() const { return mFontShadowColor; } -const ColorA& cUITheme::FontOverColor() const { +const ColorA& UITheme::FontOverColor() const { return mFontOverColor; } -const ColorA& cUITheme::FontSelectedColor() const { +const ColorA& UITheme::FontSelectedColor() const { return mFontSelectedColor; } -void cUITheme::FontColor( const ColorA& Color ) { +void UITheme::FontColor( const ColorA& Color ) { mFontColor = Color; } -void cUITheme::FontShadowColor( const ColorA& Color ) { +void UITheme::FontShadowColor( const ColorA& Color ) { mFontShadowColor = Color; } -void cUITheme::FontOverColor( const ColorA& Color ) { +void UITheme::FontOverColor( const ColorA& Color ) { mFontOverColor = Color; } -void cUITheme::FontSelectedColor( const ColorA& Color ) { +void UITheme::FontSelectedColor( const ColorA& Color ) { mFontSelectedColor = Color; } -void cUITheme::UseDefaultThemeValues( const bool& Use ) { +void UITheme::UseDefaultThemeValues( const bool& Use ) { mUseDefaultThemeValues = Use; } -const bool& cUITheme::UseDefaultThemeValues() const { +const bool& UITheme::UseDefaultThemeValues() const { return mUseDefaultThemeValues; } -Graphics::TextureAtlas * cUITheme::TextureAtlas() const { +Graphics::TextureAtlas * UITheme::TextureAtlas() const { return mTextureAtlas; } -void cUITheme::TextureAtlas( Graphics::TextureAtlas * SG ) { +void UITheme::TextureAtlas( Graphics::TextureAtlas * SG ) { mTextureAtlas = SG; } -SubTexture * cUITheme::GetIconByName( const std::string& name ) { +SubTexture * UITheme::GetIconByName( const std::string& name ) { if ( NULL != mTextureAtlas ) return mTextureAtlas->GetByName( mAbbr + "_icon_" + name ); return NULL; } -cUIGfx * cUITheme::CreateGfx( SubTexture * SubTexture, cUIControl * Parent, const Sizei& Size, const Vector2i& Pos, const Uint32& Flags, ColorA SubTextureColor, EE_RENDER_MODE SubTextureRender ) { - cUIGfx::CreateParams GfxParams; +UIGfx * UITheme::CreateGfx( SubTexture * SubTexture, UIControl * Parent, const Sizei& Size, const Vector2i& Pos, const Uint32& Flags, ColorA SubTextureColor, EE_RENDER_MODE SubTextureRender ) { + UIGfx::CreateParams GfxParams; GfxParams.Parent( Parent ); GfxParams.PosSet( Pos ); GfxParams.SizeSet( Size ); @@ -433,14 +433,14 @@ cUIGfx * cUITheme::CreateGfx( SubTexture * SubTexture, cUIControl * Parent, cons GfxParams.SubTexture = SubTexture; GfxParams.SubTextureColor = SubTextureColor; GfxParams.SubTextureRender = SubTextureRender; - cUIGfx * Gfx = eeNew( cUIGfx, ( GfxParams ) ); + UIGfx * Gfx = eeNew( UIGfx, ( GfxParams ) ); Gfx->Visible( true ); Gfx->Enabled( true ); return Gfx; } -cUISprite * cUITheme::CreateSprite( Sprite * Sprite, cUIControl * Parent, const Sizei& Size, const Vector2i& Pos, const Uint32& Flags, bool DealloSprite, EE_RENDER_MODE SpriteRender ) { - cUISprite::CreateParams SpriteParams; +UISprite * UITheme::CreateSprite( Sprite * Sprite, UIControl * Parent, const Sizei& Size, const Vector2i& Pos, const Uint32& Flags, bool DealloSprite, EE_RENDER_MODE SpriteRender ) { + UISprite::CreateParams SpriteParams; SpriteParams.Parent( Parent ); SpriteParams.PosSet( Pos ); SpriteParams.SizeSet( Size ); @@ -448,63 +448,63 @@ cUISprite * cUITheme::CreateSprite( Sprite * Sprite, cUIControl * Parent, const SpriteParams.Sprite = Sprite; SpriteParams.SpriteRender = SpriteRender; SpriteParams.DealloSprite = DealloSprite; - cUISprite * Spr = eeNew( cUISprite, ( SpriteParams ) ); + UISprite * Spr = eeNew( UISprite, ( SpriteParams ) ); Spr->Visible( true ); Spr->Enabled( true ); return Spr; } -cUICheckBox * cUITheme::CreateCheckBox( cUIControl * Parent, const Sizei& Size, const Vector2i& Pos, const Uint32& Flags ) { - cUICheckBox::CreateParams CheckBoxParams; +UICheckBox * UITheme::CreateCheckBox( UIControl * Parent, const Sizei& Size, const Vector2i& Pos, const Uint32& Flags ) { + UICheckBox::CreateParams CheckBoxParams; CheckBoxParams.Parent( Parent ); CheckBoxParams.PosSet( Pos ); CheckBoxParams.SizeSet( Size ); CheckBoxParams.Flags = Flags; - cUICheckBox * Ctrl = eeNew( cUICheckBox, ( CheckBoxParams ) ); + UICheckBox * Ctrl = eeNew( UICheckBox, ( CheckBoxParams ) ); Ctrl->Visible( true ); Ctrl->Enabled( true ); return Ctrl; } -cUIRadioButton * cUITheme::CreateRadioButton( cUIControl * Parent, const Sizei& Size, const Vector2i& Pos, const Uint32& Flags ) { - cUIRadioButton::CreateParams RadioButtonParams; +UIRadioButton * UITheme::CreateRadioButton( UIControl * Parent, const Sizei& Size, const Vector2i& Pos, const Uint32& Flags ) { + UIRadioButton::CreateParams RadioButtonParams; RadioButtonParams.Parent( Parent ); RadioButtonParams.PosSet( Pos ); RadioButtonParams.SizeSet( Size ); RadioButtonParams.Flags = Flags; - cUIRadioButton * Ctrl = eeNew( cUIRadioButton, ( RadioButtonParams ) ); + UIRadioButton * Ctrl = eeNew( UIRadioButton, ( RadioButtonParams ) ); Ctrl->Visible( true ); Ctrl->Enabled( true ); return Ctrl; } -cUITextBox * cUITheme::CreateTextBox( const String& Text, cUIControl * Parent, const Sizei& Size, const Vector2i& Pos, const Uint32& Flags ) { - cUITextBox::CreateParams TextBoxParams; +UITextBox * UITheme::CreateTextBox( const String& Text, UIControl * Parent, const Sizei& Size, const Vector2i& Pos, const Uint32& Flags ) { + UITextBox::CreateParams TextBoxParams; TextBoxParams.Parent( Parent ); TextBoxParams.PosSet( Pos ); TextBoxParams.SizeSet( Size ); TextBoxParams.Flags = Flags; - cUITextBox * Ctrl = eeNew( cUITextBox, ( TextBoxParams ) ); + UITextBox * Ctrl = eeNew( UITextBox, ( TextBoxParams ) ); Ctrl->Visible( true ); Ctrl->Enabled( false ); Ctrl->Text( Text ); return Ctrl; } -cUITooltip * cUITheme::CreateTooltip( cUIControl * TooltipOf, cUIControl * Parent, const Sizei& Size, const Vector2i& Pos, const Uint32& Flags ) { - cUITooltip::CreateParams TooltipParams; +UITooltip * UITheme::CreateTooltip( UIControl * TooltipOf, UIControl * Parent, const Sizei& Size, const Vector2i& Pos, const Uint32& Flags ) { + UITooltip::CreateParams TooltipParams; TooltipParams.Parent( Parent ); TooltipParams.PosSet( Pos ); TooltipParams.SizeSet( Size ); TooltipParams.Flags = Flags; - cUITooltip * Ctrl = eeNew( cUITooltip, ( TooltipParams, TooltipOf ) ); + UITooltip * Ctrl = eeNew( UITooltip, ( TooltipParams, TooltipOf ) ); Ctrl->Visible( true ); Ctrl->Enabled( true ); return Ctrl; } -cUITextEdit * cUITheme::CreateTextEdit( cUIControl * Parent, const Sizei& Size, const Vector2i& Pos, const Uint32& Flags, UI_SCROLLBAR_MODE HScrollBar, UI_SCROLLBAR_MODE VScrollBar, bool WordWrap ) { - cUITextEdit::CreateParams TextEditParams; +UITextEdit * UITheme::CreateTextEdit( UIControl * Parent, const Sizei& Size, const Vector2i& Pos, const Uint32& Flags, UI_SCROLLBAR_MODE HScrollBar, UI_SCROLLBAR_MODE VScrollBar, bool WordWrap ) { + UITextEdit::CreateParams TextEditParams; TextEditParams.Parent( Parent ); TextEditParams.PosSet( Pos ); TextEditParams.SizeSet( Size ); @@ -512,69 +512,69 @@ cUITextEdit * cUITheme::CreateTextEdit( cUIControl * Parent, const Sizei& Size, TextEditParams.HScrollBar = HScrollBar; TextEditParams.VScrollBar = VScrollBar; TextEditParams.WordWrap = WordWrap; - cUITextEdit * Ctrl = eeNew( cUITextEdit, ( TextEditParams ) ); + UITextEdit * Ctrl = eeNew( UITextEdit, ( TextEditParams ) ); Ctrl->Visible( true ); Ctrl->Enabled( true ); return Ctrl; } -cUITextInput * cUITheme::CreateTextInput( cUIControl * Parent, const Sizei& Size, const Vector2i& Pos, const Uint32& Flags, bool SupportFreeEditing, Uint32 MaxLength ) { - cUITextInput::CreateParams TextInputParams; +UITextInput * UITheme::CreateTextInput( UIControl * Parent, const Sizei& Size, const Vector2i& Pos, const Uint32& Flags, bool SupportFreeEditing, Uint32 MaxLength ) { + UITextInput::CreateParams TextInputParams; TextInputParams.Parent( Parent ); TextInputParams.PosSet( Pos ); TextInputParams.SizeSet( Size ); TextInputParams.Flags = Flags; TextInputParams.SupportFreeEditing = SupportFreeEditing; TextInputParams.MaxLength = MaxLength; - cUITextInput * Ctrl = eeNew( cUITextInput, ( TextInputParams ) ); + UITextInput * Ctrl = eeNew( UITextInput, ( TextInputParams ) ); Ctrl->Visible( true ); Ctrl->Enabled( true ); return Ctrl; } -cUITextInputPassword * cUITheme::CreateTextInputPassword( cUIControl * Parent, const Sizei& Size, const Vector2i& Pos, const Uint32& Flags, bool SupportFreeEditing, Uint32 MaxLength ) { - cUITextInput::CreateParams TextInputParams; +UITextInputPassword * UITheme::CreateTextInputPassword( UIControl * Parent, const Sizei& Size, const Vector2i& Pos, const Uint32& Flags, bool SupportFreeEditing, Uint32 MaxLength ) { + UITextInput::CreateParams TextInputParams; TextInputParams.Parent( Parent ); TextInputParams.PosSet( Pos ); TextInputParams.SizeSet( Size ); TextInputParams.Flags = Flags; TextInputParams.SupportFreeEditing = SupportFreeEditing; TextInputParams.MaxLength = MaxLength; - cUITextInputPassword * Ctrl = eeNew( cUITextInputPassword, ( TextInputParams ) ); + UITextInputPassword * Ctrl = eeNew( UITextInputPassword, ( TextInputParams ) ); Ctrl->Visible( true ); Ctrl->Enabled( true ); return Ctrl; } -cUISpinBox * cUITheme::CreateSpinBox( cUIControl * Parent, const Sizei& Size, const Vector2i& Pos, const Uint32& Flags, Float DefaultValue, bool AllowDotsInNumbers ) { - cUISpinBox::CreateParams SpinBoxParams; +UISpinBox * UITheme::CreateSpinBox( UIControl * Parent, const Sizei& Size, const Vector2i& Pos, const Uint32& Flags, Float DefaultValue, bool AllowDotsInNumbers ) { + UISpinBox::CreateParams SpinBoxParams; SpinBoxParams.Parent( Parent ); SpinBoxParams.PosSet( Pos ); SpinBoxParams.SizeSet( Size ); SpinBoxParams.Flags = Flags; SpinBoxParams.DefaultValue = DefaultValue; SpinBoxParams.AllowDotsInNumbers = AllowDotsInNumbers; - cUISpinBox * Ctrl = eeNew( cUISpinBox, ( SpinBoxParams ) ); + UISpinBox * Ctrl = eeNew( UISpinBox, ( SpinBoxParams ) ); Ctrl->Visible( true ); Ctrl->Enabled( true ); return Ctrl; } -cUIScrollBar * cUITheme::CreateScrollBar( cUIControl * Parent, const Sizei& Size, const Vector2i& Pos, const Uint32& Flags, bool VerticalScrollBar ) { - cUIScrollBar::CreateParams ScrollBarParams; +UIScrollBar * UITheme::CreateScrollBar( UIControl * Parent, const Sizei& Size, const Vector2i& Pos, const Uint32& Flags, bool VerticalScrollBar ) { + UIScrollBar::CreateParams ScrollBarParams; ScrollBarParams.Parent( Parent ); ScrollBarParams.PosSet( Pos ); ScrollBarParams.SizeSet( Size ); ScrollBarParams.Flags = Flags; ScrollBarParams.VerticalScrollBar = VerticalScrollBar; - cUIScrollBar * Ctrl = eeNew( cUIScrollBar, ( ScrollBarParams ) ); + UIScrollBar * Ctrl = eeNew( UIScrollBar, ( ScrollBarParams ) ); Ctrl->Visible( true ); Ctrl->Enabled( true ); return Ctrl; } -cUISlider * cUITheme::CreateSlider( cUIControl * Parent, const Sizei& Size, const Vector2i& Pos, const Uint32& Flags, bool VerticalSlider, bool AllowHalfSliderOut, bool ExpandBackground ) { - cUISlider::CreateParams SliderParams; +UISlider * UITheme::CreateSlider( UIControl * Parent, const Sizei& Size, const Vector2i& Pos, const Uint32& Flags, bool VerticalSlider, bool AllowHalfSliderOut, bool ExpandBackground ) { + UISlider::CreateParams SliderParams; SliderParams.Parent( Parent ); SliderParams.PosSet( Pos ); SliderParams.SizeSet( Size ); @@ -582,14 +582,14 @@ cUISlider * cUITheme::CreateSlider( cUIControl * Parent, const Sizei& Size, cons SliderParams.VerticalSlider = VerticalSlider; SliderParams.AllowHalfSliderOut = AllowHalfSliderOut; SliderParams.ExpandBackground = ExpandBackground; - cUISlider * Ctrl = eeNew( cUISlider, ( SliderParams ) ); + UISlider * Ctrl = eeNew( UISlider, ( SliderParams ) ); Ctrl->Visible( true ); Ctrl->Enabled( true ); return Ctrl; } -cUIComboBox * cUITheme::CreateComboBox( cUIControl * Parent, const Sizei& Size, const Vector2i& Pos, const Uint32& Flags, Uint32 MinNumVisibleItems, bool PopUpToMainControl, cUIListBox * ListBox ) { - cUIComboBox::CreateParams ComboParams; +UIComboBox * UITheme::CreateComboBox( UIControl * Parent, const Sizei& Size, const Vector2i& Pos, const Uint32& Flags, Uint32 MinNumVisibleItems, bool PopUpToMainControl, UIListBox * ListBox ) { + UIComboBox::CreateParams ComboParams; ComboParams.Parent( Parent ); ComboParams.PosSet( Pos ); ComboParams.SizeSet( Size ); @@ -597,14 +597,14 @@ cUIComboBox * cUITheme::CreateComboBox( cUIControl * Parent, const Sizei& Size, ComboParams.MinNumVisibleItems = MinNumVisibleItems; ComboParams.PopUpToMainControl = PopUpToMainControl; ComboParams.ListBox = ListBox; - cUIComboBox * Ctrl = eeNew( cUIComboBox, ( ComboParams ) ); + UIComboBox * Ctrl = eeNew( UIComboBox, ( ComboParams ) ); Ctrl->Visible( true ); Ctrl->Enabled( true ); return Ctrl; } -cUIDropDownList * cUITheme::CreateDropDownList( cUIControl * Parent, const Sizei& Size, const Vector2i& Pos, const Uint32& Flags, Uint32 MinNumVisibleItems, bool PopUpToMainControl, cUIListBox * ListBox ) { - cUIDropDownList::CreateParams DDLParams; +UIDropDownList * UITheme::CreateDropDownList( UIControl * Parent, const Sizei& Size, const Vector2i& Pos, const Uint32& Flags, Uint32 MinNumVisibleItems, bool PopUpToMainControl, UIListBox * ListBox ) { + UIDropDownList::CreateParams DDLParams; DDLParams.Parent( Parent ); DDLParams.PosSet( Pos ); DDLParams.SizeSet( Size ); @@ -612,14 +612,14 @@ cUIDropDownList * cUITheme::CreateDropDownList( cUIControl * Parent, const Sizei DDLParams.MinNumVisibleItems = MinNumVisibleItems; DDLParams.PopUpToMainControl = PopUpToMainControl; DDLParams.ListBox = ListBox; - cUIDropDownList * Ctrl = eeNew( cUIDropDownList, ( DDLParams ) ); + UIDropDownList * Ctrl = eeNew( UIDropDownList, ( DDLParams ) ); Ctrl->Visible( true ); Ctrl->Enabled( true ); return Ctrl; } -cUIListBox * cUITheme::CreateListBox( cUIControl * Parent, const Sizei& Size, const Vector2i& Pos, const Uint32& Flags, bool SmoothScroll, Uint32 RowHeight, UI_SCROLLBAR_MODE VScrollMode, UI_SCROLLBAR_MODE HScrollMode, Recti PaddingContainer ) { - cUIListBox::CreateParams LBParams; +UIListBox * UITheme::CreateListBox( UIControl * Parent, const Sizei& Size, const Vector2i& Pos, const Uint32& Flags, bool SmoothScroll, Uint32 RowHeight, UI_SCROLLBAR_MODE VScrollMode, UI_SCROLLBAR_MODE HScrollMode, Recti PaddingContainer ) { + UIListBox::CreateParams LBParams; LBParams.Parent( Parent ); LBParams.PosSet( Pos ); LBParams.SizeSet( Size ); @@ -629,14 +629,14 @@ cUIListBox * cUITheme::CreateListBox( cUIControl * Parent, const Sizei& Size, co LBParams.VScrollMode = VScrollMode; LBParams.HScrollMode = HScrollMode; LBParams.PaddingContainer = PaddingContainer; - cUIListBox * Ctrl = eeNew( cUIListBox, ( LBParams ) ); + UIListBox * Ctrl = eeNew( UIListBox, ( LBParams ) ); Ctrl->Visible( true ); Ctrl->Enabled( true ); return Ctrl; } -cUIMenu * cUITheme::CreateMenu( cUIControl * Parent, const Sizei& Size, const Vector2i& Pos, const Uint32& Flags, Uint32 RowHeight, Recti PaddingContainer, Uint32 MinWidth, Uint32 MinSpaceForIcons, Uint32 MinRightMargin ) { - cUIMenu::CreateParams MenuParams; +UIMenu * UITheme::CreateMenu( UIControl * Parent, const Sizei& Size, const Vector2i& Pos, const Uint32& Flags, Uint32 RowHeight, Recti PaddingContainer, Uint32 MinWidth, Uint32 MinSpaceForIcons, Uint32 MinRightMargin ) { + UIMenu::CreateParams MenuParams; MenuParams.Parent( Parent ); MenuParams.PosSet( Pos ); MenuParams.SizeSet( Size ); @@ -647,14 +647,14 @@ cUIMenu * cUITheme::CreateMenu( cUIControl * Parent, const Sizei& Size, const Ve MenuParams.MinSpaceForIcons = MinSpaceForIcons; MenuParams.MinRightMargin = MinRightMargin; - cUIMenu * Ctrl = eeNew( cUIMenu, ( MenuParams ) ); + UIMenu * Ctrl = eeNew( UIMenu, ( MenuParams ) ); Ctrl->Visible( true ); Ctrl->Enabled( true ); return Ctrl; } -cUIPopUpMenu * cUITheme::CreatePopUpMenu( cUIControl * Parent, const Sizei& Size, const Vector2i& Pos, const Uint32& Flags, Uint32 RowHeight, Recti PaddingContainer, Uint32 MinWidth, Uint32 MinSpaceForIcons, Uint32 MinRightMargin ) { - cUIPopUpMenu::CreateParams MenuParams; +UIPopUpMenu * UITheme::CreatePopUpMenu( UIControl * Parent, const Sizei& Size, const Vector2i& Pos, const Uint32& Flags, Uint32 RowHeight, Recti PaddingContainer, Uint32 MinWidth, Uint32 MinSpaceForIcons, Uint32 MinRightMargin ) { + UIPopUpMenu::CreateParams MenuParams; MenuParams.Parent( Parent ); MenuParams.PosSet( Pos ); MenuParams.SizeSet( Size ); @@ -664,11 +664,11 @@ cUIPopUpMenu * cUITheme::CreatePopUpMenu( cUIControl * Parent, const Sizei& Size MenuParams.MinWidth = MinWidth; MenuParams.MinSpaceForIcons = MinSpaceForIcons; MenuParams.MinRightMargin = MinRightMargin; - return eeNew( cUIPopUpMenu, ( MenuParams ) ); + return eeNew( UIPopUpMenu, ( MenuParams ) ); } -cUIProgressBar * cUITheme::CreateProgressBar( cUIControl * Parent, const Sizei& Size, const Vector2i& Pos, const Uint32& Flags, bool DisplayPercent, bool VerticalExpand, Vector2f MovementSpeed, Rectf FillerMargin ) { - cUIProgressBar::CreateParams PBParams; +UIProgressBar * UITheme::CreateProgressBar( UIControl * Parent, const Sizei& Size, const Vector2i& Pos, const Uint32& Flags, bool DisplayPercent, bool VerticalExpand, Vector2f MovementSpeed, Rectf FillerMargin ) { + UIProgressBar::CreateParams PBParams; PBParams.Parent( Parent ); PBParams.PosSet( Pos ); PBParams.SizeSet( Size ); @@ -678,14 +678,14 @@ cUIProgressBar * cUITheme::CreateProgressBar( cUIControl * Parent, const Sizei& PBParams.MovementSpeed = MovementSpeed; PBParams.FillerMargin = FillerMargin; - cUIProgressBar * Ctrl = eeNew( cUIProgressBar, ( PBParams ) ); + UIProgressBar * Ctrl = eeNew( UIProgressBar, ( PBParams ) ); Ctrl->Visible( true ); Ctrl->Enabled( true ); return Ctrl; } -cUIPushButton * cUITheme::CreatePushButton( cUIControl * Parent, const Sizei& Size, const Vector2i& Pos, const Uint32& Flags, SubTexture * Icon, Int32 IconHorizontalMargin, bool IconAutoMargin ) { - cUIPushButton::CreateParams ButtonParams; +UIPushButton * UITheme::CreatePushButton( UIControl * Parent, const Sizei& Size, const Vector2i& Pos, const Uint32& Flags, SubTexture * Icon, Int32 IconHorizontalMargin, bool IconAutoMargin ) { + UIPushButton::CreateParams ButtonParams; ButtonParams.Parent( Parent ); ButtonParams.PosSet( Pos ); ButtonParams.SizeSet( Size ); @@ -697,14 +697,14 @@ cUIPushButton * cUITheme::CreatePushButton( cUIControl * Parent, const Sizei& Si if ( NULL != Icon ) ButtonParams.SetIcon( Icon ); - cUIPushButton * Ctrl = eeNew( cUIPushButton, ( ButtonParams ) ); + UIPushButton * Ctrl = eeNew( UIPushButton, ( ButtonParams ) ); Ctrl->Visible( true ); Ctrl->Enabled( true ); return Ctrl; } -cUISelectButton * cUITheme::CreateSelectButton( cUIControl * Parent, const Sizei& Size, const Vector2i& Pos, const Uint32& Flags, SubTexture * Icon, Int32 IconHorizontalMargin, bool IconAutoMargin ) { - cUIPushButton::CreateParams ButtonParams; +UISelectButton * UITheme::CreateSelectButton( UIControl * Parent, const Sizei& Size, const Vector2i& Pos, const Uint32& Flags, SubTexture * Icon, Int32 IconHorizontalMargin, bool IconAutoMargin ) { + UIPushButton::CreateParams ButtonParams; ButtonParams.Parent( Parent ); ButtonParams.PosSet( Pos ); ButtonParams.SizeSet( Size ); @@ -716,14 +716,14 @@ cUISelectButton * cUITheme::CreateSelectButton( cUIControl * Parent, const Sizei if ( NULL != Icon ) ButtonParams.SetIcon( Icon ); - cUISelectButton * Ctrl = eeNew( cUISelectButton, ( ButtonParams ) ); + UISelectButton * Ctrl = eeNew( UISelectButton, ( ButtonParams ) ); Ctrl->Visible( true ); Ctrl->Enabled( true ); return Ctrl; } -cUIWinMenu * cUITheme::CreateWinMenu( cUIControl * Parent, const Sizei& Size, const Vector2i& Pos, const Uint32& Flags, Uint32 MarginBetweenButtons, Uint32 ButtonMargin, Uint32 MenuHeight, Uint32 FirstButtonMargin ) { - cUIWinMenu::CreateParams WinMenuParams; +UIWinMenu * UITheme::CreateWinMenu( UIControl * Parent, const Sizei& Size, const Vector2i& Pos, const Uint32& Flags, Uint32 MarginBetweenButtons, Uint32 ButtonMargin, Uint32 MenuHeight, Uint32 FirstButtonMargin ) { + UIWinMenu::CreateParams WinMenuParams; WinMenuParams.Parent( Parent ); WinMenuParams.PosSet( Pos ); WinMenuParams.SizeSet( Size ); @@ -733,14 +733,14 @@ cUIWinMenu * cUITheme::CreateWinMenu( cUIControl * Parent, const Sizei& Size, co WinMenuParams.MenuHeight = MenuHeight; WinMenuParams.FirstButtonMargin = FirstButtonMargin; - cUIWinMenu * Ctrl = eeNew( cUIWinMenu, ( WinMenuParams ) ); + UIWinMenu * Ctrl = eeNew( UIWinMenu, ( WinMenuParams ) ); Ctrl->Visible( true ); Ctrl->Enabled( true ); return Ctrl; } -cUIWindow * cUITheme::CreateWindow( cUIControl * Parent, const Sizei& Size, const Vector2i& Pos, const Uint32& Flags, Uint32 WinFlags, Sizei MinWindowSize, Uint8 BaseAlpha ) { - cUIWindow::CreateParams WinParams; +UIWindow * UITheme::CreateWindow( UIControl * Parent, const Sizei& Size, const Vector2i& Pos, const Uint32& Flags, Uint32 WinFlags, Sizei MinWindowSize, Uint8 BaseAlpha ) { + UIWindow::CreateParams WinParams; WinParams.Parent( Parent ); WinParams.PosSet( Pos ); WinParams.SizeSet( Size ); @@ -748,11 +748,11 @@ cUIWindow * cUITheme::CreateWindow( cUIControl * Parent, const Sizei& Size, cons WinParams.WinFlags = WinFlags; WinParams.MinWindowSize = MinWindowSize; WinParams.BaseAlpha = BaseAlpha; - return eeNew( cUIWindow, ( WinParams ) ); + return eeNew( UIWindow, ( WinParams ) ); } -cUICommonDialog * cUITheme::CreateCommonDialog( cUIControl * Parent, const Sizei& Size, const Vector2i& Pos, const Uint32& Flags, Uint32 WinFlags, Sizei MinWindowSize, Uint8 BaseAlpha, Uint32 CDLFlags, std::string DefaultFilePattern, std::string DefaultDirectory ) { - cUICommonDialog::CreateParams DLGParams; +UICommonDialog * UITheme::CreateCommonDialog( UIControl * Parent, const Sizei& Size, const Vector2i& Pos, const Uint32& Flags, Uint32 WinFlags, Sizei MinWindowSize, Uint8 BaseAlpha, Uint32 CDLFlags, std::string DefaultFilePattern, std::string DefaultDirectory ) { + UICommonDialog::CreateParams DLGParams; DLGParams.Parent( Parent ); DLGParams.PosSet( Pos ); DLGParams.SizeSet( Size ); @@ -763,11 +763,11 @@ cUICommonDialog * cUITheme::CreateCommonDialog( cUIControl * Parent, const Sizei DLGParams.DefaultDirectory = DefaultDirectory; DLGParams.DefaultFilePattern = DefaultFilePattern; DLGParams.CDLFlags = CDLFlags; - return eeNew( cUICommonDialog, ( DLGParams ) ); + return eeNew( UICommonDialog, ( DLGParams ) ); } -cUIMessageBox * cUITheme::CreateMessageBox( UI_MSGBOX_TYPE Type, const String& Message, Uint32 WinFlags, cUIControl * Parent, const Sizei& Size, const Vector2i& Pos, const Uint32& Flags, Sizei MinWindowSize, Uint8 BaseAlpha ) { - cUIMessageBox::CreateParams MsgBoxParams; +UIMessageBox * UITheme::CreateMessageBox( UI_MSGBOX_TYPE Type, const String& Message, Uint32 WinFlags, UIControl * Parent, const Sizei& Size, const Vector2i& Pos, const Uint32& Flags, Sizei MinWindowSize, Uint8 BaseAlpha ) { + UIMessageBox::CreateParams MsgBoxParams; MsgBoxParams.Parent( Parent ); MsgBoxParams.PosSet( Pos ); MsgBoxParams.SizeSet( Size ); @@ -777,11 +777,11 @@ cUIMessageBox * cUITheme::CreateMessageBox( UI_MSGBOX_TYPE Type, const String& M MsgBoxParams.BaseAlpha = BaseAlpha; MsgBoxParams.Type = Type; MsgBoxParams.Message = Message; - return eeNew( cUIMessageBox, ( MsgBoxParams ) ); + return eeNew( UIMessageBox, ( MsgBoxParams ) ); } -cUITabWidget * cUITheme::CreateTabWidget( cUIControl *Parent, const Sizei &Size, const Vector2i &Pos, const Uint32 &Flags, const bool &TabsClosable, const bool &SpecialBorderTabs, const Int32 &TabSeparation, const Uint32 &MaxTextLength, const Uint32 &TabWidgetHeight, const Uint32 &TabTextAlign, const Uint32 &MinTabWidth, const Uint32 &MaxTabWidth ) { - cUITabWidget::CreateParams TabWidgetParams; +UITabWidget * UITheme::CreateTabWidget( UIControl *Parent, const Sizei &Size, const Vector2i &Pos, const Uint32 &Flags, const bool &TabsClosable, const bool &SpecialBorderTabs, const Int32 &TabSeparation, const Uint32 &MaxTextLength, const Uint32 &TabWidgetHeight, const Uint32 &TabTextAlign, const Uint32 &MinTabWidth, const Uint32 &MaxTabWidth ) { + UITabWidget::CreateParams TabWidgetParams; TabWidgetParams.Parent( Parent ); TabWidgetParams.PosSet( Pos ); TabWidgetParams.SizeSet( Size ); @@ -795,7 +795,7 @@ cUITabWidget * cUITheme::CreateTabWidget( cUIControl *Parent, const Sizei &Size, TabWidgetParams.MinTabWidth = MinTabWidth; TabWidgetParams.MaxTabWidth = MaxTabWidth; - cUITabWidget * Ctrl = eeNew( cUITabWidget, ( TabWidgetParams ) ); + UITabWidget * Ctrl = eeNew( UITabWidget, ( TabWidgetParams ) ); Ctrl->Visible( true ); Ctrl->Enabled( true ); return Ctrl; diff --git a/src/eepp/ui/uithememanager.cpp b/src/eepp/ui/uithememanager.cpp new file mode 100644 index 000000000..dde7ec70c --- /dev/null +++ b/src/eepp/ui/uithememanager.cpp @@ -0,0 +1,120 @@ +#include +#include +#include + +namespace EE { namespace UI { + +SINGLETON_DECLARE_IMPLEMENTATION(UIThemeManager) + +UIThemeManager::UIThemeManager() : + ResourceManager( true ), + mFont( NULL ), + mThemeDefault( NULL ), + mAutoApplyDefaultTheme( true ), + mEnableDefaultEffects( false ), + mFadeInTime( Milliseconds( 100.f ) ), + mFadeOutTime( Milliseconds ( 100.f ) ), + mTooltipTimeToShow( Milliseconds( 200 ) ), + mTooltipFollowMouse( true ), + mCursorSize( 16, 16 ) +{ +} + +UIThemeManager::~UIThemeManager() { +} + +void UIThemeManager::DefaultFont( Font * Font ) { + mFont = Font; +} + +Font * UIThemeManager::DefaultFont() const { + return mFont; +} + +void UIThemeManager::SetTheme( const std::string& Theme ) { + SetTheme( GetByName( Theme ) ); +} + +void UIThemeManager::SetTheme( UITheme * Theme ) { + UIControl * MainCtrl = UIManager::instance()->MainControl(); + + if ( NULL != MainCtrl ) { + MainCtrl->SetThemeToChilds( Theme ); + MainCtrl->SetTheme( Theme ); + } +} + +void UIThemeManager::DefaultTheme( UITheme * Theme ) { + mThemeDefault = Theme; +} + +void UIThemeManager::DefaultTheme( const std::string& Theme ) { + DefaultTheme( UIThemeManager::instance()->GetByName( Theme ) ); +} + +UITheme * UIThemeManager::DefaultTheme() const { + return mThemeDefault; +} + +void UIThemeManager::ApplyDefaultTheme( UIControl * Control ) { + if ( mAutoApplyDefaultTheme && NULL != mThemeDefault && NULL != Control ) + Control->SetTheme( mThemeDefault ); +} + +void UIThemeManager::AutoApplyDefaultTheme( const bool& apply ) { + mAutoApplyDefaultTheme = apply; +} + +const bool& UIThemeManager::AutoApplyDefaultTheme() const { + return mAutoApplyDefaultTheme; +} + +void UIThemeManager::DefaultEffectsEnabled( const bool& Enabled ) { + mEnableDefaultEffects = Enabled; +} + +const bool& UIThemeManager::DefaultEffectsEnabled() const { + return mEnableDefaultEffects; +} + +const Time& UIThemeManager::ControlsFadeInTime() const { + return mFadeInTime; +} + +void UIThemeManager::ControlsFadeInTime( const Time& Time ) { + mFadeInTime = Time; +} + +const Time& UIThemeManager::ControlsFadeOutTime() const { + return mFadeOutTime; +} + +void UIThemeManager::ControlsFadeOutTime( const Time& Time ) { + mFadeOutTime = Time; +} + +void UIThemeManager::TooltipTimeToShow( const Time& Time ) { + mTooltipTimeToShow = Time; +} + +const Time& UIThemeManager::TooltipTimeToShow() const { + return mTooltipTimeToShow; +} + +void UIThemeManager::TooltipFollowMouse( const bool& Follow ) { + mTooltipFollowMouse = Follow; +} + +const bool& UIThemeManager::TooltipFollowMouse() const { + return mTooltipFollowMouse; +} + +void UIThemeManager::CursorSize( const Sizei& Size ) { + mCursorSize = Size; +} + +const Sizei& UIThemeManager::CursorSize() const { + return mCursorSize; +} + +}} diff --git a/src/eepp/ui/cuitooltip.cpp b/src/eepp/ui/uitooltip.cpp similarity index 56% rename from src/eepp/ui/cuitooltip.cpp rename to src/eepp/ui/uitooltip.cpp index fb0fdeb8d..f72d1a5ea 100644 --- a/src/eepp/ui/cuitooltip.cpp +++ b/src/eepp/ui/uitooltip.cpp @@ -1,12 +1,12 @@ -#include -#include -#include +#include +#include +#include #include namespace EE { namespace UI { -cUITooltip::cUITooltip( cUITooltip::CreateParams& Params, cUIControl * TooltipOf ) : - cUIControlAnim( Params ), +UITooltip::UITooltip( UITooltip::CreateParams& Params, UIControl * TooltipOf ) : + UIControlAnim( Params ), mFontColor( Params.FontColor ), mFontShadowColor( Params.FontShadowColor ), mAlignOffset( 0.f, 0.f ), @@ -20,38 +20,38 @@ cUITooltip::cUITooltip( cUITooltip::CreateParams& Params, cUIControl * TooltipOf mTextCache->ShadowColor( mFontShadowColor ); if ( NULL == Params.Font ) { - if ( NULL != cUIThemeManager::instance()->DefaultFont() ) - mTextCache->Font( cUIThemeManager::instance()->DefaultFont() ); + if ( NULL != UIThemeManager::instance()->DefaultFont() ) + mTextCache->Font( UIThemeManager::instance()->DefaultFont() ); else - eePRINTL( "cUITooltip::cUITextBox : Created a UI TextBox without a defined font." ); + eePRINTL( "UITooltip::UITextBox : Created a UI TextBox without a defined font." ); } AutoPadding(); - if ( Params.ParentCtrl != cUIManager::instance()->MainControl() ) - Parent( cUIManager::instance()->MainControl() ); + if ( Params.ParentCtrl != UIManager::instance()->MainControl() ) + Parent( UIManager::instance()->MainControl() ); ApplyDefaultTheme(); } -cUITooltip::~cUITooltip() { +UITooltip::~UITooltip() { eeSAFE_DELETE( mTextCache ); if ( NULL != mTooltipOf && mTooltipOf->IsComplex() ) { - reinterpret_cast( mTooltipOf )->TooltipRemove(); + reinterpret_cast( mTooltipOf )->TooltipRemove(); } } -Uint32 cUITooltip::Type() const { +Uint32 UITooltip::Type() const { return UI_TYPE_TOOLTIP; } -bool cUITooltip::IsType( const Uint32& type ) const { - return cUITooltip::Type() == type ? true : cUIControlAnim::IsType( type ); +bool UITooltip::IsType( const Uint32& type ) const { + return UITooltip::Type() == type ? true : UIControlAnim::IsType( type ); } -void cUITooltip::SetTheme( cUITheme * Theme ) { - cUIControl::SetThemeControl( Theme, "tooltip" ); +void UITooltip::SetTheme( UITheme * Theme ) { + UIControl::SetThemeControl( Theme, "tooltip" ); AutoPadding(); @@ -60,40 +60,40 @@ void cUITooltip::SetTheme( cUITheme * Theme ) { } } -void cUITooltip::AutoPadding() { +void UITooltip::AutoPadding() { if ( mFlags & UI_AUTO_PADDING ) { mPadding = MakePadding( true, true, true, true ); } } -void cUITooltip::Show() { +void UITooltip::Show() { if ( !Visible() || 0 == mAlpha ) { ToFront(); Visible( true ); - if ( cUIThemeManager::instance()->DefaultEffectsEnabled() ) { + if ( UIThemeManager::instance()->DefaultEffectsEnabled() ) { if ( 255.f == mAlpha ) - StartAlphaAnim( 0.f, 255.f, cUIThemeManager::instance()->ControlsFadeInTime() ); + StartAlphaAnim( 0.f, 255.f, UIThemeManager::instance()->ControlsFadeInTime() ); else - CreateFadeIn( cUIThemeManager::instance()->ControlsFadeInTime() ); + CreateFadeIn( UIThemeManager::instance()->ControlsFadeInTime() ); } } } -void cUITooltip::Hide() { +void UITooltip::Hide() { if ( Visible() ) { - if ( cUIThemeManager::instance()->DefaultEffectsEnabled() ) { - DisableFadeOut( cUIThemeManager::instance()->ControlsFadeOutTime() ); + if ( UIThemeManager::instance()->DefaultEffectsEnabled() ) { + DisableFadeOut( UIThemeManager::instance()->ControlsFadeOutTime() ); } else { Visible( false ); } } } -void cUITooltip::Draw() { +void UITooltip::Draw() { if ( mVisible && 0.f != mAlpha ) { - cUIControlAnim::Draw(); + UIControlAnim::Draw(); if ( mTextCache->GetTextWidth() ) { mTextCache->Flags( Flags() ); @@ -102,11 +102,11 @@ void cUITooltip::Draw() { } } -Graphics::Font * cUITooltip::Font() const { +Graphics::Font * UITooltip::Font() const { return mTextCache->Font(); } -void cUITooltip::Font( Graphics::Font * font ) { +void UITooltip::Font( Graphics::Font * font ) { if ( mTextCache->Font() != font ) { mTextCache->Font( font ); AutoPadding(); @@ -116,11 +116,11 @@ void cUITooltip::Font( Graphics::Font * font ) { } } -const String& cUITooltip::Text() { +const String& UITooltip::Text() { return mTextCache->Text(); } -void cUITooltip::Text( const String& text ) { +void UITooltip::Text( const String& text ) { mTextCache->Text( text ); AutoPadding(); AutoSize(); @@ -128,41 +128,41 @@ void cUITooltip::Text( const String& text ) { OnTextChanged(); } -const ColorA& cUITooltip::Color() const { +const ColorA& UITooltip::Color() const { return mFontColor; } -void cUITooltip::Color( const ColorA& color ) { +void UITooltip::Color( const ColorA& color ) { mFontColor = color; Alpha( color.A() ); } -const ColorA& cUITooltip::ShadowColor() const { +const ColorA& UITooltip::ShadowColor() const { return mFontShadowColor; } -void cUITooltip::ShadowColor( const ColorA& color ) { +void UITooltip::ShadowColor( const ColorA& color ) { mFontShadowColor = color; Alpha( color.A() ); mTextCache->ShadowColor( mFontColor ); } -void cUITooltip::Alpha( const Float& alpha ) { - cUIControlAnim::Alpha( alpha ); +void UITooltip::Alpha( const Float& alpha ) { + UIControlAnim::Alpha( alpha ); mFontColor.Alpha = (Uint8)alpha; mFontShadowColor.Alpha = (Uint8)alpha; mTextCache->Color( mFontColor ); } -void cUITooltip::AutoSize() { +void UITooltip::AutoSize() { if ( mFlags & UI_AUTO_SIZE ) { mSize.Width( (int)mTextCache->GetTextWidth() + mPadding.Left + mPadding.Right ); mSize.Height( (int)mTextCache->GetTextHeight() + mPadding.Top + mPadding.Bottom ); } } -void cUITooltip::AutoAlign() { +void UITooltip::AutoAlign() { Uint32 Width = mSize.Width() - mPadding.Left - mPadding.Right; Uint32 Height = mSize.Height() - mPadding.Top - mPadding.Bottom; @@ -191,61 +191,61 @@ void cUITooltip::AutoAlign() { } } -void cUITooltip::OnSizeChange() { +void UITooltip::OnSizeChange() { AutoPadding(); AutoSize(); AutoAlign(); - cUIControlAnim::OnSizeChange(); + UIControlAnim::OnSizeChange(); mTextCache->Cache(); } -void cUITooltip::OnTextChanged() { - SendCommonEvent( cUIEvent::EventOnTextChanged ); +void UITooltip::OnTextChanged() { + SendCommonEvent( UIEvent::EventOnTextChanged ); } -void cUITooltip::OnFontChanged() { - SendCommonEvent( cUIEvent::EventOnFontChanged ); +void UITooltip::OnFontChanged() { + SendCommonEvent( UIEvent::EventOnFontChanged ); } -void cUITooltip::Padding( const Recti& padding ) { +void UITooltip::Padding( const Recti& padding ) { mPadding = padding; } -const Recti& cUITooltip::Padding() const { +const Recti& UITooltip::Padding() const { return mPadding; } -TextCache * cUITooltip::GetTextCache() { +TextCache * UITooltip::GetTextCache() { return mTextCache; } -Float cUITooltip::GetTextWidth() { +Float UITooltip::GetTextWidth() { return mTextCache->GetTextWidth(); } -Float cUITooltip::GetTextHeight() { +Float UITooltip::GetTextHeight() { return mTextCache->GetTextHeight(); } -const int& cUITooltip::GetNumLines() const { +const int& UITooltip::GetNumLines() const { return mTextCache->GetNumLines(); } -const Vector2f& cUITooltip::AlignOffset() const { +const Vector2f& UITooltip::AlignOffset() const { return mAlignOffset; } -void cUITooltip::TooltipTime( const Time& Time ) { +void UITooltip::TooltipTime( const Time& Time ) { mTooltipTime = Time; } -void cUITooltip::TooltipTimeAdd( const Time& Time ) { +void UITooltip::TooltipTimeAdd( const Time& Time ) { mTooltipTime += Time; } -const Time& cUITooltip::TooltipTime() const { +const Time& UITooltip::TooltipTime() const { return mTooltipTime; } diff --git a/src/eepp/ui/cuiwindow.cpp b/src/eepp/ui/uiwindow.cpp similarity index 72% rename from src/eepp/ui/cuiwindow.cpp rename to src/eepp/ui/uiwindow.cpp index 10987a639..b0592a60e 100644 --- a/src/eepp/ui/cuiwindow.cpp +++ b/src/eepp/ui/uiwindow.cpp @@ -1,11 +1,11 @@ -#include -#include +#include +#include #include namespace EE { namespace UI { -cUIWindow::cUIWindow( const cUIWindow::CreateParams& Params ) : - cUIComplexControl( Params ), +UIWindow::UIWindow( const UIWindow::CreateParams& Params ) : + UIComplexControl( Params ), mWinFlags( Params.WinFlags ), mWindowDecoration( NULL ), mButtonClose( NULL ), @@ -25,71 +25,71 @@ cUIWindow::cUIWindow( const cUIWindow::CreateParams& Params ) : mDecoAutoSize( Params.DecorationAutoSize ), mBorderAutoSize( Params.BorderAutoSize ) { - cUIManager::instance()->WindowAdd( this ); + UIManager::instance()->WindowAdd( this ); - cUIComplexControl::CreateParams tcParams; + UIComplexControl::CreateParams tcParams; tcParams.Parent( this ); tcParams.Flags |= UI_REPORT_SIZE_CHANGE_TO_CHILDS; - mContainer = eeNew( cUIComplexControl, ( tcParams ) ); + mContainer = eeNew( UIComplexControl, ( tcParams ) ); mContainer->Enabled( true ); mContainer->Visible( true ); mContainer->Size( mSize ); - mContainer->AddEventListener( cUIEvent::EventOnPosChange, cb::Make1( this, &cUIWindow::ContainerPosChange ) ); + mContainer->AddEventListener( UIEvent::EventOnPosChange, cb::Make1( this, &UIWindow::ContainerPosChange ) ); if ( !( mWinFlags & UI_WIN_NO_BORDER ) ) { - cUIControlAnim::CreateParams tParams; + UIControlAnim::CreateParams tParams; tParams.Parent( this ); - mWindowDecoration = eeNew( cUIControlAnim, ( tParams ) ); + mWindowDecoration = eeNew( UIControlAnim, ( tParams ) ); mWindowDecoration->Visible( true ); mWindowDecoration->Enabled( false ); - mBorderLeft = eeNew( cUIControlAnim, ( tParams ) ); + mBorderLeft = eeNew( UIControlAnim, ( tParams ) ); mBorderLeft->Enabled( true ); mBorderLeft->Visible( true ); - mBorderRight = eeNew( cUIControlAnim, ( tParams ) ); + mBorderRight = eeNew( UIControlAnim, ( tParams ) ); mBorderRight->Enabled( true ); mBorderRight->Visible( true ); - mBorderBottom = eeNew( cUIControlAnim, ( tParams ) ); + mBorderBottom = eeNew( UIControlAnim, ( tParams ) ); mBorderBottom->Enabled( true ); mBorderBottom->Visible( true ); if ( mWinFlags & UI_WIN_DRAGABLE_CONTAINER ) mContainer->DragEnable( true ); - cUIComplexControl::CreateParams ButtonParams; + UIComplexControl::CreateParams ButtonParams; ButtonParams.Parent( this ); if ( mWinFlags & UI_WIN_CLOSE_BUTTON ) { - mButtonClose = eeNew( cUIComplexControl, ( ButtonParams ) ); + mButtonClose = eeNew( UIComplexControl, ( ButtonParams ) ); mButtonClose->Visible( true ); mButtonClose->Enabled( true ); if ( mWinFlags & UI_WIN_USE_DEFAULT_BUTTONS_ACTIONS ) { - mButtonClose->AddEventListener( cUIEvent::EventMouseClick, cb::Make1( this, &cUIWindow::ButtonCloseClick ) ); + mButtonClose->AddEventListener( UIEvent::EventMouseClick, cb::Make1( this, &UIWindow::ButtonCloseClick ) ); } } if ( ( mWinFlags & UI_WIN_RESIZEABLE ) && ( mWinFlags & UI_WIN_MAXIMIZE_BUTTON ) ) { - mButtonMaximize = eeNew( cUIComplexControl, ( ButtonParams ) ); + mButtonMaximize = eeNew( UIComplexControl, ( ButtonParams ) ); mButtonMaximize->Visible( true ); mButtonMaximize->Enabled( true ); if ( mWinFlags & UI_WIN_USE_DEFAULT_BUTTONS_ACTIONS ) { - mButtonMaximize->AddEventListener( cUIEvent::EventMouseClick, cb::Make1( this, &cUIWindow::ButtonMaximizeClick ) ); + mButtonMaximize->AddEventListener( UIEvent::EventMouseClick, cb::Make1( this, &UIWindow::ButtonMaximizeClick ) ); } } if ( mWinFlags & UI_WIN_MINIMIZE_BUTTON ) { - mButtonMinimize = eeNew( cUIComplexControl, ( ButtonParams ) ); + mButtonMinimize = eeNew( UIComplexControl, ( ButtonParams ) ); mButtonMinimize->Visible( true ); mButtonMinimize->Enabled( true ); if ( mWinFlags & UI_WIN_USE_DEFAULT_BUTTONS_ACTIONS ) { - mButtonMinimize->AddEventListener( cUIEvent::EventMouseClick, cb::Make1( this, &cUIWindow::ButtonMinimizeClick ) ); + mButtonMinimize->AddEventListener( UIEvent::EventMouseClick, cb::Make1( this, &UIWindow::ButtonMinimizeClick ) ); } } @@ -105,19 +105,19 @@ cUIWindow::cUIWindow( const cUIWindow::CreateParams& Params ) : ApplyDefaultTheme(); } -cUIWindow::~cUIWindow() { - cUIManager::instance()->WindowRemove( this ); +UIWindow::~UIWindow() { + UIManager::instance()->WindowRemove( this ); - cUIManager::instance()->SetFocusLastWindow( this ); + UIManager::instance()->SetFocusLastWindow( this ); - SendCommonEvent( cUIEvent::EventOnWindowClose ); + SendCommonEvent( UIEvent::EventOnWindowClose ); } -void cUIWindow::CreateModalControl() { - cUIControl * Ctrl = cUIManager::instance()->MainControl(); +void UIWindow::CreateModalControl() { + UIControl * Ctrl = UIManager::instance()->MainControl(); if ( NULL == mModalCtrl ) { - mModalCtrl = eeNew( cUIControlAnim, ( cUIControlAnim::CreateParams( Ctrl , Vector2i(0,0), Ctrl->Size(), UI_ANCHOR_LEFT | UI_ANCHOR_TOP | UI_ANCHOR_RIGHT | UI_ANCHOR_BOTTOM ) ) ); + mModalCtrl = eeNew( UIControlAnim, ( UIControlAnim::CreateParams( Ctrl , Vector2i(0,0), Ctrl->Size(), UI_ANCHOR_LEFT | UI_ANCHOR_TOP | UI_ANCHOR_RIGHT | UI_ANCHOR_BOTTOM ) ) ); } else { mModalCtrl->Pos( 0, 0 ); mModalCtrl->Size( Ctrl->Size() ); @@ -126,9 +126,9 @@ void cUIWindow::CreateModalControl() { DisableByModal(); } -void cUIWindow::EnableByModal() { +void UIWindow::EnableByModal() { if ( IsModal() ) { - cUIControl * CtrlChild = cUIManager::instance()->MainControl()->ChildGetFirst(); + UIControl * CtrlChild = UIManager::instance()->MainControl()->ChildGetFirst(); while ( NULL != CtrlChild ) { @@ -145,9 +145,9 @@ void cUIWindow::EnableByModal() { } } -void cUIWindow::DisableByModal() { +void UIWindow::DisableByModal() { if ( IsModal() ) { - cUIControl * CtrlChild = cUIManager::instance()->MainControl()->ChildGetFirst(); + UIControl * CtrlChild = UIManager::instance()->MainControl()->ChildGetFirst(); while ( NULL != CtrlChild ) { @@ -164,15 +164,15 @@ void cUIWindow::DisableByModal() { } } -Uint32 cUIWindow::Type() const { +Uint32 UIWindow::Type() const { return UI_TYPE_WINDOW; } -bool cUIWindow::IsType( const Uint32& type ) const { - return cUIWindow::Type() == type ? true : cUIComplexControl::IsType( type ); +bool UIWindow::IsType( const Uint32& type ) const { + return UIWindow::Type() == type ? true : UIComplexControl::IsType( type ); } -void cUIWindow::ContainerPosChange( const cUIEvent * Event ) { +void UIWindow::ContainerPosChange( const UIEvent * Event ) { Vector2i PosDiff = mContainer->Pos() - Vector2i( mBorderLeft->Size().Width(), mWindowDecoration->Size().Height() ); if ( PosDiff.x != 0 || PosDiff.y != 0 ) { @@ -182,13 +182,13 @@ void cUIWindow::ContainerPosChange( const cUIEvent * Event ) { } } -void cUIWindow::ButtonCloseClick( const cUIEvent * Event ) { +void UIWindow::ButtonCloseClick( const UIEvent * Event ) { CloseWindow(); - SendCommonEvent( cUIEvent::EventOnWindowCloseClick ); + SendCommonEvent( UIEvent::EventOnWindowCloseClick ); } -void cUIWindow::CloseWindow() { +void UIWindow::CloseWindow() { if ( NULL != mButtonClose ) mButtonClose->Enabled( false ); @@ -203,32 +203,32 @@ void cUIWindow::CloseWindow() { mModalCtrl = NULL; } - if ( Time::Zero != cUIThemeManager::instance()->ControlsFadeOutTime() ) - CloseFadeOut( cUIThemeManager::instance()->ControlsFadeOutTime() ); + if ( Time::Zero != UIThemeManager::instance()->ControlsFadeOutTime() ) + CloseFadeOut( UIThemeManager::instance()->ControlsFadeOutTime() ); else Close(); } -void cUIWindow::Close() { - cUIComplexControl::Close(); +void UIWindow::Close() { + UIComplexControl::Close(); EnableByModal(); } -void cUIWindow::ButtonMaximizeClick( const cUIEvent * Event ) { +void UIWindow::ButtonMaximizeClick( const UIEvent * Event ) { Maximize(); - SendCommonEvent( cUIEvent::EventOnWindowMaximizeClick ); + SendCommonEvent( UIEvent::EventOnWindowMaximizeClick ); } -void cUIWindow::ButtonMinimizeClick( const cUIEvent * Event ) { +void UIWindow::ButtonMinimizeClick( const UIEvent * Event ) { Hide(); - SendCommonEvent( cUIEvent::EventOnWindowMinimizeClick ); + SendCommonEvent( UIEvent::EventOnWindowMinimizeClick ); } -void cUIWindow::SetTheme( cUITheme *Theme ) { - cUIComplexControl::SetTheme( Theme ); +void UIWindow::SetTheme( UITheme *Theme ) { + UIComplexControl::SetTheme( Theme ); mContainer->SetThemeControl ( Theme, "winback" ); @@ -258,7 +258,7 @@ void cUIWindow::SetTheme( cUITheme *Theme ) { } } -void cUIWindow::GetMinWinSize() { +void UIWindow::GetMinWinSize() { if ( NULL == mWindowDecoration || ( mMinWindowSize.x != 0 && mMinWindowSize.y != 0 ) ) return; @@ -283,7 +283,7 @@ void cUIWindow::GetMinWinSize() { mMinWindowSize.y = tSize.y; } -void cUIWindow::OnSizeChange() { +void UIWindow::OnSizeChange() { if ( mSize.x < mMinWindowSize.x || mSize.y < mMinWindowSize.y ) { if ( mSize.x < mMinWindowSize.x && mSize.y < mMinWindowSize.y ) { Size( mMinWindowSize ); @@ -295,32 +295,32 @@ void cUIWindow::OnSizeChange() { } else { FixChildsSize(); - cUIComplexControl::OnSizeChange(); + UIComplexControl::OnSizeChange(); } } -void cUIWindow::Size( const Sizei& Size ) { +void UIWindow::Size( const Sizei& Size ) { if ( NULL != mWindowDecoration ) { Sizei size = Size; size.x += mBorderLeft->Size().Width() + mBorderRight->Size().Width(); size.y += mWindowDecoration->Size().Height() + mBorderBottom->Size().Height(); - cUIComplexControl::Size( size ); + UIComplexControl::Size( size ); } else { - cUIComplexControl::Size( Size ); + UIComplexControl::Size( Size ); } } -void cUIWindow::Size( const Int32& Width, const Int32& Height ) { +void UIWindow::Size( const Int32& Width, const Int32& Height ) { Size( Sizei( Width, Height ) ); } -const Sizei& cUIWindow::Size() { - return cUIComplexControl::Size(); +const Sizei& UIWindow::Size() { + return UIComplexControl::Size(); } -void cUIWindow::FixChildsSize() { +void UIWindow::FixChildsSize() { if ( NULL == mWindowDecoration ) { mContainer->Size( mSize.Width(), mSize.Height() ); return; @@ -390,62 +390,62 @@ void cUIWindow::FixChildsSize() { FixTitleSize(); } -Uint32 cUIWindow::OnMessage( const cUIMessage * Msg ) { +Uint32 UIWindow::OnMessage( const UIMessage * Msg ) { switch ( Msg->Msg() ) { - case cUIMessage::MsgFocus: + case UIMessage::MsgFocus: { ToFront(); break; } - case cUIMessage::MsgMouseDown: + case UIMessage::MsgMouseDown: { DoResize( Msg ); break; } - case cUIMessage::MsgWindowResize: + case UIMessage::MsgWindowResize: { if ( IsModal() && NULL != mModalCtrl ) { - mModalCtrl->Size( cUIManager::instance()->MainControl()->Size() ); + mModalCtrl->Size( UIManager::instance()->MainControl()->Size() ); } break; } - case cUIMessage::MsgMouseExit: + case UIMessage::MsgMouseExit: { - cUIManager::instance()->SetCursor( EE_CURSOR_ARROW ); + UIManager::instance()->SetCursor( EE_CURSOR_ARROW ); break; } - case cUIMessage::MsgDragStart: + case UIMessage::MsgDragStart: { - cUIManager::instance()->SetCursor( EE_CURSOR_HAND ); + UIManager::instance()->SetCursor( EE_CURSOR_HAND ); break; } - case cUIMessage::MsgDragEnd: + case UIMessage::MsgDragEnd: { - cUIManager::instance()->SetCursor( EE_CURSOR_ARROW ); + UIManager::instance()->SetCursor( EE_CURSOR_ARROW ); break; } } - return cUIComplexControl::OnMessage( Msg ); + return UIComplexControl::OnMessage( Msg ); } -void cUIWindow::DoResize ( const cUIMessage * Msg ) { +void UIWindow::DoResize ( const UIMessage * Msg ) { if ( NULL == mWindowDecoration ) return; if ( !( mWinFlags & UI_WIN_RESIZEABLE ) || !( Msg->Flags() & EE_BUTTON_LMASK ) || RESIZE_NONE != mResizeType || - ( cUIManager::instance()->LastPressTrigger() & EE_BUTTON_LMASK ) + ( UIManager::instance()->LastPressTrigger() & EE_BUTTON_LMASK ) ) return; DecideResizeType( Msg->Sender() ); } -void cUIWindow::DecideResizeType( cUIControl * Control ) { - Vector2i Pos = cUIManager::instance()->GetMousePos(); +void UIWindow::DecideResizeType( UIControl * Control ) { + Vector2i Pos = UIManager::instance()->GetMousePos(); WorldToControl( Pos ); @@ -486,13 +486,13 @@ void cUIWindow::DecideResizeType( cUIControl * Control ) { } } -void cUIWindow::TryResize( const UI_RESIZE_TYPE& Type ) { +void UIWindow::TryResize( const UI_RESIZE_TYPE& Type ) { if ( RESIZE_NONE != mResizeType ) return; DragEnable( false ); - Vector2i Pos = cUIManager::instance()->GetMousePos(); + Vector2i Pos = UIManager::instance()->GetMousePos(); WorldToControl( Pos ); @@ -550,21 +550,21 @@ void cUIWindow::TryResize( const UI_RESIZE_TYPE& Type ) { } } -void cUIWindow::EndResize() { +void UIWindow::EndResize() { mResizeType = RESIZE_NONE; } -void cUIWindow::UpdateResize() { +void UIWindow::UpdateResize() { if ( RESIZE_NONE == mResizeType ) return; - if ( !( cUIManager::instance()->PressTrigger() & EE_BUTTON_LMASK ) ) { + if ( !( UIManager::instance()->PressTrigger() & EE_BUTTON_LMASK ) ) { EndResize(); DragEnable( true ); return; } - Vector2i Pos = cUIManager::instance()->GetMousePos(); + Vector2i Pos = UIManager::instance()->GetMousePos(); WorldToControl( Pos ); @@ -582,14 +582,14 @@ void cUIWindow::UpdateResize() { case RESIZE_LEFT: { Pos.x -= mResizePos.x; - cUIControl::Pos( mPos.x + Pos.x, mPos.y ); + UIControl::Pos( mPos.x + Pos.x, mPos.y ); InternalSize( mSize.Width() - Pos.x, mSize.Height() ); break; } case RESIZE_TOP: { Pos.y -= mResizePos.y; - cUIControl::Pos( mPos.x, mPos.y + Pos.y ); + UIControl::Pos( mPos.x, mPos.y + Pos.y ); InternalSize( mSize.Width(), mSize.Height() - Pos.y ); break; } @@ -602,7 +602,7 @@ void cUIWindow::UpdateResize() { case RESIZE_TOPLEFT: { Pos -= mResizePos; - cUIControl::Pos( mPos.x + Pos.x, mPos.y + Pos.y ); + UIControl::Pos( mPos.x + Pos.x, mPos.y + Pos.y ); InternalSize( mSize.Width() - Pos.x, mSize.Height() - Pos.y ); break; } @@ -610,7 +610,7 @@ void cUIWindow::UpdateResize() { { Pos.y -= mResizePos.y; Pos.x += mResizePos.x; - cUIControl::Pos( mPos.x, mPos.y + Pos.y ); + UIControl::Pos( mPos.x, mPos.y + Pos.y ); InternalSize( Pos.x, mSize.Height() - Pos.y ); break; } @@ -618,7 +618,7 @@ void cUIWindow::UpdateResize() { { Pos.x -= mResizePos.x; Pos.y += mResizePos.y; - cUIControl::Pos( mPos.x + Pos.x, mPos.y ); + UIControl::Pos( mPos.x + Pos.x, mPos.y ); InternalSize( mSize.Width() - Pos.x, Pos.y ); break; } @@ -628,11 +628,11 @@ void cUIWindow::UpdateResize() { } } -void cUIWindow::InternalSize( const Int32& w, const Int32& h ) { +void UIWindow::InternalSize( const Int32& w, const Int32& h ) { InternalSize( Sizei( w, h ) ); } -void cUIWindow::InternalSize( Sizei Size ) { +void UIWindow::InternalSize( Sizei Size ) { if ( Size.x < mMinWindowSize.x || Size.y < mMinWindowSize.y ) { if ( Size.x < mMinWindowSize.x && Size.y < mMinWindowSize.y ) { Size = mMinWindowSize; @@ -649,8 +649,8 @@ void cUIWindow::InternalSize( Sizei Size ) { } } -void cUIWindow::Draw() { - cUIComplexControl::Draw(); +void UIWindow::Draw() { + UIComplexControl::Draw(); if ( mWinFlags & UI_WIN_DRAW_SHADOW ) { Primitives P; @@ -684,31 +684,31 @@ void cUIWindow::Draw() { } } -void cUIWindow::Update() { +void UIWindow::Update() { ResizeCursor(); - cUIComplexControl::Update(); + UIComplexControl::Update(); UpdateResize(); } -cUIControlAnim * cUIWindow::Container() const { +UIControlAnim * UIWindow::Container() const { return mContainer; } -cUIComplexControl * cUIWindow::ButtonClose() const { +UIComplexControl * UIWindow::ButtonClose() const { return mButtonClose; } -cUIComplexControl * cUIWindow::ButtonMaximize() const { +UIComplexControl * UIWindow::ButtonMaximize() const { return mButtonMaximize; } -cUIComplexControl * cUIWindow::ButtonMinimize() const { +UIComplexControl * UIWindow::ButtonMinimize() const { return mButtonMinimize; } -bool cUIWindow::Show() { +bool UIWindow::Show() { if ( !Visible() ) { Enabled( true ); Visible( true ); @@ -716,9 +716,9 @@ bool cUIWindow::Show() { SetFocus(); if ( mBaseAlpha == Alpha() ) { - StartAlphaAnim( 0.f, mBaseAlpha, cUIThemeManager::instance()->ControlsFadeInTime() ); + StartAlphaAnim( 0.f, mBaseAlpha, UIThemeManager::instance()->ControlsFadeInTime() ); } else { - StartAlphaAnim( mAlpha, mBaseAlpha, cUIThemeManager::instance()->ControlsFadeInTime() ); + StartAlphaAnim( mAlpha, mBaseAlpha, UIThemeManager::instance()->ControlsFadeInTime() ); } if ( IsModal() ) { @@ -737,16 +737,16 @@ bool cUIWindow::Show() { return false; } -bool cUIWindow::Hide() { +bool UIWindow::Hide() { if ( Visible() ) { - if ( cUIThemeManager::instance()->DefaultEffectsEnabled() ) { - DisableFadeOut( cUIThemeManager::instance()->ControlsFadeOutTime() ); + if ( UIThemeManager::instance()->DefaultEffectsEnabled() ) { + DisableFadeOut( UIThemeManager::instance()->ControlsFadeOutTime() ); } else { Enabled( false ); Visible( false ); } - cUIManager::instance()->MainControl()->SetFocus(); + UIManager::instance()->MainControl()->SetFocus(); if ( NULL != mModalCtrl ) { mModalCtrl->Enabled( false ); @@ -759,14 +759,14 @@ bool cUIWindow::Hide() { return false; } -void cUIWindow::OnAlphaChange() { +void UIWindow::OnAlphaChange() { if ( mWinFlags & UI_WIN_SHARE_ALPHA_WITH_CHILDS ) { - cUIControlAnim * AnimChild; - cUIControl * CurChild = mChild; + UIControlAnim * AnimChild; + UIControl * CurChild = mChild; while ( NULL != CurChild ) { if ( CurChild->IsAnimated() ) { - AnimChild = reinterpret_cast ( CurChild ); + AnimChild = reinterpret_cast ( CurChild ); AnimChild->Alpha( mAlpha ); } @@ -774,24 +774,24 @@ void cUIWindow::OnAlphaChange() { } } - cUIComplexControl::OnAlphaChange(); + UIComplexControl::OnAlphaChange(); } -void cUIWindow::BaseAlpha( const Uint8& Alpha ) { +void UIWindow::BaseAlpha( const Uint8& Alpha ) { if ( mAlpha == mBaseAlpha ) { - cUIControlAnim::Alpha( Alpha ); + UIControlAnim::Alpha( Alpha ); } mBaseAlpha = Alpha; } -const Uint8& cUIWindow::BaseAlpha() const { +const Uint8& UIWindow::BaseAlpha() const { return mBaseAlpha; } -void cUIWindow::Title( const String& Text ) { +void UIWindow::Title( const String& Text ) { if ( NULL == mTitle ) { - cUITextBox::CreateParams Params; + UITextBox::CreateParams Params; Params.Parent( this ); Params.Flags = UI_CLIP_ENABLE | UI_VALIGN_CENTER; Params.FontColor = mTitleFontColor; @@ -802,7 +802,7 @@ void cUIWindow::Title( const String& Text ) { if ( mFlags & UI_DRAW_SHADOW ) Params.Flags |= UI_DRAW_SHADOW; - mTitle = eeNew( cUITextBox, ( Params ) ); + mTitle = eeNew( UITextBox, ( Params ) ); mTitle->Enabled( false ); mTitle->Visible( true ); } @@ -812,26 +812,26 @@ void cUIWindow::Title( const String& Text ) { FixTitleSize(); } -void cUIWindow::FixTitleSize() { +void UIWindow::FixTitleSize() { if ( NULL != mWindowDecoration && NULL != mTitle ) { mTitle->Size( mWindowDecoration->Size().Width() - mBorderLeft->Size().Width() - mBorderRight->Size().Width(), mWindowDecoration->Size().Height() ); mTitle->Pos( mBorderLeft->Size().Width(), 0 ); } } -String cUIWindow::Title() const { +String UIWindow::Title() const { if ( NULL != mTitle ) return mTitle->Text(); return String(); } -cUITextBox * cUIWindow::TitleTextBox() const { +UITextBox * UIWindow::TitleTextBox() const { return mTitle; } -void cUIWindow::Maximize() { - cUIControl * Ctrl = cUIManager::instance()->MainControl(); +void UIWindow::Maximize() { + UIControl * Ctrl = UIManager::instance()->MainControl(); if ( Ctrl->Size() == mSize ) { Pos( mNonMaxPos ); @@ -841,11 +841,11 @@ void cUIWindow::Maximize() { mNonMaxSize = mSize; Pos( 0, 0 ); - InternalSize( cUIManager::instance()->MainControl()->Size() ); + InternalSize( UIManager::instance()->MainControl()->Size() ); } } -Uint32 cUIWindow::OnMouseDoubleClick( const Vector2i &Pos, const Uint32 Flags ) { +Uint32 UIWindow::OnMouseDoubleClick( const Vector2i &Pos, const Uint32 Flags ) { if ( ( mWinFlags & UI_WIN_RESIZEABLE ) && ( NULL != mButtonMaximize ) && ( Flags & EE_BUTTON_LMASK ) ) { ButtonMaximizeClick( NULL ); } @@ -853,24 +853,24 @@ Uint32 cUIWindow::OnMouseDoubleClick( const Vector2i &Pos, const Uint32 Flags ) return 1; } -Uint32 cUIWindow::OnKeyDown( const cUIEventKey &Event ) { +Uint32 UIWindow::OnKeyDown( const UIEventKey &Event ) { CheckShortcuts( Event.KeyCode(), Event.Mod() ); - return cUIComplexControl::OnKeyDown( Event ); + return UIComplexControl::OnKeyDown( Event ); } -void cUIWindow::CheckShortcuts( const Uint32& KeyCode, const Uint32& Mod ) { +void UIWindow::CheckShortcuts( const Uint32& KeyCode, const Uint32& Mod ) { for ( KeyboardShortcuts::iterator it = mKbShortcuts.begin(); it != mKbShortcuts.end(); it++ ) { KeyboardShortcut kb = (*it); if ( KeyCode == kb.KeyCode && ( Mod & kb.Mod ) ) { - cUIManager::instance()->SendMouseUp( kb.Button, Vector2i(0,0), EE_BUTTON_LMASK ); - cUIManager::instance()->SendMouseClick( kb.Button, Vector2i(0,0), EE_BUTTON_LMASK ); + UIManager::instance()->SendMouseUp( kb.Button, Vector2i(0,0), EE_BUTTON_LMASK ); + UIManager::instance()->SendMouseClick( kb.Button, Vector2i(0,0), EE_BUTTON_LMASK ); } } } -cUIWindow::KeyboardShortcuts::iterator cUIWindow::ExistsShortcut( const Uint32& KeyCode, const Uint32& Mod ) { +UIWindow::KeyboardShortcuts::iterator UIWindow::ExistsShortcut( const Uint32& KeyCode, const Uint32& Mod ) { for ( KeyboardShortcuts::iterator it = mKbShortcuts.begin(); it != mKbShortcuts.end(); it++ ) { if ( (*it).KeyCode == KeyCode && (*it).Mod == Mod ) return it; @@ -879,7 +879,7 @@ cUIWindow::KeyboardShortcuts::iterator cUIWindow::ExistsShortcut( const Uint32& return mKbShortcuts.end(); } -bool cUIWindow::AddShortcut( const Uint32& KeyCode, const Uint32& Mod, cUIPushButton * Button ) { +bool UIWindow::AddShortcut( const Uint32& KeyCode, const Uint32& Mod, UIPushButton * Button ) { if ( InParentTreeOf( Button ) && mKbShortcuts.end() == ExistsShortcut( KeyCode, Mod ) ) { mKbShortcuts.push_back( KeyboardShortcut( KeyCode, Mod, Button ) ); @@ -889,7 +889,7 @@ bool cUIWindow::AddShortcut( const Uint32& KeyCode, const Uint32& Mod, cUIPushBu return false; } -bool cUIWindow::RemoveShortcut( const Uint32& KeyCode, const Uint32& Mod ) { +bool UIWindow::RemoveShortcut( const Uint32& KeyCode, const Uint32& Mod ) { KeyboardShortcuts::iterator it = ExistsShortcut( KeyCode, Mod ); if ( mKbShortcuts.end() != it ) { @@ -901,20 +901,20 @@ bool cUIWindow::RemoveShortcut( const Uint32& KeyCode, const Uint32& Mod ) { return false; } -bool cUIWindow::IsMaximixable() { +bool UIWindow::IsMaximixable() { return 0 != ( ( mWinFlags & UI_WIN_RESIZEABLE ) && ( mWinFlags & UI_WIN_MAXIMIZE_BUTTON ) ); } -bool cUIWindow::IsModal() { +bool UIWindow::IsModal() { return 0 != ( mWinFlags & UI_WIN_MODAL ); } -cUIControlAnim * cUIWindow::GetModalControl() const { +UIControlAnim * UIWindow::GetModalControl() const { return mModalCtrl; } -void cUIWindow::ResizeCursor() { - cUIManager * Man = cUIManager::instance(); +void UIWindow::ResizeCursor() { + UIManager * Man = UIManager::instance(); if ( !IsMouseOverMeOrChilds() || !Man->UseGlobalCursors() || ( mWinFlags & UI_WIN_NO_BORDER ) || !( mWinFlags & UI_WIN_RESIZEABLE ) ) return; @@ -923,7 +923,7 @@ void cUIWindow::ResizeCursor() { WorldToControl( Pos ); - const cUIControl * Control = Man->OverControl(); + const UIControl * Control = Man->OverControl(); if ( Control == this ) { if ( Pos.x <= mBorderLeft->Size().Width() ) { @@ -938,7 +938,7 @@ void cUIWindow::ResizeCursor() { } else { Man->SetCursor( EE_CURSOR_SIZENS ); // RESIZE_TOP } - } else if ( !( cUIManager::instance()->PressTrigger() & EE_BUTTON_LMASK ) ) { + } else if ( !( UIManager::instance()->PressTrigger() & EE_BUTTON_LMASK ) ) { Man->SetCursor( EE_CURSOR_ARROW ); } } else if ( Control == mBorderBottom ) { diff --git a/src/eepp/ui/cuiwinmenu.cpp b/src/eepp/ui/uiwinmenu.cpp similarity index 64% rename from src/eepp/ui/cuiwinmenu.cpp rename to src/eepp/ui/uiwinmenu.cpp index 672f8fba5..46252238e 100644 --- a/src/eepp/ui/cuiwinmenu.cpp +++ b/src/eepp/ui/uiwinmenu.cpp @@ -1,11 +1,11 @@ -#include -#include +#include +#include #include namespace EE { namespace UI { -cUIWinMenu::cUIWinMenu( const cUIWinMenu::CreateParams& Params ) : - cUIComplexControl( Params ), +UIWinMenu::UIWinMenu( const UIWinMenu::CreateParams& Params ) : + UIComplexControl( Params ), mFont( Params.Font ), mFontColor( Params.FontColor ), mFontShadowColor( Params.FontShadowColor ), @@ -27,22 +27,22 @@ cUIWinMenu::cUIWinMenu( const cUIWinMenu::CreateParams& Params ) : ApplyDefaultTheme(); } -cUIWinMenu::~cUIWinMenu() { +UIWinMenu::~UIWinMenu() { DestroyMenues(); } -Uint32 cUIWinMenu::Type() const { +Uint32 UIWinMenu::Type() const { return UI_TYPE_WINMENU; } -bool cUIWinMenu::IsType( const Uint32& type ) const { - return cUIWinMenu::Type() == type ? true : cUIComplexControl::IsType( type ); +bool UIWinMenu::IsType( const Uint32& type ) const { + return UIWinMenu::Type() == type ? true : UIComplexControl::IsType( type ); } -void cUIWinMenu::AddMenuButton( const String& ButtonText, cUIPopUpMenu * Menu ) { +void UIWinMenu::AddMenuButton( const String& ButtonText, UIPopUpMenu * Menu ) { eeASSERT( NULL != Menu ); - cUISelectButton::CreateParams ButtonParams; + UISelectButton::CreateParams ButtonParams; ButtonParams.Parent( this ); ButtonParams.Flags = UI_HALIGN_CENTER | UI_VALIGN_CENTER; @@ -54,7 +54,7 @@ void cUIWinMenu::AddMenuButton( const String& ButtonText, cUIPopUpMenu * Menu ) ButtonParams.FontShadowColor = mFontShadowColor; ButtonParams.FontOverColor = mFontOverColor; - cUISelectButton * Button = eeNew( cUISelectButton, ( ButtonParams ) ); + UISelectButton * Button = eeNew( UISelectButton, ( ButtonParams ) ); Button->Text( ButtonText ); Button->Visible( true ); Button->Enabled( true ); @@ -63,22 +63,22 @@ void cUIWinMenu::AddMenuButton( const String& ButtonText, cUIPopUpMenu * Menu ) Menu->Visible( false ); Menu->Enabled( false ); Menu->Parent( Parent() ); - Menu->AddEventListener( cUIEvent::EventOnComplexControlFocusLoss, cb::Make1( this, &cUIWinMenu::OnMenuFocusLoss ) ); + Menu->AddEventListener( UIEvent::EventOnComplexControlFocusLoss, cb::Make1( this, &UIWinMenu::OnMenuFocusLoss ) ); mButtons.push_back( std::make_pair( Button, Menu ) ); RefreshButtons(); } -void cUIWinMenu::SetTheme( cUITheme * Theme ) { - cUIComplexControl::SetThemeControl( Theme, "winmenu" ); +void UIWinMenu::SetTheme( UITheme * Theme ) { + UIComplexControl::SetThemeControl( Theme, "winmenu" ); for ( WinMenuList::iterator it = mButtons.begin(); it != mButtons.end(); it++ ) { it->first->SetThemeControl( Theme, "winmenubutton" ); } - if ( 0 == mMenuHeight && NULL != GetSkin() && NULL != GetSkin()->GetSubTexture( cUISkinState::StateNormal ) ) { - mMenuHeight = GetSkin()->GetSubTexture( cUISkinState::StateNormal )->Size().Height(); + if ( 0 == mMenuHeight && NULL != GetSkin() && NULL != GetSkin()->GetSubTexture( UISkinState::StateNormal ) ) { + mMenuHeight = GetSkin()->GetSubTexture( UISkinState::StateNormal )->Size().Height(); Size( Parent()->Size().Width(), mMenuHeight ); @@ -86,7 +86,7 @@ void cUIWinMenu::SetTheme( cUITheme * Theme ) { } } -void cUIWinMenu::RemoveMenuButton( const String& ButtonText ) { +void UIWinMenu::RemoveMenuButton( const String& ButtonText ) { for ( WinMenuList::iterator it = mButtons.begin(); it != mButtons.end(); it++ ) { if ( it->first->Text() == ButtonText ) { it->second->Close(); @@ -98,7 +98,7 @@ void cUIWinMenu::RemoveMenuButton( const String& ButtonText ) { } } -cUISelectButton * cUIWinMenu::GetButton( const String& ButtonText ) { +UISelectButton * UIWinMenu::GetButton( const String& ButtonText ) { for ( WinMenuList::iterator it = mButtons.begin(); it != mButtons.end(); it++ ) { if ( it->first->Text() == ButtonText ) { return it->first; @@ -108,7 +108,7 @@ cUISelectButton * cUIWinMenu::GetButton( const String& ButtonText ) { return NULL; } -cUIPopUpMenu * cUIWinMenu::GetPopUpMenu( const String& ButtonText ) { +UIPopUpMenu * UIWinMenu::GetPopUpMenu( const String& ButtonText ) { for ( WinMenuList::iterator it = mButtons.begin(); it != mButtons.end(); it++ ) { if ( it->first->Text() == ButtonText ) { return it->second; @@ -118,21 +118,21 @@ cUIPopUpMenu * cUIWinMenu::GetPopUpMenu( const String& ButtonText ) { return NULL; } -void cUIWinMenu::RefreshButtons() { +void UIWinMenu::RefreshButtons() { Uint32 xpos = mFirstButtonMargin; Int32 h = 0, th = 0, ycenter = 0; if ( NULL != GetSkin() ) { - SubTexture * subTexture = GetSkin()->GetSubTexture( cUISkinState::StateNormal ); + SubTexture * subTexture = GetSkin()->GetSubTexture( UISkinState::StateNormal ); if ( NULL != subTexture ) { h = subTexture->Size().Height(); if ( mButtons.begin() != mButtons.end() ) { - cUISelectButton * tbut = mButtons.begin()->first; + UISelectButton * tbut = mButtons.begin()->first; if ( NULL != tbut->GetSkin() ) { - SubTexture * tSubTexture2 = tbut->GetSkin()->GetSubTexture( cUISkinState::StateSelected ); + SubTexture * tSubTexture2 = tbut->GetSkin()->GetSubTexture( UISkinState::StateSelected ); if ( NULL != tSubTexture2 ) { th = tSubTexture2->Size().Height(); @@ -155,8 +155,8 @@ void cUIWinMenu::RefreshButtons() { } for ( WinMenuList::iterator it = mButtons.begin(); it != mButtons.end(); it++ ) { - cUISelectButton * pbut = it->first; - cUITextBox * tbox = pbut->TextBox(); + UISelectButton * pbut = it->first; + UITextBox * tbox = pbut->TextBox(); pbut->Size( tbox->GetTextWidth() + mButtonMargin, Size().Height() ); pbut->Pos( xpos, ycenter ); @@ -165,19 +165,19 @@ void cUIWinMenu::RefreshButtons() { } } -Uint32 cUIWinMenu::OnMessage( const cUIMessage * Msg ) { +Uint32 UIWinMenu::OnMessage( const UIMessage * Msg ) { switch ( Msg->Msg() ) { - case cUIMessage::MsgMouseUp: - case cUIMessage::MsgMouseEnter: + case UIMessage::MsgMouseUp: + case UIMessage::MsgMouseEnter: { if ( Msg->Sender()->IsType( UI_TYPE_SELECTBUTTON ) ) { - cUISelectButton * tbut = reinterpret_cast ( Msg->Sender() ); - cUIPopUpMenu * tpop = GetMenuFromButton( tbut ); + UISelectButton * tbut = reinterpret_cast ( Msg->Sender() ); + UIPopUpMenu * tpop = GetMenuFromButton( tbut ); Vector2i pos( tbut->Pos().x, tbut->Pos().y + tbut->Size().Height() ); tpop->Pos( pos ); - if ( Msg->Msg() == cUIMessage::MsgMouseEnter ) { + if ( Msg->Msg() == UIMessage::MsgMouseEnter ) { if ( NULL != mCurrentMenu ) { mCurrentMenu = tpop; @@ -198,7 +198,7 @@ Uint32 cUIWinMenu::OnMessage( const cUIMessage * Msg ) { break; } - case cUIMessage::MsgSelected: + case UIMessage::MsgSelected: { for ( WinMenuList::iterator it = mButtons.begin(); it != mButtons.end(); it++ ) { if ( it->first != Msg->Sender() ) { @@ -208,9 +208,9 @@ Uint32 cUIWinMenu::OnMessage( const cUIMessage * Msg ) { return 1; } - case cUIMessage::MsgFocusLoss: + case UIMessage::MsgFocusLoss: { - cUIControl * FocusCtrl = cUIManager::instance()->FocusControl(); + UIControl * FocusCtrl = UIManager::instance()->FocusControl(); if ( !IsParentOf( FocusCtrl ) && !IsPopUpMenuChild( FocusCtrl ) ) { OnComplexControlFocusLoss(); @@ -223,13 +223,13 @@ Uint32 cUIWinMenu::OnMessage( const cUIMessage * Msg ) { return 0; } -void cUIWinMenu::UnselectButtons() { +void UIWinMenu::UnselectButtons() { for ( WinMenuList::iterator it = mButtons.begin(); it != mButtons.end(); it++ ) { it->first->Unselect(); } } -cUIPopUpMenu * cUIWinMenu::GetMenuFromButton( cUISelectButton * Button ) { +UIPopUpMenu * UIWinMenu::GetMenuFromButton( UISelectButton * Button ) { for ( WinMenuList::iterator it = mButtons.begin(); it != mButtons.end(); it++ ) { if ( it->first == Button ) { return it->second; @@ -239,7 +239,7 @@ cUIPopUpMenu * cUIWinMenu::GetMenuFromButton( cUISelectButton * Button ) { return NULL; } -bool cUIWinMenu::IsPopUpMenuChild( cUIControl * Ctrl ) { +bool UIWinMenu::IsPopUpMenuChild( UIControl * Ctrl ) { for ( WinMenuList::iterator it = mButtons.begin(); it != mButtons.end(); it++ ) { if ( it->second == Ctrl || it->second->IsParentOf( Ctrl ) ) { return true; @@ -249,16 +249,16 @@ bool cUIWinMenu::IsPopUpMenuChild( cUIControl * Ctrl ) { return false; } -void cUIWinMenu::OnMenuFocusLoss( const cUIEvent * Event ) { - cUIControl * FocusCtrl = cUIManager::instance()->FocusControl(); +void UIWinMenu::OnMenuFocusLoss( const UIEvent * Event ) { + UIControl * FocusCtrl = UIManager::instance()->FocusControl(); if ( !IsParentOf( FocusCtrl ) && !IsPopUpMenuChild( FocusCtrl ) ) { OnComplexControlFocusLoss(); } } -void cUIWinMenu::OnComplexControlFocusLoss() { - cUIComplexControl::OnComplexControlFocusLoss(); +void UIWinMenu::OnComplexControlFocusLoss() { + UIComplexControl::OnComplexControlFocusLoss(); if ( NULL != mCurrentMenu ) { mCurrentMenu->Hide(); @@ -270,36 +270,36 @@ void cUIWinMenu::OnComplexControlFocusLoss() { } -void cUIWinMenu::FontColor( const ColorA& Color ) { +void UIWinMenu::FontColor( const ColorA& Color ) { mFontColor = Color; } -const ColorA& cUIWinMenu::FontColor() const { +const ColorA& UIWinMenu::FontColor() const { return mFontColor; } -void cUIWinMenu::FontOverColor( const ColorA& Color ) { +void UIWinMenu::FontOverColor( const ColorA& Color ) { mFontOverColor = Color; } -const ColorA& cUIWinMenu::FontOverColor() const { +const ColorA& UIWinMenu::FontOverColor() const { return mFontOverColor; } -void cUIWinMenu::FontSelectedColor( const ColorA& Color ) { +void UIWinMenu::FontSelectedColor( const ColorA& Color ) { mFontSelectedColor = Color; } -const ColorA& cUIWinMenu::FontSelectedColor() const { +const ColorA& UIWinMenu::FontSelectedColor() const { return mFontSelectedColor; } -Graphics::Font * cUIWinMenu::Font() const { +Graphics::Font * UIWinMenu::Font() const { return mFont; } -void cUIWinMenu::DestroyMenues() { - if ( !cUIManager::instance()->IsShootingDown() ) { +void UIWinMenu::DestroyMenues() { + if ( !UIManager::instance()->IsShootingDown() ) { for ( WinMenuList::iterator it = mButtons.begin(); it != mButtons.end(); it++ ) { it->second->Close(); } diff --git a/src/eepp/window/engine.cpp b/src/eepp/window/engine.cpp index 2f6c028d4..9752efa82 100755 --- a/src/eepp/window/engine.cpp +++ b/src/eepp/window/engine.cpp @@ -8,7 +8,7 @@ #include #include #include -#include +#include #include #include #include @@ -63,7 +63,7 @@ Engine::~Engine() { FontManager::DestroySingleton(); - UI::cUIManager::DestroySingleton(); + UI::UIManager::DestroySingleton(); Graphics::cGL::DestroySingleton(); diff --git a/src/test/eetest.cpp b/src/test/eetest.cpp index bec849c17..2eccf12fe 100644 --- a/src/test/eetest.cpp +++ b/src/test/eetest.cpp @@ -215,15 +215,15 @@ void cEETest::CreateShaders() { } } -void cEETest::OnWinMouseUp( const cUIEvent * Event ) { - const cUIEventMouse * MEvent = reinterpret_cast ( Event ); +void cEETest::OnWinMouseUp( const UIEvent * Event ) { + const UIEventMouse * MEvent = reinterpret_cast ( Event ); - cUIControlAnim * CtrlAnim; + UIControlAnim * CtrlAnim; if ( Event->Ctrl()->IsType( UI_TYPE_WINDOW ) ) { - CtrlAnim = reinterpret_cast( Event->Ctrl() ); + CtrlAnim = reinterpret_cast( Event->Ctrl() ); } else { - CtrlAnim = reinterpret_cast( Event->Ctrl()->Parent() ); + CtrlAnim = reinterpret_cast( Event->Ctrl()->Parent() ); } if ( MEvent->Flags() & EE_BUTTON_WUMASK ) { @@ -233,12 +233,12 @@ void cEETest::OnWinMouseUp( const cUIEvent * Event ) { } } -void cEETest::OnShowMenu( const cUIEvent * Event ) { - cUIPushButton * PB = static_cast( Event->Ctrl() ); +void cEETest::OnShowMenu( const UIEvent * Event ) { + UIPushButton * PB = static_cast( Event->Ctrl() ); if ( Menu->Show() ) { Vector2i Pos = Vector2i( (Int32)PB->GetPolygon()[0].x, (Int32)PB->GetPolygon()[0].y - 2 ); - cUIMenu::FixMenuPos( Pos , Menu ); + UIMenu::FixMenuPos( Pos , Menu ); Menu->Pos( Pos ); } } @@ -254,39 +254,39 @@ void cEETest::CreateUI() { eePRINTL( "Texture Atlas Loading Time: %4.3f ms.", TE.Elapsed().AsMilliseconds() ); - cUIManager::instance()->Init(); //UI_MANAGER_HIGHLIGHT_FOCUS | UI_MANAGER_HIGHLIGHT_OVER + UIManager::instance()->Init(); //UI_MANAGER_HIGHLIGHT_FOCUS | UI_MANAGER_HIGHLIGHT_OVER - //mTheme = cUITheme::LoadFromPath( eeNew( cUIDefaultTheme, ( "uitheme", "uitheme" ) ), MyPath + "uitheme/" ); + //mTheme = UITheme::LoadFromPath( eeNew( UIDefaultTheme, ( "uitheme", "uitheme" ) ), MyPath + "uitheme/" ); TextureAtlasLoader tgl( MyPath + "ui/uitheme" + EE_TEXTURE_ATLAS_EXTENSION ); - mTheme = cUITheme::LoadFromTextureAtlas( eeNew( cUIDefaultTheme, ( "uitheme", "uitheme" ) ), TextureAtlasManager::instance()->GetByName( "uitheme" ) ); + mTheme = UITheme::LoadFromTextureAtlas( eeNew( UIDefaultTheme, ( "uitheme", "uitheme" ) ), TextureAtlasManager::instance()->GetByName( "uitheme" ) ); - cUIThemeManager::instance()->Add( mTheme ); - cUIThemeManager::instance()->DefaultEffectsEnabled( true ); - cUIThemeManager::instance()->DefaultFont( TTF ); - cUIThemeManager::instance()->DefaultTheme( "uitheme" ); + UIThemeManager::instance()->Add( mTheme ); + UIThemeManager::instance()->DefaultEffectsEnabled( true ); + UIThemeManager::instance()->DefaultFont( TTF ); + UIThemeManager::instance()->DefaultTheme( "uitheme" ); - cUIControl::CreateParams Params( cUIManager::instance()->MainControl(), Vector2i(0,0), Sizei( 530, 380 ), UI_FILL_BACKGROUND | UI_CLIP_ENABLE | UI_BORDER ); + UIControl::CreateParams Params( UIManager::instance()->MainControl(), Vector2i(0,0), Sizei( 530, 380 ), UI_FILL_BACKGROUND | UI_CLIP_ENABLE | UI_BORDER ); Params.Border.Width( 2 ); Params.Border.Color( 0x979797CC ); Params.Background.Colors( ColorA( 0xEDEDED66 ), ColorA( 0xEDEDEDCC ), ColorA( 0xEDEDEDCC ), ColorA( 0xEDEDED66 ) ); - cUIWindow * tWin = mTheme->CreateWindow( NULL, Sizei( 530, 405 ), Vector2i( 320, 240 ), UI_CONTROL_DEFAULT_FLAGS_CENTERED, UI_WIN_DRAGABLE_CONTAINER , Sizei( 530, 405 ), 200 ); + UIWindow * tWin = mTheme->CreateWindow( NULL, Sizei( 530, 405 ), Vector2i( 320, 240 ), UI_CONTROL_DEFAULT_FLAGS_CENTERED, UI_WIN_DRAGABLE_CONTAINER , Sizei( 530, 405 ), 200 ); C = tWin->Container(); tWin->Title( "Controls Test" ); - tWin->AddEventListener( cUIEvent::EventMouseUp, cb::Make1( this, &cEETest::OnWinMouseUp ) ); - C->AddEventListener( cUIEvent::EventMouseUp, cb::Make1( this, &cEETest::OnWinMouseUp ) ); + tWin->AddEventListener( UIEvent::EventMouseUp, cb::Make1( this, &cEETest::OnWinMouseUp ) ); + C->AddEventListener( UIEvent::EventMouseUp, cb::Make1( this, &cEETest::OnWinMouseUp ) ); Params.Flags &= ~UI_CLIP_ENABLE; Params.Background.Corners(0); Params.Background.Colors( ColorA( 0x00FF0077 ), ColorA( 0x00CC0077 ), ColorA( 0x00CC0077 ), ColorA( 0x00FF0077 ) ); Params.Parent( C ); Params.Size = Sizei( 50, 50 ); - cUITest * Child = eeNew( cUITest, ( Params ) ); + UITest * Child = eeNew( UITest, ( Params ) ); Child->Pos( 240, 130 ); Child->Visible( true ); Child->Enabled( true ); @@ -296,7 +296,7 @@ void cEETest::CreateUI() { Params.Background.Colors( ColorA( 0xFFFF0077 ), ColorA( 0xCCCC0077 ), ColorA( 0xCCCC0077 ), ColorA( 0xFFFF0077 ) ); Params.Parent( Child ); Params.Size = Sizei( 25, 25 ); - cUITest * Child2 = eeNew( cUITest, ( Params ) ); + UITest * Child2 = eeNew( UITest, ( Params ) ); Child2->Pos( 15, 15 ); Child2->Visible( true ); Child2->Enabled( true ); @@ -305,113 +305,113 @@ void cEETest::CreateUI() { mTheme->CreateSprite( eeNew( Sprite, ( "gn" ) ), C, Sizei(), Vector2i( 160, 100 ) ); - cUITextBox::CreateParams TextParams; + UITextBox::CreateParams TextParams; TextParams.Parent( C ); TextParams.PosSet( 0, 0 ); TextParams.Size = Sizei( 320, 240 ); TextParams.Flags = UI_VALIGN_TOP | UI_HALIGN_RIGHT; - cUITextBox * Text = eeNew( cUITextBox, ( TextParams ) ); + UITextBox * Text = eeNew( UITextBox, ( TextParams ) ); Text->Visible( true ); Text->Enabled( false ); Text->Text( "Turn around\nJust Turn Around\nAround!" ); - cUITextInput::CreateParams InputParams; + UITextInput::CreateParams InputParams; InputParams.Parent( C ); InputParams.PosSet( 20, 216 ); InputParams.Size = Sizei( 200, 22 ); InputParams.Flags = UI_VALIGN_CENTER | UI_HALIGN_LEFT | UI_CLIP_ENABLE | UI_AUTO_PADDING | UI_TEXT_SELECTION_ENABLED; - cUITextInput * Input = eeNew( cUITextInput, ( InputParams ) ); + UITextInput * Input = eeNew( UITextInput, ( InputParams ) ); Input->Visible( true ); Input->Enabled( true ); - cUIPushButton::CreateParams ButtonParams; + UIPushButton::CreateParams ButtonParams; ButtonParams.Parent( C ); ButtonParams.Flags = UI_VALIGN_CENTER | UI_HALIGN_CENTER | UI_AUTO_SIZE; ButtonParams.PosSet( 225, 216 ); ButtonParams.Size = Sizei( 90, 0 ); ButtonParams.SetIcon( mTheme->GetIconByName( "ok" ) ); - cUIPushButton * Button = eeNew( cUIPushButton, ( ButtonParams ) ); + UIPushButton * Button = eeNew( UIPushButton, ( ButtonParams ) ); Button->Visible( true ); Button->Enabled( true ); Button->Text( "Click Me" ); - Button->AddEventListener( cUIEvent::EventMouseClick, cb::Make1( this, &cEETest::ButtonClick ) ); + Button->AddEventListener( UIEvent::EventMouseClick, cb::Make1( this, &cEETest::ButtonClick ) ); Button->TooltipText( "Click and see what happens..." ); TextParams.PosSet( 130, 20 ); TextParams.Size = Sizei( 80, 22 ); TextParams.Flags = UI_VALIGN_CENTER | UI_HALIGN_LEFT; - cUICheckBox * Checkbox = eeNew( cUICheckBox, ( TextParams ) ); + UICheckBox * Checkbox = eeNew( UICheckBox, ( TextParams ) ); Checkbox->Visible( true ); Checkbox->Text( "Check Me" ); Checkbox->Enabled( true ); TextParams.PosSet( 130, 40 ); - cUIRadioButton * RadioButton = eeNew( cUIRadioButton, ( TextParams ) ); + UIRadioButton * RadioButton = eeNew( UIRadioButton, ( TextParams ) ); RadioButton->Visible( true ); RadioButton->Text( "Check Me" ); RadioButton->Enabled( true ); TextParams.PosSet( 130, 60 ); - RadioButton = eeNew( cUIRadioButton, ( TextParams ) ); + RadioButton = eeNew( UIRadioButton, ( TextParams ) ); RadioButton->Visible( true ); RadioButton->Text( "Check Me 2" ); RadioButton->Enabled( true ); - cUISlider::CreateParams SliderParams; + UISlider::CreateParams SliderParams; SliderParams.Parent( C ); SliderParams.PosSet( 220, 80 ); SliderParams.Size = Sizei( 80, 24 ); - mSlider = eeNew( cUISlider, ( SliderParams ) ); + mSlider = eeNew( UISlider, ( SliderParams ) ); mSlider->Visible( true ); mSlider->Enabled( true ); - mSlider->AddEventListener( cUIEvent::EventOnValueChange, cb::Make1( this, &cEETest::OnSliderValueChange ) ); + mSlider->AddEventListener( UIEvent::EventOnValueChange, cb::Make1( this, &cEETest::OnSliderValueChange ) ); SliderParams.PosSet( 40, 110 ); SliderParams.Size = Sizei( 24, 80 ); SliderParams.VerticalSlider = true; - mSlider = eeNew( cUISlider, ( SliderParams ) ); + mSlider = eeNew( UISlider, ( SliderParams ) ); mSlider->Visible( true ); mSlider->Enabled( true ); SliderParams.PosSet( 60, 110 ); - mSlider = eeNew( cUISlider, ( SliderParams ) ); + mSlider = eeNew( UISlider, ( SliderParams ) ); mSlider->Visible( true ); mSlider->Enabled( true ); - cUISpinBox::CreateParams SpinBoxParams; + UISpinBox::CreateParams SpinBoxParams; SpinBoxParams.Parent( C ); SpinBoxParams.PosSet( 80, 150 ); SpinBoxParams.Size = Sizei( 80, 24 ); SpinBoxParams.Flags = UI_VALIGN_CENTER | UI_HALIGN_LEFT | UI_CLIP_ENABLE; SpinBoxParams.AllowDotsInNumbers = true; - cUISpinBox * mSpinBox = eeNew( cUISpinBox, ( SpinBoxParams ) ); + UISpinBox * mSpinBox = eeNew( UISpinBox, ( SpinBoxParams ) ); mSpinBox->Visible( true ); mSpinBox->Enabled( true ); - cUIScrollBar::CreateParams ScrollBarP; + UIScrollBar::CreateParams ScrollBarP; ScrollBarP.Parent( C ); ScrollBarP.PosSet( 0, 0 ); ScrollBarP.Size = Sizei( 15, 240 ); ScrollBarP.Flags = UI_AUTO_SIZE; ScrollBarP.VerticalScrollBar = true; - mScrollBar = eeNew( cUIScrollBar, ( ScrollBarP ) ); + mScrollBar = eeNew( UIScrollBar, ( ScrollBarP ) ); mScrollBar->Visible( true ); mScrollBar->Enabled( true ); - mScrollBar->AddEventListener( cUIEvent::EventOnValueChange, cb::Make1( this, &cEETest::OnValueChange ) ); + mScrollBar->AddEventListener( UIEvent::EventOnValueChange, cb::Make1( this, &cEETest::OnValueChange ) ); mProgressBar = mTheme->CreateProgressBar( C, Sizei( 200, 20 ), Vector2i( 20, 190 ) ); TextParams.PosSet( 20, 5 ); - mTextBoxValue = eeNew( cUITextBox, ( TextParams ) ); + mTextBoxValue = eeNew( UITextBox, ( TextParams ) ); mTextBoxValue->Visible( true ); OnValueChange( NULL ); - cUIListBox::CreateParams LBParams; + UIListBox::CreateParams LBParams; LBParams.Parent( C ); LBParams.PosSet( 325, 8 ); LBParams.Size = Sizei( 200, 240-16 ); LBParams.Flags = UI_CLIP_ENABLE | UI_AUTO_PADDING | UI_TOUCH_DRAG_ENABLED; // | UI_MULTI_SELECT - mListBox = eeNew( cUIListBox, ( LBParams ) ); + mListBox = eeNew( UIListBox, ( LBParams ) ); mListBox->Visible( true ); mListBox->Enabled( true ); @@ -426,12 +426,12 @@ void cEETest::CreateUI() { mListBox->AddListBoxItems( str ); } - cUIDropDownList::CreateParams DDLParams; + UIDropDownList::CreateParams DDLParams; DDLParams.Parent( C ); DDLParams.PosSet( 20, 55 ); DDLParams.Size = Sizei( 100, 21 ); DDLParams.Flags = UI_CLIP_ENABLE | UI_AUTO_PADDING | UI_VALIGN_CENTER | UI_HALIGN_LEFT | UI_TOUCH_DRAG_ENABLED; - cUIDropDownList * mDropDownList = eeNew( cUIDropDownList, ( DDLParams ) ); + UIDropDownList * mDropDownList = eeNew( UIDropDownList, ( DDLParams ) ); mDropDownList->Visible( true ); mDropDownList->Enabled( true ); @@ -448,12 +448,12 @@ void cEETest::CreateUI() { mDropDownList->ListBox()->AddListBoxItems( combostrs ); mDropDownList->ListBox()->SetSelected( 0 ); - cUIComboBox::CreateParams ComboParams; + UIComboBox::CreateParams ComboParams; ComboParams.Parent( C ); ComboParams.PosSet( 20, 80 ); ComboParams.Size = Sizei( 100, 1 ); ComboParams.Flags = UI_CLIP_ENABLE | UI_AUTO_PADDING | UI_VALIGN_CENTER | UI_HALIGN_LEFT | UI_AUTO_SIZE | UI_TOUCH_DRAG_ENABLED | UI_TEXT_SELECTION_ENABLED; - cUIComboBox * mComboBox = eeNew( cUIComboBox, ( ComboParams ) ); + UIComboBox * mComboBox = eeNew( UIComboBox, ( ComboParams ) ); mComboBox->Visible( true ); mComboBox->Enabled( true ); @@ -481,13 +481,13 @@ void cEETest::CreateUI() { Menu->Add( "Show Window 2" ); Menu->AddCheckBox( "Multi Viewport" ); - cUIPopUpMenu * Menu3 = mTheme->CreatePopUpMenu(); + UIPopUpMenu * Menu3 = mTheme->CreatePopUpMenu(); Menu3->Add( "Hello World 1" ); Menu3->Add( "Hello World 2" ); Menu3->Add( "Hello World 3" ); Menu3->Add( "Hello World 4" ); - cUIPopUpMenu * Menu2 = mTheme->CreatePopUpMenu(); + UIPopUpMenu * Menu2 = mTheme->CreatePopUpMenu(); Menu2->Add( "Test 1" ); Menu2->Add( "Test 2" ); Menu2->Add( "Test 3" ); @@ -500,47 +500,47 @@ void cEETest::CreateUI() { Menu->AddSeparator(); Menu->Add( "Quit" ); - Menu->AddEventListener( cUIEvent::EventOnItemClicked, cb::Make1( this, &cEETest::ItemClick ) ); - Menu->GetItem( "Quit" )->AddEventListener( cUIEvent::EventMouseUp, cb::Make1( this, &cEETest::QuitClick ) ); - cUIManager::instance()->MainControl()->AddEventListener( cUIEvent::EventMouseClick, cb::Make1( this, &cEETest::MainClick ) ); + Menu->AddEventListener( UIEvent::EventOnItemClicked, cb::Make1( this, &cEETest::ItemClick ) ); + Menu->GetItem( "Quit" )->AddEventListener( UIEvent::EventMouseUp, cb::Make1( this, &cEETest::QuitClick ) ); + UIManager::instance()->MainControl()->AddEventListener( UIEvent::EventMouseClick, cb::Make1( this, &cEETest::MainClick ) ); - cUITextEdit::CreateParams TEParams; + UITextEdit::CreateParams TEParams; TEParams.Parent( C ); TEParams.PosSet( 5, 245 ); TEParams.Size = Sizei( 315, 130 ); TEParams.Flags = UI_AUTO_PADDING | UI_CLIP_ENABLE | UI_TEXT_SELECTION_ENABLED; - cUITextEdit * TextEdit = eeNew( cUITextEdit, ( TEParams ) ); + UITextEdit * TextEdit = eeNew( UITextEdit, ( TEParams ) ); TextEdit->Visible( true ); TextEdit->Enabled( true ); TextEdit->Text( mBuda ); - cUIGenericGrid::CreateParams GridParams; + UIGenericGrid::CreateParams GridParams; GridParams.Parent( C ); GridParams.PosSet( 325, 245 ); GridParams.SizeSet( 200, 130 ); GridParams.Flags = UI_AUTO_PADDING | UI_TOUCH_DRAG_ENABLED; GridParams.RowHeight = 24; GridParams.CollumnsCount = 3; - cUIGenericGrid * mGenGrid = eeNew( cUIGenericGrid, ( GridParams ) ); + UIGenericGrid * mGenGrid = eeNew( UIGenericGrid, ( GridParams ) ); mGenGrid->Visible( true ); mGenGrid->Enabled( true ); - cUIGridCell::CreateParams CellParams; + UIGridCell::CreateParams CellParams; CellParams.Parent( mGenGrid->Container() ); - cUITextBox::CreateParams TxtBoxParams; - cUITextInput::CreateParams TxtInputParams; + UITextBox::CreateParams TxtBoxParams; + UITextInput::CreateParams TxtInputParams; TxtInputParams.Flags = UI_CLIP_ENABLE | UI_AUTO_PADDING | UI_VALIGN_CENTER | UI_TEXT_SELECTION_ENABLED; - cUIGfx::CreateParams TxtGfxParams; + UIGfx::CreateParams TxtGfxParams; TxtGfxParams.Flags = UI_VALIGN_CENTER | UI_HALIGN_CENTER; TxtGfxParams.SubTexture = mTheme->GetIconByName( "ok" ); for ( Uint32 i = 0; i < 100; i++ ) { - cUIGridCell * Cell = eeNew( cUIGridCell, ( CellParams ) ); - cUITextBox * TxtBox = eeNew( cUITextBox, ( TxtBoxParams ) ); - cUITextInput * TxtInput = eeNew( cUITextInput, ( TxtInputParams ) ); - cUIGfx * TxtGfx = eeNew( cUIGfx, ( TxtGfxParams ) ); + UIGridCell * Cell = eeNew( UIGridCell, ( CellParams ) ); + UITextBox * TxtBox = eeNew( UITextBox, ( TxtBoxParams ) ); + UITextInput * TxtInput = eeNew( UITextInput, ( TxtInputParams ) ); + UIGfx * TxtGfx = eeNew( UIGfx, ( TxtGfxParams ) ); TxtBox->Text( "Test " + String::ToStr( i+1 ) ); @@ -555,7 +555,7 @@ void cEETest::CreateUI() { mGenGrid->CollumnWidth( 1, 24 ); mGenGrid->CollumnWidth( 2, 100 ); - C = reinterpret_cast ( C->Parent() ); + C = reinterpret_cast ( C->Parent() ); eePRINTL( "CreateUI time: %4.3f ms.", TE.Elapsed().AsMilliseconds() ); } @@ -564,7 +564,7 @@ void cEETest::CreateMapEditor() { if ( NULL != mMapEditor ) return; - cUIWindow * tWin = mTheme->CreateWindow( NULL, Sizei( 1024, 768 ), Vector2i(), UI_CONTROL_DEFAULT_FLAGS_CENTERED, UI_WIN_DEFAULT_FLAGS | UI_WIN_MAXIMIZE_BUTTON | UI_WIN_DRAGABLE_CONTAINER, Sizei( 1024, 768 ) ); + UIWindow * tWin = mTheme->CreateWindow( NULL, Sizei( 1024, 768 ), Vector2i(), UI_CONTROL_DEFAULT_FLAGS_CENTERED, UI_WIN_DEFAULT_FLAGS | UI_WIN_MAXIMIZE_BUTTON | UI_WIN_DRAGABLE_CONTAINER, Sizei( 1024, 768 ) ); mMapEditor = eeNew( MapEditor, ( tWin, cb::Make0( this, &cEETest::OnMapEditorClose ) ) ); tWin->Center(); tWin->Show(); @@ -575,7 +575,7 @@ void cEETest::OnMapEditorClose() { } void cEETest::CreateETGEditor() { - cUIWindow * tWin = mTheme->CreateWindow( NULL, Sizei( 1024, 768 ), Vector2i(), UI_CONTROL_DEFAULT_FLAGS_CENTERED, UI_WIN_DEFAULT_FLAGS | UI_WIN_MAXIMIZE_BUTTON | UI_WIN_DRAGABLE_CONTAINER, Sizei( 1024, 768 ) ); + UIWindow * tWin = mTheme->CreateWindow( NULL, Sizei( 1024, 768 ), Vector2i(), UI_CONTROL_DEFAULT_FLAGS_CENTERED, UI_WIN_DEFAULT_FLAGS | UI_WIN_MAXIMIZE_BUTTON | UI_WIN_DRAGABLE_CONTAINER, Sizei( 1024, 768 ) ); mETGEditor = eeNew ( Tools::TextureAtlasEditor, ( tWin, cb::Make0( this, &cEETest::OnETGEditorClose ) ) ); tWin->Center(); tWin->Show(); @@ -586,22 +586,22 @@ void cEETest::OnETGEditorClose() { } void cEETest::CreateCommonDialog() { - cUICommonDialog * CDialog = mTheme->CreateCommonDialog( NULL, Sizei(), Vector2i(), UI_CONTROL_DEFAULT_FLAGS_CENTERED, UI_WIN_DEFAULT_FLAGS | UI_WIN_MAXIMIZE_BUTTON ); + UICommonDialog * CDialog = mTheme->CreateCommonDialog( NULL, Sizei(), Vector2i(), UI_CONTROL_DEFAULT_FLAGS_CENTERED, UI_WIN_DEFAULT_FLAGS | UI_WIN_MAXIMIZE_BUTTON ); CDialog->AddFilePattern( "*.hpp;*.cpp", true ); CDialog->Center(); CDialog->Show(); } void cEETest::CreateWinMenu() { - cUIWinMenu * WinMenu = mTheme->CreateWinMenu( mUIWindow->Container() ); + UIWinMenu * WinMenu = mTheme->CreateWinMenu( mUIWindow->Container() ); - cUIPopUpMenu * PopMenu = mTheme->CreatePopUpMenu(); + UIPopUpMenu * PopMenu = mTheme->CreatePopUpMenu(); PopMenu->Add( "File" ); PopMenu->Add( "Open" ); PopMenu->Add( "Close" ); PopMenu->Add( "Quit" ); - cUIPopUpMenu * PopMenu2 = mTheme->CreatePopUpMenu(); + UIPopUpMenu * PopMenu2 = mTheme->CreatePopUpMenu(); PopMenu2->Add( "Bla" ); PopMenu2->Add( "Bla 2" ); PopMenu2->Add( "Bla 3" ); @@ -614,23 +614,23 @@ void cEETest::CreateWinMenu() { void cEETest::CreateDecoratedWindow() { mUIWindow = mTheme->CreateWindow( NULL, Sizei( 530, 350 ), Vector2i( 200, 50 ), UI_CONTROL_DEFAULT_FLAGS_CENTERED, UI_WIN_DEFAULT_FLAGS | UI_WIN_MAXIMIZE_BUTTON, Sizei( 100, 200 ) ); - mUIWindow->AddEventListener( cUIEvent::EventOnWindowCloseClick, cb::Make1( this, &cEETest::CloseClick ) ); + mUIWindow->AddEventListener( UIEvent::EventOnWindowCloseClick, cb::Make1( this, &cEETest::CloseClick ) ); mUIWindow->Title( "Test Window" ); mUIWindow->ToBack(); - cUIPushButton * Button = mTheme->CreatePushButton( mUIWindow->Container(), Sizei( 510, 22 ), Vector2i( 10, 28 ), UI_CONTROL_DEFAULT_FLAGS_CENTERED | UI_ANCHOR_RIGHT ); + UIPushButton * Button = mTheme->CreatePushButton( mUIWindow->Container(), Sizei( 510, 22 ), Vector2i( 10, 28 ), UI_CONTROL_DEFAULT_FLAGS_CENTERED | UI_ANCHOR_RIGHT ); Button->Text( "Click Me" ); - Button->AddEventListener( cUIEvent::EventMouseClick, cb::Make1( this, &cEETest::ButtonClick ) ); + Button->AddEventListener( UIEvent::EventMouseClick, cb::Make1( this, &cEETest::ButtonClick ) ); mUIWindow->AddShortcut( KEY_C, KEYMOD_ALT, Button ); - cUITabWidget * TabWidget = mTheme->CreateTabWidget( mUIWindow->Container(), Sizei( 510, 250 ), Vector2i( 10, 55 ), UI_HALIGN_CENTER | UI_VALIGN_CENTER | UI_ANCHOR_RIGHT | UI_ANCHOR_BOTTOM | UI_ANCHOR_LEFT | UI_ANCHOR_TOP ); + UITabWidget * TabWidget = mTheme->CreateTabWidget( mUIWindow->Container(), Sizei( 510, 250 ), Vector2i( 10, 55 ), UI_HALIGN_CENTER | UI_VALIGN_CENTER | UI_ANCHOR_RIGHT | UI_ANCHOR_BOTTOM | UI_ANCHOR_LEFT | UI_ANCHOR_TOP ); - cUITextEdit * TEdit = mTheme->CreateTextEdit( TabWidget, Sizei(), Vector2i() ); + UITextEdit * TEdit = mTheme->CreateTextEdit( TabWidget, Sizei(), Vector2i() ); TEdit->Text( mBuda ); TabWidget->Add( "TextEdit", TEdit ); - cUITextInput * Txt = mTheme->CreateTextInput( TabWidget, Sizei(), Vector2i(), UI_AUTO_PADDING | UI_AUTO_SHRINK_TEXT | UI_TEXT_SELECTION_ENABLED ); + UITextInput * Txt = mTheme->CreateTextInput( TabWidget, Sizei(), Vector2i(), UI_AUTO_PADDING | UI_AUTO_SHRINK_TEXT | UI_TEXT_SELECTION_ENABLED ); Txt->Text( mBuda ); TabWidget->Add( "TextInput", Txt ); @@ -639,15 +639,15 @@ void cEETest::CreateDecoratedWindow() { CreateWinMenu(); } -void cEETest::CloseClick( const cUIEvent * Event ) { +void cEETest::CloseClick( const UIEvent * Event ) { mUIWindow = NULL; } -void cEETest::ItemClick( const cUIEvent * Event ) { +void cEETest::ItemClick( const UIEvent * Event ) { if ( !Event->Ctrl()->IsType( UI_TYPE_MENUITEM ) ) return; - const String& txt = reinterpret_cast ( Event->Ctrl() )->Text(); + const String& txt = reinterpret_cast ( Event->Ctrl() )->Text(); if ( "Show Screen 1" == txt ) { SetScreen( 0 ); @@ -671,7 +671,7 @@ void cEETest::ItemClick( const cUIEvent * Event ) { mWindow->StopTextInput(); } } else if ( "Show Window" == txt ) { - cUIMenuCheckBox * Chk = reinterpret_cast ( Event->Ctrl() ); + UIMenuCheckBox * Chk = reinterpret_cast ( Event->Ctrl() ); C->Visible( true ); C->Enabled( true ); @@ -707,20 +707,20 @@ void cEETest::ItemClick( const cUIEvent * Event ) { } } -void cEETest::OnValueChange( const cUIEvent * Event ) { +void cEETest::OnValueChange( const UIEvent * Event ) { mTextBoxValue->Text( "Scroll Value:\n" + String::ToStr( mScrollBar->Value() ) ); mProgressBar->Progress( mScrollBar->Value() * 100.f ); } -void cEETest::OnSliderValueChange( const cUIEvent * Event ) { - cUISlider * slider = static_cast( Event->Ctrl() ); +void cEETest::OnSliderValueChange( const UIEvent * Event ) { + UISlider * slider = static_cast( Event->Ctrl() ); C->Angle( slider->Value() * 90.f ); } -void cEETest::QuitClick( const cUIEvent * Event ) { - const cUIEventMouse * MouseEvent = reinterpret_cast ( Event ); +void cEETest::QuitClick( const UIEvent * Event ) { + const UIEventMouse * MouseEvent = reinterpret_cast ( Event ); if ( MouseEvent->Flags() & EE_BUTTON_LMASK ) { mWindow->Close(); @@ -730,27 +730,27 @@ void cEETest::QuitClick( const cUIEvent * Event ) { void cEETest::ShowMenu() { if ( Menu->Show() ) { Vector2i Pos = mWindow->GetInput()->GetMousePos(); - cUIMenu::FixMenuPos( Pos , Menu ); + UIMenu::FixMenuPos( Pos , Menu ); Menu->Pos( Pos ); } } -void cEETest::MainClick( const cUIEvent * Event ) { - const cUIEventMouse * MouseEvent = reinterpret_cast ( Event ); +void cEETest::MainClick( const UIEvent * Event ) { + const UIEventMouse * MouseEvent = reinterpret_cast ( Event ); if ( MouseEvent->Flags() & EE_BUTTON_RMASK ) { ShowMenu(); } } -void cEETest::ButtonClick( const cUIEvent * Event ) { - const cUIEventMouse * MouseEvent = reinterpret_cast ( Event ); +void cEETest::ButtonClick( const UIEvent * Event ) { + const UIEventMouse * MouseEvent = reinterpret_cast ( Event ); if ( MouseEvent->Flags() & EE_BUTTONS_LRM ) { - cUIGfx::CreateParams GfxParams; - GfxParams.Parent( cUIManager::instance()->MainControl() ); + UIGfx::CreateParams GfxParams; + GfxParams.Parent( UIManager::instance()->MainControl() ); GfxParams.SubTexture = mTheme->GetIconByName( "ok" ); - cUIGfx * Gfx = eeNew( cUIGfx, ( GfxParams ) ); + UIGfx * Gfx = eeNew( UIGfx, ( GfxParams ) ); Gfx->Visible( true ); Gfx->Enabled( false ); @@ -1262,8 +1262,8 @@ void cEETest::Render() { FF2->Draw( 6, 180, FONT_DRAW_SHADOW ); } - cUIManager::instance()->Draw(); - cUIManager::instance()->Update(); + UIManager::instance()->Draw(); + UIManager::instance()->Update(); Con.Draw(); diff --git a/src/test/eetest.hpp b/src/test/eetest.hpp index 457631475..9083e12a4 100644 --- a/src/test/eetest.hpp +++ b/src/test/eetest.hpp @@ -5,9 +5,9 @@ namespace Demo_Test { -class cUITest : public cUIControlAnim { +class UITest : public UIControlAnim { public: - cUITest( cUIControlAnim::CreateParams& Params ) : cUIControlAnim( Params ) { mOldColor = mBackground->Colors(); } + UITest( UIControlAnim::CreateParams& Params ) : UIControlAnim( Params ) { mOldColor = mBackground->Colors(); } virtual Uint32 OnMouseEnter( const Vector2i& Pos, const Uint32 Flags ) { if ( 4 == mOldColor.size() ) { @@ -34,7 +34,7 @@ class cUITest : public cUIControlAnim { } virtual Uint32 OnMouseUp( const Vector2i& Pos, const Uint32 Flags ) { - cUIDragable::OnMouseUp( Pos, Flags ); + UIDragable::OnMouseUp( Pos, Flags ); if ( Engine::instance()->GetCurrentWindow()->GetInput()->MouseWheelUp() ) Scale( Scale() + 0.1f ); @@ -199,26 +199,26 @@ class cEETest : private Thread { Clock mFTE; void CreateCommonDialog(); - void ItemClick( const cUIEvent * Event ); - void MainClick( const cUIEvent * Event ); - void QuitClick( const cUIEvent * Event ); - void CloseClick( const cUIEvent * Event ); - void ButtonClick( const cUIEvent * Event ); - void OnValueChange( const cUIEvent * Event ); - void OnSliderValueChange( const cUIEvent * Event ); - void OnWinMouseUp( const cUIEvent * Event ); + void ItemClick( const UIEvent * Event ); + void MainClick( const UIEvent * Event ); + void QuitClick( const UIEvent * Event ); + void CloseClick( const UIEvent * Event ); + void ButtonClick( const UIEvent * Event ); + void OnValueChange( const UIEvent * Event ); + void OnSliderValueChange( const UIEvent * Event ); + void OnWinMouseUp( const UIEvent * Event ); void CreateDecoratedWindow(); void CreateWinMenu(); void CreateUIThemeTextureAtlas(); - cUIControlAnim * C; - cUIScrollBar * mScrollBar; - cUITextBox * mTextBoxValue; - cUISlider * mSlider; - cUIProgressBar * mProgressBar; - cUIListBox * mListBox; - cUIPopUpMenu * Menu; - cUIWindow * mUIWindow; + UIControlAnim * C; + UIScrollBar * mScrollBar; + UITextBox * mTextBoxValue; + UISlider * mSlider; + UIProgressBar * mProgressBar; + UIListBox * mListBox; + UIPopUpMenu * Menu; + UIWindow * mUIWindow; MapEditor * mMapEditor; TextureAtlasEditor * mETGEditor; @@ -276,11 +276,11 @@ class cEETest : private Thread { Sprite * mBoxSprite; Sprite * mCircleSprite; - cUITheme * mTheme; + UITheme * mTheme; bool mTerrainUp; - cUIPushButton * mShowMenu; - cUIPushButton * mTerrainBut; + UIPushButton * mShowMenu; + UIPushButton * mTerrainBut; void CreateMapEditor(); @@ -294,7 +294,7 @@ class cEETest : private Thread { void DestroyBody(); - void OnShowMenu( const cUIEvent * Event ); + void OnShowMenu( const UIEvent * Event ); void OnWindowResize( EE::Window::Window * win ); };