vertical_scrollbar.cpp

Go to the documentation of this file.
00001 /* $Id: vertical_scrollbar.cpp 26359 2008-05-03 14:59:38Z mordante $ */
00002 /*
00003    copyright (C) 2008 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 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 #include "gui/widgets/vertical_scrollbar.hpp"
00016 
00017 #include "log.hpp"
00018 
00019 #include <cassert>
00020 
00021 
00022 #define DBG_G LOG_STREAM_INDENT(debug, gui)
00023 #define LOG_G LOG_STREAM_INDENT(info, gui)
00024 #define WRN_G LOG_STREAM_INDENT(warn, gui)
00025 #define ERR_G LOG_STREAM_INDENT(err, gui)
00026 
00027 #define DBG_G_D LOG_STREAM_INDENT(debug, gui_draw)
00028 #define LOG_G_D LOG_STREAM_INDENT(info, gui_draw)
00029 #define WRN_G_D LOG_STREAM_INDENT(warn, gui_draw)
00030 #define ERR_G_D LOG_STREAM_INDENT(err, gui_draw)
00031 
00032 #define DBG_G_E LOG_STREAM_INDENT(debug, gui_event)
00033 #define LOG_G_E LOG_STREAM_INDENT(info, gui_event)
00034 #define WRN_G_E LOG_STREAM_INDENT(warn, gui_event)
00035 #define ERR_G_E LOG_STREAM_INDENT(err, gui_event)
00036 
00037 #define DBG_G_P LOG_STREAM_INDENT(debug, gui_parse)
00038 #define LOG_G_P LOG_STREAM_INDENT(info, gui_parse)
00039 #define WRN_G_P LOG_STREAM_INDENT(warn, gui_parse)
00040 #define ERR_G_P LOG_STREAM_INDENT(err, gui_parse)
00041 
00042 
00043 namespace gui2 {
00044 
00045 //! Inherited from tscrollbar.
00046 unsigned tvertical_scrollbar::minimum_positioner_length() const
00047 { 
00048     const tvertical_scrollbar_definition::tresolution* conf = 
00049         dynamic_cast<const tvertical_scrollbar_definition::tresolution*>(config());
00050     assert(conf); 
00051     return conf->minimum_positioner_length; 
00052 }
00053 
00054 //! Inherited from tscrollbar.
00055 unsigned tvertical_scrollbar::offset_before() const
00056 { 
00057     const tvertical_scrollbar_definition::tresolution* conf = 
00058         dynamic_cast<const tvertical_scrollbar_definition::tresolution*>(config());
00059     assert(conf); 
00060     return conf->top_offset; 
00061 }
00062 
00063 //! Inherited from tscrollbar.
00064 unsigned tvertical_scrollbar::offset_after() const
00065 { 
00066     const tvertical_scrollbar_definition::tresolution* conf = 
00067         dynamic_cast<const tvertical_scrollbar_definition::tresolution*>(config());
00068     assert(conf); 
00069     return conf->bottom_offset; 
00070 }
00071 
00072 //! Inherited from tscrollbar.
00073 bool tvertical_scrollbar::on_positioner(const tpoint& coordinate) const
00074 {
00075     // Note we assume the positioner is over the entire width of the widget.
00076     return coordinate.y >= get_positioner_offset() 
00077         && coordinate.y < get_positioner_offset() + get_positioner_length()
00078         && coordinate.x > 0
00079         && coordinate.x < get_width();
00080 }
00081 
00082 } // namespace gui2
00083 
00084 

Generated by doxygen 1.5.5 on 23 May 2008 for The Battle for Wesnoth
Gna! | Forum | Wiki | CIA | devdocs