gui/auxiliary/event/message.hpp

Go to the documentation of this file.
00001 /* $Id: message.hpp 54167 2012-05-13 13:33:24Z mordante $ */
00002 /*
00003    Copyright (C) 2011 - 2012 by Mark de Wever <koraq@xs4all.nl>
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 
00016 /**
00017  * @file
00018  * This file contains the defintions for the @ref gui2::event::tmessage class.
00019  *
00020  * The class is used in the @ref gui2::event::tsignal_message_function
00021  */
00022 
00023 #ifndef GUI_WIDGETS_AUXILIARY_EVENT_MESSAGE_HPP_INCLUDED
00024 #define GUI_WIDGETS_AUXILIARY_EVENT_MESSAGE_HPP_INCLUDED
00025 
00026 #include "gui/widgets/helper.hpp"
00027 
00028 namespace gui2 {
00029 
00030 namespace event {
00031 
00032 /**
00033  * The message callbacks hold a reference to a message.
00034  *
00035  * The contents of the message differ per type. This class is a base with a
00036  * virtual destructor, which makes it possible to use a dynamic_cast on the
00037  * class received to make sure the proper message type is send.
00038  *
00039  * This means all messages used in the events need to be derived from this
00040  * class. When a message needs no `content' it can send this class as message.
00041  * This is done by:
00042  * * @ref REQUEST_PLACEMENT
00043  */
00044 struct tmessage
00045 {
00046     virtual ~tmessage() {}
00047 };
00048 
00049 /** The message for MESSAGE_SHOW_TOOLTIP. */
00050 struct tmessage_show_tooltip
00051     : public tmessage
00052 {
00053     tmessage_show_tooltip(
00054               const std::string& message_
00055             , const tpoint& location_)
00056         : message(message_)
00057         , location(location_)
00058     {
00059     }
00060 
00061     /** The message to show on the tooltip. */
00062     const std::string message;
00063 
00064     /** The location where to show the tooltip. */
00065     const tpoint location;
00066 };
00067 
00068 /** The message for MESSAGE_SHOW_HELPTIP. */
00069 struct tmessage_show_helptip
00070     : public tmessage
00071 {
00072     tmessage_show_helptip(
00073               const std::string& message_
00074             , const tpoint& location_)
00075         : message(message_)
00076         , location(location_)
00077     {
00078     }
00079 
00080     /** The message to show on the helptip. */
00081     const std::string message;
00082 
00083     /** The location where to show the helptip. */
00084     const tpoint location;
00085 };
00086 
00087 } // namespace event
00088 
00089 } // namespace gui2
00090 
00091 #endif
00092 
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines

Generated by doxygen 1.7.1 on Wed May 23 2012 01:02:40 for The Battle for Wesnoth
Gna! | Forum | Wiki | CIA | devdocs