Renamed UIControl to UINode.

Removed UIControlAnim and UIDragableControl.
UIControlAnim and UIDragableControl implemented in base UINode.

--HG--
branch : dev-2.1
This commit is contained in:
Martí­n Lucas Golini
2018-01-02 02:37:23 -03:00
parent 04a605c684
commit e21daabe65
92 changed files with 1665 additions and 1959 deletions

View File

@@ -29,7 +29,7 @@ using namespace EE::Maps::Private;
namespace EE { namespace Maps {
static UITextView * createTextBox( const String& Text = "", UIControl * Parent = NULL, const Sizei& Size = Sizei(), const Vector2i& Pos = Vector2i(), const Uint32& Flags = UI_CONTROL_DEFAULT_FLAGS | UI_AUTO_SIZE, const Uint32& fontStyle = Text::Regular ) {
static UITextView * createTextBox( const String& Text = "", UINode * Parent = NULL, const Sizei& Size = Sizei(), const Vector2i& Pos = Vector2i(), const Uint32& Flags = UI_CONTROL_DEFAULT_FLAGS | UI_AUTO_SIZE, const Uint32& fontStyle = Text::Regular ) {
UITextView * Ctrl = UITextView::New();
Ctrl->setFontStyle( fontStyle );
Ctrl->resetFlags( Flags )->setParent( Parent )->setPosition( Pos )->setSize( Size )->setVisible( true )->setEnabled( false );

View File

@@ -3,7 +3,7 @@
namespace EE { namespace Maps { namespace Private {
static UITextView * createTextBox( const String& Text = "", UIControl * Parent = NULL, const Sizei& Size = Sizei(), const Vector2i& Pos = Vector2i(), const Uint32& Flags = UI_CONTROL_DEFAULT_FLAGS | UI_AUTO_SIZE, const Uint32& fontStyle = Text::Regular ) {
static UITextView * createTextBox( const String& Text = "", UINode * Parent = NULL, const Sizei& Size = Sizei(), const Vector2i& Pos = Vector2i(), const Uint32& Flags = UI_CONTROL_DEFAULT_FLAGS | UI_AUTO_SIZE, const Uint32& fontStyle = Text::Regular ) {
UITextView * Ctrl = UITextView::New();
Ctrl->setFontStyle( fontStyle );
Ctrl->resetFlags( Flags )->setParent( Parent )->setPosition( Pos )->setSize( Size )->setVisible( true )->setEnabled( false );

View File

@@ -2,7 +2,7 @@
namespace EE { namespace Maps { namespace Private {
static UITextView * createTextBox( const String& Text = "", UIControl * Parent = NULL, const Sizei& Size = Sizei(), const Vector2i& Pos = Vector2i(), const Uint32& Flags = UI_CONTROL_DEFAULT_FLAGS | UI_AUTO_SIZE, const Uint32& fontStyle = Text::Regular ) {
static UITextView * createTextBox( const String& Text = "", UINode * Parent = NULL, const Sizei& Size = Sizei(), const Vector2i& Pos = Vector2i(), const Uint32& Flags = UI_CONTROL_DEFAULT_FLAGS | UI_AUTO_SIZE, const Uint32& fontStyle = Text::Regular ) {
UITextView * Ctrl = UITextView::New();
Ctrl->setFontStyle( fontStyle );
Ctrl->resetFlags( Flags )->setParent( Parent )->setPosition( Pos )->setSize( Size )->setVisible( true )->setEnabled( false );

View File

@@ -2,7 +2,7 @@
namespace EE { namespace Maps { namespace Private {
static UITextView * createTextBox( const String& Text = "", UIControl * Parent = NULL, const Sizei& Size = Sizei(), const Vector2i& Pos = Vector2i(), const Uint32& Flags = UI_CONTROL_DEFAULT_FLAGS | UI_AUTO_SIZE, const Uint32& fontStyle = Text::Regular ) {
static UITextView * createTextBox( const String& Text = "", UINode * Parent = NULL, const Sizei& Size = Sizei(), const Vector2i& Pos = Vector2i(), const Uint32& Flags = UI_CONTROL_DEFAULT_FLAGS | UI_AUTO_SIZE, const Uint32& fontStyle = Text::Regular ) {
UITextView * Ctrl = UITextView::New();
Ctrl->setFontStyle( fontStyle );
Ctrl->resetFlags( Flags )->setParent( Parent )->setPosition( Pos )->setSize( Size )->setVisible( true )->setEnabled( false );

View File

@@ -25,7 +25,7 @@ TextureAtlasSubTextureEditor::TextureAtlasSubTextureEditor( TextureAtlasEditor *
mGfx->setVisible( true );
mGfx->setEnabled( true );
mDrag = UIDragableControl::New();
mDrag = UINode::New();
mDrag->setParent( this );
mDrag->setSize( 64000, 64000 );
mDrag->setEnabled( true );

View File

@@ -30,7 +30,7 @@ class EE_API TextureAtlasSubTextureEditor : public UIWidget {
protected:
UITheme * mTheme;
UISubTexture * mGfx;
UIDragableControl * mDrag;
UINode * mDrag;
Vector2i mUICenter;
TextureAtlasEditor * mEditor;

View File

@@ -1,16 +1,16 @@
#include <eepp/ui/uibackground.hpp>
#include <eepp/ui/uicontrol.hpp>
#include <eepp/ui/uinode.hpp>
#include <eepp/graphics/primitives.hpp>
using namespace EE::Graphics;
namespace EE { namespace UI {
UIBackground * UIBackground::New( UIControl * control ) {
UIBackground * UIBackground::New( UINode * control ) {
return eeNew( UIBackground, ( control ) );
}
UIBackground::UIBackground( UIControl * control ) :
UIBackground::UIBackground( UINode * control ) :
mControl( control ),
mBlendMode( BlendAlpha ),
mCorners(0),

View File

@@ -1,16 +1,16 @@
#include <eepp/ui/uiborder.hpp>
#include <eepp/ui/uicontrol.hpp>
#include <eepp/ui/uinode.hpp>
#include <eepp/graphics/primitives.hpp>
using namespace EE::Graphics;
namespace EE { namespace UI {
UIBorder * UIBorder::New( UIControl * control ) {
UIBorder * UIBorder::New( UINode * control ) {
return eeNew( UIBorder, ( control ) );
}
UIBorder::UIBorder( UIControl * control ) :
UIBorder::UIBorder( UINode * control ) :
mControl( control ),
mColor( Color::Black ),
mWidth( 1 )

View File

@@ -15,14 +15,14 @@ UICheckBox::UICheckBox() :
mActive( false ),
mTextSeparation( 4 )
{
mActiveButton = UIControlAnim::New();
mActiveButton = UINode::New();
mActiveButton->setVisible( false );
mActiveButton->setEnabled( true );
mActiveButton->setParent( this );
mActiveButton->setPosition( 0, 0 );
mActiveButton->setSize( 16, 16 );
mInactiveButton = UIControlAnim::New();
mInactiveButton = UINode::New();
mInactiveButton->setVisible( true );
mInactiveButton->setEnabled( true );
mInactiveButton->setParent( this );
@@ -150,11 +150,11 @@ void UICheckBox::onPaddingChange() {
mRealPadding.Left = mActiveButton->getRealPosition().x + mActiveButton->getRealSize().getWidth() + PixelDensity::dpToPxI( mTextSeparation );
}
UIControlAnim * UICheckBox::getActiveButton() const {
UINode * UICheckBox::getActiveButton() const {
return mActiveButton;
}
UIControlAnim * UICheckBox::getInactiveButton() const {
UINode * UICheckBox::getInactiveButton() const {
return mInactiveButton;
}

View File

@@ -39,7 +39,7 @@ void UIComboBox::setTheme( UITheme * Theme ) {
}
if ( NULL == mButton ) {
mButton = UIControlAnim::New();
mButton = UINode::New();
mButton->setParent( this );
mButton->setVisible( true );
mButton->setEnabled( true );

View File

@@ -1,480 +0,0 @@
#include <eepp/ui/uicontrolanim.hpp>
#include <eepp/ui/uimanager.hpp>
#include <eepp/graphics/renderer/renderer.hpp>
#include <eepp/graphics/globalbatchrenderer.hpp>
#include <eepp/graphics/primitives.hpp>
namespace EE { namespace UI {
UIControlAnim * UIControlAnim::New() {
return eeNew( UIControlAnim, () );
}
UIControlAnim::UIControlAnim() :
UIDragableControl(),
mAngle(0.f),
mScale(1.f,1.f),
mAlpha(255.f),
mAngleAnim(NULL),
mScaleAnim(NULL),
mAlphaAnim(NULL),
mMoveAnim(NULL)
{
mControlFlags |= UI_CTRL_FLAG_ANIM;
updateOriginPoint();
}
UIControlAnim::~UIControlAnim() {
eeSAFE_DELETE( mAlphaAnim );
eeSAFE_DELETE( mAngleAnim );
eeSAFE_DELETE( mScaleAnim );
eeSAFE_DELETE( mMoveAnim );
}
Uint32 UIControlAnim::getType() const {
return UI_TYPE_CONTROL_ANIM;
}
bool UIControlAnim::isType( const Uint32& type ) const {
return UIControlAnim::getType() == type ? true : UIControl::isType( type );
}
void UIControlAnim::drawSkin() {
if ( NULL != mSkinState ) {
if ( mFlags & UI_SKIN_KEEP_SIZE_ON_DRAW ) {
Sizei rSize = PixelDensity::dpToPxI( mSkinState->getSkin()->getSize( mSkinState->getState() ) );
Sizei diff = ( mRealSize - rSize ) / 2;
mSkinState->draw( mScreenPosf.x + diff.x, mScreenPosf.y + diff.y, (Float)rSize.getWidth(), (Float)rSize.getHeight(), (Uint32)mAlpha );
} else {
mSkinState->draw( mScreenPosf.x, mScreenPosf.y, (Float)mRealSize.getWidth(), (Float)mRealSize.getHeight(), (Uint32)mAlpha );
}
}
}
void UIControlAnim::draw() {
if ( mVisible && 0.f != mAlpha ) {
drawBackground();
drawBorder();
drawSkin();
drawHighlightFocus();
drawOverControl();
drawDebugData();
drawBox();
}
}
const Float& UIControlAnim::getRotation() const {
return mAngle;
}
const OriginPoint& UIControlAnim::getRotationOriginPoint() const {
return mRotationOriginPoint;
}
void UIControlAnim::setRotationOriginPoint( const OriginPoint & center ) {
mRotationOriginPoint = PixelDensity::dpToPx( center );
updateOriginPoint();
}
Vector2f UIControlAnim::getRotationCenter() {
switch ( mRotationOriginPoint.OriginType ) {
case OriginPoint::OriginCenter: return mCenter;
case OriginPoint::OriginTopLeft: return mScreenPosf;
case OriginPoint::OriginCustom: default: return mScreenPosf + mRotationOriginPoint;
}
}
void UIControlAnim::setRotation( const Float& angle ) {
mAngle = angle;
if ( mAngle != 0.f ) {
mControlFlags |= UI_CTRL_FLAG_ROTATED;
} else {
if ( mControlFlags & UI_CTRL_FLAG_ROTATED )
mControlFlags &= ~UI_CTRL_FLAG_ROTATED;
}
onAngleChange();
}
void UIControlAnim::setRotation( const Float& angle , const OriginPoint & center ) {
mRotationOriginPoint = center;
updateOriginPoint();
this->setRotation( angle );
}
const Vector2f& UIControlAnim::getScale() const {
return mScale;
}
void UIControlAnim::setScale( const Vector2f & scale ) {
mScale = scale;
if ( mScale != 1.f ) {
mControlFlags |= UI_CTRL_FLAG_SCALED;
} else {
if ( mControlFlags & UI_CTRL_FLAG_SCALED )
mControlFlags &= ~UI_CTRL_FLAG_SCALED;
}
onScaleChange();
}
const OriginPoint& UIControlAnim::getScaleOriginPoint() const {
return mScaleOriginPoint;
}
void UIControlAnim::setScaleOriginPoint( const OriginPoint & center ) {
mScaleOriginPoint = PixelDensity::dpToPx( center );
updateOriginPoint();
}
Vector2f UIControlAnim::getScaleCenter() {
switch ( mScaleOriginPoint.OriginType ) {
case OriginPoint::OriginCenter: return mCenter;
case OriginPoint::OriginTopLeft: return mScreenPosf;
case OriginPoint::OriginCustom: default: return mScreenPosf + mScaleOriginPoint;
}
}
void UIControlAnim::setScale( const Vector2f& scale, const OriginPoint& center ) {
mScaleOriginPoint = center;
updateOriginPoint();
this->setScale( scale );
}
void UIControlAnim::setScale( const Float& scale, const OriginPoint& center ) {
this->setScale( Vector2f( scale, scale ), center );
}
const Float& UIControlAnim::getAlpha() const {
return mAlpha;
}
void UIControlAnim::setAlpha( const Float& alpha ) {
mAlpha = alpha;
onAlphaChange();
}
void UIControlAnim::setChildsAlpha( const Float &alpha ) {
UIControlAnim * AnimChild;
UIControl * CurChild = mChild;
while ( NULL != CurChild ) {
if ( CurChild->isAnimated() ) {
AnimChild = reinterpret_cast<UIControlAnim*> ( CurChild );
AnimChild->setAlpha( alpha );
AnimChild->setChildsAlpha( alpha );
}
CurChild = CurChild->getNextControl();
}
}
void UIControlAnim::matrixSet() {
if ( mScale != 1.f || mAngle != 0.f ) {
GlobalBatchRenderer::instance()->draw();
GLi->pushMatrix();
Vector2f scaleCenter = getScaleCenter();
GLi->translatef( scaleCenter.x , scaleCenter.y, 0.f );
GLi->scalef( mScale.x, mScale.y, 1.0f );
GLi->translatef( -scaleCenter.x, -scaleCenter.y, 0.f );
Vector2f rotationCenter = getRotationCenter();
GLi->translatef( rotationCenter.x , rotationCenter.y, 0.f );
GLi->rotatef( mAngle, 0.0f, 0.0f, 1.0f );
GLi->translatef( -rotationCenter.x, -rotationCenter.y, 0.f );
}
}
void UIControlAnim::matrixUnset() {
if ( mScale != 1.f || mAngle != 0.f ) {
GlobalBatchRenderer::instance()->draw();
GLi->popMatrix();
}
}
void UIControlAnim::update() {
UIDragableControl::update();
if ( NULL != mMoveAnim && mMoveAnim->isEnabled() ) {
mMoveAnim->update( getElapsed() );
setPosition( (int)mMoveAnim->getPosition().x, (int)mMoveAnim->getPosition().y );
if ( mMoveAnim->ended() )
eeSAFE_DELETE( mMoveAnim );
}
if ( NULL != mAlphaAnim && mAlphaAnim->isEnabled() ) {
mAlphaAnim->update( getElapsed() );
setAlpha( mAlphaAnim->getPosition() );
if ( mAlphaAnim->ended() ) {
if ( ( mControlFlags & UI_CTRL_FLAG_CLOSE_FO ) )
close();
if ( ( mControlFlags & UI_CTRL_FLAG_DISABLE_FADE_OUT ) ) {
mControlFlags &= ~UI_CTRL_FLAG_DISABLE_FADE_OUT;
setVisible( false );
}
eeSAFE_DELETE( mAlphaAnim );
}
}
if ( NULL != mScaleAnim && mScaleAnim->isEnabled() ) {
mScaleAnim->update( getElapsed() );
setScale( mScaleAnim->getPosition() );
if ( mScaleAnim->ended() )
eeSAFE_DELETE( mScaleAnim );
}
if ( NULL != mAngleAnim && mAngleAnim->isEnabled() ) {
mAngleAnim->update( getElapsed() );
setRotation( mAngleAnim->getPosition() );
if ( mAngleAnim->ended() )
eeSAFE_DELETE( mAngleAnim );
}
}
bool UIControlAnim::isFadingOut() {
return 0 != ( mControlFlags & UI_CTRL_FLAG_DISABLE_FADE_OUT );
}
bool UIControlAnim::isAnimating() {
return ( NULL != mAlphaAnim && mAlphaAnim->isEnabled() ) || ( NULL != mAngleAnim && mAngleAnim->isEnabled() ) || ( NULL != mScaleAnim && mScaleAnim->isEnabled() ) || ( NULL != mMoveAnim && mMoveAnim->isEnabled() );
}
Interpolation1d * UIControlAnim::startAlphaAnim( const Float& From, const Float& To, const Time& TotalTime, const bool& AlphaChilds, const Ease::Interpolation& Type, Interpolation1d::OnPathEndCallback PathEndCallback ) {
if ( NULL == mAlphaAnim )
mAlphaAnim = eeNew( Interpolation1d, () );
mAlphaAnim->clear().add( From, TotalTime ).add( To ).setType( Type ).start( PathEndCallback );
setAlpha( From );
if ( AlphaChilds ) {
UIControlAnim * AnimChild;
UIControl * CurChild = mChild;
while ( NULL != CurChild ) {
if ( CurChild->isAnimated() ) {
AnimChild = reinterpret_cast<UIControlAnim*> ( CurChild );
AnimChild->startAlphaAnim( From, To, TotalTime, AlphaChilds );
}
CurChild = CurChild->getNextControl();
}
}
return mAlphaAnim;
}
Interpolation2d * UIControlAnim::startScaleAnim( const Vector2f& From, const Vector2f& To, const Time& TotalTime, const Ease::Interpolation& Type, Interpolation2d::OnPathEndCallback PathEndCallback ) {
if ( NULL == mScaleAnim )
mScaleAnim = eeNew( Interpolation2d, () );
mScaleAnim->clear().add( From ).add( To ).setDuration( TotalTime ).setType( Type ).start( PathEndCallback );
setScale( From );
return mScaleAnim;
}
Interpolation2d * UIControlAnim::startScaleAnim( const Float& From, const Float& To, const Time& TotalTime, const Ease::Interpolation& Type, Interpolation2d::OnPathEndCallback PathEndCallback ) {
return startScaleAnim( Vector2f( From, From ), Vector2f( To, To ), TotalTime, Type, PathEndCallback );
}
Interpolation2d * UIControlAnim::startTranslation( const Vector2i& From, const Vector2i& To, const Time& TotalTime, const Ease::Interpolation& Type, Interpolation2d::OnPathEndCallback PathEndCallback ) {
if ( NULL == mMoveAnim )
mMoveAnim = eeNew( Interpolation2d, () );
mMoveAnim->clear().add( Vector2f( (Float)From.x, (Float)From.y ) ).add( Vector2f( (Float)To.x, (Float)To.y ) ).setType( Type ).setDuration( TotalTime ).start( PathEndCallback );
setPosition( From );
return mMoveAnim;
}
Interpolation1d * UIControlAnim::startRotation( const Float& From, const Float& To, const Time& TotalTime, const Ease::Interpolation& Type, Interpolation1d::OnPathEndCallback PathEndCallback ) {
if ( NULL == mAngleAnim )
mAngleAnim = eeNew( Interpolation1d, () );
mAngleAnim->clear().add( From ).add( To ).setDuration( TotalTime ).setType( Type ).start( PathEndCallback );
setRotation( From );
return mAngleAnim;
}
Interpolation1d * UIControlAnim::startAlphaAnim(const Float & To, const Time & TotalTime, const bool & alphaChilds, const Ease::Interpolation & type, Interpolation1d::OnPathEndCallback PathEndCallback) {
return startAlphaAnim( mAlpha, To, TotalTime, alphaChilds, type, PathEndCallback );
}
Interpolation2d * UIControlAnim::startScaleAnim(const Vector2f & To, const Time & TotalTime, const Ease::Interpolation & type, Interpolation2d::OnPathEndCallback PathEndCallback) {
return startScaleAnim( mScale, To, TotalTime, type, PathEndCallback );
}
Interpolation2d * UIControlAnim::startScaleAnim(const Float & To, const Time & TotalTime, const Ease::Interpolation & type, Interpolation2d::OnPathEndCallback PathEndCallback) {
return startScaleAnim( mScale, Vector2f(To,To), TotalTime, type, PathEndCallback );
}
Interpolation2d * UIControlAnim::startTranslation(const Vector2i & To, const Time & TotalTime, const Ease::Interpolation & type, Interpolation2d::OnPathEndCallback PathEndCallback) {
return startTranslation( mPos, To, TotalTime, type, PathEndCallback );
}
Interpolation1d * UIControlAnim::startRotation(const Float & To, const Time & TotalTime, const Ease::Interpolation & type, Interpolation1d::OnPathEndCallback PathEndCallback) {
return startRotation( mAngle, To, TotalTime, type, PathEndCallback );
}
Interpolation1d * UIControlAnim::createFadeIn( const Time& time, const bool& AlphaChilds, const Ease::Interpolation& Type ) {
return startAlphaAnim( mAlpha, 255.f, time, AlphaChilds, Type );
}
Interpolation1d * UIControlAnim::createFadeOut( const Time& time, const bool& AlphaChilds, const Ease::Interpolation& Type ) {
return startAlphaAnim( 255.f, mAlpha, time, AlphaChilds, Type );
}
Interpolation1d * 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;
return mAlphaAnim;
}
Interpolation1d * UIControlAnim::disableFadeOut( const Time& time, const bool& AlphaChilds, const Ease::Interpolation& Type ) {
setEnabled( false );
startAlphaAnim ( mAlpha, 0.f, time, AlphaChilds, Type );
mControlFlags |= UI_CTRL_FLAG_DISABLE_FADE_OUT;
return mAlphaAnim;
}
void UIControlAnim::drawBackground() {
if ( mFlags & UI_FILL_BACKGROUND ) {
mBackground->draw( getRectf(), mAlpha );
}
}
void UIControlAnim::drawBorder() {
if ( mFlags & UI_BORDER ) {
mBorder->draw( getRectf(), mAlpha, mBackground->getCorners(), ( mFlags & UI_CLIP_ENABLE ) != 0 );
}
}
Color UIControlAnim::getColor( const Color& Col ) {
return Color( Col.r, Col.g, Col.b, static_cast<Uint8>( (Float)Col.a * ( mAlpha / 255.f ) ) );
}
void UIControlAnim::updateQuad() {
mPoly = Polygon2f( Rectf( mScreenPosf.x, mScreenPosf.y, mScreenPosf.x + mRealSize.getWidth(), mScreenPosf.y + mRealSize.getHeight() ) );
mPoly.rotate( mAngle, getRotationCenter() );
mPoly.scale( mScale, getScaleCenter() );
UIControl * tParent = getParent();
while ( tParent ) {
if ( tParent->isAnimated() ) {
UIControlAnim * tP = reinterpret_cast<UIControlAnim *> ( tParent );
mPoly.rotate( tP->getRotation(), tP->getRotationCenter() );
mPoly.scale( tP->getScale(), tP->getScaleCenter() );
}
tParent = tParent->getParent();
};
}
void UIControlAnim::onSizeChange() {
UIDragableControl::onSizeChange();
updateOriginPoint();
}
void UIControlAnim::updateOriginPoint() {
switch ( mRotationOriginPoint.OriginType ) {
case OriginPoint::OriginCenter:
mRotationOriginPoint.x = mRealSize.x * 0.5f;
mRotationOriginPoint.y = mRealSize.y * 0.5f;
break;
case OriginPoint::OriginTopLeft:
mRotationOriginPoint.x = mRotationOriginPoint.y = 0;
break;
default: {}
}
switch ( mScaleOriginPoint.OriginType ) {
case OriginPoint::OriginCenter:
mScaleOriginPoint.x = mRealSize.x * 0.5f;
mScaleOriginPoint.y = mRealSize.y * 0.5f;
break;
case OriginPoint::OriginTopLeft:
mScaleOriginPoint.x = mScaleOriginPoint.y = 0;
break;
default: {}
}
}
Interpolation1d * UIControlAnim::getRotationInterpolation() {
if ( NULL == mAngleAnim )
mAngleAnim = eeNew( Interpolation1d, () );
return mAngleAnim;
}
Interpolation2d * UIControlAnim::getScaleInterpolation() {
if ( NULL == mScaleAnim )
mScaleAnim = eeNew( Interpolation2d, () );
return mScaleAnim;
}
Interpolation1d * UIControlAnim::getAlphaInterpolation() {
if ( NULL == mAlphaAnim )
mAlphaAnim = eeNew( Interpolation1d, () );
return mAlphaAnim;
}
Interpolation2d * UIControlAnim::getTranslationInterpolation() {
if ( NULL == mMoveAnim )
mMoveAnim = eeNew( Interpolation2d, () );
return mMoveAnim;
}
void UIControlAnim::onAngleChange() {
sendCommonEvent( UIEvent::OnAngleChange );
invalidateDraw();
}
void UIControlAnim::onScaleChange() {
sendCommonEvent( UIEvent::OnScaleChange );
invalidateDraw();
}
void UIControlAnim::onAlphaChange() {
sendCommonEvent( UIEvent::OnAlphaChange );
invalidateDraw();
}
}}

View File

@@ -1,140 +0,0 @@
#include <eepp/ui/uidragablecontrol.hpp>
#include <eepp/ui/uimanager.hpp>
#include <eepp/window/input.hpp>
namespace EE { namespace UI {
UIDragableControl * UIDragableControl::New() {
return eeNew( UIDragableControl, () );
}
UIDragableControl::UIDragableControl() :
UIControl(),
mDragButton( EE_BUTTON_LMASK )
{
mControlFlags |= UI_CTRL_FLAG_DRAGABLE;
}
UIDragableControl::~UIDragableControl() {
}
Uint32 UIDragableControl::getType() const {
return UI_TYPE_CONTROL_DRAGABLE;
}
bool UIDragableControl::isType( const Uint32& type ) const {
return UIDragableControl::getType() == type ? true : UIControl::isType( type );
}
Uint32 UIDragableControl::onMouseDown( const Vector2i& Pos, const Uint32 Flags ) {
if ( !( UIManager::instance()->getLastPressTrigger() & mDragButton ) && ( Flags & mDragButton ) && isDragEnabled() && !isDragging() ) {
setDragging( true );
mDragPoint = Pos;
}
UIControl::onMouseDown( Pos, Flags );
return 1;
}
Uint32 UIDragableControl::onMouseUp( const Vector2i& Pos, const Uint32 Flags ) {
if ( isDragEnabled() && isDragging() && ( Flags & mDragButton ) ) {
setDragging( false );
}
UIControl::onMouseUp( Pos, Flags );
return 1;
}
const Vector2i& UIDragableControl::getDragPoint() const {
return mDragPoint;
}
void UIDragableControl::setDragPoint( const Vector2i& Point ) {
mDragPoint = Point;
}
void UIDragableControl::update() {
UIControl::update();
if ( !isDragEnabled() )
return;
if ( isDragging() ) {
if ( !( UIManager::instance()->getPressTrigger() & mDragButton ) ) {
setDragging( false );
UIManager::instance()->setControlDragging( false );
return;
}
Vector2i Pos( UIManager::instance()->getMousePos() );
if ( mDragPoint != Pos && ( abs( mDragPoint.x - Pos.x ) > PixelDensity::getPixelDensity() || abs( mDragPoint.y - Pos.y ) > PixelDensity::getPixelDensity() ) ) {
if ( onDrag( Pos ) ) {
Sizei dragDiff;
dragDiff.x = (Int32)( (Float)( mDragPoint.x - Pos.x ) / PixelDensity::getPixelDensity() );
dragDiff.y = (Int32)( (Float)( mDragPoint.y - Pos.y ) / PixelDensity::getPixelDensity() );
setInternalPosition( mPos - dragDiff );
mDragPoint = Pos;
onPositionChange();
UIManager::instance()->setControlDragging( true );
}
}
}
}
Uint32 UIDragableControl::onDrag( const Vector2i& Pos ) {
return 1;
}
Uint32 UIDragableControl::onDragStart( const Vector2i& Pos ) {
sendCommonEvent( UIEvent::OnDragStart );
return 1;
}
Uint32 UIDragableControl::onDragStop( const Vector2i& Pos ) {
sendCommonEvent( UIEvent::OnDragStop );
return 1;
}
bool UIDragableControl::isDragEnabled() const {
return 0 != ( mFlags & UI_DRAG_ENABLE );
}
void UIDragableControl::setDragEnabled( const bool& enable ) {
writeFlag( UI_DRAG_ENABLE, true == enable );
}
bool UIDragableControl::isDragging() const {
return 0 != ( mControlFlags & UI_CTRL_FLAG_DRAGGING );
}
void UIDragableControl::setDragging( const bool& dragging ) {
writeCtrlFlag( UI_CTRL_FLAG_DRAGGING, dragging );
if ( dragging ) {
UIMessage tMsg( this, UIMessage::DragStart, 0 );
messagePost( &tMsg );
onDragStart( UIManager::instance()->getMousePos() );
} else {
UIMessage tMsg( this, UIMessage::DragStop, 0 );
messagePost( &tMsg );
onDragStop( UIManager::instance()->getMousePos() );
}
}
void UIDragableControl::setDragButton( const Uint32& Button ) {
mDragButton = Button;
}
const Uint32& UIDragableControl::getDragButton() const {
return mDragButton;
}
}}

View File

@@ -77,7 +77,7 @@ void UIDropDownList::onThemeLoaded() {
autoSizeControl();
}
void UIDropDownList::setFriendControl( UIControl * friendCtrl ) {
void UIDropDownList::setFriendControl( UINode * friendCtrl ) {
mFriendCtrl = friendCtrl;
}
@@ -116,8 +116,8 @@ void UIDropDownList::showList() {
} else if ( NULL != mFriendCtrl ) {
Pos = Vector2i( mFriendCtrl->getPosition().x, mFriendCtrl->getPosition().y + mFriendCtrl->getSize().getHeight() );
} else {
UIControl * ParentLoop = getParent();
UIControl * rp = getWindowContainer();
UINode * ParentLoop = getParent();
UINode * rp = getWindowContainer();
while ( rp != ParentLoop ) {
Pos += ParentLoop->getPosition();
ParentLoop = ParentLoop->getParent();
@@ -151,8 +151,8 @@ void UIDropDownList::showList() {
} else if ( NULL != mFriendCtrl ) {
Pos = Vector2i( mFriendCtrl->getPosition().x, mFriendCtrl->getPosition().y + mFriendCtrl->getSize().getHeight() );
} else {
UIControl * ParentLoop = getParent();
UIControl * rp = getWindowContainer();
UINode * ParentLoop = getParent();
UINode * rp = getWindowContainer();
while ( rp != ParentLoop ) {
Pos += ParentLoop->getPosition();
ParentLoop = ParentLoop->getParent();

View File

@@ -1,9 +1,9 @@
#include <eepp/ui/uievent.hpp>
#include <eepp/ui/uicontrol.hpp>
#include <eepp/ui/uinode.hpp>
namespace EE { namespace UI {
UIEvent::UIEvent(UIControl * control, const Uint32& eventType ) :
UIEvent::UIEvent(UINode * control, const Uint32& eventType ) :
mCtrl( control ),
mEventType( eventType )
{
@@ -13,7 +13,7 @@ UIEvent::~UIEvent()
{
}
UIControl * UIEvent::getControl() const {
UINode * UIEvent::getControl() const {
return mCtrl;
}

View File

@@ -1,9 +1,9 @@
#include <eepp/ui/uieventkey.hpp>
#include <eepp/ui/uicontrol.hpp>
#include <eepp/ui/uinode.hpp>
namespace EE { namespace UI {
UIEventKey::UIEventKey( UIControl * Ctrl, const Uint32& EventNum, const Uint32& KeyCode, const Uint16& Char, const Uint32& Mod ) :
UIEventKey::UIEventKey( UINode * Ctrl, const Uint32& EventNum, const Uint32& KeyCode, const Uint16& Char, const Uint32& Mod ) :
UIEvent( Ctrl, EventNum ),
mKeyCode( KeyCode ),
mChar( Char ),

View File

@@ -1,9 +1,9 @@
#include <eepp/ui/uieventmouse.hpp>
#include <eepp/ui/uicontrol.hpp>
#include <eepp/ui/uinode.hpp>
namespace EE { namespace UI {
UIEventMouse::UIEventMouse( UIControl * Ctrl, const Uint32& EventNum, const Vector2i& Pos, const Uint32& Flags ) :
UIEventMouse::UIEventMouse( UINode * Ctrl, const Uint32& EventNum, const Vector2i& Pos, const Uint32& Flags ) :
UIEvent( Ctrl, EventNum ),
mPos( Pos ),
mFlags( Flags )

View File

@@ -143,7 +143,7 @@ void UIGridLayout::pack() {
setInternalHeight( getParent()->getSize().getHeight() - mLayoutMargin.Top - mLayoutMargin.Bottom );
}
UIControl * ChildLoop = mChild;
UINode * ChildLoop = mChild;
Vector2i pos(mPadding.Left,mPadding.Top);
Sizei targetSize( getTargetElementSize() );

View File

@@ -92,7 +92,7 @@ void UIImage::calcDestSize() {
}
void UIImage::draw() {
UIControlAnim::draw();
UINode::draw();
if ( mVisible ) {
if ( NULL != mDrawable && 0.f != mAlpha ) {
@@ -106,7 +106,7 @@ void UIImage::draw() {
}
void UIImage::setAlpha( const Float& alpha ) {
UIControlAnim::setAlpha( alpha );
UINode::setAlpha( alpha );
mColor.a = (Uint8)alpha;
}

View File

@@ -77,7 +77,7 @@ void UILinearLayout::packVertical() {
setInternalHeight( getParent()->getSize().getHeight() - mLayoutMargin.Top - mLayoutMargin.Bottom );
}
UIControl * ChildLoop = mChild;
UINode * ChildLoop = mChild;
while ( NULL != ChildLoop ) {
if ( ChildLoop->isWidget() && ChildLoop->isVisible() ) {
@@ -191,7 +191,7 @@ void UILinearLayout::packHorizontal() {
setInternalHeight( getParent()->getSize().getHeight() - mLayoutMargin.Top - mLayoutMargin.Bottom );
}
UIControl * ChildLoop = mChild;
UINode * ChildLoop = mChild;
while ( NULL != ChildLoop ) {
if ( ChildLoop->isWidget() ) {
@@ -297,7 +297,7 @@ void UILinearLayout::packHorizontal() {
}
Sizei UILinearLayout::getTotalUsedSize() {
UIControl * ChildLoop = mChild;
UINode * ChildLoop = mChild;
Sizei size( 0, 0 );
while ( NULL != ChildLoop ) {

View File

@@ -858,7 +858,7 @@ void UIListBox::selectNext() {
}
Uint32 UIListBox::onKeyDown( const UIEventKey &Event ) {
UIControlAnim::onKeyDown( Event );
UINode::onKeyDown( Event );
if ( !mSelected.size() || mFlags & UI_MULTI_SELECT )
return 0;
@@ -904,7 +904,7 @@ Uint32 UIListBox::onMessage( const UIMessage * Msg ) {
switch ( Msg->getMsg() ) {
case UIMessage::FocusLoss:
{
UIControl * FocusCtrl = UIManager::instance()->getFocusControl();
UINode * FocusCtrl = UIManager::instance()->getFocusControl();
if ( this != FocusCtrl && !isParentOf( FocusCtrl ) ) {
onWidgetFocusLoss();

View File

@@ -96,7 +96,7 @@ void UIListBoxItem::update() {
}
Uint32 UIListBoxItem::onMouseExit( const Vector2i& Pos, const Uint32 Flags ) {
UIControl::onMouseExit( Pos, Flags );
UINode::onMouseExit( Pos, Flags );
if ( mControlFlags & UI_CTRL_FLAG_SELECTED )
setSkinState( UISkinState::StateSelected );

View File

@@ -146,7 +146,7 @@ void UIManager::resizeControl( EE::Window::Window * win ) {
void UIManager::sendKeyUp( const Uint32& KeyCode, const Uint16& Char, const Uint32& Mod ) {
UIEventKey KeyEvent = UIEventKey( mFocusControl, UIEvent::KeyUp, KeyCode, Char, Mod );
UIControl * CtrlLoop = mFocusControl;
UINode * CtrlLoop = mFocusControl;
while( NULL != CtrlLoop ) {
if ( CtrlLoop->isEnabled() && CtrlLoop->onKeyUp( KeyEvent ) )
@@ -158,7 +158,7 @@ void UIManager::sendKeyUp( const Uint32& KeyCode, const Uint16& Char, const Uint
void UIManager::sendKeyDown( const Uint32& KeyCode, const Uint16& Char, const Uint32& Mod ) {
UIEventKey KeyEvent = UIEventKey( mFocusControl, UIEvent::KeyDown, KeyCode, Char, Mod );
UIControl * CtrlLoop = mFocusControl;
UINode * CtrlLoop = mFocusControl;
while( NULL != CtrlLoop ) {
if ( CtrlLoop->isEnabled() && CtrlLoop->onKeyDown( KeyEvent ) )
@@ -168,15 +168,15 @@ void UIManager::sendKeyDown( const Uint32& KeyCode, const Uint16& Char, const Ui
}
}
UIControl * UIManager::getFocusControl() const {
UINode * UIManager::getFocusControl() const {
return mFocusControl;
}
UIControl * UIManager::getLossFocusControl() const {
UINode * UIManager::getLossFocusControl() const {
return mLossFocusControl;
}
void UIManager::setFocusControl( UIControl * Ctrl ) {
void UIManager::setFocusControl( UINode * Ctrl ) {
if ( NULL != mFocusControl && NULL != Ctrl && Ctrl != mFocusControl ) {
mLossFocusControl = mFocusControl;
@@ -190,15 +190,15 @@ void UIManager::setFocusControl( UIControl * Ctrl ) {
}
}
UIControl * UIManager::getOverControl() const {
UINode * UIManager::getOverControl() const {
return mOverControl;
}
void UIManager::setOverControl( UIControl * Ctrl ) {
void UIManager::setOverControl( UINode * Ctrl ) {
mOverControl = Ctrl;
}
void UIManager::sendMsg( UIControl * Ctrl, const Uint32& Msg, const Uint32& Flags ) {
void UIManager::sendMsg( UINode * Ctrl, const Uint32& Msg, const Uint32& Flags ) {
UIMessage tMsg( Ctrl, Msg, Flags );
Ctrl->messagePost( &tMsg );
@@ -211,7 +211,7 @@ void UIManager::update() {
mControl->update();
UIControl * pOver = mControl->overFind( mKM->getMousePosf() );
UINode * pOver = mControl->overFind( mKM->getMousePosf() );
if ( pOver != mOverControl ) {
if ( NULL != mOverControl ) {
@@ -271,7 +271,7 @@ void UIManager::update() {
checkClose();
}
UIControl * UIManager::getDownControl() const {
UINode * UIManager::getDownControl() const {
return mDownControl;
}
@@ -305,7 +305,7 @@ const Uint32& UIManager::getLastPressTrigger() const {
return mKM->getLastPressTrigger();
}
void UIManager::clipSmartEnable(UIControl * ctrl, const Int32 & x, const Int32 & y, const Uint32 & Width, const Uint32 & Height) {
void UIManager::clipSmartEnable(UINode * ctrl, const Int32 & x, const Int32 & y, const Uint32 & Width, const Uint32 & Height) {
if ( ctrl->isMeOrParentTreeScaledOrRotatedOrFrameBuffer() ) {
GLi->getClippingMask()->clipPlaneEnable( x, y, Width, Height );
} else {
@@ -313,7 +313,7 @@ void UIManager::clipSmartEnable(UIControl * ctrl, const Int32 & x, const Int32 &
}
}
void UIManager::clipSmartDisable(UIControl * ctrl) {
void UIManager::clipSmartDisable(UINode * ctrl) {
if ( ctrl->isMeOrParentTreeScaledOrRotatedOrFrameBuffer() ) {
GLi->getClippingMask()->clipPlaneDisable();
} else {
@@ -413,24 +413,24 @@ void UIManager::checkTabPress( const Uint32& KeyCode ) {
eeASSERT( NULL != mFocusControl );
if ( KeyCode == KEY_TAB ) {
UIControl * Ctrl = mFocusControl->getNextWidget();
UINode * Ctrl = mFocusControl->getNextWidget();
if ( NULL != Ctrl )
Ctrl->setFocus();
}
}
void UIManager::sendMouseClick( UIControl * ToCtrl, const Vector2i& Pos, const Uint32 Flags ) {
void UIManager::sendMouseClick( UINode * ToCtrl, const Vector2i& Pos, const Uint32 Flags ) {
sendMsg( ToCtrl, UIMessage::Click, Flags );
ToCtrl->onMouseClick( Pos, Flags );
}
void UIManager::sendMouseUp( UIControl * ToCtrl, const Vector2i& Pos, const Uint32 Flags ) {
void UIManager::sendMouseUp( UINode * ToCtrl, const Vector2i& Pos, const Uint32 Flags ) {
sendMsg( ToCtrl, UIMessage::MouseUp, Flags );
ToCtrl->onMouseUp( Pos, Flags );
}
void UIManager::sendMouseDown( UIControl * ToCtrl, const Vector2i& Pos, const Uint32 Flags ) {
void UIManager::sendMouseDown( UINode * ToCtrl, const Vector2i& Pos, const Uint32 Flags ) {
sendMsg( ToCtrl, UIMessage::MouseDown, Flags );
ToCtrl->onMouseDown( Pos, Flags );
}
@@ -473,11 +473,11 @@ const Vector2i &UIManager::getMouseDownPos() const {
return mMouseDownPos;
}
void UIManager::addToCloseQueue( UIControl * Ctrl ) {
void UIManager::addToCloseQueue( UINode * Ctrl ) {
eeASSERT( NULL != Ctrl );
std::list<UIControl*>::iterator it;
UIControl * itCtrl = NULL;
std::list<UINode*>::iterator it;
UINode * itCtrl = NULL;
for ( it = mCloseList.begin(); it != mCloseList.end(); it++ ) {
itCtrl = *it;
@@ -490,7 +490,7 @@ void UIManager::addToCloseQueue( UIControl * Ctrl ) {
}
}
std::list< std::list<UIControl*>::iterator > itEraseList;
std::list< std::list<UINode*>::iterator > itEraseList;
for ( it = mCloseList.begin(); it != mCloseList.end(); it++ ) {
itCtrl = *it;
@@ -507,7 +507,7 @@ void UIManager::addToCloseQueue( UIControl * 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<UIControl*>::iterator >::iterator ite;
std::list< std::list<UINode*>::iterator >::iterator ite;
for ( ite = itEraseList.begin(); ite != itEraseList.end(); ite++ ) {
mCloseList.erase( *ite );
@@ -518,7 +518,7 @@ void UIManager::addToCloseQueue( UIControl * Ctrl ) {
void UIManager::checkClose() {
if ( !mCloseList.empty() ) {
for ( std::list<UIControl*>::iterator it = mCloseList.begin(); it != mCloseList.end(); it++ ) {
for ( std::list<UINode*>::iterator it = mCloseList.begin(); it != mCloseList.end(); it++ ) {
eeDelete( *it );
}
@@ -571,7 +571,7 @@ void UIManager::setHighlightInvalidationColor(const Color & highlightInvalidatio
mHighlightInvalidationColor = highlightInvalidationColor;
}
UIWidget * UIManager::loadLayoutNodes( pugi::xml_node node, UIControl * parent ) {
UIWidget * UIManager::loadLayoutNodes( pugi::xml_node node, UINode * parent ) {
UIWidget * firstWidget = NULL;
if ( NULL == parent )
@@ -599,7 +599,7 @@ UIWidget * UIManager::loadLayoutNodes( pugi::xml_node node, UIControl * parent )
return firstWidget;
}
UIWidget * UIManager::loadLayoutFromFile( const std::string& layoutPath, UIControl * parent ) {
UIWidget * UIManager::loadLayoutFromFile( const std::string& layoutPath, UINode * parent ) {
if ( FileSystem::fileExists( layoutPath ) ) {
pugi::xml_document doc;
pugi::xml_parse_result result = doc.load_file( layoutPath.c_str() );
@@ -623,7 +623,7 @@ UIWidget * UIManager::loadLayoutFromFile( const std::string& layoutPath, UIContr
return NULL;
}
UIWidget * UIManager::loadLayoutFromString( const std::string& layoutString, UIControl * parent ) {
UIWidget * UIManager::loadLayoutFromString( const std::string& layoutString, UINode * parent ) {
pugi::xml_document doc;
pugi::xml_parse_result result = doc.load_string( layoutString.c_str() );
@@ -638,7 +638,7 @@ UIWidget * UIManager::loadLayoutFromString( const std::string& layoutString, UIC
return NULL;
}
UIWidget * UIManager::loadLayoutFromMemory( const void * buffer, Int32 bufferSize, UIControl * parent ) {
UIWidget * UIManager::loadLayoutFromMemory( const void * buffer, Int32 bufferSize, UINode * parent ) {
pugi::xml_document doc;
pugi::xml_parse_result result = doc.load_buffer( buffer, bufferSize);
@@ -653,7 +653,7 @@ UIWidget * UIManager::loadLayoutFromMemory( const void * buffer, Int32 bufferSiz
return NULL;
}
UIWidget * UIManager::loadLayoutFromStream( IOStream& stream, UIControl * parent ) {
UIWidget * UIManager::loadLayoutFromStream( IOStream& stream, UINode * parent ) {
if ( !stream.isOpen() )
return NULL;
@@ -675,7 +675,7 @@ UIWidget * UIManager::loadLayoutFromStream( IOStream& stream, UIControl * parent
return NULL;
}
UIWidget * UIManager::loadLayoutFromPack( Pack * pack, const std::string& FilePackPath, UIControl * parent ) {
UIWidget * UIManager::loadLayoutFromPack( Pack * pack, const std::string& FilePackPath, UINode * parent ) {
SafeDataPointer PData;
if ( pack->isOpen() && pack->extractFileToMemory( FilePackPath, PData ) ) {

View File

@@ -121,7 +121,7 @@ Uint32 UIMenu::addSubMenu( const String& Text, Drawable * Icon, UIMenu * SubMenu
return add( createSubMenu( Text, Icon, SubMenu ) );
}
bool UIMenu::checkControlSize( UIControl * Control, const bool& Resize ) {
bool UIMenu::checkControlSize( UINode * Control, const bool& Resize ) {
if ( Control->isType( UI_TYPE_MENUITEM ) ) {
UIMenuItem * tItem = reinterpret_cast<UIMenuItem*> ( Control );
@@ -161,7 +161,7 @@ bool UIMenu::checkControlSize( UIControl * Control, const bool& Resize ) {
return false;
}
Uint32 UIMenu::add( UIControl * Control ) {
Uint32 UIMenu::add( UINode * Control ) {
if ( this != Control->getParent() )
Control->setParent( this );
@@ -180,7 +180,7 @@ Uint32 UIMenu::add( UIControl * Control ) {
return mItems.size() - 1;
}
void UIMenu::setControlSize( UIControl * Control, const Uint32& Pos ) {
void UIMenu::setControlSize( UINode * Control, const Uint32& Pos ) {
Control->setPixelsSize( mRealSize.getWidth(), Control->getRealSize().getHeight() );
}
@@ -199,12 +199,12 @@ Uint32 UIMenu::addSeparator() {
return mItems.size() - 1;
}
UIControl * UIMenu::getItem( const Uint32& Index ) {
UINode * UIMenu::getItem( const Uint32& Index ) {
eeASSERT( Index < mItems.size() );
return mItems[ Index ];
}
UIControl * UIMenu::getItem( const String& Text ) {
UINode * UIMenu::getItem( const String& Text ) {
for ( Uint32 i = 0; i < mItems.size(); i++ ) {
if ( mItems[i]->isType( UI_TYPE_MENUITEM ) ) {
UIMenuItem * tMenuItem = reinterpret_cast<UIMenuItem*>( mItems[i] );
@@ -217,7 +217,7 @@ UIControl * UIMenu::getItem( const String& Text ) {
return NULL;
}
Uint32 UIMenu::getItemIndex( UIControl * Item ) {
Uint32 UIMenu::getItemIndex( UINode * Item ) {
for ( Uint32 i = 0; i < mItems.size(); i++ ) {
if ( mItems[i] == Item )
return i;
@@ -241,7 +241,7 @@ void UIMenu::remove( const Uint32& Index ) {
resizeControls();
}
void UIMenu::remove( UIControl * Ctrl ) {
void UIMenu::remove( UINode * Ctrl ) {
for ( Uint32 i = 0; i < mItems.size(); i++ ) {
if ( mItems[i] == Ctrl ) {
remove( i );
@@ -266,7 +266,7 @@ void UIMenu::insert( const String& Text, Drawable * Icon, const Uint32& Index )
insert( createMenuItem( Text, Icon ), Index );
}
void UIMenu::insert( UIControl * Control, const Uint32& Index ) {
void UIMenu::insert( UINode * Control, const Uint32& Index ) {
mItems.insert( mItems.begin() + Index, Control );
childAddAt( Control, Index );
@@ -275,7 +275,7 @@ void UIMenu::insert( UIControl * Control, const Uint32& Index ) {
resizeControls();
}
bool UIMenu::isSubMenu( UIControl * Ctrl ) {
bool UIMenu::isSubMenu( UINode * Ctrl ) {
for ( Uint32 i = 0; i < mItems.size(); i++ ) {
if ( mItems[i]->isType( UI_TYPE_MENUSUBMENU ) ) {
UIMenuSubMenu * tMenu = reinterpret_cast<UIMenuSubMenu*> ( mItems[i] );
@@ -301,7 +301,7 @@ Uint32 UIMenu::onMessage( const UIMessage * Msg ) {
}
case UIMessage::FocusLoss:
{
UIControl * FocusCtrl = UIManager::instance()->getFocusControl();
UINode * FocusCtrl = UIManager::instance()->getFocusControl();
if ( this != FocusCtrl && !isParentOf( FocusCtrl ) && !isSubMenu( FocusCtrl ) ) {
onWidgetFocusLoss();
@@ -350,7 +350,7 @@ void UIMenu::rePosControls() {
}
for ( i = 0; i < mItems.size(); i++ ) {
UIControl * ctrl = mItems[i];
UINode * ctrl = mItems[i];
ctrl->setPixelsPosition( PixelDensity::dpToPxI( mStyleConfig.Padding.Left ), PixelDensity::dpToPxI( mStyleConfig.Padding.Top ) + mNextPosY );
@@ -388,7 +388,7 @@ bool UIMenu::hide() {
return true;
}
void UIMenu::setItemSelected( UIControl * Item ) {
void UIMenu::setItemSelected( UINode * Item ) {
if ( NULL != mItemSelected ) {
if ( mItemSelected->isType( UI_TYPE_MENUSUBMENU ) ) {
UIMenuSubMenu * tMenu = reinterpret_cast<UIMenuSubMenu*> ( mItemSelected );
@@ -409,7 +409,7 @@ void UIMenu::setItemSelected( UIControl * Item ) {
}
}
void UIMenu::trySelect( UIControl * Ctrl, bool Up ) {
void UIMenu::trySelect( UINode * Ctrl, bool Up ) {
if ( mItems.size() ) {
if ( !Ctrl->isType( UI_TYPE_MENU_SEPARATOR ) ) {
setItemSelected( Ctrl );

View File

@@ -21,7 +21,7 @@ Uint32 UIMenuSeparator::getType() const {
}
bool UIMenuSeparator::isType( const Uint32& type ) const {
return UIMenuSeparator::getType() == type ? true : UIControlAnim::isType( type );
return UIMenuSeparator::getType() == type ? true : UINode::isType( type );
}
void UIMenuSeparator::setTheme( UITheme * Theme ) {

View File

@@ -17,7 +17,7 @@ UIMenuSubMenu::UIMenuSubMenu() :
mCbId( 0 ),
mCbId2( 0 )
{
mArrow = UIControlAnim::New();
mArrow = UINode::New();
mArrow->setParent( this );
mArrow->setFlags( UI_AUTO_SIZE );
mArrow->setVisible( true );
@@ -122,12 +122,12 @@ Uint32 UIMenuSubMenu::onMouseExit( const Vector2i &Pos, const Uint32 Flags ) {
return 1;
}
UIControl * UIMenuSubMenu::getArrow() const {
UINode * UIMenuSubMenu::getArrow() const {
return mArrow;
}
void UIMenuSubMenu::onSubMenuFocusLoss( const UIEvent * Event ) {
UIControl * FocusCtrl = UIManager::instance()->getFocusControl();
UINode * FocusCtrl = UIManager::instance()->getFocusControl();
if ( getParent() != FocusCtrl && !getParent()->isParentOf( FocusCtrl ) ) {
getParent()->setFocus();

View File

@@ -1,9 +1,9 @@
#include <eepp/ui/uimessage.hpp>
#include <eepp/ui/uicontrol.hpp>
#include <eepp/ui/uinode.hpp>
namespace EE { namespace UI {
UIMessage::UIMessage( UIControl * Ctrl, const Uint32& Msg, const Uint32& Flags ) :
UIMessage::UIMessage( UINode * Ctrl, const Uint32& Msg, const Uint32& Flags ) :
mCtrl( Ctrl ),
mMsg( Msg ),
mFlags( Flags )
@@ -14,7 +14,7 @@ UIMessage::~UIMessage()
{
}
UIControl * UIMessage::getSender() const {
UINode * UIMessage::getSender() const {
return mCtrl;
}

File diff suppressed because it is too large Load Diff

View File

@@ -46,7 +46,7 @@ bool UIProgressBar::isType( const Uint32& type ) const {
}
void UIProgressBar::draw() {
UIControlAnim::draw();
UINode::draw();
if ( NULL == mFillerSkin )
return;
@@ -78,7 +78,7 @@ void UIProgressBar::draw() {
}
void UIProgressBar::update() {
UIControlAnim::update();
UINode::update();
if ( NULL == mFillerSkin )
return;
@@ -129,7 +129,7 @@ void UIProgressBar::onThemeLoaded() {
}
Uint32 UIProgressBar::onValueChange() {
UIControlAnim::onValueChange();
UINode::onValueChange();
onSizeChange();
@@ -248,7 +248,7 @@ void UIProgressBar::loadFromXmlNode(const pugi::xml_node & node) {
}
void UIProgressBar::onAlphaChange() {
UIControlAnim::onAlphaChange();
UINode::onAlphaChange();
mTextBox->setAlpha( mAlpha );
}

View File

@@ -17,14 +17,14 @@ UIRadioButton::UIRadioButton() :
mActive( false ),
mTextSeparation( 4 )
{
mActiveButton = UIControlAnim::New();
mActiveButton = UINode::New();
mActiveButton->setVisible( false );
mActiveButton->setEnabled( true );
mActiveButton->setParent( this );
mActiveButton->setPosition( 0, 0 );
mActiveButton->setSize( 16, 16 );
mInactiveButton = UIControlAnim::New();
mInactiveButton = UINode::New();
mInactiveButton->setVisible( true );
mInactiveButton->setEnabled( true );
mInactiveButton->setParent( this );
@@ -137,7 +137,7 @@ void UIRadioButton::setActive( const bool& active ) {
}
if ( active && NULL != mParentCtrl ) {
UIControl * tChild = mParentCtrl->getFirstChild();
UINode * tChild = mParentCtrl->getFirstChild();
while ( NULL != tChild ) {
if ( tChild->isType( UI_TYPE_RADIOBUTTON ) ) {
@@ -156,7 +156,7 @@ void UIRadioButton::setActive( const bool& active ) {
bool UIRadioButton::checkActives() {
if ( NULL != mParentCtrl ) {
UIControl * tChild = mParentCtrl->getFirstChild();
UINode * tChild = mParentCtrl->getFirstChild();
while ( NULL != tChild ) {
if ( tChild->isType( UI_TYPE_RADIOBUTTON ) ) {
@@ -179,7 +179,7 @@ void UIRadioButton::autoActivate() {
eeASSERT( NULL != mParentCtrl );
if ( NULL != mParentCtrl ) {
UIControl * tChild = mParentCtrl->getFirstChild();
UINode * tChild = mParentCtrl->getFirstChild();
while ( NULL != tChild ) {
if ( tChild->isType( UI_TYPE_RADIOBUTTON ) ) {
@@ -210,11 +210,11 @@ void UIRadioButton::onPaddingChange() {
mRealPadding.Left = mActiveButton->getRealPosition().x + mActiveButton->getRealSize().getWidth() + PixelDensity::dpToPxI( mTextSeparation );
}
UIControlAnim * UIRadioButton::getActiveButton() const {
UINode * UIRadioButton::getActiveButton() const {
return mActiveButton;
}
UIControlAnim * UIRadioButton::getInactiveButton() const {
UINode * UIRadioButton::getInactiveButton() const {
return mInactiveButton;
}

View File

@@ -49,7 +49,7 @@ void UIRelativeLayout::fixChilds() {
setInternalHeight( getParent()->getSize().getHeight() - mLayoutMargin.Top - mLayoutMargin.Bottom );
}
UIControl * child = mChild;
UINode * child = mChild;
while ( NULL != child ) {
if ( child->isWidget() ) {

View File

@@ -18,8 +18,8 @@ UIScrollBar::UIScrollBar( const UI_ORIENTATION& orientation ) :
{
mFlags |= UI_AUTO_SIZE;
mBtnDown = UIControlAnim::New();
mBtnUp = UIControlAnim::New();
mBtnDown = UINode::New();
mBtnUp = UINode::New();
mBtnUp->setParent( this );
mBtnUp->setSize( 16, 16 );
mBtnDown->setParent( this );
@@ -53,14 +53,14 @@ void UIScrollBar::setTheme( UITheme * Theme ) {
UIWidget::setTheme( Theme );
if ( !isVertical() ) {
UIControl::setThemeSkin( Theme, "hscrollbar" );
UINode::setThemeSkin( Theme, "hscrollbar" );
mSlider->setThemeSkin( Theme, "hscrollbar_slider" );
mSlider->getBackSlider()->setThemeSkin( Theme, "hscrollbar_bg" );
mSlider->getSliderButton()->setThemeSkin( Theme, "hscrollbar_button" );
mBtnUp->setThemeSkin( Theme, "hscrollbar_btnup" );
mBtnDown->setThemeSkin( Theme, "hscrollbar_btndown" );
} else {
UIControl::setThemeSkin( Theme, "vscrollbar" );
UINode::setThemeSkin( Theme, "vscrollbar" );
mSlider->setThemeSkin( Theme, "vscrollbar_slider" );
mSlider->getBackSlider()->setThemeSkin( Theme, "vscrollbar_bg" );
mSlider->getSliderButton()->setThemeSkin( Theme, "vscrollbar_button" );
@@ -178,7 +178,7 @@ void UIScrollBar::adjustChilds() {
}
void UIScrollBar::update() {
UIControlAnim::update();
UINode::update();
if ( mBtnUp->isMouseOver() || mBtnDown->isMouseOver() ) {
manageClick( UIManager::instance()->getInput()->getClickTrigger() );
@@ -265,11 +265,11 @@ UISlider * UIScrollBar::getSlider() const {
return mSlider;
}
UIControlAnim * UIScrollBar::getButtonUp() const {
UINode * UIScrollBar::getButtonUp() const {
return mBtnUp;
}
UIControlAnim * UIScrollBar::getButtonDown() const {
UINode * UIScrollBar::getButtonDown() const {
return mBtnDown;
}
@@ -309,7 +309,7 @@ UI_ORIENTATION UIScrollBar::getOrientation() const {
return mSlider->getOrientation();
}
UIControl * UIScrollBar::setOrientation( const UI_ORIENTATION & orientation ) {
UINode * UIScrollBar::setOrientation( const UI_ORIENTATION & orientation ) {
mSlider->setOrientation( orientation );
applyDefaultTheme();
@@ -318,7 +318,7 @@ UIControl * UIScrollBar::setOrientation( const UI_ORIENTATION & orientation ) {
}
void UIScrollBar::onAlphaChange() {
UIControlAnim::onAlphaChange();
UINode::onAlphaChange();
mSlider->setAlpha( mAlpha );
mBtnUp->setAlpha( mAlpha );

View File

@@ -15,7 +15,7 @@ UIScrollView::UIScrollView() :
mHScrollMode( UI_SCROLLBAR_AUTO ),
mVScroll( UIScrollBar::New( UI_VERTICAL ) ),
mHScroll( UIScrollBar::New( UI_HORIZONTAL ) ),
mContainer( UIControlAnim::New() ),
mContainer( UINode::New() ),
mScrollView( NULL ),
mSizeChangeCb( 0 )
{
@@ -51,12 +51,12 @@ void UIScrollView::onAlphaChange() {
mHScroll->setAlpha( mAlpha );
mContainer->setAlpha( mAlpha );
if ( NULL != mScrollView && mScrollView->isAnimated() )
reinterpret_cast<UIControlAnim*>( mScrollView )->setAlpha( mAlpha );
if ( NULL != mScrollView )
mScrollView->setAlpha( mAlpha );
}
void UIScrollView::onChildCountChange() {
UIControl * child = mChild;
UINode * child = mChild;
bool found = false;
while ( NULL != child ) {
@@ -125,7 +125,7 @@ UIScrollBar * UIScrollView::getHorizontalScrollBar() const {
return mHScroll;
}
UIControlAnim * UIScrollView::getContainer() const {
UINode * UIScrollView::getContainer() const {
return mContainer;
}

View File

@@ -34,7 +34,7 @@ UISlider::UISlider( const UI_ORIENTATION& orientation ) :
else
bgSize = Sizei( 8, mSize.getHeight() - 16 );
mBackSlider = UIControlAnim::New();
mBackSlider = UINode::New();
mBackSlider->setParent( this );
mBackSlider->setVisible( true );
mBackSlider->setEnabled( true );
@@ -282,7 +282,7 @@ bool UISlider::isVertical() const {
}
void UISlider::update() {
UIControlAnim::update();
UINode::update();
if ( isMouseOver() || mBackSlider->isMouseOver() || mSlider->isMouseOver() ) {
manageClick( UIManager::instance()->getInput()->getClickTrigger() );
@@ -387,16 +387,16 @@ void UISlider::setPageStep(const Float & pageStep) {
setValue( mValue );
}
UIControl * UISlider::getBackSlider() const {
UINode * UISlider::getBackSlider() const {
return mBackSlider;
}
UIDragableControl * UISlider::getSliderButton() const {
UINode * UISlider::getSliderButton() const {
return mSlider;
}
void UISlider::onAlphaChange() {
UIControlAnim::onAlphaChange();
UINode::onAlphaChange();
mBackSlider->setAlpha( mAlpha );
mSlider->setAlpha( mAlpha );

View File

@@ -20,13 +20,13 @@ UISpinBox::UISpinBox() :
mInput->setEnabled( true );
mInput->setParent( this );
mPushUp = UIControlAnim::New();
mPushUp = UINode::New();
mPushUp->setVisible( true );
mPushUp->setEnabled( true );
mPushUp->setParent( this );
mPushUp->setSize( 16, 16 );
mPushDown = UIControlAnim::New();
mPushDown = UINode::New();
mPushDown->setVisible( true );
mPushDown->setEnabled( true );
mPushDown->setParent( this );
@@ -211,7 +211,7 @@ const Float& UISpinBox::getMaxValue() const {
void UISpinBox::update() {
bool Changed = mInput->getInputTextBuffer()->changedSinceLastUpdate();
UIControlAnim::update();
UINode::update();
if ( Changed ) {
if ( !mInput->getText().size() ) {
@@ -234,11 +234,11 @@ void UISpinBox::update() {
}
}
UIControlAnim * UISpinBox::getButtonPushUp() const {
UINode * UISpinBox::getButtonPushUp() const {
return mPushUp;
}
UIControlAnim * UISpinBox::getButtonPushDown() const {
UINode * UISpinBox::getButtonPushDown() const {
return mPushDown;
}
@@ -257,7 +257,7 @@ bool UISpinBox::dotsInNumbersAllowed() {
}
void UISpinBox::onAlphaChange() {
UIControlAnim::onAlphaChange();
UINode::onAlphaChange();
mInput->setAlpha( mAlpha );
mPushUp->setAlpha( mAlpha );

View File

@@ -59,7 +59,7 @@ void UISubTexture::onAutoSize() {
}
void UISubTexture::draw() {
UIControlAnim::draw();
UINode::draw();
if ( mVisible ) {
if ( NULL != mSubTexture && 0.f != mAlpha ) {

View File

@@ -57,7 +57,7 @@ void UITab::setTheme( UITheme * Theme ) {
}
}
UIControl::setThemeSkin( Theme, tabPos );
UINode::setThemeSkin( Theme, tabPos );
onThemeLoaded();
}
@@ -195,18 +195,18 @@ void UITab::loadFromXmlNode(const pugi::xml_node & node) {
}
void UITab::setOwnedControl() {
UIControl * ctrl = getParent()->getParent()->find( mOwnedName );
UINode * ctrl = getParent()->getParent()->find( mOwnedName );
if ( NULL != ctrl ) {
setControlOwned( ctrl );
}
}
UIControl * UITab::getControlOwned() const {
UINode * UITab::getControlOwned() const {
return mControlOwned;
}
void UITab::setControlOwned(UIControl * controlOwned) {
void UITab::setControlOwned(UINode * controlOwned) {
mControlOwned = controlOwned;
UITabWidget * tTabW = getTabWidget();

View File

@@ -483,7 +483,7 @@ void UITable::updateCollumnsPos() {
}
void UITable::onAlphaChange() {
UIControlAnim::onAlphaChange();
UINode::onAlphaChange();
mVScrollBar->setAlpha( mAlpha );
mHScrollBar->setAlpha( mAlpha );
@@ -561,7 +561,7 @@ Uint32 UITable::onMessage( const UIMessage * Msg ) {
switch ( Msg->getMsg() ) {
case UIMessage::FocusLoss:
{
UIControl * FocusCtrl = UIManager::instance()->getFocusControl();
UINode * FocusCtrl = UIManager::instance()->getFocusControl();
if ( this != FocusCtrl && !isParentOf( FocusCtrl ) ) {
onWidgetFocusLoss();

View File

@@ -32,7 +32,7 @@ UITable * UITableCell::gridParent() const {
return reinterpret_cast<UITable*> ( mParentCtrl->getParent() );
}
void UITableCell::setCell( const Uint32& CollumnIndex, UIControl * Ctrl ) {
void UITableCell::setCell( const Uint32& CollumnIndex, UINode * Ctrl ) {
eeASSERT( CollumnIndex < gridParent()->getCollumnsCount() );
UITable * P = gridParent();
@@ -52,7 +52,7 @@ void UITableCell::setCell( const Uint32& CollumnIndex, UIControl * Ctrl ) {
Ctrl->setEnabled( true );
}
UIControl * UITableCell::getCell( const Uint32& CollumnIndex ) const {
UINode * UITableCell::getCell( const Uint32& CollumnIndex ) const {
eeASSERT( CollumnIndex < gridParent()->getCollumnsCount() );
return mCells[ CollumnIndex ];
@@ -78,8 +78,8 @@ void UITableCell::update() {
setAlpha( MyParent->getAlpha() );
for ( Uint32 i = 0; i < mCells.size(); i++ ) {
if ( NULL != mCells[i] && mCells[i]->isAnimated() ) {
reinterpret_cast<UIControlAnim*>( mCells[i] )->setAlpha( MyParent->getAlpha() );
if ( NULL != mCells[i] ) {
mCells[i]->setAlpha( MyParent->getAlpha() );
}
}
}
@@ -127,7 +127,7 @@ bool UITableCell::isSelected() const {
}
Uint32 UITableCell::onMouseExit( const Vector2i& Pos, const Uint32 Flags ) {
UIControl::onMouseExit( Pos, Flags );
UINode::onMouseExit( Pos, Flags );
if ( mControlFlags & UI_CTRL_FLAG_SELECTED )
setSkinState( UISkinState::StateSelected );

View File

@@ -503,7 +503,7 @@ void UITabWidget::orderTabs() {
invalidateDraw();
}
UITab * UITabWidget::createTab( const String& Text, UIControl * CtrlOwned, Drawable * Icon ) {
UITab * UITabWidget::createTab( const String& Text, UINode * CtrlOwned, Drawable * Icon ) {
UITab * tCtrl = UITab::New();
tCtrl->setParent( mTabContainer );
tCtrl->setFlags( UI_VALIGN_CENTER | UI_HALIGN_CENTER | UI_AUTO_SIZE );
@@ -520,7 +520,7 @@ UITab * UITabWidget::createTab( const String& Text, UIControl * CtrlOwned, Drawa
return tCtrl;
}
UITabWidget * UITabWidget::add( const String& Text, UIControl * CtrlOwned, Drawable * Icon ) {
UITabWidget * UITabWidget::add( const String& Text, UINode * CtrlOwned, Drawable * Icon ) {
return add( createTab( Text, CtrlOwned, Icon ) );
}
@@ -619,7 +619,7 @@ void UITabWidget::removeAll() {
orderTabs();
}
void UITabWidget::insert( const String& Text, UIControl * CtrlOwned, Drawable * Icon, const Uint32& Index ) {
void UITabWidget::insert( const String& Text, UINode * CtrlOwned, Drawable * Icon, const Uint32& Index ) {
insert( createTab( Text, CtrlOwned, Icon ), Index );
}
@@ -711,7 +711,7 @@ void UITabWidget::onSizeChange() {
}
void UITabWidget::onChildCountChange() {
UIControl * child = mChild;
UINode * child = mChild;
bool found = false;
while ( NULL != child ) {

View File

@@ -128,7 +128,7 @@ void UITextInput::draw() {
}
Uint32 UITextInput::onFocus() {
UIControlAnim::onFocus();
UINode::onFocus();
if ( mAllowEditing ) {
mTextBuffer.setActive( true );
@@ -292,7 +292,7 @@ Uint32 UITextInput::onMouseDoubleClick( const Vector2i& Pos, const Uint32 Flags
}
Uint32 UITextInput::onMouseExit( const Vector2i& Pos, const Uint32 Flags ) {
UIControl::onMouseExit( Pos, Flags );
UINode::onMouseExit( Pos, Flags );
UIManager::instance()->setCursor( EE_CURSOR_ARROW );

View File

@@ -25,7 +25,7 @@ UITextInputPassword::~UITextInputPassword() {
void UITextInputPassword::draw() {
if ( mVisible && 0.f != mAlpha ) {
UIControlAnim::draw();
UINode::draw();
drawSelection( mPassCache );

View File

@@ -49,7 +49,7 @@ bool UITextView::isType( const Uint32& type ) const {
void UITextView::draw() {
if ( mVisible && 0.f != mAlpha ) {
UIControlAnim::draw();
UINode::draw();
drawSelection( mTextCache );
@@ -223,7 +223,7 @@ UITextView * UITextView::setSelectionBackColor( const Color& color ) {
void UITextView::setAlpha( const Float& alpha ) {
if ( mAlpha != alpha ) {
UIControlAnim::setAlpha( alpha );
UINode::setAlpha( alpha );
mFontStyleConfig.FontColor.a = (Uint8)alpha;
mFontStyleConfig.ShadowColor.a = (Uint8)alpha;
@@ -298,7 +298,7 @@ Uint32 UITextView::onFocusLoss() {
void UITextView::onSizeChange() {
recalculate();
UIControlAnim::onSizeChange();
UINode::onSizeChange();
}
void UITextView::onTextChanged() {

View File

@@ -1,5 +1,5 @@
#include <eepp/ui/uithememanager.hpp>
#include <eepp/ui/uicontrol.hpp>
#include <eepp/ui/uinode.hpp>
#include <eepp/ui/uimanager.hpp>
namespace EE { namespace UI {
@@ -45,7 +45,7 @@ void UIThemeManager::setTheme( const std::string& Theme ) {
}
void UIThemeManager::setTheme( UITheme * Theme ) {
UIControl * MainCtrl = UIManager::instance()->getMainControl();
UINode * MainCtrl = UIManager::instance()->getMainControl();
if ( NULL != MainCtrl ) {
MainCtrl->setThemeToChilds( Theme );
@@ -74,7 +74,7 @@ UITheme * UIThemeManager::getDefaultTheme() const {
return mThemeDefault;
}
void UIThemeManager::applyDefaultTheme( UIControl * Control ) {
void UIThemeManager::applyDefaultTheme( UINode * Control ) {
if ( mAutoApplyDefaultTheme && NULL != mThemeDefault && NULL != Control )
Control->setTheme( mThemeDefault );
}

View File

@@ -10,7 +10,7 @@ UITooltip *UITooltip::New() {
}
UITooltip::UITooltip() :
UIControlAnim(),
UINode(),
mAlignOffset( 0.f, 0.f ),
mTooltipTime( Time::Zero ),
mTooltipOf()
@@ -50,7 +50,7 @@ Uint32 UITooltip::getType() const {
}
bool UITooltip::isType( const Uint32& type ) const {
return UITooltip::getType() == type ? true : UIControlAnim::isType( type );
return UITooltip::getType() == type ? true : UINode::isType( type );
}
void UITooltip::setTheme( UITheme * Theme ) {
@@ -91,7 +91,7 @@ void UITooltip::hide() {
void UITooltip::draw() {
if ( mVisible && 0.f != mAlpha && mTextCache->getString().size() > 0 ) {
UIControlAnim::draw();
UINode::draw();
if ( mTextCache->getTextWidth() ) {
mTextCache->setAlign( getFlags() );
@@ -147,7 +147,7 @@ void UITooltip::setFontShadowColor( const Color& color ) {
}
void UITooltip::setAlpha( const Float& alpha ) {
UIControlAnim::setAlpha( alpha );
UINode::setAlpha( alpha );
mStyleConfig.FontColor.a = (Uint8)alpha;
mStyleConfig.ShadowColor.a = (Uint8)alpha;
@@ -197,7 +197,7 @@ void UITooltip::onSizeChange() {
onAutoSize();
autoAlign();
UIControlAnim::onSizeChange();
UINode::onSizeChange();
}
void UITooltip::onTextChanged() {
@@ -249,11 +249,11 @@ const Time& UITooltip::getTooltipTime() const {
return mTooltipTime;
}
UIControl * UITooltip::getTooltipOf() const {
UINode * UITooltip::getTooltipOf() const {
return mTooltipOf;
}
void UITooltip::setTooltipOf(UIControl * tooltipOf) {
void UITooltip::setTooltipOf(UINode * tooltipOf) {
mTooltipOf = tooltipOf;
}

View File

@@ -10,7 +10,7 @@ UIWidget * UIWidget::New() {
}
UIWidget::UIWidget() :
UIControlAnim(),
UINode(),
mTheme( NULL ),
mTooltip( NULL ),
mMinControlSize(),
@@ -36,7 +36,7 @@ Uint32 UIWidget::getType() const {
}
bool UIWidget::isType( const Uint32& type ) const {
return UIWidget::getType() == type ? true : UIControlAnim::isType( type );
return UIWidget::getType() == type ? true : UINode::isType( type );
}
void UIWidget::updateAnchorsDistances() {
@@ -190,7 +190,7 @@ void UIWidget::update() {
}
}
UIControlAnim::update();
UINode::update();
}
void UIWidget::createTooltip() {
@@ -227,7 +227,7 @@ void UIWidget::tooltipRemove() {
mTooltip = NULL;
}
UIControl * UIWidget::setSize( const Sizei& size ) {
UINode * UIWidget::setSize( const Sizei& size ) {
Sizei s( size );
if ( s.x < mMinControlSize.x )
@@ -236,10 +236,10 @@ UIControl * UIWidget::setSize( const Sizei& size ) {
if ( s.y < mMinControlSize.y )
s.y = mMinControlSize.y;
return UIControlAnim::setSize( s );
return UINode::setSize( s );
}
UIControl * UIWidget::setFlags(const Uint32 & flags) {
UINode * UIWidget::setFlags(const Uint32 & flags) {
if ( flags & ( UI_ANCHOR_LEFT | UI_ANCHOR_TOP | UI_ANCHOR_RIGHT | UI_ANCHOR_BOTTOM ) ) {
updateAnchorsDistances();
}
@@ -248,15 +248,15 @@ UIControl * UIWidget::setFlags(const Uint32 & flags) {
onAutoSize();
}
return UIControlAnim::setFlags( flags );
return UINode::setFlags( flags );
}
UIControl * UIWidget::unsetFlags(const Uint32 & flags) {
UINode * UIWidget::unsetFlags(const Uint32 & flags) {
if ( flags & ( UI_ANCHOR_LEFT | UI_ANCHOR_TOP | UI_ANCHOR_RIGHT | UI_ANCHOR_BOTTOM ) ) {
updateAnchorsDistances();
}
return UIControlAnim::unsetFlags( flags );
return UINode::unsetFlags( flags );
}
UIWidget * UIWidget::setAnchors(const Uint32 & flags) {
@@ -271,20 +271,20 @@ void UIWidget::setTheme( UITheme * Theme ) {
invalidateDraw();
}
UIControl * UIWidget::setThemeSkin( const std::string& skinName ) {
UINode * UIWidget::setThemeSkin( const std::string& skinName ) {
return setThemeSkin( NULL != mTheme ? mTheme : UIThemeManager::instance()->getDefaultTheme(), skinName );
}
UIControl * UIWidget::setThemeSkin( UITheme * Theme, const std::string& skinName ) {
return UIControl::setThemeSkin( Theme, skinName );
UINode * UIWidget::setThemeSkin( UITheme * Theme, const std::string& skinName ) {
return UINode::setThemeSkin( Theme, skinName );
}
UIControl * UIWidget::setSize( const Int32& Width, const Int32& Height ) {
return UIControlAnim::setSize( Width, Height );
UINode * UIWidget::setSize( const Int32& Width, const Int32& Height ) {
return UINode::setSize( Width, Height );
}
const Sizei& UIWidget::getSize() {
return UIControlAnim::getSize();
return UINode::getSize();
}
UITooltip * UIWidget::getTooltip() {
@@ -293,18 +293,18 @@ UITooltip * UIWidget::getTooltip() {
void UIWidget::onParentSizeChange( const Vector2i& SizeChange ) {
updateAnchors( SizeChange );
UIControlAnim::onParentSizeChange( SizeChange );
UINode::onParentSizeChange( SizeChange );
}
void UIWidget::onPositionChange() {
updateAnchorsDistances();
UIControlAnim::onPositionChange();
UINode::onPositionChange();
}
void UIWidget::onVisibilityChange() {
updateAnchorsDistances();
notifyLayoutAttrChange();
UIControlAnim::onVisibilityChange();
UINode::onVisibilityChange();
}
void UIWidget::onAutoSize() {
@@ -630,7 +630,7 @@ void UIWidget::loadFromXmlNode( const pugi::xml_node& node ) {
std::string id = ait->as_string();
UIControl * control = getParent()->find( id );
UINode * control = getParent()->find( id );
if ( NULL != control && control->isWidget() ) {
UIWidget * widget = static_cast<UIWidget*>( control );

View File

@@ -107,7 +107,7 @@ void UIWindow::updateWinFlags() {
if ( !( mStyleConfig.WinFlags & UI_WIN_NO_BORDER ) ) {
if ( NULL == mWindowDecoration ) {
mWindowDecoration = UIControlAnim::New();
mWindowDecoration = UINode::New();
mWindowDecoration->writeCtrlFlag( UI_CTRL_FLAG_OWNED_BY_WINDOW, 1 );
}
@@ -116,7 +116,7 @@ void UIWindow::updateWinFlags() {
mWindowDecoration->setEnabled( false );
if ( NULL == mBorderLeft ) {
mBorderLeft = UIControlAnim::New();
mBorderLeft = UINode::New();
mBorderLeft->writeCtrlFlag( UI_CTRL_FLAG_OWNED_BY_WINDOW, 1 );
}
@@ -125,7 +125,7 @@ void UIWindow::updateWinFlags() {
mBorderLeft->setVisible( true );
if ( NULL == mBorderRight ) {
mBorderRight = UIControlAnim::New();
mBorderRight = UINode::New();
mBorderRight->writeCtrlFlag( UI_CTRL_FLAG_OWNED_BY_WINDOW, 1 );
}
@@ -134,7 +134,7 @@ void UIWindow::updateWinFlags() {
mBorderRight->setVisible( true );
if ( NULL == mBorderBottom ) {
mBorderBottom = UIControlAnim::New();
mBorderBottom = UINode::New();
mBorderBottom->writeCtrlFlag( UI_CTRL_FLAG_OWNED_BY_WINDOW, 1 );
}
@@ -144,7 +144,7 @@ void UIWindow::updateWinFlags() {
if ( mStyleConfig.WinFlags & UI_WIN_CLOSE_BUTTON ) {
if ( NULL == mButtonClose ) {
mButtonClose = UIControlAnim::New();
mButtonClose = UINode::New();
mButtonClose->writeCtrlFlag( UI_CTRL_FLAG_OWNED_BY_WINDOW, 1 );
needsUpdate = true;
}
@@ -163,7 +163,7 @@ void UIWindow::updateWinFlags() {
if ( isMaximizable() ) {
if ( NULL == mButtonMaximize ) {
mButtonMaximize = UIControlAnim::New();
mButtonMaximize = UINode::New();
mButtonMaximize->writeCtrlFlag( UI_CTRL_FLAG_OWNED_BY_WINDOW, 1 );
needsUpdate = true;
}
@@ -182,7 +182,7 @@ void UIWindow::updateWinFlags() {
if ( mStyleConfig.WinFlags & UI_WIN_MINIMIZE_BUTTON ) {
if ( NULL == mButtonMinimize ) {
mButtonMinimize = UIControlAnim::New();
mButtonMinimize = UINode::New();
mButtonMinimize->writeCtrlFlag( UI_CTRL_FLAG_OWNED_BY_WINDOW, 1 );
needsUpdate = true;
}
@@ -335,7 +335,7 @@ Sizei UIWindow::getFrameBufferSize() {
}
void UIWindow::createModalControl() {
UIControl * Ctrl = UIManager::instance()->getMainControl();
UINode * Ctrl = UIManager::instance()->getMainControl();
if ( NULL == mModalCtrl ) {
mModalCtrl = UIWidget::New();
@@ -356,7 +356,7 @@ void UIWindow::createModalControl() {
void UIWindow::enableByModal() {
if ( isModal() ) {
UIControl * CtrlChild = UIManager::instance()->getMainControl()->getFirstChild();
UINode * CtrlChild = UIManager::instance()->getMainControl()->getFirstChild();
while ( NULL != CtrlChild )
{
@@ -375,7 +375,7 @@ void UIWindow::enableByModal() {
void UIWindow::disableByModal() {
if ( isModal() ) {
UIControl * CtrlChild = UIManager::instance()->getMainControl()->getFirstChild();
UINode * CtrlChild = UIManager::instance()->getMainControl()->getFirstChild();
while ( NULL != CtrlChild )
{
@@ -551,7 +551,7 @@ void UIWindow::onSizeChange() {
}
}
UIControl * UIWindow::setSize( const Sizei& Size ) {
UINode * UIWindow::setSize( const Sizei& Size ) {
if ( NULL != mWindowDecoration ) {
Sizei size = Size;
@@ -566,7 +566,7 @@ UIControl * UIWindow::setSize( const Sizei& Size ) {
return this;
}
UIControl * UIWindow::setSize( const Int32& Width, const Int32& Height ) {
UINode * UIWindow::setSize( const Int32& Width, const Int32& Height ) {
setSize( Sizei( Width, Height ) );
return this;
}
@@ -718,7 +718,7 @@ void UIWindow::doResize ( const UIMessage * Msg ) {
decideResizeType( Msg->getSender() );
}
void UIWindow::decideResizeType( UIControl * Control ) {
void UIWindow::decideResizeType( UINode * Control ) {
Vector2i Pos = UIManager::instance()->getMousePos();
worldToControl( Pos );
@@ -860,14 +860,14 @@ void UIWindow::updateResize() {
case RESIZE_LEFT:
{
Pos.x -= mResizePos.x;
UIControl::setPixelsPosition( mRealPos.x + Pos.x, mRealPos.y );
UINode::setPixelsPosition( mRealPos.x + Pos.x, mRealPos.y );
internalSize( mRealSize.getWidth() - Pos.x, mRealSize.getHeight() );
break;
}
case RESIZE_TOP:
{
Pos.y -= mResizePos.y;
UIControl::setPixelsPosition( mRealPos.x, mRealPos.y + Pos.y );
UINode::setPixelsPosition( mRealPos.x, mRealPos.y + Pos.y );
internalSize( mRealSize.getWidth(), mRealSize.getHeight() - Pos.y );
break;
}
@@ -880,7 +880,7 @@ void UIWindow::updateResize() {
case RESIZE_TOPLEFT:
{
Pos -= mResizePos;
UIControl::setPixelsPosition( mRealPos.x + Pos.x, mRealPos.y + Pos.y );
UINode::setPixelsPosition( mRealPos.x + Pos.x, mRealPos.y + Pos.y );
internalSize( mRealSize.getWidth() - Pos.x, mRealSize.getHeight() - Pos.y );
break;
}
@@ -888,7 +888,7 @@ void UIWindow::updateResize() {
{
Pos.y -= mResizePos.y;
Pos.x += mResizePos.x;
UIControl::setPixelsPosition( mRealPos.x, mRealPos.y + Pos.y );
UINode::setPixelsPosition( mRealPos.x, mRealPos.y + Pos.y );
internalSize( Pos.x, mRealSize.getHeight() - Pos.y );
break;
}
@@ -896,7 +896,7 @@ void UIWindow::updateResize() {
{
Pos.x -= mResizePos.x;
Pos.y += mResizePos.y;
UIControl::setPixelsPosition( mRealPos.x + Pos.x, mRealPos.y );
UINode::setPixelsPosition( mRealPos.x + Pos.x, mRealPos.y );
internalSize( mRealSize.getWidth() - Pos.x, Pos.y );
break;
}
@@ -934,15 +934,15 @@ UIWidget * UIWindow::getContainer() const {
return mContainer;
}
UIControlAnim * UIWindow::getButtonClose() const {
UINode * UIWindow::getButtonClose() const {
return mButtonClose;
}
UIControlAnim * UIWindow::getButtonMaximize() const {
UINode * UIWindow::getButtonMaximize() const {
return mButtonMaximize;
}
UIControlAnim * UIWindow::getButtonMinimize() const {
UINode * UIWindow::getButtonMinimize() const {
return mButtonMinimize;
}
@@ -995,15 +995,10 @@ bool UIWindow::hide() {
void UIWindow::onAlphaChange() {
if ( mStyleConfig.WinFlags & UI_WIN_SHARE_ALPHA_WITH_CHILDS ) {
UIControlAnim * AnimChild;
UIControl * CurChild = mChild;
UINode * CurChild = mChild;
while ( NULL != CurChild ) {
if ( CurChild->isAnimated() ) {
AnimChild = reinterpret_cast<UIControlAnim*> ( CurChild );
AnimChild->setAlpha( mAlpha );
}
CurChild->setAlpha( mAlpha );
CurChild = CurChild->getNextControl();
}
}
@@ -1015,7 +1010,7 @@ void UIWindow::onChildCountChange() {
if ( NULL == mContainer || UIManager::instance()->getMainControl() == this )
return;
UIControl * child = mChild;
UINode * child = mChild;
bool found = false;
while ( NULL != child ) {
@@ -1034,7 +1029,7 @@ void UIWindow::onChildCountChange() {
void UIWindow::setBaseAlpha( const Uint8& Alpha ) {
if ( mAlpha == mStyleConfig.BaseAlpha ) {
UIControlAnim::setAlpha( Alpha );
UINode::setAlpha( Alpha );
}
mStyleConfig.BaseAlpha = Alpha;
@@ -1088,7 +1083,7 @@ UITextView * UIWindow::getTitleTextBox() const {
}
void UIWindow::maximize() {
UIControl * Ctrl = UIManager::instance()->getMainControl();
UINode * Ctrl = UIManager::instance()->getMainControl();
if ( Ctrl->getSize() == mSize ) {
setPixelsPosition( mNonMaxPos );
@@ -1329,7 +1324,7 @@ void UIWindow::resizeCursor() {
worldToControl( Pos );
const UIControl * Control = Man->getOverControl();
const UINode * Control = Man->getOverControl();
if ( Control == this ) {
if ( Pos.x <= mBorderLeft->getSize().getWidth() ) {

View File

@@ -219,7 +219,7 @@ Uint32 UIWinMenu::onMessage( const UIMessage * Msg ) {
}
case UIMessage::FocusLoss:
{
UIControl * FocusCtrl = UIManager::instance()->getFocusControl();
UINode * FocusCtrl = UIManager::instance()->getFocusControl();
if ( !isParentOf( FocusCtrl ) && !isPopUpMenuChild( FocusCtrl ) ) {
onWidgetFocusLoss();
@@ -256,7 +256,7 @@ UIPopUpMenu * UIWinMenu::getMenuFromButton( UISelectButton * Button ) {
return NULL;
}
bool UIWinMenu::isPopUpMenuChild( UIControl * Ctrl ) {
bool UIWinMenu::isPopUpMenuChild( UINode * Ctrl ) {
for ( WinMenuList::iterator it = mButtons.begin(); it != mButtons.end(); it++ ) {
if ( it->second == Ctrl || it->second->isParentOf( Ctrl ) ) {
return true;
@@ -267,7 +267,7 @@ bool UIWinMenu::isPopUpMenuChild( UIControl * Ctrl ) {
}
void UIWinMenu::onMenuFocusLoss( const UIEvent * Event ) {
UIControl * FocusCtrl = UIManager::instance()->getFocusControl();
UINode * FocusCtrl = UIManager::instance()->getFocusControl();
if ( !isParentOf( FocusCtrl ) && !isPopUpMenuChild( FocusCtrl ) ) {
onWidgetFocusLoss();

View File

@@ -99,11 +99,7 @@ void InputSDL::update() {
String txt = String::fromUtf8( SDLEvent.text.text );
EEEvent.Type = InputEvent::TextInput;
#if SDL_VERSION_ATLEAST(2,0,0)
EEEvent.text.timestamp = SDLEvent.text.timestamp;
#else
EEEvent.text.timestamp = Sys::getTicks();
#endif
EEEvent.text.text = txt[0];
processEvent( &EEEvent );

View File

@@ -164,13 +164,11 @@ bool WindowSDL::create( WindowSettings Settings, ContextSettings Context ) {
#endif
}
#else
#if SDL_VERSION_ATLEAST(2,0,0)
if ( GLv_3CP == Context.Version ) {
SDL_GL_SetAttribute(SDL_GL_CONTEXT_PROFILE_MASK, SDL_GL_CONTEXT_PROFILE_CORE);
SDL_GL_SetAttribute(SDL_GL_CONTEXT_MAJOR_VERSION, 3);
SDL_GL_SetAttribute(SDL_GL_CONTEXT_MINOR_VERSION, 2);
}
#endif
#endif
#ifdef SDL2_THREADED_GLCONTEXT
@@ -390,9 +388,7 @@ void WindowSDL::setSize( Uint32 Width, Uint32 Height, bool Windowed ) {
if ( isWindowed() && !Windowed ) {
mWinPos = getPosition();
} else {
#if SDL_VERSION_ATLEAST(2,0,0)
SDL_SetWindowFullscreen( mSDLWindow, Windowed ? 0 : SDL_WINDOW_FULLSCREEN );
#endif
}
SDL_SetWindowSize( mSDLWindow, Width, Height );
@@ -402,9 +398,7 @@ void WindowSDL::setSize( Uint32 Width, Uint32 Height, bool Windowed ) {
setGLConfig();
#if SDL_VERSION_ATLEAST(2,0,0)
SDL_SetWindowFullscreen( mSDLWindow, Windowed ? 0 : SDL_WINDOW_FULLSCREEN );
#endif
}
if ( isWindowed() && Windowed ) {
@@ -576,12 +570,10 @@ Vector2i WindowSDL::getPosition() {
}
void WindowSDL::updateDesktopResolution() {
#if SDL_VERSION_ATLEAST(2,0,0)
SDL_DisplayMode dpm;
SDL_GetDesktopDisplayMode( SDL_GetWindowDisplayIndex( mSDLWindow ), &dpm );
mWindow.DesktopResolution = Sizei( dpm.w, dpm.h );
#endif
}
const Sizei& WindowSDL::getDesktopResolution() {
@@ -598,11 +590,7 @@ void WindowSDL::startTextInput() {
}
bool WindowSDL::isTextInputActive() {
#if SDL_VERSION_ATLEAST(2,0,0)
return SDL_TRUE == SDL_IsTextInputActive();
#else
return false;
#endif
}
void WindowSDL::stopTextInput() {
@@ -626,19 +614,11 @@ void WindowSDL::setTextInputRect( Rect& rect ) {
}
bool WindowSDL::hasScreenKeyboardSupport() {
#if SDL_VERSION_ATLEAST(2,0,0)
return SDL_TRUE == SDL_HasScreenKeyboardSupport();
#else
return false;
#endif
}
bool WindowSDL::isScreenKeyboardShown() {
#if SDL_VERSION_ATLEAST(2,0,0)
return SDL_TRUE == SDL_IsScreenKeyboardShown( mSDLWindow );
#else
return false;
#endif
}
}}}}

View File

@@ -312,12 +312,12 @@ void EETest::createShaders() {
void EETest::onWinMouseUp( const UIEvent * Event ) {
const UIEventMouse * MEvent = reinterpret_cast<const UIEventMouse*> ( Event );
UIControlAnim * CtrlAnim;
UINode * CtrlAnim;
if ( Event->getControl()->isType( UI_TYPE_WINDOW ) ) {
CtrlAnim = reinterpret_cast<UIControlAnim*>( Event->getControl() );
CtrlAnim = reinterpret_cast<UINode*>( Event->getControl() );
} else {
CtrlAnim = reinterpret_cast<UIControlAnim*>( Event->getControl()->getParent() );
CtrlAnim = reinterpret_cast<UINode*>( Event->getControl()->getParent() );
}
if ( MEvent->getFlags() & EE_BUTTON_WUMASK ) {
@@ -560,7 +560,7 @@ void EETest::createUI() {
genGrid->setCollumnWidth( 1, 24 );
genGrid->setCollumnWidth( 2, 100 );
C = reinterpret_cast<UIControlAnim*> ( C->getParent() );
C = reinterpret_cast<UINode*> ( C->getParent() );
//createNewUI();
@@ -598,7 +598,7 @@ void EETest::createNewUI() {
relLay = UIRelativeLayout::New();
relLay->setLayoutSizeRules( MATCH_PARENT, MATCH_PARENT );
UIControlAnim * container = UIControlAnim::New();
UINode * container = UINode::New();
container->setSize( relLay->getSize() - 32 );
UIScrollView * scrollView = UIScrollView::New();
@@ -910,13 +910,13 @@ void EETest::createCommonDialog() {
}
static void onWinDragStart( const UIEvent * event ) {
UIControl * ctrl = static_cast<UIControl*>( event->getControl() );
UINode * ctrl = static_cast<UINode*>( event->getControl() );
UIWindow * window = ctrl->isType(UI_TYPE_WINDOW) ? static_cast<UIWindow*>( ctrl ) : static_cast<UIWindow*>( ctrl->getWindowContainer()->getParent() );
window->startAlphaAnim( window->getAlpha(), 100, Seconds(0.2f) );
}
static void onWinDragStop( const UIEvent * event ) {
UIControl * ctrl = static_cast<UIControl*>( event->getControl() );
UINode * ctrl = static_cast<UINode*>( event->getControl() );
UIWindow * window = ctrl->isType(UI_TYPE_WINDOW) ? static_cast<UIWindow*>( ctrl ) : static_cast<UIWindow*>( ctrl->getWindowContainer()->getParent() );
window->startAlphaAnim( window->getAlpha(), 255, Seconds(0.2f) );
}

View File

@@ -159,7 +159,7 @@ class EETest : private Thread {
void createDecoratedWindow();
void createUIThemeTextureAtlas();
UIControlAnim * C;
UINode * C;
UIScrollBar * mScrollBar;
UITextView * mTextBoxValue;
UISlider * mSlider;