Skip to content

Commit

Permalink
GUI2/Window: pass definition pointer to ctor instead of individual ar…
Browse files Browse the repository at this point in the history
…guments
  • Loading branch information
Vultraz committed Aug 25, 2017
1 parent e0e76c4 commit b5c4223
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 61 deletions.
18 changes: 1 addition & 17 deletions src/gui/core/window_builder.cpp
Expand Up @@ -72,23 +72,7 @@ window* build(CVideo& video, const builder_window::window_resolution* definition
{
// We set the values from the definition since we can only determine the
// best size (if needed) after all widgets have been placed.
window* win = new window(video,
definition->x,
definition->y,
definition->width,
definition->height,
definition->reevaluate_best_size,
definition->functions,
definition->automatic_placement,
definition->horizontal_placement,
definition->vertical_placement,
definition->maximum_width,
definition->maximum_height,
definition->definition,
definition->tooltip,
definition->helptip
);

window* win = new window(video, definition);
assert(win);

for(const auto& lg : definition->linked_groups) {
Expand Down
42 changes: 14 additions & 28 deletions src/gui/widgets/window.cpp
Expand Up @@ -289,21 +289,7 @@ window* manager::get_window(const unsigned id)

} // namespace

window::window(CVideo& video,
typed_formula<unsigned> x,
typed_formula<unsigned> y,
typed_formula<unsigned> w,
typed_formula<unsigned> h,
typed_formula<bool> reevaluate_best_size,
const wfl::function_symbol_table& functions,
const bool automatic_placement,
const unsigned horizontal_placement,
const unsigned vertical_placement,
const unsigned maximum_width,
const unsigned maximum_height,
const std::string& definition,
const builder_window::window_resolution::tooltip_info& tooltip,
const builder_window::window_resolution::tooltip_info& helptip)
window::window(CVideo& video, const builder_window::window_resolution* definition)
: panel(implementation::builder_window(::config {"definition", definition->definition}), get_control_type())
, cursor::setter(cursor::NORMAL)
, video_(video)
Expand All @@ -318,19 +304,19 @@ window::window(CVideo& video,
, restore_(true)
, is_toplevel_(!is_in_dialog())
, restorer_()
, automatic_placement_(automatic_placement)
, horizontal_placement_(horizontal_placement)
, vertical_placement_(vertical_placement)
, maximum_width_(maximum_width)
, maximum_height_(maximum_height)
, x_(x)
, y_(y)
, w_(w)
, h_(h)
, reevaluate_best_size_(reevaluate_best_size)
, functions_(functions)
, tooltip_(tooltip)
, helptip_(helptip)
, automatic_placement_(definition->automatic_placement)
, horizontal_placement_(definition->horizontal_placement)
, vertical_placement_(definition->vertical_placement)
, maximum_width_(definition->maximum_width)
, maximum_height_(definition->maximum_height)
, x_(definition->x)
, y_(definition->y)
, w_(definition->width)
, h_(definition->height)
, reevaluate_best_size_(definition->reevaluate_best_size)
, functions_(definition->functions)
, tooltip_(definition->tooltip)
, helptip_(definition->helptip)
, click_dismiss_(false)
, enter_disabled_(false)
, escape_disabled_(false)
Expand Down
18 changes: 2 additions & 16 deletions src/gui/widgets/window.hpp
Expand Up @@ -68,21 +68,7 @@ class window : public panel, public cursor::setter
friend class pane;

public:
window(CVideo& video,
typed_formula<unsigned> x,
typed_formula<unsigned> y,
typed_formula<unsigned> w,
typed_formula<unsigned> h,
typed_formula<bool> reevaluate_best_size,
const wfl::function_symbol_table& functions,
const bool automatic_placement,
const unsigned horizontal_placement,
const unsigned vertical_placement,
const unsigned maximum_width,
const unsigned maximum_height,
const std::string& definition,
const builder_window::window_resolution::tooltip_info& tooltip,
const builder_window::window_resolution::tooltip_info& helptip);
window(CVideo& video, const builder_window::window_resolution* definition);

~window();

Expand Down Expand Up @@ -151,7 +137,7 @@ class window : public panel, public cursor::setter
* @param auto_close_timeout The time in ms after which the window will
* automatically close, if 0 it doesn't close.
* @note the timeout is a minimum time and
* there's no quarantee about how fast it closes
* there's no guarantee about how fast it closes
* after the minimum.
*
* @returns The close code of the window, predefined
Expand Down

0 comments on commit b5c4223

Please sign in to comment.