// -*- c++ -*-
//  Generated by gtkmmproc from ./../curve.gen_h -- DO NOT MODIFY!
#ifndef _GTKMM_CURVE_H
#define _GTKMM_CURVE_H

/* $Id: curve.gen_h,v 1.38 2000/02/13 02:22:09 kenelson Exp $ */

/* curve.h
 *
 * Copyright (C) 1998-1999 The Gtk-- 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.
 */

#include <gtk--/box.h>
#include <gtk--/drawingarea.h>
#include <gtk/gtkcurve.h>
#include <gtk/gtkgamma.h>
#include <gtk/gtkdrawingarea.h>

namespace Gtk {
class Curve;
class Curve_Class;
}
namespace Gtk { Gtk::Curve *wrap (GtkCurve *o); }
namespace Gtk {
class GammaCurve;
class GammaCurve_Class;
}
namespace Gtk { Gtk::GammaCurve *wrap (GtkGammaCurve *o); }
namespace Gtk
{

// (internal) Input conversion class to allow for flexible use
struct CurveArray
{
  protected:
    bool owned_;
    int size_;
    gfloat* data_;

    void a_alloc(int size);

    template <class Iterator>
    void a_dup(Iterator b,Iterator e)
      {
        int i;
        Iterator iter;
        for (iter=b,i=0;iter!=e;++iter,++i);
        a_alloc(i);
        for (iter=b,i=0;iter!=e;++iter,++i)
          data_[i]=(*iter);
      }

  public:
    int size() const          {return size_;}
    operator float* () const  {return data_;}

    CurveArray(const CurveArray& c)
       : owned_(0),size_(c.size_),data_(c.data_)
      { }
    CurveArray(int size,gfloat data[])
       : owned_(0),size_(size),data_(data)
      { }

#ifndef GTKMM_CXX_AMBIGUOUS_TEMPLATES
    // copy a other containers
    template <class Container>
    CurveArray(const Container& c)
      { a_dup(c.begin(),c.end()); }
#else
    // compiler can't handle template cctor properly.
    CurveArray(const list<gfloat>& c)    { a_dup(c.begin(),c.end()); }
    CurveArray(const vector<gfloat>& c)  { a_dup(c.begin(),c.end()); }
#endif

    // copy a partial container
    template <class Iterator>
    CurveArray(Iterator b,Iterator e):owned_(0)
      { a_dup(b,e); }

    ~CurveArray();

};

class Curve : public DrawingArea {

public:
  typedef Curve          CppObjectType;
  typedef Curve_Class    CppClassType;
  typedef GtkCurve           BaseObjectType;
  typedef GtkCurveClass      BaseClassType;

private:
  friend class Curve_Class;
  static CppClassType curve_class;

  Curve(const Curve&);
  Curve& operator=(const Curve&); // not implemented

protected:
  void   initialize_class();
  explicit Curve(GtkCurve *castitem);

public:
  static GtkType get_type();
  GtkCurve* gtkobj()             { return (GtkCurve*)(gtkobject); }
  const GtkCurve* gtkobj() const { return (GtkCurve*)(gtkobject); }
  static bool isA(Object *checkcast);

  // Hook for proxies
  static const char* const signal_names[];

  virtual ~Curve();

private:

public:

  Curve();




  void reset();


  void set_gamma(gfloat gamma);



  void set_range(gfloat min_x,gfloat max_x,gfloat min_y,gfloat max_y);



  void get_vector(int num,gfloat* data);

  // For containers
  template <class Iterator>
  int get_vector(Iterator b,Iterator e) const
    {
      int i;
      Iterator iter;
      for (iter=b,i=0;iter!=e;++iter,i++);
      gfloat data[]=new gfloat[i];
      get_vector(n,data);
      for (iter=b,i=0;iter!=e;++iter,i++)
        (*iter)=data[i];
      delete [] data;
      return i;
    };

  //void gtk_curve_set_vector(GtkCurve*,int,gfloat[]);
  void set_vector(const CurveArray &vect);


  void set_curve_type(GtkCurveType type);

public:

  union
    {
      CppObjectType * curve_self;
      Gtk::ProxySignal0<void,CppObjectType,BaseObjectType,0> curve_type_changed;
    };

protected:
  // impl functions
    virtual void curve_type_changed_impl();

};

class GammaCurve : public VBox
{

public:
  typedef GammaCurve          CppObjectType;
  typedef GammaCurve_Class    CppClassType;
  typedef GtkGammaCurve           BaseObjectType;
  typedef GtkGammaCurveClass      BaseClassType;

private:
  friend class GammaCurve_Class;
  static CppClassType gamma_curve_class;

  GammaCurve(const GammaCurve&);
  GammaCurve& operator=(const GammaCurve&); // not implemented

protected:
  void   initialize_class();
  explicit GammaCurve(GtkGammaCurve *castitem);

public:
  static GtkType get_type();
  GtkGammaCurve* gtkobj()             { return (GtkGammaCurve*)(gtkobject); }
  const GtkGammaCurve* gtkobj() const { return (GtkGammaCurve*)(gtkobject); }
  static bool isA(Object *checkcast);

  // Hook for proxies
  static const char* const signal_names[];

  virtual ~GammaCurve();

private:

public:
  GammaCurve();

public:

protected:
  // impl functions

};

}


//+ PROPERTIES(Gtk_Curve)
//. name: cursor_type
//. type: gint
//. get:
//. set:
//. desc:

//. name: min_x
//. type: gfloat
//. get:
//. set:
//. desc:

//. name: max_x
//. type: gfloat
//. get:
//. set:
//. desc:

//. name: min_y
//. type: gfloat
//. get:
//. set:
//. desc:

//. name: max_y
//. type: gfloat
//. get:
//. set:
//. desc:

//. name: pixmap
//. type: GdkPixmap*
//. get:
//. set:
//. desc:

//. name: curve_type
//. type: GtkCurveType
//. get:
//. set:
//. desc:

//. name: height
//. type: gint
//. get:
//. set:
//. desc: (cached) graph height in pixels

//. name: grab_point
//. type: gint
//. get:
//. set:
//. desc: point currently grabbed

//. name: last
//. type: gint
//. get:
//. set:
//. desc:

//. name: num_points
//. type: gint
//. get:
//. set:
//. desc: (cached) curve points:

//. name: point
//. type: GdkPoint*
//. get:
//. set:
//. desc:

//. name: num_ctlpoints
//. type: gint
//. get:
//. set:
//. desc: number of control points

#endif
