Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
GUI2: implemented a Unit Preview Pane widget
- Loading branch information
Showing
11 changed files
with
702 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,175 @@ | ||
#textdomain wesnoth-lib | ||
|
||
#define _GUI_UNIT_PREVIEW_PANE_FULL | ||
[grid] | ||
vertical_grow = "true" | ||
horizontal_grow = "true" | ||
|
||
[row] | ||
grow_factor = 0 | ||
[column] | ||
border = "bottom" | ||
border_size = 5 | ||
vertical_grow = "true" | ||
horizontal_grow = "true" | ||
|
||
[label] | ||
id = "type_name" | ||
wrap = "true" | ||
[/label] | ||
|
||
[/column] | ||
|
||
[/row] | ||
|
||
[row] | ||
grow_factor = 0 | ||
|
||
[column] | ||
border = "bottom" | ||
border_size = 5 | ||
horizontal_alignment = "center" | ||
vertical_alignment = "center" | ||
|
||
[image] | ||
id = "type_image" | ||
definition = "default" | ||
[/image] | ||
|
||
[/column] | ||
|
||
[/row] | ||
|
||
[row] | ||
grow_factor = 0 | ||
|
||
[column] | ||
border = "bottom" | ||
border_size = 5 | ||
horizontal_alignment = "center" | ||
|
||
[button] | ||
id = "type_profile" | ||
definition = "default" | ||
|
||
label = _ "Profile" | ||
[/button] | ||
|
||
[/column] | ||
|
||
[/row] | ||
|
||
[row] | ||
grow_factor = 0 | ||
|
||
[column] | ||
horizontal_grow = "true" | ||
|
||
[grid] | ||
|
||
[row] | ||
grow_factor = 1 | ||
|
||
[column] | ||
border = "right,bottom" | ||
border_size = 5 | ||
horizontal_alignment = "left" | ||
|
||
[label] | ||
id = "type_level" | ||
[/label] | ||
|
||
[/column] | ||
|
||
[column] | ||
border = "right,bottom" | ||
border_size = 5 | ||
horizontal_alignment = "left" | ||
|
||
[image] | ||
id = "type_race" | ||
[/image] | ||
|
||
[/column] | ||
|
||
[column] | ||
border = "bottom" | ||
border_size = 5 | ||
horizontal_alignment = "left" | ||
|
||
[image] | ||
id = "type_alignment" | ||
[/image] | ||
|
||
[/column] | ||
|
||
[/row] | ||
|
||
[/grid] | ||
|
||
[/column] | ||
|
||
[/row] | ||
|
||
[row] | ||
grow_factor = 1 | ||
|
||
[column] | ||
vertical_grow = "true" | ||
horizontal_alignment = "left" | ||
|
||
[label] | ||
id = "type_details" | ||
definition = "default_small" | ||
wrap = "true" | ||
[/label] | ||
|
||
[/column] | ||
|
||
[/row] | ||
|
||
[/grid] | ||
#enddef | ||
|
||
#define _GUI_RESOLUTION DEFINITION_GRID | ||
[resolution] | ||
|
||
min_width = 0 | ||
min_height = 0 | ||
|
||
default_width = 0 | ||
default_height = 0 | ||
|
||
max_width = 0 | ||
max_height = 0 | ||
|
||
[background] | ||
|
||
[draw] | ||
|
||
[/draw] | ||
|
||
[/background] | ||
|
||
[foreground] | ||
|
||
[draw] | ||
|
||
[/draw] | ||
|
||
[/foreground] | ||
|
||
{DEFINITION_GRID} | ||
|
||
[/resolution] | ||
#enddef | ||
|
||
[unit_preview_pane_definition] | ||
id = "default" | ||
description = "A fully detailed preview area for unit stats." | ||
|
||
{_GUI_RESOLUTION ({_GUI_UNIT_PREVIEW_PANE_FULL})} | ||
[/unit_preview_pane_definition] | ||
|
||
#undef _GUI_UNIT_PREVIEW_PANE_FULL | ||
#undef _GUI_RESOLUTION |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
/* | ||
Copyright (C) 2016 by the Battle for Wesnoth Project http://www.wesnoth.org/ | ||
This program is free software; you can redistribute it and/or modify | ||
it under the terms of the GNU General Public License as published by | ||
the Free Software Foundation; either version 2 of the License, or | ||
(at your option) any later version. | ||
This program is distributed in the hope that it will be useful, | ||
but WITHOUT ANY WARRANTY. | ||
See the COPYING file for more details. | ||
*/ | ||
|
||
#define GETTEXT_DOMAIN "wesnoth-lib" | ||
|
||
#include "gui/auxiliary/widget_definition/unit_preview_pane.hpp" | ||
|
||
#include "gettext.hpp" | ||
#include "gui/auxiliary/log.hpp" | ||
#include "wml_exception.hpp" | ||
|
||
namespace gui2 | ||
{ | ||
|
||
tunit_preview_pane_definition::tunit_preview_pane_definition(const config& cfg) | ||
: tcontrol_definition(cfg) | ||
{ | ||
DBG_GUI_P << "Parsing unit preview pane " << id << '\n'; | ||
|
||
load_resolutions<tresolution>(cfg); | ||
} | ||
|
||
tunit_preview_pane_definition::tresolution::tresolution(const config& cfg) | ||
: tresolution_definition_(cfg), grid() | ||
{ | ||
state.push_back(tstate_definition(cfg.child("background"))); | ||
state.push_back(tstate_definition(cfg.child("foreground"))); | ||
|
||
const config& child = cfg.child("grid"); | ||
VALIDATE(child, _("No grid defined.")); | ||
|
||
grid = new tbuilder_grid(child); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
/* | ||
Copyright (C) 2016 by the Battle for Wesnoth Project http://www.wesnoth.org/ | ||
This program is free software; you can redistribute it and/or modify | ||
it under the terms of the GNU General Public License as published by | ||
the Free Software Foundation; either version 2 of the License, or | ||
(at your option) any later version. | ||
This program is distributed in the hope that it will be useful, | ||
but WITHOUT ANY WARRANTY. | ||
See the COPYING file for more details. | ||
*/ | ||
|
||
#ifndef GUI_AUXILIARY_WIDGET_DEFINITION_UNIT_PREVIEW_PANE_HPP_INCLUDED | ||
#define GUI_AUXILIARY_WIDGET_DEFINITION_UNIT_PREVIEW_PANE_HPP_INCLUDED | ||
|
||
#include "gui/auxiliary/widget_definition.hpp" | ||
#include "gui/auxiliary/window_builder.hpp" | ||
|
||
namespace gui2 | ||
{ | ||
|
||
struct tunit_preview_pane_definition : public tcontrol_definition | ||
{ | ||
|
||
explicit tunit_preview_pane_definition(const config& cfg); | ||
|
||
struct tresolution : public tresolution_definition_ | ||
{ | ||
explicit tresolution(const config& cfg); | ||
|
||
tbuilder_grid_ptr grid; | ||
}; | ||
}; | ||
|
||
} // namespace gui2 | ||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.