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


#include <glibmm.h>

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

/* queryfieldvalue.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/dicttype.h>
#include <libgdamm/datamodel.h>

#include <libgdamm/xmlstorage.h>
#include <libgdamm/referer.h>
#include <libgdamm/entityfield.h>
#include <libgdamm/renderer.h>

#include <libgdamm/query.h>


#ifndef DOXYGEN_SHOULD_SKIP_THIS
typedef struct _GdaQueryFieldValue GdaQueryFieldValue;
typedef struct _GdaQueryFieldValueClass GdaQueryFieldValueClass;
#endif /* DOXYGEN_SHOULD_SKIP_THIS */


namespace Gnome
{

namespace Gda
{ class QueryFieldValue_Class; } // namespace Gda

} // namespace Gnome
namespace Gnome
{

namespace Gda
{

/** Represents a single value (or a parameter).
 *
 * @ingroup Queries
 */

class QueryFieldValue
 : public QueryField,
   public XmlStorage,
   public Referer,
   public EntityField,
   public Renderer
{
  
#ifndef DOXYGEN_SHOULD_SKIP_THIS

public:
  typedef QueryFieldValue CppObjectType;
  typedef QueryFieldValue_Class CppClassType;
  typedef GdaQueryFieldValue BaseObjectType;
  typedef GdaQueryFieldValueClass BaseClassType;

private:  friend class QueryFieldValue_Class;
  static CppClassType queryfieldvalue_class_;

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

protected:
  explicit QueryFieldValue(const Glib::ConstructParams& construct_params);
  explicit QueryFieldValue(GdaQueryFieldValue* castitem);

#endif /* DOXYGEN_SHOULD_SKIP_THIS */

public:
  virtual ~QueryFieldValue();

#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.
  GdaQueryFieldValue*       gobj()       { return reinterpret_cast<GdaQueryFieldValue*>(gobject_); }

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

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

private:


protected:
  
  //TODO: Documentation
  QueryFieldValue(const Glib::RefPtr<Query>& query, GType type);
  QueryFieldValue(const Glib::RefPtr<Query>& query, const Value& value);

public:
  
  static Glib::RefPtr<QueryFieldValue> create(const Glib::RefPtr<Query>& query, GType type);

  
  static Glib::RefPtr<QueryFieldValue> create(const Glib::RefPtr<Query>& query, const Value& value);


  /** Sets the value of @a field, or removes it (if @a val is <tt>0</tt>)
   * @param val The value to be set, or <tt>0</tt>.
   */
  void set_value(const Value& val);
  
  /** Get the value stored by @a field. If there is no value, but a default value exists, then the
   * default value is returned.n it's up to the caller to test if there is a default value for @a field.
   * The default value can be of a different type than the one expected by @a field.
   * @return The value or <tt>0</tt>.
   */
  Value get_value() const;
  
  /** Sets the default value of @a field, or removes it (if @a default_val is <tt>0</tt>)
   * @param default_val The default value to be set, or <tt>0</tt>.
   */
  void set_default_value(const Value& default_val);
  
  /** Get the default value stored by @a field.
   * @return The value or <tt>0</tt>.
   */
  Value get_default_value() const;

  
  /** Sets wether @a field can be considered as a parameter
   */
  void set_is_parameter(bool is_param = true);
  
  bool get_is_parameter() const;
  
  /** Sets if a <tt>0</tt> value is acceptable for @a field. If @a not_null is <tt>true</tt>, then @a field
   * can't have a <tt>0</tt> value.
   */
  void set_not_null(bool not_null = true);
  
  /** Tells if @a field can receive a <tt>0</tt> value.
   * @return <tt>true</tt> if @a field can't have a <tt>0</tt> value.
   */
  bool get_not_null() const;
  
  /** Tells if @a field represents a <tt>0</tt> value.
   * @param context A Gda::ParameterList object.
   */
  bool is_value_null(const Glib::RefPtr<ParameterList>& context) const;
  
  /** Restricts the possible values which @a field can have among the calues stored in
   *  @a model at column @a col.
   * @param model A Gda::DataModel object.
   * @param col A valid column in @a model.
   * @return <tt>true</tt> if no error occurred.
   */
#ifdef GLIBMM_EXCEPTIONS_ENABLED
  bool restrict(const Glib::RefPtr<DataModel>& model, int col);
#else
  bool restrict(const Glib::RefPtr<DataModel>& model, int col, std::auto_ptr<Glib::Error>& error);
#endif //GLIBMM_EXCEPTIONS_ENABLED


  #ifdef GLIBMM_PROPERTIES_ENABLED
/** 
   *
   * You rarely need to use properties because there are get_ and set_ methods for almost all of them.
   * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when
   * the value of the property changes.
   */
  Glib::PropertyProxy<Glib::ustring> property_entry_plugin() ;
#endif //#GLIBMM_PROPERTIES_ENABLED

#ifdef GLIBMM_PROPERTIES_ENABLED
/** 
   *
   * You rarely need to use properties because there are get_ and set_ methods for almost all of them.
   * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when
   * the value of the property changes.
   */
  Glib::PropertyProxy_ReadOnly<Glib::ustring> property_entry_plugin() const;
#endif //#GLIBMM_PROPERTIES_ENABLED

  #ifdef GLIBMM_PROPERTIES_ENABLED
/** 
   *
   * You rarely need to use properties because there are get_ and set_ methods for almost all of them.
   * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when
   * the value of the property changes.
   */
  Glib::PropertyProxy<GType> property_g_type() ;
#endif //#GLIBMM_PROPERTIES_ENABLED

#ifdef GLIBMM_PROPERTIES_ENABLED
/** 
   *
   * You rarely need to use properties because there are get_ and set_ methods for almost all of them.
   * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when
   * the value of the property changes.
   */
  Glib::PropertyProxy_ReadOnly<GType> property_g_type() const;
#endif //#GLIBMM_PROPERTIES_ENABLED

  #ifdef GLIBMM_PROPERTIES_ENABLED
/** 
   *
   * You rarely need to use properties because there are get_ and set_ methods for almost all of them.
   * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when
   * the value of the property changes.
   */
  Glib::PropertyProxy_ReadOnly< Glib::RefPtr<Query> > property_query() const;
#endif //#GLIBMM_PROPERTIES_ENABLED


  #ifdef GLIBMM_PROPERTIES_ENABLED
/** 
   *
   * You rarely need to use properties because there are get_ and set_ methods for almost all of them.
   * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when
   * the value of the property changes.
   */
  Glib::PropertyProxy<int> property_restrict_column() ;
#endif //#GLIBMM_PROPERTIES_ENABLED

#ifdef GLIBMM_PROPERTIES_ENABLED
/** 
   *
   * You rarely need to use properties because there are get_ and set_ methods for almost all of them.
   * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when
   * the value of the property changes.
   */
  Glib::PropertyProxy_ReadOnly<int> property_restrict_column() const;
#endif //#GLIBMM_PROPERTIES_ENABLED

  #ifdef GLIBMM_PROPERTIES_ENABLED
/** 
   *
   * You rarely need to use properties because there are get_ and set_ methods for almost all of them.
   * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when
   * the value of the property changes.
   */
  Glib::PropertyProxy< Glib::RefPtr<DataModel> > property_restrict_model() ;
#endif //#GLIBMM_PROPERTIES_ENABLED

#ifdef GLIBMM_PROPERTIES_ENABLED
/** 
   *
   * You rarely need to use properties because there are get_ and set_ methods for almost all of them.
   * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when
   * the value of the property changes.
   */
  Glib::PropertyProxy_ReadOnly< Glib::RefPtr<DataModel> > property_restrict_model() const;
#endif //#GLIBMM_PROPERTIES_ENABLED


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::QueryFieldValue
   */
  Glib::RefPtr<Gnome::Gda::QueryFieldValue> wrap(GdaQueryFieldValue* object, bool take_copy = false);
}


#endif /* _LIBGDAMM_QUERYFIELDVALUE_H */

