gui/widgets/event_executor.hpp

Go to the documentation of this file.
00001 /* $Id: event_executor.hpp 52533 2012-01-07 02:35:17Z shadowmaster $ */
00002 /*
00003    Copyright (C) 2007 - 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 #ifndef GUI_WIDGETS_EVENT_EXECUTOR_HPP_INCLUDED
00017 #define GUI_WIDGETS_EVENT_EXECUTOR_HPP_INCLUDED
00018 
00019 #include "SDL.h"
00020 
00021 namespace gui2 {
00022 
00023 class tevent_handler;
00024 
00025 /**
00026  * Event execution calls.
00027  *
00028  * Base class with all possible events, most widgets can ignore most of these,
00029  * but they are available. In order to use an event simply override the
00030  * execution function and implement the wanted behaviour. The default behaviour
00031  * defined here is to do nothing.
00032  *
00033  * For more info about the event handling have a look at the tevent_handler
00034  * class which 'translates' sdl events into 'widget' events.
00035  */
00036 class tevent_executor
00037 {
00038 public:
00039     tevent_executor() :
00040         wants_mouse_hover_(false),
00041         wants_mouse_left_double_click_(false),
00042         wants_mouse_middle_double_click_(false),
00043         wants_mouse_right_double_click_(false)
00044         {}
00045 
00046     virtual ~tevent_executor() {}
00047 
00048     /***** ***** ***** setters / getters for members ***** ****** *****/
00049 
00050     void set_wants_mouse_hover(const bool hover = true)
00051         { wants_mouse_hover_ = hover; }
00052     bool wants_mouse_hover() const { return wants_mouse_hover_; }
00053 
00054     void set_wants_mouse_left_double_click(const bool click = true)
00055         { wants_mouse_left_double_click_ = click; }
00056     bool wants_mouse_left_double_click() const
00057         { return wants_mouse_left_double_click_; }
00058 
00059     void set_wants_mouse_middle_double_click(const bool click = true)
00060         { wants_mouse_middle_double_click_ = click; }
00061     bool wants_mouse_middle_double_click() const
00062         { return wants_mouse_middle_double_click_; }
00063 
00064     tevent_executor& set_wants_mouse_right_double_click(const bool click = true)
00065         { wants_mouse_right_double_click_ = click; return *this; }
00066     bool wants_mouse_right_double_click() const
00067         { return wants_mouse_right_double_click_; }
00068 
00069 private:
00070 
00071     /** Does the widget want a hover event? See mouse_hover. */
00072     bool wants_mouse_hover_;
00073 
00074     /**
00075      * Does the widget want a left button double click? See
00076      * mouse_left_button_double_click.
00077      */
00078     bool wants_mouse_left_double_click_;
00079 
00080     /** See wants_mouse_left_double_click_ */
00081     bool wants_mouse_middle_double_click_;
00082 
00083     /** See wants_mouse_left_double_click_ */
00084     bool wants_mouse_right_double_click_;
00085 };
00086 
00087 } // namespace gui2
00088 
00089 #endif
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines

Generated by doxygen 1.7.1 on Thu May 24 2012 01:02:43 for The Battle for Wesnoth
Gna! | Forum | Wiki | CIA | devdocs