/* $Id: toolbar.hg,v 1.19 2006/04/12 11:11:25 murrayc Exp $ */

/* Copyright (C) 1998-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.
 */

#include <gtkmm/toolitem.h>
#include <gtkmm/toolbutton.h>
#include <gtkmm/toggletoolbutton.h>
#include <glibmm/helperlist.h>
#include <gtkmm/container.h>
#include <gtkmm/stockid.h>

_DEFS(gtkmm,gtk)
_PINCLUDE(gtkmm/private/container_p.h)


namespace Gtk
{

/** Bars of buttons and other widgets.
 * @ingroup Widgets
 * @ingroup Containers
 * @ingroup Toolbars
 */
class Toolbar : public Container
{
  _CLASS_GTKOBJECT(Toolbar,GtkToolbar,GTK_TOOLBAR,Gtk::Container,GtkContainer)
public:
  _CTOR_DEFAULT()

  _WRAP_METHOD(void insert(ToolItem& item, int pos), gtk_toolbar_insert)
  void insert(ToolButton& item, int pos, const sigc::slot<void>& clicked_slot);
  void insert(ToggleToolButton& item, int pos, const sigc::slot<void>& toggled_slot);
  
  void append(ToolItem& item);
  void append(ToolButton& item, const sigc::slot<void>& clicked_slot);
  void append(ToggleToolButton& item, const sigc::slot<void>& toggled_slot);
  
  void prepend(ToolItem& item);
  void prepend(ToolButton& item, const sigc::slot<void>& clicked_slot);
  void prepend(ToggleToolButton& item, const sigc::slot<void>& toggled_slot);
  
  _WRAP_METHOD(int get_item_index(const ToolItem& item) const, gtk_toolbar_get_item_index)
  _WRAP_METHOD(int get_n_items() const, gtk_toolbar_get_n_items)
  _WRAP_METHOD(ToolItem* get_nth_item(int n), gtk_toolbar_get_nth_item)
  _WRAP_METHOD(const ToolItem* get_nth_item(int n) const, gtk_toolbar_get_nth_item, constversion)
  _WRAP_METHOD(bool get_show_arrow() const, gtk_toolbar_get_show_arrow)
  _WRAP_METHOD(void set_show_arrow(bool show_arrow = true), gtk_toolbar_set_show_arrow)


/* Style methods */
  _WRAP_METHOD(void set_orientation(Orientation orientation), gtk_toolbar_set_orientation)
  _WRAP_METHOD(Orientation get_orientation() const, gtk_toolbar_get_orientation)

  _WRAP_METHOD(void set_toolbar_style(ToolbarStyle style), gtk_toolbar_set_style)
  _WRAP_METHOD(ToolbarStyle get_toolbar_style() const, gtk_toolbar_get_style)

  _WRAP_METHOD(void set_tooltips(bool enable = true), gtk_toolbar_set_tooltips)
  _WRAP_METHOD(bool get_tooltips() const, gtk_toolbar_get_tooltips)

  _WRAP_METHOD(void unset_toolbar_style(), gtk_toolbar_unset_style)
  
  //Note that gtk_toolbar_set_icon_size() is deprecated, but gtk_toolbar_get_icon_size() is not.
  _WRAP_METHOD(IconSize get_icon_size() const, gtk_toolbar_get_icon_size)
 
  _WRAP_METHOD(ReliefStyle get_relief_style() const, gtk_toolbar_get_relief_style)
  _WRAP_METHOD(int get_drop_index(int x, int y) const, gtk_toolbar_get_drop_index)
  _WRAP_METHOD(void set_drop_highlight_item(ToolItem& tool_item, int index), gtk_toolbar_set_drop_highlight_item)
  void unset_drop_highlight_item();

  /** Emitted when the orientation of the toolbar changes.
   *
   * @param orientation The new Orientation of the toolbar.
   */
  _WRAP_SIGNAL(void orientation_changed(Orientation orientation), "orientation_changed")
  
  /** Emitted when the style of the toolbar changes. 
   * 
   * @param @style The new ToolbarStyle of the toolbar.
   */
  _WRAP_SIGNAL(void toolbar_style_changed(ToolbarStyle style), "style_changed")
  
  /** Emitted when the user right-clicks the toolbar or uses the
   * keybinding to display a popup menu.
   *
   * Application developers should handle this signal if they want
   * to display a context menu on the toolbar. The context-menu should
   * appear at the coordinates given by @a x and @a y. The mouse button
   * number is given by the @a button parameter. If the menu was popped
   * up using the keybaord, @a button is -1.
   *
   * @param x The x coordinate of the point where the menu should appear.
   * @param y The y coordinate of the point where the menu should appear.
   * @param button The mouse button the user pressed, or -1
   * @resultt true if the signal was handled, false if not.
   */
  _WRAP_SIGNAL(bool popup_context_menu(int x, int y, int button_number), "popup_context_menu")
  
  _IGNORE_SIGNAL("move_focus")
  _IGNORE_SIGNAL("focus_home_or_end")

  //This is called get_tooltips_object() to avoid a clash with get_tooltips(), which just says whether they are enabled.
  
  _MEMBER_GET(tooltips_object, tooltips, Tooltips*, GtkTooltips*)
  
  //This is probably the same as Container::children().size(), which is deprecated anyway?
  //_MEMBER_GET(num_children, num_children, int, gint)

  //There is already set/get_orientation():
  //_MEMBER_GET(orientation, orientation, GtkOrientation, Orientation)

  //There is already set/get_toolbar_style():
  //_MEMBER_GET(style, style, GtkToolbarStyle, ToolbarStyle)

  //There is already set/get_icon_size():
  //_MEMBER_GET(icon_size, icon_size, int, gint)

  //Ignore deprecated GtkToolbarAPI:
  //Normally we just deprecate it in gtkmm too,
  //but the GtkToolbar compatibility system is particularly unpleasant, so we just removed it in gtkmm 2.4. murrayc.
  _IGNORE(gtk_toolbar_set_icon_size, gtk_toolbar_unset_icon_size,
          gtk_toolbar_append_item, gtk_toolbar_prepend_item, gtk_toolbar_insert_item, gtk_toolbar_insert_stock
          gtk_toolbar_append_space, gtk_toolbar_prepend_space, gtk_toolbar_insert_space, gtk_toolbar_remove_space
          gtk_toolbar_append_element, gtk_toolbar_prepend_element, gtk_toolbar_insert_element,
          gtk_toolbar_append_widget, gtk_toolbar_prepend_widget, gtk_toolbar_insert_widget)
    
  _WRAP_PROPERTY("orientation", Orientation)
  _WRAP_PROPERTY("toolbar_style", ToolbarStyle)
  _WRAP_PROPERTY("show_arrow", bool)
};

} // namespace Gtk

