mirror of
https://github.com/godotengine/godot.git
synced 2025-01-31 06:10:51 +00:00
Add "font_color_separator" theme property to 'PopupMenu'
(cherry picked from commit 383e8919e0
)
This commit is contained in:
parent
99a6cf77dd
commit
32da9dc1e9
@ -205,6 +205,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">
|
||||
@ -668,6 +669,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="hover" type="StyleBox">
|
||||
[StyleBox] displayed when the [PopupMenu] item is hovered.
|
||||
</theme_item>
|
||||
|
@ -687,6 +687,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"));
|
||||
|
@ -482,6 +482,7 @@ void PopupMenu::_notification(int p_what) {
|
||||
Color font_color_disabled = get_color("font_color_disabled");
|
||||
Color font_color_accel = get_color("font_color_accel");
|
||||
Color font_color_hover = get_color("font_color_hover");
|
||||
Color font_color_separator = get_color("font_color_separator");
|
||||
float font_h = font->get_height();
|
||||
|
||||
// Add the check and the wider icon to the offset of all items.
|
||||
@ -566,7 +567,7 @@ void PopupMenu::_notification(int p_what) {
|
||||
|
||||
if (text != String()) {
|
||||
int center = (get_size().width - font->get_string_size(text).width) / 2;
|
||||
font->draw(ci, Point2(center, item_ofs.y + Math::floor((h - font_h) / 2.0)), text, font_color_disabled);
|
||||
font->draw(ci, Point2(center, item_ofs.y + Math::floor((h - font_h) / 2.0)), text, font_color_separator);
|
||||
}
|
||||
} else {
|
||||
|
||||
|
@ -580,6 +580,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
Block a user