/* 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 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, write to the Free Software
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
 */

_DEFS(gdkmm,gdk)
_CC_INCLUDE(gdk/gdk.h)
_PINCLUDE(glibmm/private/object_p.h)

#include <glibmm/object.h>
#include <glibmm/refptr.h>
#include <glibmm/value.h>

/* Shadow DELETE macro (from winnt.h).
 * It interferes with Gdk::Event::Type::DELETE.
 */
#if defined(DELETE) && !defined(GTKMM_MACRO_SHADOW_DELETE)
enum { GTKMM_MACRO_DEFINITION_DELETE = DELETE };
#undef DELETE
enum { DELETE = GTKMM_MACRO_DEFINITION_DELETE };
#define DELETE DELETE
#define GTKMM_MACRO_SHADOW_DELETE 1
#endif

#ifndef DOXYGEN_SHOULD_SKIP_THIS
using GdkEvent = union _GdkEvent;
using GdkEventClass = struct _GdkEventClass;
#endif /* DOXYGEN_SHOULD_SKIP_THIS */

namespace Gdk
{
class Device;
class Display;
class Seat;
class Surface;

/** Functions for handling events from the window system.
 *
 * In GTK+ applications the events are handled automatically in
 * gtk_main_do_event() and passed on to the appropriate widgets,
 * so %Gdk::Event and its subclasses are rarely needed.
 */
class Event : public Glib::Object
{
  _CLASS_GOBJECT(Event, GdkEvent, GDK_EVENT, Glib::Object, GObject)
  _STRUCT_NOT_HIDDEN dnl// _GdkEvent is not a struct, it's a union
  _IGNORE(gdk_event_new)

public:
  _WRAP_ENUM(Type, GdkEventType)

protected:
  _WRAP_CTOR(Event(Type event_type), gdk_event_new)

public:
  /** Creates a new event of the given type. All fields are set to 0.
   */
  _WRAP_CREATE(Type event_type)
  _WRAP_METHOD(Glib::RefPtr<Event> copy() const, gdk_event_copy)

  _WRAP_METHOD(Type get_event_type() const, gdk_event_get_event_type)

  _WRAP_METHOD(Glib::RefPtr<Gdk::Surface> get_surface(), gdk_event_get_surface, refreturn)
  _WRAP_METHOD(Glib::RefPtr<const Gdk::Surface> get_surface() const, gdk_event_get_surface, refreturn, constversion)

  /**
   * Returns @c true if the event was sent explicitly (e.g. using @c XSendEvent)
   */
  _WRAP_METHOD(bool is_sent() const, gdk_event_is_sent)

  _WRAP_METHOD(static void set_show_events(bool show_events = true), gdk_set_show_events)
  _WRAP_METHOD(static bool get_show_events(), gdk_get_show_events)

  _WRAP_METHOD(void set_device(const Glib::RefPtr<Device>& device), gdk_event_set_device, newin "3,94")
  _WRAP_METHOD(Glib::RefPtr<Device> get_device(), gdk_event_get_device, refreturn, newin "3,94")
  _WRAP_METHOD(Glib::RefPtr<const Device> get_device() const, gdk_event_get_device, refreturn, constversion, newin "3,94")

  _WRAP_METHOD(void set_source_device(const Glib::RefPtr<Device>& device), gdk_event_set_source_device, newin "3,94")
  _WRAP_METHOD(Glib::RefPtr<Device> get_source_device(), gdk_event_get_source_device, refreturn, newin "3,94")
  _WRAP_METHOD(Glib::RefPtr<const Device> get_source_device() const, gdk_event_get_source_device, refreturn, constversion, newin "3,94")

  _WRAP_METHOD(void set_display(const Glib::RefPtr<Display>& display), gdk_event_set_display)
  _WRAP_METHOD(Glib::RefPtr<Display> get_display(), gdk_event_get_display, refreturn)
  _WRAP_METHOD(Glib::RefPtr<const Display> get_display() const, gdk_event_get_display, refreturn, constversion)

  _WRAP_METHOD(Glib::RefPtr<Seat> get_seat(), gdk_event_get_seat, refreturn, newin "3,90")
  _WRAP_METHOD(Glib::RefPtr<const Seat> get_seat() const, gdk_event_get_seat, refreturn, constversion, newin "3,90")

  _WRAP_PROPERTY("event-type", Type)

  // Belong to subclasses:
  _IGNORE(gdk_event_get_time, gdk_event_get_state, gdk_event_get_keyval,
    gdk_event_get_device_tool, gdk_event_set_device_tool,
    gdk_event_get_keycode, gdk_event_get_scancode, gdk_event_get_key_group,
    gdk_event_get_key_is_modifier, gdk_event_get_button,
    gdk_event_get_click_count, gdk_event_triggers_context_menu,
    gdk_event_get_coords, gdk_event_get_root_coords, gdk_event_get_scroll_deltas,
    gdk_event_get_scroll_direction, gdk_event_is_scroll_stop_event, gdk_event_get_axis,
    gdk_event_get_event_sequence, gdk_event_get_touch_emulating_pointer,
    gdk_event_get_pointer_emulated, gdk_event_get_drop, gdk_event_get_crossing_mode,
    gdk_event_get_crossing_detail, gdk_event_get_focus_in,
    gdk_event_get_grab_surface, gdk_event_get_touchpad_gesture_phase,
    gdk_event_get_touchpad_gesture_n_fingers, gdk_event_get_touchpad_deltas,
    gdk_event_get_touchpad_angle_delta, gdk_event_get_touchpad_scale,
    gdk_event_get_pad_group_mode, gdk_event_get_pad_button, gdk_event_get_pad_axis_value)
};

} // namespace Gdk
