Add a new toggle button type for the resize direction in the new editor.

Also added proof-of-concept code in the editor and made a tight grid.
This commit is contained in:
Mark de Wever 2008-08-12 20:05:32 +00:00
parent 7fccf0709c
commit a506c03625
3 changed files with 140 additions and 21 deletions

View file

@ -0,0 +1,107 @@
###
### Definition of a toggle button with only a changing image.
### It's used for the editor in the resize grid.
###
#define ICON
[image]
x = 0
y = 0
name = "(icon)"
[/image]
#enddef
[toggle_button_definition]
id = "icon"
description = "This toggle button is meant to be used in the resize grid of the editor and only has an icon."
[resolution]
min_width = 27
min_height = 27
default_width = 27
default_height = 27
max_width = 27
max_height = 27
text_extra_width = 0
text_font_size = 0
[state_enabled]
full_redraw = "true"
[draw]
{ICON}
[/draw]
[/state_enabled]
[state_disabled]
full_redraw = "true"
[draw]
{ICON}
[/draw]
[/state_disabled]
[state_focussed]
full_redraw = "true"
[draw]
{ICON}
[/draw]
[/state_focussed]
###
### Selected
###
[state_enabled_selected]
full_redraw = "true"
[draw]
{ICON}
[/draw]
[/state_enabled_selected]
[state_disabled_selected]
full_redraw = "true"
[draw]
{ICON}
[/draw]
[/state_disabled_selected]
[state_focussed_selected]
full_redraw = "true"
[draw]
{ICON}
[/draw]
[/state_focussed_selected]
[/resolution]
[/toggle_button_definition]
#undef ICON

View file

@ -151,24 +151,25 @@
grow_factor = 0
[toggle_button]
id = "expand0"
definition = "default"
label = "Bottom / right"
definition = "icon"
# label = "Bottom / right"
[/toggle_button]
[/column]
[column]
grow_factor = 0
[toggle_button]
id = "expand1"
definition = "default"
label = "Bottom / center"
definition = "icon"
# label = "Bottom / center"
[/toggle_button]
[/column]
[column]
grow_factor = 0
grow_factor = 1
horizontal_alignment = "left"
[toggle_button]
id = "expand2"
definition = "default"
label = "Bottom / left"
definition = "icon"
# label = "Bottom / left"
[/toggle_button]
[/column]
[/row]
@ -178,51 +179,53 @@
grow_factor = 0
[toggle_button]
id = "expand3"
definition = "default"
label = "Center / right"
definition = "icon"
# label = "Center / right"
[/toggle_button]
[/column]
[column]
grow_factor = 0
[toggle_button]
id = "expand4"
definition = "default"
label = "Center"
definition = "icon"
# label = "Center"
[/toggle_button]
[/column]
[column]
grow_factor = 0
grow_factor = 1
horizontal_alignment = "left"
[toggle_button]
id = "expand5"
definition = "default"
label = "Center / left"
definition = "icon"
# label = "Center / left"
[/toggle_button]
[/column]
[/row]
[row]
grow_factor = 1
[column]
grow_factor = 0
grow_factor = 1
horizontal_alignment = "left"
[toggle_button]
id = "expand6"
definition = "default"
label = "Top / right"
definition = "icon"
# label = "Top / right"
[/toggle_button]
[/column]
[column]
grow_factor = 0
[toggle_button]
id = "expand7"
definition = "default"
label = "Top / center"
definition = "icon"
# label = "Top / center"
[/toggle_button]
[/column]
[column]
grow_factor = 0
[toggle_button]
id = "expand8"
definition = "default"
label = "Top / left"
definition = "icon"
# label = "Top / left"
[/toggle_button]
[/column]
[/row]

View file

@ -114,6 +114,15 @@ void teditor_resize_map::pre_show(CVideo& /*video*/, twindow& window)
dialog_callback<teditor_resize_map, &teditor_resize_map::update_expand_direction>);
}
direction_buttons_[0]->set_value(true);
direction_buttons_[0]->set_icon_name("buttons/resize-direction-top-left.png");
direction_buttons_[1]->set_icon_name("buttons/resize-direction-top.png");
direction_buttons_[2]->set_icon_name("buttons/resize-direction-top-right.png");
direction_buttons_[3]->set_icon_name("buttons/resize-direction-left.png");
direction_buttons_[4]->set_icon_name("buttons/resize-direction-center.png");
direction_buttons_[5]->set_icon_name("buttons/resize-direction-right.png");
direction_buttons_[6]->set_icon_name("buttons/resize-direction-bottom-left.png");
direction_buttons_[7]->set_icon_name("buttons/resize-direction-bottom.png");
direction_buttons_[8]->set_icon_name("buttons/resize-direction-bottom-right.png");
window.recalculate_size();
}