00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
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