Gtk.Dnd

Entities

Simple Types

Constants

Subprograms

Description

----------------- Dest_Defaults -- -----------------

Check_Threshold

function Check_Threshold
  (Widget    : access Gtk.Widget.Gtk_Widget_Record'Class;
   Start_X   : Gint;
   Start_Y   : Gint;
   Current_X : Gint;
   Current_Y : Gint) return Boolean

Checks to see if a mouse drag starting at (Start_X, Start_Y) and ending at (Current_X, Current_Y) has passed the GTK drag threshhold, and thus should trigger the beginning of a drag-and-drop operation. Return True if the drag threshold has been passed.

Parameters
Widget
Start_X
Start_Y
Current_X
Current_Y
Return Value

Dest_Add_Image_Targets

procedure Dest_Add_Image_Targets
  (Widget : access Gtk.Widget.Gtk_Widget_Record'Class)

Add the image/text/URI targets supported by Gtk_Selection to the target list of the drag destination. The targets are added with Info = 0. If you need another value, use Gtk.Selection.Target_List_Add_*_Targets, and Dest_Set_Target_List

Parameters
Widget

Dest_Add_Text_Targets

procedure Dest_Add_Text_Targets
  (Widget : access Gtk.Widget.Gtk_Widget_Record'Class)

Add the image/text/URI targets supported by Gtk_Selection to the target list of the drag destination. The targets are added with Info = 0. If you need another value, use Gtk.Selection.Target_List_Add_*_Targets, and Dest_Set_Target_List

Parameters
Widget

Dest_Add_Uri_Targets

procedure Dest_Add_Uri_Targets
  (Widget : access Gtk.Widget.Gtk_Widget_Record'Class)

Add the image/text/URI targets supported by Gtk_Selection to the target list of the drag destination. The targets are added with Info = 0. If you need another value, use Gtk.Selection.Target_List_Add_*_Targets, and Dest_Set_Target_List

Parameters
Widget

Dest_Default_All

Dest_Default_All       : constant Dest_Defaults;

If set, specifies that all default actions should be taken.

Dest_Default_Drop

Dest_Default_Drop      : constant Dest_Defaults;

If set for a widget, when a drop occurs, GtkAda+ will check if the drag matches this widget's list of possible targets and actions. If so, GtkAda will call Get_Data on behalf of the widget. Whether or not the drop is succesful, GtkAda will call Drag_Finish. If the action was a move, then if the drag was succesful, then True will be passed for the delete parameter to Finish.

Dest_Default_Highlight

Dest_Default_Highlight : constant Dest_Defaults;

If set for a widget, GtkAda will draw a highlight on this widget as long as a drag is over this widget and the wiget drag format and action is acceptable.

Dest_Default_Motion

Dest_Default_Motion    : constant Dest_Defaults;

If set for a widget, GtkAda, during a drag over this widget will check if the drag matches this widget's list of possible targets and actions. gdk_drag_status is called as appropriate.

Dest_Defaults

type Dest_Defaults is new Integer;

Specify the various types of action that will be taken on behalf of the user for a drag destination site.

Dest_Find_Target

function Dest_Find_Target
  (Widget      : access Gtk.Widget.Gtk_Widget_Record'Class;
   Context     : Gdk.Drag_Contexts.Drag_Context;
   Target_List : Gtk.Target_List.Gtk_Target_List) return Gdk.Types.Gdk_Atom

Looks for a match between the targets set for context and the Target_List, returning the first matching target, otherwise returning GDK_NONE. Target_List should usually be the return value from Dest_Get_Target_List, but some widgets may have different valid targets for different parts of the widget; in that case, they will have to implement a drag_motion handler that passes the correct target list to this function.

Parameters
Widget
Context
Target_List
Return Value

Dest_Get_Target_List

function Dest_Get_Target_List
  (Widget : access Gtk.Widget.Gtk_Widget_Record'Class)
   return Gtk.Target_List.Gtk_Target_List

Sets the target types that this widget can accept from drag-and-drop. The widget must first be made into a drag destination with Dest_Set.

Parameters
Widget
Return Value

Dest_Get_Track_Motion

function Dest_Get_Track_Motion
  (Widget : access Gtk.Widget.Gtk_Widget_Record'Class)
   return Boolean

Control whether the widget emits drag-motion and drag-leave events regardless of the targets and the Dest_Default_Motion flag.

This may be used when a widget wants to do generic actions regardless of the targets that the source offers.

Parameters
Widget
Return Value

Dest_No_Default

Dest_No_Default        : constant Dest_Defaults;

No default behavior is provided for the drop site, this is your own responsabily. You need to handler the "drag_drop" signal yourself.

Dest_Set

procedure Dest_Set
  (Widget  : access Gtk.Widget.Gtk_Widget_Record'Class;
   Flags   : Dest_Defaults := Dest_No_Default;
   Targets : Target_Entry_Array := No_Target_Entry;
   Actions : Drag_Action := Action_Any)

Set a widget as a potential drop destination.

Flags specifies what action GtkAda should take on behalf of a widget for drops onto that widget. The Targets and Actions fields are used only if Dest_Default_Motion or Dest_Default_Drop are given.

Targets indicates the drop types that Widget accepts. If no item from Targets matches the list of targets emitted by the source (as set in Source_Set), then the drop will be considered illegal and refused.

Actions is a bitmask of possible actions for a drop onto Widget. At least of the actions must be in common with what was set for the source in Source_Set, or the drop is considered illegal.

Parameters
Widget
Flags
Targets
Actions

Dest_Set_Proxy

procedure Dest_Set_Proxy
  (Widget          : access Gtk.Widget.Gtk_Widget_Record'Class;
   Proxy_Window    : Gdk.Gdk_Window;
   Protocol        : Drag_Protocol;
   Use_Coordinates : Boolean)

Set this widget as a proxy for drops to another window. All drag events on Widget will be forwarded to Proxy_Window. Protocol is the drag protocol that Proxy_Window accepts. You can use Gdk.Drag.Get_Protocol to determine this. If Use_Coordinates is True, send the same coordinates to the destination because it is an embedded subwindow.

Parameters
Widget
Proxy_Window
Protocol
Use_Coordinates

Dest_Set_Target_List

procedure Dest_Set_Target_List
  (Widget      : access Gtk.Widget.Gtk_Widget_Record'Class;
   Target_List : Gtk.Target_List.Gtk_Target_List)

Sets the target types that this widget can accept from drag-and-drop. The widget must first be made into a drag destination with Dest_Set.

Parameters
Widget
Target_List

Dest_Set_Track_Motion

procedure Dest_Set_Track_Motion
  (Widget       : access Gtk.Widget.Gtk_Widget_Record'Class;
   Track_Motion : Boolean)

Control whether the widget emits drag-motion and drag-leave events regardless of the targets and the Dest_Default_Motion flag.

This may be used when a widget wants to do generic actions regardless of the targets that the source offers.

Parameters
Widget
Track_Motion

Dest_Unset

procedure Dest_Unset
  (Widget : access Gtk.Widget.Gtk_Widget_Record'Class)

Clear information about a drop destination set with Dest_Set. The widget will no longer receive notification of drags.

Parameters
Widget

Drag_Begin

function Drag_Begin
  (Widget  : access Gtk.Widget.Gtk_Widget_Record'Class;
   Targets : Gtk_Target_List;
   Actions : Drag_Action;
   Button  : Gint;
   Event   : Gdk.Event.Gdk_Event) return Drag_Context

Initiate a drag on the source side. The function only needs to be used when the application is starting drags itself, and is not needed when Source_Set is used. Targets is the list of targets (data formats) in which the source can provide the data. Actions is a bitmask of the allowed drag actions for this drag. Button is the button the user clicked to start the drag. Event is the event that triggered the start of the drag.

Parameters
Widget
Targets
Actions
Button
Event
Return Value

Finish

procedure Finish
  (Context : Drag_Context;
   Success : Boolean;
   Del     : Boolean;
   Time    : Guint32 := 0)

Inform the drag source that the drop is finished, and that the data of the drag will no longer be required. Success should indicate whether the drop was successful. Del should be set to True if the source should delete the original data (this should be True for a move).

Parameters
Context
Success
Del
Time

Get_Data

procedure Get_Data
  (Widget  : access Gtk.Widget.Gtk_Widget_Record'Class;
   Context : Drag_Context;
   Target  : Gdk.Types.Gdk_Atom;
   Time    : Guint32 := 0)

Get the data associated with a drag. When the data is received or the retrieval fails, GtkAda will emit a "drag_data_received" signal. Failure of the retrieval is indicated by the length field of the selection_data signal parameter being negative. However, when Get_Data is called implicitely because the Drag_Default_Drop was set, then the widget will not receive notification of failed drops.

Target is the target (form of the data) to retrieve. Time is a timestamp to retrive the data, and will be given to "drag_data_motion" or "drag_data_drop" signals.

Parameters
Widget
Context
Target
Time

Get_Source_Widget

function Get_Source_Widget
  (Context : Drag_Context) return Gtk.Widget.Gtk_Widget

Determine the source widget for a drag. If the drag is occuring within a single application, this function returns the source widget. Otherwise, it returns null.

Parameters
Context
Return Value

Highlight

procedure Highlight (Widget : access Gtk.Widget.Gtk_Widget_Record'Class)

Draw a highlight around a widget.

Parameters
Widget

Set_Icon_Default

procedure Set_Icon_Default (Context : Drag_Context)

Set the icon for a particular drag to the default icon. This must be called with a context for the source side of a drag.

Parameters
Context

Set_Icon_Name

procedure Set_Icon_Name
  (Context   : Drag_Context;
   Icon_Name : String;
   Hot_X     : Gint;
   Hot_Y     : Gint)

Sets the icon for a given drag from a named themed icon. See the docs for Gtk_Icon_Theme for more details. Note that the size of the icon depends on the icon theme (the icon is loaded at the symbolic size GTK_ICON_SIZE_DND), thus Hot_X and Hot_Y have to be used with care.

Parameters
Context
Icon_Name
Hot_X
Hot_Y

Set_Icon_Pixbuf

procedure Set_Icon_Pixbuf
  (Context : Drag_Context;
   Pixbuf  : Gdk.Pixbuf.Gdk_Pixbuf;
   Hot_X   : Gint;
   Hot_Y   : Gint)

Sets Pixbuf as the icon for a given drag.

Parameters
Context

the context for a drag. (This must be called with a context for the source side of a drag)

Pixbuf

the Gdk_Pixbuf to use as the drag icon.

Hot_X

the X offset within the pixbuf of the hotspot.

Hot_Y

the Y offset within the pixbuf of the hotspot.

Set_Icon_Stock

procedure Set_Icon_Stock
  (Context  : Drag_Context;
   Stock_Id : String;
   Hot_X    : Gint;
   Hot_Y    : Gint)

Sets the icon for a given drag from a stock ID

Parameters
Context

the context for a drag. (This must be called with a context for the source side of a drag)

Stock_Id

the ID of the stock icon to use for the drag.

Hot_X

the X offset within the icon of the hotspot.

Hot_Y

the Y offset within the icon of the hotspot.

Set_Icon_Widget

procedure Set_Icon_Widget
  (Context : Drag_Context;
   Widget  : access Gtk.Widget.Gtk_Widget_Record'Class;
   Hot_X   : Gint;
   Hot_Y   : Gint)

Change the icon for a drag. GtkAda will not destroy the icon, so if you don't want it to persist, you should connect to the "drag_end" signal and destroy it yourself. Context is the reference to the current drag operation. Widget is the toplevel window to use as an icon. (Hot_X, Hot_Y) is the coordinates of the hot point (that will be just under the mouse) within Widget.

Parameters
Context
Widget
Hot_X
Hot_Y

Source_Add_Image_Targets

procedure Source_Add_Image_Targets
  (Widget : access Gtk.Widget.Gtk_Widget_Record'Class)

Add the writable image/text/URI targets supported by Gtk_Selection to the target list of the drag source. The targets are added with Info = 0. If you need another value, use Gtk.Selection.Target_List_Add_*_Targets, and Source_Set_Target_List

Parameters
Widget

a #GtkWidget that's is a drag source

Source_Add_Text_Targets

procedure Source_Add_Text_Targets
  (Widget : access Gtk.Widget.Gtk_Widget_Record'Class)

Add the writable image/text/URI targets supported by Gtk_Selection to the target list of the drag source. The targets are added with Info = 0. If you need another value, use Gtk.Selection.Target_List_Add_*_Targets, and Source_Set_Target_List

Parameters
Widget

a #GtkWidget that's is a drag source

Source_Add_Uri_Targets

procedure Source_Add_Uri_Targets
  (Widget : access Gtk.Widget.Gtk_Widget_Record'Class)

Add the writable image/text/URI targets supported by Gtk_Selection to the target list of the drag source. The targets are added with Info = 0. If you need another value, use Gtk.Selection.Target_List_Add_*_Targets, and Source_Set_Target_List

Parameters
Widget

a #GtkWidget that's is a drag source

Source_Get_Target_List

function Source_Get_Target_List
  (Widget : access Gtk.Widget.Gtk_Widget_Record'Class)
   return Gtk.Target_List.Gtk_Target_List

Changes the target types that this widget offers for drag-and-drop. The widget must first be made into a drag source with Source_Set.

Parameters
Widget
Return Value

Source_Set

procedure Source_Set
  (Widget            : access Gtk.Widget.Gtk_Widget_Record'Class;
   Start_Button_Mask : Gdk.Types.Gdk_Modifier_Type;
   Targets           : Target_Entry_Array := No_Target_Entry;
   Actions           : Drag_Action)

Set up a widget so that GtkAda will start a drag operation when the user clicks and drags on the widget. The widget must have a window.

Targets is the list of targets that the drag can provide. The first possible target accepted by the drop site will be used. For instance, if Targets contains "text/plain" and "text/url", and the drop site only accepts "text/url", this will be the one used. However, if the drop site also accepts "text/plain", the latter will be prefered.

Widget needs to be able to convert the data to any of the types in Target, as any of them might be requested by the drop site.

Actions is a list of possible actions for drags from Widget. At least one of the actions must be in common with the drop site for the drag-and-drop operation to succeed.

Parameters
Widget
Start_Button_Mask
Targets
Actions

Source_Set_Icon_Name

procedure Source_Set_Icon_Name
  (Widget    : access Gtk.Widget.Gtk_Widget_Record'Class;
   Icon_Name : String)

Set the icon that will be used for drags from a particular widget. GtkAda retains a reference count for the arguments, and will release them when they are no longer needed.

Parameters
Widget
Icon_Name

Source_Set_Icon_Pixbuf

procedure Source_Set_Icon_Pixbuf
  (Widget : access Gtk.Widget.Gtk_Widget_Record'Class;
   Pixbuf : Gdk.Pixbuf.Gdk_Pixbuf)

Set the icon that will be used for drags from a particular widget. GtkAda retains a reference count for the arguments, and will release them when they are no longer needed.

Parameters
Widget
Pixbuf

Source_Set_Icon_Stock

procedure Source_Set_Icon_Stock
  (Widget   : access Gtk.Widget.Gtk_Widget_Record'Class;
   Stock_Id : String)

Set the icon that will be used for drags from a particular widget. GtkAda retains a reference count for the arguments, and will release them when they are no longer needed.

Parameters
Widget
Stock_Id

Source_Set_Target_List

procedure Source_Set_Target_List
  (Widget      : access Gtk.Widget.Gtk_Widget_Record'Class;
   Target_List : Gtk.Target_List.Gtk_Target_List)

Changes the target types that this widget offers for drag-and-drop. The widget must first be made into a drag source with Source_Set.

Parameters
Widget
Target_List

Source_Unset

procedure Source_Unset (Widget : access Gtk.Widget.Gtk_Widget_Record'Class)

Undo the effects of Source_Set

Parameters
Widget

Unhighlight

procedure Unhighlight (Widget : access Gtk.Widget.Gtk_Widget_Record'Class)

Remove a highlight set by Highlight.

Parameters
Widget