00001 /* $Id: scrollarea.hpp 23842 2008-02-16 08:47:16Z mordante $ */ 00002 /* 00003 Copyright (C) 2004 - 2008 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 version 2 00008 or at your option any later version. 00009 This program is distributed in the hope that it will be useful, 00010 but WITHOUT ANY WARRANTY. 00011 00012 See the COPYING file for more details. 00013 */ 00014 00015 //! @file widgets/scrollarea.hpp 00016 //! 00017 00018 #ifndef SCROLLAREA_HPP_INCLUDED 00019 #define SCROLLAREA_HPP_INCLUDED 00020 00021 #include "SDL.h" 00022 #include "../sdl_utils.hpp" 00023 #include "scrollbar.hpp" 00024 #include "widget.hpp" 00025 00026 namespace gui { 00027 00028 class scrollarea : public widget 00029 { 00030 public: 00031 //! Create a zone with automatic handling of scrollbar. 00032 //! @todo FIXME: parameterlist ?? 00033 //- \param d the display object 00034 //- \param pane the widget where wheel events take place 00035 scrollarea(CVideo &video, bool auto_join=true); 00036 00037 virtual void hide(bool value = true); 00038 00039 protected: 00040 virtual handler_vector handler_members(); 00041 virtual void update_location(SDL_Rect const &rect); 00042 virtual void handle_event(const SDL_Event& event); 00043 virtual void process_event(); 00044 virtual void scroll(unsigned int pos) = 0; 00045 virtual void set_inner_location(SDL_Rect const &rect) = 0; 00046 00047 SDL_Rect inner_location() const; 00048 unsigned scrollbar_width() const; 00049 00050 unsigned get_position() const; 00051 unsigned get_max_position() const; 00052 void set_position(unsigned pos); 00053 void adjust_position(unsigned pos); 00054 void move_position(int dep); 00055 void set_shown_size(unsigned h); 00056 void set_full_size(unsigned h); 00057 void set_scroll_rate(unsigned r); 00058 bool has_scrollbar() const; 00059 00060 private: 00061 scrollbar scrollbar_; 00062 int old_position_; 00063 bool recursive_, shown_scrollbar_; 00064 unsigned shown_size_; 00065 unsigned full_size_; 00066 00067 void test_scrollbar(); 00068 }; 00069 00070 } // end namespace gui 00071 00072 #endif
Generated by doxygen 1.5.5 on 23 May 2008 for The Battle for Wesnoth | Gna! | Forum | Wiki | CIA | devdocs |