Removed InheritsFrom and IsTypeOrInheritsFrom, now it's contained in IsType.

Fixed IsType in cGameObjects.
This commit is contained in:
spartanj@gmail.com
2011-08-22 22:41:56 -03:00
parent 4e70877ef1
commit d2c002f992
72 changed files with 413 additions and 115 deletions

View File

@@ -13,8 +13,12 @@ cGameObject::~cGameObject()
{
}
Uint32 cGameObject::Type() const {
return GAMEOBJECT_TYPE_BASE;
}
bool cGameObject::IsType( const Uint32& type ) {
return type == Type();
return type == cGameObject::Type();
}
const Uint32& cGameObject::Flags() const {
@@ -94,10 +98,6 @@ eeSize cGameObject::Size() {
return eeSize();
}
Uint32 cGameObject::Type() const {
return GAMEOBJECT_TYPE_BASE;
}
Uint32 cGameObject::DataId() {
return 0;
}

View File

@@ -22,7 +22,7 @@ Uint32 cGameObjectShape::Type() const {
}
bool cGameObjectShape::IsType( const Uint32& type ) {
return ( Type() == type ) ? true : cGameObject::IsType( type );
return ( cGameObjectShape::Type() == type ) ? true : cGameObject::IsType( type );
}
void cGameObjectShape::Draw() {

View File

@@ -28,7 +28,7 @@ Uint32 cGameObjectShapeEx::Type() const {
}
bool cGameObjectShapeEx::IsType( const Uint32& type ) {
return ( Type() == type ) ? true : cGameObjectShape::IsType( type );
return ( cGameObjectShapeEx::Type() == type ) ? true : cGameObjectShape::IsType( type );
}
void cGameObjectShapeEx::Draw() {

View File

@@ -24,7 +24,7 @@ Uint32 cGameObjectSprite::Type() const {
}
bool cGameObjectSprite::IsType( const Uint32& type ) {
return ( Type() == type ) ? true : cGameObject::IsType( type );
return ( cGameObjectSprite::Type() == type ) ? true : cGameObject::IsType( type );
}
void cGameObjectSprite::Draw() {

View File

@@ -38,7 +38,7 @@ Uint32 cGameObjectVirtual::Type() const {
}
bool cGameObjectVirtual::IsType( const Uint32& type ) {
return ( Type() == type ) ? true : cGameObject::IsType( type );
return ( cGameObjectVirtual::Type() == type ) ? true : cGameObject::IsType( type );
}
Uint32 cGameObjectVirtual::RealType() const {

View File

@@ -741,7 +741,7 @@ void cMapEditor::MapSave( const cUIEvent * Event ) {
}
void cMapEditor::FileMenuClick( const cUIEvent * Event ) {
if ( !Event->Ctrl()->IsTypeOrInheritsFrom( UI_TYPE_MENUITEM ) )
if ( !Event->Ctrl()->IsType( UI_TYPE_MENUITEM ) )
return;
const String& txt = reinterpret_cast<cUIMenuItem*> ( Event->Ctrl() )->Text();
@@ -792,7 +792,7 @@ void cMapEditor::OnMapClose( const cUIEvent * Event ) {
}
void cMapEditor::ViewMenuClick( const cUIEvent * Event ) {
if ( !Event->Ctrl()->IsTypeOrInheritsFrom( UI_TYPE_MENUITEM ) )
if ( !Event->Ctrl()->IsType( UI_TYPE_MENUITEM ) )
return;
const String& txt = reinterpret_cast<cUIMenuItem*> ( Event->Ctrl() )->Text();
@@ -807,7 +807,7 @@ void cMapEditor::ViewMenuClick( const cUIEvent * Event ) {
}
void cMapEditor::MapMenuClick( const cUIEvent * Event ) {
if ( !Event->Ctrl()->IsTypeOrInheritsFrom( UI_TYPE_MENUITEM ) )
if ( !Event->Ctrl()->IsType( UI_TYPE_MENUITEM ) )
return;
const String& txt = reinterpret_cast<cUIMenuItem*> ( Event->Ctrl() )->Text();
@@ -830,7 +830,7 @@ void cMapEditor::MapMenuClick( const cUIEvent * Event ) {
}
void cMapEditor::LayerMenuClick( const cUIEvent * Event ) {
if ( !Event->Ctrl()->IsTypeOrInheritsFrom( UI_TYPE_MENUITEM ) )
if ( !Event->Ctrl()->IsType( UI_TYPE_MENUITEM ) )
return;
const String& txt = reinterpret_cast<cUIMenuItem*> ( Event->Ctrl() )->Text();

View File

@@ -632,7 +632,7 @@ void cEETest::CloseClick( const cUIEvent * Event ) {
}
void cEETest::ItemClick( const cUIEvent * Event ) {
if ( !Event->Ctrl()->IsTypeOrInheritsFrom( UI_TYPE_MENUITEM ) )
if ( !Event->Ctrl()->IsType( UI_TYPE_MENUITEM ) )
return;
const String& txt = reinterpret_cast<cUIMenuItem*> ( Event->Ctrl() )->Text();
@@ -849,7 +849,7 @@ void cEETest::LoadTextures() {
CurMan->Visible( false );
CurMan->Visible( true );
CurMan->Set( Window::Cursor::SYS_CURSOR_LINK );
CurMan->Set( CurMan->Add( CurMan->Create( CursorP[1], eeVector2i( 2, 2 ), "cursor_special" ) ) );
CurMan->Set( CurMan->Add( CurMan->Create( CursorP[1], eeVector2i( 1, 1 ), "cursor_special" ) ) );
CL1.AddFrame(TN[2]);
CL1.Position( 500, 400 );

View File

@@ -7,8 +7,6 @@ cUICheckBox::cUICheckBox( const cUITextBox::CreateParams& Params ) :
cUITextBox( Params ),
mActive( false )
{
mType = UI_TYPE_CHECKBOX;
cUIControlAnim::CreateParams ButtonParams( Params );
ButtonParams.Parent( this );
@@ -31,6 +29,14 @@ cUICheckBox::cUICheckBox( const cUITextBox::CreateParams& Params ) :
cUICheckBox::~cUICheckBox() {
}
Uint32 cUICheckBox::Type() const {
return UI_TYPE_CHECKBOX;
}
bool cUICheckBox::IsType( const Uint32& type ) const {
return cUICheckBox::Type() == type ? true : cUITextBox::IsType( type );
}
void cUICheckBox::SetTheme( cUITheme * Theme ) {
cUIControl::SetTheme( Theme, "checkbox" );

View File

@@ -12,6 +12,10 @@ class EE_API cUICheckBox : public cUITextBox {
~cUICheckBox();
virtual Uint32 Type() const;
virtual bool IsType( const Uint32& type ) const;
virtual void SetTheme( cUITheme * Theme );
const bool& IsActive() const;

View File

@@ -6,8 +6,6 @@ cUIComboBox::cUIComboBox( cUIComboBox::CreateParams& Params ) :
cUIDropDownList( Params ),
mButton( NULL )
{
mType = UI_TYPE_COMBOBOX;
AllowEditing( true );
ApplyDefaultTheme();
@@ -16,6 +14,14 @@ cUIComboBox::cUIComboBox( cUIComboBox::CreateParams& Params ) :
cUIComboBox::~cUIComboBox() {
}
Uint32 cUIComboBox::Type() const {
return UI_TYPE_COMBOBOX;
}
bool cUIComboBox::IsType( const Uint32& type ) const {
return cUIComboBox::Type() == type ? true : cUIDropDownList::IsType( type );
}
void cUIComboBox::SetTheme( cUITheme * Theme ) {
cUIControl::SetTheme( Theme, "combobox" );

View File

@@ -11,6 +11,10 @@ class EE_API cUIComboBox : public cUIDropDownList {
~cUIComboBox();
virtual Uint32 Type() const;
virtual bool IsType( const Uint32& type ) const;
virtual void SetTheme( cUITheme * Theme );
protected:
cUIControl * mButton;

View File

@@ -13,8 +13,6 @@ cUICommonDialog::cUICommonDialog( const cUICommonDialog::CreateParams& Params )
mCurPath( Params.DefaultDirectory ),
mCDLFlags( Params.CDLFlags )
{
mType = UI_TYPE_COMMONDIALOG;
if ( mSize.Width() < CDLG_MIN_WIDTH )
mSize.x = CDLG_MIN_WIDTH;
@@ -140,6 +138,14 @@ cUICommonDialog::cUICommonDialog( const cUICommonDialog::CreateParams& Params )
cUICommonDialog::~cUICommonDialog() {
}
Uint32 cUICommonDialog::Type() const {
return UI_TYPE_COMMONDIALOG;
}
bool cUICommonDialog::IsType( const Uint32& type ) const {
return cUICommonDialog::Type() == type ? true : cUIWindow::IsType( type );
}
void cUICommonDialog::SetTheme( cUITheme * Theme ) {
cUIWindow::SetTheme( Theme );
@@ -239,7 +245,7 @@ Uint32 cUICommonDialog::OnMessage( const cUIMessage * Msg ) {
case cUIMessage::MsgDoubleClick:
{
if ( Msg->Flags() & EE_BUTTON_LMASK ) {
if ( Msg->Sender()->IsTypeOrInheritsFrom( UI_TYPE_LISTBOXITEM ) ) {
if ( Msg->Sender()->IsType( UI_TYPE_LISTBOXITEM ) ) {
std::string newPath = mCurPath + mList->GetItemSelectedText();
if ( IsDirectory( newPath ) ) {

View File

@@ -34,6 +34,10 @@ class EE_API cUICommonDialog : public cUIWindow {
virtual ~cUICommonDialog();
virtual Uint32 Type() const;
virtual bool IsType( const Uint32& type ) const;
virtual void SetTheme( cUITheme * Theme );
void RefreshFolder();

View File

@@ -8,7 +8,6 @@ cUIComplexControl::cUIComplexControl( const cUIComplexControl::CreateParams& Par
mTooltip( NULL ),
mMinControlSize( Params.MinControlSize )
{
mType = UI_TYPE_CONTROL_COMPLEX;
mControlFlags |= UI_CTRL_FLAG_COMPLEX;
CalcDistToBorder();
@@ -20,6 +19,14 @@ cUIComplexControl::~cUIComplexControl() {
eeSAFE_DELETE( mTooltip );
}
Uint32 cUIComplexControl::Type() const {
return UI_TYPE_CONTROL_COMPLEX;
}
bool cUIComplexControl::IsType( const Uint32& type ) const {
return cUIComplexControl::Type() == type ? true : cUIControlAnim::IsType( type );
}
void cUIComplexControl::CalcDistToBorder() {
if ( NULL != mParentCtrl ) {
mDistToBorder = eeRecti( mPos.x, mPos.y, mParentCtrl->Size().x - ( mPos.x + mSize.x ), mParentCtrl->Size().y - ( mPos.y + mSize.y ) );

View File

@@ -41,6 +41,10 @@ class EE_API cUIComplexControl : public cUIControlAnim {
virtual ~cUIComplexControl();
virtual Uint32 Type() const;
virtual bool IsType( const Uint32& type ) const;
virtual void Update();
virtual void Size( const eeSize &Size );

View File

@@ -7,7 +7,6 @@ cUIControl::cUIControl( const CreateParams& Params ) :
mPos( Params.Pos ),
mSize( Params.Size ),
mFlags( Params.Flags ),
mType( UI_TYPE_CONTROL ),
mData( 0 ),
mParentCtrl( Params.ParentCtrl ),
mChild( NULL ),
@@ -89,19 +88,11 @@ void cUIControl::ControlToScreen( eeVector2i& Pos ) const {
}
Uint32 cUIControl::Type() const {
return mType;
return UI_TYPE_CONTROL;
}
bool cUIControl::IsType( const Uint32& Type ) const {
return mType == Type;
}
bool cUIControl::InheritsFrom( const Uint32 Type ) {
return false;
}
bool cUIControl::IsTypeOrInheritsFrom( const Uint32 Type ) {
return IsType( Type ) || InheritsFrom( Type );
bool cUIControl::IsType( const Uint32& type ) const {
return cUIControl::Type() == type;
}
void cUIControl::MessagePost( const cUIMessage * Msg ) {

View File

@@ -78,14 +78,9 @@ class EE_API cUIControl {
void ControlToScreen( eeVector2i& Pos ) const;
Uint32 Type() const;
virtual Uint32 Type() const;
bool IsType( const Uint32& Type ) const;
//! This exists because i want to avoid dynamic_cast if it's possible. It's ugly, i don't like the solution, but, works.
virtual bool InheritsFrom( const Uint32 Type );
bool IsTypeOrInheritsFrom( const Uint32 Type );
virtual bool IsType( const Uint32& type ) const;
virtual void MessagePost( const cUIMessage * Msg );
@@ -244,7 +239,6 @@ class EE_API cUIControl {
eeSize mSize;
Uint32 mFlags;
Uint32 mType;
Uint32 mData;
cUIControl * mParentCtrl;

View File

@@ -13,7 +13,6 @@ cUIControlAnim::cUIControlAnim( const CreateParams& Params ) :
mAlphaAnim(NULL),
mMoveAnim(NULL)
{
mType = UI_TYPE_CONTROL_ANIM;
mControlFlags |= UI_CTRL_FLAG_ANIM;
}
@@ -24,6 +23,14 @@ cUIControlAnim::~cUIControlAnim() {
eeSAFE_DELETE( mMoveAnim );
}
Uint32 cUIControlAnim::Type() const {
return UI_TYPE_CONTROL_ANIM;
}
bool cUIControlAnim::IsType( const Uint32& type ) const {
return cUIControlAnim::Type() == type ? true : cUIControl::IsType( type );
}
void cUIControlAnim::Draw() {
if ( mVisible && 0.f != mAlpha ) {
if ( mFlags & UI_FILL_BACKGROUND )

View File

@@ -13,6 +13,10 @@ class EE_API cUIControlAnim : public cUIDragable {
virtual ~cUIControlAnim();
virtual Uint32 Type() const;
virtual bool IsType( const Uint32& type ) const;
virtual void Update();
const eeFloat& Angle() const;

View File

@@ -8,13 +8,20 @@ cUIDragable::cUIDragable( const cUIControl::CreateParams& Params ) :
cUIControl( Params ),
mDragButton( EE_BUTTON_LMASK )
{
mType = UI_TYPE_CONTROL_DRAGABLE;
mControlFlags |= UI_CTRL_FLAG_DRAGABLE;
}
cUIDragable::~cUIDragable() {
}
Uint32 cUIDragable::Type() const {
return UI_TYPE_CONTROL_DRAGABLE;
}
bool cUIDragable::IsType( const Uint32& type ) const {
return cUIDragable::Type() == type ? true : cUIControl::IsType( type );
}
Uint32 cUIDragable::OnMouseDown( const eeVector2i& Pos, const Uint32 Flags ) {
if ( !( cUIManager::instance()->LastPressTrigger() & mDragButton ) && ( Flags & mDragButton ) && DragEnable() && !Dragging() ) {
Dragging( true );

View File

@@ -9,6 +9,10 @@ class EE_API cUIDragable : public cUIControl {
public:
cUIDragable( const cUIControl::CreateParams& Params );
virtual Uint32 Type() const;
virtual bool IsType( const Uint32& type ) const;
bool Dragging() const;
void Dragging( const bool& dragging );

View File

@@ -9,8 +9,6 @@ cUIDropDownList::cUIDropDownList( cUIDropDownList::CreateParams& Params ) :
mMinNumVisibleItems( Params.MinNumVisibleItems ),
mPopUpToMainControl( Params.PopUpToMainControl )
{
mType = UI_TYPE_DROPDOWNLIST;
AllowEditing( false );
ApplyDefaultTheme();
@@ -37,6 +35,14 @@ cUIDropDownList::cUIDropDownList( cUIDropDownList::CreateParams& Params ) :
cUIDropDownList::~cUIDropDownList() {
}
Uint32 cUIDropDownList::Type() const {
return UI_TYPE_DROPDOWNLIST;
}
bool cUIDropDownList::IsType( const Uint32& type ) const {
return cUIDropDownList::Type() == type ? true : cUITextInput::IsType( type );
}
void cUIDropDownList::SetTheme( cUITheme * Theme ) {
cUIControl::SetTheme( Theme, "dropdownlist" );

View File

@@ -29,6 +29,10 @@ class EE_API cUIDropDownList : public cUITextInput {
~cUIDropDownList();
virtual Uint32 Type() const;
virtual bool IsType( const Uint32& type ) const;
virtual void SetTheme( cUITheme * Theme );
cUIListBox * ListBox() const;

View File

@@ -23,8 +23,6 @@ cUIGenericGrid::cUIGenericGrid( const cUIGenericGrid::CreateParams& Params ) :
mSelected(-1),
mCollWidthAssigned( false )
{
mType = UI_TYPE_GENERICGRID;
mCollumnsWidth.resize( mCollumnsCount, 0 );
mCollumnsPos.resize( mCollumnsCount, 0 );
@@ -72,6 +70,14 @@ cUIGenericGrid::cUIGenericGrid( const cUIGenericGrid::CreateParams& Params ) :
cUIGenericGrid::~cUIGenericGrid() {
}
Uint32 cUIGenericGrid::Type() const {
return UI_TYPE_GENERICGRID;
}
bool cUIGenericGrid::IsType( const Uint32& type ) const {
return cUIGenericGrid::Type() == type ? true : cUIControlAnim::IsType( type );
}
void cUIGenericGrid::SetDefaultCollumnsWidth() {
if ( mCollWidthAssigned )
return;

View File

@@ -38,6 +38,10 @@ class EE_API cUIGenericGrid : public cUIControlAnim {
~cUIGenericGrid();
virtual Uint32 Type() const;
virtual bool IsType( const Uint32& type ) const;
virtual void SetTheme( cUITheme * Theme );
void Add( cUIGridCell * Cell );

View File

@@ -9,8 +9,6 @@ cUIGfx::cUIGfx( const cUIGfx::CreateParams& Params ) :
mRender( Params.ShapeRender ),
mAlignOffset(0,0)
{
mType = UI_TYPE_GFX;
if ( NULL != mShape && ( ( Flags() & UI_AUTO_SIZE ) || ( Params.Size.x == -1 && Params.Size.y == -1 ) ) )
Size( mShape->Size() );
@@ -22,6 +20,14 @@ cUIGfx::cUIGfx( const cUIGfx::CreateParams& Params ) :
cUIGfx::~cUIGfx() {
}
Uint32 cUIGfx::Type() const {
return UI_TYPE_GFX;
}
bool cUIGfx::IsType( const Uint32& type ) const {
return cUIGfx::Type() == type ? true : cUIComplexControl::IsType( type );
}
void cUIGfx::Shape( cShape * shape ) {
mShape = shape;

View File

@@ -28,6 +28,10 @@ class EE_API cUIGfx : public cUIComplexControl {
~cUIGfx();
virtual Uint32 Type() const;
virtual bool IsType( const Uint32& type ) const;
virtual void Draw();
virtual void Alpha( const eeFloat& alpha );

View File

@@ -27,8 +27,6 @@ cUIListBox::cUIListBox( cUIListBox::CreateParams& Params ) :
mVisibleFirst(0),
mVisibleLast(0)
{
mType = UI_TYPE_LISTBOX;
if ( NULL == Params.Font && NULL != cUIThemeManager::instance()->DefaultFont() )
mFont = cUIThemeManager::instance()->DefaultFont();
@@ -78,6 +76,14 @@ cUIListBox::cUIListBox( cUIListBox::CreateParams& Params ) :
cUIListBox::~cUIListBox() {
}
Uint32 cUIListBox::Type() const {
return UI_TYPE_LISTBOX;
}
bool cUIListBox::IsType( const Uint32& type ) const {
return cUIListBox::Type() == type ? true : cUIComplexControl::IsType( type );
}
void cUIListBox::SetTheme( cUITheme * Theme ) {
cUIControl::SetTheme( Theme, "listbox" );

View File

@@ -54,6 +54,10 @@ class EE_API cUIListBox : public cUIComplexControl {
virtual ~cUIListBox();
virtual Uint32 Type() const;
virtual bool IsType( const Uint32& type ) const;
void Clear();
void AddListBoxItems( std::vector<String> Texts );

View File

@@ -7,8 +7,6 @@ namespace EE { namespace UI {
cUIListBoxItem::cUIListBoxItem( const cUITextBox::CreateParams& Params ) :
cUITextBox( Params )
{
mType = UI_TYPE_LISTBOXITEM;
ApplyDefaultTheme();
}
@@ -20,6 +18,14 @@ cUIListBoxItem::~cUIListBoxItem() {
cUIManager::instance()->OverControl( mParentCtrl );
}
Uint32 cUIListBoxItem::Type() const {
return UI_TYPE_LISTBOXITEM;
}
bool cUIListBoxItem::IsType( const Uint32& type ) const {
return cUIListBoxItem::Type() == type ? true : cUITextBox::IsType( type );
}
void cUIListBoxItem::SetTheme( cUITheme * Theme ) {
cUIControl::SetTheme( Theme, "listboxitem" );
}

View File

@@ -14,6 +14,10 @@ class EE_API cUIListBoxItem : public cUITextBox {
virtual ~cUIListBoxItem();
virtual Uint32 Type() const;
virtual bool IsType( const Uint32& type ) const;
virtual void SetTheme( cUITheme * Theme );
virtual void Update();

View File

@@ -23,8 +23,6 @@ cUIMenu::cUIMenu( cUIMenu::CreateParams& Params ) :
mClickHide( false ),
mLastTickMove( 0 )
{
mType = UI_TYPE_MENU;
OnSizeChange();
ApplyDefaultTheme();
@@ -33,6 +31,14 @@ cUIMenu::cUIMenu( cUIMenu::CreateParams& Params ) :
cUIMenu::~cUIMenu() {
}
Uint32 cUIMenu::Type() const {
return UI_TYPE_MENU;
}
bool cUIMenu::IsType( const Uint32& type ) const {
return cUIMenu::Type() == type ? true : cUIComplexControl::IsType( type );
}
void cUIMenu::SetTheme( cUITheme * Theme ) {
cUIControl::SetTheme( Theme, "menu" );
DoAfterSetTheme();
@@ -145,7 +151,7 @@ Uint32 cUIMenu::AddSubMenu( const String& Text, cShape * Icon, cUIMenu * SubMenu
}
bool cUIMenu::CheckControlSize( cUIControl * Control, const bool& Resize ) {
if ( Control->IsTypeOrInheritsFrom( UI_TYPE_MENUITEM ) ) {
if ( Control->IsType( UI_TYPE_MENUITEM ) ) {
cUIMenuItem * tItem = reinterpret_cast<cUIMenuItem*> ( Control );
if ( NULL != tItem->Icon() && tItem->IconHorizontalMargin() + tItem->Icon()->Size().Width() > (Int32)mBiggestIcon ) {
@@ -153,7 +159,7 @@ bool cUIMenu::CheckControlSize( cUIControl * Control, const bool& Resize ) {
}
if ( mFlags & UI_AUTO_SIZE ) {
if ( Control->IsTypeOrInheritsFrom( UI_TYPE_MENUSUBMENU ) ) {
if ( Control->IsType( UI_TYPE_MENUSUBMENU ) ) {
cUIMenuSubMenu * tMenu = reinterpret_cast<cUIMenuSubMenu*> ( tItem );
if ( tMenu->TextBox()->GetTextWidth() + mBiggestIcon + tMenu->Arrow()->Size().Width() + mMinRightMargin > (Int32)mMaxWidth - mPadding.Left - mPadding.Right ) {
@@ -203,7 +209,7 @@ Uint32 cUIMenu::Add( cUIControl * Control ) {
}
void cUIMenu::SetControlSize( cUIControl * Control, const Uint32& Pos ) {
if ( Control->IsTypeOrInheritsFrom( UI_TYPE_MENUITEM ) ) {
if ( Control->IsType( UI_TYPE_MENUITEM ) ) {
Control->Size( mSize.Width() - mPadding.Left - mPadding.Right, mRowHeight );
} else {
Control->Size( mSize.Width() - mPadding.Left - mPadding.Right, Control->Size().Height() );
@@ -237,7 +243,7 @@ cUIControl * cUIMenu::GetItem( const Uint32& Index ) {
cUIControl * cUIMenu::GetItem( const String& Text ) {
for ( Uint32 i = 0; i < mItems.size(); i++ ) {
if ( mItems[i]->IsTypeOrInheritsFrom( UI_TYPE_MENUITEM ) ) {
if ( mItems[i]->IsType( UI_TYPE_MENUITEM ) ) {
cUIMenuItem * tMenuItem = reinterpret_cast<cUIMenuItem*>( mItems[i] );
if ( tMenuItem->Text() == Text )
@@ -308,7 +314,7 @@ void cUIMenu::Insert( cUIControl * Control, const Uint32& Index ) {
bool cUIMenu::IsSubMenu( cUIControl * Ctrl ) {
for ( Uint32 i = 0; i < mItems.size(); i++ ) {
if ( mItems[i]->IsTypeOrInheritsFrom( UI_TYPE_MENUSUBMENU ) ) {
if ( mItems[i]->IsType( UI_TYPE_MENUSUBMENU ) ) {
cUIMenuSubMenu * tMenu = reinterpret_cast<cUIMenuSubMenu*> ( mItems[i] );
if ( tMenu->SubMenu() == Ctrl )
@@ -420,7 +426,7 @@ bool cUIMenu::Hide() {
void cUIMenu::SetItemSelected( cUIControl * Item ) {
if ( NULL != mItemSelected ) {
if ( mItemSelected->IsTypeOrInheritsFrom( UI_TYPE_MENUSUBMENU ) ) {
if ( mItemSelected->IsType( UI_TYPE_MENUSUBMENU ) ) {
cUIMenuSubMenu * tMenu = reinterpret_cast<cUIMenuSubMenu*> ( mItemSelected );
if ( NULL != tMenu->SubMenu() )
@@ -441,7 +447,7 @@ void cUIMenu::SetItemSelected( cUIControl * Item ) {
void cUIMenu::TrySelect( cUIControl * Ctrl, bool Up ) {
if ( mItems.size() ) {
if ( !Ctrl->IsTypeOrInheritsFrom( UI_TYPE_SEPARATOR ) ) {
if ( !Ctrl->IsType( UI_TYPE_SEPARATOR ) ) {
SetItemSelected( Ctrl );
} else {
Uint32 Index = GetItemIndex( Ctrl );
@@ -450,7 +456,7 @@ void cUIMenu::TrySelect( cUIControl * Ctrl, bool Up ) {
if ( Up ) {
if ( Index > 0 ) {
for ( Int32 i = (Int32)Index - 1; i >= 0; i-- ) {
if ( !mItems[i]->IsTypeOrInheritsFrom( UI_TYPE_SEPARATOR ) ) {
if ( !mItems[i]->IsType( UI_TYPE_SEPARATOR ) ) {
SetItemSelected( mItems[i] );
return;
}
@@ -460,7 +466,7 @@ void cUIMenu::TrySelect( cUIControl * Ctrl, bool Up ) {
SetItemSelected( mItems[ mItems.size() ] );
} else {
for ( Uint32 i = Index + 1; i < mItems.size(); i++ ) {
if ( !mItems[i]->IsTypeOrInheritsFrom( UI_TYPE_SEPARATOR ) ) {
if ( !mItems[i]->IsType( UI_TYPE_SEPARATOR ) ) {
SetItemSelected( mItems[i] );
return;
}
@@ -515,7 +521,7 @@ Uint32 cUIMenu::OnKeyDown( const cUIEventKey& Event ) {
break;
case KEY_RIGHT:
if ( NULL != mItemSelected && ( mItemSelected->IsTypeOrInheritsFrom( UI_TYPE_MENUSUBMENU ) ) ) {
if ( NULL != mItemSelected && ( mItemSelected->IsType( UI_TYPE_MENUSUBMENU ) ) ) {
cUIMenuSubMenu * tMenu = reinterpret_cast<cUIMenuSubMenu*> ( mItemSelected );
tMenu->ShowSubMenu();

View File

@@ -60,6 +60,10 @@ class EE_API cUIMenu : public cUIComplexControl {
~cUIMenu();
virtual Uint32 Type() const;
virtual bool IsType( const Uint32& type ) const;
Uint32 Add( const String& Text, cShape * Icon = NULL );
Uint32 Add( cUIControl * Control );

View File

@@ -9,14 +9,20 @@ cUIMenuCheckBox::cUIMenuCheckBox( cUIMenuCheckBox::CreateParams& Params ) :
mSkinActive( NULL ),
mSkinInactive( NULL )
{
mType = UI_TYPE_MENUCHECKBOX;
ApplyDefaultTheme();
}
cUIMenuCheckBox::~cUIMenuCheckBox() {
}
Uint32 cUIMenuCheckBox::Type() const {
return UI_TYPE_MENUCHECKBOX;
}
bool cUIMenuCheckBox::IsType( const Uint32& type ) const {
return cUIMenuCheckBox::Type() == type ? true : cUIMenuItem::IsType( type );
}
void cUIMenuCheckBox::SetTheme( cUITheme * Theme ) {
cUIControl::SetTheme( Theme, "menuitem" );

View File

@@ -11,6 +11,10 @@ class cUIMenuCheckBox : public cUIMenuItem {
~cUIMenuCheckBox();
virtual Uint32 Type() const;
virtual bool IsType( const Uint32& type ) const;
virtual void SetTheme( cUITheme * Theme );
const bool& Active() const;

View File

@@ -6,14 +6,20 @@ namespace EE { namespace UI {
cUIMenuItem::cUIMenuItem( cUIPushButton::CreateParams& Params ) :
cUIPushButton( Params )
{
mType = UI_TYPE_MENUITEM;
ApplyDefaultTheme();
}
cUIMenuItem::~cUIMenuItem() {
}
Uint32 cUIMenuItem::Type() const {
return UI_TYPE_MENUITEM;
}
bool cUIMenuItem::IsType( const Uint32& type ) const {
return cUIMenuItem::Type() == type ? true : cUIPushButton::IsType( type );
}
void cUIMenuItem::SetTheme( cUITheme * Theme ) {
cUIControl::SetTheme( Theme, "menuitem" );
DoAfterSetTheme();

View File

@@ -11,6 +11,10 @@ class EE_API cUIMenuItem : public cUIPushButton {
~cUIMenuItem();
virtual Uint32 Type() const;
virtual bool IsType( const Uint32& type ) const;
virtual void SetTheme( cUITheme * Theme );
protected:
virtual Uint32 OnMouseEnter( const eeVector2i &Pos, Uint32 Flags );

View File

@@ -14,8 +14,6 @@ cUIMenuSubMenu::cUIMenuSubMenu( cUIMenuSubMenu::CreateParams& Params ) :
mCbId( 0 ),
mCbId2( 0 )
{
mType = UI_TYPE_MENUSUBMENU;
cUIGfx::CreateParams GfxParams;
GfxParams.Parent( this );
GfxParams.Shape = NULL;
@@ -32,6 +30,14 @@ cUIMenuSubMenu::cUIMenuSubMenu( cUIMenuSubMenu::CreateParams& Params ) :
cUIMenuSubMenu::~cUIMenuSubMenu() {
}
Uint32 cUIMenuSubMenu::Type() const {
return UI_TYPE_MENUSUBMENU;
}
bool cUIMenuSubMenu::IsType( const Uint32& type ) const {
return cUIMenuSubMenu::Type() == type ? true : cUIMenuItem::IsType( type );
}
void cUIMenuSubMenu::SetTheme( cUITheme * Theme ) {
cUIMenuItem::SetTheme( Theme );

View File

@@ -28,6 +28,10 @@ class cUIMenuSubMenu : public cUIMenuItem {
~cUIMenuSubMenu();
virtual Uint32 Type() const;
virtual bool IsType( const Uint32& type ) const;
virtual void SetTheme( cUITheme * Theme );
void SubMenu( cUIMenu * SubMenu );

View File

@@ -6,14 +6,20 @@ namespace EE { namespace UI {
cUIPopUpMenu::cUIPopUpMenu( cUIPopUpMenu::CreateParams Params ) :
cUIMenu( Params )
{
mType = UI_TYPE_POPUPMENU;
ApplyDefaultTheme();
}
cUIPopUpMenu::~cUIPopUpMenu() {
}
Uint32 cUIPopUpMenu::Type() const {
return UI_TYPE_POPUPMENU;
}
bool cUIPopUpMenu::IsType( const Uint32& type ) const {
return cUIPopUpMenu::Type() == type ? true : cUIMenu::IsType( type );
}
void cUIPopUpMenu::SetTheme( cUITheme * Theme ) {
cUIControl::SetTheme( Theme, "popupmenu" );
DoAfterSetTheme();
@@ -74,7 +80,7 @@ Uint32 cUIPopUpMenu::OnMessage( const cUIMessage * Msg ) {
switch ( Msg->Msg() ) {
case cUIMessage::MsgMouseUp:
{
if ( !Msg->Sender()->IsTypeOrInheritsFrom( UI_TYPE_MENUSUBMENU ) && ( Msg->Flags() & EE_BUTTONS_LRM ) ) {
if ( !Msg->Sender()->IsType( UI_TYPE_MENUSUBMENU ) && ( Msg->Flags() & EE_BUTTONS_LRM ) ) {
SendCommonEvent( cUIEvent::EventOnHideByClick );
cUIManager::instance()->MainControl()->SetFocus();

View File

@@ -11,6 +11,10 @@ class cUIPopUpMenu : public cUIMenu {
~cUIPopUpMenu();
virtual Uint32 Type() const;
virtual bool IsType( const Uint32& type ) const;
virtual void SetTheme( cUITheme * Theme );
virtual bool Show();

View File

@@ -12,8 +12,6 @@ cUIProgressBar::cUIProgressBar( const cUIProgressBar::CreateParams& Params ) :
mTotalSteps( 100.f ),
mParallax( NULL )
{
mType = UI_TYPE_PROGRESSBAR;
cUITextBox::CreateParams TxtBoxParams = Params;
TxtBoxParams.Parent( this );
@@ -32,6 +30,14 @@ cUIProgressBar::~cUIProgressBar() {
eeSAFE_DELETE( mParallax );
}
Uint32 cUIProgressBar::Type() const {
return UI_TYPE_PROGRESSBAR;
}
bool cUIProgressBar::IsType( const Uint32& type ) const {
return cUIProgressBar::Type() == type ? true : cUIComplexControl::IsType( type );
}
void cUIProgressBar::Draw() {
cUIControlAnim::Draw();

View File

@@ -31,6 +31,10 @@ class cUIProgressBar : public cUIComplexControl {
~cUIProgressBar();
virtual Uint32 Type() const;
virtual bool IsType( const Uint32& type ) const;
virtual void SetTheme( cUITheme * Theme );
virtual void Progress( eeFloat Val );

View File

@@ -10,8 +10,6 @@ cUIPushButton::cUIPushButton( const cUIPushButton::CreateParams& Params ) :
mTextBox( NULL ),
mIconSpace( Params.IconHorizontalMargin )
{
mType = UI_TYPE_PUSHBUTTON;
cUIGfx::CreateParams GfxParams;
GfxParams.Parent( this );
GfxParams.Shape = Params.Icon;
@@ -55,6 +53,17 @@ cUIPushButton::cUIPushButton( const cUIPushButton::CreateParams& Params ) :
ApplyDefaultTheme();
}
cUIPushButton::~cUIPushButton() {
}
Uint32 cUIPushButton::Type() const {
return UI_TYPE_PUSHBUTTON;
}
bool cUIPushButton::IsType( const Uint32& type ) const {
return cUIPushButton::Type() == type ? true : cUIComplexControl::IsType( type );
}
void cUIPushButton::OnSizeChange() {
if ( NULL != mTextBox ) {
mTextBox->Size( mSize.Width(), mSize.Height() );
@@ -112,9 +121,6 @@ void cUIPushButton::OnSizeChange() {
*/
}
cUIPushButton::~cUIPushButton() {
}
void cUIPushButton::SetTheme( cUITheme * Theme ) {
cUIControl::SetTheme( Theme, "button" );

View File

@@ -58,6 +58,10 @@ class EE_API cUIPushButton : public cUIComplexControl {
~cUIPushButton();
virtual Uint32 Type() const;
virtual bool IsType( const Uint32& type ) const;
virtual void SetTheme( cUITheme * Theme );
virtual void Icon( cShape * Icon );

View File

@@ -9,8 +9,6 @@ cUIRadioButton::cUIRadioButton( const cUITextBox::CreateParams& Params ) :
mInactiveButton(NULL),
mActive( false )
{
mType = UI_TYPE_RADIOBUTTON;
cUIControlAnim::CreateParams ButtonParams( Params );
ButtonParams.Parent( this );
@@ -35,6 +33,14 @@ cUIRadioButton::cUIRadioButton( const cUITextBox::CreateParams& Params ) :
cUIRadioButton::~cUIRadioButton() {
}
Uint32 cUIRadioButton::Type() const {
return UI_TYPE_RADIOBUTTON;
}
bool cUIRadioButton::IsType( const Uint32& type ) const {
return cUIRadioButton::Type() == type ? true : cUITextBox::IsType( type );
}
void cUIRadioButton::SetTheme( cUITheme * Theme ) {
cUIControl::SetTheme( Theme, "radiobutton" );
@@ -130,7 +136,7 @@ void cUIRadioButton::Active( const bool& active ) {
cUIControl * tChild = mParentCtrl->ChildGetFirst();
while ( NULL != tChild ) {
if ( tChild->IsType( UI_TYPE_RADIOBUTTON ) || tChild->InheritsFrom( UI_TYPE_RADIOBUTTON ) ) {
if ( tChild->IsType( UI_TYPE_RADIOBUTTON ) ) {
if ( tChild != this ) {
cUIRadioButton * tRB = reinterpret_cast<cUIRadioButton*> ( tChild );
@@ -149,7 +155,7 @@ bool cUIRadioButton::CheckActives() {
cUIControl * tChild = mParentCtrl->ChildGetFirst();
while ( NULL != tChild ) {
if ( tChild->IsTypeOrInheritsFrom( UI_TYPE_RADIOBUTTON ) ) {
if ( tChild->IsType( UI_TYPE_RADIOBUTTON ) ) {
if ( tChild != this ) {
cUIRadioButton * tRB = reinterpret_cast<cUIRadioButton*> ( tChild );
@@ -172,7 +178,7 @@ void cUIRadioButton::AutoActivate() {
cUIControl * tChild = mParentCtrl->ChildGetFirst();
while ( NULL != tChild ) {
if ( tChild->IsTypeOrInheritsFrom( UI_TYPE_RADIOBUTTON ) ) {
if ( tChild->IsType( UI_TYPE_RADIOBUTTON ) ) {
if ( tChild != this ) {
cUIRadioButton * tRB = reinterpret_cast<cUIRadioButton*> ( tChild );

View File

@@ -12,6 +12,10 @@ class EE_API cUIRadioButton : public cUITextBox {
~cUIRadioButton();
virtual Uint32 Type() const;
virtual bool IsType( const Uint32& type ) const;
virtual void SetTheme( cUITheme * Theme );
const bool& IsActive() const;

View File

@@ -6,8 +6,6 @@ namespace EE { namespace UI {
cUIScrollBar::cUIScrollBar( const cUIScrollBar::CreateParams& Params ) :
cUIComplexControl( Params )
{
mType = UI_TYPE_SCROLLBAR;
cUIControlAnim::CreateParams CParams = Params;
CParams.Size = eeSize( 16, 16 );
CParams.Parent( this );
@@ -46,6 +44,14 @@ cUIScrollBar::cUIScrollBar( const cUIScrollBar::CreateParams& Params ) :
cUIScrollBar::~cUIScrollBar() {
}
Uint32 cUIScrollBar::Type() const {
return UI_TYPE_SCROLLBAR;
}
bool cUIScrollBar::IsType( const Uint32& type ) const {
return cUIScrollBar::Type() == type ? true : cUIComplexControl::IsType( type );
}
void cUIScrollBar::SetTheme( cUITheme * Theme ) {
if ( !IsVertical() ) {
cUIControl::SetTheme( Theme, "hscrollbar" );

View File

@@ -25,6 +25,10 @@ class cUIScrollBar : public cUIComplexControl {
~cUIScrollBar();
virtual Uint32 Type() const;
virtual bool IsType( const Uint32& type ) const;
virtual void Value( eeFloat Val );
const eeFloat& Value() const;

View File

@@ -6,12 +6,19 @@ namespace EE { namespace UI {
cUISelectButton::cUISelectButton( const cUIPushButton::CreateParams& Params ) :
cUIPushButton( Params )
{
mType = UI_TYPE_SELECTBUTTON;
}
cUISelectButton::~cUISelectButton() {
}
Uint32 cUISelectButton::Type() const {
return UI_TYPE_SELECTBUTTON;
}
bool cUISelectButton::IsType( const Uint32& type ) const {
return cUISelectButton::Type() == type ? true : cUIPushButton::IsType( type );
}
void cUISelectButton::Select() {
bool wasSelected = Selected();

View File

@@ -11,6 +11,10 @@ class cUISelectButton : public cUIPushButton {
virtual ~cUISelectButton();
virtual Uint32 Type() const;
virtual bool IsType( const Uint32& type ) const;
virtual bool Selected() const;
virtual void Unselect();

View File

@@ -5,14 +5,20 @@ namespace EE { namespace UI {
cUISeparator::cUISeparator( cUIControlAnim::CreateParams Params ) :
cUIControlAnim( Params )
{
mType = UI_TYPE_SEPARATOR;
ApplyDefaultTheme();
}
cUISeparator::~cUISeparator() {
}
Uint32 cUISeparator::Type() const {
return UI_TYPE_SEPARATOR;
}
bool cUISeparator::IsType( const Uint32& type ) const {
return cUISeparator::Type() == type ? true : cUIControlAnim::IsType( type );
}
void cUISeparator::SetTheme( cUITheme * Theme ) {
cUIControl::SetTheme( Theme, "separator" );

View File

@@ -10,7 +10,11 @@ class cUISeparator : public cUIControlAnim {
cUISeparator( cUIControlAnim::CreateParams Params );
~cUISeparator();
virtual Uint32 Type() const;
virtual bool IsType( const Uint32& type ) const;
virtual void SetTheme( cUITheme * Theme );
protected:
};

View File

@@ -16,8 +16,6 @@ cUISlider::cUISlider( const cUISlider::CreateParams& Params ) :
mClickStep( 0.1f ),
mOnPosChange( false )
{
mType = UI_TYPE_SLIDER;
cUIControl::CreateParams BgParams;
BgParams.Parent( this );
@@ -52,6 +50,14 @@ cUISlider::cUISlider( const cUISlider::CreateParams& Params ) :
cUISlider::~cUISlider() {
}
Uint32 cUISlider::Type() const {
return UI_TYPE_SLIDER;
}
bool cUISlider::IsType( const Uint32& type ) const {
return cUISlider::Type() == type ? true : cUIComplexControl::IsType( type );
}
void cUISlider::SetTheme( cUITheme * Theme ) {
if ( !mVertical ) {
cUIControl::SetTheme( Theme, "hslider" );

View File

@@ -29,6 +29,10 @@ class EE_API cUISlider : public cUIComplexControl {
~cUISlider();
virtual Uint32 Type() const;
virtual bool IsType( const Uint32& type ) const;
virtual void SetTheme( cUITheme * Theme );
virtual void Value( eeFloat Val );

View File

@@ -9,8 +9,6 @@ cUISpinBox::cUISpinBox( const cUISpinBox::CreateParams& Params ) :
mValue( Params.DefaultValue ),
mClickStep( 1.f )
{
mType = UI_TYPE_SPINBOX;
cUITextInput::CreateParams InputParams( Params );
InputParams.PosSet( 0, 0 );
InputParams.Parent( this );
@@ -49,7 +47,14 @@ cUISpinBox::cUISpinBox( const cUISpinBox::CreateParams& Params ) :
}
cUISpinBox::~cUISpinBox() {
}
Uint32 cUISpinBox::Type() const {
return UI_TYPE_SPINBOX;
}
bool cUISpinBox::IsType( const Uint32& type ) const {
return cUISpinBox::Type() == type ? true : cUIComplexControl::IsType( type );
}
void cUISpinBox::SetTheme( cUITheme * Theme ) {

View File

@@ -28,6 +28,10 @@ class EE_API cUISpinBox : public cUIComplexControl {
~cUISpinBox();
virtual Uint32 Type() const;
virtual bool IsType( const Uint32& type ) const;
virtual void SetTheme( cUITheme * Theme );
virtual void Padding( const eeRecti& padding );

View File

@@ -9,8 +9,6 @@ cUISprite::cUISprite( const cUISprite::CreateParams& Params ) :
mAlignOffset(0,0),
mShapeLast(NULL)
{
mType = UI_TYPE_SPRITE;
if ( Params.DeallocSprite )
mControlFlags |= UI_CTRL_FLAG_FREE_USE;
@@ -26,6 +24,14 @@ cUISprite::~cUISprite() {
eeSAFE_DELETE( mSprite );
}
Uint32 cUISprite::Type() const {
return UI_TYPE_SPRITE;
}
bool cUISprite::IsType( const Uint32& type ) const {
return cUISprite::Type() == type ? true : cUIComplexControl::IsType( type );
}
Uint32 cUISprite::DeallocSprite() {
return mControlFlags & UI_CTRL_FLAG_FREE_USE;
}

View File

@@ -28,6 +28,10 @@ class EE_API cUISprite : public cUIComplexControl {
~cUISprite();
virtual Uint32 Type() const;
virtual bool IsType( const Uint32& type ) const;
virtual void Draw();
virtual void Alpha( const eeFloat& alpha );

View File

@@ -10,8 +10,6 @@ cUITextBox::cUITextBox( const cUITextBox::CreateParams& Params ) :
mFontShadowColor( Params.FontShadowColor ),
mAlignOffset( 0.f, 0.f )
{
mType = UI_TYPE_TEXTBOX;
mTextCache = eeNew( cTextCache, () );
mTextCache->Font( Params.Font );
mTextCache->Color( mFontColor );
@@ -31,6 +29,14 @@ cUITextBox::~cUITextBox() {
eeSAFE_DELETE( mTextCache );
}
Uint32 cUITextBox::Type() const {
return UI_TYPE_TEXTBOX;
}
bool cUITextBox::IsType( const Uint32& type ) const {
return cUITextBox::Type() == type ? true : cUIComplexControl::IsType( type );
}
void cUITextBox::Draw() {
if ( mVisible && 0.f != mAlpha ) {
cUIControlAnim::Draw();

View File

@@ -38,6 +38,10 @@ class EE_API cUITextBox : public cUIComplexControl {
~cUITextBox();
virtual Uint32 Type() const;
virtual bool IsType( const Uint32& type ) const;
virtual void Draw();
virtual void Alpha( const eeFloat& alpha );

View File

@@ -12,8 +12,6 @@ cUITextEdit::cUITextEdit( cUITextEdit::CreateParams& Params ) :
mVScrollBarMode( Params.VScrollBar ),
mSkipValueChange( false )
{
mType = UI_TYPE_TEXTEDIT;
Uint32 extraFlags = 0;
if ( mFlags & UI_ANCHOR_LEFT )
@@ -78,6 +76,14 @@ cUITextEdit::cUITextEdit( cUITextEdit::CreateParams& Params ) :
cUITextEdit::~cUITextEdit() {
}
Uint32 cUITextEdit::Type() const {
return UI_TYPE_TEXTEDIT;
}
bool cUITextEdit::IsType( const Uint32& type ) const {
return cUITextEdit::Type() == type ? true : cUIComplexControl::IsType( type );
}
void cUITextEdit::SetTheme( cUITheme * Theme ) {
cUIControl::SetTheme( Theme, "textedit" );

View File

@@ -29,6 +29,10 @@ class EE_API cUITextEdit : public cUIComplexControl {
~cUITextEdit();
virtual Uint32 Type() const;
virtual bool IsType( const Uint32& type ) const;
virtual void SetTheme( cUITheme * Theme );
const String& Text() const;

View File

@@ -10,8 +10,6 @@ cUITextInput::cUITextInput( const cUITextInput::CreateParams& Params ) :
mAllowEditing( true ),
mShowingWait( true )
{
mType = UI_TYPE_TEXTINPUT;
mTextBuffer.Start();
mTextBuffer.Active( false );
mTextBuffer.SupportFreeEditing( Params.SupportFreeEditing );
@@ -24,6 +22,14 @@ cUITextInput::cUITextInput( const cUITextInput::CreateParams& Params ) :
cUITextInput::~cUITextInput() {
}
Uint32 cUITextInput::Type() const {
return UI_TYPE_TEXTINPUT;
}
bool cUITextInput::IsType( const Uint32& type ) const {
return cUITextInput::Type() == type ? true : cUITextBox::IsType( type );
}
void cUITextInput::Update() {
cUITextBox::Update();

View File

@@ -28,6 +28,10 @@ class EE_API cUITextInput : public cUITextBox {
~cUITextInput();
virtual Uint32 Type() const;
virtual bool IsType( const Uint32& type ) const;
virtual void Update();
virtual void Draw();

View File

@@ -12,8 +12,6 @@ cUITooltip::cUITooltip( cUITooltip::CreateParams& Params, cUIControl * TooltipOf
mTooltipTime( 0.f ),
mTooltipOf( TooltipOf )
{
mType = UI_TYPE_TOOLTIP;
mTextCache = eeNew( cTextCache, () );
mTextCache->Font( Params.Font );
mTextCache->Color( mFontColor );
@@ -42,6 +40,14 @@ cUITooltip::~cUITooltip() {
}
}
Uint32 cUITooltip::Type() const {
return UI_TYPE_TOOLTIP;
}
bool cUITooltip::IsType( const Uint32& type ) const {
return cUITooltip::Type() == type ? true : cUIControlAnim::IsType( type );
}
void cUITooltip::SetTheme( cUITheme * Theme ) {
cUIControl::SetTheme( Theme, "tooltip" );

View File

@@ -38,6 +38,10 @@ class EE_API cUITooltip : public cUIControlAnim {
~cUITooltip();
virtual Uint32 Type() const;
virtual bool IsType( const Uint32& type ) const;
virtual void SetTheme( cUITheme * Theme );
void Show();

View File

@@ -24,8 +24,6 @@ cUIWindow::cUIWindow( const cUIWindow::CreateParams& Params ) :
mDecoAutoSize( Params.DecorationAutoSize ),
mBorderAutoSize( Params.BorderAutoSize )
{
mType = UI_TYPE_WINDOW;
cUIComplexControl::CreateParams tcParams;
tcParams.Parent( this );
tcParams.Flags |= UI_REPORT_SIZE_CHANGE_TO_CHILDS;
@@ -104,6 +102,14 @@ cUIWindow::~cUIWindow() {
SendCommonEvent( cUIEvent::EventOnWindowClose );
}
Uint32 cUIWindow::Type() const {
return UI_TYPE_WINDOW;
}
bool cUIWindow::IsType( const Uint32& type ) const {
return cUIWindow::Type() == type ? true : cUIComplexControl::IsType( type );
}
void cUIWindow::ContainerPosChange( const cUIEvent * Event ) {
eeVector2i PosDiff = mContainer->Pos() - eeVector2i( mBorderLeft->Size().Width(), mWindowDecoration->Size().Height() );

View File

@@ -42,6 +42,10 @@ class cUIWindow : public cUIComplexControl {
~cUIWindow();
virtual Uint32 Type() const;
virtual bool IsType( const Uint32& type ) const;
virtual void Size( const eeSize& Size );
void Size( const Int32& Width, const Int32& Height );

View File

@@ -16,8 +16,6 @@ cUIWinMenu::cUIWinMenu( const cUIWinMenu::CreateParams& Params ) :
mFirstButtonMargin( Params.FirstButtonMargin ),
mMenuHeight( Params.MenuHeight )
{
mType = UI_TYPE_WINMENU;
if ( !(mFlags & UI_ANCHOR_RIGHT) )
mFlags |= UI_ANCHOR_RIGHT;
@@ -32,6 +30,14 @@ cUIWinMenu::~cUIWinMenu()
{
}
Uint32 cUIWinMenu::Type() const {
return UI_TYPE_WINMENU;
}
bool cUIWinMenu::IsType( const Uint32& type ) const {
return cUIWinMenu::Type() == type ? true : cUIComplexControl::IsType( type );
}
void cUIWinMenu::AddMenuButton( const String& ButtonText, cUIPopUpMenu * Menu ) {
eeASSERT( NULL != Menu );
@@ -162,7 +168,7 @@ Uint32 cUIWinMenu::OnMessage( const cUIMessage * Msg ) {
case cUIMessage::MsgMouseUp:
case cUIMessage::MsgMouseEnter:
{
if ( Msg->Sender()->IsTypeOrInheritsFrom( UI_TYPE_SELECTBUTTON ) ) {
if ( Msg->Sender()->IsType( UI_TYPE_SELECTBUTTON ) ) {
cUISelectButton * tbut = reinterpret_cast<cUISelectButton*> ( Msg->Sender() );
cUIPopUpMenu * tpop = GetMenuFromButton( tbut );

View File

@@ -53,6 +53,10 @@ class EE_API cUIWinMenu : public cUIComplexControl {
virtual ~cUIWinMenu();
virtual Uint32 Type() const;
virtual bool IsType( const Uint32& type ) const;
void AddMenuButton( const String& ButtonText, cUIPopUpMenu * Menu );
void RemoveMenuButton( const String& ButtonText );

View File

@@ -226,7 +226,7 @@ void cTextureGroupEditor::CreateWinMenu() {
}
void cTextureGroupEditor::FileMenuClick( const cUIEvent * Event ) {
if ( !Event->Ctrl()->IsTypeOrInheritsFrom( UI_TYPE_MENUITEM ) )
if ( !Event->Ctrl()->IsType( UI_TYPE_MENUITEM ) )
return;
const String& txt = reinterpret_cast<cUIMenuItem*> ( Event->Ctrl() )->Text();