gui/widgets/scroll_label.hpp

Go to the documentation of this file.
00001 /* $Id: scroll_label.hpp 52533 2012-01-07 02:35:17Z shadowmaster $ */
00002 /*
00003    Copyright (C) 2008 - 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_SCROLL_LABEL_HPP_INCLUDED
00017 #define GUI_WIDGETS_SCROLL_LABEL_HPP_INCLUDED
00018 
00019 #include "gui/widgets/scrollbar_container.hpp"
00020 
00021 namespace gui2 {
00022 
00023 class tlabel;
00024 class tspacer;
00025 
00026 namespace implementation {
00027     struct tbuilder_scroll_label;
00028 }
00029 
00030 /**
00031  * Label showing a text.
00032  *
00033  * This version shows a scrollbar if the text gets too long and has some
00034  * scrolling features. In general this widget is slower as the normal label so
00035  * the normal label should be preferred.
00036  */
00037 class tscroll_label : public tscrollbar_container
00038 {
00039     friend struct implementation::tbuilder_scroll_label;
00040 public:
00041 
00042     tscroll_label();
00043 
00044     /** Inherited from tcontrol. */
00045     void set_label(const t_string& label);
00046 
00047     /** Inherited from tcontrol. */
00048     void set_use_markup(bool use_markup);
00049 
00050     /** Inherited from tcontainer_. */
00051     void set_self_active(const bool active)
00052         { state_ = active ? ENABLED : DISABLED; }
00053 
00054     /***** ***** ***** setters / getters for members ***** ****** *****/
00055 
00056     bool get_active() const { return state_ != DISABLED; }
00057 
00058     unsigned get_state() const { return state_; }
00059 
00060 private:
00061     /**
00062      * Possible states of the widget.
00063      *
00064      * Note the order of the states must be the same as defined in settings.hpp.
00065      */
00066     enum tstate { ENABLED, DISABLED, COUNT };
00067 
00068 //  It's not needed for now so keep it disabled, no definition exists yet.
00069 //  void set_state(const tstate state);
00070 
00071     /**
00072      * Current state of the widget.
00073      *
00074      * The state of the widget determines what to render and how the widget
00075      * reacts to certain 'events'.
00076      */
00077     tstate state_;
00078 
00079     void finalize_subclass();
00080 
00081     /***** ***** ***** inherited ****** *****/
00082 
00083     /** Inherited from tcontrol. */
00084     const std::string& get_control_type() const;
00085 
00086     /***** ***** ***** signal handlers ***** ****** *****/
00087 
00088     void signal_handler_left_button_down(const event::tevent event);
00089 };
00090 
00091 } // namespace gui2
00092 
00093 #endif
00094 
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines

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