UINode::setSkin now can be NULL.

Added tag to RadioButton::active, RadioButton::inactive, DropDownList::ListBox::item.

--HG--
branch : dev
This commit is contained in:
Martín Lucas Golini
2019-12-08 22:08:07 -03:00
parent 2ac0b8b843
commit 4c4e329c8f
6 changed files with 26 additions and 5 deletions

View File

@@ -12,8 +12,12 @@ class EE_API UIListBoxItem : public UITextView {
public: public:
static UIListBoxItem * New(); static UIListBoxItem * New();
static UIListBoxItem * NewWithTag( const std::string& tag );
UIListBoxItem(); UIListBoxItem();
UIListBoxItem( const std::string& tag );
virtual ~UIListBoxItem(); virtual ~UIListBoxItem();
virtual Uint32 getType() const; virtual Uint32 getType() const;

View File

@@ -188,7 +188,7 @@ Uint32 UIListBox::addListBoxItem( const String& text ) {
} }
UIListBoxItem * UIListBox::createListBoxItem( const String& Name ) { UIListBoxItem * UIListBox::createListBoxItem( const String& Name ) {
UIListBoxItem * tItem = UIListBoxItem::New(); UIListBoxItem * tItem = UIListBoxItem::NewWithTag( mTag + "::item" );
tItem->setParent( mContainer ); tItem->setParent( mContainer );
tItem->setTheme( mTheme ); tItem->setTheme( mTheme );
tItem->setHorizontalAlign( UI_HALIGN_LEFT )->setVerticalAlign( UI_VALIGN_CENTER ); tItem->setHorizontalAlign( UI_HALIGN_LEFT )->setVerticalAlign( UI_VALIGN_CENTER );

View File

@@ -8,6 +8,10 @@ UIListBoxItem * UIListBoxItem::New() {
return eeNew( UIListBoxItem, () ); return eeNew( UIListBoxItem, () );
} }
UIListBoxItem * UIListBoxItem::NewWithTag( const std::string& tag ) {
return eeNew( UIListBoxItem, ( tag ) );
}
UIListBoxItem::UIListBoxItem() : UIListBoxItem::UIListBoxItem() :
UITextView( "listbox::item" ) UITextView( "listbox::item" )
{ {
@@ -15,6 +19,13 @@ UIListBoxItem::UIListBoxItem() :
applyDefaultTheme(); applyDefaultTheme();
} }
UIListBoxItem::UIListBoxItem( const std::string& tag ) :
UITextView( tag )
{
setLayoutSizeRules( FIXED, FIXED );
applyDefaultTheme();
}
UIListBoxItem::~UIListBoxItem() { UIListBoxItem::~UIListBoxItem() {
EventDispatcher * eventDispatcher = getEventDispatcher(); EventDispatcher * eventDispatcher = getEventDispatcher();

View File

@@ -699,6 +699,8 @@ UINode * UINode::setSkin( UISkin * skin ) {
mSkinState->setState( InitialState ); mSkinState->setState( InitialState );
onThemeLoaded(); onThemeLoaded();
} else {
removeSkin();
} }
return this; return this;

View File

@@ -16,14 +16,14 @@ UIRadioButton::UIRadioButton() :
mActive( false ), mActive( false ),
mTextSeparation( 4 ) mTextSeparation( 4 )
{ {
mActiveButton = UINode::New(); mActiveButton = UIWidget::NewWithTag( "radiobutton::active" );
mActiveButton->setVisible( false ); mActiveButton->setVisible( false );
mActiveButton->setEnabled( true ); mActiveButton->setEnabled( true );
mActiveButton->setParent( this ); mActiveButton->setParent( this );
mActiveButton->setPosition( 0, 0 ); mActiveButton->setPosition( 0, 0 );
mActiveButton->setSize( 16, 16 ); mActiveButton->setSize( 16, 16 );
mInactiveButton = UINode::New(); mInactiveButton = UIWidget::NewWithTag( "radiobutton::inactive" );
mInactiveButton->setVisible( true ); mInactiveButton->setVisible( true );
mInactiveButton->setEnabled( true ); mInactiveButton->setEnabled( true );
mInactiveButton->setParent( this ); mInactiveButton->setParent( this );
@@ -113,7 +113,7 @@ void UIRadioButton::onSizeChange() {
Uint32 UIRadioButton::onMessage( const NodeMessage * Msg ) { Uint32 UIRadioButton::onMessage( const NodeMessage * Msg ) {
switch ( Msg->getMsg() ) { switch ( Msg->getMsg() ) {
case NodeMessage::Click: { case NodeMessage::MouseUp: {
if ( Msg->getFlags() & EE_BUTTON_LMASK ) { if ( Msg->getFlags() & EE_BUTTON_LMASK ) {
switchState(); switchState();
} }

View File

@@ -1093,7 +1093,11 @@ bool UIWidget::applyProperty( const StyleSheetProperty& attribute ) {
break; break;
case PropertyId::Skin: case PropertyId::Skin:
mSkinName = attribute.asString(); mSkinName = attribute.asString();
setThemeSkin( mSkinName ); if ( "none" == mSkinName || mSkinName.empty() ) {
removeSkin();
} else {
setThemeSkin( mSkinName );
}
break; break;
case PropertyId::SkinColor: case PropertyId::SkinColor:
setSkinColor( attribute.asColor() ); setSkinColor( attribute.asColor() );