Ticket #4350: 4350_dropdown.patch

File 4350_dropdown.patch, 3.3 KB (added by Vladislav Belov, 3 years ago)

Adds a style for disabled dropdowns

  • binaries/data/mods/mod/gui/common/modern/sprites.xml

     
    199199            size = "0 1 100% 100%-1"
    200200        />
    201201    </sprite>
     202    <sprite name="ModernDarkBoxGoldDisabled">
     203        <effect grayscale=""/>
     204        <!-- borders -->
     205        <image texture = "global/modern/gold-separator.png"
     206            real_texture_placement = "0 0 806 1"
     207            size = "0 0 100% 1"
     208        />
     209        <image texture = "global/modern/gold-separator.png"
     210            real_texture_placement = "0 0 806 1"
     211            size = "0 100%-1 100% 100%"
     212        />
     213        <!-- background -->
     214        <image backcolor = "12 12 12 100"
     215            size = "0 1 100% 100%-1"
     216        />
     217    </sprite>
    202218    <sprite name="ModernDarkBoxWhite">
    203219        <!-- borders -->
    204220        <image texture = "global/modern/white-separator.png"
     
    729745            size="0 6 16 22"
    730746        />
    731747    </sprite>
     748    <sprite name = "ModernDropDownArrowDisabled">
     749        <effect grayscale=""/>
     750        <image texture = "global/modern/dropdown-arrow.png"
     751            real_texture_placement = "0 0 16 16"
     752            texture_size="0 0 16 16"
     753            size="0 6 16 22"
     754        />
     755    </sprite>
    732756    <sprite name = "ModernNotSorted">
    733757        <image texture = "global/modern/arrow-up-down.png"
    734758            real_texture_placement = "0 0 16 16"
  • binaries/data/mods/mod/gui/common/modern/styles.xml

     
    5959        text_valign="center"
    6060
    6161        sprite="ModernDarkBoxGold"
     62        sprite_disabled="ModernDarkBoxGoldDisabled"
    6263        button_width="16"
    6364        sprite2="ModernDropDownArrow"
     65        sprite2_disabled="ModernDropDownArrowDisabled"
    6466        sprite2_pressed="ModernDropDownArrowHighlight"
    6567
    6668        buffer_zone="8"
  • source/gui/CDropDown.cpp

     
    3737    AddSetting(GUIST_CStrW,                 "sound_enter");
    3838    AddSetting(GUIST_CStrW,                 "sound_leave");
    3939    AddSetting(GUIST_CStrW,                 "sound_opened");
    40 //  AddSetting(GUIST_CGUISpriteInstance,    "sprite");              // Background that sits around the size
     40    AddSetting(GUIST_CGUISpriteInstance,    "sprite");              // Background that sits around the size
     41    AddSetting(GUIST_CGUISpriteInstance,    "sprite_disabled");
    4142    AddSetting(GUIST_CGUISpriteInstance,    "sprite_list");         // Background of the drop down list
    4243    AddSetting(GUIST_CGUISpriteInstance,    "sprite2");             // Button that sits to the right
    4344    AddSetting(GUIST_CGUISpriteInstance,    "sprite2_over");
     
    442443    int cell_id, selected = 0;
    443444    CColor color;
    444445
    445     GUI<CGUISpriteInstance>::GetSettingPointer(this, "sprite", sprite);
    446446    GUI<CGUISpriteInstance>::GetSettingPointer(this, "sprite2", sprite2);
    447447    GUI<int>::GetSetting(this, "cell_id", cell_id);
    448448    GUI<int>::GetSetting(this, "selected", selected);
     
    452452    bool enabled;
    453453    GUI<bool>::GetSetting(this, "enabled", enabled);
    454454
     455    GUI<CGUISpriteInstance>::GetSettingPointer(this, enabled ? "sprite" : "sprite_disabled", sprite);
    455456    GetGUI()->DrawSprite(*sprite, cell_id, bz, m_CachedActualSize);
    456457
    457458    if (button_width > 0.f)