wesnoth/data/gui/widget/text_box_default.cfg
Iris Morelle 3ddbeb0b1e gui2/text_box: Add a monospace font variation
This requires communicating the font family to the internal renderer, so
it's not just a WML change.
2021-03-13 19:23:42 -03:00

258 lines
5.6 KiB
INI

#textdomain wesnoth-lib
###
### Definition of a single line text box.
###
#define _GUI_DRAW_BACKGROUND COLOR
[rectangle]
x = 0
y = 0
w = "(width)"
h = "(height)"
fill_color = {COLOR}
[/rectangle]
#enddef
#define _GUI_TEXTBOX_BACKGROUND_ENABLED
{_GUI_DRAW_BACKGROUND ({GUI__BACKGROUND_COLOR_ENABLED})}
#enddef
#define _GUI_TEXTBOX_BACKGROUND_DISABLED
{_GUI_DRAW_BACKGROUND ({GUI__BACKGROUND_COLOR_DISABLED})}
#enddef
#define _GUI_DRAW_BORDER COLOR
[rectangle]
x = 0
y = 0
w = "(width)"
h = "(height)"
border_thickness = 1
border_color = {COLOR}
[/rectangle]
#enddef
#define _GUI_DRAW_TEXT SIZE COLOR
#arg FONT_FAMILY
#endarg
[rectangle]
x = "(text_x_offset + selection_offset)"
y = "(text_y_offset)"
w = "(selection_width)"
h = "(text_font_height)"
border_thickness = 0
fill_color = "21, 53, 80, 255"
[/rectangle]
[text]
x = "(text_x_offset)"
y = "(text_y_offset)"
w = "(text_width)"
h = "(text_height)"
maximum_width = "(text_maximum_width)"
font_size = {SIZE}
font_family = {FONT_FAMILY}
color = {COLOR}
text = "(text)"
[/text]
#enddef
#
# The preprocessor can't process GUI__FONT_COLOR_DISABLED__DEFAULT as part of string
# concatenation for some reason. Perhaps it's the optional argument. So I'm just copying
# it here. Though the lack of quotes means I don't need to use concatenation anyway.
#
# -- vultraz, 2018-03-26
#
#define __DISABLED_COLOR_PREPROCESSOR_WORKAROUND
128, 128, 128, 255 #enddef
#define _GUI_DRAW_TEXT_OR_HINT SIZE COLOR
#arg FONT_FAMILY
#endarg
[rectangle]
x = "(text_x_offset + selection_offset)"
y = "(text_y_offset)"
w = "(selection_width)"
h = "(text_font_height)"
border_thickness = 0
fill_color = "21, 53, 80, 255"
[/rectangle]
[text]
x = "(text_x_offset)"
y = "(text_y_offset)"
w = "(text_width)"
h = "(text_height)"
maximum_width = "(text_maximum_width)"
font_size = "(
if(text = '' and hint_text != '', hint_size, reg_size) where
hint_size = {GUI_FONT_SIZE_SMALL},
reg_size = {SIZE}
)"
font_family = {FONT_FAMILY}
color = "(
if(text = '' and hint_text != '', hint_color, reg_color) where
hint_color = [{__DISABLED_COLOR_PREPROCESSOR_WORKAROUND}],
reg_color = [{COLOR}]
)"
text = "(
if(text = '' and hint_text != '', hint_text, text))"
[/text]
[image]
x = "(width - image_width)"
y = "(max(0, height / 2 - image_height / 2))"
name = "(if(text = '' and hint_image != '', hint_image, ''))"
[/image]
#enddef
#define _GUI_DRAW_CURSOR X_OFFSET
[line]
x1 = "(cursor_offset + {X_OFFSET})"
y1 = "(text_y_offset + 2)"
x2 = "(cursor_offset + {X_OFFSET})"
y2 = "(text_y_offset + text_font_height - 2)"
color = "([255, 255, 255, cursor_alpha])"
thickness = 1
[/line]
[rectangle]
x = "(composition_offset + {X_OFFSET})"
y = "(text_y_offset + text_font_height - 2)"
w = "(composition_width)"
h = "2"
fill_color = "([140, 140, 0, if(composition_width > 0, 255, 0)])"
border_thickness = 0
[/rectangle]
#enddef
#define _GUI_RESOLUTION RESOLUTION MIN_WIDTH DEFAULT_WIDTH HEIGHT X_OFFSET EXTRA_WIDTH FONT_SIZE BACKGROUND_ENABLED BACKGROUND_DISABLED
#arg FONT_FAMILY
#endarg
[resolution]
{RESOLUTION}
min_width = {MIN_WIDTH}
min_height = {HEIGHT}
default_width = {DEFAULT_WIDTH}
default_height = {HEIGHT}
max_width = 0
max_height = {HEIGHT}
text_font_size = {FONT_SIZE}
text_font_family = {FONT_FAMILY}
text_x_offset = {X_OFFSET}
text_y_offset = "(if(text_font_height <= height, (height - text_font_height) / 2, 0))"
text_extra_width = {EXTRA_WIDTH}
#functions = "(def show_hint_text() (text = '' and hint_text != '');)"
[state_enabled]
[draw]
{BACKGROUND_ENABLED}
{_GUI_DRAW_BORDER ({GUI__BORDER_COLOR_DARK}) }
{_GUI_DRAW_TEXT_OR_HINT ({FONT_SIZE}) ({GUI__FONT_COLOR_ENABLED__DEFAULT}) FONT_FAMILY={FONT_FAMILY} }
[/draw]
[/state_enabled]
[state_disabled]
[draw]
{BACKGROUND_DISABLED}
{_GUI_DRAW_BORDER ({GUI__FONT_COLOR_DISABLED_DARK__DEFAULT}) }
{_GUI_DRAW_TEXT_OR_HINT ({FONT_SIZE}) ({GUI__FONT_COLOR_DISABLED__DEFAULT}) FONT_FAMILY={FONT_FAMILY} }
[/draw]
[/state_disabled]
[state_focused]
[draw]
{BACKGROUND_ENABLED}
{_GUI_DRAW_BORDER ({GUI__BORDER_COLOR_BRIGHT}) }
# We never draw the hint text or image if focused
{_GUI_DRAW_TEXT ({FONT_SIZE}) ({GUI__FONT_COLOR_ENABLED__DEFAULT}) FONT_FAMILY={FONT_FAMILY} }
{_GUI_DRAW_CURSOR ({X_OFFSET}) }
[/draw]
[/state_focused]
[state_hovered]
[draw]
{BACKGROUND_ENABLED}
{_GUI_DRAW_BORDER ({GUI__BORDER_COLOR}) }
{_GUI_DRAW_TEXT_OR_HINT ({FONT_SIZE}) ({GUI__FONT_COLOR_ENABLED__DEFAULT}) FONT_FAMILY={FONT_FAMILY} }
[/draw]
[/state_hovered]
[/resolution]
#enddef
[text_box_definition]
id = "default"
description = "Default text box"
{_GUI_RESOLUTION () 40 250 30 5 10 ({GUI_FONT_SIZE_DEFAULT}) ({_GUI_TEXTBOX_BACKGROUND_ENABLED}) ({_GUI_TEXTBOX_BACKGROUND_DISABLED})}
[/text_box_definition]
[text_box_definition]
id = "transparent"
description = "Background-less text box, used for WML messages"
{_GUI_RESOLUTION () 40 250 30 5 10 ({GUI_FONT_SIZE_DEFAULT}) () ()}
[/text_box_definition]
[text_box_definition]
id = "verbatim"
description = "Monospace text box for command inputs"
{_GUI_RESOLUTION () 40 250 30 5 10 ({GUI_FONT_SIZE_DEFAULT}) ({_GUI_TEXTBOX_BACKGROUND_ENABLED}) ({_GUI_TEXTBOX_BACKGROUND_DISABLED}) FONT_FAMILY=monospace}
[/text_box_definition]
#undef _GUI_RESOLUTION
#undef _GUI_DRAW_CURSOR
#undef _GUI_DRAW_TEXT
#undef _GUI_DRAW_BORDER
#undef _GUI_DRAW_BACKGROUND
#undef _GUI_TEXTBOX_BACKGROUND_ENABLED
#undef _GUI_TEXTBOX_BACKGROUND_DISABLED
#undef __DISABLED_COLOR_PREPROCESSOR_WORKAROUND