widgets/scrollarea.hpp

Go to the documentation of this file.
00001 /* $Id: scrollarea.hpp 52533 2012-01-07 02:35:17Z shadowmaster $ */
00002 /*
00003    Copyright (C) 2004 - 2012 by Guillaume Melquiond <guillaume.melquiond@gmail.com>
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 /** @file */
00017 
00018 #ifndef SCROLLAREA_HPP_INCLUDED
00019 #define SCROLLAREA_HPP_INCLUDED
00020 
00021 #include "scrollbar.hpp"
00022 
00023 namespace gui {
00024 
00025 class scrollarea : public widget
00026 {
00027 public:
00028     /**
00029      * Create a zone with automatic handling of scrollbar.
00030      * @todo FIXME: parameterlist ??
00031      */
00032     //- \param d the display object
00033     //- \param pane the widget where wheel events take place
00034     scrollarea(CVideo &video, bool auto_join=true);
00035 
00036     virtual void hide(bool value = true);
00037 
00038 protected:
00039     virtual handler_vector handler_members();
00040     virtual void update_location(SDL_Rect const &rect);
00041     virtual void handle_event(const SDL_Event& event);
00042     virtual void process_event();
00043     virtual void scroll(unsigned int pos) = 0;
00044     virtual void set_inner_location(SDL_Rect const &rect) = 0;
00045 
00046     SDL_Rect inner_location() const;
00047     unsigned scrollbar_width() const;
00048 
00049     unsigned get_position() const;
00050     unsigned get_max_position() const;
00051     void set_position(unsigned pos);
00052     void adjust_position(unsigned pos);
00053     void move_position(int dep);
00054     void set_shown_size(unsigned h);
00055     void set_full_size(unsigned h);
00056     void set_scroll_rate(unsigned r);
00057     bool has_scrollbar() const;
00058 
00059 private:
00060     scrollbar scrollbar_;
00061     int old_position_;
00062     bool recursive_, shown_scrollbar_;
00063     unsigned shown_size_;
00064     unsigned full_size_;
00065 
00066     void test_scrollbar();
00067 };
00068 
00069 } // end namespace gui
00070 
00071 #endif
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines

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