// -*- c++ -*-
//  Generated by gtkmmproc from ./../text.gen_h -- DO NOT MODIFY!
#include <gtk--/text.h>
#include <gtk--/private/text_p.h>
namespace Gtk
{

Text::Text()
  :     Editable((GtkEditable*)(gtk_object_new(get_type(),0)))
{
  initialize_class();
  gtk_text_set_adjustments (gtkobj(), 0, 0);
}

Text::Text( Adjustment &hadj,
		    Adjustment &vadj)
  :     Editable((GtkEditable*)(gtk_object_new(get_type(),0)))
{
  initialize_class();
  set_adjustments(hadj, vadj);
}

void Text::insert(const Context& gc, const string& text)
{
  gtk_text_insert(gtkobj(), gc.gtkfont(), gc.gtkfore(), gc.gtkback(), text.c_str(), text.length());
}

void Text::insert(const string& text)
{
  gtk_text_insert(gtkobj(), gc_.gtkfont(), gc_.gtkfore(), gc_.gtkback(), text.c_str(), text.length());
}

void Text::set_context()
{
  gc_=Context();
}

void Text::set_context(const Context& gc)
{
  gc_=gc;
}

Text::Context Text::get_context() const
{
  return gc_;
}

}

namespace Gtk {
Gtk::Text *wrap (GtkText *o)
  {
    return static_cast<Gtk::Text *> (Gtk::wrap_auto ((GtkObject *) (o)));
  }
}

namespace Gtk {
Text_Class Text::text_class = {0};

Object* Text_Class::wrap_new(GtkObject* o)
  {
    Object* cpp=manage(new Text((GtkText*)(o)));
    return cpp;
  }

bool Text::isA( Object *checkcast)
  {
    return GTK_IS_TEXT(checkcast->gtkobj());
  }

GtkType Text::get_type()
  {
    return text_class.get_type();
  }

GtkType Text_Class::get_type()
  {
    if (!type)
      {
        CppClassParent::CppObjectType::get_type();
        GtkTypeInfo info =
          {
            "Gtk__Text",
            sizeof(BaseObjectType),
            sizeof(BaseClassType),
            (GtkClassInitFunc) class_init_function,
            (GtkObjectInitFunc) object_init_function,
            /* reserved_1 */ NULL,
            /* reserved_2 */ NULL,
            /*base_class_init_func */ (GtkClassInitFunc) NULL
          };
        type=gtk_type_unique(gtk_text_get_type(), &info);
      }
    return type;
  }

const char* const Text::signal_names[]={
   "set_scroll_adjustments",
   0};

void Text::initialize_class()
  {

     text_self=this;

  }

void Text_Class::class_init_function(GtkTextClass *klass)
  {
    CppClassParent::class_init_function((BaseClassParent*)klass);
    klass->set_scroll_adjustments=set_scroll_adjustments_callback;
  }

void Text_Class::object_init_function(GtkText *)
  {}

}

Gtk::Text::Text(GtkText *castitem)
  :     Gtk::Editable((GtkEditable*)(castitem))
  {
    initialize_class();
  }

Gtk::Text::~Text() { destroy_(); }

void gtk_text_set_scroll_adjustments(GtkText* text,GtkAdjustment* p1,GtkAdjustment* p2)
  {
    static guint signum=gtk_signal_lookup("set_scroll_adjustments",gtk_text_get_type());
    g_return_if_fail (text != NULL);
    g_return_if_fail (GTK_TEXT (text));

    gtk_signal_emit(GTK_OBJECT(text),signum,p1,p2);
  }

void Gtk::Text::set_word_wrap(bool word_wrap)
  {
    gtk_text_set_word_wrap(gtkobj(),(gint)word_wrap);
  }

void Gtk::Text::set_line_wrap(bool line_wrap)
  {
    gtk_text_set_line_wrap(gtkobj(),(gint)line_wrap);
  }

void Gtk::Text::set_adjustments(Gtk::Adjustment* hadj,Gtk::Adjustment* vadj)
  {
    gtk_text_set_adjustments(gtkobj(),(GtkAdjustment*)Gtk::unwrap(hadj),(GtkAdjustment*)Gtk::unwrap(vadj));
  }

void Gtk::Text::set_adjustments(Gtk::Adjustment& hadj,Gtk::Adjustment& vadj)
  {
    gtk_text_set_adjustments(gtkobj(),hadj.gtkobj(),vadj.gtkobj());
  }

void Gtk::Text::set_point(guint index)
  {
    gtk_text_set_point(gtkobj(),index);
  }

guint Gtk::Text::get_point() const
  {
    return gtk_text_get_point(const_cast<GtkText*>(gtkobj()));
  }

guint Gtk::Text::get_length() const
  {
    return gtk_text_get_length(const_cast<GtkText*>(gtkobj()));
  }

void Gtk::Text::freeze()
  {
    gtk_text_freeze(gtkobj());
  }

void Gtk::Text::thaw()
  {
    gtk_text_thaw(gtkobj());
  }

void Gtk::Text::insert(const Gdk_Font& font,const Gdk_Color& fore,const Gdk_Color& back,const nstring& chars,gint length)
  {
    gtk_text_insert(gtkobj(),const_cast<GdkFont*>(font.gdkobj()),const_cast<GdkColor*>(fore.gdkobj()),const_cast<GdkColor*>(back.gdkobj()),chars.gc_str(),length);
  }

gint Gtk::Text::backward_delete(guint nchars)
  {
    return gtk_text_backward_delete(gtkobj(),nchars);
  }

gint Gtk::Text::forward_delete(guint nchars)
  {
    return gtk_text_forward_delete(gtkobj(),nchars);
  }

void Gtk::Text_Class::set_scroll_adjustments_callback(GtkText* p0,GtkAdjustment* p1,GtkAdjustment* p2)
  {
    CppObjectType *obj=
      static_cast<CppObjectType *>(static_cast<Gtk::Object *>(
        gtk_object_get_data_by_id((GtkObject*)p0,Gtk::quark_)));

    if (obj)
      obj->set_scroll_adjustments_impl(Gtk::wrap(p1),Gtk::wrap(p2));
    else
      {
        BaseClassType* base=
          static_cast<BaseClassType*>(
            gtk_type_parent_class(((GtkObject*)p0)->klass->type));
        if (base->set_scroll_adjustments)
          (base->set_scroll_adjustments)(p0,p1,p2);
      }

  }

void Gtk::Text::set_scroll_adjustments_impl(Gtk::Adjustment* p0,Gtk::Adjustment* p1)
  {
    BaseClassType* base=
      static_cast<BaseClassType*>(
        gtk_type_parent_class(gtkobject->klass->type));
    if (base->set_scroll_adjustments)
      (base->set_scroll_adjustments)(gtkobj(),(GtkAdjustment*)Gtk::unwrap(p0),(GtkAdjustment*)Gtk::unwrap(p1));

  }

namespace {
static void set_scroll_adjustments_convert_func(SigC::Callback2<void,Gtk::Adjustment*,Gtk::Adjustment*> *s,GtkAdjustment* p1,GtkAdjustment* p2)
  {
     s->call(Gtk::wrap(p1),Gtk::wrap(p2));
  }

}

SigC::Connection
Gtk::Text::Proxy_set_scroll_adjustments::connect(const SigC::Slot2<void,Gtk::Adjustment*,Gtk::Adjustment*> &s)
   {
    return BaseType::connect(SigC::convert(s,&set_scroll_adjustments_convert_func));
   }

void Gtk::Text::Proxy_set_scroll_adjustments::operator()(Gtk::Adjustment* p0,Gtk::Adjustment* p1)
  {
     BaseType::emit((GtkAdjustment*)Gtk::unwrap(p0),(GtkAdjustment*)Gtk::unwrap(p1));
  }

void Gtk::Text::Proxy_set_scroll_adjustments::emit(Gtk::Adjustment* p0,Gtk::Adjustment* p1)
  {
     BaseType::emit((GtkAdjustment*)Gtk::unwrap(p0),(GtkAdjustment*)Gtk::unwrap(p1));
  }

Gtk::Adjustment* Gtk::Text::get_hadjustment() const
  { return Gtk::wrap(gtkobj()->hadj); }

Gtk::Adjustment* Gtk::Text::get_vadjustment() const
  { return Gtk::wrap(gtkobj()->vadj); }
