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

Method applyProperty

src/eepp/ui/uiwindow.cpp:1637–1754  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1635}
1636
1637bool UIWindow::applyProperty( const StyleSheetProperty& attribute ) {
1638 if ( !checkPropertyDefinition( attribute ) )
1639 return false;
1640
1641 switch ( attribute.getPropertyDefinition()->getPropertyId() ) {
1642 case PropertyId::Width:
1643 setSize( attribute.asDpDimension(), getSize().getHeight() );
1644 break;
1645 case PropertyId::Height:
1646 setSize( getSize().getWidth(), attribute.asDpDimension( this ) );
1647 break;
1648 case PropertyId::WindowTitle:
1649 setTitle( getUISceneNode()->getTranslatorString( attribute.value() ) );
1650 break;
1651 case PropertyId::WindowOpacity:
1652 setWindowOpacity( (Uint8)eemin<Uint32>( (Uint32)attribute.asFloat() * 255.f, 255u ) );
1653 break;
1654 case PropertyId::WindowButtonsOffset:
1655 mStyleConfig.ButtonsOffset = attribute.asDpDimensionVector2i( this );
1656 fixChildrenSize();
1657 break;
1658 case PropertyId::WindowFlags: {
1659 std::string flagsStr = attribute.asString();
1660 String::toLowerInPlace( flagsStr );
1661 std::vector<std::string> strings = String::split( flagsStr, '|' );
1662 Uint32 winflags = 0;
1663
1664 if ( strings.size() ) {
1665 for ( std::size_t i = 0; i < strings.size(); i++ ) {
1666 std::string cur = strings[i];
1667
1668 if ( "default" == cur )
1669 winflags |= UI_WIN_DEFAULT_FLAGS;
1670 else if ( "close" == cur )
1671 winflags |= UI_WIN_CLOSE_BUTTON;
1672 else if ( "maximize" == cur )
1673 winflags |= UI_WIN_MAXIMIZE_BUTTON;
1674 else if ( "minimize" == cur )
1675 winflags |= UI_WIN_MINIMIZE_BUTTON;
1676 else if ( "draggable" == cur )
1677 winflags |= UI_WIN_DRAGGABLE_CONTAINER;
1678 else if ( "shadow" == cur )
1679 winflags |= UI_WIN_SHADOW;
1680 else if ( "modal" == cur )
1681 winflags |= UI_WIN_MODAL;
1682 else if ( "noborder" == cur || "borderless" == cur || "undecorated" == cur )
1683 winflags |= UI_WIN_NO_DECORATION;
1684 else if ( "resizeable" == cur )
1685 winflags |= UI_WIN_RESIZEABLE;
1686 else if ( "shareopacity" == cur )
1687 winflags |= UI_WIN_SHARE_ALPHA_WITH_CHILDREN;
1688 else if ( "buttonactions" == cur )
1689 winflags |= UI_WIN_USE_DEFAULT_BUTTONS_ACTIONS;
1690 else if ( "framebuffer" == cur )
1691 winflags |= UI_WIN_FRAME_BUFFER;
1692 else if ( "colorbuffer" == cur )
1693 winflags |= UI_WIN_COLOR_BUFFER;
1694 else if ( "ephemeral" == cur )

Callers

nothing calls this directly

Calls 15

setSizeFunction · 0.85
getPropertyIdMethod · 0.80
asDpDimensionMethod · 0.80
asDpDimensionVector2iMethod · 0.80
asStringMethod · 0.80
asDpDimensionSizeiMethod · 0.80
asDpDimensionSizefMethod · 0.80
asDpDimensionUintMethod · 0.80
asDpDimensionIMethod · 0.80
asBoolMethod · 0.80
asColorMethod · 0.80
asVector2fMethod · 0.80

Tested by

no test coverage detected