mirror of
https://github.com/wesnoth/wesnoth
synced 2025-05-18 10:33:26 +00:00

Cleaned up the widget to use the new macros and also added the (not so well) tested code for tiny gui.
145 lines
2.6 KiB
INI
145 lines
2.6 KiB
INI
###
|
|
### Definition of a single line text box.
|
|
###
|
|
|
|
#define _GUI_DRAW_BORDER COLOUR
|
|
[rectangle]
|
|
x = 0
|
|
y = 0
|
|
w = "(width)"
|
|
h = "(height)"
|
|
|
|
border_thickness = 3
|
|
border_colour = "55, 55, 55, 192"
|
|
|
|
[ /rectangle]
|
|
|
|
[rectangle]
|
|
x = 1
|
|
y = 1
|
|
w = "(width - 2)"
|
|
h = "(height - 2)"
|
|
|
|
border_thickness = 1
|
|
border_colour = {COLOUR}
|
|
|
|
[/rectangle]
|
|
#enddef
|
|
|
|
#define _GUI_DRAW_TEXT SIZE COLOUR
|
|
[rectangle]
|
|
x = "(text_x_offset + selection_offset)"
|
|
y = "(text_y_offset)"
|
|
w = "(selection_width)"
|
|
h = "(text_font_height)"
|
|
|
|
border_thickness = 0
|
|
fill_colour = "21, 53, 80, 255"
|
|
|
|
[/rectangle]
|
|
|
|
[text]
|
|
x = "(text_x_offset)"
|
|
y = "(text_y_offset)"
|
|
w = "(text_width)"
|
|
h = "(text_height)"
|
|
font_size = {SIZE}
|
|
colour = {COLOUR}
|
|
text = "(text)"
|
|
[/text]
|
|
#enddef
|
|
|
|
#define _GUI_DRAW_CURSOR X_OFFSET
|
|
[line]
|
|
x1 = "(cursor_offset + " + {X_OFFSET} + ")"
|
|
y1 = "(text_y_offset)"
|
|
x2 = "(cursor_offset + " + {X_OFFSET} + ")"
|
|
y2 = "(text_y_offset + text_font_height)"
|
|
colour = "255, 255, 255, 255"
|
|
thickness = 1
|
|
[/line]
|
|
#enddef
|
|
|
|
#define _GUI_RESOLUTION RESOLUTION MIN_WIDTH DEFAULT_WIDTH HEIGHT X_OFFSET FONT_SIZE
|
|
[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_x_offset = {X_OFFSET}
|
|
text_y_offset = "(if(text_font_height <= height, (height - text_font_height) / 2, 0))"
|
|
|
|
[state_enabled]
|
|
|
|
full_redraw = "true"
|
|
|
|
[draw]
|
|
|
|
{_GUI_DRAW_BORDER ({GUI__FONT_COLOUR_ENABLED__TITLE}) }
|
|
|
|
{_GUI_DRAW_TEXT ({FONT_SIZE}) ({FONT_COLOUR_ENABLED}) }
|
|
|
|
{_GUI_DRAW_CURSOR ({X_OFFSET}) }
|
|
|
|
[/draw]
|
|
|
|
[/state_enabled]
|
|
|
|
[state_disabled]
|
|
|
|
full_redraw = "true"
|
|
|
|
[draw]
|
|
|
|
{_GUI_DRAW_BORDER ({GUI__FONT_COLOUR_DISABLED__TITLE}) }
|
|
|
|
{_GUI_DRAW_TEXT ({FONT_SIZE}) ({FONT_COLOUR_DISABLED}) }
|
|
|
|
[/draw]
|
|
|
|
[/state_disabled]
|
|
|
|
[state_focussed]
|
|
|
|
full_redraw = "true"
|
|
|
|
[draw]
|
|
|
|
{_GUI_DRAW_BORDER ({GUI__FONT_COLOUR_ENABLED__TITLE}) }
|
|
|
|
{_GUI_DRAW_TEXT ({FONT_SIZE}) ({FONT_COLOUR_ENABLED}) }
|
|
|
|
{_GUI_DRAW_CURSOR ({X_OFFSET}) }
|
|
|
|
[/draw]
|
|
|
|
[/state_focussed]
|
|
|
|
[/resolution]
|
|
|
|
#enddef
|
|
|
|
[text_box_definition]
|
|
id = "default"
|
|
description = "Default text box"
|
|
|
|
# Tiny gui sizes haven't been tested yet so might need some tuning.
|
|
{_GUI_RESOLUTION ({GUI_TINY__RESOLUTION}) 20 125 15 5 ({GUI_TINY__FONT_SIZE__DEFAULT}) }
|
|
{_GUI_RESOLUTION () 40 250 25 5 ({GUI_NORMAL__FONT_SIZE__DEFAULT}) }
|
|
|
|
[/text_box_definition]
|
|
|
|
#undef _GUI_RESOLUTION
|
|
#undef _GUI_DRAW_CURSOR
|
|
#undef _GUI_DRAW_TEXT
|
|
#undef _GUI_DRAW_BORDER COLOUR
|