diff --git a/bin/assets/ui/uitheme.eta b/bin/assets/ui/uitheme.eta index c18c8015f..d04875c35 100644 Binary files a/bin/assets/ui/uitheme.eta and b/bin/assets/ui/uitheme.eta differ diff --git a/bin/assets/ui/uitheme.png b/bin/assets/ui/uitheme.png index 6b207c541..43af5dbeb 100644 Binary files a/bin/assets/ui/uitheme.png and b/bin/assets/ui/uitheme.png differ diff --git a/bin/assets/ui/uitheme/uitheme_combobox_button_menter_d.png b/bin/assets/ui/uitheme/uitheme_combobox_button_menter_d.png new file mode 100644 index 000000000..055f2b12b Binary files /dev/null and b/bin/assets/ui/uitheme/uitheme_combobox_button_menter_d.png differ diff --git a/bin/assets/ui/uitheme/uitheme_combobox_button_menter_m.png b/bin/assets/ui/uitheme/uitheme_combobox_button_menter_m.png new file mode 100644 index 000000000..6caee78dd Binary files /dev/null and b/bin/assets/ui/uitheme/uitheme_combobox_button_menter_m.png differ diff --git a/bin/assets/ui/uitheme/uitheme_combobox_button_menter_u.png b/bin/assets/ui/uitheme/uitheme_combobox_button_menter_u.png new file mode 100644 index 000000000..46a5287bc Binary files /dev/null and b/bin/assets/ui/uitheme/uitheme_combobox_button_menter_u.png differ diff --git a/bin/assets/ui/uitheme/uitheme_combobox_button_normal_d.png b/bin/assets/ui/uitheme/uitheme_combobox_button_normal_d.png new file mode 100644 index 000000000..0ae02f612 Binary files /dev/null and b/bin/assets/ui/uitheme/uitheme_combobox_button_normal_d.png differ diff --git a/bin/assets/ui/uitheme/uitheme_combobox_button_normal_m.png b/bin/assets/ui/uitheme/uitheme_combobox_button_normal_m.png new file mode 100644 index 000000000..96ba80e5b Binary files /dev/null and b/bin/assets/ui/uitheme/uitheme_combobox_button_normal_m.png differ diff --git a/bin/assets/ui/uitheme/uitheme_combobox_button_normal_u.png b/bin/assets/ui/uitheme/uitheme_combobox_button_normal_u.png new file mode 100644 index 000000000..8c619f4f6 Binary files /dev/null and b/bin/assets/ui/uitheme/uitheme_combobox_button_normal_u.png differ diff --git a/bin/assets/ui/uitheme/uitheme_combobox_menter_d.png b/bin/assets/ui/uitheme/uitheme_combobox_menter_d.png deleted file mode 100644 index 09bb94394..000000000 Binary files a/bin/assets/ui/uitheme/uitheme_combobox_menter_d.png and /dev/null differ diff --git a/bin/assets/ui/uitheme/uitheme_combobox_menter_dl.png b/bin/assets/ui/uitheme/uitheme_combobox_menter_dl.png deleted file mode 100644 index 02c0e76dc..000000000 Binary files a/bin/assets/ui/uitheme/uitheme_combobox_menter_dl.png and /dev/null differ diff --git a/bin/assets/ui/uitheme/uitheme_combobox_menter_dr.png b/bin/assets/ui/uitheme/uitheme_combobox_menter_dr.png deleted file mode 100644 index ad473bf57..000000000 Binary files a/bin/assets/ui/uitheme/uitheme_combobox_menter_dr.png and /dev/null differ diff --git a/bin/assets/ui/uitheme/uitheme_combobox_menter_m.png b/bin/assets/ui/uitheme/uitheme_combobox_menter_m.png deleted file mode 100644 index 558225b5c..000000000 Binary files a/bin/assets/ui/uitheme/uitheme_combobox_menter_m.png and /dev/null differ diff --git a/bin/assets/ui/uitheme/uitheme_combobox_menter_ml.png b/bin/assets/ui/uitheme/uitheme_combobox_menter_ml.png deleted file mode 100644 index 6d3cef0c1..000000000 Binary files a/bin/assets/ui/uitheme/uitheme_combobox_menter_ml.png and /dev/null differ diff --git a/bin/assets/ui/uitheme/uitheme_combobox_menter_mr.png b/bin/assets/ui/uitheme/uitheme_combobox_menter_mr.png deleted file mode 100644 index 466a733fa..000000000 Binary files a/bin/assets/ui/uitheme/uitheme_combobox_menter_mr.png and /dev/null differ diff --git a/bin/assets/ui/uitheme/uitheme_combobox_menter_u.png b/bin/assets/ui/uitheme/uitheme_combobox_menter_u.png deleted file mode 100644 index 1268ef4bc..000000000 Binary files a/bin/assets/ui/uitheme/uitheme_combobox_menter_u.png and /dev/null differ diff --git a/bin/assets/ui/uitheme/uitheme_combobox_menter_ul.png b/bin/assets/ui/uitheme/uitheme_combobox_menter_ul.png deleted file mode 100644 index 58e68887f..000000000 Binary files a/bin/assets/ui/uitheme/uitheme_combobox_menter_ul.png and /dev/null differ diff --git a/bin/assets/ui/uitheme/uitheme_combobox_menter_ur.png b/bin/assets/ui/uitheme/uitheme_combobox_menter_ur.png deleted file mode 100644 index d255a6a38..000000000 Binary files a/bin/assets/ui/uitheme/uitheme_combobox_menter_ur.png and /dev/null differ diff --git a/bin/assets/ui/uitheme/uitheme_combobox_normal_dr.png b/bin/assets/ui/uitheme/uitheme_combobox_normal_dr.png index 933180a03..5eeb70024 100644 Binary files a/bin/assets/ui/uitheme/uitheme_combobox_normal_dr.png and b/bin/assets/ui/uitheme/uitheme_combobox_normal_dr.png differ diff --git a/bin/assets/ui/uitheme/uitheme_combobox_normal_mr.png b/bin/assets/ui/uitheme/uitheme_combobox_normal_mr.png index 3355d3940..57c608a21 100644 Binary files a/bin/assets/ui/uitheme/uitheme_combobox_normal_mr.png and b/bin/assets/ui/uitheme/uitheme_combobox_normal_mr.png differ diff --git a/bin/assets/ui/uitheme/uitheme_combobox_normal_ur.png b/bin/assets/ui/uitheme/uitheme_combobox_normal_ur.png index e1bb2a1fb..ef7e56c94 100644 Binary files a/bin/assets/ui/uitheme/uitheme_combobox_normal_ur.png and b/bin/assets/ui/uitheme/uitheme_combobox_normal_ur.png differ diff --git a/bin/assets/ui/uitheme2x.eta b/bin/assets/ui/uitheme2x.eta index 55fcd5c23..de5075c80 100644 Binary files a/bin/assets/ui/uitheme2x.eta and b/bin/assets/ui/uitheme2x.eta differ diff --git a/bin/assets/ui/uitheme2x.png b/bin/assets/ui/uitheme2x.png index 4a3b1c38b..4fb1ba44e 100644 Binary files a/bin/assets/ui/uitheme2x.png and b/bin/assets/ui/uitheme2x.png differ diff --git a/bin/assets/ui/uitheme2x/uitheme2x_combobox_button_menter_d.png b/bin/assets/ui/uitheme2x/uitheme2x_combobox_button_menter_d.png new file mode 100644 index 000000000..b499e1af6 Binary files /dev/null and b/bin/assets/ui/uitheme2x/uitheme2x_combobox_button_menter_d.png differ diff --git a/bin/assets/ui/uitheme2x/uitheme2x_combobox_button_menter_m.png b/bin/assets/ui/uitheme2x/uitheme2x_combobox_button_menter_m.png new file mode 100644 index 000000000..9ddfba114 Binary files /dev/null and b/bin/assets/ui/uitheme2x/uitheme2x_combobox_button_menter_m.png differ diff --git a/bin/assets/ui/uitheme2x/uitheme2x_combobox_button_menter_u.png b/bin/assets/ui/uitheme2x/uitheme2x_combobox_button_menter_u.png new file mode 100644 index 000000000..826f48a4a Binary files /dev/null and b/bin/assets/ui/uitheme2x/uitheme2x_combobox_button_menter_u.png differ diff --git a/bin/assets/ui/uitheme2x/uitheme2x_combobox_button_normal_d.png b/bin/assets/ui/uitheme2x/uitheme2x_combobox_button_normal_d.png new file mode 100644 index 000000000..e71405a21 Binary files /dev/null and b/bin/assets/ui/uitheme2x/uitheme2x_combobox_button_normal_d.png differ diff --git a/bin/assets/ui/uitheme2x/uitheme2x_combobox_button_normal_m.png b/bin/assets/ui/uitheme2x/uitheme2x_combobox_button_normal_m.png new file mode 100644 index 000000000..180b87540 Binary files /dev/null and b/bin/assets/ui/uitheme2x/uitheme2x_combobox_button_normal_m.png differ diff --git a/bin/assets/ui/uitheme2x/uitheme2x_combobox_button_normal_u.png b/bin/assets/ui/uitheme2x/uitheme2x_combobox_button_normal_u.png new file mode 100644 index 000000000..413e4b753 Binary files /dev/null and b/bin/assets/ui/uitheme2x/uitheme2x_combobox_button_normal_u.png differ diff --git a/bin/assets/ui/uitheme2x/uitheme2x_combobox_menter_d.png b/bin/assets/ui/uitheme2x/uitheme2x_combobox_menter_d.png deleted file mode 100644 index 68c99ec93..000000000 Binary files a/bin/assets/ui/uitheme2x/uitheme2x_combobox_menter_d.png and /dev/null differ diff --git a/bin/assets/ui/uitheme2x/uitheme2x_combobox_menter_dl.png b/bin/assets/ui/uitheme2x/uitheme2x_combobox_menter_dl.png deleted file mode 100644 index 4df36cf38..000000000 Binary files a/bin/assets/ui/uitheme2x/uitheme2x_combobox_menter_dl.png and /dev/null differ diff --git a/bin/assets/ui/uitheme2x/uitheme2x_combobox_menter_dr.png b/bin/assets/ui/uitheme2x/uitheme2x_combobox_menter_dr.png deleted file mode 100644 index 15c8a0426..000000000 Binary files a/bin/assets/ui/uitheme2x/uitheme2x_combobox_menter_dr.png and /dev/null differ diff --git a/bin/assets/ui/uitheme2x/uitheme2x_combobox_menter_m.png b/bin/assets/ui/uitheme2x/uitheme2x_combobox_menter_m.png deleted file mode 100644 index d70b7ed0a..000000000 Binary files a/bin/assets/ui/uitheme2x/uitheme2x_combobox_menter_m.png and /dev/null differ diff --git a/bin/assets/ui/uitheme2x/uitheme2x_combobox_menter_ml.png b/bin/assets/ui/uitheme2x/uitheme2x_combobox_menter_ml.png deleted file mode 100644 index aeacbbdb8..000000000 Binary files a/bin/assets/ui/uitheme2x/uitheme2x_combobox_menter_ml.png and /dev/null differ diff --git a/bin/assets/ui/uitheme2x/uitheme2x_combobox_menter_mr.png b/bin/assets/ui/uitheme2x/uitheme2x_combobox_menter_mr.png deleted file mode 100644 index 5e82b206a..000000000 Binary files a/bin/assets/ui/uitheme2x/uitheme2x_combobox_menter_mr.png and /dev/null differ diff --git a/bin/assets/ui/uitheme2x/uitheme2x_combobox_menter_u.png b/bin/assets/ui/uitheme2x/uitheme2x_combobox_menter_u.png deleted file mode 100644 index 827e5bec9..000000000 Binary files a/bin/assets/ui/uitheme2x/uitheme2x_combobox_menter_u.png and /dev/null differ diff --git a/bin/assets/ui/uitheme2x/uitheme2x_combobox_menter_ul.png b/bin/assets/ui/uitheme2x/uitheme2x_combobox_menter_ul.png deleted file mode 100644 index 26e097205..000000000 Binary files a/bin/assets/ui/uitheme2x/uitheme2x_combobox_menter_ul.png and /dev/null differ diff --git a/bin/assets/ui/uitheme2x/uitheme2x_combobox_menter_ur.png b/bin/assets/ui/uitheme2x/uitheme2x_combobox_menter_ur.png deleted file mode 100644 index d34cb0fbe..000000000 Binary files a/bin/assets/ui/uitheme2x/uitheme2x_combobox_menter_ur.png and /dev/null differ diff --git a/bin/assets/ui/uitheme2x/uitheme2x_combobox_normal_dr.png b/bin/assets/ui/uitheme2x/uitheme2x_combobox_normal_dr.png index 567321a1b..f1621ed77 100644 Binary files a/bin/assets/ui/uitheme2x/uitheme2x_combobox_normal_dr.png and b/bin/assets/ui/uitheme2x/uitheme2x_combobox_normal_dr.png differ diff --git a/bin/assets/ui/uitheme2x/uitheme2x_combobox_normal_mr.png b/bin/assets/ui/uitheme2x/uitheme2x_combobox_normal_mr.png index cd13dd73e..b7560befd 100644 Binary files a/bin/assets/ui/uitheme2x/uitheme2x_combobox_normal_mr.png and b/bin/assets/ui/uitheme2x/uitheme2x_combobox_normal_mr.png differ diff --git a/bin/assets/ui/uitheme2x/uitheme2x_combobox_normal_ur.png b/bin/assets/ui/uitheme2x/uitheme2x_combobox_normal_ur.png index 23636f9a1..ba274abff 100644 Binary files a/bin/assets/ui/uitheme2x/uitheme2x_combobox_normal_ur.png and b/bin/assets/ui/uitheme2x/uitheme2x_combobox_normal_ur.png differ diff --git a/bin/assets/ui/uitheme2x/uitheme2x_hscrollbar_button_menter_m.png b/bin/assets/ui/uitheme2x/uitheme2x_hscrollbar_button_menter_m.png index 75b9c32b9..c83bbd64c 100644 Binary files a/bin/assets/ui/uitheme2x/uitheme2x_hscrollbar_button_menter_m.png and b/bin/assets/ui/uitheme2x/uitheme2x_hscrollbar_button_menter_m.png differ diff --git a/bin/assets/ui/uitheme2x/uitheme2x_hscrollbar_button_menter_ml.png b/bin/assets/ui/uitheme2x/uitheme2x_hscrollbar_button_menter_ml.png index 5ede509f7..54bdb1f16 100644 Binary files a/bin/assets/ui/uitheme2x/uitheme2x_hscrollbar_button_menter_ml.png and b/bin/assets/ui/uitheme2x/uitheme2x_hscrollbar_button_menter_ml.png differ diff --git a/bin/assets/ui/uitheme2x/uitheme2x_hscrollbar_button_menter_mr.png b/bin/assets/ui/uitheme2x/uitheme2x_hscrollbar_button_menter_mr.png index 0805de99b..6ba1281fa 100644 Binary files a/bin/assets/ui/uitheme2x/uitheme2x_hscrollbar_button_menter_mr.png and b/bin/assets/ui/uitheme2x/uitheme2x_hscrollbar_button_menter_mr.png differ diff --git a/bin/assets/ui/uitheme2x/uitheme2x_hscrollbar_button_normal_m.png b/bin/assets/ui/uitheme2x/uitheme2x_hscrollbar_button_normal_m.png index fc5185034..2457f638d 100644 Binary files a/bin/assets/ui/uitheme2x/uitheme2x_hscrollbar_button_normal_m.png and b/bin/assets/ui/uitheme2x/uitheme2x_hscrollbar_button_normal_m.png differ diff --git a/bin/assets/ui/uitheme2x/uitheme2x_hscrollbar_button_normal_ml.png b/bin/assets/ui/uitheme2x/uitheme2x_hscrollbar_button_normal_ml.png index ce53145b3..0654a4e98 100644 Binary files a/bin/assets/ui/uitheme2x/uitheme2x_hscrollbar_button_normal_ml.png and b/bin/assets/ui/uitheme2x/uitheme2x_hscrollbar_button_normal_ml.png differ diff --git a/bin/assets/ui/uitheme2x/uitheme2x_hscrollbar_button_normal_mr.png b/bin/assets/ui/uitheme2x/uitheme2x_hscrollbar_button_normal_mr.png index 3604b51eb..4d4e42d3c 100644 Binary files a/bin/assets/ui/uitheme2x/uitheme2x_hscrollbar_button_normal_mr.png and b/bin/assets/ui/uitheme2x/uitheme2x_hscrollbar_button_normal_mr.png differ diff --git a/bin/assets/ui/uitheme2x/uitheme2x_vscrollbar_button_menter_d.png b/bin/assets/ui/uitheme2x/uitheme2x_vscrollbar_button_menter_d.png index 8d340e7ca..a5bb8e8f2 100644 Binary files a/bin/assets/ui/uitheme2x/uitheme2x_vscrollbar_button_menter_d.png and b/bin/assets/ui/uitheme2x/uitheme2x_vscrollbar_button_menter_d.png differ diff --git a/bin/assets/ui/uitheme2x/uitheme2x_vscrollbar_button_menter_m.png b/bin/assets/ui/uitheme2x/uitheme2x_vscrollbar_button_menter_m.png index 781fc026a..c65781d48 100644 Binary files a/bin/assets/ui/uitheme2x/uitheme2x_vscrollbar_button_menter_m.png and b/bin/assets/ui/uitheme2x/uitheme2x_vscrollbar_button_menter_m.png differ diff --git a/bin/assets/ui/uitheme2x/uitheme2x_vscrollbar_button_menter_u.png b/bin/assets/ui/uitheme2x/uitheme2x_vscrollbar_button_menter_u.png index 87ad0f19f..aed60b832 100644 Binary files a/bin/assets/ui/uitheme2x/uitheme2x_vscrollbar_button_menter_u.png and b/bin/assets/ui/uitheme2x/uitheme2x_vscrollbar_button_menter_u.png differ diff --git a/bin/assets/ui/uitheme2x/uitheme2x_vscrollbar_button_normal_d.png b/bin/assets/ui/uitheme2x/uitheme2x_vscrollbar_button_normal_d.png index 6186e8543..0e2942251 100644 Binary files a/bin/assets/ui/uitheme2x/uitheme2x_vscrollbar_button_normal_d.png and b/bin/assets/ui/uitheme2x/uitheme2x_vscrollbar_button_normal_d.png differ diff --git a/bin/assets/ui/uitheme2x/uitheme2x_vscrollbar_button_normal_m.png b/bin/assets/ui/uitheme2x/uitheme2x_vscrollbar_button_normal_m.png index ee668c4f8..fd6e555d3 100644 Binary files a/bin/assets/ui/uitheme2x/uitheme2x_vscrollbar_button_normal_m.png and b/bin/assets/ui/uitheme2x/uitheme2x_vscrollbar_button_normal_m.png differ diff --git a/bin/assets/ui/uitheme2x/uitheme2x_vscrollbar_button_normal_u.png b/bin/assets/ui/uitheme2x/uitheme2x_vscrollbar_button_normal_u.png index b5b1abff4..58af7b051 100644 Binary files a/bin/assets/ui/uitheme2x/uitheme2x_vscrollbar_button_normal_u.png and b/bin/assets/ui/uitheme2x/uitheme2x_vscrollbar_button_normal_u.png differ diff --git a/include/eepp/ui/uicombobox.hpp b/include/eepp/ui/uicombobox.hpp index 6e64ea5cd..10b93b68c 100644 --- a/include/eepp/ui/uicombobox.hpp +++ b/include/eepp/ui/uicombobox.hpp @@ -5,7 +5,7 @@ namespace EE { namespace UI { -class EE_API UIComboBox : public UIDropDownList { +class EE_API UIComboBox : public UIComplexControl { public: UIComboBox( UIComboBox::CreateParams& Params ); @@ -18,8 +18,19 @@ class EE_API UIComboBox : public UIDropDownList { virtual bool isType( const Uint32& type ) const; virtual void setTheme( UITheme * Theme ); + + UIListBox * getListBox(); + + UIDropDownList * getDropDownList() const { return mDropDownList; } + + UIComplexControl * getButton() const { return mButton; } + + InputTextBuffer * getInputTextBuffer(); + + const String& getText(); protected: - UIControl * mButton; + UIDropDownList * mDropDownList; + UIComplexControl * mButton; void onButtonClick( const UIEvent * Event ); @@ -27,13 +38,13 @@ class EE_API UIComboBox : public UIDropDownList { void onButtonExit( const UIEvent * Event ); - Uint32 onMouseClick( const Vector2i& position, const Uint32 flags ); - - void createButton(); - - virtual void onControlClear( const UIEvent *Event ); + void updateControls(); virtual void onSizeChange(); + + virtual void onPositionChange(); + + virtual void onParentChange(); }; }} diff --git a/include/eepp/ui/uicomplexcontrol.hpp b/include/eepp/ui/uicomplexcontrol.hpp index 05b730e05..c207e6514 100644 --- a/include/eepp/ui/uicomplexcontrol.hpp +++ b/include/eepp/ui/uicomplexcontrol.hpp @@ -49,9 +49,9 @@ class EE_API UIComplexControl : public UIControlAnim { virtual void update(); - virtual void setSize( const Sizei& size ); + virtual UIControl * setSize( const Sizei& size ); - void setSize( const Int32& Width, const Int32& Height ); + UIControl * setSize( const Int32& Width, const Int32& Height ); const Sizei& getSize(); diff --git a/include/eepp/ui/uicontrol.hpp b/include/eepp/ui/uicontrol.hpp index 50a2e8e02..1d1d0dad9 100644 --- a/include/eepp/ui/uicontrol.hpp +++ b/include/eepp/ui/uicontrol.hpp @@ -90,9 +90,9 @@ class EE_API UIControl { virtual void messagePost( const UIMessage * Msg ); - void setPosition( const Vector2i& position ); + UIControl * setPosition( const Vector2i& position ); - void setPosition( const Int32& x, const Int32& y ); + UIControl * setPosition( const Int32& x, const Int32& y ); void setPixelsPosition( const Vector2i& position ); @@ -102,9 +102,9 @@ class EE_API UIControl { const Vector2i& getRealPosition() const; - virtual void setSize( const Sizei& size ); + virtual UIControl * setSize( const Sizei& size ); - void setSize( const Int32& Width, const Int32& Height ); + UIControl * setSize( const Int32& Width, const Int32& Height ); void setPixelsSize( const Sizei& size ); @@ -116,13 +116,13 @@ class EE_API UIControl { Recti getRect() const; - void setVisible( const bool& visible ); + UIControl * setVisible( const bool& visible ); bool isVisible() const; bool isHided() const; - void setEnabled( const bool& enabled ); + UIControl * setEnabled( const bool& enabled ); bool isEnabled() const; @@ -130,7 +130,7 @@ class EE_API UIControl { UIControl * getParent() const; - void setParent( UIControl * parent ); + UIControl * setParent( UIControl * parent ); void centerHorizontal(); @@ -350,6 +350,8 @@ class EE_API UIControl { virtual void onParentSizeChange( const Vector2i& SizeChange ); virtual void onStateChange(); + + virtual void onParentChange(); virtual void onComplexControlFocusLoss(); diff --git a/include/eepp/ui/uidropdownlist.hpp b/include/eepp/ui/uidropdownlist.hpp index b58b3ebd0..440d7cda9 100644 --- a/include/eepp/ui/uidropdownlist.hpp +++ b/include/eepp/ui/uidropdownlist.hpp @@ -40,12 +40,25 @@ class EE_API UIDropDownList : public UITextInput { UIListBox * getListBox() const; virtual void update(); + + void showList(); + + bool getPopUpToMainControl() const; + + void setPopUpToMainControl(bool popUpToMainControl); + + Uint32 getMinNumVisibleItems() const; + + void setMinNumVisibleItems(const Uint32 & minNumVisibleItems); + protected: - UIListBox * mListBox; + friend class UIComboBox; + + UIListBox * mListBox; + UIControl * mFriendCtrl; Uint32 mMinNumVisibleItems; bool mPopUpToMainControl; - void showListBox(); void onListBoxFocusLoss( const UIEvent * Event ); @@ -71,6 +84,10 @@ class EE_API UIDropDownList : public UITextInput { virtual void autoSizeControl(); + virtual void doAftersetTheme(); + + void setFriendControl( UIControl * friendCtrl ); + void destroyListBox(); }; diff --git a/include/eepp/ui/uiscrollbar.hpp b/include/eepp/ui/uiscrollbar.hpp index 2c88ba1df..964e24714 100644 --- a/include/eepp/ui/uiscrollbar.hpp +++ b/include/eepp/ui/uiscrollbar.hpp @@ -65,7 +65,7 @@ class EE_API UIScrollBar : public UIComplexControl { UI_ORIENTATION getOrientation() const; - void setOrientation( const UI_ORIENTATION & orientation ); + UIControl * setOrientation( const UI_ORIENTATION & orientation ); bool getExpandBackground() const; diff --git a/include/eepp/ui/uislider.hpp b/include/eepp/ui/uislider.hpp index d9ea7940a..4206cad68 100644 --- a/include/eepp/ui/uislider.hpp +++ b/include/eepp/ui/uislider.hpp @@ -67,7 +67,7 @@ class EE_API UISlider : public UIComplexControl { UI_ORIENTATION getOrientation() const; - void setOrientation( const UI_ORIENTATION & orientation ); + UIControl * setOrientation( const UI_ORIENTATION & orientation ); bool getAllowHalfSliderOut() const; diff --git a/include/eepp/ui/uiwindow.hpp b/include/eepp/ui/uiwindow.hpp index 05c096628..964ee3b29 100644 --- a/include/eepp/ui/uiwindow.hpp +++ b/include/eepp/ui/uiwindow.hpp @@ -46,9 +46,9 @@ class EE_API UIWindow : public UIComplexControl { virtual bool isType( const Uint32& type ) const; - virtual void setSize( const Sizei& size ); + virtual UIControl * setSize( const Sizei& size ); - void setSize( const Int32& Width, const Int32& Height ); + UIControl * setSize( const Int32& Width, const Int32& Height ); const Sizei& getSize(); diff --git a/src/eepp/ui/tools/textureatlasnew.cpp b/src/eepp/ui/tools/textureatlasnew.cpp index 43ef127a8..4d50ee728 100644 --- a/src/eepp/ui/tools/textureatlasnew.cpp +++ b/src/eepp/ui/tools/textureatlasnew.cpp @@ -35,10 +35,22 @@ TextureAtlasNew::TextureAtlasNew( TGCreateCb NewTGCb ) : mSaveFileType->getListBox()->setSelected( "PNG" ); createTxtBox( Vector2i( 10, 50 ), "Max. Texture Atlas Width:" ); - mComboWidth = mTheme->createComboBox( mUIWindow->getContainer(), Sizei( 100, 22 ), Vector2i( PosX, 50 ), UI_CONTROL_DEFAULT_FLAGS | UI_CLIP_ENABLE | UI_AUTO_PADDING | UI_AUTO_SIZE ); + + mComboWidth = eeNew( UIComboBox, () ); + mComboWidth->setParent( mUIWindow->getContainer() ); + mComboWidth->setSize( 100, 0 ); + mComboWidth->setPosition( PosX, 50 ); + mComboWidth->setVisible( true ); + mComboWidth->setEnabled( true ); createTxtBox( Vector2i( 10, 80 ), "Max. Texture Atlas Height:" ); - mComboHeight = mTheme->createComboBox( mUIWindow->getContainer(), Sizei( 100, 22 ), Vector2i( PosX, 80 ), UI_CONTROL_DEFAULT_FLAGS | UI_CLIP_ENABLE | UI_AUTO_PADDING | UI_AUTO_SIZE ); + + mComboHeight = eeNew( UIComboBox, () ); + mComboHeight->setParent( mUIWindow->getContainer() ); + mComboHeight->setSize( 100, 0 ); + mComboHeight->setPosition( PosX, 80 ); + mComboHeight->setVisible( true ); + mComboHeight->setEnabled( true ); std::vector Sizes; diff --git a/src/eepp/ui/uicombobox.cpp b/src/eepp/ui/uicombobox.cpp index 495e7a86e..6e0c8c752 100644 --- a/src/eepp/ui/uicombobox.cpp +++ b/src/eepp/ui/uicombobox.cpp @@ -4,20 +4,18 @@ namespace EE { namespace UI { UIComboBox::UIComboBox( UIComboBox::CreateParams& Params ) : - UIDropDownList( Params ), + UIComplexControl( Params ), + mDropDownList( NULL ), mButton( NULL ) { - setAllowEditing( true ); - applyDefaultTheme(); } UIComboBox::UIComboBox() : - UIDropDownList(), + UIComplexControl(), + mDropDownList( NULL ), mButton( NULL ) { - setAllowEditing( true ); - applyDefaultTheme(); } @@ -29,83 +27,91 @@ Uint32 UIComboBox::getType() const { } bool UIComboBox::isType( const Uint32& type ) const { - return UIComboBox::getType() == type ? true : UIDropDownList::isType( type ); + return UIComboBox::getType() == type ? true : UIComplexControl::isType( type ); } void UIComboBox::setTheme( UITheme * Theme ) { - UIControl::setThemeControl( Theme, "combobox" ); - - autoSizeControl(); - - autoPadding(); - - onSizeChange(); -} - -void UIComboBox::createButton() { - 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->getDpSize().getWidth(); - } + if ( NULL == mDropDownList ) { + mDropDownList = eeNew( UIDropDownList, () ); + mDropDownList->setParent( this ); + mDropDownList->setVisible( true ); + mDropDownList->setEnabled( true ); + mDropDownList->setAllowEditing( true ); + mDropDownList->getInputTextBuffer()->setFreeEditing( true ); + mDropDownList->setFriendControl( this ); } if ( NULL == mButton ) { - mButton = eeNew( UIControl, () ); + mButton = eeNew( UIComplexControl, () ); mButton->setParent( this ); mButton->setVisible( true ); mButton->setEnabled( 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 ) ); - } - mButton->setSize( btnWidth, mSize.getHeight() ); - mButton->setPosition( mSize.getWidth() - btnWidth, 0 ); + mDropDownList->setThemeControl( Theme, "combobox" ); + mDropDownList->doAftersetTheme(); + + mButton->setThemeControl( Theme, "combobox_button" ); + + if ( NULL != mDropDownList->getSkin() ) { + setInternalHeight( mDropDownList->getSkin()->getSize().getHeight() ); + } + + if ( NULL != mButton->getSkin() ) { + mButton->setSize( mButton->getSkin()->getSize() ); + } + + updateControls(); +} + +UIListBox *UIComboBox::getListBox() { + return mDropDownList->getListBox(); +} + +InputTextBuffer *UIComboBox::getInputTextBuffer() { + return mDropDownList->getInputTextBuffer(); +} + +const String& UIComboBox::getText() { + return mDropDownList->getText(); +} + +void UIComboBox::updateControls() { + if ( ( mFlags & UI_AUTO_SIZE ) || 0 == mSize.getHeight() ) { + setInternalHeight( mDropDownList->getSkin()->getSize().getHeight() ); + } + + mDropDownList->setPosition( 0, 0 ); + mDropDownList->setSize( mSize.getWidth() - mButton->getSize().getWidth(), mSize.getHeight() ); + mDropDownList->getListBox()->setSize( mSize.getWidth(), mDropDownList->getListBox()->getSize().getHeight() ); + + mButton->setPosition( mSize.getWidth() - mButton->getSize().getWidth(), 0 ); + mButton->centerVertical(); } void UIComboBox::onButtonClick( const UIEvent * Event ) { const UIEventMouse * MEvent = reinterpret_cast ( Event ); if ( MEvent->getFlags() & EE_BUTTON_LMASK ) { - showListBox(); + mDropDownList->showList(); } } -void UIComboBox::onButtonEnter( const UIEvent * Event ) { - setSkinState( UISkinState::StateMouseEnter ); -} - -void UIComboBox::onButtonExit( const UIEvent * Event ) { - setSkinState( UISkinState::StateMouseExit ); -} - -Uint32 UIComboBox::onMouseClick( const Vector2i& position, const Uint32 Flags ) { - if ( Flags & EE_BUTTON_LMASK ) { - UITextInput::onMouseClick( position, Flags ); - - if ( mListBox->isVisible() ) { - hide(); - } - } - - return 1; -} - -void UIComboBox::onControlClear( const UIEvent *Event ) { -} - void UIComboBox::onSizeChange() { - UIDropDownList::onSizeChange(); + UIComplexControl::onSizeChange(); - createButton(); + updateControls(); +} + +void UIComboBox::onPositionChange() { + UIComplexControl::onPositionChange(); + + updateControls(); +} + +void UIComboBox::onParentChange() { + //mButton->centerVertical(); } }} diff --git a/src/eepp/ui/uicomplexcontrol.cpp b/src/eepp/ui/uicomplexcontrol.cpp index 55ab9cadd..60c05c29a 100644 --- a/src/eepp/ui/uicomplexcontrol.cpp +++ b/src/eepp/ui/uicomplexcontrol.cpp @@ -134,7 +134,7 @@ void UIComplexControl::tooltipRemove() { mTooltip = NULL; } -void UIComplexControl::setSize( const Sizei& size ) { +UIControl * UIComplexControl::setSize( const Sizei& size ) { Sizei s( size ); if ( s.x < mMinControlSize.x ) @@ -143,11 +143,11 @@ void UIComplexControl::setSize( const Sizei& size ) { if ( s.y < mMinControlSize.y ) s.y = mMinControlSize.y; - UIControlAnim::setSize( s ); + return UIControlAnim::setSize( s ); } -void UIComplexControl::setSize( const Int32& Width, const Int32& Height ) { - UIControlAnim::setSize( Width, Height ); +UIControl * UIComplexControl::setSize( const Int32& Width, const Int32& Height ) { + return UIControlAnim::setSize( Width, Height ); } const Sizei& UIComplexControl::getSize() { diff --git a/src/eepp/ui/uicontrol.cpp b/src/eepp/ui/uicontrol.cpp index 454157940..ee6ecebc4 100644 --- a/src/eepp/ui/uicontrol.cpp +++ b/src/eepp/ui/uicontrol.cpp @@ -153,13 +153,15 @@ void UIControl::setInternalPosition( const Vector2i& Pos ) { mRealPos = Vector2i( Pos.x * PixelDensity::getPixelDensity(), Pos.y * PixelDensity::getPixelDensity() ); } -void UIControl::setPosition( const Vector2i& Pos ) { +UIControl * UIControl::setPosition( const Vector2i& Pos ) { setInternalPosition( Pos ); onPositionChange(); + return this; } -void UIControl::setPosition( const Int32& x, const Int32& y ) { +UIControl * UIControl::setPosition( const Int32& x, const Int32& y ) { setPosition( Vector2i( x, y ) ); + return this; } void UIControl::setPixelsPosition( const Vector2i& Pos ) { @@ -190,7 +192,7 @@ void UIControl::setInternalPixelsSize( const Sizei& size ) { mRealSize = size; } -void UIControl::setSize( const Sizei& Size ) { +UIControl * UIControl::setSize( const Sizei& Size ) { if ( Size != mSize ) { Vector2i sizeChange( Size.x - mSize.x, Size.y - mSize.y ); @@ -202,10 +204,13 @@ void UIControl::setSize( const Sizei& Size ) { sendParentSizeChange( sizeChange ); } } + + return this; } -void UIControl::setSize( const Int32& Width, const Int32& Height ) { +UIControl * UIControl::setSize( const Int32& Width, const Int32& Height ) { setSize( Sizei( Width, Height ) ); + return this; } void UIControl::setPixelsSize( const Sizei & size ) { @@ -244,9 +249,10 @@ const Sizei& UIControl::getRealSize() { return mRealSize; } -void UIControl::setVisible( const bool& visible ) { +UIControl * UIControl::setVisible( const bool& visible ) { mVisible = visible; onVisibleChange(); + return this; } bool UIControl::isVisible() const { @@ -257,9 +263,10 @@ bool UIControl::isHided() const { return !mVisible; } -void UIControl::setEnabled( const bool& enabled ) { +UIControl * UIControl::setEnabled( const bool& enabled ) { mEnabled = enabled; onEnabledChange(); + return this; } bool UIControl::isEnabled() const { @@ -274,9 +281,9 @@ UIControl * UIControl::getParent() const { return mParentCtrl; } -void UIControl::setParent( UIControl * parent ) { +UIControl * UIControl::setParent( UIControl * parent ) { if ( parent == mParentCtrl ) - return; + return this; if ( NULL != mParentCtrl ) mParentCtrl->childRemove( this ); @@ -285,6 +292,10 @@ void UIControl::setParent( UIControl * parent ) { if ( NULL != mParentCtrl ) mParentCtrl->childAdd( this ); + + onParentChange(); + + return this; } bool UIControl::isParentOf( UIControl * Ctrl ) { @@ -1221,6 +1232,9 @@ void UIControl::setSkin( const UISkin& Skin ) { void UIControl::onStateChange() { } +void UIControl::onParentChange() { +} + void UIControl::setSkinState( const Uint32& State ) { if ( NULL != mSkinState ) { mSkinState->setState( State ); diff --git a/src/eepp/ui/uidefaulttheme.cpp b/src/eepp/ui/uidefaulttheme.cpp index 579f1bf87..4ec0a1547 100644 --- a/src/eepp/ui/uidefaulttheme.cpp +++ b/src/eepp/ui/uidefaulttheme.cpp @@ -156,9 +156,6 @@ UIComboBox * UIDefaultTheme::createComboBox( UIControl * Parent, const Sizei& Si ComboParams.setPosition( Pos ); ComboParams.setSize( Size ); ComboParams.Flags = Flags; - ComboParams.MinNumVisibleItems = MinNumVisibleItems; - ComboParams.PopUpToMainControl = PopUpToMainControl; - ComboParams.ListBox = ListBox; if ( getUseDefaultThemeValues() ) { ComboParams.Flags |= UI_AUTO_SIZE | UI_TEXT_SELECTION_ENABLED; diff --git a/src/eepp/ui/uidropdownlist.cpp b/src/eepp/ui/uidropdownlist.cpp index ce49b6333..c04c51945 100644 --- a/src/eepp/ui/uidropdownlist.cpp +++ b/src/eepp/ui/uidropdownlist.cpp @@ -6,6 +6,7 @@ namespace EE { namespace UI { UIDropDownList::UIDropDownList( UIDropDownList::CreateParams& Params ) : UITextInput( Params ), mListBox( Params.ListBox ), + mFriendCtrl( NULL ), mMinNumVisibleItems( Params.MinNumVisibleItems ), mPopUpToMainControl( Params.PopUpToMainControl ) { @@ -49,6 +50,7 @@ UIDropDownList::UIDropDownList( UIDropDownList::CreateParams& Params ) : UIDropDownList::UIDropDownList() : UITextInput(), mListBox( NULL ), + mFriendCtrl( NULL ), mMinNumVisibleItems( 10 ), mPopUpToMainControl( false ) { @@ -58,20 +60,6 @@ UIDropDownList::UIDropDownList() : applyDefaultTheme(); - Uint32 flags = UI_CLIP_ENABLE | UI_AUTO_PADDING; - - UITheme * Theme = UIThemeManager::instance()->getDefaultTheme(); - - if ( NULL != Theme ) { - mListBox = Theme->createListBox( NULL, Sizei( mSize.getWidth(), mMinNumVisibleItems * mSize.getHeight() ),Vector2i(), flags ); - } else { - UIListBox::CreateParams LBParams; - LBParams.Size = Sizei( mSize.getWidth(), mMinNumVisibleItems * mSize.getHeight() ); - LBParams.Flags = flags; - LBParams.FontSelectedColor = ColorA( 255, 255, 255, 255 ); - - } - mListBox = eeNew( UIListBox, () ); mListBox->setSize( mSize.getWidth(), mMinNumVisibleItems * mSize.getHeight() ); mListBox->setEnabled( false ); @@ -100,11 +88,7 @@ bool UIDropDownList::isType( const Uint32& type ) const { void UIDropDownList::setTheme( UITheme * Theme ) { UIControl::setThemeControl( Theme, "dropdownlist" ); - autoSizeControl(); - - autoPadding(); - - onSizeChange(); + doAftersetTheme(); } void UIDropDownList::onSizeChange() { @@ -119,6 +103,16 @@ void UIDropDownList::autoSizeControl() { } } +void UIDropDownList::doAftersetTheme() { + autoPadding(); + + autoSizeControl(); +} + +void UIDropDownList::setFriendControl( UIControl * friendCtrl ) { + mFriendCtrl = friendCtrl; +} + void UIDropDownList::autoSize() { } @@ -127,16 +121,20 @@ UIListBox * UIDropDownList::getListBox() const { } Uint32 UIDropDownList::onMouseClick( const Vector2i& Pos, const Uint32 Flags ) { - if ( Flags & EE_BUTTON_LMASK ) - showListBox(); + if ( ( Flags & EE_BUTTON_LMASK ) && NULL == mFriendCtrl ) + showList(); + + if ( NULL != mFriendCtrl ) { + UITextInput::onMouseClick( Pos, Flags ); + } return 1; } -void UIDropDownList::showListBox() { +void UIDropDownList::showList() { if ( !mListBox->isVisible() ) { if ( !mPopUpToMainControl ) - mListBox->setParent( getParent() ); + mListBox->setParent( NULL != mFriendCtrl ? mFriendCtrl->getParent() : getParent() ); else mListBox->setParent( UIManager::instance()->getMainControl() ); @@ -146,6 +144,9 @@ void UIDropDownList::showListBox() { if ( mPopUpToMainControl ) { getParent()->controlToWorld( Pos ); + Pos = PixelDensity::pxToDpI( Pos ); + } else if ( NULL != mFriendCtrl ) { + Pos = Vector2i( mFriendCtrl->getPosition().x, mFriendCtrl->getPosition().y + mFriendCtrl->getSize().getHeight() ); } mListBox->setPosition( Pos ); @@ -156,9 +157,9 @@ void UIDropDownList::showListBox() { Float sliderValue = mListBox->getVerticalScrollBar()->getValue(); if ( mMinNumVisibleItems < mListBox->getCount() ) - mListBox->setSize( mSize.getWidth(), (Int32)( mMinNumVisibleItems * mListBox->getRowHeight() ) + tPadding.Top + tPadding.Bottom ); + mListBox->setSize( NULL != mFriendCtrl ? mFriendCtrl->getSize().getWidth() : mSize.getWidth(), (Int32)( mMinNumVisibleItems * mListBox->getRowHeight() ) + tPadding.Top + tPadding.Bottom ); else { - mListBox->setSize( mSize.getWidth(), (Int32)( mListBox->getCount() * mListBox->getRowHeight() ) + tPadding.Top + tPadding.Bottom ); + mListBox->setSize( NULL != mFriendCtrl ? mFriendCtrl->getSize().getWidth() : mSize.getWidth(), (Int32)( mListBox->getCount() * mListBox->getRowHeight() ) + tPadding.Top + tPadding.Bottom ); } mListBox->updateQuad(); @@ -171,6 +172,7 @@ void UIDropDownList::showListBox() { if ( mPopUpToMainControl ) { getParent()->controlToWorld( Pos ); + Pos = PixelDensity::pxToDpI( Pos ); } Pos.y -= mListBox->getSize().getHeight(); @@ -189,6 +191,22 @@ void UIDropDownList::showListBox() { } } +bool UIDropDownList::getPopUpToMainControl() const { + return mPopUpToMainControl; +} + +void UIDropDownList::setPopUpToMainControl(bool popUpToMainControl) { + mPopUpToMainControl = popUpToMainControl; +} + +Uint32 UIDropDownList::getMinNumVisibleItems() const { + return mMinNumVisibleItems; +} + +void UIDropDownList::setMinNumVisibleItems(const Uint32 & minNumVisibleItems) { + mMinNumVisibleItems = minNumVisibleItems; +} + void UIDropDownList::onControlClear( const UIEvent * Event ) { setText( "" ); } @@ -201,7 +219,10 @@ void UIDropDownList::onItemKeyDown( const UIEvent * Event ) { } void UIDropDownList::onListBoxFocusLoss( const UIEvent * Event ) { - if ( UIManager::instance()->getFocusControl() != this && !isChild( UIManager::instance()->getFocusControl() ) ) { + bool frienIsFocus = NULL != mFriendCtrl && mFriendCtrl == UIManager::instance()->getFocusControl(); + bool isChildFocus = isChild( UIManager::instance()->getFocusControl() ); + + if ( UIManager::instance()->getFocusControl() != this && !isChildFocus && !frienIsFocus ) { hide(); } } diff --git a/src/eepp/ui/uiscrollbar.cpp b/src/eepp/ui/uiscrollbar.cpp index ef2f7b065..219edaa26 100644 --- a/src/eepp/ui/uiscrollbar.cpp +++ b/src/eepp/ui/uiscrollbar.cpp @@ -279,10 +279,12 @@ UI_ORIENTATION UIScrollBar::getOrientation() const { return mSlider->getOrientation(); } -void UIScrollBar::setOrientation( const UI_ORIENTATION & orientation ) { +UIControl * UIScrollBar::setOrientation( const UI_ORIENTATION & orientation ) { mSlider->setOrientation( orientation ); applyDefaultTheme(); + + return this; } diff --git a/src/eepp/ui/uislider.cpp b/src/eepp/ui/uislider.cpp index c1c534e2c..ebce9750b 100644 --- a/src/eepp/ui/uislider.cpp +++ b/src/eepp/ui/uislider.cpp @@ -377,10 +377,12 @@ UI_ORIENTATION UISlider::getOrientation() const { return mOrientation; } -void UISlider::setOrientation( const UI_ORIENTATION & orientation ) { +UIControl * UISlider::setOrientation( const UI_ORIENTATION & orientation ) { mOrientation = orientation; applyDefaultTheme(); + + return this; } bool UISlider::getAllowHalfSliderOut() const { diff --git a/src/eepp/ui/uitextinput.cpp b/src/eepp/ui/uitextinput.cpp index 7c5e28065..a71a4f0fb 100644 --- a/src/eepp/ui/uitextinput.cpp +++ b/src/eepp/ui/uitextinput.cpp @@ -30,7 +30,7 @@ UITextInput::UITextInput() : mAllowEditing( true ), mShowingWait( true ) { - setFlags( UI_CLIP_ENABLE | UI_AUTO_PADDING | UI_AUTO_SIZE ); + setFlags( UI_CLIP_ENABLE | UI_AUTO_PADDING | UI_AUTO_SIZE | UI_TEXT_SELECTION_ENABLED ); mTextBuffer.start(); mTextBuffer.setActive( false ); diff --git a/src/eepp/ui/uitheme.cpp b/src/eepp/ui/uitheme.cpp index be67e2338..699982cc5 100644 --- a/src/eepp/ui/uitheme.cpp +++ b/src/eepp/ui/uitheme.cpp @@ -73,6 +73,7 @@ static void loadThemeElements( std::list& UI_THEME_ELEMENTS, std::l UI_THEME_ELEMENTS.push_back( "listboxitem" ); UI_THEME_ELEMENTS.push_back( "dropdownlist" ); UI_THEME_ELEMENTS.push_back( "combobox" ); + UI_THEME_ELEMENTS.push_back( "combobox_button" ); UI_THEME_ELEMENTS.push_back( "menu" ); UI_THEME_ELEMENTS.push_back( "menuitem" ); UI_THEME_ELEMENTS.push_back( "separator" ); @@ -594,9 +595,7 @@ UIComboBox * UITheme::createComboBox( UIControl * Parent, const Sizei& Size, con ComboParams.setPosition( Pos ); ComboParams.setSize( Size ); ComboParams.Flags = Flags; - ComboParams.MinNumVisibleItems = MinNumVisibleItems; - ComboParams.PopUpToMainControl = PopUpToMainControl; - ComboParams.ListBox = ListBox; + UIComboBox * Ctrl = eeNew( UIComboBox, ( ComboParams ) ); Ctrl->setVisible( true ); Ctrl->setEnabled( true ); diff --git a/src/eepp/ui/uiwindow.cpp b/src/eepp/ui/uiwindow.cpp index 564bf6fb2..711124c85 100644 --- a/src/eepp/ui/uiwindow.cpp +++ b/src/eepp/ui/uiwindow.cpp @@ -309,7 +309,7 @@ void UIWindow::onSizeChange() { } } -void UIWindow::setSize( const Sizei& Size ) { +UIControl * UIWindow::setSize( const Sizei& Size ) { if ( NULL != mWindowDecoration ) { Sizei size = Size; @@ -320,10 +320,13 @@ void UIWindow::setSize( const Sizei& Size ) { } else { UIComplexControl::setSize( Size ); } + + return this; } -void UIWindow::setSize( const Int32& Width, const Int32& Height ) { +UIControl * UIWindow::setSize( const Int32& Width, const Int32& Height ) { setSize( Sizei( Width, Height ) ); + return this; } const Sizei& UIWindow::getSize() { diff --git a/src/test/eetest.cpp b/src/test/eetest.cpp index d9c50657b..ac4481174 100644 --- a/src/test/eetest.cpp +++ b/src/test/eetest.cpp @@ -265,7 +265,7 @@ void EETest::createUI() { eePRINTL( "Texture Atlas Loading Time: %4.3f ms.", TE.getElapsed().asMilliseconds() ); - UIManager::instance()->init(UI_MANAGER_DRAW_BOXES | UI_MANAGER_HIGHLIGHT_FOCUS | UI_MANAGER_HIGHLIGHT_OVER); // UI_MANAGER_DRAW_BOXES | UI_MANAGER_HIGHLIGHT_FOCUS | UI_MANAGER_HIGHLIGHT_OVER + UIManager::instance()->init(); // UI_MANAGER_DRAW_BOXES | UI_MANAGER_HIGHLIGHT_FOCUS | UI_MANAGER_HIGHLIGHT_OVER //mTheme = UITheme::LoadFromPath( eeNew( UIdefaultTheme, ( mThemeName, mThemeName ) ), MyPath + mThemeName + "/" ); @@ -588,94 +588,58 @@ void EETest::createUI() { /**/ UIRadioButton * ctrl = eeNew( UIRadioButton, () ); - ctrl->setPosition( 100, 100 ); - ctrl->setSize( 320, 32 ); + ctrl->setPosition( 50, 100 )->setSize( 320, 32 )->setVisible( true )->setEnabled( true ); ctrl->setBackgroundFillEnabled( true )->setColor( 0x33333333 ); ctrl->setBorderEnabled( true )->setColor( 0x66666666 ); - ctrl->setVisible( true ); - ctrl->setEnabled( true ); ctrl->setText( "Happy RadioButon :)" ); ctrl->setFontColor( 0x000000FF ); UICheckBox * cbox = eeNew( UICheckBox, () ); - cbox->setPosition( 100, 164 ); - cbox->setSize( 320, 32 ); + cbox->setPosition( 50, 164 )->setSize( 320, 32 )->setVisible( true )->setEnabled( true ); cbox->setBackgroundFillEnabled( true )->setColor( 0x33333333 ); cbox->setBorderEnabled( true )->setColor( 0x66666666 ); - cbox->setVisible( true ); - cbox->setEnabled( true ); cbox->setText( "Happy CheckBox :)" ); cbox->setFontColor( 0x000000FF ); UIGfx * gfx = eeNew( UIGfx, () ); - gfx->setPosition( 100, 132 ); - gfx->setSize( 16, 16 ); + gfx->setPosition( 50, 132 )->setSize( 16, 16 )->setVisible( true )->setEnabled( true ); gfx->setBackgroundFillEnabled( true )->setColor( 0x33333333 ); gfx->setSubTexture( mTheme->getIconByName( "ok" ) ); - gfx->setVisible( true ); - gfx->setEnabled( true ); UISlider * slider = eeNew( UISlider, () ); - slider->setPosition( 50, 100 ); - slider->setSize( 100, 100 ); - slider->setVisible( true ); - slider->setEnabled( true ); - slider->setOrientation( UI_HORIZONTAL ); + slider->setOrientation( UI_HORIZONTAL )->setPosition( 50, 0 )->setSize( 100, 100 )->setVisible( true )->setEnabled( true ); slider->setAllowHalfSliderOut( true ); UISlider * slider2 = eeNew( UISlider, () ); - slider2->setPosition( 50, 25 ); - slider2->setSize( 100, 100 ); - slider2->setVisible( true ); - slider2->setEnabled( true ); - slider2->setOrientation( UI_VERTICAL ); + slider2->setOrientation( UI_VERTICAL )->setPosition( 100, 0 )->setSize( 100, 100 )->setVisible( true )->setEnabled( true ); slider2->setAllowHalfSliderOut( true ); UITextInput * textInput = eeNew( UITextInput, () ); - textInput->setPosition( 50, 210 ); - textInput->setSize( 100, 0 ); - textInput->setVisible( true ); - textInput->setEnabled( true ); + textInput->setPosition( 50, 210 )->setSize( 200, 0 )->setVisible( true )->setEnabled( true ); + + UIListBox * listBox = eeNew( UIListBox, () ); + listBox->setPosition( 50, 320 )->setSize( 200, 160 )->setVisible( true )->setEnabled( true ); + listBox->addListBoxItems( str ); + + UIScrollBar * scrollBar = eeNew( UIScrollBar, () ); + scrollBar->setOrientation( UI_HORIZONTAL )->setPosition( 200, 0 )->setSize( 100, 0 )->setVisible( true )->setEnabled( true ); + + UIScrollBar * scrollBar2 = eeNew( UIScrollBar, () ); + scrollBar2->setOrientation( UI_VERTICAL )->setPosition( 300, 0 )->setSize( 0, 100 )->setVisible( true )->setEnabled( true ); UIDropDownList * dropdownList = eeNew( UIDropDownList, () ); - dropdownList->setPosition( 50, 250 ); - dropdownList->setSize( 100, 0 ); - dropdownList->setVisible( true ); - dropdownList->setEnabled( true ); + dropdownList->setPosition( 50, 240 )->setSize( 200, 0 )->setVisible( true )->setEnabled( true ); dropdownList->getListBox()->addListBoxItem( "Test 1" ); dropdownList->getListBox()->addListBoxItem( "Test 2" ); dropdownList->getListBox()->addListBoxItem( "Test 3" ); UIComboBox * comboBox = eeNew( UIComboBox, () ); - comboBox->setPosition( 50, 280 ); - comboBox->setSize( 100, 0 ); - comboBox->setVisible( true ); - comboBox->setEnabled( true ); - comboBox->getListBox()->addListBoxItem( "Test 1" ); - comboBox->getListBox()->addListBoxItem( "Test 2" ); - comboBox->getListBox()->addListBoxItem( "Test 3" ); + comboBox->setPosition( 50, 280 )->setSize( 200, 0 )->setVisible( true )->setEnabled( true ); + comboBox->getListBox()->addListBoxItem( "Test 1234" ); + comboBox->getListBox()->addListBoxItem( "Test 2345" ); + comboBox->getListBox()->addListBoxItem( "Test 3567" ); comboBox->getListBox()->setSelected( 0 ); - UIListBox * listBox = eeNew( UIListBox, () ); - listBox->setPosition( 50, 320 ); - listBox->setSize( 200, 160 ); - listBox->setVisible( true ); - listBox->setEnabled( true ); - listBox->addListBoxItems( str ); - - UIScrollBar * scrollBar = eeNew( UIScrollBar, () ); - scrollBar->setOrientation( UI_HORIZONTAL ); - scrollBar->setPosition( 200, 150 ); - scrollBar->setSize( 100, 0 ); - scrollBar->setVisible( true ); - scrollBar->setEnabled( true ); - - UIScrollBar * scrollBar2 = eeNew( UIScrollBar, () ); - scrollBar2->setOrientation( UI_VERTICAL ); - scrollBar2->setPosition( 200, 25 ); - scrollBar2->setSize( 0, 100 ); - scrollBar2->setVisible( true ); - scrollBar2->setEnabled( true ); } void EETest::createMapEditor() {