00001
#ifndef _LIBGNOMECANVASMM_PROPERTIES_H_
00002
#define _LIBGNOMECANVASMM_PROPERTIES_H_
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
#include <glibmm/propertyproxy.h>
00030
#include <gdkmm/color.h>
00031
#include <gdkmm/bitmap.h>
00032
#include <pangomm/fontdescription.h>
00033
#include <gtkmm/enums.h>
00034
00035
namespace Gnome
00036 {
00037
00038
namespace Canvas
00039 {
00040
00041 namespace Properties
00042 {
00043
00044 class PropertyBase
00045 {
00046
public:
00047
PropertyBase(
const char* name);
00048
~PropertyBase();
00049
00050
const char*
get_name()
const;
00051
00052
protected:
00053 const char*
name_;
00054 };
00055
00056
template <
class T_Value>
00057 class Property :
public PropertyBase
00058 {
00059
public:
00060 Property(
const char* name,
const T_Value& value)
00061 :
PropertyBase(name),
value_(value)
00062 {}
00063
00064 void set_value_in_object(Glib::Object& object)
const
00065
{
00066 Glib::PropertyProxy<T_Value> proxy(&object,
get_name());
00067 proxy.set_value(
value_);
00068 }
00069
00070
protected:
00071 T_Value
value_;
00072 };
00073
00074
00079
template <
class O,
class T>
00080 O& operator << (O& object, const Property<T>& property)
00081 {
00082 property.set_value_in_object(object);
00083
return object;
00084 }
00085
00086
00087
00088
00089
template<>
00090 class Property<Gdk::Color> :
public PropertyBase
00091 {
00092
public:
00093
Property(
const char* name,
const Gdk::Color& value);
00094
Property(
const char* name,
const Glib::ustring& color);
00095
Property(
const char* name,
const guint& rgba_color);
00096
00097
void set_value_in_object(Glib::Object& object)
const;
00098
00099
protected:
00100 Gdk::Color value_;
00101 bool value_gobj_used_;
00102 Glib::ustring value_string_;
00103 bool value_string_used_;
00104 guint value_rgba_;
00105 };
00106
00107
00108
template<>
00109 class Property<Pango::FontDescription> :
public PropertyBase
00110 {
00111
public:
00112
Property(
const char* name,
const Pango::FontDescription& value);
00113
Property(
const char* name,
const Glib::ustring&
font);
00114
00115
void set_value_in_object(Glib::Object& object)
const;
00116
00117
protected:
00118 Pango::FontDescription value_;
00119 Glib::ustring value_string_;
00120 };
00121
00122
00123
00124
00125
00126
00127
00128 class font :
public Property<Pango::FontDescription>
00129 {
00130
public:
00131
font(
const Pango::FontDescription& v);
00132
00133
font(
const Glib::ustring& v);
00134 };
00135
00136
template<>
00137 class Property< Glib::RefPtr<Gdk::Bitmap> > :
public PropertyBase
00138 {
00139
public:
00140
Property(
const char* name,
const Glib::RefPtr<Gdk::Bitmap>& value);
00141
00142
void set_value_in_object(Glib::Object& object)
const;
00143
00144
protected:
00145 Glib::RefPtr<Gdk::Bitmap> value_;
00146 };
00147
00148 class fill_color :
public Property<Gdk::Color>
00149 {
00150
public:
00151
fill_color(
const Gdk::Color& v);
00152
00153
fill_color(
const Glib::ustring& v);
00154 };
00155
00156 class outline_color :
public Property<Gdk::Color>
00157 {
00158
public:
00159
outline_color(
const Gdk::Color& v);
00160
00161
outline_color(
const Glib::ustring& v);
00162 };
00163
00164
00165
00166 #define GNOMEMM_PROPERTY(N,N2,T) \
00167
class N : public Property<T> \
00168
{ \
00169
public: \
00170
N(const T& v); \
00171
};
00172
00173
00174
00175
GNOMEMM_PROPERTY(arrow_shape_a,arrow_shape_a,
double)
00176 GNOMEMM_PROPERTY(arrow_shape_b,arrow_shape_b,
double)
00177 GNOMEMM_PROPERTY(arrow_shape_c,arrow_shape_c,
double)
00178 GNOMEMM_PROPERTY(cap_style,cap_style,Gdk::CapStyle)
00179 GNOMEMM_PROPERTY(first_arrowhead,first_arrowhead,
bool)
00180 GNOMEMM_PROPERTY(join_style,join_style,Gdk::JoinStyle)
00181 GNOMEMM_PROPERTY(last_arrowhead,last_arrowhead,
bool)
00182 GNOMEMM_PROPERTY(line_style,line_style,Gdk::LineStyle)
00183 GNOMEMM_PROPERTY(smooth,smooth,
bool)
00184 GNOMEMM_PROPERTY(spline_steps,spline_steps,guint)
00185
00186
00187 GNOMEMM_PROPERTY(clip,clip,
bool)
00188 GNOMEMM_PROPERTY(clip_height,clip_height,
double)
00189 GNOMEMM_PROPERTY(clip_width,clip_width,
double)
00190 GNOMEMM_PROPERTY(justification,justification,Gtk::Justification)
00191 GNOMEMM_PROPERTY(direction,direction,Gtk::DirectionType)
00192 GNOMEMM_PROPERTY(wrap_mode,wrap_mode,Gtk::WrapMode)
00193 GNOMEMM_PROPERTY(text_height,text_height,
double)
00194 GNOMEMM_PROPERTY(text_width,text_width,
double)
00195 GNOMEMM_PROPERTY(x_offset,x_offset,
double)
00196 GNOMEMM_PROPERTY(y_offset,y_offset,
double)
00197 GNOMEMM_PROPERTY(text,text,Glib::ustring)
00198 GNOMEMM_PROPERTY(markup,markup,Glib::ustring)
00199 GNOMEMM_PROPERTY(editable,editable,
bool)
00200 GNOMEMM_PROPERTY(visible,visible,
bool)
00201 GNOMEMM_PROPERTY(cursor_visible,cursor_visible,
bool)
00202 GNOMEMM_PROPERTY(cursor_blink,cursor_blink,
bool)
00203 GNOMEMM_PROPERTY(grow_height,grow_height,
bool)
00204 GNOMEMM_PROPERTY(pixels_above_lines,pixels_above_lines,
int)
00205 GNOMEMM_PROPERTY(pixels_below_lines,pixels_below_lines,
int)
00206 GNOMEMM_PROPERTY(pixels_inside_wrap,pixels_inside_wrap,
int)
00207 GNOMEMM_PROPERTY(left_margin,left_margin,
int)
00208 GNOMEMM_PROPERTY(right_margin,right_margin,
int)
00209 GNOMEMM_PROPERTY(indent,indent,
int)
00210
00211
00212 GNOMEMM_PROPERTY(size_pixels,size_pixels,
bool)
00213
00214
00215 GNOMEMM_PROPERTY(height,height,
double)
00216 GNOMEMM_PROPERTY(width,width,
double)
00217
00218
00219 GNOMEMM_PROPERTY(x1,x1,
double)
00220 GNOMEMM_PROPERTY(x2,x2,
double)
00221 GNOMEMM_PROPERTY(y1,y1,
double)
00222 GNOMEMM_PROPERTY(y2,y2,
double)
00223
00224
00225 GNOMEMM_PROPERTY(anchor,anchor,Gtk::AnchorType)
00226
00227
00228 GNOMEMM_PROPERTY(outline_stipple,outline_stipple,Glib::RefPtr<Gdk::Bitmap>)
00229 GNOMEMM_PROPERTY(wind,wind,guint)
00230 GNOMEMM_PROPERTY(miterlimit,miterlimit,
double)
00231
00232
00233 GNOMEMM_PROPERTY(width_pixels,width_pixels,guint)
00234 GNOMEMM_PROPERTY(width_units,width_units,
double)
00235
00236
00237 GNOMEMM_PROPERTY(x,x,
double)
00238 GNOMEMM_PROPERTY(y,y,
double)
00239
00240
00241 GNOMEMM_PROPERTY(fill_stipple,fill_stipple,Glib::RefPtr<Gdk::Bitmap>)
00242
00243 }
00244 }
00245 }
00246
00247 #endif
00248