/usr/share/ada/adainclude/gtkada/gtk-clipboard.adb is in libgtkada16.1.0-dev 17.0.2017-2.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 | ------------------------------------------------------------------------------
-- --
-- Copyright (C) 1998-2000 E. Briot, J. Brobecker and A. Charlet --
-- Copyright (C) 2000-2017, AdaCore --
-- --
-- This library is free software; you can redistribute it and/or modify it --
-- under terms of the GNU General Public License as published by the Free --
-- Software Foundation; either version 3, or (at your option) any later --
-- version. This library is distributed in the hope that it will be useful, --
-- but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHAN- --
-- TABILITY or FITNESS FOR A PARTICULAR PURPOSE. --
-- --
-- --
-- --
-- --
-- --
-- You should have received a copy of the GNU General Public License and --
-- a copy of the GCC Runtime Library Exception along with this program; --
-- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see --
-- <http://www.gnu.org/licenses/>. --
-- --
------------------------------------------------------------------------------
pragma Style_Checks (Off);
pragma Warnings (Off, "*is already use-visible*");
with Ada.Unchecked_Conversion;
with Glib.Type_Conversion_Hooks; use Glib.Type_Conversion_Hooks;
with Glib.Values; use Glib.Values;
with Gtk.Arguments; use Gtk.Arguments;
with Gtkada.Bindings; use Gtkada.Bindings;
with Gtkada.C; use Gtkada.C;
with Interfaces.C.Strings; use Interfaces.C.Strings;
package body Gtk.Clipboard is
package Atom_Arrays is new Gtkada.C.Unbounded_Arrays
(Gdk.Types.Gdk_Atom, Gdk.Types.Gdk_None,
Natural, Gdk.Types.Gdk_Atom_Array);
----------------------
-- Wait_For_Targets --
----------------------
function Wait_For_Targets
(Clipboard : not null access Gtk_Clipboard_Record)
return Gdk.Types.Gdk_Atom_Array
is
use Atom_Arrays;
function Internal
(Clipboard : System.Address;
Targets : access Unbounded_Array_Access;
N_Targets : access Gint) return Gboolean;
pragma Import (C, Internal, "gtk_clipboard_wait_for_targets");
Output : aliased Unbounded_Array_Access;
N_Targets : aliased Gint;
begin
if Internal
(Get_Object (Clipboard),
Output'Unchecked_Access,
N_Targets'Unchecked_Access) = 0
then
G_Free (Output);
Output := null;
end if;
declare
Result : constant Gdk_Atom_Array :=
To_Array (Output, Integer (N_Targets));
begin
if Output /= null then
G_Free (Output);
end if;
return Result;
end;
end Wait_For_Targets;
procedure C_Gtk_Clipboard_Request_Contents
(Clipboard : System.Address;
Target : Gdk.Types.Gdk_Atom;
Callback : System.Address;
User_Data : System.Address);
pragma Import (C, C_Gtk_Clipboard_Request_Contents, "gtk_clipboard_request_contents");
-- Requests the contents of clipboard as the given target. When the
-- results of the result are later received the supplied callback will be
-- called.
-- "target": an atom representing the form into which the clipboard owner
-- should convert the selection.
-- "callback": A function to call when the results are received (or the
-- retrieval fails). If the retrieval fails the length field of
-- Selection_Data will be negative.
-- "user_data": user data to pass to Callback
procedure C_Gtk_Clipboard_Request_Image
(Clipboard : System.Address;
Callback : System.Address;
User_Data : System.Address);
pragma Import (C, C_Gtk_Clipboard_Request_Image, "gtk_clipboard_request_image");
-- Requests the contents of the clipboard as image. When the image is
-- later received, it will be converted to a Gdk.Pixbuf.Gdk_Pixbuf, and
-- Callback will be called.
-- The Pixbuf parameter to Callback will contain the resulting
-- Gdk.Pixbuf.Gdk_Pixbuf if the request succeeded, or null if it failed.
-- This could happen for various reasons, in particular if the clipboard
-- was empty or if the contents of the clipboard could not be converted
-- into an image.
-- Since: gtk+ 2.6
-- "callback": a function to call when the image is received, or the
-- retrieval fails. (It will always be called one way or the other.)
-- "user_data": user data to pass to Callback.
procedure C_Gtk_Clipboard_Request_Rich_Text
(Clipboard : System.Address;
Buffer : System.Address;
Callback : System.Address;
User_Data : System.Address);
pragma Import (C, C_Gtk_Clipboard_Request_Rich_Text, "gtk_clipboard_request_rich_text");
-- Requests the contents of the clipboard as rich text. When the rich text
-- is later received, Callback will be called.
-- The Text parameter to Callback will contain the resulting rich text if
-- the request succeeded, or null if it failed. The Length parameter will
-- contain Text's length. This function can fail for various reasons, in
-- particular if the clipboard was empty or if the contents of the
-- clipboard could not be converted into rich text form.
-- Since: gtk+ 2.10
-- "buffer": a Gtk.Text_Buffer.Gtk_Text_Buffer
-- "callback": a function to call when the text is received, or the
-- retrieval fails. (It will always be called one way or the other.)
-- "user_data": user data to pass to Callback.
procedure C_Gtk_Clipboard_Request_Targets
(Clipboard : System.Address;
Callback : System.Address;
User_Data : System.Address);
pragma Import (C, C_Gtk_Clipboard_Request_Targets, "gtk_clipboard_request_targets");
-- Requests the contents of the clipboard as list of supported targets.
-- When the list is later received, Callback will be called.
-- The Targets parameter to Callback will contain the resulting targets if
-- the request succeeded, or null if it failed.
-- Since: gtk+ 2.4
-- "callback": a function to call when the targets are received, or the
-- retrieval fails. (It will always be called one way or the other.)
-- "user_data": user data to pass to Callback.
procedure C_Gtk_Clipboard_Request_Text
(Clipboard : System.Address;
Callback : System.Address;
User_Data : System.Address);
pragma Import (C, C_Gtk_Clipboard_Request_Text, "gtk_clipboard_request_text");
-- Requests the contents of the clipboard as text. When the text is later
-- received, it will be converted to UTF-8 if necessary, and Callback will
-- be called.
-- The Text parameter to Callback will contain the resulting text if the
-- request succeeded, or null if it failed. This could happen for various
-- reasons, in particular if the clipboard was empty or if the contents of
-- the clipboard could not be converted into text form.
-- "callback": a function to call when the text is received, or the
-- retrieval fails. (It will always be called one way or the other.)
-- "user_data": user data to pass to Callback.
procedure C_Gtk_Clipboard_Request_Uris
(Clipboard : System.Address;
Callback : System.Address;
User_Data : System.Address);
pragma Import (C, C_Gtk_Clipboard_Request_Uris, "gtk_clipboard_request_uris");
-- Requests the contents of the clipboard as URIs. When the URIs are later
-- received Callback will be called.
-- The Uris parameter to Callback will contain the resulting array of URIs
-- if the request succeeded, or null if it failed. This could happen for
-- various reasons, in particular if the clipboard was empty or if the
-- contents of the clipboard could not be converted into URI form.
-- Since: gtk+ 2.14
-- "callback": a function to call when the URIs are received, or the
-- retrieval fails. (It will always be called one way or the other.)
-- "user_data": user data to pass to Callback.
function To_Gtk_Clipboard_Received_Func is new Ada.Unchecked_Conversion
(System.Address, Gtk_Clipboard_Received_Func);
function To_Address is new Ada.Unchecked_Conversion
(Gtk_Clipboard_Received_Func, System.Address);
function To_Gtk_Clipboard_Image_Received_Func is new Ada.Unchecked_Conversion
(System.Address, Gtk_Clipboard_Image_Received_Func);
function To_Address is new Ada.Unchecked_Conversion
(Gtk_Clipboard_Image_Received_Func, System.Address);
function To_Gtk_Clipboard_Rich_Text_Received_Func is new Ada.Unchecked_Conversion
(System.Address, Gtk_Clipboard_Rich_Text_Received_Func);
function To_Address is new Ada.Unchecked_Conversion
(Gtk_Clipboard_Rich_Text_Received_Func, System.Address);
function To_Gtk_Clipboard_Targets_Received_Func is new Ada.Unchecked_Conversion
(System.Address, Gtk_Clipboard_Targets_Received_Func);
function To_Address is new Ada.Unchecked_Conversion
(Gtk_Clipboard_Targets_Received_Func, System.Address);
function To_Gtk_Clipboard_Text_Received_Func is new Ada.Unchecked_Conversion
(System.Address, Gtk_Clipboard_Text_Received_Func);
function To_Address is new Ada.Unchecked_Conversion
(Gtk_Clipboard_Text_Received_Func, System.Address);
function To_Gtk_Clipboard_Urireceived_Func is new Ada.Unchecked_Conversion
(System.Address, Gtk_Clipboard_Urireceived_Func);
function To_Address is new Ada.Unchecked_Conversion
(Gtk_Clipboard_Urireceived_Func, System.Address);
procedure Internal_Gtk_Clipboard_Image_Received_Func
(Clipboard : System.Address;
Pixbuf : System.Address;
Data : System.Address);
pragma Convention (C, Internal_Gtk_Clipboard_Image_Received_Func);
-- "clipboard": the Gtk.Clipboard.Gtk_Clipboard
-- "pixbuf": the received image
-- "data": the User_Data supplied to Gtk.Clipboard.Request_Image.
procedure Internal_Gtk_Clipboard_Received_Func
(Clipboard : System.Address;
Selection_Data : System.Address;
Data : System.Address);
pragma Convention (C, Internal_Gtk_Clipboard_Received_Func);
-- "clipboard": the Gtk.Clipboard.Gtk_Clipboard
-- "selection_data": a Gtk.Selection_Data.Gtk_Selection_Data containing
-- the data was received. If retrieving the data failed, then then length
-- field of Selection_Data will be negative.
-- "data": the User_Data supplied to Gtk.Clipboard.Request_Contents.
procedure Internal_Gtk_Clipboard_Rich_Text_Received_Func
(Clipboard : System.Address;
Format : Gdk.Types.Gdk_Atom;
Text : Interfaces.C.Strings.chars_ptr;
Length : Gsize;
Data : System.Address);
pragma Convention (C, Internal_Gtk_Clipboard_Rich_Text_Received_Func);
-- "clipboard": the Gtk.Clipboard.Gtk_Clipboard
-- "format": The format of the rich text
-- "text": the rich text received, as a UTF-8 encoded string, or null if
-- retrieving the data failed.
-- "length": Length of the text.
-- "data": the User_Data supplied to Gtk.Clipboard.Request_Rich_Text.
procedure Internal_Gtk_Clipboard_Targets_Received_Func
(Clipboard : System.Address;
Atoms : System.Address;
N_Atoms : Gint;
Data : System.Address);
pragma Convention (C, Internal_Gtk_Clipboard_Targets_Received_Func);
-- "clipboard": the Gtk.Clipboard.Gtk_Clipboard
-- "atoms": the supported targets, as array of Gdk.Types.Gdk_Atom, or null
-- if retrieving the data failed.
-- "n_atoms": the length of the Atoms array.
-- "data": the User_Data supplied to Gtk.Clipboard.Request_Targets.
procedure Internal_Gtk_Clipboard_Text_Received_Func
(Clipboard : System.Address;
Text : Interfaces.C.Strings.chars_ptr;
Data : System.Address);
pragma Convention (C, Internal_Gtk_Clipboard_Text_Received_Func);
-- "clipboard": the Gtk.Clipboard.Gtk_Clipboard
-- "text": the text received, as a UTF-8 encoded string, or null if
-- retrieving the data failed.
-- "data": the User_Data supplied to Gtk.Clipboard.Request_Text.
procedure Internal_Gtk_Clipboard_Urireceived_Func
(Clipboard : System.Address;
Uris : chars_ptr_array_access;
Data : System.Address);
pragma Convention (C, Internal_Gtk_Clipboard_Urireceived_Func);
-- "clipboard": the Gtk.Clipboard.Gtk_Clipboard
-- "uris": the received URIs
-- "data": the User_Data supplied to Gtk.Clipboard.Request_Uris.
------------------------------------------------
-- Internal_Gtk_Clipboard_Image_Received_Func --
------------------------------------------------
procedure Internal_Gtk_Clipboard_Image_Received_Func
(Clipboard : System.Address;
Pixbuf : System.Address;
Data : System.Address)
is
Func : constant Gtk_Clipboard_Image_Received_Func := To_Gtk_Clipboard_Image_Received_Func (Data);
Stub_Gtk_Clipboard : Gtk_Clipboard_Record;
Stub_Gdk_Pixbuf : Gdk.Pixbuf.Gdk_Pixbuf_Record;
begin
Func (Gtk.Clipboard.Gtk_Clipboard (Get_User_Data (Clipboard, Stub_Gtk_Clipboard)), Gdk.Pixbuf.Gdk_Pixbuf (Get_User_Data (Pixbuf, Stub_Gdk_Pixbuf)));
end Internal_Gtk_Clipboard_Image_Received_Func;
------------------------------------------
-- Internal_Gtk_Clipboard_Received_Func --
------------------------------------------
procedure Internal_Gtk_Clipboard_Received_Func
(Clipboard : System.Address;
Selection_Data : System.Address;
Data : System.Address)
is
Func : constant Gtk_Clipboard_Received_Func := To_Gtk_Clipboard_Received_Func (Data);
Stub_Gtk_Clipboard : Gtk_Clipboard_Record;
begin
Func (Gtk.Clipboard.Gtk_Clipboard (Get_User_Data (Clipboard, Stub_Gtk_Clipboard)), From_Object (Selection_Data));
end Internal_Gtk_Clipboard_Received_Func;
----------------------------------------------------
-- Internal_Gtk_Clipboard_Rich_Text_Received_Func --
----------------------------------------------------
procedure Internal_Gtk_Clipboard_Rich_Text_Received_Func
(Clipboard : System.Address;
Format : Gdk.Types.Gdk_Atom;
Text : Interfaces.C.Strings.chars_ptr;
Length : Gsize;
Data : System.Address)
is
Func : constant Gtk_Clipboard_Rich_Text_Received_Func := To_Gtk_Clipboard_Rich_Text_Received_Func (Data);
Stub_Gtk_Clipboard : Gtk_Clipboard_Record;
begin
Func (Gtk.Clipboard.Gtk_Clipboard (Get_User_Data (Clipboard, Stub_Gtk_Clipboard)), Format, Gtkada.Bindings.Value_Allowing_Null (Text), Length);
end Internal_Gtk_Clipboard_Rich_Text_Received_Func;
--------------------------------------------------
-- Internal_Gtk_Clipboard_Targets_Received_Func --
--------------------------------------------------
procedure Internal_Gtk_Clipboard_Targets_Received_Func
(Clipboard : System.Address;
Atoms : System.Address;
N_Atoms : Gint;
Data : System.Address)
is
Func : constant Gtk_Clipboard_Targets_Received_Func := To_Gtk_Clipboard_Targets_Received_Func (Data);
Stub_Gtk_Clipboard : Gtk_Clipboard_Record;
begin
Func (Gtk.Clipboard.Gtk_Clipboard (Get_User_Data (Clipboard, Stub_Gtk_Clipboard)), Atom_Arrays.To_Array (Atom_Arrays.Convert (Atoms), Integer (N_Atoms)), N_Atoms);
end Internal_Gtk_Clipboard_Targets_Received_Func;
-----------------------------------------------
-- Internal_Gtk_Clipboard_Text_Received_Func --
-----------------------------------------------
procedure Internal_Gtk_Clipboard_Text_Received_Func
(Clipboard : System.Address;
Text : Interfaces.C.Strings.chars_ptr;
Data : System.Address)
is
Func : constant Gtk_Clipboard_Text_Received_Func := To_Gtk_Clipboard_Text_Received_Func (Data);
Stub_Gtk_Clipboard : Gtk_Clipboard_Record;
begin
Func (Gtk.Clipboard.Gtk_Clipboard (Get_User_Data (Clipboard, Stub_Gtk_Clipboard)), Gtkada.Bindings.Value_Allowing_Null (Text));
end Internal_Gtk_Clipboard_Text_Received_Func;
---------------------------------------------
-- Internal_Gtk_Clipboard_Urireceived_Func --
---------------------------------------------
procedure Internal_Gtk_Clipboard_Urireceived_Func
(Clipboard : System.Address;
Uris : chars_ptr_array_access;
Data : System.Address)
is
Func : constant Gtk_Clipboard_Urireceived_Func := To_Gtk_Clipboard_Urireceived_Func (Data);
Stub_Gtk_Clipboard : Gtk_Clipboard_Record;
begin
Func (Gtk.Clipboard.Gtk_Clipboard (Get_User_Data (Clipboard, Stub_Gtk_Clipboard)), To_String_List (Uris.all));
end Internal_Gtk_Clipboard_Urireceived_Func;
package Type_Conversion_Gtk_Clipboard is new Glib.Type_Conversion_Hooks.Hook_Registrator
(Get_Type'Access, Gtk_Clipboard_Record);
pragma Unreferenced (Type_Conversion_Gtk_Clipboard);
-----------
-- Clear --
-----------
procedure Clear (Clipboard : not null access Gtk_Clipboard_Record) is
procedure Internal (Clipboard : System.Address);
pragma Import (C, Internal, "gtk_clipboard_clear");
begin
Internal (Get_Object (Clipboard));
end Clear;
-----------------
-- Get_Display --
-----------------
function Get_Display
(Clipboard : not null access Gtk_Clipboard_Record)
return Gdk.Display.Gdk_Display
is
function Internal (Clipboard : System.Address) return System.Address;
pragma Import (C, Internal, "gtk_clipboard_get_display");
Stub_Gdk_Display : Gdk.Display.Gdk_Display_Record;
begin
return Gdk.Display.Gdk_Display (Get_User_Data (Internal (Get_Object (Clipboard)), Stub_Gdk_Display));
end Get_Display;
---------------
-- Get_Owner --
---------------
function Get_Owner
(Clipboard : not null access Gtk_Clipboard_Record)
return Glib.Object.GObject
is
function Internal (Clipboard : System.Address) return System.Address;
pragma Import (C, Internal, "gtk_clipboard_get_owner");
Stub_GObject : Glib.Object.GObject_Record;
begin
return Get_User_Data (Internal (Get_Object (Clipboard)), Stub_GObject);
end Get_Owner;
----------------------
-- Request_Contents --
----------------------
procedure Request_Contents
(Clipboard : not null access Gtk_Clipboard_Record;
Target : Gdk.Types.Gdk_Atom;
Callback : Gtk_Clipboard_Received_Func)
is
begin
if Callback = null then
C_Gtk_Clipboard_Request_Contents (Get_Object (Clipboard), Target, System.Null_Address, System.Null_Address);
else
C_Gtk_Clipboard_Request_Contents (Get_Object (Clipboard), Target, Internal_Gtk_Clipboard_Received_Func'Address, To_Address (Callback));
end if;
end Request_Contents;
-------------------
-- Request_Image --
-------------------
procedure Request_Image
(Clipboard : not null access Gtk_Clipboard_Record;
Callback : Gtk_Clipboard_Image_Received_Func)
is
begin
if Callback = null then
C_Gtk_Clipboard_Request_Image (Get_Object (Clipboard), System.Null_Address, System.Null_Address);
else
C_Gtk_Clipboard_Request_Image (Get_Object (Clipboard), Internal_Gtk_Clipboard_Image_Received_Func'Address, To_Address (Callback));
end if;
end Request_Image;
-----------------------
-- Request_Rich_Text --
-----------------------
procedure Request_Rich_Text
(Clipboard : not null access Gtk_Clipboard_Record;
Buffer : not null access Glib.Object.GObject_Record'Class;
Callback : Gtk_Clipboard_Rich_Text_Received_Func)
is
begin
if Callback = null then
C_Gtk_Clipboard_Request_Rich_Text (Get_Object (Clipboard), Get_Object (Buffer), System.Null_Address, System.Null_Address);
else
C_Gtk_Clipboard_Request_Rich_Text (Get_Object (Clipboard), Get_Object (Buffer), Internal_Gtk_Clipboard_Rich_Text_Received_Func'Address, To_Address (Callback));
end if;
end Request_Rich_Text;
---------------------
-- Request_Targets --
---------------------
procedure Request_Targets
(Clipboard : not null access Gtk_Clipboard_Record;
Callback : Gtk_Clipboard_Targets_Received_Func)
is
begin
if Callback = null then
C_Gtk_Clipboard_Request_Targets (Get_Object (Clipboard), System.Null_Address, System.Null_Address);
else
C_Gtk_Clipboard_Request_Targets (Get_Object (Clipboard), Internal_Gtk_Clipboard_Targets_Received_Func'Address, To_Address (Callback));
end if;
end Request_Targets;
------------------
-- Request_Text --
------------------
procedure Request_Text
(Clipboard : not null access Gtk_Clipboard_Record;
Callback : Gtk_Clipboard_Text_Received_Func)
is
begin
if Callback = null then
C_Gtk_Clipboard_Request_Text (Get_Object (Clipboard), System.Null_Address, System.Null_Address);
else
C_Gtk_Clipboard_Request_Text (Get_Object (Clipboard), Internal_Gtk_Clipboard_Text_Received_Func'Address, To_Address (Callback));
end if;
end Request_Text;
------------------
-- Request_Uris --
------------------
procedure Request_Uris
(Clipboard : not null access Gtk_Clipboard_Record;
Callback : Gtk_Clipboard_Urireceived_Func)
is
begin
if Callback = null then
C_Gtk_Clipboard_Request_Uris (Get_Object (Clipboard), System.Null_Address, System.Null_Address);
else
C_Gtk_Clipboard_Request_Uris (Get_Object (Clipboard), Internal_Gtk_Clipboard_Urireceived_Func'Address, To_Address (Callback));
end if;
end Request_Uris;
-------------------
-- Set_Can_Store --
-------------------
procedure Set_Can_Store
(Clipboard : not null access Gtk_Clipboard_Record;
Targets : Gtk.Target_List.Target_Entry_Array;
N_Targets : Gint)
is
procedure Internal
(Clipboard : System.Address;
Targets : Gtk.Target_List.Target_Entry_Array;
N_Targets : Gint);
pragma Import (C, Internal, "gtk_clipboard_set_can_store");
begin
Internal (Get_Object (Clipboard), Targets, N_Targets);
end Set_Can_Store;
---------------
-- Set_Image --
---------------
procedure Set_Image
(Clipboard : not null access Gtk_Clipboard_Record;
Pixbuf : not null access Gdk.Pixbuf.Gdk_Pixbuf_Record'Class)
is
procedure Internal
(Clipboard : System.Address;
Pixbuf : System.Address);
pragma Import (C, Internal, "gtk_clipboard_set_image");
begin
Internal (Get_Object (Clipboard), Get_Object (Pixbuf));
end Set_Image;
--------------
-- Set_Text --
--------------
procedure Set_Text
(Clipboard : not null access Gtk_Clipboard_Record;
Text : UTF8_String)
is
procedure Internal
(Clipboard : System.Address;
Text : Interfaces.C.Strings.chars_ptr;
Len : Gint);
pragma Import (C, Internal, "gtk_clipboard_set_text");
Tmp_Text : Interfaces.C.Strings.chars_ptr := New_String (Text);
begin
Internal (Get_Object (Clipboard), Tmp_Text, -1);
Free (Tmp_Text);
end Set_Text;
-----------
-- Store --
-----------
procedure Store (Clipboard : not null access Gtk_Clipboard_Record) is
procedure Internal (Clipboard : System.Address);
pragma Import (C, Internal, "gtk_clipboard_store");
begin
Internal (Get_Object (Clipboard));
end Store;
-----------------------
-- Wait_For_Contents --
-----------------------
function Wait_For_Contents
(Clipboard : not null access Gtk_Clipboard_Record;
Target : Gdk.Types.Gdk_Atom)
return Gtk.Selection_Data.Gtk_Selection_Data
is
function Internal
(Clipboard : System.Address;
Target : Gdk.Types.Gdk_Atom) return System.Address;
pragma Import (C, Internal, "gtk_clipboard_wait_for_contents");
begin
return From_Object (Internal (Get_Object (Clipboard), Target));
end Wait_For_Contents;
--------------------
-- Wait_For_Image --
--------------------
function Wait_For_Image
(Clipboard : not null access Gtk_Clipboard_Record)
return Gdk.Pixbuf.Gdk_Pixbuf
is
function Internal (Clipboard : System.Address) return System.Address;
pragma Import (C, Internal, "gtk_clipboard_wait_for_image");
Stub_Gdk_Pixbuf : Gdk.Pixbuf.Gdk_Pixbuf_Record;
begin
return Gdk.Pixbuf.Gdk_Pixbuf (Get_User_Data (Internal (Get_Object (Clipboard)), Stub_Gdk_Pixbuf));
end Wait_For_Image;
-------------------
-- Wait_For_Text --
-------------------
function Wait_For_Text
(Clipboard : not null access Gtk_Clipboard_Record) return UTF8_String
is
function Internal
(Clipboard : System.Address) return Interfaces.C.Strings.chars_ptr;
pragma Import (C, Internal, "gtk_clipboard_wait_for_text");
begin
return Gtkada.Bindings.Value_And_Free (Internal (Get_Object (Clipboard)));
end Wait_For_Text;
-------------------
-- Wait_For_Uris --
-------------------
function Wait_For_Uris
(Clipboard : not null access Gtk_Clipboard_Record)
return GNAT.Strings.String_List
is
function Internal
(Clipboard : System.Address) return chars_ptr_array_access;
pragma Import (C, Internal, "gtk_clipboard_wait_for_uris");
begin
return To_String_List_And_Free (Internal (Get_Object (Clipboard)));
end Wait_For_Uris;
-----------------------------
-- Wait_Is_Image_Available --
-----------------------------
function Wait_Is_Image_Available
(Clipboard : not null access Gtk_Clipboard_Record) return Boolean
is
function Internal (Clipboard : System.Address) return Glib.Gboolean;
pragma Import (C, Internal, "gtk_clipboard_wait_is_image_available");
begin
return Internal (Get_Object (Clipboard)) /= 0;
end Wait_Is_Image_Available;
---------------------------------
-- Wait_Is_Rich_Text_Available --
---------------------------------
function Wait_Is_Rich_Text_Available
(Clipboard : not null access Gtk_Clipboard_Record;
Buffer : not null access Glib.Object.GObject_Record'Class)
return Boolean
is
function Internal
(Clipboard : System.Address;
Buffer : System.Address) return Glib.Gboolean;
pragma Import (C, Internal, "gtk_clipboard_wait_is_rich_text_available");
begin
return Internal (Get_Object (Clipboard), Get_Object (Buffer)) /= 0;
end Wait_Is_Rich_Text_Available;
------------------------------
-- Wait_Is_Target_Available --
------------------------------
function Wait_Is_Target_Available
(Clipboard : not null access Gtk_Clipboard_Record;
Target : Gdk.Types.Gdk_Atom) return Boolean
is
function Internal
(Clipboard : System.Address;
Target : Gdk.Types.Gdk_Atom) return Glib.Gboolean;
pragma Import (C, Internal, "gtk_clipboard_wait_is_target_available");
begin
return Internal (Get_Object (Clipboard), Target) /= 0;
end Wait_Is_Target_Available;
----------------------------
-- Wait_Is_Text_Available --
----------------------------
function Wait_Is_Text_Available
(Clipboard : not null access Gtk_Clipboard_Record) return Boolean
is
function Internal (Clipboard : System.Address) return Glib.Gboolean;
pragma Import (C, Internal, "gtk_clipboard_wait_is_text_available");
begin
return Internal (Get_Object (Clipboard)) /= 0;
end Wait_Is_Text_Available;
----------------------------
-- Wait_Is_Uris_Available --
----------------------------
function Wait_Is_Uris_Available
(Clipboard : not null access Gtk_Clipboard_Record) return Boolean
is
function Internal (Clipboard : System.Address) return Glib.Gboolean;
pragma Import (C, Internal, "gtk_clipboard_wait_is_uris_available");
begin
return Internal (Get_Object (Clipboard)) /= 0;
end Wait_Is_Uris_Available;
---------
-- Get --
---------
function Get
(Selection : Gdk.Types.Gdk_Atom := Gdk.Types.Gdk_None)
return Gtk_Clipboard
is
function Internal
(Selection : Gdk.Types.Gdk_Atom) return System.Address;
pragma Import (C, Internal, "gtk_clipboard_get");
Stub_Gtk_Clipboard : Gtk_Clipboard_Record;
begin
return Gtk.Clipboard.Gtk_Clipboard (Get_User_Data (Internal (Selection), Stub_Gtk_Clipboard));
end Get;
---------------------
-- Get_For_Display --
---------------------
function Get_For_Display
(Display : not null access Gdk.Display.Gdk_Display_Record'Class;
Selection : Gdk.Types.Gdk_Atom := Gdk.Types.Gdk_None)
return Gtk_Clipboard
is
function Internal
(Display : System.Address;
Selection : Gdk.Types.Gdk_Atom) return System.Address;
pragma Import (C, Internal, "gtk_clipboard_get_for_display");
Stub_Gtk_Clipboard : Gtk_Clipboard_Record;
begin
return Gtk.Clipboard.Gtk_Clipboard (Get_User_Data (Internal (Get_Object (Display), Selection), Stub_Gtk_Clipboard));
end Get_For_Display;
use type System.Address;
function Cb_To_Address is new Ada.Unchecked_Conversion
(Cb_Gtk_Clipboard_Gdk_Event_Owner_Change_Void, System.Address);
function Address_To_Cb is new Ada.Unchecked_Conversion
(System.Address, Cb_Gtk_Clipboard_Gdk_Event_Owner_Change_Void);
function Cb_To_Address is new Ada.Unchecked_Conversion
(Cb_GObject_Gdk_Event_Owner_Change_Void, System.Address);
function Address_To_Cb is new Ada.Unchecked_Conversion
(System.Address, Cb_GObject_Gdk_Event_Owner_Change_Void);
procedure Connect
(Object : access Gtk_Clipboard_Record'Class;
C_Name : Glib.Signal_Name;
Handler : Cb_Gtk_Clipboard_Gdk_Event_Owner_Change_Void;
After : Boolean);
procedure Connect_Slot
(Object : access Gtk_Clipboard_Record'Class;
C_Name : Glib.Signal_Name;
Handler : Cb_GObject_Gdk_Event_Owner_Change_Void;
After : Boolean;
Slot : access Glib.Object.GObject_Record'Class := null);
procedure Marsh_GObject_Gdk_Event_Owner_Change_Void
(Closure : GClosure;
Return_Value : Glib.Values.GValue;
N_Params : Glib.Guint;
Params : Glib.Values.C_GValues;
Invocation_Hint : System.Address;
User_Data : System.Address);
pragma Convention (C, Marsh_GObject_Gdk_Event_Owner_Change_Void);
procedure Marsh_Gtk_Clipboard_Gdk_Event_Owner_Change_Void
(Closure : GClosure;
Return_Value : Glib.Values.GValue;
N_Params : Glib.Guint;
Params : Glib.Values.C_GValues;
Invocation_Hint : System.Address;
User_Data : System.Address);
pragma Convention (C, Marsh_Gtk_Clipboard_Gdk_Event_Owner_Change_Void);
-------------
-- Connect --
-------------
procedure Connect
(Object : access Gtk_Clipboard_Record'Class;
C_Name : Glib.Signal_Name;
Handler : Cb_Gtk_Clipboard_Gdk_Event_Owner_Change_Void;
After : Boolean)
is
begin
Unchecked_Do_Signal_Connect
(Object => Object,
C_Name => C_Name,
Marshaller => Marsh_Gtk_Clipboard_Gdk_Event_Owner_Change_Void'Access,
Handler => Cb_To_Address (Handler),-- Set in the closure
After => After);
end Connect;
------------------
-- Connect_Slot --
------------------
procedure Connect_Slot
(Object : access Gtk_Clipboard_Record'Class;
C_Name : Glib.Signal_Name;
Handler : Cb_GObject_Gdk_Event_Owner_Change_Void;
After : Boolean;
Slot : access Glib.Object.GObject_Record'Class := null)
is
begin
Unchecked_Do_Signal_Connect
(Object => Object,
C_Name => C_Name,
Marshaller => Marsh_GObject_Gdk_Event_Owner_Change_Void'Access,
Handler => Cb_To_Address (Handler),-- Set in the closure
Slot_Object => Slot,
After => After);
end Connect_Slot;
-----------------------------------------------
-- Marsh_GObject_Gdk_Event_Owner_Change_Void --
-----------------------------------------------
procedure Marsh_GObject_Gdk_Event_Owner_Change_Void
(Closure : GClosure;
Return_Value : Glib.Values.GValue;
N_Params : Glib.Guint;
Params : Glib.Values.C_GValues;
Invocation_Hint : System.Address;
User_Data : System.Address)
is
pragma Unreferenced (Return_Value, N_Params, Invocation_Hint, User_Data);
H : constant Cb_GObject_Gdk_Event_Owner_Change_Void := Address_To_Cb (Get_Callback (Closure));
Obj : constant Glib.Object.GObject := Glib.Object.Convert (Get_Data (Closure));
begin
H (Obj, Unchecked_To_Gdk_Event_Owner_Change (Params, 1));
exception when E : others => Process_Exception (E);
end Marsh_GObject_Gdk_Event_Owner_Change_Void;
-----------------------------------------------------
-- Marsh_Gtk_Clipboard_Gdk_Event_Owner_Change_Void --
-----------------------------------------------------
procedure Marsh_Gtk_Clipboard_Gdk_Event_Owner_Change_Void
(Closure : GClosure;
Return_Value : Glib.Values.GValue;
N_Params : Glib.Guint;
Params : Glib.Values.C_GValues;
Invocation_Hint : System.Address;
User_Data : System.Address)
is
pragma Unreferenced (Return_Value, N_Params, Invocation_Hint, User_Data);
H : constant Cb_Gtk_Clipboard_Gdk_Event_Owner_Change_Void := Address_To_Cb (Get_Callback (Closure));
Obj : constant Gtk_Clipboard := Gtk_Clipboard (Unchecked_To_Object (Params, 0));
begin
H (Obj, Unchecked_To_Gdk_Event_Owner_Change (Params, 1));
exception when E : others => Process_Exception (E);
end Marsh_Gtk_Clipboard_Gdk_Event_Owner_Change_Void;
---------------------
-- On_Owner_Change --
---------------------
procedure On_Owner_Change
(Self : not null access Gtk_Clipboard_Record;
Call : Cb_Gtk_Clipboard_Gdk_Event_Owner_Change_Void;
After : Boolean := False)
is
begin
Connect (Self, "owner-change" & ASCII.NUL, Call, After);
end On_Owner_Change;
---------------------
-- On_Owner_Change --
---------------------
procedure On_Owner_Change
(Self : not null access Gtk_Clipboard_Record;
Call : Cb_GObject_Gdk_Event_Owner_Change_Void;
Slot : not null access Glib.Object.GObject_Record'Class;
After : Boolean := False)
is
begin
Connect_Slot (Self, "owner-change" & ASCII.NUL, Call, After, Slot);
end On_Owner_Change;
end Gtk.Clipboard;
|