// -*- c++ -*-
// Generated by gtkmmproc -- DO NOT MODIFY!
#ifndef _LIBGDAMM_QUERYFIELD_H
#define _LIBGDAMM_QUERYFIELD_H


#include <glibmm.h>

// -*- C++ -*- // this is for the .hg, I realize gensig puts one in

/* queryfield.h
 *
 * Copyright 2003 libgdamm 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 <glibmm/object.h>
#include <libgdamm/dict.h>
#include <libgdamm/datamodel.h>

#include <libgdamm/xmlstorage.h>
#include <libgdamm/queryobject.h>


#ifndef DOXYGEN_SHOULD_SKIP_THIS
typedef struct _GdaQueryField GdaQueryField;
typedef struct _GdaQueryFieldClass GdaQueryFieldClass;
#endif /* DOXYGEN_SHOULD_SKIP_THIS */


namespace Gnome
{

namespace Gda
{ class QueryField_Class; } // namespace Gda

} // namespace Gnome
namespace Gnome
{

namespace Gda
{

/** Parent class for any query's field.
 * @ingroup Queries
 */

class QueryField
 : public QueryObject
{
  
#ifndef DOXYGEN_SHOULD_SKIP_THIS

public:
  typedef QueryField CppObjectType;
  typedef QueryField_Class CppClassType;
  typedef GdaQueryField BaseObjectType;
  typedef GdaQueryFieldClass BaseClassType;

private:  friend class QueryField_Class;
  static CppClassType queryfield_class_;

private:
  // noncopyable
  QueryField(const QueryField&);
  QueryField& operator=(const QueryField&);

protected:
  explicit QueryField(const Glib::ConstructParams& construct_params);
  explicit QueryField(GdaQueryField* castitem);

#endif /* DOXYGEN_SHOULD_SKIP_THIS */

public:
  virtual ~QueryField();

#ifndef DOXYGEN_SHOULD_SKIP_THIS
  static GType get_type()      G_GNUC_CONST;
  static GType get_base_type() G_GNUC_CONST;
#endif

  ///Provides access to the underlying C GObject.
  GdaQueryField*       gobj()       { return reinterpret_cast<GdaQueryField*>(gobject_); }

  ///Provides access to the underlying C GObject.
  const GdaQueryField* gobj() const { return reinterpret_cast<GdaQueryField*>(gobject_); }

  ///Provides access to the underlying C instance. The caller is responsible for unrefing it. Use when directly setting fields in structs.
  GdaQueryField* gobj_copy();

private:


public:
  
  /** This is a copy constructor
   * @return The new object.
   */
  Glib::RefPtr<QueryField> copy() const;

  // TODO: Constructors use GError* argument
  
  /** Get the Gda::DictType represented by the @a qfield object: for a function it returns
   * the return type, for a value, it returns its type, etc.
   * @return The data type, or <tt>0</tt> if @a qfield does not have a data type.
   */
  Glib::RefPtr<DictType> get_dict_type();
  
  /** Get the Gda::DictType represented by the @a qfield object: for a function it returns
   * the return type, for a value, it returns its type, etc.
   * @return The data type, or <tt>0</tt> if @a qfield does not have a data type.
   */
  Glib::RefPtr<const DictType> get_dict_type() const;
  
  
  /** Compares the @a qfield1 and @a qfield2. The name and aliases of the two fields are
   * not compared, only the contents of the fields are.
   * @param qfield2 A Gda::QueryField object.
   * @return <tt>true</tt> if they are equal and <tt>false</tt> otherwise.
   */
  bool is_equal(const Glib::RefPtr<const QueryField>& qfield2) const;
  
  // TODO: GList* gda_query_field_get_parameters
  
  /** Sets @a qfield's alias
   * @param alias The alias to set @a qfield to.
   */
  void set_alias(const Glib::ustring& alias);
  
  /** Get @a qfield's alias
   * @return The alias.
   */
  Glib::ustring get_alias() const;

  // TODO: use get_ instead of is_?
  
  /** Sets the visibility of @a qfield. A visible field will appear in the query's 
   * corresponding (virtual) entity, whereas a non visible one will be hidden (and
   * possibly not taking part in the query).
   */
  void set_visible(bool visible = true);
  
  /** 
   * @return <tt>true</tt> if @a field is visible.
   */
  bool get_visible() const;
  
  /** Sets weather @a qfield is internal or not. Internal fields in a query are fields added
   * or changed by libgnomedb itself, such fields may or may not be visible.
   */
  void set_internal(bool internal = true);
  
  /** 
   * @return <tt>true</tt> if @a field is internal.
   */
  bool get_internal() const;
  
  /** Tells if @a qfield can potentially represent a list of values.
   * @return <tt>true</tt> if @a field can be a list of values.
   */
  bool is_list() const;

   
  /** Get a list of all the parameters needed to @a qfield to be
   * rendered as a valid statement
   * @return A new list of parameters for @a qfield.
   */
  Glib::SListHandle<Glib::RefPtr<Parameter> > get_parameters();
  
  /** Get a list of all the parameters needed to @a qfield to be
   * rendered as a valid statement
   * @return A new list of parameters for @a qfield.
   */
  Glib::SListHandle<Glib::RefPtr<const Parameter> > get_parameters() const;


public:

public:
  //C++ methods used to invoke GTK+ virtual functions:
#ifdef GLIBMM_VFUNCS_ENABLED
#endif //GLIBMM_VFUNCS_ENABLED

protected:
  //GTK+ Virtual Functions (override these to change behaviour):
#ifdef GLIBMM_VFUNCS_ENABLED
#endif //GLIBMM_VFUNCS_ENABLED

  //Default Signal Handlers::
#ifdef GLIBMM_DEFAULT_SIGNAL_HANDLERS_ENABLED
#endif //GLIBMM_DEFAULT_SIGNAL_HANDLERS_ENABLED


};

} // namespace Gda
} // namespace Gnome


namespace Glib
{
  /** A Glib::wrap() method for this object.
   * 
   * @param object The C instance.
   * @param take_copy False if the result should take ownership of the C instance. True if it should take a new copy or ref.
   * @result A C++ instance that wraps this C instance.
   *
   * @relates Gnome::Gda::QueryField
   */
  Glib::RefPtr<Gnome::Gda::QueryField> wrap(GdaQueryField* object, bool take_copy = false);
}


#endif /* _LIBGDAMM_QUERYFIELD_H */

