/* Copyright (C) 2018 The gtkmm Development Team
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2.1 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
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library. If not, see <http://www.gnu.org/licenses/>.
 */

#include <gtkmm/eventcontroller.h>
#include <gdkmm/enums.h>

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

namespace Gtk
{
class GTKMM_API Widget;

/** Event controller for key events.
 *
 * %Gtk::EventControllerKey is an event controller meant for situations
 * where you need access to key events.
 *
 * Key values are the codes which are sent whenever a key is pressed or released.
 * The complete list of key values can be found in the
 * <a href="https://gitlab.gnome.org/GNOME/gtk/tree/main/gdk/gdkkeysyms.h">gdk/gdkkeysyms.h</a>
 * header file. They are prefixed with <tt>GDK_KEY_</tt>.
 *
 * @newin{3,94}
 *
 * @ingroup Gestures
 */
class GTKMM_API EventControllerKey : public EventController
{
  _CLASS_GOBJECT(EventControllerKey, GtkEventControllerKey, GTK_EVENT_CONTROLLER_KEY, EventController, GtkEventController, , , GTKMM_API)

protected:
  _CTOR_DEFAULT

public:
  _WRAP_CREATE()

  //TODO: GtkIMContext has not (yet) been wrapped in gtkmm.
  //_WRAP_METHOD(void set_im_context(const Glib::RefPtr<Gtk::IMContext>& im_context), gtk_event_controller_key_set_im_context)
  //_WRAP_METHOD(Glib::RefPtr<Gtk::IMContext> get_im_context(), gtk_event_controller_key_get_im_context, refreturn)
  //_WRAP_METHOD(Glib::RefPtr<const Gtk::IMContext> get_im_context(), gtk_event_controller_key_get_im_context, refreturn, constversion)

  _WRAP_METHOD(bool forward(Widget& widget), gtk_event_controller_key_forward)
  _WRAP_METHOD(guint get_group() const, gtk_event_controller_key_get_group)

  // no_default_handler because GtkEventControllerKeyClass is private.
  _WRAP_SIGNAL(bool key_pressed(guint keyval, guint keycode, Gdk::ModifierType state), "key-pressed", no_default_handler)
  _WRAP_SIGNAL(void key_released(guint keyval, guint keycode, Gdk::ModifierType state), "key-released", no_default_handler)
  _WRAP_SIGNAL(bool modifiers(Gdk::ModifierType state), "modifiers", no_default_handler)
  _WRAP_SIGNAL(void im_update(), "im-update", no_default_handler)
};

} // namespace Gtk
