/usr/share/ada/adainclude/gtkada/gtkada-builder.ads is in libgtkada2.24.1-dev 2.24.1-14.
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 | -----------------------------------------------------------------------
-- GtkAda - Ada95 binding for Gtk+/Gnome --
-- --
-- Copyright (C) 2011, AdaCore --
-- --
-- This library is free software; you can redistribute it and/or --
-- modify it under the terms of the GNU General Public --
-- License as published by the Free Software Foundation; either --
-- version 2 of the License, 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 --
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU --
-- General Public License for more details. --
-- --
-- You should have received a copy of the GNU General Public --
-- License along with this library; if not, write to the --
-- Free Software Foundation, Inc., 59 Temple Place - Suite 330, --
-- Boston, MA 02111-1307, USA. --
-- --
-----------------------------------------------------------------------
-- <description>
--
-- This package provides a high-level API for using Gtk.Builder and
-- user interface files produced with the GUI builder glade-3.
--
-- Here is how to use this package:
--
-- Step 1: create a Builder and add the XML data, just as you would a
-- standard Gtk.Builder:
--
-- declare
-- Builder : Gtkada_Builder;
-- Error : GError;
-- begin
-- Gtk_New (Builder);
-- Error := Add_From_File (Builder, Default_Filename);
--
-- Step 2: add calls to "Register_Handler" to associate your handlers
-- with your callbacks.
--
-- Register_Handler
-- (Builder => Builder,
-- Handler_Name => "my_handler_id",
-- Handler => My_Handler'Access);
--
-- Where:
-- - Builder is your Gtkada_Builder,
-- - "my_handler_id" is the name of the handler as specified in
-- Glade-3, in the "Handler" column of the "Signals" tab for
-- your object,
-- - Handler is your Ada subprogram.
--
-- You will need one call to "Register_Handler" per handler
-- declared in the Glade-3 interface. If there is one or more
-- handler declared in Glade-3 which does not have an associated
-- call to Register_Handler, an ASSERT_FAILURE will be raised by
-- the Gtk main loop.
--
-- There are multiple way to call Register_Handler, see below.
--
-- Step 3: call Do_Connect.
--
-- Step 4: when the application terminates or all Windows described through
-- your builder should be closed, call Unref to free memory
-- associated with the Builder.
--
-- </description>
-- <group>GUI Builder</group>
pragma Ada_2005;
with Ada.Containers.Hashed_Maps;
with Ada.Strings.Unbounded; use Ada.Strings.Unbounded;
with Ada.Strings.Unbounded.Hash;
with Glib.Object; use Glib.Object;
with Gtk.Builder;
package Gtkada.Builder is
type Gtkada_Builder_Record is new
Gtk.Builder.Gtk_Builder_Record with private;
type Gtkada_Builder is access all Gtkada_Builder_Record'Class;
procedure Gtk_New (Builder : out Gtkada_Builder);
procedure Initialize (Builder : access Gtkada_Builder_Record'Class);
-- Create a new Gtkada_Builder.
procedure Do_Connect (Builder : access Gtkada_Builder_Record'Class);
-- Activate in the builder callabacks that have been connected using
-- calls to Register_Handler functions below.
--------------------------------------
-- Callbacks working on the Builder --
--------------------------------------
-- These callbacks take as parameter the Gtkada_Builder.
-- If a "User data" is present in the Glade-3, it will be ignored.
type Builder_Handler is access procedure
(Builder : access Gtkada_Builder_Record'Class);
type Builder_Return_Handler is access function
(User_Data : access Gtkada_Builder_Record'Class) return Boolean;
procedure Register_Handler
(Builder : access Gtkada_Builder_Record'Class;
Handler_Name : String;
Handler : Builder_Handler);
procedure Register_Handler
(Builder : access Gtkada_Builder_Record'Class;
Handler_Name : String;
Handler : Builder_Return_Handler);
--------------------------------------------------------------
-- Callbacks working on user data specified through Glade-3 --
--------------------------------------------------------------
-- Use these registry functions if your signal handler was defined in
-- the Glade-3 interface with a "User data". The parameter User_Data
-- passed to the handlers corresponds to the object entered in the
-- "User data" column in Glade-3.
type Object_Handler is access procedure
(User_Data : access GObject_Record'Class);
type Object_Return_Handler is access function
(User_Data : access GObject_Record'Class) return Boolean;
procedure Register_Handler
(Builder : access Gtkada_Builder_Record'Class;
Handler_Name : String;
Handler : Object_Handler);
procedure Register_Handler
(Builder : access Gtkada_Builder_Record'Class;
Handler_Name : String;
Handler : Object_Return_Handler);
private
type Handler_Type is (Object, Object_Return, Builder, Builder_Return);
type Universal_Marshaller (T : Handler_Type) is record
case T is
when Object =>
The_Object_Handler : Object_Handler;
when Object_Return =>
The_Object_Return_Handler : Object_Return_Handler;
when Builder =>
The_Builder_Handler : Builder_Handler;
when Builder_Return =>
The_Builder_Return_Handler : Builder_Return_Handler;
end case;
end record;
type Universal_Marshaller_Access is access Universal_Marshaller;
package Handlers_Map is new Ada.Containers.Hashed_Maps
(Key_Type => Unbounded_String,
Element_Type => Universal_Marshaller_Access,
Hash => Ada.Strings.Unbounded.Hash,
Equivalent_Keys => "=",
"=" => "=");
type Gtkada_Builder_Record is new
Gtk.Builder.Gtk_Builder_Record
with record
Handlers : Handlers_Map.Map;
end record;
end Gtkada.Builder;
|