
/* Copyright (C) 1998-2006 The gtkmm Development Team
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2.1 of the License, or (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library; if not, write to the Free
 * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
 */

#include <glibmm/object.h>
#include <cairomm/context.h>
#include <cairomm/refptr.h>

#include <goocanvasstyle.h>

_DEFS(goocanvasmm,libgoocanvas)
_PINCLUDE(glibmm/private/object_p.h)

namespace Goocanvas
{

class Style : public Glib::Object
{
  _CLASS_GOBJECT(Style, GooCanvasStyle, GOO_CANVAS_STYLE, Glib::Object, GObject)
protected:
  _CTOR_DEFAULT();

public:
  _WRAP_CREATE()
  _IGNORE(goo_canvas_style_new)

  template<typename PropertyType>
  void get_property(GQuark property_id, PropertyType& value) const;
  _IGNORE(goo_canvas_style_get_property)

  template<typename PropertyType>
  void set_property(GQuark property_id, const PropertyType& value);
  _IGNORE(goo_canvas_style_set_property)

  _WRAP_METHOD(Glib::RefPtr<Style> copy() const, goo_canvas_style_copy)
  _WRAP_METHOD(Glib::RefPtr<Style> get_parent() const, goo_canvas_style_get_parent, refreturn)
  _WRAP_METHOD(void set_parent(const Glib::RefPtr<Style>& style), goo_canvas_style_set_parent)
  _WRAP_METHOD(bool set_stroke_options(const Cairo::RefPtr<Cairo::Context>& context), goo_canvas_style_set_stroke_options)
  _WRAP_METHOD(bool set_fill_options(const Cairo::RefPtr<Cairo::Context>& context), goo_canvas_style_set_fill_options)
};

template<typename PropertyType> inline
void Style::get_property(GQuark property_id, PropertyType& value) const
{
  Glib::Value<PropertyType> property_value(goo_canvas_style_get_property(const_cast<GooCanvasStyle*>(gobj()), property_id));
  value = property_value.get();
}

template<typename PropertyType> inline
void Style::set_property(GQuark property_id, const PropertyType& value)
{
  Glib::Value<PropertyType> property_value;
  property_value.init(Glib::Value<PropertyType>::value_type());
  property_value.set(value);
  goo_canvas_style_set_property(gobj(), property_id, property_value.gobj());
}

}

