From d8836e7b997053b15391261567d129f3947d8a88 Mon Sep 17 00:00:00 2001 From: Charles Dang Date: Tue, 10 Mar 2015 21:06:15 +1100 Subject: [PATCH] Initial framework for a GUI2 version of the help browser --- data/gui/default/window/help_browser.cfg | 135 +++++++++++++++++++++++ projectfiles/CodeBlocks/wesnoth.cbp | 2 + src/gui/dialogs/help_browser.cpp | 57 ++++++++++ src/gui/dialogs/help_browser.hpp | 41 +++++++ 4 files changed, 235 insertions(+) create mode 100644 data/gui/default/window/help_browser.cfg create mode 100644 src/gui/dialogs/help_browser.cpp create mode 100644 src/gui/dialogs/help_browser.hpp diff --git a/data/gui/default/window/help_browser.cfg b/data/gui/default/window/help_browser.cfg new file mode 100644 index 000000000000..077ab6e8d846 --- /dev/null +++ b/data/gui/default/window/help_browser.cfg @@ -0,0 +1,135 @@ +#textdomain wesnoth-lib + +[window] + id = "help_browser" + description = "Battle for Wesnoth Help." + + [resolution] + definition = "default" + + automatic_placement = "true" + vertical_placement = "center" + horizontal_placement = "center" + + [tooltip] + id = "tooltip_large" + [/tooltip] + + [helptip] + id = "tooltip_large" + [/helptip] + + [linked_group] + id = "images" + fixed_width = true + [/linked_group] + + [linked_group] + id = "names" + fixed_width = true + [/linked_group] + + [grid] + [row] + grow_factor = 1 + [column] + border = "all" + border_size = 5 + horizontal_alignment = "left" + [label] + definition = "title" + label = _ "Battle For Wesnoth Help" + [/label] + [/column] + [/row] + [row] + [column] + grow_factor = 1 + [grid] + [row] + grow_factor = 1 + [column] + border = "all" + border_size = 5 + vertical_alignment = "top" + [listbox] + id = "topic_list" + [list_definition] + [row] + [column] + vertical_grow = true + horizontal_grow = true + grow_factor = 1 + [toggle_panel] + [grid] + [row] + [column] + border = "all" + border_size = 5 + [image] + id = "topic_list_image" + linked_group = "images" + label = "icons/menu-book.png" + [/image] + [/column] + [column] + border = "all" + border_size = 5 + [label] + id = "topic_list_name" + linked_group = "names" + [/label] + [/column] + [column] + border = "all" + border_size = 5 + [spacer] + width = 5 + [/spacer] + [/column] + [/row] + [/grid] + [/toggle_panel] + [/column] + [/row] + [/list_definition] + [/listbox] + [/column] + [column] + [multi_page] + id = "help_text_pages" + [page_definition] + [row] + grow_factor = 1 + [column] + border = "all" + border_size = 5 + vertical_grow = true + [scroll_label] + id = "topic_text" + [/scroll_label] + [/column] + [/row] + [/page_definition] + [/multi_page] + [/column] + [/row] + [/grid] + [/column] + [/row] + [row] + [column] + border = "all" + border_size = 5 + horizontal_alignment = "right" + [button] + definition=default + id = "close_button" + return_value = 1 + label = _ "Close" + [/button] + [/column] + [/row] + [/grid] + [/resolution] +[/window] diff --git a/projectfiles/CodeBlocks/wesnoth.cbp b/projectfiles/CodeBlocks/wesnoth.cbp index a4daac8b3ef8..a97065607882 100644 --- a/projectfiles/CodeBlocks/wesnoth.cbp +++ b/projectfiles/CodeBlocks/wesnoth.cbp @@ -660,6 +660,8 @@ + + diff --git a/src/gui/dialogs/help_browser.cpp b/src/gui/dialogs/help_browser.cpp new file mode 100644 index 000000000000..26187f00de54 --- /dev/null +++ b/src/gui/dialogs/help_browser.cpp @@ -0,0 +1,57 @@ +/* + Copyright (C) 2008 - 2015 by Charles Dang + Part of 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/dialogs/help_browser.hpp" + +#include "gui/auxiliary/find_widget.tpp" +#include "gui/widgets/button.hpp" +#include "gui/widgets/window.hpp" +#include "gui/widgets/settings.hpp" +#include "gui/widgets/text_box.hpp" +#include "gui/widgets/image.hpp" +#include "gui/widgets/multi_page.hpp" +#include "gui/widgets/scroll_label.hpp" +#include "gui/widgets/settings.hpp" + +#ifdef GUI2_EXPERIMENTAL_LISTBOX +#include "gui/widgets/list.hpp" +#else +#include "gui/widgets/listbox.hpp" +#endif + +#include "help/help.hpp" + +#include + +namespace gui2 +{ + +REGISTER_DIALOG(help_browser) + +thelp_browser::thelp_browser(const std::vector& help) + : initial_topic_("introduction") +{ +} + +void thelp_browser::pre_show(CVideo& video, twindow& window) +{ +} + +void thelp_browser::post_show(twindow& window) +{ +} + +} // namespace gui2 diff --git a/src/gui/dialogs/help_browser.hpp b/src/gui/dialogs/help_browser.hpp new file mode 100644 index 000000000000..1c89a20d9961 --- /dev/null +++ b/src/gui/dialogs/help_browser.hpp @@ -0,0 +1,41 @@ +/* + Copyright (C) 2008 - 2015 by Charles Dang + Part of 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. +*/ + +#include "gui/dialogs/dialog.hpp" + +#include "config.hpp" + +namespace gui2 +{ + +/** Help browser dialog. */ +class thelp_browser : public tdialog +{ +public: + thelp_browser(const std::vector& help); + +private: + std::string initial_topic_; + + /** Inherited from tdialog, implemented by REGISTER_DIALOG. */ + virtual const std::string& window_id() const; + + /** Inherited from tdialog. */ + void pre_show(CVideo& video, twindow& window); + + /** Inherited from tdialog. */ + void post_show(twindow& window); +}; + +} // namespace gui2