/* $Id: style.hg,v 1.7 2004/10/09 19:56:42 murrayc Exp $ */

/* Copyright (C) 1998-2002 The gtkmm Development Team
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Library General Public
 * License as published by the Free Software Foundation; either
 * version 2 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
 * Library General Public License for more details.
 *
 * You should have received a copy of the GNU Library General Public
 * License along with this library; if not, write to the Free
 * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
 */

_DEFS(gtkmm,gtk)
_PINCLUDE(glibmm/private/object_p.h)
_PINCLUDE(gtk/gtkrc.h)
#m4begin

m4_define(`_STYLE_MEMBER_COLOR',`dnl
void set_$1(Gtk::StateType state, const Gdk::Color& color);
  Gdk::Color get_$1(Gtk::StateType state) const;
_PUSH(SECTION_CC)
void Style::set_$1(StateType state, const Gdk::Color& color)
{
  gobj()->$1[state] = *color.gobj();
}

Gdk::Color Style::get_$1(StateType state) const
{
  return Gdk::Color(const_cast<GdkColor*>(&gobj()->$1[state]), true);
}

_POP()
')dnl

#m4end

#include <pangomm/fontdescription.h>
#include <pangomm/layout.h>

#include <gdkmm/gc.h>
#include <gdkmm/pixmap.h>
#include <gdkmm/types.h>
#include <gdkmm/window.h>

#include <gtkmm/object.h>
#include <gtkmm/enums.h>
#include <gtkmm/iconsource.h>
#include <gtkmm/iconset.h>
#include <gtkmmconfig.h>


namespace Gtk
{

class Widget;
class RcStyle;


class Style : public Glib::Object
{
  _CLASS_GOBJECT(Style, GtkStyle, GTK_STYLE, Glib::Object, GObject)
  _IGNORE(gtk_style_ref, gtk_style_unref, gtk_style_get_font, gtk_style_set_font)
 
protected:
  _CTOR_DEFAULT()

public:
  _WRAP_CREATE()
  _IGNORE(gtk_style_new)

  _STYLE_MEMBER_COLOR(fg)
  _STYLE_MEMBER_COLOR(bg)
  _STYLE_MEMBER_COLOR(light)
  _STYLE_MEMBER_COLOR(dark)
  _STYLE_MEMBER_COLOR(mid)
  _STYLE_MEMBER_COLOR(text)
  _STYLE_MEMBER_COLOR(base)
  _STYLE_MEMBER_COLOR(text_aa)

  _MEMBER_SET(black, black, Gdk::Color, GdkColor)
  _MEMBER_GET(black, black, Gdk::Color, GdkColor)
  _MEMBER_SET(white, white, Gdk::Color, GdkColor)
  _MEMBER_GET(white, white, Gdk::Color, GdkColor)

  void set_font(const Pango::FontDescription& font_desc);

  // These are only available after being attached to a window.
  Pango::FontDescription get_font() const;

  void set_xthickness(int xthickness);
  _MEMBER_GET(xthickness, xthickness, int, gint)

  void set_ythickness(int ythickness);
  _MEMBER_GET(ythickness, ythickness, int, gint)

  Glib::RefPtr<Gdk::GC> get_fg_gc(Gtk::StateType state_type);
  Glib::RefPtr<const Gdk::GC> get_fg_gc(Gtk::StateType state_type) const;

  Glib::RefPtr<Gdk::GC> get_bg_gc(Gtk::StateType state_type);
  Glib::RefPtr<const Gdk::GC> get_bg_gc(Gtk::StateType state_type) const;

  Glib::RefPtr<Gdk::GC> get_light_gc(Gtk::StateType state_type);
  Glib::RefPtr<const Gdk::GC> get_light_gc(Gtk::StateType state_type) const;

  Glib::RefPtr<Gdk::GC> get_dark_gc(Gtk::StateType state_type);
  Glib::RefPtr<const Gdk::GC> get_dark_gc(Gtk::StateType state_type) const;

  Glib::RefPtr<Gdk::GC> get_mid_gc ( Gtk::StateType state_type);
  Glib::RefPtr<const Gdk::GC> get_mid_gc ( Gtk::StateType state_type) const;

  Glib::RefPtr<Gdk::GC> get_text_gc(Gtk::StateType state_type);
  Glib::RefPtr<const Gdk::GC> get_text_gc(Gtk::StateType state_type) const;

  Glib::RefPtr<Gdk::GC> get_base_gc(Gtk::StateType state_type);
  Glib::RefPtr<const Gdk::GC> get_base_gc(Gtk::StateType state_type) const;

  _MEMBER_GET_GOBJECT(black_gc, black_gc, Gdk::GC, GdkGC*)
  _MEMBER_GET_GOBJECT(white_gc, white_gc, Gdk::GC, GdkGC*)

  /* Deprecated in gtkmm 2.2 -- use get_bg() instead.
   * Honestly, I have absolutely no idea why this method was added
   * in the first place.  It's basically just confusing since it's
   * absolutely unrelated to set_background().  Sigh.
   */
  Gdk::Color get_background(Gtk::StateType state_type) const;

  /* Deprecated in gtkmm 2.2 -- use get_bg_pixmap() instead.
   */
  Glib::RefPtr<Gdk::Pixmap> get_background_pixmap(Gtk::StateType state_type);

  void set_bg_pixmap(Gtk::StateType state_type, const Glib::RefPtr<Gdk::Pixmap>& pixmap);
  Glib::RefPtr<Gdk::Pixmap>       get_bg_pixmap(Gtk::StateType state_type);
  Glib::RefPtr<const Gdk::Pixmap> get_bg_pixmap(Gtk::StateType state_type) const;

  _WRAP_METHOD(void paint_arrow(
                  const Glib::RefPtr<Gdk::Window>&  window,
                  Gtk::StateType                    state_type,
                  ShadowType                        shadow_type,
                  const Gdk::Rectangle&             area,
                  Widget&                           widget,
                  const Glib::ustring&              detail,
                  ArrowType                         arrow_type,
                  bool                              fill,
                  int                               x,
                  int                               y,
                  int                               width,
                  int                               height) const, gtk_paint_arrow)

  _WRAP_METHOD(void paint_box(
                  const Glib::RefPtr<Gdk::Window>&  window,
                  Gtk::StateType                    state_type,
                  ShadowType                        shadow_type,
                  const Gdk::Rectangle&             area,
                  Widget&                           widget,
                  const Glib::ustring&              detail,
                  int                               x,
                  int                               y,
                  int                               width,
                  int                               height) const, gtk_paint_box)

  _WRAP_METHOD(void paint_box_gap(
                  const Glib::RefPtr<Gdk::Window>&  window,
                  Gtk::StateType                    state_type,
                  ShadowType                        shadow_type,
                  const Gdk::Rectangle&             area,
                  Widget&                           widget,
                  const Glib::ustring&              detail,
                  int                               x,
                  int                               y,
                  int                               width,
                  int                               height,
                  PositionType                      gap_side,
                  int                               gap_x,
                  int                               gap_width) const, gtk_paint_box_gap)

  _WRAP_METHOD(void paint_check(
                  const Glib::RefPtr<Gdk::Window>&  window,
                  Gtk::StateType                    state_type,
                  ShadowType                        shadow_type,
                  const Gdk::Rectangle&             area,
                  Widget&                           widget,
                  const Glib::ustring&              detail,
                  int                               x,
                  int                               y,
                  int                               width,
                  int                               height) const, gtk_paint_check)

  _WRAP_METHOD(void paint_diamond(
                  const Glib::RefPtr<Gdk::Window>&  window,
                  Gtk::StateType                    state_type,
                  ShadowType                        shadow_type,
                  const Gdk::Rectangle&             area,
                  Widget&                           widget,
                  const Glib::ustring&              detail,
                  int                               x,
                  int                               y,
                  int                               width,
                  int                               height) const, gtk_paint_diamond)

  _WRAP_METHOD(void paint_extension(
                  const Glib::RefPtr<Gdk::Window>&  window,
                  Gtk::StateType                    state_type,
                  ShadowType                        shadow_type,
                  const Gdk::Rectangle&             area,
                  Widget&                           widget,
                  const Glib::ustring&              detail,
                  int                               x,
                  int                               y,
                  int                               width,
                  int                               height,
                  PositionType                      gap_side) const, gtk_paint_extension)

  _WRAP_METHOD(void paint_flat_box(
                  const Glib::RefPtr<Gdk::Window>&  window,
                  Gtk::StateType                    state_type,
                  ShadowType                        shadow_type,
                  const Gdk::Rectangle&             area,
                  Widget&                           widget,
                  const Glib::ustring&              detail,
                  int                               x,
                  int                               y,
                  int                               width,
                  int                               height) const, gtk_paint_flat_box)

  _WRAP_METHOD(void paint_focus(
                  const Glib::RefPtr<Gdk::Window>&  window,
                  Gtk::StateType                    state_type,
                  const Gdk::Rectangle&             area,
                  Widget&                           widget,
                  const Glib::ustring&              detail,
                  int                               x,
                  int                               y,
                  int                               width,
                  int                               height) const, gtk_paint_focus)

  _WRAP_METHOD(void paint_handle(
                  const Glib::RefPtr<Gdk::Window>&  window,
                  Gtk::StateType                    state_type,
                  ShadowType                        shadow_type,
                  const Gdk::Rectangle&             area,
                  Widget&                           widget,
                  const Glib::ustring&              detail,
                  int                               x,
                  int                               y,
                  int                               width,
                  int                               height,
                  Orientation                       orientation) const, gtk_paint_handle)

  _WRAP_METHOD(void paint_hline(
                  const Glib::RefPtr<Gdk::Window>&  window,
                  Gtk::StateType                    state_type,
                  const Gdk::Rectangle&             area,
                  Widget&                           widget,
                  const Glib::ustring&              detail,
                  int                               x1,
                  int                               x2,
                  int                               y) const, gtk_paint_hline)

  _WRAP_METHOD(void paint_option(
                  const Glib::RefPtr<Gdk::Window>&  window,
                  Gtk::StateType                    state_type,
                  ShadowType                        shadow_type,
                  const Gdk::Rectangle&             area,
                  Widget&                           widget,
                  const Glib::ustring&              detail,
                  int                               x,
                  int                               y,
                  int                               width,
                  int                               height) const, gtk_paint_option)

  void paint_polygon(
                  const Glib::RefPtr<Gdk::Window>&      window,
                  Gtk::StateType                        state_type,
                  ShadowType                            shadow_type,
                  const Gdk::Rectangle&                 area,
                  Widget&                               widget,
                  const Glib::ustring&                  detail,
                  const Glib::ArrayHandle<Gdk::Point>&  points,
                  bool                                  fill) const;

  _WRAP_METHOD(void paint_shadow(
                  const Glib::RefPtr<Gdk::Window>&  window,
                  Gtk::StateType                    state_type,
                  ShadowType                        shadow_type,
                  const Gdk::Rectangle&             area,
                  Widget&                           widget,
                  const Glib::ustring&              detail,
                  int                               x,
                  int                               y,
                  int                               width,
                  int                               height) const, gtk_paint_shadow)

  _WRAP_METHOD(void paint_shadow_gap(
                  const Glib::RefPtr<Gdk::Window>&  window,
                  Gtk::StateType                    state_type,
                  ShadowType                        shadow_type,
                  const Gdk::Rectangle&             area,
                  Widget&                           widget,
                  const Glib::ustring&              detail,
                  int                               x,
                  int                               y,
                  int                               width,
                  int                               height,
                  PositionType                      gap_side,
                  int                               gap_x,
                  int                               gap_width) const, gtk_paint_shadow_gap)

  _WRAP_METHOD(void paint_slider(
                  const Glib::RefPtr<Gdk::Window>&  window,
                  Gtk::StateType                    state_type,
                  ShadowType                        shadow_type,
                  const Gdk::Rectangle&             area,
                  Widget&                           widget,
                  const Glib::ustring&              detail,
                  int                               x,
                  int                               y,
                  int                               width,
                  int                               height,
                  Orientation                       orientation) const, gtk_paint_slider)

  _WRAP_METHOD(void paint_tab(
                  const Glib::RefPtr<Gdk::Window>&  window,
                  Gtk::StateType                    state_type,
                  ShadowType                        shadow_type,
                  const Gdk::Rectangle&             area,
                  Widget&                           widget,
                  const Glib::ustring&              detail,
                  int                               x,
                  int                               y,
                  int                               width,
                  int                               height) const, gtk_paint_tab)

                  
  _WRAP_METHOD(void paint_vline(
                  const Glib::RefPtr<Gdk::Window>&  window,
                  Gtk::StateType                    state_type,
                  const Gdk::Rectangle&             area,
                  Widget&                           widget,
                  const Glib::ustring&              detail,
                  int                               y1,
                  int                               y2,
                  int                               x) const, gtk_paint_vline)

  _WRAP_METHOD(void paint_expander(
                  const Glib::RefPtr<Gdk::Window>&  window,
                  Gtk::StateType                    state_type,
                  const Gdk::Rectangle&             area,
                  Widget&                           widget,
                  const Glib::ustring&              detail,
                  int                               x,
                  int                               y,
                  ExpanderStyle                     expander_style) const, gtk_paint_expander)

  _WRAP_METHOD(void paint_layout(
                  const Glib::RefPtr<Gdk::Window>&    window,
                  Gtk::StateType                      state_type,
                  bool                                use_text,
                  const Gdk::Rectangle&               area,
                  Widget&                             widget,
                  const Glib::ustring&                detail,
                  int                                 x,
                  int                                 y,
                  const Glib::RefPtr<Pango::Layout>&  layout) const, gtk_paint_layout)

  _WRAP_METHOD(void paint_resize_grip(
                  const Glib::RefPtr<Gdk::Window>&  window,
                  Gtk::StateType                    state_type,
                  const Gdk::Rectangle&             area,
                  Widget&                           widget,
                  const Glib::ustring&              detail,
                  Gdk::WindowEdge                   edge,
                  int                               x,
                  int                               y,
                  int                               width,
                  int                               height) const, gtk_paint_resize_grip)


  _WRAP_METHOD(Glib::RefPtr<Style> copy(), gtk_style_copy)

  // These are worthless to the users - they should use set_style instead.
  _IGNORE(gtk_style_attach, gtk_style_detach)
  //_WRAP_METHOD(Glib::RefPtr<Style> attach(const Glib::RefPtr<Gdk::Window>& window), gtk_style_attach)
  //_WRAP_METHOD(void detach(), gtk_style_detach)

  _WRAP_METHOD(void set_background(const Glib::RefPtr<Gdk::Window>& window, Gtk::StateType state_type), gtk_style_set_background)

  _WRAP_METHOD(void apply_default_background(const Glib::RefPtr<Gdk::Window>& window, bool set_bg,
	              Gtk::StateType state_type, const Gdk::Rectangle& area,
	              int x, int y, int width, int height), gtk_style_apply_default_background)

  _WRAP_METHOD(IconSet lookup_icon_set(const Gtk::StockID& stock_id), gtk_style_lookup_icon_set)

  _WRAP_METHOD(Glib::RefPtr<Gdk::Pixbuf> render_icon(const IconSource& source,
                                       Gtk::TextDirection direction, Gtk::StateType state, Gtk::IconSize size,
                                       Gtk::Widget& widget, const Glib::ustring& detail), gtk_style_render_icon)

protected:
  _WRAP_VFUNC(void realize(), realize)
  _WRAP_VFUNC(void unrealize(), unrealize)
  _WRAP_VFUNC(void copy(const Glib::RefPtr<Style>& src), copy)
  _WRAP_VFUNC(Glib::RefPtr<Style> clone(), clone)
  _WRAP_VFUNC(void init_from_rc(const Glib::RefPtr<RcStyle>& rc_style), init_from_rc)
  _WRAP_VFUNC(void set_background(const Glib::RefPtr<Gdk::Window>& window, Gtk::StateType state_type), set_background)

  _WRAP_VFUNC(Glib::RefPtr<Gdk::Pixbuf> render_icon(const IconSource& source,
                                 TextDirection direction,
                                 Gtk::StateType state,
                                 IconSize size,
                                 Widget* widget,
                                 const Glib::ustring& detail), render_icon)
  _WRAP_VFUNC(void draw_hline(const Glib::RefPtr<Gdk::Window>& window,
         Gtk::StateType state_type,
         const Gdk::Rectangle& area,
         Widget* widget,
         const Glib::ustring& detail,
         int x1, int x2, int y), draw_hline)
  _WRAP_VFUNC(void draw_vline(const Glib::RefPtr<Gdk::Window>& window,
         Gtk::StateType state_type,
         const Gdk::Rectangle& area,
         Widget* widget,
         const Glib::ustring& detail,
         int y1, int y2, int x), draw_vline)
  _WRAP_VFUNC(void draw_shadow(const Glib::RefPtr<Gdk::Window>& window,
         Gtk::StateType state_type,
         ShadowType shadow_type,
         const Gdk::Rectangle& area,
         Widget* widget,
         const Glib::ustring& detail,
         int x,  int y, int width, int height), draw_shadow)
  _WRAP_VFUNC(void draw_polygon(const Glib::RefPtr<Gdk::Window>& window,
         Gtk::StateType state_type,
         ShadowType shadow_type,
         const Gdk::Rectangle& area,
         Widget* widget,
         const Glib::ustring& detail,
         GdkPoint* point, int npoints, bool fill), draw_polygon)
  _WRAP_VFUNC(void draw_arrow(const Glib::RefPtr<Gdk::Window>& window,
         Gtk::StateType state_type,
         ShadowType shadow_type,
         const Gdk::Rectangle& area,
         Widget* widget,
         const Glib::ustring& detail,
         Gtk::ArrowType arrow_type, bool fill,
               int x,  int y, int width, int height), draw_arrow)
  _WRAP_VFUNC(void draw_diamond(const Glib::RefPtr<Gdk::Window>& window,
         Gtk::StateType state_type,
         ShadowType shadow_type,
         const Gdk::Rectangle& area,
         Widget* widget,
         const Glib::ustring& detail,
         int x, int y, int width, int height), draw_diamond)
  _WRAP_VFUNC(void draw_string(const Glib::RefPtr<Gdk::Window>& window,
         Gtk::StateType state_type,
         const Gdk::Rectangle& area,
         Widget* widget,
         const Glib::ustring& detail,
         int x, int y, const Glib::ustring& string), draw_string)
  _WRAP_VFUNC(void draw_box(const Glib::RefPtr<Gdk::Window>& window,
         Gtk::StateType state_type,
         ShadowType shadow_type,
         const Gdk::Rectangle& area,
         Widget* widget,
         const Glib::ustring& detail,
         int x, int y, int width, int height), draw_box)
  _WRAP_VFUNC(void draw_flat_box(const Glib::RefPtr<Gdk::Window>& window,
         Gtk::StateType state_type,
         ShadowType shadow_type,
         const Gdk::Rectangle& area,
         Widget* widget,
         const Glib::ustring& detail,
         int x, int y, int width,  int height), draw_flat_box)
  _WRAP_VFUNC(void draw_check(const Glib::RefPtr<Gdk::Window>& window,
         Gtk::StateType state_type,
         ShadowType shadow_type,
         const Gdk::Rectangle& area,
         Widget* widget,
         const Glib::ustring& detail,
         int x,  int y, int width, int height), draw_check)
  _WRAP_VFUNC(void draw_option(const Glib::RefPtr<Gdk::Window>& window,
         Gtk::StateType state_type,
         ShadowType shadow_type,
         const Gdk::Rectangle& area,
         Widget* widget,
         const Glib::ustring& detail,
         int x, int y,  int width, int height), draw_option)
  _WRAP_VFUNC(void draw_tab(const Glib::RefPtr<Gdk::Window>& window,
         Gtk::StateType state_type,
         ShadowType shadow_type,
         const Gdk::Rectangle& area,
         Widget* widget,
         const Glib::ustring& detail,
         int x, int y, int width,  int height), draw_tab)
  _WRAP_VFUNC(void draw_shadow_gap(const Glib::RefPtr<Gdk::Window>& window,
         Gtk::StateType state_type,
         ShadowType shadow_type,
         const Gdk::Rectangle& area,
         Widget* widget,
         const Glib::ustring& detail,
         int x, int y, int width, int height,
         Gtk::PositionType gap_side, int gap_x, int gap_width), draw_shadow_gap)
  _WRAP_VFUNC(void draw_box_gap(const Glib::RefPtr<Gdk::Window>& window,
         Gtk::StateType state_type,
         ShadowType shadow_type,
         const Gdk::Rectangle& area,
         Widget* widget,
         const Glib::ustring& detail,
         int x,  int y, int width, int height,
         Gtk::PositionType gap_side, int gap_x, int gap_width), draw_box_gap)
  _WRAP_VFUNC(void draw_extension(const Glib::RefPtr<Gdk::Window>& window,
         Gtk::StateType state_type,
         ShadowType shadow_type,
         const Gdk::Rectangle& area,
         Widget* widget,
         const Glib::ustring& detail,
         int x, int y, int width, int height,
         PositionType gap_side), draw_extension)
  _WRAP_VFUNC(void draw_focus(const Glib::RefPtr<Gdk::Window>& window,
         Gtk::StateType state_type,
         const Gdk::Rectangle& area,
         Widget* widget,
         const Glib::ustring& detail,
         int x, int y, int width, int height), draw_focus)
  _WRAP_VFUNC(void draw_slider(const Glib::RefPtr<Gdk::Window>& window,
         Gtk::StateType state_type,
         ShadowType shadow_type,
         const Gdk::Rectangle& area,
         Widget* widget,
         const Glib::ustring& detail,
         int x, int y, int width,  int height,
         Orientation orientation), draw_slider)
  _WRAP_VFUNC(void draw_handle(const Glib::RefPtr<Gdk::Window>& window,
         Gtk::StateType state_type,
         ShadowType shadow_type,
         const Gdk::Rectangle& area,
         Widget* widget,
         const Glib::ustring& detail,
         int x, int y, int width, int height,
         Orientation orientation), draw_handle)
  _WRAP_VFUNC(void draw_expander(const Glib::RefPtr<Gdk::Window>& window,
         Gtk::StateType state_type,
         const Gdk::Rectangle& area,
         Widget* widget,
         const Glib::ustring& detail,
         int x, int y, ExpanderStyle expander_style), draw_expander)
  _WRAP_VFUNC(void draw_layout(const Glib::RefPtr<Gdk::Window>& window,
         Gtk::StateType state_type,
         bool use_text,
         const Gdk::Rectangle& area,
         Widget* widget,
         const Glib::ustring& detail,
         int x, int y,
         const Glib::RefPtr<Pango::Layout>& layout), draw_layout)
  _WRAP_VFUNC(void draw_resize_grip(const Glib::RefPtr<Gdk::Window>& window,
         Gtk::StateType state_type,
         const Gdk::Rectangle& area,
         Widget* widget,
         const Glib::ustring& detail,
         Gdk::WindowEdge edge,
         int x, int y,  int width, int height), draw_resize_grip)

  _WRAP_SIGNAL(void realize(), realize)
  _WRAP_SIGNAL(void unrealize(), unrealize)
};

} // namespace Gtk

