/* Copyright (C) 2007 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 <glibmm/object.h>
#include <gdkmm/pixbuf.h>
#include <gtkmm/enums.h>
#include <gtkmm/widget.h>

_DEFS(gtkmm,gtk)
_PINCLUDE(glibmm/private/object_p.h)

namespace Gtk
{

/** Add tips to your widgets
 *
 * Gtk::Tooltip belongs to the new tooltips API that was introduced in GTK+ 2.12
 * and which deprecates the old Gtk::Tooltips API.
 *
 * Basic tooltips can be realized simply by using set_tooltip_text()
 * or set_tooltip_markup() without any explicit tooltip object.
 *
 * When you need a tooltip with a little more fancy contents, like
 * adding an image, or you want the tooltip to have different contents
 * per Gtk::TreeView row or cell, you will have to do a little more work:
 *
 * - Call Gtk::Widget:set_has_tooltip(); this will
 * make GTK+ monitor the widget for motion and related events
 * which are needed to determine when and where to show a tooltip.
 *
 * - Connect to Gtk::Widget::signal_query_tooltip(). This signal
 * will be emitted when a tooltip is supposed to be shown. One
 * of the arguments passed to the signal handler is a Gtk::Tooltip
 * object. This is the object that we are about to display as a
 * tooltip, and can be manipulated in your callback using functions
 * like Gtk::Tooltip::set_icon(). There are functions for setting
 * the tooltip's markup, setting an image from a stock icon, or
 * even putting in a custom widget.
 *
 * - Return true from your query-tooltip handler. This causes
 * the tooltip to be show. If you return false, it will not be shown.
 *
 * In the probably rare case where you want to have even more control
 * over the tooltip that is about to be shown, you can set your own
 * Window which will be used as tooltip window. This works as follows:
 *
 * - Do Gtk::Widget::set_has_tooltip() and connect to
 * Gtk::Widget::signal_query_tooltip() as before.
 *
 * - Use Gtk::Widget::set_tooltip_window() to set a Gtk::Window created
 * by you as tooltip window.
 *
 * - In the query-tooltip callback you can access your window
 * using Gtk::Widget::get_tooltip_window() and manipulate it as you
 * wish. The semantics of the return value are exactly as before,
 * return true to show the window, false to not show it.
 *
 * @newin2p12
 */
class Tooltip : public Glib::Object
{
protected:
  _CLASS_GOBJECT(Tooltip, GtkTooltip, GTK_TOOLTIP, Glib::Object, GObject)

public:

  _WRAP_METHOD(void set_markup(const Glib::ustring& markup), gtk_tooltip_set_markup)
  _WRAP_METHOD(void set_text(const Glib::ustring& markup), gtk_tooltip_set_text)
  _WRAP_METHOD(void set_icon(const Glib::RefPtr<Gdk::Pixbuf>& pixbuf), gtk_tooltip_set_icon)
  _WRAP_METHOD(void set_icon_from_stock(const StockID& stock_id, IconSize size), gtk_tooltip_set_icon_from_stock)
  _WRAP_METHOD(void set_custom(Widget& custom_widget), gtk_tooltip_set_custom)
  _WRAP_METHOD(void set_tip_area(const Gdk::Rectangle& rect), gtk_tooltip_set_tip_area)

  _IGNORE(gtk_tooltip_trigger_tooltip_query)
  static void trigger_tooltip_query(const Glib::RefPtr<Gdk::Display>& display);
};

} // namespace Gtk
