PageRenderTime 28ms CodeModel.GetById 18ms app.highlight 4ms RepoModel.GetById 1ms app.codeStats 1ms

/src/wrappers/gdk/library/gdk_drag_context.e

http://github.com/tybor/Liberty
Specman e | 165 lines | 97 code | 29 blank | 39 comment | 4 complexity | a3aabf81f27125d96ad5ce9d8a3cb8df MD5 | raw file
  1indexing
  2	description: "GdkDragContext structure"
  3	copyright: "[
  4					Copyright (C) 2006 eiffel-libraries team, GTK+ team
  5					
  6					This library is free software; you can redistribute it and/or
  7					modify it under the terms of the GNU Lesser General Public License
  8					as published by the Free Software Foundation; either version 2.1 of
  9					the License, or (at your option) any later version.
 10					
 11					This library is distributed in the hope that it will be useful, but
 12					WITHOUT ANY WARRANTY; without even the implied warranty of
 13					MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 14					Lesser General Public License for more details.
 15
 16					You should have received a copy of the GNU Lesser General Public
 17					License along with this library; if not, write to the Free Software
 18					Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
 19					02110-1301 USA
 20			]"
 21
 22class GDK_DRAG_CONTEXT
 23
 24	-- GdkDragContext
 25	
 26	-- typedef struct {
 27	--   GObject parent_instance;
 28	--   GdkDragProtocol protocol;
 29	--   gboolean is_source;
 30	--   GdkWindow *source_window;
 31	--   GdkWindow *dest_window;
 32	--   GList *targets;
 33	--   GdkDragAction actions;
 34	--   GdkDragAction suggested_action;
 35	--   GdkDragAction action; 
 36	--   guint32 start_time;
 37	-- } GdkDragContext;
 38	-- 
 39
 40	-- A GdkDragContext holds information about a drag in progress. It
 41	-- is used on both source and destination sides.
 42
 43inherit
 44	G_OBJECT
 45
 46insert
 47	GDK_DRAG_CONTEXT_EXTERNALS
 48	GDK_DRAG_ACTION
 49
 50creation from_external_pointer, secondary_wrapper_from
 51
 52feature -- size
 53
 54	struct_size: INTEGER is
 55		external "C inline use <gtk/gtk.h>"
 56		alias "sizeof(GdkDragContext)"
 57		end
 58
 59feature -- Operations
 60
 61	finish (success, delete: BOOLEAN; time: INTEGER) is
 62			-- Informs the drag source that the drop is finished, and
 63			-- that the data of the drag will no longer be required.
 64			-- `success': a flag indicating whether the drop was successful
 65			-- `delete': a flag indicating whether the source should delete the original data. (This should be TRUE for a move)
 66			-- `time': the timestamp from the "drag_data_drop" signal.
 67		require
 68			--time >= 0
 69		do
 70			gtk_drag_finish (handle, success.to_integer, delete.to_integer, time)
 71		end
 72
 73	status (an_action: INTEGER; time: INTEGER) is
 74			-- Selects one of the actions offered by the drag source.
 75			
 76			-- This function is called by the drag destination in
 77			-- response to gdk_drag_motion() called by the drag source.
 78			
 79			-- `an_action': the selected action which will be taken when a drop happens, or 0 to indicate that a drop will not be accepted.
 80			-- `time': the timestamp for this operation. 
 81		require
 82			--time >= 0
 83			is_valid_gdk_drag_action (an_action)
 84		do
 85			gdk_drag_status (handle, an_action, time)
 86		end
 87
 88feature -- Representation
 89
 90	parent_instance: G_OBJECT is
 91			-- the parent instance
 92		local factory: G_OBJECT_EXPANDED_FACTORY[G_OBJECT]
 93		do
 94			Result := factory.wrapper(gdk_drag_context_parent_instance (handle))
 95		end
 96
 97	protocol: INTEGER is -- GdkDragProtocol
 98			-- the DND protocol which governs this drag
 99		do
100		end
101
102	is_source: BOOLEAN is
103			-- true if the context is used on the source side
104		do
105			Result := gdk_drag_context_is_source (handle).to_boolean
106		end
107
108	source_window: GDK_WINDOW is
109			-- the source of this drag
110		local window: POINTER; factory: G_OBJECT_EXPANDED_FACTORY[GDK_WINDOW]
111		do
112			window := gdk_drag_context_source_window (handle) 
113			Result := factory.existant_wrapper(window)
114			if Result=Void then
115				create Result.from_external_pointer (window)
116			end
117		end
118
119	dest_window: GDK_WINDOW is
120			-- the destination window of this drag
121		local
122			window: POINTER
123			factory: G_OBJECT_EXPANDED_FACTORY[GDK_WINDOW]
124		do
125			window := gdk_drag_context_dest_window (handle)
126			Result := factory.existant_wrapper (window)
127			if Result=Void then
128				create Result.from_external_pointer (window)
129			end
130		end
131
132--	targets: G_LIST
133			-- a list of targets offered by the source
134
135	actions: INTEGER is -- GdkDragAction
136			-- a bitmask of actions proposed by the source when suggested_action is GDK_ACTION_ASK
137		do
138			Result := gdk_drag_context_actions (handle)
139		ensure
140			is_valid_gdk_drag_action (Result)
141		end
142
143	suggested_action: INTEGER is -- GdkDragAction
144			-- the action suggested by the source
145		do
146			Result := gdk_drag_context_suggested_action (handle)
147		ensure
148			is_valid_gdk_drag_action (Result)
149		end
150
151	action: INTEGER is -- GdkDragAction
152			-- the action chosen by the destination
153		do
154			Result := gdk_drag_context_action (handle)
155		ensure
156			is_valid_gdk_drag_action (Result)
157		end
158
159	start_time: INTEGER_64 is
160			-- a timestamp recording the start time of this drag
161		do
162			Result := gdk_drag_context_start_time (handle)
163		end
164
165end -- class GDK_DRAG_CONTEXT