Skip to content

Commit

Permalink
Initial framework for a GUI2 version of the help browser
Browse files Browse the repository at this point in the history
  • Loading branch information
Vultraz committed Mar 10, 2015
1 parent 760e967 commit d8836e7
Show file tree
Hide file tree
Showing 4 changed files with 235 additions and 0 deletions.
135 changes: 135 additions & 0 deletions 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]
2 changes: 2 additions & 0 deletions projectfiles/CodeBlocks/wesnoth.cbp
Expand Up @@ -660,6 +660,8 @@
<Unit filename="../../src/gui/dialogs/game_save.hpp" />
<Unit filename="../../src/gui/dialogs/gamestate_inspector.cpp" />
<Unit filename="../../src/gui/dialogs/gamestate_inspector.hpp" />
<Unit filename="../../src/gui/dialogs/help_browser.cpp" />
<Unit filename="../../src/gui/dialogs/help_browser.hpp" />
<Unit filename="../../src/gui/dialogs/helper.hpp" />
<Unit filename="../../src/gui/dialogs/language_selection.cpp" />
<Unit filename="../../src/gui/dialogs/language_selection.hpp" />
Expand Down
57 changes: 57 additions & 0 deletions src/gui/dialogs/help_browser.cpp
@@ -0,0 +1,57 @@
/*
Copyright (C) 2008 - 2015 by Charles Dang <exodia339@gmail.com>
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 <boost/bind.hpp>

namespace gui2
{

REGISTER_DIALOG(help_browser)

thelp_browser::thelp_browser(const std::vector<config>& help)
: initial_topic_("introduction")
{
}

void thelp_browser::pre_show(CVideo& video, twindow& window)
{
}

void thelp_browser::post_show(twindow& window)
{
}

} // namespace gui2
41 changes: 41 additions & 0 deletions src/gui/dialogs/help_browser.hpp
@@ -0,0 +1,41 @@
/*
Copyright (C) 2008 - 2015 by Charles Dang <exodia339@gmail.com>
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<config>& 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

0 comments on commit d8836e7

Please sign in to comment.