Ticket #4350: 4350_dropdown_label.2.patch

File 4350_dropdown_label.2.patch, 6.1 KB (added by Vladislav Belov, 3 years ago)

Adds a style for disabled dropdowns and labels

  • 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"
     
    6870        sprite_list="BlackBorderOnGray"
    6971        sprite_selectarea="ModernDarkBoxWhite"
    7072        textcolor_selected="white"
     73        textcolor_disabled="140 140 140 255"
    7174
    7275        scrollbar="true"
    7376        scrollbar_style="ModernScrollBar"
     
    7982    <style name="ModernLabelText"
    8083        font="sans-bold-stroke-14"
    8184        textcolor="white"
     85        textcolor_disabled="140 140 140 255"
    8286        text_align="center"
    8387        text_valign="center"
    8488    />
  • binaries/data/mods/public/gui/options/options.js

     
    2121            let config = option.parameters.config;
    2222            g_Controls[config] = {
    2323                "control": setupControl(option, i, category),
     24                "label": label,
    2425                "type": option.type,
    2526                "dependencies": option.dependencies || undefined,
    2627                "parameters": option.parameters
     
    247248            continue;
    248249
    249250        for (let dependency of control.dependencies)
     251        {
    250252            g_Controls[dependency].control.enabled = control.control.checked;
     253            g_Controls[dependency].label.enabled = control.control.checked;
     254        }
    251255    }
    252256
    253257    // And main buttons
  • 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");
     
    4849    // Add these in CList! And implement TODO
    4950    //AddSetting(GUIST_CColor,              "textcolor_over");
    5051    //AddSetting(GUIST_CColor,              "textcolor_pressed");
    51     //AddSetting(GUIST_CColor,              "textcolor_disabled");
     52    AddSetting(GUIST_CColor,                "textcolor_selected");
     53    AddSetting(GUIST_CColor,                "textcolor_disabled");
    5254
    5355    // Scrollbar is forced to be true.
    5456    GUI<bool>::SetSetting(this, "scrollbar", true);
     
    442444    int cell_id, selected = 0;
    443445    CColor color;
    444446
    445     GUI<CGUISpriteInstance>::GetSettingPointer(this, "sprite", sprite);
     447    bool enabled;
     448    GUI<bool>::GetSetting(this, "enabled", enabled);
     449
    446450    GUI<CGUISpriteInstance>::GetSettingPointer(this, "sprite2", sprite2);
    447451    GUI<int>::GetSetting(this, "cell_id", cell_id);
    448452    GUI<int>::GetSetting(this, "selected", selected);
    449     GUI<CColor>::GetSetting(this, "textcolor", color);
     453    GUI<CColor>::GetSetting(this, enabled ? "textcolor_selected" : "textcolor_disabled", color);
    450454
    451 
    452     bool enabled;
    453     GUI<bool>::GetSetting(this, "enabled", enabled);
    454 
     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)
  • source/gui/CText.cpp

     
    1 /* Copyright (C) 2015 Wildfire Games.
     1/* Copyright (C) 2016 Wildfire Games.
    22 * This file is part of 0 A.D.
    33 *
    44 * 0 A.D. is free software: you can redistribute it and/or modify
     
    3838    AddSetting(GUIST_EAlign,                "text_align");
    3939    AddSetting(GUIST_EVAlign,               "text_valign");
    4040    AddSetting(GUIST_CColor,                "textcolor");
     41    AddSetting(GUIST_CColor,                "textcolor_disabled");
    4142    AddSetting(GUIST_CStrW,                 "tooltip");
    4243    AddSetting(GUIST_CStr,                  "tooltip_style");
    4344
     
    229230        }
    230231    }
    231232
     233    bool enabled;
     234    GUI<bool>::GetSetting(this, "enabled", enabled);
     235
    232236    CColor color;
    233     GUI<CColor>::GetSetting(this, "textcolor", color);
     237    GUI<CColor>::GetSetting(this, enabled ? "textcolor" : "textcolor_disabled", color);
    234238
    235239    if (scrollbar)
    236240        DrawText(0, color, m_CachedActualSize.TopLeft() - CPos(0.f, scroll), bz+0.1f, cliparea);