TABLE OF CONTENTS


TkAda/Clipboard [ Packages ]

[ Top ] [ TkAda ] [ Packages ]

FUNCTION

 Provides code for manipulate Tk clipboard and selection

SOURCE

package Tcl.Tk.Ada.Clipboard with SPARK_Mode is

Clipboard/Clipboard.Append [ Subprograms ]

[ Top ] [ Clipboard ] [ Subprograms ]

FUNCTION

 Add the selected data to the clipboard

SOURCE

   procedure Append
     (Data: in String; Window: in Tk_Widget'Class;
      Format, Ctype: in String := "STRING") with
      Pre => Data /= "" and Format in "STRING" | "ATOM" and
      Ctype in "STRING" | "FILE_NAME";

PARAMETERS

 Data   - The data which will be added to the clipboard
 Window - Tk_Widget on which display the data will be added to clipboard
 Format - Format in which the data is transmitted to the requester.
          Possible values are STRING or ATOM. Default value is STRING
 CType  - Type of desired selection return. Possible values are STRING or
          FILE_NAME. Default value is STRING

EXAMPLE

   -- Add text as string to the clipboard on display where My_Main_Window widget is
   Append("Data to add to clipboard", My_Main_Window);

COMMANDS

 clipboard append -displayof window -format format -type ctype ?--? data

HISTORY

 8.6.7 - Added

Clipboard/Clipboard.Clear [ Subprograms ]

[ Top ] [ Clipboard ] [ Subprograms ]

FUNCTION

 Claim ownership of the clipboard and remove any previous contents.

SOURCE

   procedure Clear(Window: in Tk_Widget'Class);

PARAMETERS

 Window - Tk_Widget on which display the clipboard will be claimed

EXAMPLE

      -- Clear the clipboard on display where My_Main_Window widget is
      Clear(My_Main_Window);

SEE ALSO

 Clipboard.Selection_Clear

COMMANDS

 clipboard clear -displayof window

HISTORY

 8.6.7 - Added

Clipboard/Clipboard.Get [ Subprograms ]

[ Top ] [ Clipboard ] [ Subprograms ]

FUNCTION

 Retrieve the data from the clipboard

SOURCE

   function Get
     (Window: in Tk_Widget'Class; CType: in String := "STRING")
      return String with
      Pre => CType in "STRING" | "FILE_NAME";

PARAMETERS

 Window - Tk_Widget on which display the clipboard data will be retrieved
 CType  - The form in which the data will be returned. Possible values
          are STRING or FILE_NAME. Default value is STRING

RESULT

 The content of the selected clipboard

EXAMPLE

   -- Get the content of the clipboard in the string form on display where
   -- My_Main_Window is
   Clipboard_Content: constant String := Get(My_Main_Window);

SEE ALSO

 Clipboard.Selection_Get

COMMANDS

 clipboard get -displayof window -type ctype

HISTORY

 8.6.7 - Added

Clipboard/Clipboard.Selection_Clear [ Subprograms ]

[ Top ] [ Clipboard ] [ Subprograms ]

FUNCTION

 Clear the selected selection on the selected window's display

SOURCE

   procedure Selection_Clear
     (Window: in Tk_Widget'Class; Selection: in String := "PRIMARY") with
      Pre => Selection in "PRIMARY" | "CLIPBOARD";

PARAMETERS

 Window    - Tk_Widget on which display the selection will be cleared
 Selection - Type of selection to clear. Possible values are PRIMARY
             and CLIPBOARD. Default value is PRIMARY

EXAMPLE

      -- Clear the PRIMARY selection on the My_Main_Window display
      Selection_Clear(My_Main_Window);
      -- Clear the CLIPBOARD selection on the My_Main_Window display
      Selection_Clear(My_Main_Window, "CLIPBOARD");

SEE ALSO

 Clipboard.Clear

COMMANDS

 selection clear -displayof window -selection selection

HISTORY

 8.6.7 - Added

Clipboard/Clipboard.Selection_Get [ Subprograms ]

[ Top ] [ Clipboard ] [ Subprograms ]

FUNCTION

 Retrieve the data from the selected selection on the selected
 window's display

SOURCE

   function Selection_Get
     (Window: in Tk_Widget'Class; Selection: in String := "PRIMARY";
      SType: in String := "STRING") return String with
      Pre => Selection in "PRIMARY" | "CLIPBOARD" and
      SType in "STRING" | "FILE_NAME";

PARAMETERS

 Window    - Tk_Widget on which display the contents of the selection
             will be get
 Selection - The type of the selection. Possible values are PRIMARY
             and CLIPBOARD. Default value is PRIMARY
 SType     - Form in which the data will be returned. Possible values
             are STRING and FILE_NAME. Default value is STRING

RESULT

 The contents of the selected selection

EXAMPLE

      -- Get the PRIMARY selection on My_Main_Window widget display in
      -- form of string
      Selection_Content: constant String := Selection_Get(My_Main_Window);
      -- Get the CLIPBOARD selection on My_Main_Window widget display in
      -- form of file name
      File_Name: constant String := Selection_Get(My_Main_Window, "CLIPBOARD",
                                                  "FILE_NAME");

SEE ALSO

 Clipboard.Get

COMMANDS

 selection get -displayof window -selection selection -type stype

HISTORY

 8.6.7 - Added

Clipboard/Clipboard.Selection_Handle [ Subprograms ]

[ Top ] [ Clipboard ] [ Subprograms ]

FUNCTION

 Creates a handler for selection requests, such that command will be
 executed whenever selection is owned by the selected window

SOURCE

   procedure Selection_Handle
     (Window: in Tk_Widget'Class; Command: in String;
      Selection: in String := "PRIMARY"; SType: in String := "STRING";
      Format: in String := "STRING") with
      Pre => Command /= "" and Selection in "PRIMARY" | "CLIPBOARD" and
      SType in "STRING" | "FILE_NAME" and
      Format in "STRING" | "UTF8_STRING" | "ATOM" | "INTEGER";

PARAMETERS

 Window    - Tk_Widget which will be owe the selection
 Command   - Tcl command which will be executed
 Selection - The selection which will be queried. Possible values are
             PRIMARY and CLIPBOARD. Default value is PRIMARY
 SType     - Form of data retrieved from the selection. Possible
             values are STRING or FILE_NAME. Default value is STRING
 Format    - Format used to transmit the selection to the requester.
             Possible values are STRING, UTF8_STRING, ATOM and INTEGER.
             Default value is STRING

EXAMPLE

      -- Create a handerl for My_Main_Window widget display PRIMARY
      -- selection which runs Tcl puts hello command
      Selection_Handle(My_Main_Window, "{puts hello}");
      -- Create a handerl for My_Main_Window widget display CLIPBOARD
      -- selection which runs Tcl puts hello command and data will be
      -- retrieved as file name
      Selection_Handle(My_Main_Window, "{puts hello}", "CLIPBOARD", "FILE_NAME");

COMMANDS

 selection handle -selection selection -type stype -format format window command

HISTORY

 8.6.7 - Added

Clipboard/Clipboard.Selection_Own_(function) [ Subprograms ]

[ Top ] [ Clipboard ] [ Subprograms ]

FUNCTION

 Get the name of the window which owns the selected selection in the
 selected window's display

SOURCE

   function Selection_Own
     (Window: in Tk_Widget'Class; Selection: in String := "PRIMARY")
      return String with
      Pre => Selection in "PRIMARY" | "CLIPBOARD";

PARAMETERS

 Window    - Tk_Widget on which display the owner of selection will be
             get
 Selection - The selection which will be checked. Possible values are
             PRIMARY and CLIPBOARD. Default value is PRIMARY

RESULT

 The name of the window which owns the selection or {} if no window
 owns the selection.

EXAMPLE

      -- Get the name of owner of PRIMARY selection on My_Main_Window
      -- widget display
      Owner_Name: constant String := Selection_Own(My_Main_Window);
      -- Get the name of owner of CLIPBOARD selection on My_Main_Window
      -- widget display
      Owner_Name: constant String := Selection_Own(My_Main_Window, "CLIPBOARD");

SEE ALSO

 Clipboard.Selection_Own_(procedure)

COMMANDS

 selection own -displayof window -selection selection

HISTORY

 8.6.7 - Added

Clipboard/Clipboard.Selection_Own_(procedure) [ Subprograms ]

[ Top ] [ Clipboard ] [ Subprograms ]

FUNCTION

 Set the Window as a new owner of the selected selection.

SOURCE

   procedure Selection_Own
     (Window: in Tk_Widget'Class; Command: in String := "";
      Selection: in String := "PRIMARY") with
      Pre => Selection in "PRIMARY" | "CLIPBOARD";

PARAMETERS

 Window    - Tk_Widget which will be set as the owner of the selected
             Selection
 Command   - Tcl command to execute when other window claims ownership
             of the Selection from the Window. Must starts with
             "-command "
 Selection - The selection which will be owned. Possible values are
             PRIMARY and CLIPBOARD. Default value is PRIMARY

EXAMPLE

      -- Set the name of owner of PRIMARY selection to My_Main_Window
      -- widget
      Selection_Own(My_Main_Window);
      -- Set the name of owner of CLIPBOARD selection to My_Main_Window and
      -- execute Tcl command puts hello when other widget will claim ownership
      Selection_Own(My_Main_Window, "{puts hello}", "CLIPBOARD");

SEE ALSO

 Clipboard.Selection_Own_(function)

COMMANDS

 selection own -command command -selection selection window

HISTORY

 8.6.7 - Added