MCPcopy Create free account
hub / github.com/SpartanJ/eepp / applyProperty

Method applyProperty

src/eepp/ui/uipushbutton.cpp:665–743  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

663}
664
665bool UIPushButton::applyProperty( const StyleSheetProperty& attribute ) {
666 bool attributeSet = true;
667
668 if ( attribute.getPropertyDefinition() == NULL ) {
669 return false;
670 }
671
672 switch ( attribute.getPropertyDefinition()->getPropertyId() ) {
673 case PropertyId::InnerWidgetOrientation:
674 setInnerWidgetOrientation( innerWidgetOrientationFromString( attribute.value() ) );
675 break;
676 case PropertyId::Text:
677 case PropertyId::Value:
678 if ( NULL != mSceneNode && mSceneNode->isUISceneNode() )
679 setText( getUISceneNode()->getTranslatorString( attribute.value() ) );
680 break;
681 case PropertyId::Icon: {
682 const std::string& val = attribute.value();
683 Drawable* icon = NULL;
684 bool ownIt;
685 UIIcon* iconF = getUISceneNode()->findIcon( val );
686 if ( iconF ) {
687 setIcon( iconF->getSize(
688 eemax<size_t>( mSize.getHeight() - mPaddingPx.Top - mPadding.Bottom,
689 PixelDensity::dpToPxI( 16 ) ) ) );
690 } else if ( NULL !=
691 ( icon = StyleSheetSpecification::instance()
692 ->getDrawableImageParser()
693 .createDrawable( val, getPixelsSize(), ownIt, this ) ) ) {
694 setIcon( icon, ownIt );
695 }
696 break;
697 }
698 case PropertyId::MinIconSize:
699 setIconMinimumSize( attribute.asDpDimensionSizei() );
700 break;
701 case PropertyId::TextAlign: {
702 std::string align = String::toLower( attribute.value() );
703 if ( align == "center" )
704 setTextAlign( UI_HALIGN_CENTER );
705 else if ( align == "left" )
706 setTextAlign( UI_HALIGN_LEFT );
707 else if ( align == "right" )
708 setTextAlign( UI_HALIGN_RIGHT );
709 break;
710 }
711 case PropertyId::TextAsFallback:
712 setTextAsFallback( attribute.asBool() );
713 break;
714 case PropertyId::Tint:
715 getIcon()->setColor( attribute.asColor() );
716 break;
717 case PropertyId::ExpandText:
718 setExpandTextView( attribute.asBool() );
719 break;
720 case PropertyId::Color:
721 case PropertyId::TextShadowColor:
722 case PropertyId::TextShadowOffset:

Callers

nothing calls this directly

Calls 14

setTextFunction · 0.85
getPropertyIdMethod · 0.80
isUISceneNodeMethod · 0.80
asDpDimensionSizeiMethod · 0.80
asBoolMethod · 0.80
asColorMethod · 0.80
getPropertyDefinitionMethod · 0.45
valueMethod · 0.45
getTranslatorStringMethod · 0.45
findIconMethod · 0.45
getSizeMethod · 0.45
getHeightMethod · 0.45

Tested by

no test coverage detected