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:
static UIListBoxItem * New();
static UIListBoxItem * NewWithTag( const std::string& tag );
UIListBoxItem();
UIListBoxItem( const std::string& tag );
virtual ~UIListBoxItem();
virtual Uint32 getType() const;

View File

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

View File

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

View File

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

View File

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

View File

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