help.hpp

Go to the documentation of this file.
00001 /* $Id: help.hpp 25333 2008-03-30 13:49:03Z jhinrichs $ */
00002 /*
00003    Copyright (C) 2003 - 2008 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 version 2
00008    or at your option any later version.
00009    This program is distributed in the hope that it will be useful,
00010    but WITHOUT ANY WARRANTY.
00011 
00012    See the COPYING file for more details.
00013 */
00014 #ifndef HELP_HPP_INCLUDED
00015 #define HELP_HPP_INCLUDED
00016 
00017 #include <string>
00018 #include <vector>
00019 
00020 class config;
00021 class display;
00022 class gamemap;
00023 
00024 #include "hotkeys.hpp"
00025 #include "construct_dialog.hpp"
00026 
00027 namespace help {
00028 
00029 struct help_manager {
00030     help_manager(const config *game_config, gamemap *map);
00031     ~help_manager();
00032 };
00033 
00034 struct section;
00035 /// Open a help dialog using a toplevel other than the default. This
00036 /// allows for complete customization of the contents, although not in a
00037 /// very easy way.
00038 void show_help(display &disp, const section &toplevel, const std::string& show_topic="",
00039                int xloc=-1, int yloc=-1);
00040 
00041 /// Open the help browser. The help browser will have the topic with id
00042 /// show_topic open if it is not the empty string. The default topic
00043 /// will be shown if show_topic is the empty string.
00044 void show_help(display &disp, const std::string& show_topic="", int xloc=-1, int yloc=-1);
00045 
00046 /// wrapper to add unit prefix and hidding symbol
00047 void show_unit_help(display &disp, const std::string& unit_id, bool hidden = false,
00048                 int xloc=-1, int yloc=-1);
00049 
00050 class help_button : public gui::dialog_button, public hotkey::command_executor {
00051 public:
00052     help_button(display& disp, const std::string &help_topic);
00053     int action(gui::dialog_process_info &info);
00054     const std::string topic() const { return topic_; }
00055     void join();
00056     void leave();
00057 private:
00058     void show_help();
00059     bool can_execute_command(hotkey::HOTKEY_COMMAND cmd, int/*index*/ =-1) const;
00060 
00061     display &disp_;
00062     const std::string topic_;
00063     hotkey::basic_handler *help_hand_;
00064 };
00065 
00066 
00067 } // End namespace help.
00068 
00069 #endif

Generated by doxygen 1.5.5 on 23 May 2008 for The Battle for Wesnoth
Gna! | Forum | Wiki | CIA | devdocs