• Main Page
  • Related Pages
  • Classes
  • Files
  • File List

src/LineBased.hh

00001 /*
00002  * Copyright Staffan Gimåker 2007-2010.
00003  *
00004  * ---
00005  *
00006  * This file is part of peekabot.
00007  *
00008  * peekabot is free software; you can redistribute it and/or modify
00009  * it under the terms of the GNU General Public License as published by
00010  * the Free Software Foundation; either version 3 of the License, or
00011  * (at your option) any later version.
00012  *
00013  * peekabot is distributed in the hope that it will be useful,
00014  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00015  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00016  * GNU General Public License for more details.
00017  *
00018  * You should have received a copy of the GNU General Public License
00019  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
00020  */
00021 
00022 #ifndef PEEKABOT_LINE_BASED_HH_INCLUDED
00023 #define PEEKABOT_LINE_BASED_HH_INCLUDED
00024 
00025 
00026 #include <boost/signals2.hpp>
00027 #include <boost/cstdint.hpp>
00028 
00029 #include "Types.hh"
00030 #include "XMLHandler.hh"
00031 #include "PropMap.hh"
00032 
00033 
00034 namespace peekabot
00035 {
00036 
00037     class ScopedHandler;
00038 
00048     class LineBased
00049     {
00050     public:
00051         LineBased() throw();
00052 
00056         LineBased(ScopedHandler *handler);
00057 
00058         virtual ~LineBased() {}
00059 
00060         float get_line_width() const;
00061 
00062         void set_line_width(float line_width);
00063 
00064         void set_line_style(LineStyle style);
00065 
00066         LineStyle get_line_style() const;
00067 
00068         void set_stipple_factor(boost::uint32_t factor);
00069 
00070         boost::uint32_t get_stipple_factor() const;
00071 
00074 
00075         typedef boost::signals2::signal<void ()> LineWidthSetSignal;
00076 
00077         typedef boost::signals2::signal<void ()> LineStyleSetSignal;
00078 
00079         typedef boost::signals2::signal<void ()> StippleFactorSetSignal;
00080 
00081         inline LineWidthSetSignal &line_width_set_signal() const
00082         {
00083             return m_line_width_set_signal;
00084         }
00085 
00086         inline LineStyleSetSignal &line_style_set_signal() const
00087         {
00088             return m_line_style_set_signal;
00089         }
00090 
00091         inline StippleFactorSetSignal &stipple_factor_set_signal() const
00092         {
00093             return m_stipple_factor_set_signal;
00094         }
00095 
00097 
00098     protected:
00099         virtual PropMap &get_prop_adapters();
00100 
00101     private:
00102         static void create_prop_adapters(PropMap &adapters);
00103 
00106 
00110         void line_width_start_handler(
00111             const std::string &name,
00112             XMLHandler::AttributeMap &attributes,
00113             ScopedHandler *handler) throw();
00114 
00118         void line_width_cdata_handler(
00119             const std::string &cdata,
00120             ScopedHandler *handler);
00121 
00125         void line_style_start_handler(
00126             const std::string &name,
00127             XMLHandler::AttributeMap &attributes,
00128             ScopedHandler *handler);
00129 
00133         void line_style_cdata_handler(
00134             const std::string &cdata,
00135             ScopedHandler *handler,
00136             int factor);
00137 
00139 
00140     private:
00141         float m_line_width;
00142 
00143         LineStyle m_line_style;
00144 
00145         int m_stipple_factor;
00146 
00147         mutable LineWidthSetSignal m_line_width_set_signal;
00148         mutable LineStyleSetSignal m_line_style_set_signal;
00149         mutable StippleFactorSetSignal m_stipple_factor_set_signal;
00150     };
00151 }
00152 
00153 
00154 #endif // PEEKABOT_LINE_BASED_HH_INCLUDED

Generated on Sun Jan 30 2011 for peekabot by  doxygen 1.7.1