mirror of
https://github.com/SpartanJ/eepp.git
synced 2026-08-14 13:15:14 +03:00
Minor clean up.
--HG-- branch : dev
This commit is contained in:
@@ -23,14 +23,14 @@ class EE_API UIComboBox : public UIComplexControl {
|
||||
|
||||
UIDropDownList * getDropDownList() const { return mDropDownList; }
|
||||
|
||||
UIComplexControl * getButton() const { return mButton; }
|
||||
UIControlAnim * getButton() const { return mButton; }
|
||||
|
||||
InputTextBuffer * getInputTextBuffer();
|
||||
|
||||
const String& getText();
|
||||
protected:
|
||||
UIDropDownList * mDropDownList;
|
||||
UIComplexControl * mButton;
|
||||
UIControlAnim * mButton;
|
||||
|
||||
void onButtonClick( const UIEvent * Event );
|
||||
|
||||
|
||||
@@ -53,6 +53,8 @@ class EE_API UIComplexControl : public UIControlAnim {
|
||||
virtual void onPositionChange();
|
||||
|
||||
virtual void onAutoSize();
|
||||
|
||||
void updateAnchors( const Vector2i & SizeChange );
|
||||
};
|
||||
|
||||
}}
|
||||
|
||||
@@ -16,17 +16,21 @@ class EE_API UIDragable : public UIControl {
|
||||
virtual bool isType( const Uint32& type ) const;
|
||||
|
||||
bool isDragging() const;
|
||||
|
||||
void setDragging( const bool& dragging );
|
||||
|
||||
const Vector2i& getDragPoint() const;
|
||||
|
||||
void setDragPoint( const Vector2i& Point );
|
||||
|
||||
virtual void update();
|
||||
|
||||
bool isDragEnabled() const;
|
||||
|
||||
void setDragEnabled( const bool& enable );
|
||||
|
||||
void setDragButton( const Uint32& Button );
|
||||
|
||||
const Uint32& getDragButton() const;
|
||||
protected:
|
||||
virtual ~UIDragable();
|
||||
|
||||
@@ -35,11 +35,11 @@ class EE_API UIWindow : public UIComplexControl {
|
||||
|
||||
UIControlAnim * getContainer() const;
|
||||
|
||||
UIComplexControl * getButtonClose() const;
|
||||
UIControlAnim * getButtonClose() const;
|
||||
|
||||
UIComplexControl * getButtonMaximize() const;
|
||||
UIControlAnim * getButtonMaximize() const;
|
||||
|
||||
UIComplexControl * getButtonMinimize() const;
|
||||
UIControlAnim * getButtonMinimize() const;
|
||||
|
||||
virtual void draw();
|
||||
|
||||
@@ -69,7 +69,7 @@ class EE_API UIWindow : public UIComplexControl {
|
||||
|
||||
bool isModal();
|
||||
|
||||
UIControlAnim * getModalControl() const;
|
||||
UIComplexControl * getModalControl() const;
|
||||
|
||||
void maximize();
|
||||
|
||||
@@ -127,12 +127,12 @@ class EE_API UIWindow : public UIComplexControl {
|
||||
UIControlAnim * mBorderLeft;
|
||||
UIControlAnim * mBorderRight;
|
||||
UIControlAnim * mBorderBottom;
|
||||
UIComplexControl * mContainer;
|
||||
UIControlAnim * mContainer;
|
||||
|
||||
UIComplexControl * mButtonClose;
|
||||
UIComplexControl * mButtonMinimize;
|
||||
UIComplexControl * mButtonMaximize;
|
||||
UITextBox * mTitle;
|
||||
UIControlAnim * mButtonClose;
|
||||
UIControlAnim * mButtonMinimize;
|
||||
UIControlAnim * mButtonMaximize;
|
||||
UITextBox * mTitle;
|
||||
|
||||
UIComplexControl * mModalCtrl;
|
||||
|
||||
|
||||
@@ -38,7 +38,7 @@ void UIComboBox::setTheme( UITheme * Theme ) {
|
||||
}
|
||||
|
||||
if ( NULL == mButton ) {
|
||||
mButton = UIComplexControl::New();
|
||||
mButton = UIControlAnim::New();
|
||||
mButton->setParent( this );
|
||||
mButton->setVisible( true );
|
||||
mButton->setEnabled( true );
|
||||
|
||||
@@ -168,11 +168,25 @@ const Sizei& UIComplexControl::getSize() {
|
||||
}
|
||||
|
||||
void UIComplexControl::onParentSizeChange( const Vector2i& SizeChange ) {
|
||||
updateAnchors( SizeChange );
|
||||
UIControlAnim::onParentSizeChange( SizeChange );
|
||||
}
|
||||
|
||||
void UIComplexControl::onPositionChange() {
|
||||
updateAnchorsDistances();
|
||||
UIControlAnim::onPositionChange();
|
||||
}
|
||||
|
||||
void UIComplexControl::onAutoSize() {
|
||||
}
|
||||
|
||||
void UIComplexControl::updateAnchors( const Vector2i& SizeChange ) {
|
||||
if ( !( mFlags & ( UI_ANCHOR_LEFT | UI_ANCHOR_TOP | UI_ANCHOR_RIGHT | UI_ANCHOR_BOTTOM ) ) )
|
||||
return;
|
||||
|
||||
Sizei newSize( mSize );
|
||||
|
||||
if ( mFlags & UI_ANCHOR_LEFT ) {
|
||||
// Nothing ?
|
||||
} else {
|
||||
if ( !( mFlags & UI_ANCHOR_LEFT ) ) {
|
||||
setInternalPosition( Vector2i( mPos.x += SizeChange.x, mPos.y ) );
|
||||
}
|
||||
|
||||
@@ -185,9 +199,7 @@ void UIComplexControl::onParentSizeChange( const Vector2i& SizeChange ) {
|
||||
}
|
||||
}
|
||||
|
||||
if ( mFlags & UI_ANCHOR_TOP ) {
|
||||
// Nothing ?
|
||||
} else {
|
||||
if ( !( mFlags & UI_ANCHOR_TOP ) ) {
|
||||
setInternalPosition( Vector2i( mPos.x, mPos.y += SizeChange.y ) );
|
||||
}
|
||||
|
||||
@@ -202,16 +214,6 @@ void UIComplexControl::onParentSizeChange( const Vector2i& SizeChange ) {
|
||||
|
||||
if ( newSize != mSize )
|
||||
setSize( newSize );
|
||||
|
||||
UIControlAnim::onParentSizeChange( SizeChange );
|
||||
}
|
||||
|
||||
void UIComplexControl::onPositionChange() {
|
||||
updateAnchorsDistances();
|
||||
UIControlAnim::onPositionChange();
|
||||
}
|
||||
|
||||
void UIComplexControl::onAutoSize() {
|
||||
}
|
||||
|
||||
}}
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
|
||||
namespace EE { namespace UI {
|
||||
|
||||
UIControl *UIControl::New() {
|
||||
UIControl * UIControl::New() {
|
||||
return eeNew( UIControl, () );
|
||||
}
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
|
||||
namespace EE { namespace UI {
|
||||
|
||||
UIControlAnim *UIControlAnim::New() {
|
||||
UIControlAnim * UIControlAnim::New() {
|
||||
return eeNew( UIControlAnim, () );
|
||||
}
|
||||
|
||||
|
||||
@@ -34,7 +34,7 @@ UIWindow::UIWindow() :
|
||||
mStyleConfig = theme->getWindowStyleConfig();
|
||||
}
|
||||
|
||||
mContainer = UIComplexControl::New();
|
||||
mContainer = UIControlAnim::New();
|
||||
mContainer->setParent( this );
|
||||
mContainer->setFlags( UI_REPORT_SIZE_CHANGE_TO_CHILDS );
|
||||
mContainer->setSize( mSize );
|
||||
@@ -92,7 +92,7 @@ void UIWindow::updateWinFlags() {
|
||||
|
||||
if ( mStyleConfig.WinFlags & UI_WIN_CLOSE_BUTTON ) {
|
||||
if ( NULL == mButtonClose ) {
|
||||
mButtonClose = UIComplexControl::New();
|
||||
mButtonClose = UIControlAnim::New();
|
||||
needsUpdate = true;
|
||||
}
|
||||
|
||||
@@ -103,11 +103,14 @@ void UIWindow::updateWinFlags() {
|
||||
if ( mStyleConfig.WinFlags & UI_WIN_USE_DEFAULT_BUTTONS_ACTIONS && 0 == mCloseListener ) {
|
||||
mCloseListener = mButtonClose->addEventListener( UIEvent::EventMouseClick, cb::Make1( this, &UIWindow::onButtonCloseClick ) );
|
||||
}
|
||||
} else if ( NULL != mButtonClose ) {
|
||||
mButtonClose->setVisible( false )->setEnabled( false )->close();
|
||||
mButtonClose = NULL;
|
||||
}
|
||||
|
||||
if ( ( mStyleConfig.WinFlags & UI_WIN_RESIZEABLE ) && ( mStyleConfig.WinFlags & UI_WIN_MAXIMIZE_BUTTON ) ) {
|
||||
if ( NULL == mButtonMaximize ) {
|
||||
mButtonMaximize = UIComplexControl::New();
|
||||
mButtonMaximize = UIControlAnim::New();
|
||||
needsUpdate = true;
|
||||
}
|
||||
|
||||
@@ -118,11 +121,14 @@ void UIWindow::updateWinFlags() {
|
||||
if ( mStyleConfig.WinFlags & UI_WIN_USE_DEFAULT_BUTTONS_ACTIONS && 0 == mMaximizeListener ) {
|
||||
mMaximizeListener = mButtonMaximize->addEventListener( UIEvent::EventMouseClick, cb::Make1( this, &UIWindow::onButtonMaximizeClick ) );
|
||||
}
|
||||
} else if ( NULL != mButtonMaximize ) {
|
||||
mButtonMaximize->setVisible( false )->setEnabled( false )->close();
|
||||
mButtonMaximize = NULL;
|
||||
}
|
||||
|
||||
if ( mStyleConfig.WinFlags & UI_WIN_MINIMIZE_BUTTON ) {
|
||||
if ( NULL == mButtonMinimize ) {
|
||||
mButtonMinimize = UIComplexControl::New();
|
||||
mButtonMinimize = UIControlAnim::New();
|
||||
needsUpdate = true;
|
||||
}
|
||||
|
||||
@@ -133,6 +139,9 @@ void UIWindow::updateWinFlags() {
|
||||
if ( mStyleConfig.WinFlags & UI_WIN_USE_DEFAULT_BUTTONS_ACTIONS && 0 == mMinimizeListener ) {
|
||||
mMinimizeListener = mButtonMinimize->addEventListener( UIEvent::EventMouseClick, cb::Make1( this, &UIWindow::onButtonMinimizeClick ) );
|
||||
}
|
||||
} else if ( NULL != mButtonMinimize ) {
|
||||
mButtonMinimize->setVisible( false )->setEnabled( false )->close();
|
||||
mButtonMinimize = NULL;
|
||||
}
|
||||
|
||||
setDragEnabled( true );
|
||||
@@ -766,15 +775,15 @@ UIControlAnim * UIWindow::getContainer() const {
|
||||
return mContainer;
|
||||
}
|
||||
|
||||
UIComplexControl * UIWindow::getButtonClose() const {
|
||||
UIControlAnim * UIWindow::getButtonClose() const {
|
||||
return mButtonClose;
|
||||
}
|
||||
|
||||
UIComplexControl * UIWindow::getButtonMaximize() const {
|
||||
UIControlAnim * UIWindow::getButtonMaximize() const {
|
||||
return mButtonMaximize;
|
||||
}
|
||||
|
||||
UIComplexControl * UIWindow::getButtonMinimize() const {
|
||||
UIControlAnim * UIWindow::getButtonMinimize() const {
|
||||
return mButtonMinimize;
|
||||
}
|
||||
|
||||
@@ -1018,7 +1027,7 @@ bool UIWindow::isModal() {
|
||||
return 0 != ( mStyleConfig.WinFlags & UI_WIN_MODAL );
|
||||
}
|
||||
|
||||
UIControlAnim * UIWindow::getModalControl() const {
|
||||
UIComplexControl * UIWindow::getModalControl() const {
|
||||
return mModalCtrl;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user