gui/widgets/clickable.hpp

Go to the documentation of this file.
00001 /* $Id: clickable.hpp 52533 2012-01-07 02:35:17Z shadowmaster $ */
00002 /*
00003    Copyright (C) 2009 - 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_CLICKABLE_HPP_INCLUDED
00017 #define GUI_WIDGETS_CLICKABLE_HPP_INCLUDED
00018 
00019 #include "gui/auxiliary/event/dispatcher.hpp"
00020 
00021 namespace gui2 {
00022 
00023 /**
00024  * Small concept class.
00025  *
00026  * Parts of the engine inherit this class so we can have generic
00027  * clickable items. This is mainly for the button and the repeating button
00028  * classes.
00029  *
00030  * The reason for having the click functions here is that not all subclasses
00031  * need to implement the click event in the same way; e.g. the repeating button
00032  * clicks on the mouse down event and the normal button on the mouse click
00033  * event.
00034  *
00035  * Common signal handlers:
00036  * - connect_signal_mouse_left_click
00037  * - disconnect_signal_mouse_left_click
00038  */
00039 class tclickable_
00040 {
00041 public:
00042     virtual ~tclickable_() {}
00043 
00044     /**
00045      * Connects a signal handler for a 'click' event.
00046      *
00047      * What the click is depends on the subclass.
00048      *
00049      * @param signal              The signal to connect.
00050      */
00051     virtual void connect_click_handler(
00052             const event::tsignal_function& signal) = 0;
00053 
00054     /**
00055      * Disconnects a signal handler for a 'click' event.
00056      *
00057      * What the click is depends on the subclass.
00058      *
00059      * @param signal              The signal to disconnect (should be the same
00060      *                            as send to the connect call.
00061      */
00062     virtual void disconnect_click_handler(
00063             const event::tsignal_function& signal) = 0;
00064 };
00065 
00066 } // namespace gui2
00067 
00068 #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