#
# This file is part of gtkD.
#
# gtkD 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.
#
# gtkD 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 gtkD; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
#

#############################################
### Definitions for wrapping Gtk+ ###########
#############################################

# must start with wrap
wrap: gdk
file: Gdk-3.0.gir
version Posix: file: GdkX11-3.0.gir

addStructs: start

	/**
	 * An opaque type representing a string as an index into a table
	 * of strings on the X server.
	 */
	alias _GdkAtom* GdkAtom;
	public struct _GdkAtom;
addStructs: end

struct: Atom
namespace:
noStruct: true
move: property_change Atom
array: property_change data nelements

struct: Cairo
namespace:

struct: Color
import: gobject.ObjectG
override: to_string
code: start
	/**
	 * Creates a new Color
	 */
	this()
	{
		GdkColor color;

		this(gdk_color_copy(&color));
	}

	/** ditto */
	this(ubyte red, ubyte green, ubyte blue)
	{
		GdkColor color;

		color.red = cast(ushort)(red * 257);
		color.green = cast(ushort)(green * 257);
		color.blue = cast(ushort)(blue * 257);

		this(gdk_color_copy(&color));
	}

	/** ditto */
	this(ushort red, ushort green, ushort blue)
	{
		GdkColor color;

		color.red = red;
		color.green = green;
		color.blue = blue;

		this(gdk_color_copy(&color));
	}

	private void updatePixel()
	{
		gdkColor.pixel = (gdkColor.red&0xFF00 << 8) | (gdkColor.green&0xFF00) | (gdkColor.blue >> 8) ;
	}
code: end

struct: Event
alias: _get_angle getAngle
alias: _get_center getCenter
alias: _get_distance getDistance
code: start
	/**
	 * Specifies the type of the event.
	 */
	public EventType type()
	{
		return gdkEvent.type;
	}

	/** Get a specific event. */
	public GdkEventAny* any()
	{
		return cast(GdkEventAny*)gdkEvent;
	}

	/** ditto */
	public GdkEventExpose* expose()
	{
		return cast(GdkEventExpose*)gdkEvent;
	}

	/** ditto */
	public GdkEventVisibility* visibility()
	{
		return cast(GdkEventVisibility*)gdkEvent;
	}

	/** ditto */
	public GdkEventMotion* motion()
	{
		return cast(GdkEventMotion*)gdkEvent;
	}

	/** ditto */
	public GdkEventButton* button()
	{
		return cast(GdkEventButton*)gdkEvent;
	}

	/** ditto */
	public GdkEventScroll* scroll()
	{
		return cast(GdkEventScroll*)gdkEvent;
	}

	/** ditto */
	public GdkEventKey* key()
	{
		return cast(GdkEventKey*)gdkEvent;
	}

	/** ditto */
	public GdkEventCrossing* crossing()
	{
		return cast(GdkEventCrossing*)gdkEvent;
	}

	/** ditto */
	public GdkEventFocus* focus()
	{
		return cast(GdkEventFocus*)gdkEvent;
	}

	/** ditto */
	public GdkEventConfigure* configure()
	{
		return cast(GdkEventConfigure*)gdkEvent;
	}

	/** ditto */
	public GdkEventProperty* property()
	{
		return cast(GdkEventProperty*)gdkEvent;
	}

	/** ditto */
	public GdkEventSelection* selection()
	{
		return cast(GdkEventSelection*)gdkEvent;
	}

	/** ditto */
	public GdkEventOwnerChange* ownerChange()
	{
		return cast(GdkEventOwnerChange*)gdkEvent;
	}

	/** ditto */
	public GdkEventProximity* proximity()
	{
		return cast(GdkEventProximity*)gdkEvent;
	}

	/** ditto */
	public GdkEventDND* dnd()
	{
		return cast(GdkEventDND*)gdkEvent;
	}

	/** ditto */
	public GdkEventWindowState* windowState()
	{
		return cast(GdkEventWindowState*)gdkEvent;
	}

	/** ditto */
	public GdkEventSetting* setting()
	{
		return cast(GdkEventSetting*)gdkEvent;
	}

	/** ditto */
	public GdkEventGrabBroken* grabBroken()
	{
		return cast(GdkEventGrabBroken*)gdkEvent;
	}

	/** */
	public static bool isDoubleClick(GdkEventButton* eventButton, int buttonNumber=1)
	{
		return eventButton.button==buttonNumber
				&& eventButton.type == EventType.DOUBLE_BUTTON_PRESS;
	}

	/** */
	public static bool isTripleClick(GdkEventButton* eventButton, int buttonNumber=1)
	{
		return eventButton.button==buttonNumber
				&& eventButton.type == EventType.TRIPLE_BUTTON_PRESS;
	}
code: end

struct: Monitor
class: MonitorG

struct: Pango
namespace:

struct: Pixbuf
namespace:
code: start
	public  import gdkpixbuf.Pixbuf;
code: end

struct: Rectangle
noCode: get_type
namespace:

struct: RGBA
override: to_string
code: start
	/**
	 * Creates a new RGBA Color
	 */
	this()
	{
		GdkRGBA rgba = GdkRGBA(0, 0, 0, 0);

		this(gdk_rgba_copy(&rgba), true);
	}

	/** ditto */
	this(double red, double green, double blue, double alpha = 1.0)
	{
		GdkRGBA rgba;

		rgba.red = red;
		rgba.green = green;
		rgba.blue = blue;
		rgba.alpha = alpha;

		this(gdk_rgba_copy(&rgba), true);
	}
code: end

struct: Threads
namespace:

struct: X11AppLaunchContext
noCode: true
noExternal: true

struct: X11AppLaunchContextClass
noExternal: true

struct: X11Cursor
noCode: true
noExternal: true

struct: X11CursorClass
noExternal: true

struct: X11DeviceCore
noCode: true
noExternal: true

struct: X11DeviceCoreClass
noExternal: true

struct: X11DeviceManagerCore
noCode: true
noExternal: true

struct: X11DeviceManagerCoreClass
noExternal: true

struct: X11DeviceManagerXI2
noCode: true
noExternal: true

struct: X11DeviceManagerXI2Class
noExternal: true

struct: X11DeviceXI2
noCode: true
noExternal: true

struct: X11DeviceXI2Class
noExternal: true

struct: X11Display
noCode: true
noExternal: true

struct: X11DisplayClass
noExternal: true

struct: X11DisplayManager
noCode: true
noExternal: true

struct: X11DisplayManagerClass
noExternal: true

struct: X11DragContext
noCode: true
noExternal: true

struct: X11DragContextClass
noExternal: true

struct: X11GLContext
noCode: true
noExternal: true

struct: X11Keymap
noCode: true
noExternal: true

struct: X11KeymapClass
noExternal: true

struct: X11Monitor
noCode: true
noExternal: true

struct: X11Screen
noCode: true
noExternal: true

struct: X11ScreenClass
noExternal: true

struct: X11Visual
noCode: true
noExternal: true

struct: X11VisualClass
noExternal: true

version Posix: start
	struct: X11Window
	namespace: X11
	namespace:
	noCode: get_type
	alias: Window uint
	import: gdk.Display
	import: gdk.Window
	structWrap: X11Display Display
	structWrap: X11Window Window
	noCode: lookup_for_display
	code: start
		/**
		* Looks up the #GdkWindow that wraps the given native window handle.
		*
		* Params:
		*     display = the #GdkDisplay corresponding to the
		*         window handle
		*     window = an Xlib Window
		*
		* Return: the #GdkWindow wrapper for the native
		*     window, or %NULL if there is none.
		*
		* Since: 2.24
		*/
		public Window lookupForDisplay(Display display, uint window)
		{
			auto p = gdk_x11_window_lookup_for_display((display is null) ? null : display.getDisplayStruct(), window);

			if(p is null)
			{
				return null;
			}

			return ObjectG.getDObject!(Window)(cast(GdkWindow*) p);
		}
	code: end
version: end

struct:

move: property_delete Atom
move: property_get Atom
move: text_property_to_utf8_list_for_display Atom
move: utf8_to_string_target Atom

move: cairo_create Cairo create_context
move: cairo_draw_from_gl Cairo draw_from_gl
move: cairo_get_clip_rectangle Cairo get_clip_rectangle
move: cairo_rectangle Cairo rectangle
move: cairo_region Cairo region
move: cairo_region_create_from_surface Cairo region_create_from_surface
move: cairo_set_source_color Cairo set_source_color
move: cairo_set_source_pixbuf Cairo set_source_pixbuf
move: cairo_set_source_rgba Cairo set_source_rgba
move: cairo_set_source_window Cairo set_source_window
move: cairo_surface_create_from_pixbuf Cairo surface_create_from_pixbuf
move: cairo_get_drawing_context Cairo get_drawing_context

move: disable_multidevice DeviceManager

move: drag_abort DragContext
move: drag_begin DragContext
move: drag_begin_for_device DragContext
move: drag_begin_from_point DragContext
move: drag_drop DragContext
move: drag_drop_done DragContext
move: drag_drop_succeeded DragContext
move: drag_find_window_for_screen DragContext
move: drag_get_selection DragContext
move: drag_motion DragContext
move: drag_status DragContext
move: drop_finish DragContext
move: drop_reply DragContext

move: events_get_angle Event _get_angle
move: events_get_center Event _get_center
move: events_get_distance Event _get_distance
move: events_pending Event pending
move: get_show_events Event
move: set_show_events Event
move: setting_get Event

move: beep Gdk
move: error_trap_pop Gdk
move: error_trap_pop_ignored Gdk
move: error_trap_push Gdk
move: flush Gdk
move: get_display Gdk
move: get_display_arg_name Gdk
move: get_program_class Gdk
move: init Gdk
move: init_check Gdk
move: keyboard_grab Gdk
move: keyboard_ungrab Gdk
move: notify_startup_complete Gdk
move: notify_startup_complete_with_id Gdk
move: parse_args Gdk
move: pointer_grab Gdk
move: pointer_is_grabbed Gdk
move: pointer_ungrab Gdk
move: set_allowed_backends Gdk
move: set_double_click_time Gdk
move: set_program_class Gdk

move: keyval_convert_case Keymap
move: keyval_from_name Keymap
move: keyval_is_lower Keymap
move: keyval_is_upper Keymap
move: keyval_name Keymap
move: keyval_to_lower Keymap
move: keyval_to_unicode Keymap
move: keyval_to_upper Keymap
move: unicode_to_keyval Keymap

move: pango_context_get Pango context_get
move: pango_context_get_for_screen Pango context_get_for_screen
move: pango_layout_get_clip_region Pango layout_get_clip_region
move: pango_layout_line_get_clip_region Pango layout_line_get_clip_region
move: pango_context_get_for_display Pango context_get_for_display

move: pixbuf_get_from_surface Pixbuf get_from_surface
move: pixbuf_get_from_window Pixbuf get_from_window

move: selection_convert Selection convert
move: selection_owner_get Selection owner_get
move: selection_owner_get_for_display Selection owner_get_for_display
move: selection_owner_set Selection owner_set
move: selection_owner_set_for_display Selection owner_set_for_display
move: selection_property_get Selection property_get
move: selection_send_notify Selection send_notify
move: selection_send_notify_for_display Selection send_notify_for_display

struct: Selection
out: property_get data

move: test_render_sync Testing
move: test_simulate_button Testing
move: test_simulate_key Testing

move: threads_add_idle Threads
move: threads_add_idle_full Threads
move: threads_add_timeout Threads
move: threads_add_timeout_full Threads
move: threads_add_timeout_seconds Threads
move: threads_add_timeout_seconds_full Threads
move: threads_enter Threads
move: threads_init Threads
move: threads_leave Threads
move: threads_set_lock_functions Threads

move: list_visuals Visual
move: query_depths Visual
move: query_visual_types Visual

move: get_default_root_window Window
move: offscreen_window_get_embedder Window
move: offscreen_window_get_surface Window
move: offscreen_window_set_embedder Window
move: synthesize_window_state Window
