/*
 * Canvas-based rendering of views
 *
 * Author:
 *    Miguel de Icaza (miguel@kernel.org)
 *
 * Copyright (C) 1999, 2001 Ximian, Inc.
 */

#ifndef BONOBO_GDK_IDL
#define BONOBO_GDK_IDL

module Bonobo {

module Gdk {
	/*
	 * Idea: would it make more sense to 
	 * not provide our own types and just copy
	 * the Gdk values instead of converting back and forth?
	 */
	enum EventType {
		FOCUS,
		KEY,
		MOTION,
		BUTTON,
		CROSSING
	};

	enum ButtonType {
		BUTTON_PRESS,
		BUTTON_2_PRESS,
		BUTTON_3_PRESS,
		BUTTON_RELEASE
	};

	enum KeyType {
		KEY_PRESS,
		KEY_RELEASE
	};

	enum CrossType {
		ENTER, LEAVE
	};

	enum CrossMode {
		NORMAL,
		GRAB,
		UNGRAB
	};

	typedef long Time;

	struct MotionEvent {
		Gdk::Time time;
		double x, y, x_root, y_root;
		double pressure;
		double xtilt, ytilt;
		long   state;
		boolean is_hint;
	};

	struct ButtonEvent {
		ButtonType type;
		Gdk::Time time;
		
		double x, y, x_root, y_root;

		short  button;
	};

	struct KeyEvent {
		KeyType   type;
		Gdk::Time time;
		short	  state;
		short	  keyval;
		short	  length;
		string    str;
	};

	struct CrossingEvent {
		CrossType    type;
		Gdk::Time    time;
		double	     x, y, x_root, y_root;
		CrossMode    mode;
		boolean      focus;
		short        state;
	};

	struct FocusEvent {
		boolean      inside;
	};

	/*
	 * Only the lists of events supported by the Canvas
	 */
	union Event switch (EventType) {
		case Gdk::FOCUS:    FocusEvent focus;
		case Gdk::KEY:      KeyEvent key;
		case Gdk::MOTION:   MotionEvent motion;
		case Gdk::BUTTON:   ButtonEvent button;
		case Gdk::CROSSING: CrossingEvent crossing;
	};

	/*
	 * This is a ':' delimited string
	 *   under X11 the first entry ( before a ':' ) contains
	 *  window ID as an integer. Other fields are reserved for
	 *  future use.
	 * See also bonobo-control.c (window_id_demangle)
	 */
	typedef string WindowId;
};

module Gtk {
	struct Requisition {
		long width;
		long height;
	};
	enum State {
		StateNormal,
		StateActive,
		StatePrelight,
		StateSelected,
		StateInsensitive
	};
	enum Direction {
		DirectionTabForward,
		DirectionTabBackward,
		DirectionUp,
		DirectionDown,
		DirectionLeft,
		DirectionRight
	};
};

};

#endif
