/* $Id: enums.hg,v 1.5 2006/05/09 16:51:34 murrayc Exp $ */

/* enums.h
 * 
 * Copyright (C) 2002 The gtkmm 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.
 */

_DEFS(gtkmm,gtk)


namespace Gtk
{

_CC_INCLUDE(gtk/gtktypebuiltins.h)

_WRAP_ENUM(AccelFlags, GtkAccelFlags)
_WRAP_ENUM(AnchorType, GtkAnchorType)

/** Used to indicate the direction in which a Gtk::Arrow should point.
 */
_WRAP_ENUM(ArrowType, GtkArrowType)

// TODO: There must be a better way to document the enum values.
//       Extract them from the GTK+ docs as well?

/*! @var ArrowType ARROW_UP
 * Represents an upward pointing arrow.
 */
/*! @var ArrowType ARROW_DOWN
 * Represents a downward pointing arrow.
 */
/*! @var ArrowType ARROW_LEFT
 * Represents a left pointing arrow.
 */
/*! @var ArrowType ARROW_RIGHT
 * Represents a right pointing arrow.
 */

/** Denotes the expansion properties that a widget will have when it (or its parent) is resized.
 */
_WRAP_ENUM(AttachOptions, GtkAttachOptions)

/*! @var AttachOptions EXPAND
 * The widget should expand to take up any extra space in its container that has been allocated.
 */
/*! @var AttachOptions SHRINK
 * The widget should shrink as and when possible.
 */
/*! @var AttachOptions FILL
 * The widget should fill the space allocated to it.
 */

_WRAP_ENUM(ButtonBoxStyle, GtkButtonBoxStyle)
_WRAP_ENUM(CurveType, GtkCurveType)
_WRAP_ENUM(DeleteType, GtkDeleteType)
_WRAP_ENUM(DirectionType, GtkDirectionType)
_WRAP_ENUM(ExpanderStyle, GtkExpanderStyle)
_WRAP_ENUM(BuiltinIconSize, GtkIconSize)
_WRAP_ENUM(TextDirection, GtkTextDirection)
_WRAP_ENUM(Justification, GtkJustification)
_WRAP_ENUM(MenuDirectionType, GtkMenuDirectionType)
_WRAP_ENUM(MetricType, GtkMetricType)
_WRAP_ENUM(MovementStep, GtkMovementStep)
_WRAP_ENUM(Orientation, GtkOrientation)
_WRAP_ENUM(CornerType, GtkCornerType)
_WRAP_ENUM(PackType, GtkPackType)
_WRAP_ENUM(PathPriorityType, GtkPathPriorityType)
_WRAP_ENUM(PathType, GtkPathType)
_WRAP_ENUM(PolicyType, GtkPolicyType)
_WRAP_ENUM(PositionType, GtkPositionType)
_WRAP_ENUM(ReliefStyle, GtkReliefStyle)
_WRAP_ENUM(ResizeMode, GtkResizeMode)
_WRAP_ENUM(ScrollType, GtkScrollType)
_WRAP_ENUM(SelectionMode, GtkSelectionMode)
_WRAP_ENUM(ShadowType, GtkShadowType)
_WRAP_ENUM(StateType, GtkStateType)
_WRAP_ENUM(TargetFlags, GtkTargetFlags)
_WRAP_ENUM(ToolbarStyle, GtkToolbarStyle)
_WRAP_ENUM(UpdateType, GtkUpdateType)
_WRAP_ENUM(Visibility, GtkVisibility)
_WRAP_ENUM(WindowPosition,GtkWindowPosition)
_WRAP_ENUM(WindowType,GtkWindowType)
_WRAP_ENUM(WrapMode, GtkWrapMode)
_WRAP_ENUM(SortType, GtkSortType)
_WRAP_ENUM(PageOrientation, GtkPageOrientation)


/* We use a class to implement the GtkIconSize enum, because you can register
 * new "enum" values.  The strict type rules of C++ don't allow using an enum
 * like that.  Gtk::BuiltinIconSize is the actual GtkIconSize wrapper enum.
 */

/**
 * Represents registered icon sizes.
 * You can also use a Gtk::BuiltinIconSize instead of an IconSize.
 */
class IconSize
{
private:
  int size_;

public:
  IconSize()                     : size_ (0)    {}
  IconSize(BuiltinIconSize size) : size_ (size) {}

  // Behave like an ordinary enum.
  explicit IconSize(int size) : size_ (size) {}
  operator int() const { return size_; }

  // These static methods are implement in iconfactory.ccg.
  static bool lookup(IconSize size, int& width, int& height);
  static IconSize register_new(const Glib::ustring& name, int width, int height);
  static void register_alias(const Glib::ustring& alias, IconSize target);
  static IconSize from_name(const Glib::ustring& name);
  static Glib::ustring get_name(IconSize size);
};

} // namespace Gtk


#ifndef DOXYGEN_SHOULD_SKIP_THIS
namespace Glib
{

template <>
class Value<Gtk::IconSize> : public Glib::Value_Enum<Gtk::IconSize>
{
public:
  static GType value_type() G_GNUC_CONST;
};

} // namespace Glib
#endif /* DOXYGEN_SHOULD_SKIP_THIS */

namespace Gtk
{

  /** Methods are overriden so you can use these simple enums, or floats for more precision.
   * @ingroup gtkmmEnums
   */
  enum AlignmentEnum
  {
    ALIGN_LEFT,   /**< Same as 0.0 */
    ALIGN_CENTER,  /**< Same as 0.5 */
    ALIGN_RIGHT,  /**< Same as 1.0 */
    ALIGN_TOP,   /**< Same as ALIGN_LEFT */
    ALIGN_BOTTOM  /**< Same as ALIGN_RIGHT */
  };

#ifndef DOXYGEN_SHOULD_SKIP_THIS
//We need this because we can't just use floats for enum value.
float _gtkmm_align_float_from_enum(AlignmentEnum value);
#endif /* DOXYGEN_SHOULD_SKIP_THIS */

} //namespace Gtk

