Merge pull request #44070 from YeldhamDev/popupmenu_separator_font_color
Add "font_color_separator" theme property to 'PopupMenu'
This commit is contained in:
commit
67259d07db
|
@ -207,6 +207,7 @@
|
|||
</argument>
|
||||
<description>
|
||||
Adds a separator between items. Separators also occupy an index.
|
||||
A [code]label[/code] can optionally be provided, which will appear at the center of the separator.
|
||||
</description>
|
||||
</method>
|
||||
<method name="add_shortcut">
|
||||
|
@ -726,6 +727,9 @@
|
|||
<theme_item name="font_color_hover" type="Color" default="Color( 0.88, 0.88, 0.88, 1 )">
|
||||
[Color] used for the hovered text.
|
||||
</theme_item>
|
||||
<theme_item name="font_color_separator" type="Color" default="Color( 0.88, 0.88, 0.88, 1 )">
|
||||
[Color] used for labeled separators' text. See [method add_separator].
|
||||
</theme_item>
|
||||
<theme_item name="font_size" type="int">
|
||||
Font size of the menu items.
|
||||
</theme_item>
|
||||
|
|
|
@ -692,6 +692,7 @@ Ref<Theme> create_editor_theme(const Ref<Theme> p_theme) {
|
|||
theme->set_color("font_color_hover", "PopupMenu", font_color_hl);
|
||||
theme->set_color("font_color_accel", "PopupMenu", font_color_disabled);
|
||||
theme->set_color("font_color_disabled", "PopupMenu", font_color_disabled);
|
||||
theme->set_color("font_color_separator", "PopupMenu", font_color_disabled);
|
||||
theme->set_icon("checked", "PopupMenu", theme->get_icon("GuiChecked", "EditorIcons"));
|
||||
theme->set_icon("unchecked", "PopupMenu", theme->get_icon("GuiUnchecked", "EditorIcons"));
|
||||
theme->set_icon("radio_checked", "PopupMenu", theme->get_icon("GuiRadioChecked", "EditorIcons"));
|
||||
|
|
|
@ -446,6 +446,7 @@ void PopupMenu::_draw_items() {
|
|||
Color font_color_disabled = get_theme_color("font_color_disabled");
|
||||
Color font_color_accel = get_theme_color("font_color_accel");
|
||||
Color font_color_hover = get_theme_color("font_color_hover");
|
||||
Color font_color_separator = get_theme_color("font_color_separator");
|
||||
|
||||
float scroll_width = scroll_container->get_v_scrollbar()->is_visible_in_tree() ? scroll_container->get_v_scrollbar()->get_size().width : 0;
|
||||
float display_width = control->get_size().width - scroll_width;
|
||||
|
@ -548,7 +549,7 @@ void PopupMenu::_draw_items() {
|
|||
if (items[i].separator) {
|
||||
if (text != String()) {
|
||||
int center = (display_width - items[i].text_buf->get_size().width) / 2;
|
||||
items[i].text_buf->draw(ci, Point2(center, item_ofs.y + Math::floor((h - items[i].text_buf->get_size().y) / 2.0)), font_color_disabled);
|
||||
items[i].text_buf->draw(ci, Point2(center, item_ofs.y + Math::floor((h - items[i].text_buf->get_size().y) / 2.0)), font_color_separator);
|
||||
}
|
||||
} else {
|
||||
item_ofs.x += icon_ofs + check_ofs;
|
||||
|
|
|
@ -571,6 +571,7 @@ void fill_default_theme(Ref<Theme> &theme, const Ref<Font> &default_font, const
|
|||
theme->set_color("font_color_accel", "PopupMenu", Color(0.7, 0.7, 0.7, 0.8));
|
||||
theme->set_color("font_color_disabled", "PopupMenu", Color(0.4, 0.4, 0.4, 0.8));
|
||||
theme->set_color("font_color_hover", "PopupMenu", control_font_color);
|
||||
theme->set_color("font_color_separator", "PopupMenu", control_font_color);
|
||||
|
||||
theme->set_constant("hseparation", "PopupMenu", 4 * scale);
|
||||
theme->set_constant("vseparation", "PopupMenu", 4 * scale);
|
||||
|
|
Loading…
Reference in New Issue