00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
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
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
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
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
00073 bool tvertical_scrollbar::on_positioner(const tpoint& coordinate) const
00074 {
00075
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 }
00083
00084