help.hpp

Go to the documentation of this file.
00001 /* $Id: help.hpp 52533 2012-01-07 02:35:17Z shadowmaster $ */
00002 /*
00003    Copyright (C) 2003 - 2012 by David White <dave@whitevine.net>
00004    Part of the Battle for Wesnoth Project http://www.wesnoth.org/
00005 
00006    This program is free software; you can redistribute it and/or modify
00007    it under the terms of the GNU General Public License as published by
00008    the Free Software Foundation; either version 2 of the License, or
00009    (at your option) any later version.
00010    This program is distributed in the hope that it will be useful,
00011    but WITHOUT ANY WARRANTY.
00012 
00013    See the COPYING file for more details.
00014 */
00015 #ifndef HELP_HPP_INCLUDED
00016 #define HELP_HPP_INCLUDED
00017 
00018 class config;
00019 class display;
00020 class gamemap;
00021 
00022 #include "hotkeys.hpp"
00023 #include "construct_dialog.hpp"
00024 
00025 namespace help {
00026 
00027 struct help_manager {
00028     help_manager(const config *game_config, gamemap *map);
00029     ~help_manager();
00030 };
00031 
00032 struct section;
00033 /// Open a help dialog using a toplevel other than the default. This
00034 /// allows for complete customization of the contents, although not in a
00035 /// very easy way.
00036 void show_help(display &disp, const section &toplevel, const std::string& show_topic="",
00037                int xloc=-1, int yloc=-1);
00038 
00039 /// Open the help browser. The help browser will have the topic with id
00040 /// show_topic open if it is not the empty string. The default topic
00041 /// will be shown if show_topic is the empty string.
00042 void show_help(display &disp, const std::string& show_topic="", int xloc=-1, int yloc=-1);
00043 
00044 /// wrapper to add unit prefix and hidding symbol
00045 void show_unit_help(display &disp, const std::string& unit_id, bool hidden = false,
00046                 int xloc=-1, int yloc=-1);
00047 
00048 class help_button : public gui::dialog_button, public hotkey::command_executor {
00049 public:
00050     help_button(display& disp, const std::string &help_topic);
00051     ~help_button();
00052     int action(gui::dialog_process_info &info);
00053     std::string topic() const { return topic_; }
00054     void join();
00055     void leave();
00056 private:
00057     void show_help();
00058     bool can_execute_command(hotkey::HOTKEY_COMMAND cmd, int/*index*/ =-1) const;
00059 
00060     display &disp_;
00061     const std::string topic_;
00062     hotkey::basic_handler *help_hand_;
00063 };
00064 
00065 
00066 } // End namespace help.
00067 
00068 #endif
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines

Generated by doxygen 1.7.1 on Fri May 25 2012 01:03:00 for The Battle for Wesnoth
Gna! | Forum | Wiki | CIA | devdocs