// -*- c++ -*-
/*  Generated by gensig from ctree.gen_h. DO NOT MODIFY!!! */
#ifndef GTKMM_CTREE_HEADER
#define GTKMM_CTREE_HEADER

/* $Id: ctree.gen_h,v 1.42.2.10 1999/09/22 02:44:39 tdukes Exp $ */

/* ctree.h
 * 
 * Copyright (C) 1998-1999 
 *
 * 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--/clist.h>
#include <gtk/gtkctree.h>

class Gtk_CTree;

class Gtk_CTreeNode
{
  friend class Gtk_CTree;
  
public:
  Gtk_CTreeNode(GtkCTreeNode *node=0);

  /*
    Gtk_CTreeNode ( GList * glist )

    this is kindof ugly, but without it you have do a lot
    of casting in user code. The gtkctree internal structure
    doesn't wrap real well. Maybe someone can make this look better.
  */
  explicit Gtk_CTreeNode( GList * glist );

  typedef G_List_Iterator < GtkCTreeRow >      iterator;
  typedef G_List_ConstIterator < GtkCTreeRow > const_iterator;

  const GtkCTreeNode*  gtkobj() const { return node_; }
  GtkCTreeNode*        gtkobj() { return node_; }

  /*
    There are const and non-const versions of this function since
    a Gtk_CTreeNode is really a pointer to internal data. For non-
    const objects we shouldn't return a non-const pointer to internal
    data.
  */
  iterator             children_begin ();
  const_iterator       children_begin () const;
  iterator             children_end ();
  const_iterator       children_end () const;
  bool                 expanded () const;
  Gtk_CTreeNode        get_parent ();
  const Gtk_CTreeNode  get_parent () const;
  bool                 is_leaf () const;
  const Gtk_CTreeNode  node_nth_child ( guint row ) const ;
  Gtk_CTreeNode        node_nth_child ( guint row );
protected:
  GtkCTreeNode *node_;

private:
  Gtk_CTreeNode node_nth_child_real ( guint row ) const;

};

// For now, stick with a minimal wrapper for this structure. It's used
// by only one call. Add features when needed.
class Gtk_CTreeRow 
{
  friend class Gtk_CTree;
  
public:
  Gtk_CTreeRow(GtkCTreeRow *castitem=0);
  
  const GtkCTreeRow* gtkobj() const { return row_; }
  GtkCTreeRow* gtkobj() { return row_; }

protected:
  GtkCTreeRow *row_;
};


class Gtk_CTree_Class;
#line 91 "ctree.gen_h"


class Gtk_CTree : public Gtk_CList
{
public:
protected:
  typedef Gtk_CTree_Class    CppClassType;
  typedef GtkCTree           BaseObjectType;
  typedef GtkCTreeClass      BaseClassType;

  virtual void *get_parent_class();

private:
  friend CppClassType;
  static CppClassType ctree_class; 
  GtkType get_type(); 

public:

  //  typedef G_List_Cpp_Iterator<GtkCTreeNode,Gtk_CTreeNode> seliterator;
  typedef G_List_Iterator<GtkCTreeNode> seliterator;
  Gtk_CTree(gint columns, gint tree_column, gchar *titles[]);
  typedef G_List_Iterator<GtkCTreeNode>                   iterator;
#line 102 "ctree.gen_h"
  Gtk_CTree ( gint tree_column, const vector < string > &titles );
#line 104 "ctree.gen_h"
  Gtk_CTree(GtkCTree *castitem);

  Signal_proxy2<BaseObjectType,GtkCTreeNode*, gint> tree_select_row;
  Signal_proxy2<BaseObjectType,GtkCTreeNode*, gint> tree_unselect_row;
  Signal_proxy1<BaseObjectType,GtkCTreeNode*> tree_expand;
  Signal_proxy1<BaseObjectType,GtkCTreeNode*> tree_collapse;
  Signal_proxy3<BaseObjectType,GtkCTreeNode*, GtkCTreeNode*, GtkCTreeNode*> tree_move;
  Signal_proxy1<BaseObjectType,GtkCTreeExpansionType> change_focus_row_expansion;



  Gtk_CTreeNode insert_node(const Gtk_CTreeNode &parent, 
			    const Gtk_CTreeNode &sibling, 
			    gchar *text[],
			    guint8 spacing,
			    const Gdk_Pixmap &pixmap_closed, 
                            const Gdk_Bitmap &mask_closed,
			    const Gdk_Pixmap &pixmap_opened, 
                            const Gdk_Bitmap &mask_opened,
			    bool is_leaf, bool expanded);

  Gtk_CTreeNode insert_node(const Gtk_CTreeNode &parent, 
			    const Gtk_CTreeNode &sibling, 
			    const vector<string> &text,
			    guint8 spacing,
			    const Gdk_Pixmap &pixmap_closed, 
                            const Gdk_Bitmap &mask_closed,
			    const Gdk_Pixmap &pixmap_opened, 
                            const Gdk_Bitmap &mask_opened,
			    bool is_leaf, bool expanded);

  void remove_node(const Gtk_CTreeNode &node);

  // beginning of selection (STL style iterators)
  seliterator selbegin() const;
  // end of selection (STL style iterators)
  seliterator selend() const;
private:
  virtual bool check_seliterator_type() const;
public:

  iterator begin ();
  iterator end ();

  //: Is actually insert_gnode
  Gtk_CTreeNode insert_node(const Gtk_CTreeNode      &parent,
			    const Gtk_CTreeNode      &sibling,
			    GNode                    *gnode,
			    GtkCTreeGNodeFunc         func,
			    gpointer                  data);

  GNode* export_to_gnode   (GNode             *parent,
			    GNode             *sibling,
			    const Gtk_CTreeNode &node,
			    GtkCTreeGNodeFunc  func,
			    gpointer           data);

/***********************************************************
 *  Generic recursive functions, querying / finding tree   *
 *  information                                            *
 ***********************************************************/

  void post_recursive               (const Gtk_CTreeNode &node,
				     GtkCTreeFunc  func,
				     gpointer      data);
  void post_recursive_to_depth      (const Gtk_CTreeNode &node,
				     gint          depth,
				     GtkCTreeFunc  func,
				     gpointer      data);
  void pre_recursive                (const Gtk_CTreeNode &node,
				     GtkCTreeFunc  func,
				     gpointer      data);
  void pre_recursive_to_depth       (const Gtk_CTreeNode &node,
				     gint          depth,
				     GtkCTreeFunc  func,
				     gpointer      data);

  bool is_viewable              (const Gtk_CTreeNode &node) const;

  bool is_hot_spot              (gint          x,
				 gint          y) const;

  bool is_ancestor              (const Gtk_CTreeNode &node,
				 const Gtk_CTreeNode &child) const;

  Gtk_CTreeNode last            (const Gtk_CTreeNode &node) const;

  Gtk_CTreeNode find_node_ptr   (const Gtk_CTreeRow  &ctree_row) const;

  Gtk_CTreeNode node_nth        (guint row) const;
  
  bool find                     (const Gtk_CTreeNode &node,
				 const Gtk_CTreeNode &child) const;

  Gtk_CTreeNode find_by_row_data(const Gtk_CTreeNode &node,
				 gpointer data) const;

  // returns a GList of all GtkCTreeNodes with row->data == data.
  Gtk_ObjectHandle< G_List<GtkCTreeNode> > find_all_by_row_data(const Gtk_CTreeNode &node,
					     gpointer data) const;

  Gtk_CTreeNode find_by_row_data_custom(const Gtk_CTreeNode &node,
					gpointer      data,
					GCompareFunc  func) const;

  // returns a GList of all GtkCTreeNodes with row->data == data. 
  Gtk_ObjectHandle< G_List<GtkCTreeNode> > find_all_by_row_data_custom(const Gtk_CTreeNode &node,
						    gpointer      data,
						    GCompareFunc  func) const;

/***********************************************************
 *   Tree signals : move, expand, collapse, (un)select     *
 ***********************************************************/

  // These should be SIGNAL_VFUNC
//   void move                         (const Gtk_CTreeNode &node,
// 				     const Gtk_CTreeNode &new_parent, 
// 				     const Gtk_CTreeNode &new_sibling);
//   void expand                       (const Gtk_CTreeNode &node);
//   void expand_to_depth              (const Gtk_CTreeNode &node,
// 				     gint  depth);
//   void collapse                     (const Gtk_CTreeNode &node);
//   void collapse_to_depth            (const Gtk_CTreeNode &node,
// 				     gint  depth);
//   void toggle_expansion             (const Gtk_CTreeNode &node);
//   void toggle_expansion_recursive   (const Gtk_CTreeNode &node);
//   void select                       (const Gtk_CTreeNode &node);
//   void select_recursive             (const Gtk_CTreeNode &node);
//   void unselect                     (const Gtk_CTreeNode &node);
//   void unselect_recursive           (const Gtk_CTreeNode &node);

  void collapse_recursive           ( Gtk_CTreeNode &node ) 
    {
      gtk_ctree_collapse_recursive ( gtkobj (), // the tree
				     node . gtkobj () ); // the node to collapse 
    }
  void expand_recursive             ( Gtk_CTreeNode &node )
    {
      gtk_ctree_expand_recursive ( gtkobj (), // the tree
				   node . gtkobj () ); // the node to expand
    } 

/***********************************************************
 *           Analogons of GtkCList functions               *
 ***********************************************************/

  void node_set_pixmap              (const Gtk_CTreeNode &node,
				     gint          column,
				     const Gdk_Pixmap &pixmap,
				     const Gdk_Bitmap &mask);

  void node_set_pixtext             (const Gtk_CTreeNode &node,
				     gint          column,
				     const string  &text,
				     guint8        spacing,
				     const Gdk_Pixmap &pixmap,
				     const Gdk_Bitmap &mask);

  void set_node_info                (const Gtk_CTreeNode &node,
				     const string  &text,
				     guint8        spacing,
				     const Gdk_Pixmap &pixmap_closed,
				     const Gdk_Bitmap &mask_closed,
				     const Gdk_Pixmap &pixmap_opened,
				     const Gdk_Bitmap &mask_opened,
				     bool      is_leaf,
				     bool      expanded);

  void node_set_shift               (const Gtk_CTreeNode &node,
				     gint          column,
				     gint          vertical,
				     gint          horizontal);

  void node_set_selectable          (const Gtk_CTreeNode &node,
				     bool      selectable);

  bool node_get_selectable          (const Gtk_CTreeNode &node) const;

  GtkCellType node_get_cell_type    (const Gtk_CTreeNode &node,
				     gint          column) const;

  bool node_get_text                (const Gtk_CTreeNode &node,
				     gint          column,
				     _gtk_string   *text) const;

  gint node_get_pixmap              (const Gtk_CTreeNode &node,
				     gint          column,
				     Gdk_Pixmap   &pixmap,
				     Gdk_Bitmap   &mask) const;

  gint node_get_pixtext             (const Gtk_CTreeNode &node,
				     gint          column,
				     _gtk_string  *text,
				     guint8       *spacing,
				     Gdk_Pixmap   &pixmap,
				     Gdk_Bitmap   &mask) const;

  gint get_node_info                (const Gtk_CTreeNode &node,
				     _gtk_string  *text,
				     guint8       *spacing,
				     Gdk_Pixmap   &pixmap_closed,
				     Gdk_Bitmap   &mask_closed,
				     Gdk_Pixmap   &pixmap_opened,
				     Gdk_Bitmap   &mask_opened,
				     bool     *is_leaf,
				     bool     *expanded) const;

  void node_set_row_style           (const Gtk_CTreeNode &node,
				     const Gtk_Style &style);

  Gtk_ObjectHandle<Gtk_Style> node_get_row_style (const Gtk_CTreeNode &node) const;

  void node_set_cell_style          (const Gtk_CTreeNode &node,
				     gint          column,
				     const Gtk_Style &style);

  Gtk_ObjectHandle<Gtk_Style> node_get_cell_style (const Gtk_CTreeNode &node,
						   gint                column) const;

  void node_set_foreground          (const Gtk_CTreeNode &node,
				     const Gdk_Color     &color);

  void node_moveto                  (const Gtk_CTreeNode &node,
				     gint          column,
				     gfloat        row_align,
				     gfloat        col_align);

  GtkVisibility node_is_visible     (const Gtk_CTreeNode &node);


  Gtk_CTreeNode get_node     (gint row) const;

  void node_set_text         (const Gtk_CTreeNode &node,
			      gint column,
			      const string &text);

  void node_set_background   (const Gtk_CTreeNode &node,
			      const Gdk_Color &color);

  void node_set_row_data     (const Gtk_CTreeNode &node,
			      gpointer data);

  gpointer node_get_row_data (const Gtk_CTreeNode &node) const;

  void node_set_row_data_full     (const Gtk_CTreeNode &node,
				   gpointer data, 
				   GtkDestroyNotify destroy);

  /***********************************************************
   *             GtkCTree specific functions                 *
   ***********************************************************/

  void set_indent            (gint indent);
  void set_spacing           (gint spacing);
  void set_show_stub         (bool show_stub);
  void set_line_style        (GtkCTreeLineStyle line_style);
  void set_expander_style    (GtkCTreeExpanderStyle expander_style);
  void set_drag_compare_func (GtkCTreeCompareDragFunc  cmp_func);

  /***********************************************************
   *             Tree sorting functions                      *
   ***********************************************************/

  void sort_node                     (const Gtk_CTreeNode &node);
  void sort_recursive                (const Gtk_CTreeNode &node);
  GtkCList * pre_build_clist ( gint tree_column_in, vector < string > titles_in );
protected:
  /* impl functions */
  virtual void tree_select_row_impl(GtkCTreeNode* p1, gint p2);
  virtual void tree_unselect_row_impl(GtkCTreeNode* p1, gint p2);
  virtual void tree_expand_impl(GtkCTreeNode* p1);
  virtual void tree_collapse_impl(GtkCTreeNode* p1);
  virtual void tree_move_impl(GtkCTreeNode* p1, GtkCTreeNode* p2, GtkCTreeNode* p3);
  virtual void change_focus_row_expansion_impl(GtkCTreeExpansionType p1);
public:
  GtkCTree* gtkobj() { return GTK_CTREE(gtkobject); }
  const GtkCTree* gtkobj() const { return GTK_CTREE(gtkobject); }
  static bool isGtkCTree(Gtk_Object *checkcast);
#line 370 "ctree.gen_h"


};


#endif
