Move placeholder color to theme item
This commit is contained in:
parent
78e3e65e7c
commit
1cd1df5dc3
10 changed files with 27 additions and 46 deletions
|
|
@ -874,7 +874,7 @@ void TextEdit::_notification(int p_what) {
|
|||
// Ensure we at least use the font color.
|
||||
Color current_color = !editable ? font_readonly_color : font_color;
|
||||
if (draw_placeholder) {
|
||||
current_color.a *= placeholder_alpha;
|
||||
current_color = font_placeholder_color;
|
||||
}
|
||||
|
||||
const Ref<TextParagraph> ldata = draw_placeholder ? placeholder_data_buf : text.get_line_data(line);
|
||||
|
|
@ -2515,6 +2515,7 @@ void TextEdit::_update_caches() {
|
|||
font_size = get_theme_font_size(SNAME("font_size"));
|
||||
font_color = get_theme_color(SNAME("font_color"));
|
||||
font_readonly_color = get_theme_color(SNAME("font_readonly_color"));
|
||||
font_placeholder_color = get_theme_color(SNAME("font_placeholder_color"));
|
||||
|
||||
outline_size = get_theme_constant(SNAME("outline_size"));
|
||||
outline_color = get_theme_color(SNAME("font_outline_color"));
|
||||
|
|
@ -2947,15 +2948,6 @@ String TextEdit::get_placeholder() const {
|
|||
return placeholder_text;
|
||||
}
|
||||
|
||||
void TextEdit::set_placeholder_alpha(float p_alpha) {
|
||||
placeholder_alpha = p_alpha;
|
||||
update();
|
||||
}
|
||||
|
||||
float TextEdit::get_placeholder_alpha() const {
|
||||
return placeholder_alpha;
|
||||
}
|
||||
|
||||
void TextEdit::set_line(int p_line, const String &p_new_text) {
|
||||
if (p_line < 0 || p_line >= text.size()) {
|
||||
return;
|
||||
|
|
@ -4944,9 +4936,6 @@ void TextEdit::_bind_methods() {
|
|||
ClassDB::bind_method(D_METHOD("set_placeholder", "text"), &TextEdit::set_placeholder);
|
||||
ClassDB::bind_method(D_METHOD("get_placeholder"), &TextEdit::get_placeholder);
|
||||
|
||||
ClassDB::bind_method(D_METHOD("set_placeholder_alpha", "alpha"), &TextEdit::set_placeholder_alpha);
|
||||
ClassDB::bind_method(D_METHOD("get_placeholder_alpha"), &TextEdit::get_placeholder_alpha);
|
||||
|
||||
ClassDB::bind_method(D_METHOD("set_line", "line", "new_text"), &TextEdit::set_line);
|
||||
ClassDB::bind_method(D_METHOD("get_line", "line"), &TextEdit::get_line);
|
||||
|
||||
|
|
@ -5256,7 +5245,6 @@ void TextEdit::_bind_methods() {
|
|||
/* Inspector */
|
||||
ADD_PROPERTY(PropertyInfo(Variant::STRING, "text", PROPERTY_HINT_MULTILINE_TEXT), "set_text", "get_text");
|
||||
ADD_PROPERTY(PropertyInfo(Variant::STRING, "placeholder_text", PROPERTY_HINT_MULTILINE_TEXT), "set_placeholder", "get_placeholder");
|
||||
ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "placeholder_alpha", PROPERTY_HINT_RANGE, "0,1,0.001"), "set_placeholder_alpha", "get_placeholder_alpha");
|
||||
ADD_PROPERTY(PropertyInfo(Variant::INT, "text_direction", PROPERTY_HINT_ENUM, "Auto,Left-to-Right,Right-to-Left,Inherited"), "set_text_direction", "get_text_direction");
|
||||
ADD_PROPERTY(PropertyInfo(Variant::STRING, "language", PROPERTY_HINT_LOCALE_ID, ""), "set_language", "get_language");
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue