00001 #ifndef GSGL_FRAMEWORK_SCROLLBAR_H 00002 #define GSGL_FRAMEWORK_SCROLLBAR_H 00003 00004 // 00005 // $Id: scrollbar.hpp 2 2008-03-01 20:58:50Z kulibali $ 00006 // 00007 // Copyright (c) 2008, The Periapsis Project. All rights reserved. 00008 // 00009 // Redistribution and use in source and binary forms, with or without 00010 // modification, are permitted provided that the following conditions are 00011 // met: 00012 // 00013 // * Redistributions of source code must retain the above copyright notice, 00014 // this list of conditions and the following disclaimer. 00015 // 00016 // * Redistributions in binary form must reproduce the above copyright 00017 // notice, this list of conditions and the following disclaimer in the 00018 // documentation and/or other materials provided with the distribution. 00019 // 00020 // * Neither the name of the The Periapsis Project nor the names of its 00021 // contributors may be used to endorse or promote products derived from 00022 // this software without specific prior written permission. 00023 // 00024 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS 00025 // IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED 00026 // TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A 00027 // PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER 00028 // OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 00029 // EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 00030 // PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 00031 // PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF 00032 // LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 00033 // NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 00034 // SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 00035 // 00036 00037 #include "framework/framework.hpp" 00038 #include "framework/widget.hpp" 00039 #include "data/config.hpp" 00040 00041 namespace gsgl 00042 { 00043 00044 namespace framework 00045 { 00046 00047 class FRAMEWORK_API scrollbar 00048 : public widget 00049 { 00050 static gsgl::data::config_variable<int> ARROW_SIZE; 00051 00052 int min_val, max_val; 00053 int pos, extent; 00054 00055 public: 00056 enum bar_mode 00057 { 00058 VERTICAL, 00059 HORIZONTAL 00060 }; 00061 00062 scrollbar(widget *parent, 00063 const int x, const int y, const int w, const int h, 00064 const platform::color & foreground, 00065 const platform::color & background, 00066 bar_mode mode = VERTICAL); 00067 virtual ~scrollbar(); 00068 00069 00070 bar_mode & get_mode() { return mode; } 00071 00072 /// Get or set the minimum value of the scrollbar. 00073 int & get_min() { return min_val; } 00074 00075 /// Get or set the maximum value of the scrollbar. 00076 int & get_max() { return max_val; } 00077 00078 /// Get or set the current beginning position of the scrollbar. 00079 int & get_pos() { return pos; } 00080 00081 /// Get or set the current extent of the scrollbar. 00082 int & get_extent() { return extent; } 00083 00084 00085 virtual void draw(); 00086 00087 private: 00088 bar_mode mode; 00089 }; // class scrollbar 00090 00091 } // namespace framework 00092 00093 } // namespace gsgl 00094 00095 #endif