This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
ada/8088: Internal error in GCC 3.2 ada compiler
- From: ash at zelatrix dot demon dot co dot uk
- To: gcc-gnats at gcc dot gnu dot org
- Date: Sun, 29 Sep 2002 14:58:22 +0100 (BST)
- Subject: ada/8088: Internal error in GCC 3.2 ada compiler
>Number: 8088
>Category: ada
>Synopsis: Internal error in GCC 3.2 ada compiler
>Confidential: no
>Severity: serious
>Priority: medium
>Responsible: unassigned
>State: open
>Class: ice-on-legal-code
>Submitter-Id: net
>Arrival-Date: Sun Sep 29 08:46:02 PDT 2002
>Closed-Date:
>Last-Modified:
>Originator: Jon Ashley
>Release: 3.2
>Organization:
>Environment:
System: Linux zelatrix 2.4.18-pre7-ac2 #4 Sun May 12 11:15:55 BST 2002 i686 unknown
Architecture: i686
host: i686-pc-linux-gnu
build: i686-pc-linux-gnu
target: i686-pc-linux-gnu
configured with: ../gcc-3.2/configure --prefix=/home/ash/gcc-3-ada/local --enable-languages=c,ada
>Description:
gcc -c -I../ -O2 -gnatn -gnatwuwl -fPIC -I- ../gtk-extra-plot_data.adb
+===========================GNAT BUG DETECTED==============================+
| 3.2 20020814 (release) (i686-pc-linux-gnu) GCC error: |
| Internal compiler error in assign_stack_temp_for_type, at |
| function.c:674 |
| Error detected at
/home/ash/gcc-3-ada/local/lib/gcc-lib/i686-pc-linux-gnu/3.2/adainclude/s-secsta.ads:66:14|
| Please submit a bug report, see http://gcc.gnu.org/bugs.html. |
| Include the entire contents of this bug box in the report. |
| Include the exact gcc or gnatmake command that you entered. |
| Also include sources listed below in gnatchop format |
| (concatenated together with no headers between files). |
+==========================================================================+
>How-To-Repeat:
I got this trying to build GtkAda-1.2.12. The files requested in this error message are below (after the "Fix:" line). Can repeat using both glibc-2.2.4 and 2.2.5.
>Fix:
Program can be built fine using the gnat-3.14p-i686-pc-linux-gnu-bin.tar.gz prepackaged binary (which I used to bootstrap the build of the Ada compiler).
-----------------------------------------------------------------------
-- GtkAda - Ada95 binding for the Gimp Toolkit --
-- --
-- Copyright (C) 2000 --
-- Emmanuel Briot, Joel Brobecker and Arnaud Charlet --
-- --
-- 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. --
-- --
-- As a special exception, if other files instantiate generics from --
-- this unit, or you link this unit with other files to produce an --
-- executable, this unit does not by itself cause the resulting --
-- executable to be covered by the GNU General Public License. This --
-- exception does not however invalidate any other reasons why the --
-- executable file might be covered by the GNU Public License. --
-----------------------------------------------------------------------
with Glib; use Glib;
with Gtk.Widget; use Gtk.Widget;
with Gtkada.Types; use Gtkada.Types;
with Gdk.Color; use Gdk.Color;
with Interfaces.C; use Interfaces.C;
package body Gtk.Extra.Plot_Data is
-------------
-- Gtk_New --
-------------
procedure Gtk_New
(Data : out Gtk_Plot_Data; Func : Plot_Function := null) is
begin
Data := new Gtk_Plot_Data_Record;
Initialize (Data, Func);
end Gtk_New;
----------------
-- Initialize --
----------------
procedure Initialize
(Data : access Gtk_Plot_Data_Record'Class; Func : Plot_Function := null)
is
function Internal return System.Address;
pragma Import (C, Internal, "gtk_plot_data_new");
function Internal2 (Func : Plot_Function) return System.Address;
pragma Import (C, Internal2, "gtk_plot_data_new_function");
begin
if Func = null then
Set_Object (Data, Internal);
else
Set_Object (Data, Internal2 (Func));
end if;
Initialize_User_Data (Data);
end Initialize;
--------------
-- Set_Name --
--------------
procedure Set_Name (Data : access Gtk_Plot_Data_Record; Name : String) is
procedure Internal (Data : System.Address; Name : in String);
pragma Import (C, Internal, "gtk_plot_data_set_name");
begin
Internal (Get_Object (Data), Name & ASCII.NUL);
end Set_Name;
-----------
-- Paint --
-----------
procedure Paint (Data : access Gtk_Plot_Data_Record) is
procedure Internal (Data : System.Address);
pragma Import (C, Internal, "gtk_plot_data_paint");
begin
Internal (Get_Object (Data));
end Paint;
-----------------
-- Draw_Points --
-----------------
procedure Draw_Points (Data : access Gtk_Plot_Data_Record; N : Gint) is
procedure Internal (Data : System.Address; N : Gint);
pragma Import (C, Internal, "gtk_plot_data_draw_points");
begin
Internal (Get_Object (Data), N);
end Draw_Points;
-----------------
-- Draw_Symbol --
-----------------
procedure Draw_Symbol
(Data : access Gtk_Plot_Data_Record; X, Y : Gdouble)
is
procedure Internal (Data : System.Address; X, Y : Gdouble);
pragma Import (C, Internal, "gtk_plot_data_draw_symbol");
begin
Internal (Get_Object (Data), X, Y);
end Draw_Symbol;
----------------
-- Set_Points --
----------------
procedure Set_Points
(Data : access Gtk_Plot_Data_Record;
X : Gdouble_Array_Access;
Y : Gdouble_Array_Access;
Dx : Gdouble_Array_Access;
Dy : Gdouble_Array_Access)
is
procedure Internal (Data : in System.Address;
X : in System.Address;
Y : in System.Address;
Dx : in System.Address;
Dy : in System.Address;
Num_Points : in Gint);
pragma Import (C, Internal, "gtk_plot_data_set_points");
Xa, Ya, Dxa, Dya : System.Address := System.Null_Address;
begin
if X /= null then
Xa := X (X'First)'Address;
end if;
if Y /= null then
Ya := Y (Y'First)'Address;
end if;
if Dx /= null then
Dxa := Dx (Dx'First)'Address;
end if;
if Dy /= null then
Dya := Dy (Dy'First)'Address;
end if;
Internal (Get_Object (Data), Xa, Ya, Dxa, Dya, X'Length);
end Set_Points;
----------------
-- Get_Points --
----------------
procedure Get_Points
(Data : access Gtk_Plot_Data_Record;
X : out Points_Array;
Y : out Points_Array;
Dx : out Points_Array;
Dy : out Points_Array)
is
procedure Internal (Data : in System.Address;
X : out System.Address;
Y : out System.Address;
Dx : out System.Address;
Dy : out System.Address;
Num_Points : out Gint);
pragma Import (C, Internal, "gtk_plot_data_get_points");
Num_Points : Gint;
X1, Y1, Dx1, Dy1 : System.Address;
begin
Internal (Get_Object (Data), X1, Y1, Dx1, Dy1, Num_Points);
X := (Points => To_Double_Array (X1), Num_Points => Num_Points);
Y := (Points => To_Double_Array (Y1), Num_Points => Num_Points);
Dx := (Points => To_Double_Array (Dx1), Num_Points => Num_Points);
Dy := (Points => To_Double_Array (Dy1), Num_Points => Num_Points);
end Get_Points;
-----------
-- Set_X --
-----------
procedure Set_X
(Data : access Gtk_Plot_Data_Record; X : Gdouble_Array_Access)
is
procedure Internal (Data : System.Address; X : System.Address);
pragma Import (C, Internal, "gtk_plot_data_set_x");
begin
pragma Assert (Get_Numpoints (Data) = X'Length);
Internal (Get_Object (Data), X (X'First)'Address);
end Set_X;
-----------
-- Set_Y --
-----------
procedure Set_Y
(Data : access Gtk_Plot_Data_Record; Y : Gdouble_Array_Access)
is
procedure Internal (Data : System.Address; Y : System.Address);
pragma Import (C, Internal, "gtk_plot_data_set_y");
begin
pragma Assert (Get_Numpoints (Data) = Y'Length);
Internal (Get_Object (Data), Y (Y'First)'Address);
end Set_Y;
-----------
-- Set_Z --
-----------
procedure Set_Z
(Data : access Gtk_Plot_Data_Record; Z : Gdouble_Array_Access)
is
procedure Internal (Data : System.Address; Z : System.Address);
pragma Import (C, Internal, "gtk_plot_data_set_z");
begin
pragma Assert (Get_Numpoints (Data) = Z'Length);
Internal (Get_Object (Data), Z (Z'First)'Address);
end Set_Z;
-----------
-- Set_A --
-----------
procedure Set_A
(Data : access Gtk_Plot_Data_Record; A : Gdouble_Array_Access)
is
procedure Internal (Data : System.Address; A : System.Address);
pragma Import (C, Internal, "gtk_plot_data_set_a");
begin
pragma Assert (Get_Numpoints (Data) = A'Length);
Internal (Get_Object (Data), A (A'First)'Address);
end Set_A;
------------
-- Set_Dx --
------------
procedure Set_Dx
(Data : access Gtk_Plot_Data_Record; Dx : Gdouble_Array_Access)
is
procedure Internal (Data : System.Address; Dx : System.Address);
pragma Import (C, Internal, "gtk_plot_data_set_dx");
begin
pragma Assert (Get_Numpoints (Data) = Dx'Length);
Internal (Get_Object (Data), Dx (Dx'First)'Address);
end Set_Dx;
------------
-- Set_Dy --
------------
procedure Set_Dy
(Data : access Gtk_Plot_Data_Record; Dy : Gdouble_Array_Access)
is
procedure Internal (Data : System.Address; Dy : System.Address);
pragma Import (C, Internal, "gtk_plot_data_set_dy");
begin
pragma Assert (Get_Numpoints (Data) = Dy'Length);
Internal (Get_Object (Data), Dy (Dy'First)'Address);
end Set_Dy;
------------
-- Set_Dz --
------------
procedure Set_Dz
(Data : access Gtk_Plot_Data_Record; Dz : Gdouble_Array_Access)
is
procedure Internal (Data : System.Address; Dz : System.Address);
pragma Import (C, Internal, "gtk_plot_data_set_dz");
begin
pragma Assert (Get_Numpoints (Data) = Dz'Length);
Internal (Get_Object (Data), Dz (Dz'First)'Address);
end Set_Dz;
------------
-- Set_Da --
------------
procedure Set_Da
(Data : access Gtk_Plot_Data_Record; Da : Gdouble_Array_Access)
is
procedure Internal (Data : System.Address; Da : System.Address);
pragma Import (C, Internal, "gtk_plot_data_set_da");
begin
pragma Assert (Get_Numpoints (Data) = Da'Length);
Internal (Get_Object (Data), Da (Da'First)'Address);
end Set_Da;
-----------
-- Get_X --
-----------
function Get_X (Data : access Gtk_Plot_Data_Record) return Points_Array is
function Internal (Data : System.Address; Num_Points : System.Address)
return System.Address;
pragma Import (C, Internal, "gtk_plot_data_get_x");
Num_Points : aliased Gint;
S : System.Address := Internal (Get_Object (Data), Num_Points'Address);
begin
return (Points => To_Double_Array (S), Num_Points => Num_Points);
end Get_X;
-----------
-- Get_Y --
-----------
function Get_Y (Data : access Gtk_Plot_Data_Record) return Points_Array is
function Internal (Data : System.Address; Num_Points : System.Address)
return System.Address;
pragma Import (C, Internal, "gtk_plot_data_get_y");
Num_Points : aliased Gint;
S : System.Address := Internal (Get_Object (Data), Num_Points'Address);
begin
return (Points => To_Double_Array (S), Num_Points => Num_Points);
end Get_Y;
-----------
-- Get_Z --
-----------
function Get_Z (Data : access Gtk_Plot_Data_Record) return Points_Array is
function Internal (Data : System.Address; Num_Points : System.Address)
return System.Address;
pragma Import (C, Internal, "gtk_plot_data_get_z");
Num_Points : aliased Gint;
S : System.Address := Internal (Get_Object (Data), Num_Points'Address);
begin
return (Points => To_Double_Array (S), Num_Points => Num_Points);
end Get_Z;
-----------
-- Get_A --
-----------
function Get_A (Data : access Gtk_Plot_Data_Record) return Points_Array is
function Internal (Data : System.Address; Num_Points : System.Address)
return System.Address;
pragma Import (C, Internal, "gtk_plot_data_get_a");
Num_Points : aliased Gint;
S : System.Address := Internal (Get_Object (Data), Num_Points'Address);
begin
return (Points => To_Double_Array (S), Num_Points => Num_Points);
end Get_A;
------------
-- Get_Dx --
------------
function Get_Dx (Data : access Gtk_Plot_Data_Record) return Points_Array is
function Internal (Data : System.Address; Num_Points : System.Address)
return System.Address;
pragma Import (C, Internal, "gtk_plot_data_get_dx");
Num_Points : aliased Gint;
S : System.Address := Internal (Get_Object (Data), Num_Points'Address);
begin
return (Points => To_Double_Array (S), Num_Points => Num_Points);
end Get_Dx;
------------
-- Get_Dy --
------------
function Get_Dy (Data : access Gtk_Plot_Data_Record) return Points_Array is
function Internal (Data : System.Address; Num_Points : System.Address)
return System.Address;
pragma Import (C, Internal, "gtk_plot_data_get_dy");
Num_Points : aliased Gint;
S : System.Address := Internal (Get_Object (Data), Num_Points'Address);
begin
return (Points => To_Double_Array (S), Num_Points => Num_Points);
end Get_Dy;
------------
-- Get_Dz --
------------
function Get_Dz (Data : access Gtk_Plot_Data_Record) return Points_Array is
function Internal (Data : System.Address; Num_Points : System.Address)
return System.Address;
pragma Import (C, Internal, "gtk_plot_data_get_dz");
Num_Points : aliased Gint;
S : System.Address := Internal (Get_Object (Data), Num_Points'Address);
begin
return (Points => To_Double_Array (S), Num_Points => Num_Points);
end Get_Dz;
------------
-- Get_Da --
------------
function Get_Da (Data : access Gtk_Plot_Data_Record) return Points_Array is
function Internal (Data : System.Address; Num_Points : System.Address)
return System.Address;
pragma Import (C, Internal, "gtk_plot_data_get_da");
Num_Points : aliased Gint;
S : System.Address := Internal (Get_Object (Data), Num_Points'Address);
begin
return (Points => To_Double_Array (S), Num_Points => Num_Points);
end Get_Da;
-------------------
-- Set_Numpoints --
-------------------
procedure Set_Numpoints (Data : access Gtk_Plot_Data_Record; Num : Gint) is
procedure Internal (Data : System.Address; Num : Gint);
pragma Import (C, Internal, "gtk_plot_data_set_numpoints");
begin
Internal (Get_Object (Data), Num);
end Set_Numpoints;
-------------------
-- Get_Numpoints --
-------------------
function Get_Numpoints (Data : access Gtk_Plot_Data_Record) return Gint is
function Internal (Data : System.Address) return Gint;
pragma Import (C, Internal, "gtk_plot_data_get_numpoints");
begin
return Internal (Get_Object (Data));
end Get_Numpoints;
----------------
-- Set_Labels --
----------------
procedure Set_Labels
(Data : access Gtk_Plot_Data_Record;
Labels : Gtkada.Types.Chars_Ptr_Array)
is
procedure Internal (Data : System.Address; Labels : Chars_Ptr_Array);
pragma Import (C, Internal, "gtk_plot_data_set_labels");
begin
Internal (Get_Object (Data), Labels);
end Set_Labels;
----------------
-- Get_Labels --
----------------
function Get_Labels (Data : access Gtk_Plot_Data_Record)
return Gtkada.Types.Chars_Ptr_Array
is
type Str_Array is array (Natural) of Chars_Ptr;
function Internal (Data : System.Address) return Str_Array;
pragma Import (C, Internal, "gtk_plot_data_get_labels");
N : constant size_t := size_t (Get_Numpoints (Data));
begin
return Chars_Ptr_Array
(Internal (Get_Object (Data))(0 .. Integer (N) - 1));
end Get_Labels;
-----------------
-- Show_Labels --
-----------------
procedure Show_Labels
(Data : access Gtk_Plot_Data_Record; Show : Boolean)
is
procedure Internal (Data : System.Address; Show : Gint);
pragma Import (C, Internal, "gtk_plot_data_show_labels");
begin
Internal (Get_Object (Data), Boolean'Pos (Show));
end Show_Labels;
---------------------------
-- Labels_Set_Attributes --
---------------------------
procedure Labels_Set_Attributes
(Data : access Gtk_Plot_Data_Record;
Font : String;
Height : Gint;
Angle : Gint;
Foreground : Gdk.Color.Gdk_Color;
Background : Gdk.Color.Gdk_Color)
is
procedure Internal
(Data : System.Address;
Font : String;
Height, Angle : Gint;
Foreground, Background : System.Address);
pragma Import (C, Internal, "gtk_plot_data_labels_set_attributes");
F : aliased Gdk_Color := Foreground;
B : aliased Gdk_Color := Background;
begin
Internal (Get_Object (Data), Font & ASCII.NUL, Height, Angle,
F'Address, B'Address);
end Labels_Set_Attributes;
----------------
-- Set_Symbol --
----------------
procedure Set_Symbol
(Data : access Gtk_Plot_Data_Record;
The_Type : Plot_Symbol_Type;
Style : Plot_Symbol_Style;
Size : Gint;
Line_Width : Gfloat;
Color : Gdk.Color.Gdk_Color;
Border_Color : Gdk.Color.Gdk_Color)
is
procedure Internal
(Data : System.Address;
The_Type, Style, Size : Gint;
Line_Width : Gfloat;
Color, Border_Color : System.Address);
pragma Import (C, Internal, "gtk_plot_data_set_symbol");
C : aliased Gdk_Color := Color;
B : aliased Gdk_Color := Border_Color;
begin
Internal (Get_Object (Data), Plot_Symbol_Type'Pos (The_Type),
Plot_Symbol_Style'Pos (Style), Size, Line_Width,
C'Address, B'Address);
end Set_Symbol;
----------------
-- Get_Symbol --
----------------
procedure Get_Symbol
(Data : access Gtk_Plot_Data_Record;
The_Type : out Plot_Symbol_Type;
Style : out Plot_Symbol_Style;
Size : out Gint;
Line_Width : out Gint;
Color : out Gdk.Color.Gdk_Color;
Border_Color : out Gdk.Color.Gdk_Color)
is
procedure Internal
(Data : System.Address;
The_Type : out Plot_Symbol_Type;
Style : out Plot_Symbol_Style;
Size : out Gint;
Line_Width : out Gint;
Color : System.Address;
Border_Color : System.Address);
pragma Import (C, Internal, "gtk_plot_data_get_symbol");
C, B : aliased Gdk_Color;
begin
Internal (Get_Object (Data), The_Type, Style, Size, Line_Width,
C'Address, B'Address);
Color := C;
Border_Color := B;
end Get_Symbol;
-------------------
-- Set_Connector --
-------------------
procedure Set_Connector
(Data : access Gtk_Plot_Data_Record; Connector : Plot_Connector)
is
procedure Internal (Data : System.Address; Connector : Gint);
pragma Import (C, Internal, "gtk_plot_data_set_connector");
begin
Internal (Get_Object (Data), Plot_Connector'Pos (Connector));
end Set_Connector;
-------------------
-- Get_Connector --
-------------------
function Get_Connector (Data : access Gtk_Plot_Data_Record)
return Plot_Connector
is
function Internal (Data : System.Address) return Gint;
pragma Import (C, Internal, "gtk_plot_data_get_connector");
begin
return Plot_Connector'Val (Internal (Get_Object (Data)));
end Get_Connector;
-------------------------
-- Set_Line_Attributes --
-------------------------
procedure Set_Line_Attributes
(Data : access Gtk_Plot_Data_Record;
Style : Plot_Line_Style;
Width : Gfloat;
Color : Gdk.Color.Gdk_Color)
is
procedure Internal
(Data : System.Address;
Style : Gint;
Width : Gfloat;
Color : System.Address);
pragma Import (C, Internal, "gtk_plot_data_set_line_attributes");
C : aliased Gdk_Color := Color;
begin
Internal (Get_Object (Data), Plot_Line_Style'Pos (Style), Width,
C'Address);
end Set_Line_Attributes;
-------------------------
-- Get_Line_Attributes --
-------------------------
procedure Get_Line_Attributes
(Data : access Gtk_Plot_Data_Record;
Style : out Plot_Line_Style;
Width : out Gfloat;
Color : out Gdk.Color.Gdk_Color)
is
procedure Internal
(Data : System.Address;
Style : out Plot_Line_Style;
Width : out Gfloat;
Color : System.Address);
pragma Import (C, Internal, "gtk_plot_data_get_line_attributes");
C : aliased Gdk_Color;
begin
Internal (Get_Object (Data), Style, Width, C'Address);
Color := C;
end Get_Line_Attributes;
----------------------
-- Set_X_Attributes --
----------------------
procedure Set_X_Attributes
(Data : access Gtk_Plot_Data_Record;
Style : Plot_Line_Style;
Width : Gfloat;
Color : Gdk.Color.Gdk_Color)
is
procedure Internal
(Data : System.Address;
Style : Gint;
Width : Gfloat;
Color : System.Address);
pragma Import (C, Internal, "gtk_plot_data_set_x_attributes");
C : aliased Gdk_Color := Color;
begin
Internal (Get_Object (Data), Plot_Line_Style'Pos (Style), Width,
C'Address);
end Set_X_Attributes;
----------------------
-- Set_Y_Attributes --
----------------------
procedure Set_Y_Attributes
(Data : access Gtk_Plot_Data_Record;
Style : Plot_Line_Style;
Width : Gfloat;
Color : Gdk.Color.Gdk_Color)
is
procedure Internal
(Data : System.Address;
Style : Gint;
Width : Gfloat;
Color : System.Address);
pragma Import (C, Internal, "gtk_plot_data_set_y_attributes");
C : aliased Gdk_Color := Color;
begin
Internal (Get_Object (Data), Plot_Line_Style'Pos (Style), Width,
C'Address);
end Set_Y_Attributes;
----------------------
-- Set_Z_Attributes --
----------------------
procedure Set_Z_Attributes
(Data : access Gtk_Plot_Data_Record;
Style : Plot_Line_Style;
Width : Gfloat;
Color : Gdk.Color.Gdk_Color)
is
procedure Internal
(Data : System.Address;
Style : Gint;
Width : Gfloat;
Color : System.Address);
pragma Import (C, Internal, "gtk_plot_data_set_z_attributes");
C : aliased Gdk_Color := Color;
begin
Internal (Get_Object (Data), Plot_Line_Style'Pos (Style), Width,
C'Address);
end Set_Z_Attributes;
-------------------
-- Show_Xerrbars --
-------------------
procedure Show_Xerrbars (Data : access Gtk_Plot_Data_Record) is
procedure Internal (Data : System.Address);
pragma Import (C, Internal, "gtk_plot_data_show_xerrbars");
begin
Internal (Get_Object (Data));
end Show_Xerrbars;
-------------------
-- Show_Yerrbars --
-------------------
procedure Show_Yerrbars (Data : access Gtk_Plot_Data_Record) is
procedure Internal (Data : System.Address);
pragma Import (C, Internal, "gtk_plot_data_show_yerrbars");
begin
Internal (Get_Object (Data));
end Show_Yerrbars;
-------------------
-- Show_Zerrbars --
-------------------
procedure Show_Zerrbars (Data : access Gtk_Plot_Data_Record) is
procedure Internal (Data : System.Address);
pragma Import (C, Internal, "gtk_plot_data_show_zerrbars");
begin
Internal (Get_Object (Data));
end Show_Zerrbars;
-------------------
-- Hide_Xerrbars --
-------------------
procedure Hide_Xerrbars (Data : access Gtk_Plot_Data_Record) is
procedure Internal (Data : System.Address);
pragma Import (C, Internal, "gtk_plot_data_hide_xerrbars");
begin
Internal (Get_Object (Data));
end Hide_Xerrbars;
-------------------
-- Hide_Yerrbars --
-------------------
procedure Hide_Yerrbars (Data : access Gtk_Plot_Data_Record) is
procedure Internal (Data : System.Address);
pragma Import (C, Internal, "gtk_plot_data_hide_yerrbars");
begin
Internal (Get_Object (Data));
end Hide_Yerrbars;
-------------------
-- Hide_Zerrbars --
-------------------
procedure Hide_Zerrbars (Data : access Gtk_Plot_Data_Record) is
procedure Internal (Data : System.Address);
pragma Import (C, Internal, "gtk_plot_data_hide_zerrbars");
begin
Internal (Get_Object (Data));
end Hide_Zerrbars;
---------------
-- Fill_Area --
---------------
procedure Fill_Area (Data : access Gtk_Plot_Data_Record; Fill : Boolean) is
procedure Internal (Data : System.Address; Fill : Gint);
pragma Import (C, Internal, "gtk_plot_data_fill_area");
begin
Internal (Get_Object (Data), Boolean'Pos (Fill));
end Fill_Area;
--------------------
-- Area_Is_Filled --
--------------------
function Area_Is_Filled (Data : access Gtk_Plot_Data_Record)
return Boolean
is
function Internal (Data : System.Address) return Gint;
pragma Import (C, Internal, "gtk_plot_data_area_is_filled");
begin
return Boolean'Val (Internal (Get_Object (Data)));
end Area_Is_Filled;
----------------
-- Set_Legend --
----------------
procedure Set_Legend (Data : access Gtk_Plot_Data_Record; Legend : String)
is
procedure Internal (Data : System.Address; Legend : String);
pragma Import (C, Internal, "gtk_plot_data_set_legend");
begin
Internal (Get_Object (Data), Legend & ASCII.NUL);
end Set_Legend;
-----------------
-- Show_Legend --
-----------------
procedure Show_Legend (Data : access Gtk_Plot_Data_Record) is
procedure Internal (Data : System.Address);
pragma Import (C, Internal, "gtk_plot_data_show_legend");
begin
Internal (Get_Object (Data));
end Show_Legend;
-----------------
-- Hide_Legend --
-----------------
procedure Hide_Legend (Data : access Gtk_Plot_Data_Record) is
procedure Internal (Data : System.Address);
pragma Import (C, Internal, "gtk_plot_data_hide_legend");
begin
Internal (Get_Object (Data));
end Hide_Legend;
--------------------------
-- Set_Legend_Precision --
--------------------------
procedure Set_Legend_Precision
(Data : access Gtk_Plot_Data_Record; Precision : Gint)
is
procedure Internal (Data : System.Address; Precision : Gint);
pragma Import (C, Internal, "gtk_plot_data_set_legend_precision");
begin
Internal (Get_Object (Data), Precision);
end Set_Legend_Precision;
--------------------------
-- Get_Legend_Precision --
--------------------------
function Get_Legend_Precision (Data : access Gtk_Plot_Data_Record)
return Gint
is
function Internal (Data : System.Address) return Gint;
pragma Import (C, Internal, "gtk_plot_data_get_legend_precision");
begin
return Internal (Get_Object (Data));
end Get_Legend_Precision;
-----------------------
-- Set_Gradient_Mask --
-----------------------
procedure Set_Gradient_Mask
(Data : access Gtk_Plot_Data_Record; Mask : Plot_Gradient)
is
procedure Internal (Data : System.Address; Mask : Gint);
pragma Import (C, Internal, "gtk_plot_data_set_gradient_mask");
begin
Internal (Get_Object (Data), Plot_Gradient'Pos (Mask));
end Set_Gradient_Mask;
-----------------------
-- Get_Gradient_Mask --
-----------------------
function Get_Gradient_Mask (Data : access Gtk_Plot_Data_Record)
return Plot_Gradient
is
function Internal (Data : System.Address) return Gint;
pragma Import (C, Internal, "gtk_plot_data_get_gradient_mask");
begin
return Plot_Gradient'Val (Internal (Get_Object (Data)));
end Get_Gradient_Mask;
--------------------------
-- Gradient_Set_Visible --
--------------------------
procedure Gradient_Set_Visible
(Data : access Gtk_Plot_Data_Record; Visible : Boolean)
is
procedure Internal (Data : System.Address; Visible : Gint);
pragma Import (C, Internal, "gtk_plot_data_gradient_set_visible");
begin
Internal (Get_Object (Data), Boolean'Pos (Visible));
end Gradient_Set_Visible;
----------------------
-- Gradient_Visible --
----------------------
function Gradient_Visible (Data : access Gtk_Plot_Data_Record)
return Boolean
is
function Internal (Data : System.Address) return Gint;
pragma Import (C, Internal, "gtk_plot_data_gradient_visible");
begin
return Boolean'Val (Internal (Get_Object (Data)));
end Gradient_Visible;
-------------------------
-- Set_Gradient_Colors --
-------------------------
procedure Set_Gradient_Colors
(Data : access Gtk_Plot_Data_Record;
Min, Max : Gdk.Color.Gdk_Color)
is
procedure Internal (Data, Min, Max : System.Address);
pragma Import (C, Internal, "gtk_plot_data_set_gradient_colors");
Mi : aliased Gdk_Color := Min;
Ma : aliased Gdk_Color := Max;
begin
Internal (Get_Object (Data), Mi'Address, Ma'Address);
end Set_Gradient_Colors;
-------------------------
-- Get_Gradient_Colors --
-------------------------
procedure Get_Gradient_Colors
(Data : access Gtk_Plot_Data_Record;
Min, Max : out Gdk.Color.Gdk_Color)
is
procedure Internal (Data, Min, Max : System.Address);
pragma Import (C, Internal, "gtk_plot_data_get_gradient_colors");
Mi, Ma : aliased Gdk_Color;
begin
Internal (Get_Object (Data), Mi'Address, Ma'Address);
Min := Mi;
Max := Ma;
end Get_Gradient_Colors;
------------------
-- Set_Gradient --
------------------
procedure Set_Gradient
(Data : access Gtk_Plot_Data_Record;
Min, Max : Gdouble;
Nlevels : Gint)
is
procedure Internal (Data : System.Address; Min, Max : Gdouble; N : Gint);
pragma Import (C, Internal, "gtk_plot_data_set_gradient");
begin
Internal (Get_Object (Data), Min, Max, Nlevels);
end Set_Gradient;
------------------
-- Get_Gradient --
------------------
procedure Get_Gradient
(Data : access Gtk_Plot_Data_Record;
Min, Max : out Gdouble;
Nlevels : out Gint)
is
procedure Internal (Data : System.Address;
Min, Max : out Gdouble;
N : out Gint);
pragma Import (C, Internal, "gtk_plot_data_get_gradient");
begin
Internal (Get_Object (Data), Min, Max, Nlevels);
end Get_Gradient;
------------------------
-- Get_Gradient_Level --
------------------------
procedure Get_Gradient_Level
(Data : access Gtk_Plot_Data_Record;
Level : Gdouble;
Color : out Gdk.Color.Gdk_Color)
is
procedure Internal (Data : System.Address;
Level : Gdouble;
Color : System.Address);
pragma Import (C, Internal, "gtk_plot_data_get_gradient_level");
C : aliased Gdk_Color;
begin
Internal (Get_Object (Data), Level, C'Address);
Color := C;
end Get_Gradient_Level;
--------------
-- Set_Link --
--------------
procedure Set_Link
(Data : access Gtk_Plot_Data_Record;
Link : System.Address)
is
procedure Internal (Data, Link : System.Address);
pragma Import (C, Internal, "gtk_plot_data_set_link");
begin
Internal (Get_Object (Data), Link);
end Set_Link;
--------------
-- Get_Link --
--------------
function Get_Link (Data : access Gtk_Plot_Data_Record)
return System.Address
is
function Internal (Data : System.Address) return System.Address;
pragma Import (C, Internal, "gtk_plot_data_get_link");
begin
return Internal (Get_Object (Data));
end Get_Link;
-----------------
-- Remove_Link --
-----------------
procedure Remove_Link (Data : access Gtk_Plot_Data_Record) is
procedure Internal (Data : System.Address);
pragma Import (C, Internal, "gtk_plot_data_remove_link");
begin
Internal (Get_Object (Data));
end Remove_Link;
end Gtk.Extra.Plot_Data;
-----------------------------------------------------------------------
-- GtkAda - Ada95 binding for the Gimp Toolkit --
-- --
-- Copyright (C) 2000 --
-- Emmanuel Briot, Joel Brobecker and Arnaud Charlet --
-- --
-- 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. --
-- --
-- As a special exception, if other files instantiate generics from --
-- this unit, or you link this unit with other files to produce an --
-- executable, this unit does not by itself cause the resulting --
-- executable to be covered by the GNU General Public License. This --
-- exception does not however invalidate any other reasons why the --
-- executable file might be covered by the GNU Public License. --
-----------------------------------------------------------------------
-- <description>
-- This package defines the root of the plot hierarchy. It defines several
-- display strategies that can be used to show scientific data on the
-- screen (see the children for 3D, polar, bars,...)
--
-- All coordinates are in percent of the total size allocates for the data
-- set (ie the actual position is (x * width, y * height), where (x, y) is
-- the value stored in the data set and (width, height) its allocated screen
-- size.
-- </description>
-- <c_version>gtk+extra 0.99.14<c_version>
with Glib; use Glib;
with Gtk.Widget;
with Gtkada.Types;
with Gdk.Color;
with Unchecked_Conversion;
package Gtk.Extra.Plot_Data is
type Gtk_Plot_Data_Record is new Gtk.Widget.Gtk_Widget_Record with private;
type Gtk_Plot_Data is access all Gtk_Plot_Data_Record'Class;
-- A set of values that can be represented on the screen. There are
-- several strategies to set the values, either explicitely in your
-- application, or by having them automatically generated by a function.
-----------
-- Types --
-----------
type No_Range_Gdouble_Array is array (Natural) of Gdouble;
-- An array of values.
-- This is used to represent the data values displayed in the plot.
-- This array does not have any range information (so that it can be
-- easily returned from a C function, without requiring an extra
-- copy of the table). You can not use 'Range on this array.
type No_Range_Gdouble_Array_Access is access all No_Range_Gdouble_Array;
-- An access to a flat array.
type Gdouble_Array_Access is access all Glib.Gdouble_Array;
-- The reason we use this type in the functions below is because
-- gtk+-extra does not keep a copy of the arrays, but points to the one
-- given in argument. Thus, the Ada arrays should not be allocated on the
-- stack, or at least they should be at library level. Using this 'Access
-- will force the compiler to do the check for us.
type Points_Array is record
Points : No_Range_Gdouble_Array_Access;
Num_Points : Gint := 0;
end record;
-- The points are indexed from 0 to Num_Points-1.
-- Note that you can't use 'Range, 'First or 'Last on Points.
type Plot_Connector is (Connect_None,
-- No connection
Connect_Straight,
-- straight line
Connect_Spline,
-- spline or Bezier curve
Connect_Hv_Step,
-- Horizontal then vertical
Connect_Vh_Step,
-- Vertical then horizontal
Connect_Middle_Step
-- Split in the middle
);
-- The type of connection between two adjacent points in a graph.
type Plot_Gradient is new Integer;
-- Indicate which color components vary along the gradient
Gradient_H : constant Plot_Gradient; -- Hue
Gradient_V : constant Plot_Gradient; -- Value
Gradient_S : constant Plot_Gradient; -- Saturation
type Plot_Symbol_Type is (Symbol_None,
Symbol_Square,
Symbol_Circle,
Symbol_Up_Triangle,
Symbol_Down_Triangle,
Symbol_Right_Triangle,
Symbol_Left_Triangle,
Symbol_Diamond,
Symbol_Plus,
Symbol_Cross,
Symbol_Star,
Symbol_Dot,
Symbol_Impulse);
-- Type of symbol used to represent the points in a graph.
type Plot_Symbol_Style is (Symbol_Empty,
Symbol_Filled,
Symbol_Opaque);
-- Style used to draw the points in a graph.
type Plot_Line_Style is (Line_None,
Line_Solid,
Line_Dotted,
Line_Dashed,
Line_Dot_Dash,
Line_Dot_Dot_Dash,
Line_Dot_Dash_Dash);
-- Lines used to connect two adjacent points in a graph.
--------------------
-- Plot functions --
--------------------
-- Plot functions should generate a unique Y value given a parameter.
-- These can be used for instance to represent exactly mathematical
-- functions.
-- Note that due to the C interface, the subprograms in Gtk.Extra.Plot and
-- in this package expect functions that take a System.Address as a
-- parameter. However, since it is much more convenient in your application
-- to get a Gtk_Plot_Record directly, GtkAda includes a generic function
-- that automatically does the conversion for you (see
-- Gtk.Plot.Generic_Plot_Function).
type Plot_Function is access function
(Plot : System.Address;
Set : Gtk_Plot_Data;
X : Gdouble;
Error : access Gboolean)
return Gdouble;
-- Function used for plotting.
-- It should return the value associated with X in its graph, and set
-- Error to True if there was an error while calculating the value.
pragma Convention (C, Plot_Function);
-------------------------
-- Creating a Data set --
-------------------------
procedure Gtk_New (Data : out Gtk_Plot_Data; Func : Plot_Function := null);
-- Creates a new data set. Its values can either be generated automatically
-- from Func, or will have to be set explicitely using the other
-- subprograms in this package.
procedure Initialize
(Data : access Gtk_Plot_Data_Record'Class; Func : Plot_Function := null);
-- Internal initialization function.
-- See the section "Creating your own widgets" in the documentation.
function Get_Type return Gtk.Gtk_Type;
-- Return the internal value associated with a Gtk_Plot_Data.
procedure Set_Name (Data : access Gtk_Plot_Data_Record; Name : String);
-- Set the name used internally for that dataset.
-- This name does not appear anywhere on the screen, but it is easier to
-- find the dataset afterward by using this name.
-------------------
-- Drawing a set --
-------------------
-- Although a set is basically a list of values, it is closely associated
-- with its representation on the screen (see the children of Gtk_Plot_Data
-- for various possible representations).
-- The Gtk.Extra packages are designed so that the drawing can be done
-- either to the screen (through a Gdk adapter), to a postscript file for
-- easy printing, or to any other media.
procedure Paint (Data : access Gtk_Plot_Data_Record);
-- Emits the "draw_data" signal to request a redrawing of the data set.
procedure Draw_Points (Data : access Gtk_Plot_Data_Record; N : Gint);
-- Draw at most N values of the Data set on the screen. If N is greater
-- than the actual number of values in Data, then they are all displayed.
procedure Draw_Symbol (Data : access Gtk_Plot_Data_Record; X, Y : Gdouble);
-- Draw the current symbol (see Set_Symbol) at specific coordinates on
-- the screen.
-------------------------
-- Manipulating values --
-------------------------
procedure Set_Points
(Data : access Gtk_Plot_Data_Record;
X : Gdouble_Array_Access;
Y : Gdouble_Array_Access;
Dx : Gdouble_Array_Access;
Dy : Gdouble_Array_Access);
-- Set some explicit points in the set.
-- Note that the set must not be associated with a function, or the points
-- will simply be ignored.
-- All of the arrays must have the same length, the behavior is undefined
-- otherwise.
-- X and Y are the list of coordinates of the points.
-- Dx and Dy are the list of size (precision) of these points. A bigger
-- symbol will be displayed for the point whose (Dx, Dy) value is bigger.
procedure Get_Points
(Data : access Gtk_Plot_Data_Record;
X : out Points_Array;
Y : out Points_Array;
Dx : out Points_Array;
Dy : out Points_Array);
-- Return the value of the points in the set.
-- Null-length arrays are returned if the set is associated with a
-- function, since no explicit point has been set.
-- See Set_Points for a definition of X, Y, Dx and Dy.
procedure Set_X
(Data : access Gtk_Plot_Data_Record; X : Gdouble_Array_Access);
procedure Set_Y
(Data : access Gtk_Plot_Data_Record; Y : Gdouble_Array_Access);
procedure Set_Z
(Data : access Gtk_Plot_Data_Record; Z : Gdouble_Array_Access);
procedure Set_A
(Data : access Gtk_Plot_Data_Record; A : Gdouble_Array_Access);
-- Set the values for one specific coordinate in the set.
-- The array must have a length of Get_Numpoints (if GtkAda was
-- compiled with assertions enabled, an exception will be raised if the
-- length are different).
-- No copy of the array is made for efficiency reasons, thus modifying
-- the array content later on will also modify the plot.
--
-- "A" is used to specify the size of the symbols. When plotting boxes in
-- two dimensions, "Z" is used to specify the size of the box.
procedure Set_Dx
(Data : access Gtk_Plot_Data_Record; Dx : Gdouble_Array_Access);
procedure Set_Dy
(Data : access Gtk_Plot_Data_Record; Dy : Gdouble_Array_Access);
procedure Set_Dz
(Data : access Gtk_Plot_Data_Record; Dz : Gdouble_Array_Access);
-- Set the precision of the points in the set. A bigger symbol is displayed
-- for the points whose (Dx, Dy, Dz) is bigger.
-- The array must have a length of Get_Numpoints (if GtkAda was
-- compiled with assertions enabled, an exception will be raised if the
-- length are different).
-- No copy of the array is made for efficiency reasons, thus modifying
-- the array content later on will also modify the plot.
procedure Set_Da
(Data : access Gtk_Plot_Data_Record; Da : Gdouble_Array_Access);
-- Specifies the colors to use for the points.
-- The color of the symbols is detemined using the gradient. the gradient
-- has (min, max) values, and corresponding colors. The symbol's color is
-- interpolated between these values using hue/saturation/value depending
-- on the gradient_mask.
function Get_X (Data : access Gtk_Plot_Data_Record) return Points_Array;
function Get_Y (Data : access Gtk_Plot_Data_Record) return Points_Array;
function Get_Z (Data : access Gtk_Plot_Data_Record) return Points_Array;
function Get_A (Data : access Gtk_Plot_Data_Record) return Points_Array;
function Get_Dx (Data : access Gtk_Plot_Data_Record) return Points_Array;
function Get_Dy (Data : access Gtk_Plot_Data_Record) return Points_Array;
function Get_Dz (Data : access Gtk_Plot_Data_Record) return Points_Array;
function Get_Da (Data : access Gtk_Plot_Data_Record) return Points_Array;
-- Return the coordinates for the points in the set.
-- This is a direct access to the underlying C array, thus modifying this
-- array's contents also modifies the graph.
-- See the corresponding Set_* functions for a definition of the
-- coordinates
procedure Set_Numpoints (Data : access Gtk_Plot_Data_Record; Num : Gint);
-- Set the number of points that should be expected in the graph.
-- Note that this does not automatically resize all the internal structure,
-- it just indicates what size the parameters to Set_X, Set_Y,... should
-- have.
function Get_Numpoints (Data : access Gtk_Plot_Data_Record) return Gint;
-- Return the number of points expected in the graph.
------------
-- Labels --
------------
-- Each point in the data set can be associated with a label that describes
-- it. This is only relevant for data sets where you explicitely give
-- values, not when the values are generated by a function.
procedure Set_Labels
(Data : access Gtk_Plot_Data_Record;
Labels : Gtkada.Types.Chars_Ptr_Array);
-- Set the labels associated which each point in the canvas.
-- There must be at least Get_Numpoints elements in Labels, or the
-- behavior is undefined
function Get_Labels (Data : access Gtk_Plot_Data_Record)
return Gtkada.Types.Chars_Ptr_Array;
-- Return the labels associated with the points in the data set.
-- Note that this returns a *copy* of the actual array, and thus might
-- be expensive to call.
procedure Show_Labels (Data : access Gtk_Plot_Data_Record; Show : Boolean);
-- Indicate whether the labels should be displayed next to each point in
-- the data set. This has no effect if no labels were specified.
procedure Labels_Set_Attributes
(Data : access Gtk_Plot_Data_Record;
Font : String;
Height : Gint;
Angle : Gint;
Foreground : Gdk.Color.Gdk_Color;
Background : Gdk.Color.Gdk_Color);
-- Set the properties of the labels
----------------------------
-- Symbols and Connectors --
----------------------------
-- Each point that is explicitely set in the data set through the
-- Set_X, Set_Y,... subprograms is visually associated with a symbol. There
-- are several representations for the symbols.
--
-- All these symbols are then connected by a line, a curve or any other
-- link. These are called connectors.
--
-- Each symbol, in addition to being connected to the next one with a
-- connector, can also be linked to the axis X=0, Y=0 or Z=0 so that it is
-- easier to read its coordinates. These are called errbars, and they must
-- be explicitely shown.
procedure Set_Symbol
(Data : access Gtk_Plot_Data_Record;
The_Type : Plot_Symbol_Type;
Style : Plot_Symbol_Style;
Size : Gint;
Line_Width : Gfloat;
Color : Gdk.Color.Gdk_Color;
Border_Color : Gdk.Color.Gdk_Color);
-- Set the visual aspect of the symbols.
procedure Get_Symbol
(Data : access Gtk_Plot_Data_Record;
The_Type : out Plot_Symbol_Type;
Style : out Plot_Symbol_Style;
Size : out Gint;
Line_Width : out Gint;
Color : out Gdk.Color.Gdk_Color;
Border_Color : out Gdk.Color.Gdk_Color);
-- Return the visual characteristics of the symbols.
procedure Set_Connector
(Data : access Gtk_Plot_Data_Record; Connector : Plot_Connector);
-- Set the style of the connectors.
function Get_Connector (Data : access Gtk_Plot_Data_Record)
return Plot_Connector;
-- Return the connector style used for the data set.
procedure Set_Line_Attributes
(Data : access Gtk_Plot_Data_Record;
Style : Plot_Line_Style;
Width : Gfloat;
Color : Gdk.Color.Gdk_Color);
-- Set the line style used for the connectors.
procedure Get_Line_Attributes
(Data : access Gtk_Plot_Data_Record;
Style : out Plot_Line_Style;
Width : out Gfloat;
Color : out Gdk.Color.Gdk_Color);
-- Return the line attributes used for the connectors.
procedure Set_X_Attributes
(Data : access Gtk_Plot_Data_Record;
Style : Plot_Line_Style;
Width : Gfloat;
Color : Gdk.Color.Gdk_Color);
-- Set the style of the lines used to connect the symbols to the X axis.
procedure Set_Y_Attributes
(Data : access Gtk_Plot_Data_Record;
Style : Plot_Line_Style;
Width : Gfloat;
Color : Gdk.Color.Gdk_Color);
-- Set the style of the lines used to connect the symbols to the Y axis.
procedure Set_Z_Attributes
(Data : access Gtk_Plot_Data_Record;
Style : Plot_Line_Style;
Width : Gfloat;
Color : Gdk.Color.Gdk_Color);
-- Set the style of the lines used to connect the symbols to the Z axis.
procedure Show_Xerrbars (Data : access Gtk_Plot_Data_Record);
procedure Show_Yerrbars (Data : access Gtk_Plot_Data_Record);
procedure Show_Zerrbars (Data : access Gtk_Plot_Data_Record);
-- Indicate that each symbol should be connected to the various axis
procedure Hide_Xerrbars (Data : access Gtk_Plot_Data_Record);
procedure Hide_Yerrbars (Data : access Gtk_Plot_Data_Record);
procedure Hide_Zerrbars (Data : access Gtk_Plot_Data_Record);
-- Indicate the the symbol should not be connected to the axis.
procedure Fill_Area (Data : access Gtk_Plot_Data_Record; Fill : Boolean);
-- Indicate whether the area between two points should be filled or not.
function Area_Is_Filled (Data : access Gtk_Plot_Data_Record)
return Boolean;
-- Indicate whether the area between two points is filled.
-------------
-- Legends --
-------------
-- In addition to the drawing corresponding to the data set, it is possible
-- to display a box that contains a legend. This is particulary useful when
-- multiple data sets are displayed on the same plot.
procedure Set_Legend (Data : access Gtk_Plot_Data_Record; Legend : String);
-- Set the string printed in the legend for that data set.
-- Note that an entry can exist in the legend even if there is no name
-- associated with the graph.
procedure Show_Legend (Data : access Gtk_Plot_Data_Record);
-- An entry will be made in the plot's legend for that dataset.
procedure Hide_Legend (Data : access Gtk_Plot_Data_Record);
-- No entry will appear in the plot's legend for that dataset.
procedure Set_Legend_Precision
(Data : access Gtk_Plot_Data_Record; Precision : Gint);
-- Number of digits to display when the legends is associated with values,
-- as is the case for gradients.
function Get_Legend_Precision (Data : access Gtk_Plot_Data_Record)
return Gint;
-- Return the number of digits used for values in the legend
---------------
-- Gradients --
---------------
-- The symbols displayed in the plot can be assigned specific colors. But
-- they can also compute their own color by picking it in a gradient,
-- depending on the value.
procedure Set_Gradient_Mask
(Data : access Gtk_Plot_Data_Record; Mask : Plot_Gradient);
-- Indicates which component of the colors vary along the gradient.
function Get_Gradient_Mask (Data : access Gtk_Plot_Data_Record)
return Plot_Gradient;
-- Return the mask used for the gradient.
procedure Gradient_Set_Visible
(Data : access Gtk_Plot_Data_Record; Visible : Boolean);
-- Indicates whether the gradient should be visible
function Gradient_Visible (Data : access Gtk_Plot_Data_Record)
return Boolean;
-- Return True if the gradient is currently visible
procedure Set_Gradient_Colors
(Data : access Gtk_Plot_Data_Record;
Min, Max : Gdk.Color.Gdk_Color);
-- Set the colors that define the gradient. The colors will vary from
-- Min to Max along the components specified in Set_Gradient_Mask.
procedure Get_Gradient_Colors
(Data : access Gtk_Plot_Data_Record;
Min, Max : out Gdk.Color.Gdk_Color);
-- Return the colors that define the range
procedure Set_Gradient
(Data : access Gtk_Plot_Data_Record;
Min, Max : Gdouble;
Nlevels : Gint);
-- Define the values associated with the minimal color and the maximal
-- color. Any value in between will have a color computed in between.
-- Nlevels is the number of ticks to display in the gradient.
procedure Get_Gradient
(Data : access Gtk_Plot_Data_Record;
Min, Max : out Gdouble;
Nlevels : out Gint);
-- Return the values associated with the minimal and maximal colors.
procedure Get_Gradient_Level
(Data : access Gtk_Plot_Data_Record;
Level : Gdouble;
Color : out Gdk.Color.Gdk_Color);
-- Return the color associated with a specific level.
-- The color depends on the parameters to Set_Gradient and
-- Set_Gradient_Colors.
---------------
-- User Data --
---------------
-- It is possible to associated your own user data with a plot. This is
-- the mechanism provided by the C version of gtkextra. However, the best
-- way to do this in Ada is to inherit from Gtk_Plot_Data_Record (or one
-- of its children), and add your own fields.
procedure Set_Link
(Data : access Gtk_Plot_Data_Record;
Link : System.Address);
-- Associate some user data with Data.
-- It is the responsability of the user to do some convert conversion to
-- System.Address.
function Get_Link (Data : access Gtk_Plot_Data_Record)
return System.Address;
-- Return the user data associated with Data, or Null_Address if there is
-- none.
procedure Remove_Link (Data : access Gtk_Plot_Data_Record);
-- Remove the user data associated with Data.
-- <doc_ignore>
function To_Double_Array is new Unchecked_Conversion
(System.Address, No_Range_Gdouble_Array_Access);
-- </doc_ignore>
private
type Gtk_Plot_Data_Record is new Gtk.Widget.Gtk_Widget_Record with
null record;
Gradient_H : constant Plot_Gradient := 1;
Gradient_V : constant Plot_Gradient := 2;
Gradient_S : constant Plot_Gradient := 4;
pragma Import (C, Get_Type, "gtk_plot_data_get_type");
end Gtk.Extra.Plot_Data;
-----------------------------------------------------------------------
-- GtkAda - Ada95 binding for the Gimp Toolkit --
-- --
-- Copyright (C) 2000 --
-- Emmanuel Briot, Joel Brobecker and Arnaud Charlet --
-- --
-- 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. --
-- --
-- As a special exception, if other files instantiate generics from --
-- this unit, or you link this unit with other files to produce an --
-- executable, this unit does not by itself cause the resulting --
-- executable to be covered by the GNU General Public License. This --
-- exception does not however invalidate any other reasons why the --
-- executable file might be covered by the GNU Public License. --
-----------------------------------------------------------------------
-- <description>
-- This is the top level package of the Gtk.Extra widget hierarchy.
-- </description>
package Gtk.Extra is
end Gtk.Extra;
-----------------------------------------------------------------------
-- GtkAda - Ada95 binding for the Gimp Toolkit --
-- --
-- Copyright (C) 1998-2001 --
-- Emmanuel Briot, Joel Brobecker and Arnaud Charlet --
-- --
-- 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. --
-- --
-- As a special exception, if other files instantiate generics from --
-- this unit, or you link this unit with other files to produce an --
-- executable, this unit does not by itself cause the resulting --
-- executable to be covered by the GNU General Public License. This --
-- exception does not however invalidate any other reasons why the --
-- executable file might be covered by the GNU Public License. --
-----------------------------------------------------------------------
-- <description>
--
-- This package provides some basic Gtk+ functionalities such as getting the
-- version number. This is the top level package of the Gtk widget hierarchy.
-- For general GtkAda initializations, @pxref{Package_Gtk.Main}.
--
-- </description>
-- <c_version>1.2.7</c_version>
with Glib; use Glib;
with Gdk; use Gdk;
with System;
package Gtk is
type Root_Type is tagged private;
-- The base type of the hierarchy in GtkAda. It basically gives access
-- to an underlying C object. This is not a controlled type, for efficiency
-- reasons, and because gtk+ takes care of memory management on its own.
-- <doc_ignore>
type Root_Type_Access is access all Root_Type'Class;
-- </doc_ignore>
type Gtk_Rc_Style is new Gdk.C_Proxy;
-- Type used to handle resource styles.
-- See package Gtk.Rc for more details.
function Major_Version return Guint;
-- Return the major version number for Gtk+.
-- Note that this is not necessarily the same as for GtkAda.
-- If the version is 1.2.6, returns 1.
function Minor_Version return Guint;
-- Return the minor version number for Gtk+.
-- Note that this is not necessarily the same as for GtkAda.
-- If the version is 1.2.6, returns 2.
function Micro_Version return Guint;
-- Return the micro version number for Gtk+.
-- Note that this is not necessarily the same as for GtkAda.
-- If the version is 1.2.6, returns 6.
type Gtk_Type is new Guint;
-- This type describes an internal type in Gtk+.
-- You shouldn't have to use it in your own applications, however it might
-- be useful sometimes.
-- Every widget type is associated with a specific value, created
-- dynamically at run time the first time you instantiate a widget of that
-- type (thus if you have never used a Gtk_File_Selection, it won't have
-- any Gtk_Type associated with it).
-- You can get the exact type value for each type by using the functions
-- Get_Type provided in all the packages in GtkAda.
-- You can get the specific value for an existing widget by using the
-- function Gtk.Object.Get_Type.
Gtk_Type_Invalid : constant Gtk_Type := 0;
Gtk_Type_None : constant Gtk_Type := 1;
Gtk_Type_Char : constant Gtk_Type := 2;
Gtk_Type_Uchar : constant Gtk_Type := 3;
Gtk_Type_Bool : constant Gtk_Type := 4;
Gtk_Type_Int : constant Gtk_Type := 5;
Gtk_Type_Uint : constant Gtk_Type := 6;
Gtk_Type_Long : constant Gtk_Type := 7;
Gtk_Type_Ulong : constant Gtk_Type := 8;
Gtk_Type_Float : constant Gtk_Type := 9;
Gtk_Type_Double : constant Gtk_Type := 10;
Gtk_Type_String : constant Gtk_Type := 11; -- Null terminated string.
Gtk_Type_Enum : constant Gtk_Type := 12;
Gtk_Type_Flags : constant Gtk_Type := 13;
Gtk_Type_Boxed : constant Gtk_Type := 14;
Gtk_Type_Pointer : constant Gtk_Type := 15; -- a general pointer type.
Gtk_Type_Object : constant Gtk_Type := 21; -- One of the widgets/objects
type Gtk_Notebook_Page is new Gdk.C_Proxy;
-- A page of the notebook.
-- It can contain a single child, and is also associated with a tab
-- label used to select that page in the notebook.
function Gtk_Type_Gdk_Event return Gtk_Type;
-- Return the type corresponding to a Gdk_Event.
-- Note that this function must be called after Gtk+ has been initialized.
function Type_Name (Type_Num : in Gtk_Type) return String;
-- Return the type name corresponding to a Gtk_Type.
-- This might be useful in debug messages.
function Type_From_Name (Name : in String) return Gtk_Type;
-- Convert a string to the matching type.
-- Name should be the C widget's name, such as GtkScrollbar or GtkButton,
-- rather than the Ada name.
function Is_Created (Object : in Root_Type'Class) return Boolean;
-- Return True if the associated C object has been created, False if no
-- C object is associated with Object.
-- This is not the same as testing whether an access type (for instance
-- any of the widgets) is "null", since this relates to the underlying
-- C object.
------------------------
-- Interfacing with C --
------------------------
-- The following functions are made public so that one can easily create
-- new widgets outside the Gtk package hierarchy.
-- Only experienced users should make use of these functions.
function Get_Object (Object : access Root_Type'Class) return System.Address;
-- Access the underlying C pointer.
procedure Set_Object
(Object : access Root_Type'Class;
Value : in System.Address);
-- Modify the underlying C pointer.
procedure Initialize_User_Data (Obj : access Root_Type'Class);
-- Sets a user data field for the C object associated with Obj.
-- This field will be used so that it is possible, knowing a
-- C object, to get the full ada object.
function Get_User_Data
(Obj : in System.Address;
Stub : in Root_Type'Class) return Root_Type_Access;
-- Get the user data that was set by GtkAda.
-- If the Data is not set, return a new access type, that points to
-- a structure with the same tag as Stub.
function Unchecked_Cast
(Obj : access Root_Type'Class;
Stub : Root_Type'Class) return Root_Type_Access;
-- Cast Obj in an object of tag Stub'Class.
-- Return the resulting object and free the memory pointed by Obj.
function Count_Arguments
(The_Type : Gtk_Type; Name : in String) return Guint;
-- Return the number of arguments used in the handlers for the signal.
-- Note that in the Connect functions, we always test whether the user
-- has asked for *at most* the number of arguments defined by gtk+ for the
-- callback. This is because having less argument is authorized (the
-- extra parameters passed by gtk+ will simply be ignored), whereas having
-- more arguments is impossible (they would never be set).
-- Note that we provide this procedure here to avoid circularities.
function Argument_Type
(The_Type : Gtk_Type;
Name : in String;
Num : in Gint) return Gtk_Type;
-- Return the type of the num-th argument for the handlers of signal name.
-- If Num is negative, return the type returned by the handlers for this
-- signal.
-- Note that we provide this procedure here to avoid circularities.
private
type Root_Type is tagged record
Ptr : System.Address := System.Null_Address;
end record;
-- <doc_ignore>
-- Note: the following functions and types should only be used
-- for internal usage, not in the user's applications.
-- If you use type inheritance for new widgets, you should not need
-- these functions.
GtkAda_String : constant String := "_GtkAda" & ASCII.NUL;
GtkAda_String_Quark : Glib.GQuark := Glib.Unknown_Quark;
-- The name for the user data that we set in the objects.
-- The Quark version is to speed up the string lookup (this is done
-- only once).
function Conversion_Function
(Obj : System.Address; Stub : Root_Type'Class) return Root_Type_Access;
-- This function has to convert a C object to an Ada object.
-- It will first try all the registered functions (in
-- Gtk.Type_Conversion_Hooks) and by default, will create a Stub'Class
-- object, no matter what the real C type is.
-- Stub is the expected type.
-- </doc_ignore>
pragma Inline (Get_Object);
pragma Inline (Set_Object);
pragma Import (C, Major_Version, "ada_gtk_major_version");
pragma Import (C, Minor_Version, "ada_gtk_minor_version");
pragma Import (C, Micro_Version, "ada_gtk_micro_version");
pragma Import (C, Gtk_Type_Gdk_Event, "ada_gtk_type_gdk_event");
end Gtk;
-----------------------------------------------------------------------
-- GtkAda - Ada95 binding for the Gimp Toolkit --
-- --
-- Copyright (C) 1998-2000 --
-- Emmanuel Briot, Joel Brobecker and Arnaud Charlet --
-- --
-- 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. --
-- --
-- As a special exception, if other files instantiate generics from --
-- this unit, or you link this unit with other files to produce an --
-- executable, this unit does not by itself cause the resulting --
-- executable to be covered by the GNU General Public License. This --
-- exception does not however invalidate any other reasons why the --
-- executable file might be covered by the GNU Public License. --
-----------------------------------------------------------------------
-- <description>
--
-- This package provides definitions for the basic types used in Glib,
-- Gdk and Gtk.
--
-- </description>
with Ada.Unchecked_Deallocation;
with Ada.Unchecked_Conversion;
with System;
with Interfaces.C;
package Glib is
pragma Preelaborate;
package C renames Interfaces.C;
use type C.int;
use type C.unsigned;
-------------------------------------
-- The basic types defined by glib --
-------------------------------------
type Gshort is new C.short;
type Glong is new C.long;
type Gint is new C.int;
type Gchar is new C.char;
type Gboolean is new Gint;
type Gushort is new C.unsigned_short;
type Gulong is new C.unsigned_long;
type Guint is new C.unsigned;
type Guchar is new C.unsigned_char;
type Gfloat is new C.C_float;
type Gdouble is new C.double;
subtype Gint8 is Gint range -(2 ** 7) .. (2 ** 7 - 1);
subtype Gint16 is Gint range -(2 ** 15) .. (2 ** 15 - 1);
subtype Gint32 is Gint range -(2 ** 31) .. (2 ** 31 - 1);
subtype Guint8 is Guint range Guint'First .. (2 ** 8 - 1);
subtype Guint16 is Guint range Guint'First .. (2 ** 16 - 1);
subtype Guint32 is Guint range Guint'First .. (2 ** 32 - 1);
----------------------
-- Some Array types --
----------------------
type Gboolean_Array is array (Natural range <>) of Gboolean;
type Gshort_Array is array (Natural range <>) of Gshort;
type Glong_Array is array (Natural range <>) of Glong;
type Gint_Array is array (Natural range <>) of Gint;
type Guint_Array is array (Natural range <>) of Guint;
type Guint32_Array is array (Natural range <>) of Guint32;
type Gushort_Array is array (Natural range <>) of Gushort;
type Gulong_Array is array (Natural range <>) of Gulong;
type Gfloat_Array is array (Natural range <>) of Gfloat;
type Guchar_Array is array (Natural range <>) of Guchar;
type Gdouble_Array is array (Natural range <>) of Gdouble;
type Boolean_Array is array (Natural range <>) of Boolean;
type Short_Array is array (Natural range <>) of C.short;
type Long_Array is array (Natural range <>) of C.long;
-------------------------
-- Conversion services --
-------------------------
function To_Boolean_Array (A : in Gboolean_Array) return Boolean_Array;
-- Convert a C-style boolean array into an Ada-style array.
function To_Boolean (Value : in Gboolean) return Boolean;
-- Convert a C boolean into an Ada boolean.
function To_Boolean (Value : in Gint) return Boolean;
-- Convert a C int into an Ada boolean.
function To_Boolean (Value : in Guint) return Boolean;
-- Convert a C uint into an Ada boolean.
function To_Gboolean (Bool : in Boolean) return Gboolean;
-- Convert an Ada boolean into a C boolean.
function To_Gint (Bool : in Boolean) return Gint;
-- Convert an Ada boolean into a C int.
-----------------------
-- Some Access types --
-----------------------
type Guchar_Array_Access is access Guchar_Array;
type String_Ptr is access all String;
-- <doc_ignore>
procedure Free is new Ada.Unchecked_Deallocation
(Object => Guchar_Array, Name => Guchar_Array_Access);
procedure Free is new Ada.Unchecked_Deallocation
(Object => String, Name => String_Ptr);
-- </doc_ignore>
-- <doc_ignore>
type C_Dummy is limited private;
-- </doc_ignore>
type C_Proxy is access C_Dummy;
-- General proxy for C structures.
-- This type is used instead of System.Address so that the variables are
-- automatically initialized to 'null'.
-- The value pointed to is irrelevant, and in fact should not be accessed.
-- It has thus been made limited private with no subprogram to access it.
-- C_Proxy is a public type so that one can compare directly the value
-- of the variables with 'null'.
-- <doc_ignore>
pragma Convention (C, C_Proxy);
function Convert is new Ada.Unchecked_Conversion (System.Address, C_Proxy);
function Convert is new Ada.Unchecked_Conversion (C_Proxy, System.Address);
-- Converts from a System.Address returned by a C function to an
-- internal C_Proxy.
-- </doc_ignore>
------------
-- Quarks --
------------
type GQuark is new Guint32;
-- Represents a string internally in GtkAda. Once you know the
-- equivalent for a string, you can always use it instead of the string,
-- which provides a faster access for all the functions that use htables
-- in GtkAda.
-- There is a global htable that contains all the quarks defined in
-- your application and GtkAda itself.
Unknown_Quark : constant GQuark := 0;
function Quark_From_String (Id : in String) return GQuark;
-- Return, or create the quark associated with the string.
-- Note that if the quark does not already exist, an entry is created for
-- it in the global htable for quarks.
function Quark_Try_String (Id : in String) return GQuark;
-- Return the quark associated with the string, if it exists.
-- If it does not exist, return Unknown_Quark.
private
type C_Dummy is null record;
-- This array can contain anything, since it is never used on the Ada side
-- anyway.
end Glib;
-----------------------------------------------------------------------
-- GtkAda - Ada95 binding for the Gimp Toolkit --
-- --
-- Copyright (C) 1998-2000 --
-- Emmanuel Briot, Joel Brobecker and Arnaud Charlet --
-- --
-- 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. --
-- --
-- As a special exception, if other files instantiate generics from --
-- this unit, or you link this unit with other files to produce an --
-- executable, this unit does not by itself cause the resulting --
-- executable to be covered by the GNU General Public License. This --
-- exception does not however invalidate any other reasons why the --
-- executable file might be covered by the GNU Public License. --
-----------------------------------------------------------------------
-- <description>
--
-- This is the top level package of the Gdk hierarchy.
-- It provides the type definitions used to access underlying C structures.
--
-- </description>
with Glib;
package Gdk is
pragma Preelaborate;
subtype C_Proxy is Glib.C_Proxy;
type Gdk_GC is new C_Proxy;
type Gdk_Window is new C_Proxy;
subtype Gdk_Drawable is Gdk_Window;
subtype Gdk_Pixmap is Gdk_Drawable;
subtype Gdk_Bitmap is Gdk_Drawable;
end Gdk;
-----------------------------------------------------------------------
-- GtkAda - Ada95 binding for the Gimp Toolkit --
-- --
-- Copyright (C) 1998-2000 --
-- Emmanuel Briot, Joel Brobecker and Arnaud Charlet --
-- --
-- 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. --
-- --
-- As a special exception, if other files instantiate generics from --
-- this unit, or you link this unit with other files to produce an --
-- executable, this unit does not by itself cause the resulting --
-- executable to be covered by the GNU General Public License. This --
-- exception does not however invalidate any other reasons why the --
-- executable file might be covered by the GNU Public License. --
-----------------------------------------------------------------------
-- <description>
--
-- This widget is the base of the tree for displayable objects.
-- (A displayable object is one which takes up some amount
-- of screen real estate). It provides a common base and interface
-- which actual widgets must adhere to.
--
-- This package provides some services which might have been more appropriate
-- in some other packages, but could not because of dependency circularities
-- (there are for instance some functions relating to colors and colormaps).
-- We have tried to reference these functions in the other packages as well.
--
-- </description>
-- <c_version>1.2.6</c_version>
with Gdk.Color;
with Gdk.Event;
with Gdk.Bitmap;
with Gdk.Rectangle;
with Gdk.Types;
with Gdk.Visual;
with Gdk.Window;
with Gtk.Accel_Group;
with Gtk.Adjustment;
with Gtk.Enums;
with Gtk.Object;
with Gtk.Style;
with Glib.Glist;
with Glib.GSlist;
with System;
pragma Elaborate_All (Glib.GSlist);
package Gtk.Widget is
type Gtk_Widget_Record is new Object.Gtk_Object_Record with private;
type Gtk_Widget is access all Gtk_Widget_Record'Class;
type Gtk_Requisition is record
Width : Gint16;
Height : Gint16;
end record;
-- Gtk_Requisition is the desired amount of screen real-estate a widget
-- requests to the server. Its real allocated size might be different.
-- See the section in the GtkAda user guide on how to create new widgets
-- in Ada, and the examples/base_widget directory for an example on how to
-- use this.
pragma Pack (Gtk_Requisition);
type Gtk_Requisition_Access is access all Gtk_Requisition;
-- This type is used to create new widgets.
type Gtk_Allocation is record
X : Gint16;
Y : Gint16;
Width : Guint16;
Height : Guint16;
end record;
-- Gtk_Allocation indicates a size and position a widget was allocated.
-- See the section in the user guide on how to create new widgets for more
-- information.
pragma Pack (Gtk_Allocation);
type Gtk_Allocation_Access is access all Gtk_Allocation;
-- This type is used to create new widgets.
-------------------------
-- Widgets' life cycle --
-------------------------
procedure Initialize_Widget (Widget : access Gtk_Widget_Record'Class);
-- Internal initialization function.
-- See the section "Creating your own widgets" in the documentation.
procedure Destroy_Cb (Widget : access Gtk_Widget_Record'Class);
-- This function should be used as a callback to destroy a widget.
-- All it does is call Destroy on its argument, but its profile is
-- compatible with the handlers found in Gtk.Handlers.
procedure Unparent (Widget : access Gtk_Widget_Record'Class);
-- Detach the widget from its parent.
-- As a side effect, the widget will be erased from the screen.
-- Note that Widget will be destroyed if its reference count reaches 0.
-- Thus, if you want to reuse it, you should first Gtk.Object.Ref it,
-- before calling Unparent.
procedure Show (Widget : access Gtk_Widget_Record);
-- Schedule the widget to be displayed on the screen when its parent is
-- also shown (emits the "show" signal).
-- If its ancestors are already mapped to the screen, then the widget is
-- immediately displayed through a call to Map below.
procedure Show_Now (Widget : access Gtk_Widget_Record);
-- Show the widget.
-- If it is an unmapped toplevel widget, wait for it to be mapped. This
-- creates a recursive main_loop.
procedure Hide (Widget : access Gtk_Widget_Record);
-- Hide the widget from the screen (emits the "hide" signal).
-- If Widget was visible, it is immediately hidden.
-- If one of its ancestor is later shown on the screen, Widget won't
-- appear.
procedure Show_All (Widget : access Gtk_Widget_Record);
-- Show Widget and all its children recursively.
procedure Hide_All (Widget : access Gtk_Widget_Record);
-- Hide Widget and all its children.
-- Note that if you simply want to delete Widget from the screen, you can
-- simply call the Hide subprogram on it. This procedure Hide_All should
-- only be used if you want to unschedule a widget to be displayed later,
-- not to remove an actual widget from the screen.
procedure Map (Widget : access Gtk_Widget_Record);
-- Map a widget to the screen.
-- A window is created for it on the screen (through a call to Realize) and
-- Widget is then drawn on the screen (if its ancestors are also mapped).
-- This function is recursive and will also map all the children of Widget.
--
-- It is recommended to use the higher-level Show instead.
procedure Unmap (Widget : access Gtk_Widget_Record);
-- Unmap a widget from the screen.
-- This results in the widget being hidden, but not destroyed. It can be
-- shown again any time through a call to Map (provided its ancestors are
-- also mapped).
--
-- It is recommended to use the higher-level Hide instead.
procedure Realize (Widget : access Gtk_Widget_Record);
-- Create a window for Widget and its ancestors (emit the "realize" signal)
-- This does not mean that the widget will appear on the screen, but
-- resources such as colormaps, etc. become available.
-- Some routines require that the widget is realized before any call.
-- You must set the Event_Mask before calling this routine if you want to
-- change it from its default value.
procedure Unrealize (Widget : access Gtk_Widget_Record);
-- Hide the widget from the screen and deletes the associated window.
-- This does not destroy the widget itself, only its server-side
-- resources.
generic
type Widget_Type is new Gtk_Widget_Record with private;
with procedure Realize_Proc (Widget : access Widget_Type'Class);
package Realize_Handling is
procedure Set_Realize (Widget : access Gtk_Widget_Record'Class);
-- Set the realize handler at the low level.
-- This is needed to replace the default realize in new widgets.
end Realize_Handling;
function Get_Type return Gtk.Gtk_Type;
-- Return the internal value associated with a Gtk_Widget.
----------------------
-- Drawing a widget --
----------------------
procedure Queue_Draw (Widget : access Gtk_Widget_Record);
-- Add a drawing request to the event queue for the whole widget.
-- This is more efficient than calling Draw directly, since GtkAda groups
-- drawing requests as much as possible to speed up the drawing process.
-- The actual drawing will take place as soon as GtkAda is not busy
-- processing other events, but before idle events.
procedure Queue_Draw_Area
(Widget : access Gtk_Widget_Record;
X : Gint;
Y : Gint;
Width : Gint;
Height : Gint);
-- Add a drawing request to the event queue for part of the widget.
-- This is more efficient that calling Draw directly (see Queue_Draw).
procedure Queue_Clear (Widget : access Gtk_Widget_Record);
-- Add a clear request to the event queue for the whole widget.
-- This is added to the same list as for Queue_Draw, and thus is coalesced
-- as much as possible with other drawing requests.
procedure Queue_Clear_Area
(Widget : access Gtk_Widget_Record;
X : Gint;
Y : Gint;
Width : Gint;
Height : Gint);
-- Add a clear request to the event queue for part of the widget.
-- This is added to the same list as for Queue_Draw, and thus is coalesced
-- as much as possible with other drawing requests.
procedure Queue_Resize (Widget : access Gtk_Widget_Record);
-- Queue drawing requests after a resizing of the widget.
-- This clears the widget, and its parent if any, so that everything is
-- correctly redrawn.
-- You should not have to call this function directly.
procedure Draw
(Widget : access Gtk_Widget_Record;
Area : in Gdk.Rectangle.Gdk_Rectangle := Gdk.Rectangle.Full_Area);
-- Emit a "draw" signal for a specific area of the widget.
-- The visual aspect might be different whether the widget has the focus
-- or not.
procedure Draw_Focus (Widget : access Gtk_Widget_Record);
-- Emit a "draw_focus" signal for the widget.
-- The widget will be painted as it appears when it has the focus.
procedure Draw_Default (Widget : access Gtk_Widget_Record);
-- Emit a "draw_default" signal for the widget.
-- The widget will be painted as it appears when it doesn't have the focus.
-----------------------
-- Size and position --
-----------------------
procedure Size_Request
(Widget : access Gtk_Widget_Record;
Requisition : in out Gtk_Requisition);
-- Emit a "size_request" event for the widget
procedure Size_Allocate
(Widget : access Gtk_Widget_Record;
Allocation : in out Gtk_Allocation);
-- Emit a "size_allocate" event for the widget.
-- Allocation'size is first constrained to a range between 1x1 and
-- 32767x32767.
-- A clear and draw request is also queued if required.
function Get_Child_Requisition
(Widget : access Gtk_Widget_Record) return Gtk_Requisition;
-- Return the size requests by the widget.
-- This is the ideal size for the widget, not necessarily its actual size.
-- See the user guide's section on how to create new widgets for more
-- information on the size requisition and allocation.
procedure Set_UPosition
(Widget : access Gtk_Widget_Record;
X, Y : in Gint);
-- Modify the position of the widget.
-- This should be used only for toplevel widgets (windows and dialogs),
-- since other widgets' positions are handled by their parent.
procedure Set_USize
(Widget : access Gtk_Widget_Record;
Width, Height : in Gint);
-- Modify the size of the widget.
-- This sets an absolute size for the widget, no matter what its requested
-- size would be. For Gtk_Windows, you should consider using
-- Set_Default_Size instead, which sets a minimal size, but use the
-- widget's requested size if it is bigger.
-- If Width or Height is negative, they are ignored, and the widget's
-- default width is kept.
function Get_Allocation_Width
(Widget : access Gtk_Widget_Record) return Guint;
-- Return the current width of the widget.
function Get_Allocation_Height
(Widget : access Gtk_Widget_Record) return Guint;
-- Return the current height of the widget.
function Get_Allocation_X (Widget : access Gtk_Widget_Record) return Gint;
-- Return the current position of the widget, relative to its parent.
function Get_Allocation_Y (Widget : access Gtk_Widget_Record) return Gint;
-- Return the current position of the widget, relative to its parent.
------------------
-- Accelerators --
------------------
procedure Add_Accelerator
(Widget : access Gtk_Widget_Record;
Accel_Signal : in String;
Accel_Group : in Gtk.Accel_Group.Gtk_Accel_Group;
Accel_Key : in Gdk.Types.Gdk_Key_Type;
Accel_Mods : in Gdk.Types.Gdk_Modifier_Type;
Accel_Flags : in Gtk.Accel_Group.Gtk_Accel_Flags);
-- Add a new accelerator for the widget.
-- The signal Accel_Signal will be sent to Widget when the matching
-- key is pressed and the widget has the focus.
procedure Remove_Accelerator
(Widget : access Gtk_Widget_Record;
Accel_Group : in Gtk.Accel_Group.Gtk_Accel_Group;
Accel_Key : in Gdk.Types.Gdk_Key_Type;
Accel_Mods : in Gdk.Types.Gdk_Modifier_Type);
-- Remove an accelerator for the widget.
procedure Remove_Accelerators
(Widget : access Gtk_Widget_Record;
Accel_Signal : in String;
Visible_Only : in Boolean := True);
-- Remove all the accelerators for the widget that emits the Accel_Signal
-- signal when the key is pressed.
-- Visible_Only is currently unused in the code of gtk+.
function Accelerator_Signal
(Widget : access Gtk_Widget_Record;
Accel_Group : in Gtk.Accel_Group.Gtk_Accel_Group;
Accel_Key : in Gdk.Types.Gdk_Key_Type;
Accel_Mods : in Gdk.Types.Gdk_Modifier_Type) return Guint;
-- Return the signal id of the signal emitted when Accel_Key is pressed
-- inside the widget.
procedure Lock_Accelerators (Widget : access Gtk_Widget_Record);
-- Lock the accelerators for the widget.
-- No new accelerator can be added to Widget (the default behavior is
-- that the user can dynamically create new accelerators, for instance
-- by pressing a not-yet assigned key on any menu item.
-- If you call this function on the menu_item, this behavior will not
-- longer be activated.
procedure Unlock_Accelerators (Widget : access Gtk_Widget_Record);
-- Unlock the accelerators for the widget.
-- It is now possible to add new accelerators to the widget.
-------------------------
-- Events and signals --
-------------------------
function Event
(Widget : access Gtk_Widget_Record'Class;
Event : Gdk.Event.Gdk_Event) return Gint;
-- Emit a signal on the widget.
-- The exact signal depends on the event type (i.e. if the type is
-- Gdk_Button_Press, then a "button_press" signal is emitted).
procedure Activate (Widget : access Gtk_Widget_Record);
-- Emit an activate signal on the widget.
-- The exact signal emitted depends on the widget type (i.e. for a
-- Gtk_Button this emits a "clicked" signal, for a Gtk_Editable this emits
-- the "activate" signal, ...).
procedure Grab_Focus (Widget : access Gtk_Widget_Record);
-- Emit the "grab_focus" signal for the widget.
-- This is sent when the widget gets the focus. Its visual aspect might
-- change.
-- The "Can_Focus" flag must have been set first.
procedure Set_Events
(Widget : access Gtk_Widget_Record;
Events : in Gdk.Types.Gdk_Event_Mask);
-- Sets the event mask for the widget.
-- Widget should not have been realized before, or nothing is done.
-- This is the only way you can explicitly get mouse or keyboards events on
-- widgets that do not automatically get them, as for instance in a
-- Gtk_Drawing_Area.
function Get_Events
(Widget : access Gtk_Widget_Record) return Gdk.Types.Gdk_Event_Mask;
-- Get the event mask for the widget.
-- This indicates the list of events that the widget receives.
procedure Add_Events
(Widget : access Gtk_Widget_Record;
Events : in Gdk.Types.Gdk_Event_Mask);
-- Add some events to the current event mask of the widget.
procedure Set_Extension_Events
(Widget : access Gtk_Widget_Record;
Mode : in Gdk.Types.Gdk_Extension_Mode);
-- Set the extension event mask for the widget.
-- This is used to activate some special input modes for other devices than
-- keyboard and mouse.
function Get_Extension_Events
(Widget : access Gtk_Widget_Record) return Gdk.Types.Gdk_Extension_Mode;
-- Return the current extension events mask.
function Default_Motion_Notify_Event
(Widget : access Gtk_Widget_Record'Class;
Event : Gdk.Event.Gdk_Event) return Gint;
-- Access to the standard default callback for motion events:
-- This is mainly used for rulers in Gtk.Ruler (See the example in
-- testgtk, with create_rulers.adb)
function Has_Default_Motion_Notify_Handler
(Widget : access Gtk_Widget_Record'Class) return Boolean;
-- Return True if Widget has a default handler for motion_notify events.
-- Note that the function Default_Motion_Notify_Event should not be called
-- if this one returns False, since it would create a segmentation fault.
--------------------------
-- Colors and colormaps --
--------------------------
function Get_Colormap
(Widget : access Gtk_Widget_Record) return Gdk.Color.Gdk_Colormap;
-- Return the colormap used for the widget. This will generally be the
-- same one for all widgets, but might be different if for instance a
-- Gtk_Drawing_Area needs to display some different colors on a screen
-- that only has a limited amount of colors.
function Get_Visual
(Widget : access Gtk_Widget_Record) return Gdk.Visual.Gdk_Visual;
-- Get the visual used for the widget.
-- I.e. the structure that indicates the depth of the widget (number of
-- bits per pixel), and some information used internally by GtkAda to
-- handle colors and colormaps.
procedure Set_Colormap
(Widget : access Gtk_Widget_Record;
Cmap : Gdk.Color.Gdk_Colormap);
-- Modify the colormap of the widget.
-- The widget must not have been realized.
procedure Set_Visual
(Widget : access Gtk_Widget_Record;
Visual : Gdk.Visual.Gdk_Visual);
-- Modify the visual of the widget.
-- The widget must not have been realized.
procedure Push_Colormap (Cmap : Gdk.Color.Gdk_Colormap);
-- Modify temporarily the default colormap set for newly created widgets.
-- You should use this in pair with Pop_Colormap below (Push the new value,
-- create the widget, and pop the value).
procedure Pop_Colormap;
-- See Push_Colormap for more information.
procedure Push_Visual (Visual : Gdk.Visual.Gdk_Visual);
-- Modify temporarily the default visual set for newly created widgets.
-- You should use this in pair with Pop_Colormap below (Push the new value,
-- create the widget, and pop the value).
procedure Pop_Visual;
-- See Push_Visual for more information.
function Get_Default_Colormap return Gdk.Color.Gdk_Colormap;
-- Return the default colormap used when a widget is created.
procedure Set_Default_Colormap (Cmap : Gdk.Color.Gdk_Colormap);
-- Modify permanently the default colormap used when a widget is created.
-- If you only want to modify this colormap temporarily for a few widgets,
-- you should consider using Push_Colormap and Pop_Colormap instead.
function Get_Default_Visual return Gdk.Visual.Gdk_Visual;
-- Return the default visual used when a new widget is created.
procedure Set_Default_Visual (Visual : Gdk.Visual.Gdk_Visual);
-- Modify permanently the default visual used when a widget is created.
-- If you only want to modify this visual temporarily for a few widgets,
-- you should consider using Push_Visual and Pop_Visual instead.
------------
-- Styles --
------------
procedure Push_Style (Style : Gtk.Style.Gtk_Style);
-- Change the default values for styles.
-- This is generally used just before creating a widget. You should use
-- this procedure in pair with Pop_Style (Push the new value, create the
-- widget then pop the value)
procedure Pop_Style;
-- Restore the default values for styles.
-- This is generally used just after creating a widget. You should use
-- this procedure in pair with Push_Style (Push the new value, create the
-- widget then pop the value)
procedure Set_Style
(Widget : access Gtk_Widget_Record;
Style : Gtk.Style.Gtk_Style);
-- Set the style for a given widget.
function Get_Style (Widget : access Gtk_Widget_Record)
return Gtk.Style.Gtk_Style;
-- Return the style of a given widget.
procedure Modify_Style
(Widget : access Gtk_Widget_Record;
Style : Gtk_Rc_Style);
-- Modify the default style of a widget.
procedure Set_Default_Style (Style : Gtk.Style.Gtk_Style);
-- Set the default global style.
function Get_Default_Style return Gtk.Style.Gtk_Style;
-- Get the default global style.
procedure Set_Rc_Style (Widget : access Gtk_Widget_Record);
-- Restore the default style of a widget.
-- The default style is given by the configuration file initially parsed
-- by GtkAda.
procedure Ensure_Style (Widget : access Gtk_Widget_Record);
-- Make sure that the widget has a style associated to it.
-- Either the default one as set by Set_Rc_Style above or one set by the
-- user with Set_Style.
procedure Restore_Default_Style (Widget : access Gtk_Widget_Record);
-- Restore the default style that was set for the widget.
-- The default style is the first one that was set either by a call
-- to Set_Style or Set_Rc_Style.
procedure Reset_Rc_Styles (Widget : access Gtk_Widget_Record);
-- Restore the Rc style recursively for widget and its children.
-------------------
-- Widgets' tree --
-------------------
procedure Set_Name
(Widget : access Gtk_Widget_Record;
Name : in String);
-- Set the name for the widget.
-- This name is used purely internally to identify the widget, and does not
-- give any visual clue.
function Get_Name (Widget : access Gtk_Widget_Record) return String;
-- Return the name of the widget if it was set by Set_Name.
-- Return the name of its class otherwise.
procedure Set_Parent
(Widget : access Gtk_Widget_Record;
Parent : access Gtk_Widget_Record'Class);
-- Modify the parent for the widget.
-- This is not the recommended way to do this, you should use
-- Gtk.Container.Add or Gtk.Box.Pack_Start instead.
procedure Set_Parent_Window
(Widget : access Gtk_Widget_Record;
Window : Gdk.Window.Gdk_Window);
-- Set the parent window for the actual Gdk_Window of the widget. This sets
-- up required internal fields, and should be used only when you implement
-- your own container, as opposed to using one of the standard containers.
function Get_Parent (Widget : access Gtk_Widget_Record) return Gtk_Widget;
-- Return the parent of the widget, or null if Widget is a toplevel
-- widget.
function Get_Toplevel (Widget : access Gtk_Widget_Record) return Gtk_Widget;
-- Return the toplevel ancestor of the widget.
-- This is the window or dialog in which the widget is included.
-- The widget returned does not have any parent.
function Get_Ancestor
(Widget : access Gtk_Widget_Record;
Ancestor_Type : in Gtk_Type) return Gtk_Widget;
-- Return the closest ancestor of Widget which is of type Ancestor_Type.
-- Return null if there is none.
function Is_Ancestor
(Widget : access Gtk_Widget_Record;
Ancestor : access Gtk_Widget_Record'Class) return Boolean;
-- Return True if Ancestor is in the ancestor tree for Widget.
-- I.e. if Widget is contained within Ancestor.
procedure Reparent
(Widget : access Gtk_Widget_Record;
New_Parent : access Gtk_Widget_Record'Class);
-- Change the parent of the widget dynamically.
-- If both the new parent and the widget are shown, then the widget is
-- visually redrawn in its new parent.
--------------------
-- Misc functions --
--------------------
procedure Set_Scroll_Adjustments
(Widget : access Gtk_Widget_Record;
Hadj : Gtk.Adjustment.Gtk_Adjustment;
Vadj : Gtk.Adjustment.Gtk_Adjustment);
-- Emit the "set_scroll_adjustments" signal.
-- The exact signal emitted depends on the widget type (see
-- Gtk.Object.Initialize_Class_Record).
-- The handler creates the adjustments if null is passed as argument, and
-- makes sure both adjustments are in the correct range.
procedure Popup (Widget : access Gtk_Widget_Record; X, Y : in Gint);
-- Realize the widget (see Realize above), moves it to the screen position
-- (X, Y), and shows the widget.
-- This should only be used for toplevel windows and dialogs, as you can
-- no modify the position of a widget that has a parent (the parent is
-- then responsible for its position).
function Intersect
(Widget : access Gtk_Widget_Record;
Area : Gdk.Rectangle.Gdk_Rectangle;
Intersection : access Gdk.Rectangle.Gdk_Rectangle) return Boolean;
-- Return True if the widget intersects the screen area Area.
-- The intersection area is returned in Intersection.
procedure Grab_Default (Widget : access Gtk_Widget_Record);
-- The widget becomes the default widget for its parent window or dialog.
-- All keyboard events will be sent to it if no other widget has the focus.
-- Note that the "Can_Default" flag must have been set first on WIDGET.
procedure Set_State
(Widget : access Gtk_Widget_Record;
State : in Enums.Gtk_State_Type);
-- Modify the state of the widget.
-- This modifies its visual aspect, and thus should be used only if you
-- change its behavior at the same time, so as not to confuse the user.
function Get_State
(Widget : access Gtk_Widget_Record) return Enums.Gtk_State_Type;
-- Return the state of the widget.
procedure Set_Sensitive
(Widget : access Gtk_Widget_Record;
Sensitive : in Boolean := True);
-- Modify the sensitivity of the widget.
-- An insensitive widget is generally grayed out, and can not be activated.
-- For instance, an insensitive menu item is grayed, and can never be
-- selected.
procedure Set_App_Paintable
(Widget : access Gtk_Widget_Record;
App_Paintable : Boolean);
-- Modify the "App_Paintable" flag for the widget.
procedure Get_Pointer
(Widget : access Gtk_Widget_Record;
X : out Gint;
Y : out Gint);
-- Return the coordinates of the pointer (i.e. mouse) relative to Widget.
procedure Set_Window
(Widget : access Gtk_Widget_Record;
Window : in Gdk.Window.Gdk_Window);
-- Set the Gdk window associated with the widget.
function Get_Window
(Widget : access Gtk_Widget_Record) return Gdk.Window.Gdk_Window;
-- Get the Gdk window associated with the widget.
-- You can use this window if you need to draw directly on the widget using
-- the functions found in the Gdk hierarchy.
procedure Shape_Combine_Mask
(Widget : access Gtk_Widget_Record;
Shape_Mask : Gdk.Bitmap.Gdk_Bitmap;
Offset_X : Gint;
Offset_Y : Gint);
-- Modify the shape of the window that contains the widget.
-- This allows for transparent windows, and requires the Xext library to be
-- available on your system. If this library is not available, your program
-- will still work.
-- See the manual page for XShapeCombineMask(3x) for more information.
-----------
-- Flags --
-----------
-- Some additional flags are defined for all the visual objects (widgets).
-- They are defined in addition to the ones defined in Gtk.Object.
-- These flags are important in that they define exactly the different
-- states a widget can be in.
--
-- - "Toplevel":
-- Set if the widget is a toplevel widget, ie has no parent. This is
-- mostly true for windows and dialogs.
--
-- - "No_Window":
-- Set if the widget does not have an associated X11 window, ie can not
-- receive events directly. For instance, a Gtk_Toolbar does not have
-- an associated window. These objects are more lightweight, but require
-- more work from GtkAda. This flag is only set if the widget will never
-- have a window, even after it is realized.
--
-- - "Realized":
-- Set if the widget has been realized, ie its associated X11 window has
-- been created (providing the widget excepts a window, see the No_Window
-- flag
--
-- - "Mapped":
-- Set if the widget is visible on the screen. This is only possible if
-- the Visible flag is also set.
--
-- - "Visible":
-- Set if the widget will be displayed on the screen when mapped (see the
-- functions Show and Hide in this package).
--
-- - "Sensitive":
-- Set if the widget is listening to events. See the function
-- Set_Sensitive in this package. An insensitive widget will generally
-- have a different visual aspect to clue that it is unavailable (for
-- instance an insensitive item menu will be grayed)
--
-- - "Parent_Sensitive":
-- Set if the parent is sensitive. A widget is sensitive only if both
-- the Sensitive and Parent_Sensitive are set.
--
-- - "Can_Focus":
-- Set if the widget can have the focus, ie get keyboard events. Most
-- widgets can not have the focus.
--
-- - "Has_Focus":
-- Set if the widget currently has the focus. See the function Grab_Focus
-- in this package.
--
-- - "Can_Default":
-- Set if the widget can be the default widget in a window, ie the one
-- that will get the keyboard events by default. For instance, the
-- default button in a dialog is the one that gets clicked on when the
-- user pressed Enter anywhere in the dialog.
--
-- - "Has_Default":
-- Set if the widget is currently the default widget. See the function
-- Grab_Default in this package.
--
-- - "Has_Grab":
-- Set if the widget currently grabs all mouse and keyboard events in
-- the application, even if it does not have the focus. There can be only
-- such widget per application at any given time.
--
-- - "Rc_Style":
-- Set if the widget's style is either the default style, or in a
-- customization file. This is unset if the style has been modified by
-- the user.
--
-- - "Composite_Child":
-- ???
--
-- - "No_Reparent":
-- This flags is never used in gtk+.
--
-- - "App_Paintable":
-- For some containers (including Gtk_Window and Gtk_Layout), this is
-- unset when the container itself has some special drawing routines.
--
-- - "Receives_Default":
-- Set when the widget receives the default at the time it receives the
-- focus. This is how the default button in a dialog is automatically
-- changed when you press another button.
Toplevel : constant := 2 ** 4;
No_Window : constant := 2 ** 5;
Realized : constant := 2 ** 6;
Mapped : constant := 2 ** 7;
Visible : constant := 2 ** 8;
Sensitive : constant := 2 ** 9;
Parent_Sensitive : constant := 2 ** 10;
Can_Focus : constant := 2 ** 11;
Has_Focus : constant := 2 ** 12;
Can_Default : constant := 2 ** 13;
Has_Default : constant := 2 ** 14;
Has_Grab : constant := 2 ** 15;
Rc_Style : constant := 2 ** 16;
Composite_Child : constant := 2 ** 17;
No_Reparent : constant := 2 ** 18;
App_Paintable : constant := 2 ** 19;
Receives_Default : constant := 2 ** 20;
function Toplevel_Is_Set
(Widget : access Gtk_Widget_Record'Class) return Boolean;
-- Test whether the Toplevel flag is set.
function No_Window_Is_Set
(Widget : access Gtk_Widget_Record'Class) return Boolean;
-- Test whether the No_Window flag is set.
function Realized_Is_Set
(Widget : access Gtk_Widget_Record'Class) return Boolean;
-- Test whether the Realized flag is set.
function Mapped_Is_Set
(Widget : access Gtk_Widget_Record'Class) return Boolean;
-- Test whether the Mapped flag is set.
function Visible_Is_Set
(Widget : access Gtk_Widget_Record'Class) return Boolean;
-- Test whether the Visible flag is set.
function Drawable_Is_Set
(Widget : access Gtk_Widget_Record'Class) return Boolean;
-- True if the widget is both visible and mapped.
-- In other words, if it does appear on the screen.
function Is_Sensitive
(Widget : access Gtk_Widget_Record'Class) return Boolean;
-- Test whether the widget is Sensitive.
function Can_Focus_Is_Set
(Widget : access Gtk_Widget_Record'Class) return Boolean;
-- Test whether the Can_Focus flag is set.
function Has_Focus_Is_Set
(Widget : access Gtk_Widget_Record'Class) return Boolean;
-- Test whether the Has_Focus flag is set.
function Has_Default_Is_Set
(Widget : access Gtk_Widget_Record'Class) return Boolean;
-- Test whether the Has_Default flag is set.
function Has_Grab_Is_Set
(Widget : access Gtk_Widget_Record'Class) return Boolean;
-- Test whether the Has_Grab flag is set.
function Rc_Style_Is_Set
(Widget : access Gtk_Widget_Record'Class) return Boolean;
-- Test whether the Rc_Style flag is set.
--------------------------------------
-- Definitions for lists of widgets --
--------------------------------------
-- <doc_ignore>
function Convert (W : in Gtk_Widget) return System.Address;
function Convert (W : System.Address) return Gtk_Widget;
package Widget_List is new Glib.Glist.Generic_List (Gtk_Widget);
package Widget_SList is new Glib.GSlist.Generic_SList (Gtk_Widget);
-- </doc_ignore>
-------------
-- Signals --
-------------
-- <signals>
-- The following new signals are defined for this widget:
--
-- - "show"
-- procedure Handler (Widget : access Gtk_Widget_Record'Class);
--
-- Emitted when a widget is to be shown (see explanation for the Show
-- subprogam). This schedules the widget to be displayed on the screen,
-- and if this is a toplevel widget it actually appears on the screen
-- and all its children that have been shown.
--
-- - "hide"
-- procedure Handler (Widget : access Gtk_Widget_Record'Class);
--
-- Emitted when a widget is to be hidden (see explanation for the Hide
-- subprogram). Hides the widget from the screen, and if its parent is
-- shown, the widget will not appear on the screen again.
--
-- - "map"
-- procedure Handler (Widget : access Gtk_Widget_Record'Class);
--
-- Emitted when a widget is mapped on the screen (the default handler
-- simply emits the "show" signal).
--
-- - "unmap"
-- procedure Handler (Widget : access Gtk_Widget_Record'Class);
--
-- Emitted when a widget needs to be unmapped on the screen (the default
-- handler simply emits the "hide" signal).
--
-- - "realize"
-- procedure Handler (Widget : access Gtk_Widget_Record'Class);
--
-- Emitted when a widget is realized. The default handler creates the
-- Gdk window associated with the widget, and its ancestors.
--
-- - "unrealize"
-- procedure Handler (Widget : access Gtk_Widget_Record'Class);
--
-- Emitted when a widget is unrealized. The default handler destroys the
-- Gdk windows of the widget and all its children.
--
-- - "draw"
-- procedure Handler (Widget : access Gtk_Widget_Record'Class;
-- Area : Gdk.Rectangle.Gdk_Rectangle);
--
-- Emitted when a widget needs to be drawn. The default handler emits
-- the "expose" event.
--
-- - "draw_focus"
-- procedure Handler (Widget : access Gtk_Widget_Record'Class);
--
-- Emitted when a widget needs to be drawn and it has the focus. Some
-- widgets might want to provide visual clues that they have the focus,
-- like a black border. This is never called if the widget can not have
-- the focus (ie the "Can_Focus" flag is unset).
--
-- - "draw_default"
-- procedure Handler (Widget : access Gtk_Widget_Record'Class);
--
-- Emitted when a widget needs to be drawn and it does not have the
-- focus. This is never called if the widget can not have the focus
-- (ie the "Can_Focus" flag is unset).
--
-- - "size_request"
-- procedure Handler (Widget : access Gtk_Widget_Record'Class;
-- Requisition : access Gtk_Requisition);
--
-- Should return (in Requisition) the ideal size the widget would like to
-- have. It is not sure this is the size that will be assigned to it,
-- since it depends on the size of its parent).
--
-- - "size_allocate"
-- procedure Handler (Widget : access Gtk_Widget_Record'Class;
-- Allocation : Gtk_Allocation);
--
-- A size and position were assigned to the widget. This is called every
-- time the size of the widget changes.
-- The default handler takes care of resizing and moving the widget.
--
-- - "state_changed"
-- procedure Handler (Widget : access Gtk_Widget_Record'Class;
-- Previous_State : Gtk.Enums.Gtk_State_Type);
--
-- The state of the widget has changed.
--
-- - "parent_set"
-- procedure Handler (Widget : access Gtk_Widget_Record'Class;
-- Previous_Parent : access Gtk_Widget_Record'Class);
--
-- A new parent has been set for the widget. The previous parent is
-- given in arguments (if there was none,
-- Gdk.Is_Created (Previous_Parent) returns False).
--
-- - "style_set"
-- procedure Handler (Widget : access Gtk_Widget_Record'Class);
-- Previous_Style : Gtk.Style.Gtk_Style);
--
-- The widget's style has been changed (this is not call when some
-- settings in the style are changed, only when the style itself is
-- completely changed with a call to Set_Style or Set_Rc_Style).
--
-- - "add_accelerator"
--
-- ???
--
-- - "remove_accelerator"
--
-- ???
--
-- - "grab_focus"
-- procedure Handler (Widget : access Gtk_Widget_Record'Class);
--
-- The widget has got the focus, ie will now get the keyboard events
-- sent to a window. This is only called if the "Can_Focus" flag is
-- set. The "Has_Focus" flag might not be set when this signal is
-- emitted.
--
-- - "event"
-- function Handler (Widget : access Gtk_Widget_Record'Class;
-- Event : Gdk.Event.Gdk_Event)
-- return Boolean;
--
-- Some event was sent to the widget. This covers all the cases
-- below, and acts as a general handler. This is called in addition to
-- the relevant specific handler below.
-- If the handler returns False, the event might be pass to the parent
-- of widget (if no other handler of widget has returned True).
--
-- - "button_press_event"
-- function Handler (Widget : access Gtk_Widget_Record'Class;
-- Event : Gdk.Event.Gdk_Event_Button)
-- return Boolean;
--
-- A button was pressed while the pointer was inside the widget.
-- To get this signal, some widgets by have to use the Set_Events
-- subprogram first to get this event.
-- If the handler returns False, the event might be pass to the parent
-- of widget (if no other handler of widget has returned True).
--
-- - "button_release_event"
-- function Handler (Widget : access Gtk_Widget_Record'Class;
-- Event : Gdk.Event.Gdk_Event_Button)
-- return Boolean;
--
-- A button was released while the pointer was inside the widget.
-- Note that in some cases (Gtk_Buttons for instance), another "clicked"
-- signal could be emitted). This "button_release_event" should mainly
-- be used for widgets that don't already have specific signals to cover
-- that case (Gtk_Drawing_Area for instance).
--
-- To get this signal, some widgets may have to use the Set_Events
-- subprogram first to get this event.
--
-- If the handler returns False, the event might be pass to the parent
-- of widget (if no other handler of widget has returned True).
--
-- - "motion_notify_event"
-- function Handler (Widget : access Gtk_Widget_Record'Class;
-- Event : Gdk.Event.Gdk_Event_Motion)
-- return Boolean;
--
-- The pointer has moved while remaining inside the widget.
-- The Set_Events subprogram has to be called first to get this event.
--
-- If the handler returns False, the event might be pass to the parent
-- of widget (if no other handler of widget has returned True).
--
-- - "delete_event"
-- function Handler (Widget : access Gtk_Widget_Record'Class;
-- Event : Gdk.Event.Gdk_Event)
-- return Boolean;
--
-- The user has clicked on the "close" button in the window's frame
-- (the button that is automatically set by the window manager). If the
-- handler returns False, the widget will be destroyed (and the window
-- closed), but if the handler returns True, nothing will be done.
-- This is a good way to prevent the user from closing your application's
-- window if there should be some clean ups first (like saving the
-- document).
--
-- - "destroy_event"
-- function Handler (Widget : access Gtk_Widget_Record'Class;
-- Event : Gdk.Event.Gdk_Event)
-- return Boolean;
--
-- This signal is apparently never emitted by Gtk+. You might want to
-- use "destroy" instead, which is documented in Gtk.Object.
--
-- - "expose_event"
-- function Handler (Widget : access Gtk_Widget_Record'Class;
-- Event : Gdk.Event.Gdk_Event_Expose)
-- return Boolean;
--
-- The widget needs to be partly redrawn. The exact area to redraw is
-- found in Event. For some widgets, you should rather connect to the
-- "draw" signal. However, for instance for Gtk_Drawing_Area widgets,
-- you have to use this, after setting the correct event mask with
-- Set_Events.
-- If the handler returns False, the event might be pass to the parent
-- of widget (if no other handler of widget has returned True).
--
-- - "key_press_event"
-- function Handler (Widget : access Gtk_Widget_Record'Class;
-- Event : Gdk.Event.Gdk_Event_Key)
-- return Boolean;
--
-- A key has been pressed while Widget had the focus. Note that some
-- widgets like Gtk_Editable provide some higher-level signals to handle
-- this.
-- If the handler returns False, the event might be pass to the parent
-- of widget (if no other handler of widget has returned True).
--
-- - "key_release_event"
-- function Handler (Widget : access Gtk_Widget_Record'Class;
-- Event : Gdk.Event.Gdk_Event_Key)
-- return Boolean;
--
-- A key has been released while Widget had the focus.
-- If the handler returns False, the event might be pass to the parent
-- of widget (if no other handler of widget has returned True).
--
-- - "enter_notify_event"
-- function Handler (Widget : access Gtk_Widget_Record'Class;
-- Event : Gdk.Event.Gdk_Event_Crossing)
-- return Boolean;
--
-- The pointer has just entered the widget. If the "Can_Focus" flag is
-- set, Widget will gain the focus, and the widget might be drawn
-- differently.
-- If the handler returns False, the event might be pass to the parent
-- of widget (if no other handler of widget has returned True).
--
-- - "leave_notify_event"
-- function Handler (Widget : access Gtk_Widget_Record'Class;
-- Event : Gdk.Event.Gdk_Event_Crossing)
-- return Boolean;
--
-- The pointer has just leaved the widget. If the "Can_Focus" flag is
-- set, Widget will gain the focus, and the widget might be drawn
-- differently.
-- If the handler returns False, the event might be pass to the parent
-- of widget (if no other handler of widget has returned True).
--
-- - "configure_event"
-- function Handler (Widget : access Gtk_Widget_Record'Class;
-- Event : Gdk.Event.Gdk_Event_Configure)
-- return Boolean;
--
-- Some configuration of the window has changed (it has been
-- moved or resized).
-- If the handler returns False, the event might be pass to the parent
-- of widget (if no other handler of widget has returned True).
--
-- - "focus_in_event"
-- function Handler (Widget : access Gtk_Widget_Record'Class;
-- Event : Gdk.Event.Gdk_Event_Focus)
-- return Boolean;
--
-- The widget has just gained the focus.
-- If the handler returns False, the event might be pass to the parent
-- of widget (if no other handler of widget has returned True).
--
-- - "focus_out_event"
-- function Handler (Widget : access Gtk_Widget_Record'Class;
-- Event : Gdk.Event.Gdk_Event_Focus)
-- return Boolean;
--
-- The widget has just lost the focus.
-- If the handler returns False, the event might be pass to the parent
-- of widget (if no other handler of widget has returned True).
--
-- - "map_event"
-- function Handler (Widget : access Gtk_Widget_Record'Class;
-- Event : Gdk.Event.Gdk_Event)
-- return Boolean;
--
-- The widget has just been mapped. This is different from the "map"
-- signal, which is called *before* the widget is actually mapped.
-- If the handler returns False, the event might be pass to the parent
-- of widget (if no other handler of widget has returned True).
--
-- - "unmap_event"
-- function Handler (Widget : access Gtk_Widget_Record'Class;
-- Event : Gdk.Event.Gdk_Event)
-- return Boolean;
--
-- The widget has just been unmapped. This is different from the "unmap"
-- signal, which is called *before* the widget is actually unmapped.
-- If the handler returns False, the event might be pass to the parent
-- of widget (if no other handler of widget has returned True).
--
-- - "property_notify_event"
-- function Handler (Widget : access Gtk_Widget_Record'Class;
-- Event : Gdk.Event.Gdk_Event_Property)
-- return Boolean;
--
-- ???
--
-- - "selection_clear_event"
-- function Handler (Widget : access Gtk_Widget_Record'Class;
-- Event : Gdk.Event.Gdk_Event_Selection)
-- return Boolean;
--
-- ???
--
-- - "selection_request_event"
-- function Handler (Widget : access Gtk_Widget_Record'Class;
-- Event : Gdk.Event.Gdk_Event_Selection)
-- return Boolean;
--
-- ???
--
-- - "selection_notify_event"
-- function Handler (Widget : access Gtk_Widget_Record'Class;
-- Event : Gdk.Event.Gdk_Event_Selection)
-- return Boolean;
--
-- ???
--
-- - "selection_received"
-- Related to the selection mechanism, see Gtk.Selection
--
-- - "selection_get"
-- Related to the selection mechanism, see Gtk.Selection
--
-- - "proximity_in_event"
-- function Handler (Widget : access Gtk_Widget_Record'Class;
-- Event : Gdk.Event.Gdk_Event_Proximity)
-- return Boolean;
--
-- Used for special input devices. See the description of
-- Gdk.Event.Gdk_Event_Proximity.
-- If the handler returns False, the event might be pass to the parent
-- of widget (if no other handler of widget has returned True).
--
-- - "proximity_out_event"
-- function Handler (Widget : access Gtk_Widget_Record'Class;
-- Event : Gdk.Event.Gdk_Event_Proximity)
-- return Boolean;
--
-- Used for special input devices. See the description of
-- Gdk.Event.Gdk_Event_Proximity.
-- If the handler returns False, the event might be pass to the parent
-- of widget (if no other handler of widget has returned True).
--
-- - "drag_leave"
-- Event related to drag-and-drop support. See the Gtk.Dnd documentation.
--
-- - "drag_begin"
-- Event related to drag-and-drop support. See the Gtk.Dnd documentation.
--
-- - "drag_end"
-- Event related to drag-and-drop support. See the Gtk.Dnd documentation.
--
-- - "drag_data_delete"
-- Event related to drag-and-drop support. See the Gtk.Dnd documentation.
--
-- - "drag_motion"
-- Event related to drag-and-drop support. See the Gtk.Dnd documentation.
--
-- - "drag_drop"
-- Event related to drag-and-drop support. See the Gtk.Dnd documentation.
--
-- - "drag_data_get"
-- Event related to drag-and-drop support. See the Gtk.Dnd documentation.
--
-- - "drag_data_received"
-- Event related to drag-and-drop support. See the Gtk.Dnd documentation.
--
-- - "visibility_notify_event"
-- function Handler (Widget : access Gtk_Widget_Record'Class;
-- Event : Gdk.Event.Gdk_Event_Visibility)
-- return Boolean;
--
-- The visibility state of the widget has changed (partially visible,
-- fully visible, ...). You might want to use the "expose" signal
-- instead.
-- If the handler returns False, the event might be pass to the parent
-- of widget (if no other handler of widget has returned True).
--
-- - "client_event"
--
-- ???
--
-- - "no_expose_event"
-- function Handler (Widget : access Gtk_Widget_Record'Class;
-- Event : Gdk.Event.Gdk_Event)
-- return Boolean;
--
-- ???
--
-- </signals>
private
type Gtk_Widget_Record is new Object.Gtk_Object_Record with null record;
pragma Import (C, Push_Style, "gtk_widget_push_style");
pragma Import (C, Pop_Style, "gtk_widget_pop_style");
pragma Import (C, Set_Default_Style, "gtk_widget_set_default_style");
pragma Import (C, Get_Default_Style, "gtk_widget_get_default_style");
pragma Import (C, Pop_Colormap, "gtk_widget_pop_colormap");
pragma Import (C, Pop_Visual, "gtk_widget_pop_visual");
pragma Import (C, Get_Type, "gtk_widget_get_type");
pragma Import (C, Get_Default_Colormap, "gtk_widget_get_default_colormap");
pragma Import (C, Get_Default_Visual, "gtk_widget_get_default_visual");
pragma Import (C, Push_Colormap, "gtk_widget_push_colormap");
pragma Import (C, Push_Visual, "gtk_widget_push_visual");
pragma Import (C, Set_Default_Colormap, "gtk_widget_set_default_colormap");
pragma Import (C, Set_Default_Visual, "gtk_widget_set_default_visual");
pragma Inline (Toplevel_Is_Set);
pragma Inline (No_Window_Is_Set);
pragma Inline (Realized_Is_Set);
pragma Inline (Mapped_Is_Set);
pragma Inline (Visible_Is_Set);
pragma Inline (Drawable_Is_Set);
pragma Inline (Is_Sensitive);
pragma Inline (Can_Focus_Is_Set);
pragma Inline (Has_Focus_Is_Set);
pragma Inline (Has_Default_Is_Set);
pragma Inline (Has_Grab_Is_Set);
pragma Inline (Rc_Style_Is_Set);
end Gtk.Widget;
-- Functions that have no Ada equivalent:
-- - gtk_widget_new
-- - gtk_widget_get
-- - gtk_widget_getv
-- - gtk_widget_set
-- - gtk_widget_setv
-- - gtk_widget_get_parent_window <= mainly internal
-- - gtk_widget_hide_on_delete <= used as callback
-- - gtk_widget_set_composite_name
-- - gtk_widget_get_composite_name
-- - gtk_widget_push_composite_child
-- - gtk_widget_pop_composite_child
-- - gtk_widget_path
-- - gtk_widget_class_path
-----------------------------------------------------------------------
-- GtkAda - Ada95 binding for the Gimp Toolkit --
-- --
-- Copyright (C) 1998-2000 --
-- Emmanuel Briot, Joel Brobecker and Arnaud Charlet --
-- --
-- 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. --
-- --
-- As a special exception, if other files instantiate generics from --
-- this unit, or you link this unit with other files to produce an --
-- executable, this unit does not by itself cause the resulting --
-- executable to be covered by the GNU General Public License. This --
-- exception does not however invalidate any other reasons why the --
-- executable file might be covered by the GNU Public License. --
-----------------------------------------------------------------------
-- <description>
--
-- This package provides an interface to the color handling facilities in
-- gtk+. It is able to handle any kind of visual (monochrome, greyscale,
-- color with different depths, ...), but provides a common and easy
-- interface for all of them.
-- Some of these functions expect a Colormap. There are two ways you can
-- get such a colormap, either a system default colormap or a per-widget
-- colormap. It is recommended, unless you are writing your own new widget,
-- to always use the system default Colormap. All the functions to get
-- these colormaps are found in Gtk.Widget.
--
-- Getting the Red/Green/Blue components can be done through Parse, and is
-- actually recommended, since the exact color generally depends on the
-- visual your application is running on.
--
-- </description>
-- <c_version>1.2.6</c_version>
with Glib; use Glib;
with Gdk.Visual;
package Gdk.Color is
type Gdk_Color is private;
-- A color to be displayed on the screen.
-- Currently, GtkAda only supports the RGB standard, ie each color is
-- set by its red, green and blue components.
-- An extra field (Pixel) is the internal representation of the color,
-- which is set once the color has been allocated.
type Gdk_Color_Array is array (Natural range <>) of Gdk_Color;
-- An array of colors.
Null_Color : constant Gdk_Color;
-- No color. For most functions, this will select the default color in the
-- context, although this exact specification depends on the function you
-- want to use.
type Gdk_Colormap is new C_Proxy;
-- The set of colors the can be displayed on the screen.
-- When the screen is not a true-color screen (ie there is only a limited
-- number of possible colors, like 256), the colors are in fact indexes
-- into a colormap, which gives the components of the color.
-- This is the same concept as a palette.
Null_Colormap : constant Gdk_Colormap;
Wrong_Color : exception;
-- Exception raised when some functions below could not find or allocate
-- a color on the user's system.
------------------------------------
-- Creating and Destroying colors --
------------------------------------
function Parse (Spec : in String) return Gdk_Color;
-- Parse the string Spec, and get its Red/Green/Blue components.
-- The color is not allocated, and you need to call Alloc_Color.
-- If the string could not be parsed to an existing color, Wrong_Color is
-- raised.
-- The string can be one of :
--
-- - "RBG:FF/FF/FF" where the "FF" substrings are respectively the value
-- of the red, green and blue components. Some other prefixes than RGB
-- are defined in the X11 definition, please see some X11 documentation
-- (or the man page XParseColor on unix systems).
--
-- - "color_name" which can be any color name defined in the file rgb.txt
-- of the user's system. You should always check that Wrong_Color was not
-- raised, in case the color was not known on the user's system. This
-- string is case insensitive.
procedure Alloc_Color (Colormap : in Gdk_Colormap;
Color : in out Gdk_Color;
Writeable : in Boolean := False;
Best_Match : in Boolean := True;
Success : out Boolean);
-- Allocate a new color.
-- The fields RGB should have been set before calling this function.
-- If Writeable is True, the color will be allocated read/write, that can
-- be changed at any time. Not all visuals support this. On modern systems
-- this usage has become less useful than before, since redrawing the
-- screen with a new color is about as fast.
-- If Best_Match is True, and the exact color can not be allocated, GtkAda
-- will find the closest possible match, and modify the fields Red, Green
-- and Blue of Color.
-- Note that the allocation has more chances to succeed if Writeable is
-- False and Best_Match is True.
-- When you no longer use a color, you should call Free.
procedure Alloc_Colors (Colormap : in Gdk_Colormap;
Colors : in out Gdk_Color_Array;
Writeable : in Boolean := False;
Best_Match : in Boolean := True;
Success : out Boolean_Array;
Result : out Gint);
-- Allocate a set of colors.
-- The parameters are the same as for Alloc_Color
-- Result is the number of colors not successfully allocated.
--
-- The size of the Boolean_Array is equal to the length of the
-- Colors_Array. Usage of an array of a different size will
-- probably lead to a Constraint_Error.
procedure Alloc (Colormap : in Gdk_Colormap;
Color : in out Gdk_Color);
-- Same function as Alloc_Colors above, but for a single color.
-- The color is allocated non-writeable, and the best-match is taken.
-- Raises Wrong_Color if the color could not be allocated
function White (Colormap : in Gdk_Colormap) return Gdk_Color;
-- Return the default white color for the colormap.
-- If this color was not found or could not be allocated, Wrong_Color is
-- raised.
function Black (Colormap : in Gdk_Colormap) return Gdk_Color;
-- Return the default black colors for the colormap.
-- If this color is not found or could not be allocated, Wrong_Color is
-- raised.
function Get_System return Gdk_Colormap;
-- Get the default colormap for the system.
-- This is the same function as Gtk.Widget.Get_Default_Colormap.
procedure Get_Visual (Colormap : in Gdk_Colormap;
Visual : out Gdk.Visual.Gdk_Visual);
-- Get the visual associated with a colormap.
-- The main information you can get from there is the depth of the display.
procedure Gdk_New (Colormap : out Gdk_Colormap;
Visual : in Gdk.Visual.Gdk_Visual;
Private_Cmap : in Boolean);
-- Create a new colormap for the visual.
-- If Private_Cmap is true, then the
-- colormap won't be modifiable outside this scope. This might result in
-- some strange colors on the display...
procedure Unref (Colormap : in Gdk_Colormap);
-- Unref is the only way to destroy a colormap once you no longer need it.
-- Note that because gtk+ uses reference counts, the colormap will not
-- be actually destroyed while at least one object is using it.
procedure Ref (Colormap : in Gdk_Colormap);
-- Increment the ref-count for the color.
-- You should not have to use this function.
function Get_System_Size return Gint;
-- Return the number of entries in the default colormap on the system.
procedure Free_Colors (Colormap : in Gdk_Colormap;
Colors : in Gdk_Color_Array);
-- Free Colors, assuming they are allocated in Colormap.
procedure Store (Colormap : in Gdk_Colormap;
Colors : in Gdk_Color_Array);
-- Store the Colors in the Colormap
procedure Alloc (Colormap : in Gdk_Colormap;
Contiguous : in Boolean;
Planes : in Gulong_Array;
Pixels : in Gulong_Array;
Succeeded : out Boolean);
-- Allocate some Read/Write color cells.
-- Color cells' values can be changed
-- dynamically. The pixels allocated are returned in Pixels.
-- See XAllocColorCells(3) on Unix systems.
-- The Planes parameter can be used to nondestructively overlay one
-- set of graphics over another. See the X11 manual for more info.
-- Note that this is a low-level function which you should rarely
-- have to use.
procedure Free (Colormap : in Gdk_Colormap;
Pixels : in Gulong_Array;
Planes : in Gulong);
-- Free some colors in the colormap.
-- See XFreeColors(3) on Unix systems.
-- <doc_ignore>
function Hash (Color_A : in Gdk_Color;
Color_B : in Gdk_Color) return Guint;
-- Return a hash code for Color_A.
-- This seems to be a internal function for gtk+ only.
-- </doc_ignore>
procedure Change (Colormap : in Gdk_Colormap;
Color : in out Gdk_Color;
Succeeded : out Boolean);
-- Change the Read/Write colormap cell corresponding to Color.
-- The new value is the one contained in the Red, Green and Blue
-- fields of Color.
procedure Change (Colormap : in Gdk_Colormap;
Ncolors : in Gint);
-- Changes the first Ncolors defined in Colormap.
procedure Copy (Source : in Gdk_Color;
Destination : out Gdk_Color);
-- Copy the Source color to Destination.
function Equal (Colora, Colorb : in Gdk_Color) return Boolean;
-- True if the Red, Green and Blue components of both colors are equal.
---------------------------------------------
-- Setting/Getting the fields of Gdk_Color --
---------------------------------------------
procedure Set_Rgb (Color : out Gdk_Color;
Red, Green, Blue : in Gushort);
-- Modify the fields of the color.
-- You then have to allocate the color with one of the Alloc* functions
-- above.
procedure Set_Pixel (Color : in out Gdk_Color; Pixel : Gulong);
-- This function should almost never be used. Instead, use Alloc_Color
function Red (Color : in Gdk_Color) return Gushort;
-- Return the Red field of Color.
function Green (Color : in Gdk_Color) return Gushort;
-- Return the Green field of Color.
function Blue (Color : in Gdk_Color) return Gushort;
-- Return the Blue field of Color.
function Pixel (Color : in Gdk_Color) return Gulong;
-- Return the Pixel field of Color.
private
Null_Colormap : constant Gdk_Colormap := null;
type Gdk_Color is
record
Pixel : Gulong;
Red : Gushort;
Green : Gushort;
Blue : Gushort;
end record;
-- The fields are to be chosen between 0 and 65535, not 0 and 255!!!
Null_Color : constant Gdk_Color := (Gulong'Last, 1, 0, 0);
-- Note: in the implementation of GtkAda, everytime a color is used, it
-- is important to test whether this is Null_Color or not. If it is, then
-- System.Null_Address should be passed to C instead of Null_Color'Address
-- so that gtk+ can provide a default value for colors.
pragma Inline (Set_Rgb);
pragma Inline (Set_Pixel);
pragma Inline (Red);
pragma Inline (Green);
pragma Inline (Blue);
pragma Inline (Pixel);
pragma Import (C, Get_System_Size, "gdk_colormap_get_system_size");
pragma Import (C, Get_System, "gdk_colormap_get_system");
pragma Import (C, Ref, "gdk_colormap_ref");
pragma Import (C, Unref, "gdk_colormap_unref");
end Gdk.Color;
-- <example>
-- -- Here is an example how you can allocate a new color, when you know
-- -- its red/green/blue components: Note that we allocate white in fact
-- -- since the maximal value for color components is 65535.
-- Color : Gdk_Color;
-- Success : Boolean;
-- Set_Rbg (Color, 65535, 65535, 65535);
-- Alloc_Color (Colormap => Gtk.Widget.Get_Default_Colormap,
-- Color => Color,
-- Writeable => False,
-- Best_Match => True,
-- Success => Success);
-- if not Success then
-- ...; -- allocation failed
-- end if;
-- </example>
--
-----------------------------------------------------------------------
-- GtkAda - Ada95 binding for the Gimp Toolkit --
-- --
-- Copyright (C) 1998-1999 --
-- Emmanuel Briot, Joel Brobecker and Arnaud Charlet --
-- --
-- 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. --
-- --
-- As a special exception, if other files instantiate generics from --
-- this unit, or you link this unit with other files to produce an --
-- executable, this unit does not by itself cause the resulting --
-- executable to be covered by the GNU General Public License. This --
-- exception does not however invalidate any other reasons why the --
-- executable file might be covered by the GNU Public License. --
-----------------------------------------------------------------------
with Glib; use Glib;
with Glib.Glist;
pragma Elaborate_All (Glib.Glist);
with Gdk.Types;
with System;
with Unchecked_Conversion;
package Gdk.Visual is
type Gdk_Visual is new Gdk.C_Proxy;
Null_Visual : constant Gdk_Visual;
-- This type is not private because we need the full declaration
-- to instanciate Glib.Glist.Generic_List with it.
type Gdk_Visual_Type_Array is array (Natural range <>)
of Types.Gdk_Visual_Type;
function Get_Best_Depth return Gint;
function Get_Best_Type return Types.Gdk_Visual_Type;
procedure Get_System (Visual : out Gdk_Visual);
procedure Get_Best (Visual : out Gdk_Visual);
procedure Get_Best
(Visual : out Gdk_Visual;
Depth : in Gint);
procedure Get_Best
(Visual : out Gdk_Visual;
Visual_Type : in Types.Gdk_Visual_Type);
procedure Get_Best
(Visual : out Gdk_Visual;
Depth : in Gint;
Visual_Type : in Types.Gdk_Visual_Type);
function Query_Depths return Gint_Array;
function Query_Visual_Types return Gdk_Visual_Type_Array;
function Convert is new Unchecked_Conversion (Gdk_Visual, System.Address);
function Convert is new Unchecked_Conversion (System.Address, Gdk_Visual);
package Gdk_Visual_List is new Glib.Glist.Generic_List (Gdk_Visual);
function List_Visuals return Gdk_Visual_List.Glist;
private
Null_Visual : constant Gdk_Visual := null;
pragma Import (C, Get_Best_Depth, "gdk_visual_get_best_depth");
pragma Import (C, Get_Best_Type, "gdk_visual_get_best_type");
end Gdk.Visual;
-----------------------------------------------------------------------
-- GtkAda - Ada95 binding for the Gimp Toolkit --
-- --
-- Copyright (C) 1998-2000 --
-- Emmanuel Briot, Joel Brobecker and Arnaud Charlet --
-- --
-- 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. --
-- --
-- As a special exception, if other files instantiate generics from --
-- this unit, or you link this unit with other files to produce an --
-- executable, this unit does not by itself cause the resulting --
-- executable to be covered by the GNU General Public License. This --
-- exception does not however invalidate any other reasons why the --
-- executable file might be covered by the GNU Public License. --
-----------------------------------------------------------------------
-- <description>
--
-- This package implements a generic double-linked list.
-- Such lists are used throughout GtkAda to contain lists of widgets
-- (for the children of containers, or for the list of selected widgets
-- in a Gtk_Clist for instance), list of strings (for Gtk_Combo_Box),...
--
-- They provide a common interface to traverse these lists.
--
-- One useful note: you should only Free the lists that you have allocated
-- yourself, and not the lists that are returned by the subprograms in
-- GtkAda and should be left under GtkAda's control.
--
-- See the example below for an example on how to traverse a list.
--
-- Instantiating the package Generic_List requires two functions to convert
-- back and forth between your data type and a System.Address which is the
-- type stored at the C level.
-- Note that the lists used in GtkAda already have associated packages, like
-- Gtk.Enums.Gint_List, Gtk.Enums.String_List or Gtk.Widget.Widget_List.
--
-- </description>
-- <c_synchro>1.2.6</c_synchro>
with System;
package Glib.Glist is
generic
-- <doc_ignore>
type Gpointer (<>) is private;
with function Convert (P : Gpointer) return System.Address is <>;
with function Convert (S : System.Address) return Gpointer is <>;
-- </doc_ignore>
package Generic_List is
type Glist is private;
-- This type is both a list and an item in the list.
-- Each item points to its successor.
Null_List : constant Glist;
procedure Alloc (List : out Glist);
-- Allocate a new item in the list.
-- This item isn't associated with any data.
-- You probably don't have to use this subprogram, since Append,
-- Insert, Prepend, etc. already handle the allocation for you and
-- give a new value to the item.
procedure Append (List : in out Glist;
Data : in Gpointer);
-- Add a new item at the end of the list, and stores the new list
-- directly back in List.
-- The complexity of this operation is O(n)
function Concat (List1 : in Glist;
List2 : in Glist)
return Glist;
-- Concatenate two lists, and return the result.
-- List2 is added at the end of List1.
-- The complexity is O(n1) (depends on the size of List1).
procedure Insert (List : in out Glist;
Data : in Gpointer;
Position : in Gint);
-- Insert an item in the middle of a list.
-- If Position is 0, the item is added at the beginning of the list, if
-- it is negative the item is added at the end.
-- The complexity is O(Position).
function Find (List : in Glist;
Data : in Gpointer)
return Glist;
-- Find a value in the list, and return the first item that contains it.
-- Note that this function will not work if the function Convert does
-- not return the same value for two identical values.
function First (List : in Glist) return Glist;
-- Return the first item in the list.
-- Note that if List is in fact an item of a larger list, the return
-- value is the first item in the larger list itself.
procedure Free (List : in out Glist);
-- Free the list (but does not free the data in each of its elements).
-- This only frees the memory associated with the list itself.
-- You should only use this function on the lists that
-- you have created yourself, not on the list that are returned by some
-- functions in GtkAda (like Gtk.Clist.Get_Selection). These functions
-- return directly the list managed by the underlying C widget, and you
-- should never free the result yourself.
--
-- Note also that the memory might not be actually freed. For efficiency
-- reasons, GtkAda will keep the memory allocated and try to reuse it as
-- much as possible.
function Get_Data (List : in Glist) return Gpointer;
-- Return the value pointed to by List.
-- The System.Address container in the C list is converted to a Gpointer
-- through a call to Convert.
function Get_Data_Address (List : in Glist) return System.Address;
-- Return directly the System.Address contained in the C list.
-- This is used mainly internally in GtkAda to implement String lists,
-- and you should not have to use this subprogram yourself.
-- <doc_ignore>
function Get_Gpointer (List : in Glist) return Gpointer;
-- Sometimes, the data is not stored in the "data" field
-- of each cell, but rather at each cell. In such cases,
-- to retrieve the address of the data, we need to return
-- the address of the cell itself, insted of the address
-- pointed to by data.
--
-- Ex: the GtkCTree row_list.
-- </doc_ignore>
function Index (List : in Glist;
Data : in Gpointer)
return Gint;
-- Return the index of the first element in LIST that contains Data.
-- Note that this function is irrelevant if Convert does not return the
-- same value for two identical data.
function Last (List : in Glist) return Glist;
-- Return the last element in the list.
function Length (List : in Glist) return Guint;
-- Return the number of elements in the list.
-- The last item's index is Length - 1.
procedure List_Reverse (List : in out Glist);
-- Reverse the order of the list (the last item becomes the first, etc.)
function Next (List : in Glist) return Glist;
-- Returns the Item following LIST in the global list that contains
-- both.
-- If there is no such item, return Null_List. This is how you
-- stop iterating over a list.
function Nth (List : in Glist;
N : in Guint)
return Glist;
-- Give the nth item following LIST in the global list that
-- contains both.
-- If there is no such item, return Null_List.
function Nth_Data (List : in Glist;
N : in Guint)
return Gpointer;
-- Return the Data contained in the N-th item of List.
-- The result is undefined if there is no such item in the list.
-- The actual result in that case is the result of
-- Convert (System.Null_Address);
-- which might not mean anything.
function Position (List : in Glist;
Link : in Glist)
return Gint;
-- Return the position of Link in the List.
-- If Link is not contained in the list, -1 is returned.
procedure Prepend (List : in out Glist;
Data : in Gpointer);
-- Add an item at the beginning of the list.
-- This operation always succeed.
function Prev (List : in Glist) return Glist;
-- Return the item before List in the global list that contains both.
-- Return Null_List if there is no such item.
procedure Remove (List : in out Glist;
Data : in Gpointer);
-- Remove the first item in List that contains Data.
-- Note that this operation can succeed only if Convert always return
-- the same address for a given value.
procedure Remove_Link (List : in out Glist;
Link : in Glist);
-- Remove Link from the list to which it belongs.
-- If that list is not List, no error is returned, but Link is removed
-- anyway.
function Is_Created (List : in Glist) return Boolean;
-- Return True if there is a C widget associated with List.
------------------------
-- Internal functions --
------------------------
-- Please do not use the following functions. They are used internally
-- by GtkAda.
-- <doc_ignore>
function Get_Object (Obj : in Glist) return System.Address;
-- Returns the C object contained in OBJ.
pragma Inline (Get_Object);
procedure Set_Object (Obj : in out Glist; Value : in System.Address);
-- Modifies the C object contained in OBJ.
pragma Inline (Set_Object);
-- </doc_ignore>
private
type Glist is
record
Ptr : System.Address := System.Null_Address;
end record;
Null_List : constant Glist := (Ptr => System.Null_Address);
end Generic_List;
end Glib.Glist;
-- <example>
-- <include>../examples/documentation/glist_traverse.adb</include>
-- </example>
-----------------------------------------------------------------------
-- GtkAda - Ada95 binding for the Gimp Toolkit --
-- --
-- Copyright (C) 1998-1999 --
-- Emmanuel Briot, Joel Brobecker and Arnaud Charlet --
-- --
-- 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. --
-- --
-- As a special exception, if other files instantiate generics from --
-- this unit, or you link this unit with other files to produce an --
-- executable, this unit does not by itself cause the resulting --
-- executable to be covered by the GNU General Public License. This --
-- exception does not however invalidate any other reasons why the --
-- executable file might be covered by the GNU Public License. --
-----------------------------------------------------------------------
with Glib; use Glib;
package Gdk.Types is
type Gdk_Geometry is record
Min_Width : Gint;
Min_Height : Gint;
Max_Width : Gint;
Max_Height : Gint;
Base_Width : Gint;
Base_Height : Gint;
Width_Inc : Gint;
Height_Inc : Gint;
Min_Aspect : Gdouble;
Max_Aspect : Gdouble;
end record;
pragma Pack (Gdk_Geometry);
type Gdk_Point is record
X : Gint16;
Y : Gint16;
end record;
pragma Pack (Gdk_Point);
for Gdk_Point'Size use Gint'Size;
type Gdk_Points_Array is array (Positive range <>) of Gdk_Point;
pragma Pack (Gdk_Points_Array);
type Gdk_Segment is record
X1 : Gint16;
Y1 : Gint16;
X2 : Gint16;
Y2 : Gint16;
end record;
pragma Pack (Gdk_Segment);
for Gdk_Segment'Size use 64;
type Gdk_Segments_Array is array (Positive range <>) of Gdk_Segment;
pragma Pack (Gdk_Segments_Array);
--
-- See at the end of the package a list of all the types that
-- have not been "bound".
--
type Gdk_Atom is new Gulong;
-- This type represents a property of the X-server, that can be
-- manipulated through functions in Gdk.Property. They have an associated
-- name, that can be printed, as well as a value whose type may vary.
type Gdk_Axis_Use is
(Axis_Ignore,
Axis_X,
Axis_Y,
Axis_Pressure,
Axis_X_Tilt,
Axis_Y_Tilt,
Axis_Last);
type Gdk_Byte_Order is (Lsb_First, Msb_First);
type Gdk_Cap_Style is (Cap_Not_Last, Cap_Butt, Cap_Round, Cap_Projecting);
type Gdk_Crossing_Mode is (Crossing_Normal, Crossing_Grab, Crossing_Ungrab);
type Gdk_Cursor_Type is
(X_Cursor,
Arrow,
Based_Arrow_Down,
Based_Arrow_Up,
Boat,
Bogosity,
Bottom_Left_Corner,
Bottom_Right_Corner,
Bottom_Side,
Bottom_Tee,
Box_Spiral,
Center_Ptr,
Circle,
Clock,
Coffee_Mug,
Cross,
Cross_Reverse,
Crosshair,
Diamond_Cross,
Dot,
Dotbox,
Double_Arrow,
Draft_Large,
Draft_Small,
Draped_Box,
Exchange,
Fleur,
Gobbler,
Gumby,
Hand1,
Hand2,
Heart,
Icon,
Iron_Cross,
Left_Ptr,
Left_Side,
Left_Tee,
Leftbutton,
Ll_Angle,
Lr_Angle,
Man,
Middlebutton,
Mouse,
Pencil,
Pirate,
Plus,
Question_Arrow,
Right_Ptr,
Right_Side,
Right_Tee,
Rightbutton,
Rtl_Logo,
Sailboat,
Sb_Down_Arrow,
Sb_H_Double_Arrow,
Sb_Left_Arrow,
Sb_Right_Arrow,
Sb_Up_Arrow,
Sb_V_Double_Arrow,
Shuttle,
Sizing,
Spider,
Spraycan,
Star,
Target,
Tcross,
Top_Left_Arrow,
Top_Left_Corner,
Top_Right_Corner,
Top_Side,
Top_Tee,
Trek,
Ul_Angle,
Umbrella,
Ur_Angle,
Watch,
Xterm);
type Gdk_Device_Id is new Guint32;
-- This type is specific to GtkAda. In Gdk, guint32 is used instead.
type Gdk_Event_Mask is mod 2 ** 21;
-- Note that you need to change the event mask of a widget if you want
-- to be able to get some events. To change this mask, the widget
-- must first be Unrealized.
Null_Event_Mask : constant Gdk_Event_Mask;
Exposure_Mask : constant Gdk_Event_Mask;
Pointer_Motion_Mask : constant Gdk_Event_Mask;
-- Every time the mouse moves, GtkAda will send a Motion_Notify event.
-- These events will be sent as fast as possible, and your application
-- needs to be able to respond as fast as possible (generally about
-- 200 events per second).
Pointer_Motion_Hint_Mask : constant Gdk_Event_Mask;
-- GtkAda will only send one Motion_Notify event when the mouse moves.
-- The handler should call Gdk.Window.Get_Pointer, to get the current
-- position and signals GtkAda that it is ready to get another
-- Motion_Notify signal. No new Motion_Notify will be sent until
-- Get_Pointer has been called.
Button_Motion_Mask : constant Gdk_Event_Mask;
Button1_Motion_Mask : constant Gdk_Event_Mask;
Button2_Motion_Mask : constant Gdk_Event_Mask;
Button3_Motion_Mask : constant Gdk_Event_Mask;
Button_Press_Mask : constant Gdk_Event_Mask;
Button_Release_Mask : constant Gdk_Event_Mask;
Key_Press_Mask : constant Gdk_Event_Mask;
Key_Release_Mask : constant Gdk_Event_Mask;
Enter_Notify_Mask : constant Gdk_Event_Mask;
Leave_Notify_Mask : constant Gdk_Event_Mask;
Focus_Change_Mask : constant Gdk_Event_Mask;
Structure_Mask : constant Gdk_Event_Mask;
Property_Change_Mask : constant Gdk_Event_Mask;
Visibility_Notify_Mask : constant Gdk_Event_Mask;
Proximity_In_Mask : constant Gdk_Event_Mask;
Proximity_Out_Mask : constant Gdk_Event_Mask;
All_Events_Mask : constant Gdk_Event_Mask;
type Gdk_Event_Type is
(Nothing,
Delete,
Destroy,
Expose,
Motion_Notify,
Button_Press,
Gdk_2button_Press, -- Double-click
Gdk_3button_Press, -- Triple-click
Button_Release,
Key_Press,
Key_Release,
Enter_Notify,
Leave_Notify,
Focus_Change,
Configure,
Map,
Unmap,
Property_Notify,
Selection_Clear,
Selection_Request,
Selection_Notify,
Proximity_In,
Proximity_Out,
Drag_Enter,
Drag_Leave,
Drag_Motion,
Drag_Status,
Drop_Start,
Drop_Finished,
Client_Event,
Visibility_Notify,
No_Expose);
type Gdk_Extension_Mode is
(Extension_Events_None, Extension_Events_All, Extension_Events_Cursor);
type Gdk_Fill is (Solid, Tiled, Stippled, Opaque_Stippled);
type Gdk_Fill_Rule is (Even_Odd_Rule, Winding_Rule);
type Gdk_Function is
(Copy,
Invert,
Gdk_Xor,
Clear,
Gdk_And,
And_Reverse,
And_Invert,
Noop,
Gdk_Or,
Equiv,
Or_Reverse,
Copy_Invert,
Or_Invert,
Nand,
Set);
type Gdk_Join_Style is (Join_Miter, Join_Round, Join_Bevel);
type Gdk_IC_Attributes_Type is new Guint;
Ic_Style : constant Gdk_IC_Attributes_Type;
Ic_Client_Window : constant Gdk_IC_Attributes_Type;
Ic_Focus_Window : constant Gdk_IC_Attributes_Type;
Ic_Filter_Events : constant Gdk_IC_Attributes_Type;
Ic_Spot_Location : constant Gdk_IC_Attributes_Type;
Ic_Line_Spacing : constant Gdk_IC_Attributes_Type;
Ic_Cursor : constant Gdk_IC_Attributes_Type;
Ic_Preedit_Fontset : constant Gdk_IC_Attributes_Type;
Ic_Preedit_Area : constant Gdk_IC_Attributes_Type;
Ic_Preedit_Area_Needed : constant Gdk_IC_Attributes_Type;
Ic_Preedit_Foreground : constant Gdk_IC_Attributes_Type;
Ic_Preedit_Background : constant Gdk_IC_Attributes_Type;
Ic_Preedit_Pixmap : constant Gdk_IC_Attributes_Type;
Ic_Preedit_Colormap : constant Gdk_IC_Attributes_Type;
Ic_Status_Fontset : constant Gdk_IC_Attributes_Type;
Ic_Status_Area : constant Gdk_IC_Attributes_Type;
Ic_Status_Area_Needed : constant Gdk_IC_Attributes_Type;
Ic_Status_Foreground : constant Gdk_IC_Attributes_Type;
Ic_Status_Background : constant Gdk_IC_Attributes_Type;
Ic_Status_Pixmap : constant Gdk_IC_Attributes_Type;
Ic_Status_Colormap : constant Gdk_IC_Attributes_Type;
Ic_All_Req : constant Gdk_IC_Attributes_Type;
Ic_Preedit_Area_Req : constant Gdk_IC_Attributes_Type;
Ic_Preedit_Position_Req : constant Gdk_IC_Attributes_Type;
Ic_Status_Area_Req : constant Gdk_IC_Attributes_Type;
type Gdk_IM_Style is new Guint;
Im_Preedit_Area : constant Gdk_IM_Style;
Im_Preedit_Callbacks : constant Gdk_IM_Style;
Im_Preedit_Position : constant Gdk_IM_Style;
Im_Preedit_Nothing : constant Gdk_IM_Style;
Im_Preedit_None : constant Gdk_IM_Style;
Im_Preedit_Mask : constant Gdk_IM_Style;
Im_Status_Area : constant Gdk_IM_Style;
Im_Status_Callbacks : constant Gdk_IM_Style;
Im_Status_Nothing : constant Gdk_IM_Style;
Im_Status_None : constant Gdk_IM_Style;
Im_Status_Mask : constant Gdk_IM_Style;
type Gdk_Input_Condition is (Input_Read, Input_Write, Input_Exception);
type Gdk_Input_Mode is (Mode_Disabled, Mode_Screen, Mode_Window);
type Gdk_Input_Source is
(Source_Mouse,
Source_Pen,
Source_Eraser,
Source_Cursor);
type Gdk_Key_Type is new Guint;
-- see Gdk.Types.Keysyms for key type constants
type Gdk_Line_Style is (Line_Solid, Line_On_Off_Dash, Line_Double_Dash);
type Gdk_Modifier_Type is new Guint;
Shift_Mask : constant Gdk_Modifier_Type;
Lock_Mask : constant Gdk_Modifier_Type;
Control_Mask : constant Gdk_Modifier_Type;
Mod1_Mask : constant Gdk_Modifier_Type;
Mod2_Mask : constant Gdk_Modifier_Type;
Mod3_Mask : constant Gdk_Modifier_Type;
Mod4_Mask : constant Gdk_Modifier_Type;
Mod5_Mask : constant Gdk_Modifier_Type;
Button1_Mask : constant Gdk_Modifier_Type;
Button2_Mask : constant Gdk_Modifier_Type;
Button3_Mask : constant Gdk_Modifier_Type;
Button4_Mask : constant Gdk_Modifier_Type;
Button5_Mask : constant Gdk_Modifier_Type;
Release_Mask : constant Gdk_Modifier_Type;
Modifier_Mask : constant Gdk_Modifier_Type;
type Gdk_Notify_Type is
(Notify_Ancestor,
Notify_Virtual,
Notify_Inferior,
Notify_Non_Linear,
Notify_Non_Linear_Virtual,
Notify_Unknown);
type Gdk_Overlap_Type is
(Overlap_Rectangle_In,
Overlap_Rectangle_Out,
Overlap_Rectangle_Part);
type Gdk_Prop_Mode is
(Prop_Mode_Replace, Prop_Mode_Prepend, Prop_Mode_Append);
type Gdk_Subwindow_Mode is (Clip_By_Children, Include_Inferiors);
type Gdk_GC_Values_Mask is new Guint;
GC_Foreground : constant Gdk_GC_Values_Mask;
GC_Background : constant Gdk_GC_Values_Mask;
GC_Font : constant Gdk_GC_Values_Mask;
GC_Function : constant Gdk_GC_Values_Mask;
GC_Fill : constant Gdk_GC_Values_Mask;
GC_Tile : constant Gdk_GC_Values_Mask;
GC_Stipple : constant Gdk_GC_Values_Mask;
GC_Clip_Mask : constant Gdk_GC_Values_Mask;
GC_Subwindow : constant Gdk_GC_Values_Mask;
GC_Ts_X_Origin : constant Gdk_GC_Values_Mask;
GC_Tx_Y_Origin : constant Gdk_GC_Values_Mask;
GC_Clip_X_Origin : constant Gdk_GC_Values_Mask;
GC_Clip_Y_Origin : constant Gdk_GC_Values_Mask;
GC_Exposures : constant Gdk_GC_Values_Mask;
GC_Line_Width : constant Gdk_GC_Values_Mask;
GC_Line_Style : constant Gdk_GC_Values_Mask;
GC_Cap_Style : constant Gdk_GC_Values_Mask;
GC_Join_Style : constant Gdk_GC_Values_Mask;
type Gdk_Visibility_State is
(Visibility_Unobscured,
Visibility_Partial,
Visibility_Fully_Obscured);
type Gdk_Visual_Type is
(Visual_Static_Gray,
Visual_Grayscale,
Visual_Static_Color,
Visual_Pseudo_Color,
Visual_True_Color,
Visual_Direct_Color);
type Gdk_Window_Attributes_Type is new Guint;
Wa_Title : constant Gdk_Window_Attributes_Type;
Wa_X : constant Gdk_Window_Attributes_Type;
Wa_Y : constant Gdk_Window_Attributes_Type;
Wa_Cursor : constant Gdk_Window_Attributes_Type;
Wa_Colormap : constant Gdk_Window_Attributes_Type;
Wa_Visual : constant Gdk_Window_Attributes_Type;
Wa_Wmclass : constant Gdk_Window_Attributes_Type;
Wa_Noredir : constant Gdk_Window_Attributes_Type;
type Gdk_Window_Class is (Input_Output, Input_Only);
type Gdk_Window_Hints is new Guint;
Gdk_Hint_Pos : constant Gdk_Window_Hints;
Gdk_Hint_Min_Size : constant Gdk_Window_Hints;
Gdk_Hint_Max_Size : constant Gdk_Window_Hints;
Gdk_Hint_Base_Size : constant Gdk_Window_Hints;
Gdk_Hint_Aspect : constant Gdk_Window_Hints;
Gdk_Hint_Resize_Inc : constant Gdk_Window_Hints;
type Gdk_Window_Type is
(Window_Root,
Window_Toplevel,
Window_Child,
Window_Dialog,
Window_Temp,
Window_Pixmap,
Window_Foreign);
type Gdk_Wm_Decoration is new Guint;
Decor_All : constant Gdk_Wm_Decoration;
Decor_Border : constant Gdk_Wm_Decoration;
Decor_Resize_H : constant Gdk_Wm_Decoration;
Decor_Title : constant Gdk_Wm_Decoration;
Decor_Menu : constant Gdk_Wm_Decoration;
Decor_Minimize : constant Gdk_Wm_Decoration;
Decor_Maximize : constant Gdk_Wm_Decoration;
type Gdk_Wm_Function is new Guint;
Func_All : constant Gdk_Wm_Function;
Func_Resize : constant Gdk_Wm_Function;
Func_Move : constant Gdk_Wm_Function;
Func_Minimize : constant Gdk_Wm_Function;
Func_Maximize : constant Gdk_Wm_Function;
Func_Close : constant Gdk_Wm_Function;
subtype Gdk_WChar is Standard.Wide_Character;
subtype Gdk_WString is Standard.Wide_String;
-- Gdk does not define a Gdk_WString type, but uses pointers
-- to Gdk_WChar instead.
private
-------------------------
-- Private constants --
-------------------------
Null_Event_Mask : constant Gdk_Event_Mask := 0;
Exposure_Mask : constant Gdk_Event_Mask := 2 ** 1;
Pointer_Motion_Mask : constant Gdk_Event_Mask := 2 ** 2;
Pointer_Motion_Hint_Mask : constant Gdk_Event_Mask := 2 ** 3;
Button_Motion_Mask : constant Gdk_Event_Mask := 2 ** 4;
Button1_Motion_Mask : constant Gdk_Event_Mask := 2 ** 5;
Button2_Motion_Mask : constant Gdk_Event_Mask := 2 ** 6;
Button3_Motion_Mask : constant Gdk_Event_Mask := 2 ** 7;
Button_Press_Mask : constant Gdk_Event_Mask := 2 ** 8;
Button_Release_Mask : constant Gdk_Event_Mask := 2 ** 9;
Key_Press_Mask : constant Gdk_Event_Mask := 2 ** 10;
Key_Release_Mask : constant Gdk_Event_Mask := 2 ** 11;
Enter_Notify_Mask : constant Gdk_Event_Mask := 2 ** 12;
Leave_Notify_Mask : constant Gdk_Event_Mask := 2 ** 13;
Focus_Change_Mask : constant Gdk_Event_Mask := 2 ** 14;
Structure_Mask : constant Gdk_Event_Mask := 2 ** 15;
Property_Change_Mask : constant Gdk_Event_Mask := 2 ** 16;
Visibility_Notify_Mask : constant Gdk_Event_Mask := 2 ** 17;
Proximity_In_Mask : constant Gdk_Event_Mask := 2 ** 18;
Proximity_Out_Mask : constant Gdk_Event_Mask := 2 ** 19;
Substructure_Mask : constant Gdk_Event_Mask := 2 ** 20;
All_Events_Mask : constant Gdk_Event_Mask := 16#1FFFFF#;
Ic_Style : constant Gdk_IC_Attributes_Type := 2 ** 0;
Ic_Client_Window : constant Gdk_IC_Attributes_Type := 2 ** 1;
Ic_Focus_Window : constant Gdk_IC_Attributes_Type := 2 ** 2;
Ic_Filter_Events : constant Gdk_IC_Attributes_Type := 2 ** 3;
Ic_Spot_Location : constant Gdk_IC_Attributes_Type := 2 ** 4;
Ic_Line_Spacing : constant Gdk_IC_Attributes_Type := 2 ** 5;
Ic_Cursor : constant Gdk_IC_Attributes_Type := 2 ** 6;
Ic_Preedit_Fontset : constant Gdk_IC_Attributes_Type := 2 ** 10;
Ic_Preedit_Area : constant Gdk_IC_Attributes_Type := 2 ** 11;
Ic_Preedit_Area_Needed : constant Gdk_IC_Attributes_Type := 2 ** 12;
Ic_Preedit_Foreground : constant Gdk_IC_Attributes_Type := 2 ** 13;
Ic_Preedit_Background : constant Gdk_IC_Attributes_Type := 2 ** 14;
Ic_Preedit_Pixmap : constant Gdk_IC_Attributes_Type := 2 ** 15;
Ic_Preedit_Colormap : constant Gdk_IC_Attributes_Type := 2 ** 16;
Ic_Status_Fontset : constant Gdk_IC_Attributes_Type := 2 ** 21;
Ic_Status_Area : constant Gdk_IC_Attributes_Type := 2 ** 22;
Ic_Status_Area_Needed : constant Gdk_IC_Attributes_Type := 2 ** 23;
Ic_Status_Foreground : constant Gdk_IC_Attributes_Type := 2 ** 24;
Ic_Status_Background : constant Gdk_IC_Attributes_Type := 2 ** 25;
Ic_Status_Pixmap : constant Gdk_IC_Attributes_Type := 2 ** 26;
Ic_Status_Colormap : constant Gdk_IC_Attributes_Type := 2 ** 27;
Ic_All_Req : constant Gdk_IC_Attributes_Type :=
Ic_Style or Ic_Client_Window;
Ic_Preedit_Area_Req : constant Gdk_IC_Attributes_Type :=
Ic_Preedit_Area or Ic_Preedit_Fontset;
Ic_Preedit_Position_Req : constant Gdk_IC_Attributes_Type :=
Ic_Preedit_Area or Ic_Spot_Location or Ic_Preedit_Fontset;
Ic_Status_Area_Req : constant Gdk_IC_Attributes_Type :=
Ic_Status_Area or Ic_Status_Fontset;
Im_Preedit_Area : constant Gdk_IM_Style := 16#0001#;
Im_Preedit_Callbacks : constant Gdk_IM_Style := 16#0002#;
Im_Preedit_Position : constant Gdk_IM_Style := 16#0004#;
Im_Preedit_Nothing : constant Gdk_IM_Style := 16#0008#;
Im_Preedit_None : constant Gdk_IM_Style := 16#0010#;
Im_Preedit_Mask : constant Gdk_IM_Style := 16#001F#;
Im_Status_Area : constant Gdk_IM_Style := 16#0100#;
Im_Status_Callbacks : constant Gdk_IM_Style := 16#0200#;
Im_Status_Nothing : constant Gdk_IM_Style := 16#0400#;
Im_Status_None : constant Gdk_IM_Style := 16#0800#;
Im_Status_Mask : constant Gdk_IM_Style := 16#0F00#;
Shift_Mask : constant Gdk_Modifier_Type := 2 ** 0;
Lock_Mask : constant Gdk_Modifier_Type := 2 ** 1;
Control_Mask : constant Gdk_Modifier_Type := 2 ** 2;
Mod1_Mask : constant Gdk_Modifier_Type := 2 ** 3;
Mod2_Mask : constant Gdk_Modifier_Type := 2 ** 4;
Mod3_Mask : constant Gdk_Modifier_Type := 2 ** 5;
Mod4_Mask : constant Gdk_Modifier_Type := 2 ** 6;
Mod5_Mask : constant Gdk_Modifier_Type := 2 ** 7;
Button1_Mask : constant Gdk_Modifier_Type := 2 ** 8;
Button2_Mask : constant Gdk_Modifier_Type := 2 ** 9;
Button3_Mask : constant Gdk_Modifier_Type := 2 ** 10;
Button4_Mask : constant Gdk_Modifier_Type := 2 ** 11;
Button5_Mask : constant Gdk_Modifier_Type := 2 ** 12;
Release_Mask : constant Gdk_Modifier_Type := 2 ** 13;
Modifier_Mask : constant Gdk_Modifier_Type := 16#3FFF#;
Wa_Title : constant Gdk_Window_Attributes_Type := 2 ** 1;
Wa_X : constant Gdk_Window_Attributes_Type := 2 ** 2;
Wa_Y : constant Gdk_Window_Attributes_Type := 2 ** 3;
Wa_Cursor : constant Gdk_Window_Attributes_Type := 2 ** 4;
Wa_Colormap : constant Gdk_Window_Attributes_Type := 2 ** 5;
Wa_Visual : constant Gdk_Window_Attributes_Type := 2 ** 6;
Wa_Wmclass : constant Gdk_Window_Attributes_Type := 2 ** 7;
Wa_Noredir : constant Gdk_Window_Attributes_Type := 2 ** 8;
GC_Foreground : constant Gdk_GC_Values_Mask := 2 ** 0;
GC_Background : constant Gdk_GC_Values_Mask := 2 ** 1;
GC_Font : constant Gdk_GC_Values_Mask := 2 ** 2;
GC_Function : constant Gdk_GC_Values_Mask := 2 ** 3;
GC_Fill : constant Gdk_GC_Values_Mask := 2 ** 4;
GC_Tile : constant Gdk_GC_Values_Mask := 2 ** 5;
GC_Stipple : constant Gdk_GC_Values_Mask := 2 ** 6;
GC_Clip_Mask : constant Gdk_GC_Values_Mask := 2 ** 7;
GC_Subwindow : constant Gdk_GC_Values_Mask := 2 ** 8;
GC_Ts_X_Origin : constant Gdk_GC_Values_Mask := 2 ** 9;
GC_Tx_Y_Origin : constant Gdk_GC_Values_Mask := 2 ** 10;
GC_Clip_X_Origin : constant Gdk_GC_Values_Mask := 2 ** 11;
GC_Clip_Y_Origin : constant Gdk_GC_Values_Mask := 2 ** 12;
GC_Exposures : constant Gdk_GC_Values_Mask := 2 ** 13;
GC_Line_Width : constant Gdk_GC_Values_Mask := 2 ** 14;
GC_Line_Style : constant Gdk_GC_Values_Mask := 2 ** 15;
GC_Cap_Style : constant Gdk_GC_Values_Mask := 2 ** 16;
GC_Join_Style : constant Gdk_GC_Values_Mask := 2 ** 17;
Gdk_Hint_Pos : constant Gdk_Window_Hints := 2 ** 0;
Gdk_Hint_Min_Size : constant Gdk_Window_Hints := 2 ** 1;
Gdk_Hint_Max_Size : constant Gdk_Window_Hints := 2 ** 2;
Gdk_Hint_Base_Size : constant Gdk_Window_Hints := 2 ** 3;
Gdk_Hint_Aspect : constant Gdk_Window_Hints := 2 ** 4;
Gdk_Hint_Resize_Inc : constant Gdk_Window_Hints := 2 ** 5;
------------------------------
-- Representation clauses --
------------------------------
for Gdk_Event_Type use
(Nothing => -1,
Delete => 0,
Destroy => 1,
Expose => 2,
Motion_Notify => 3,
Button_Press => 4,
Gdk_2button_Press => 5,
Gdk_3button_Press => 6,
Button_Release => 7,
Key_Press => 8,
Key_Release => 9,
Enter_Notify => 10,
Leave_Notify => 11,
Focus_Change => 12,
Configure => 13,
Map => 14,
Unmap => 15,
Property_Notify => 16,
Selection_Clear => 17,
Selection_Request => 18,
Selection_Notify => 19,
Proximity_In => 20,
Proximity_Out => 21,
Drag_Enter => 22,
Drag_Leave => 23,
Drag_Motion => 24,
Drag_Status => 25,
Drop_Start => 26,
Drop_Finished => 27,
Client_Event => 28,
Visibility_Notify => 29,
No_Expose => 30);
for Gdk_Input_Condition use
(Input_Read => 2 ** 0,
Input_Write => 2 ** 1,
Input_Exception => 2 ** 2);
for Gdk_Subwindow_Mode use (Clip_By_Children => 0, Include_Inferiors => 1);
-- Warning : these values should be kept synchronized with gdk/gdcursors.h
-- ??? However, since these values are imported from Xlib, it is unlikely
-- that they will change soon.
for Gdk_Cursor_Type use
(X_Cursor => 0,
Arrow => 2,
Based_Arrow_Down => 4,
Based_Arrow_Up => 6,
Boat => 8,
Bogosity => 10,
Bottom_Left_Corner => 12,
Bottom_Right_Corner => 14,
Bottom_Side => 16,
Bottom_Tee => 18,
Box_Spiral => 20,
Center_Ptr => 22,
Circle => 24,
Clock => 26,
Coffee_Mug => 28,
Cross => 30,
Cross_Reverse => 32,
Crosshair => 34,
Diamond_Cross => 36,
Dot => 38,
Dotbox => 40,
Double_Arrow => 42,
Draft_Large => 44,
Draft_Small => 46,
Draped_Box => 48,
Exchange => 50,
Fleur => 52,
Gobbler => 54,
Gumby => 56,
Hand1 => 58,
Hand2 => 60,
Heart => 62,
Icon => 64,
Iron_Cross => 66,
Left_Ptr => 68,
Left_Side => 70,
Left_Tee => 72,
Leftbutton => 74,
Ll_Angle => 76,
Lr_Angle => 78,
Man => 80,
Middlebutton => 82,
Mouse => 84,
Pencil => 86,
Pirate => 88,
Plus => 90,
Question_Arrow => 92,
Right_Ptr => 94,
Right_Side => 96,
Right_Tee => 98,
Rightbutton => 100,
Rtl_Logo => 102,
Sailboat => 104,
Sb_Down_Arrow => 106,
Sb_H_Double_Arrow => 108,
Sb_Left_Arrow => 110,
Sb_Right_Arrow => 112,
Sb_Up_Arrow => 114,
Sb_V_Double_Arrow => 116,
Shuttle => 118,
Sizing => 120,
Spider => 122,
Spraycan => 124,
Star => 126,
Target => 128,
Tcross => 130,
Top_Left_Arrow => 132,
Top_Left_Corner => 134,
Top_Right_Corner => 136,
Top_Side => 138,
Top_Tee => 140,
Trek => 142,
Ul_Angle => 144,
Umbrella => 146,
Ur_Angle => 148,
Watch => 150,
Xterm => 152);
Decor_All : constant Gdk_Wm_Decoration := 2 ** 0;
Decor_Border : constant Gdk_Wm_Decoration := 2 ** 1;
Decor_Resize_H : constant Gdk_Wm_Decoration := 2 ** 2;
Decor_Title : constant Gdk_Wm_Decoration := 2 ** 3;
Decor_Menu : constant Gdk_Wm_Decoration := 2 ** 4;
Decor_Minimize : constant Gdk_Wm_Decoration := 2 ** 5;
Decor_Maximize : constant Gdk_Wm_Decoration := 2 ** 6;
Func_All : constant Gdk_Wm_Function := 2 ** 0;
Func_Resize : constant Gdk_Wm_Function := 2 ** 1;
Func_Move : constant Gdk_Wm_Function := 2 ** 2;
Func_Minimize : constant Gdk_Wm_Function := 2 ** 3;
Func_Maximize : constant Gdk_Wm_Function := 2 ** 4;
Func_Close : constant Gdk_Wm_Function := 2 ** 5;
end Gdk.Types;
-- The following types were not bound because it did not seem
-- to be necessary (yet).
--
-- + GdkColorContextMode
-- + GdkCrossingMode
-- + GdkFilterReturn
-- + GdkFontType
-- + GdkNotifyType
-- + GdkPropertyState
-- + GdkStatus
-----------------------------------------------------------------------
-- GtkAda - Ada95 binding for the Gimp Toolkit --
-- --
-- Copyright (C) 1998-1999 --
-- Emmanuel Briot, Joel Brobecker and Arnaud Charlet --
-- --
-- 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. --
-- --
-- As a special exception, if other files instantiate generics from --
-- this unit, or you link this unit with other files to produce an --
-- executable, this unit does not by itself cause the resulting --
-- executable to be covered by the GNU General Public License. This --
-- exception does not however invalidate any other reasons why the --
-- executable file might be covered by the GNU Public License. --
-----------------------------------------------------------------------
-- <description>
-- This package provides functions dealing with events from the window system.
-- In GtkAda applications, the events are handled automatically in
-- Gtk.Main.Do_Event, and passed on to the appropriate widgets, so these
-- functions are rarely needed.
--
-- !! Warning !! This is one of the only package that requires manual
-- memory management in some cases. If you use the function Allocate,
-- you have to use the function Free too...
-- </description>
with System;
with Glib; use Glib;
with Gdk.Rectangle;
with Gdk.Types;
with Gdk.Window;
package Gdk.Event is
------------------------------
-- Definition of the types --
------------------------------
type Gdk_Event is new Gdk.C_Proxy;
subtype Gdk_Event_Any is Gdk_Event;
-- Change from GtkAda1.2.3: There is no longer a tagged type
-- hierarchy, only one type.
-- However there are now a few runtime tests for each of the
-- function, to check whether a given field is available or not.
--
-- Fields common to all events: Window, Send_Event, Event_Type
subtype Gdk_Event_Button is Gdk_Event;
-- A button was pressed or release. Relevant fields:
-- Time, X, Y, Pressure, Xtilt, Ytilt, State, Button, Source,
-- Device_Id, X_Root, Y_Root, Window.
-- Type: Button_Press, Gdk_2Button_Press, Gdk_3Button_Press or
-- Button_Release.
subtype Gdk_Event_Configure is Gdk_Event;
-- The window configuration has changed: either it was remapped,
-- resized, moved, ...
-- Note that you usually don't have to redraw your window when you
-- receive such an event, since it is followed by an Gdk_Event_Expose.
-- Relevant fields: X, Y, Width, Height
-- Type: Configure
subtype Gdk_Event_Crossing is Gdk_Event;
-- The mouse has been moved in or out of the window
-- Relevant fields: Time, SubWindow, X, Y, X_Root, Y_Root, Mode,
-- Detail, Focus, State
-- Type: Enter_Notify, Leave_Notify
subtype Gdk_Event_Expose is Gdk_Event;
-- The window needs to be redrawn. For efficiency, gtk gives you the
-- smallest area that you need to redraw
-- Relevant fields: Area, Count, Graphics_Expose
-- Type: Expose
subtype Gdk_Event_No_Expose is Gdk_Event;
-- Indicate that the source region was completely available when parts of
-- a drawable were copied.
-- This is also emitted when a gc whose "exposures" attribute is set to
-- False in a call to Copy_Area or Draw_Pixmap. See the documentation for
-- Gdk.GC.Set_Exposures.
-- No Relevent fields except the common ones
-- Type: No_Expose
subtype Gdk_Event_Focus is Gdk_Event;
-- The focus has changed for a window.
-- Relevant fields: in
-- Type: Focus_Change
subtype Gdk_Event_Motion is Gdk_Event;
-- The mouse has moved
-- Relevant fields: Time, X, Y, Pressure, Xtilt, Ytilt, State,
-- Is_Hint, Source, Device_Id, X_Root, Y_Root
-- Type: Motion_Notify
subtype Gdk_Event_Key is Gdk_Event;
-- A keyboard key was pressed
-- Relevant fields: Time, State, Key_Val, String
-- Type: Key_Press, Key_Release
subtype Gdk_Event_Property is Gdk_Event;
-- Some property of the window was modified. GtkAda provides a higher
-- level interface, and you almost never need to use this event.
-- Relevent fields: Atom, Time, Property_State
-- Type: Property_Notify
subtype Gdk_Event_Proximity is Gdk_Event;
-- from gtk+: "This event type will be used pretty rarely. It only is
-- important for XInput aware programs that are drawing their own
-- cursor". This is only used with non standard input devices, like
-- graphic tablets.
-- Relevant fields: Time, Source, Device_Id
-- Type: Proximity_In, Proximity_Out
subtype Gdk_Event_Visibility is Gdk_Event;
-- The visibility state of the window (partially visibly, fully visible,
-- hidden). This event almost never need to be used, since other events
-- are generated at the same time, like expose_events
-- Relevant fields: Visibility_State
-- type: Visibility_Notify
subtype Gdk_Event_Selection is Gdk_Event;
-- This is how X11 implements a simple cut-and-paste mechanism. However,
-- GtkAda provides a higher level interface to the selection mechanism,
-- so this event will almost never be used.
-- Relevant fields: Selection, Target, Property, Requestor, Time
-- Type: Selection_Clear, Selection_Request, Selection_Notify
subtype Gdk_Event_Client is Gdk_Event;
-- This is an event used to send arbitrary data from one X application
-- to another. This event too is almost never used, and is not documented
-- here. Please consult an X11 documentation for more information.
-- Relevant fields: Message_Type, Data
-- Type: Client_Event
-- The following event types do not seem to have any associated type:
-- Delete, Destroy, Map, Unmap, Drag_Enter, Drag_Leave, Drag_Motion,
-- Drag_Status, Drag_Start, Drag_Finished
----------------------------------------
-- Specific definition for the fields --
----------------------------------------
type Gdk_Event_Client_Data_Format is
(Char_Array, Short_Array, Long_Array);
for Gdk_Event_Client_Data_Format use
(Char_Array => 8, Short_Array => 16, Long_Array => 32);
-- Values extracted from the XClientMessageEvent man page.
Number_Of_Characters : constant := 20;
Number_Of_Shorts : constant := 10;
Number_Of_Longs : constant := 5;
type Gdk_Event_Client_Data
(Format : Gdk_Event_Client_Data_Format) is
record
case Format is
when Char_Array =>
B : String (1 .. Number_Of_Characters);
when Short_Array =>
S : Gshort_Array (1 .. Number_Of_Shorts);
when Long_Array =>
L : Glong_Array (1 .. Number_Of_Longs);
end case;
end record;
-----------------------------------
-- Access to fields of the event --
-----------------------------------
Invalid_Field : exception;
-- If a field does not exist for the event you gave, an exception
-- Invalid_Field is raised
function Get_Event_Type (Event : in Gdk_Event) return Types.Gdk_Event_Type;
-- The type of the event.
function Get_Send_Event (Event : in Gdk_Event) return Boolean;
-- Set to true if the event was generated by the application, False
-- if generated by the X server/Win32.
function Get_Window (Event : in Gdk_Event) return Gdk.Window.Gdk_Window;
-- The window the event occured on.
function Get_Time (Event : in Gdk_Event) return Guint32;
-- Time when the event occured.
function Get_X (Event : in Gdk_Event) return Gdouble;
-- Horizontal coordinate of the mouse when the event occured.
-- The coordinates are relative to the parent window.
function Get_Y (Event : in Gdk_Event) return Gdouble;
-- Vertical coordinate of the mouse when the event occured.
-- The coordinates are relative to the parent window.
function Get_X_Root (Event : in Gdk_Event) return Gdouble;
-- Horizontal coordinate of the mouse when the event occured.
-- Relative to the root window.
function Get_Y_Root (Event : in Gdk_Event) return Gdouble;
-- Vertical coordinate of the mouse when the event occured.
-- Relative to the root window.
function Get_Button (Event : in Gdk_Event) return Guint;
-- Number of the button that was pressed.
function Get_State (Event : in Gdk_Event)
return Gdk.Types.Gdk_Modifier_Type;
-- State of the mouse buttons and keyboard keys just prior to the event.
function Get_Subwindow (Event : in Gdk_Event) return Gdk.Window.Gdk_Window;
-- Child window for the event.
-- For an Enter_Notify_Event, this is set to the initial window for the
-- pointer; for an Leave_Notify_Event this is set to the window occupied
-- by the pointer in its last position.
function Get_Mode (Event : in Gdk_Event) return Gdk.Types.Gdk_Crossing_Mode;
-- Return the mode of an Event.
-- Set to indicate whether the events are normal events, pseudo-motion
-- events when a grab activates or pseudo-motion events when a grab
-- deativates.
function Get_Detail (Event : in Gdk_Event) return Gdk.Types.Gdk_Notify_Type;
-- Set to indicate the notify details.
-- Most applications can ignore events with a Notify Virtual or a
-- Notify_Non_Linear_Virtual detail.
function Get_Focus (Event : in Gdk_Event) return Boolean;
-- Set to true if the window for the event is the focus window.
function Get_Pressure (Event : in Gdk_Event) return Gdouble;
-- This is set to a constant in the gtk+ code itself, so it
-- is most probably useless... Its value is 0.5.
-- It is only used with some special input devices, like drawing
-- tablets,...
function Get_Xtilt (Event : in Gdk_Event) return Gdouble;
-- This is set to a constant in the gtk+ code itself, so it
-- is most probably useless... Its value is 0.0.
-- It is only used with some special input devices, like drawing
-- tablets,...
function Get_Ytilt (Event : in Gdk_Event) return Gdouble;
-- This is set to a constant in the gtk+ code itself, so it
-- is most probably useless... Its value is 0.0.
-- It is only used with some special input devices, like drawing
-- tablets,...
function Get_Width (Event : in Gdk_Event) return Gint16;
-- Get the width in a configure event.
function Get_Height (Event : in Gdk_Event) return Gint16;
-- Get the height in a configure event.
function Get_Source
(Event : in Gdk_Event) return Gdk.Types.Gdk_Input_Source;
-- Set to a constant for now in the gtk+ source... Probably useless.
function Get_Device_Id
(Event : in Gdk_Event) return Gdk.Types.Gdk_Device_Id;
-- Set to a constant for now in the gtk+ source... Probably useless.
-- Since multiple input devices can be used at the same time, like a mouse
-- and a graphic tablet, this indicated which one generated the event.
function Get_Area (Event : in Gdk_Event) return Rectangle.Gdk_Rectangle;
-- The minimal area on which the event applies.
-- For Expose_Events, this is the minimal area to redraw.
function Get_Count (Event : in Gdk_Event) return Gint;
-- Number of Expose_Events that are to follow this one.
-- Most applications can ignore the event if Count is not 0, which also
-- allows for optimizations.
function Get_In (Event : in Gdk_Event) return Boolean;
-- True if the window has gained the focus, False otherwise.
function Get_Is_Hint (Event : in Gdk_Event) return Boolean;
-- ???
function Get_Key_Val (Event : in Gdk_Event) return Gdk.Types.Gdk_Key_Type;
-- Code of the key that was pressed (and that generated the event.
function Get_String (Event : in Gdk_Event) return String;
-- Symbol of the key that was pressed, as a string.
function Get_Atom (Event : in Gdk_Event) return Gdk.Types.Gdk_Atom;
-- Indicate which property has changed.
-- ??? Atom should not be a Guint
function Get_Property_State (Event : in Gdk_Event) return Guint;
-- ??? The return type should be changed.
function Get_Visibility_State
(Event : in Gdk_Event) return Gdk.Types.Gdk_Visibility_State;
-- Return the new visibility state for the window.
function Get_Selection (Event : in Gdk_Event) return Gdk.Types.Gdk_Atom;
-- What was selected in the window...
function Get_Target (Event : in Gdk_Event) return Gdk.Types.Gdk_Atom;
-- ???
function Get_Property (Event : in Gdk_Event) return Gdk.Types.Gdk_Atom;
-- ???
function Get_Requestor (Event : in Gdk_Event) return Guint32;
-- ???
function Get_Message_Type (Event : in Gdk_Event) return Gdk.Types.Gdk_Atom;
-- ???
function Get_Data (Event : in Gdk_Event) return Gdk_Event_Client_Data;
-- ???
--------------------------------------
-- Modifying the fields of an event --
--------------------------------------
procedure Set_Window (Event : in Gdk_Event; Win : Gdk.Window.Gdk_Window);
-- Set the Window field of an event.
procedure Set_X (Event : in Gdk_Event; X : Gdouble);
-- Set the X field of an event.
procedure Set_Y (Event : in Gdk_Event; Y : Gdouble);
-- Set the Y field of an event.
procedure Set_Xroot (Event : in Gdk_Event; Xroot : Gdouble);
-- Set the Xroot field of an event.
procedure Set_Yroot (Event : in Gdk_Event; Yroot : Gdouble);
-- Set the Yroot field of an event.
procedure Set_Width (Event : in Gdk_Event; Width : Gint16);
-- Set the Width field of an event.
procedure Set_Height (Event : in Gdk_Event; Height : Gint16);
-- Set the Height field of an event.
procedure Set_Button (Event : in Gdk_Event; Button : Guint);
-- Set the Button field of an event.
procedure Set_Time (Event : in Gdk_Event; Time : Guint32);
-- Set the time for the event.
-- If Time is 0, then it is set to the current time.
procedure Set_State (Event : in Gdk_Event;
State : in Gdk.Types.Gdk_Modifier_Type);
-- Set the State field of an event.
procedure Set_Subwindow (Event : in Gdk_Event;
Window : in Gdk.Window.Gdk_Window);
-- Set the Subwindow field of an event.
procedure Set_Mode (Event : in Gdk_Event;
Mode : in Gdk.Types.Gdk_Crossing_Mode);
-- Set the Mode field of an event.
procedure Set_Detail (Event : in Gdk_Event;
Detail : in Gdk.Types.Gdk_Notify_Type);
-- Set the Detail field of an event.
procedure Set_Focus (Event : in Gdk_Event; Has_Focus : Boolean);
-- Set the Focus field of an event.
procedure Set_Area (Event : in Gdk_Event; Area : Rectangle.Gdk_Rectangle);
-- Set the Area field of an event.
procedure Set_In (Event : in Gdk_Event; Focus_In : Boolean);
-- Set the In field of an event.
procedure Set_Is_Hint (Event : in Gdk_Event; Is_Hint : Boolean);
-- Set the Is_Hint field of an event.
procedure Set_Key_Val (Event : in Gdk_Event; Key : Gdk.Types.Gdk_Key_Type);
-- Set the Key_Val field of an event.
procedure Set_Atom (Event : in Gdk_Event; Atom : Gdk.Types.Gdk_Atom);
-- Set the Atom field of an event.
procedure Set_Property_State (Event : in Gdk_Event; State : Guint);
-- Set the Property_State field of an event.
procedure Set_Visibility_State (Event : in Gdk_Event;
State : Gdk.Types.Gdk_Visibility_State);
-- Set the Visibility_State field of an event.
procedure Set_Selection (Event : in Gdk_Event;
Selection : Gdk.Types.Gdk_Atom);
-- Set the Selection field of an event.
procedure Set_Target (Event : in Gdk_Event; Target : Gdk.Types.Gdk_Atom);
-- Set the Target field of an event.
procedure Set_Property (Event : in Gdk_Event;
Property : Gdk.Types.Gdk_Atom);
-- Set the Property field of an event.
procedure Set_Requestor (Event : in Gdk_Event; Requestor : Guint32);
-- Set the Requestor field of an event.
procedure Set_Message_Type (Event : in Gdk_Event; Typ : Gdk.Types.Gdk_Atom);
-- Set the Message_Type field of an event.
procedure Set_String (Event : in Gdk_Event; Str : String);
-- Set the string associated with an event.
-----------------------
-- General functions --
-----------------------
procedure Deep_Copy (From : Gdk_Event; To : out Gdk_Event);
-- Deep copy for an event. The C structure is itself duplicated.
-- You need to deallocated it yourself with a call to Free below.
procedure Get_Graphics_Expose
(Event : out Gdk_Event_Expose;
Window : in Gdk.Window.Gdk_Window);
-- Waits for a GraphicsExpose or NoExpose event
-- If it gets a GraphicsExpose event, it returns a pointer to it,
-- otherwise it returns an event for which Is_Created is False.
--
-- This function can be used to implement scrolling: you must call
-- Gdk.GC.Set_Exposures with True on the GC you are using for the
-- drawing, so that a events are generated for obscured areas and every
-- time a new part of the widget is drawn. However, there is a race
-- condition if multiple scrolls happen before you have finished
-- processing the first one. A workaround is to call Get_Graphics_Expose
-- after every scroll until it returns a null event.
function Events_Pending return Boolean;
-- Is there any event pending on the queue ?
procedure Get (Event : out Gdk_Event);
-- Get the next event on the queue.
procedure Peek (Event : out Gdk_Event);
-- Look at the next event on the queue, but leave if there.
procedure Put (Event : in Gdk_Event);
-- Add an event on the queue - Better to use Gtk.Signal.Emit_By_Name
procedure Set_Show_Events (Show_Events : in Boolean := True);
-- For debug purposes, you can choose whether you want to see the events
-- GtkAda receives.
function Get_Show_Events return Boolean;
-- Return the current state of Show_Events.
procedure Send_Client_Message_To_All (Event : in Gdk_Event);
-- Low level routine to send an Event to every window.
function Send_Client_Message
(Event : in Gdk_Event;
Xid : in Guint32) return Boolean;
-- Low level routine to send an Event to a specified X window.
procedure Allocate
(Event : out Gdk_Event;
Event_Type : in Types.Gdk_Event_Type;
Window : in Gdk.Window.Gdk_Window);
-- Create an event, whose fields are uninitialized.
-- You need to use the function Set_* above to modify them, before you can
-- send the event with Emit_By_Name.
-- !!Note!!: The event has to be freed if you have called this function.
-- Use the function Free.
procedure Free (Event : in out Gdk_Event);
-- Free the memory (and C structure) associated with an event.
-- You need to call this function only if the event was created through
-- Allocate, not if it was created by GtkAda itself (or you would get
-- a segmentation fault).
type Event_Handler_Func is access procedure
(Event : System.Address; Data : System.Address);
-- Function that can be used as a new event handler.
-- Use From_Address below to convert to a real event type.
-- This function should dispatch all the events properly, since it replaces
-- completly the default event handler. However, it can call
-- Gtk.Main.Do_Event to take care of the events it does not know how to
-- handle.
procedure Event_Handler_Set
(Func : Event_Handler_Func; Data : System.Address);
-- Set up a new event handler.
-- This handler replaces the default GtkAda event handler, and thus should
-- make sure that all events are correctly handled.
--
-- Note that managing the memory for Data is your responsability, and
-- Data is passed as is to Func.
function From_Address (C : System.Address) return Gdk_Event;
-- Convert a C handler to the matching Event structure.
function To_Address (C : Gdk_Event) return System.Address;
-- Convert an event to the underlying C handler.
function Is_Created (E : Gdk_Event) return Boolean;
-- Return True if the underlying C event has been created.
-------------------
-- Design issues --
-------------------
-- See gdk-event.adb for some of the design issues behing that package.
private
pragma Import (C, Get_Event_Type, "ada_gdk_event_get_type");
pragma Import (C, Get_Window, "ada_gdk_event_get_window");
pragma Import (C, Get_Time, "gdk_event_get_time");
pragma Import (C, Put, "gdk_event_put");
pragma Import
(C, Send_Client_Message_To_All, "gdk_event_send_clientmessage_toall");
pragma Import (C, Set_Window, "ada_gdk_event_set_window");
end Gdk.Event;
-----------------------------------------------------------------------
-- GtkAda - Ada95 binding for the Gimp Toolkit --
-- --
-- Copyright (C) 1998-1999 --
-- Emmanuel Briot, Joel Brobecker and Arnaud Charlet --
-- --
-- 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. --
-- --
-- As a special exception, if other files instantiate generics from --
-- this unit, or you link this unit with other files to produce an --
-- executable, this unit does not by itself cause the resulting --
-- executable to be covered by the GNU General Public License. This --
-- exception does not however invalidate any other reasons why the --
-- executable file might be covered by the GNU Public License. --
-----------------------------------------------------------------------
with Glib; use Glib;
package Gdk.Rectangle is
type Gdk_Rectangle is record
X : Gint16;
Y : Gint16;
Width : Guint16;
Height : Guint16;
end record;
pragma Pack (Gdk_Rectangle);
Full_Area : constant Gdk_Rectangle;
-- The constant above can be used in Gtk.Widget.Draw when you want to
-- redraw the whole widget
procedure Intersect
(Src1 : in Gdk_Rectangle;
Src2 : in Gdk_Rectangle;
Dest : out Gdk_Rectangle;
Intersect : out Boolean);
procedure Union
(Src1 : in Gdk_Rectangle;
Src2 : in Gdk_Rectangle;
Dest : out Gdk_Rectangle);
private
Full_Area : constant Gdk_Rectangle :=
(Gint16'First, Gint16'First, Guint16'Last, Guint16'Last);
end Gdk.Rectangle;
-----------------------------------------------------------------------
-- GtkAda - Ada95 binding for the Gimp Toolkit --
-- --
-- Copyright (C) 1998-2000 --
-- Emmanuel Briot, Joel Brobecker and Arnaud Charlet --
-- --
-- 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. --
-- --
-- As a special exception, if other files instantiate generics from --
-- this unit, or you link this unit with other files to produce an --
-- executable, this unit does not by itself cause the resulting --
-- executable to be covered by the GNU General Public License. This --
-- exception does not however invalidate any other reasons why the --
-- executable file might be covered by the GNU Public License. --
-----------------------------------------------------------------------
-- A Gdk_Window is the physical window that appears on the screen.
-- This is the low-level structure known to the X server or to Win32.
-- All the widgets are internally associated with a specific Gdk_Window,
-- that holds attributes such as the window decoration, whether the window
-- can be interactively resized,...
--
-- On some systems, the graphic server knows how to display non-rectangular
-- windows (this is part of the X extensions).
--
-- If you simply want to create a simply window, you should instead look
-- at the functions provided in Gtk.Window and Gtk.Widget, which are higher
-- level than these. See also the function Gtk.Widget.Get_Window to get the
-- Gdk_Window associated with a widget. Be aware that some of them don't have
-- such windows!
--
-- Scrolling can be implemented in several ways with GtkAda (toplevel
-- scrolling should be done with the Gtk_Scrolled_Window widget, but you
-- might want to handle scrolling yourself). See the function
-- Gdk.Event.Get_Graphics_Expose for more information.
-- <c_version>1.2.7</c_version>
with System;
with Glib; use Glib;
with Glib.Glist;
with Gdk;
with Gdk.Color;
with Gdk.Cursor;
with Gdk.Types;
with Gdk.Visual;
with Gdk.Window_Attr;
with Unchecked_Conversion;
package Gdk.Window is
subtype Gdk_Window is Gdk.Gdk_Window;
Null_Window : constant Gdk_Window;
procedure Gdk_New
(Window : out Gdk_Window;
Parent : Gdk_Window;
Attributes : Gdk.Window_Attr.Gdk_Window_Attr;
Attributes_Mask : Gdk.Types.Gdk_Window_Attributes_Type);
procedure Foreign_New (Window : out Gdk_Window; An_Id : Guint32);
procedure Destroy (Window : in out Gdk_Window);
-- Destroy a window and all its children.
procedure Ref (Window : Gdk_Window);
-- Increment the reference counter associated with window.
procedure Unref (Window : Gdk_Window);
-- Decrement the reference counter associated with window.
procedure Window_At_Pointer
(Win_X : out Gint;
Win_Y : out Gint;
Window : out Gdk_Window);
-- Return the window and the coordinates corresponding to the current
-- position of the cursor.
procedure Show (Window : Gdk_Window);
procedure Hide (Window : Gdk_Window);
procedure Withdraw (Window : Gdk_Window);
procedure Move
(Window : Gdk_Window;
X : Gint;
Y : Gint);
procedure Resize
(Window : Gdk_Window;
Width : Gint;
Height : Gint);
procedure Move_Resize
(Window : Gdk_Window;
X : Gint;
Y : Gint;
Width : Gint;
Height : Gint);
procedure Reparent
(Window : Gdk_Window;
New_Parent : Gdk_Window;
X : Gint;
Y : Gint);
procedure Clear (Window : Gdk_Window);
procedure Clear_Area
(Window : Gdk_Window;
X : Gint;
Y : Gint;
Width : Gint;
Height : Gint);
-- Does not generate an expose event.
procedure Clear_Area_E
(Window : Gdk_Window;
X : Gint;
Y : Gint;
Width : Gint;
Height : Gint);
-- Same as Clear_Area, but generates an expose event.
procedure Copy_Area
(Window : Gdk_Window;
Gc : Gdk.Gdk_GC;
X : Gint;
Y : Gint;
Source_Window : Gdk_Window;
Source_X : Gint;
Source_Y : Gint;
Width : Gint;
Height : Gint);
procedure Gdk_Raise (Window : Gdk_Window);
procedure Lower (Window : Gdk_Window);
procedure Set_Override_Redirect
(Window : Gdk_Window;
Override_Redirect : Boolean := True);
procedure Set_Child_Shapes (Window : Gdk_Window);
procedure Merge_Child_Shapes (Window : Gdk_Window);
function Is_Visible (Window : Gdk_Window) return Boolean;
function Is_Viewable (Window : Gdk_Window) return Boolean;
procedure Set_Hints
(Window : Gdk_Window;
X : Gint;
Y : Gint;
Min_Width : Gint;
Min_Height : Gint;
Max_Width : Gint;
Max_Height : Gint;
Flags : Gdk.Types.Gdk_Window_Hints);
procedure Set_Geometry_Hints
(Window : Gdk_Window;
Geometry : in out Gdk.Types.Gdk_Geometry;
Flags : Gdk.Types.Gdk_Window_Hints);
procedure Set_Title (Window : Gdk_Window; Title : String);
procedure Set_Role (Window : Gdk_Window; Role : String);
procedure Set_Transient_For
(Window : Gdk_Window; Leader : Gdk_Window);
procedure Set_Background
(Window : Gdk_Window; Color : Gdk.Color.Gdk_Color);
procedure Set_Back_Pixmap
(Window : Gdk_Window;
Pixmap : Gdk.Gdk_Pixmap;
Parent_Relative : Boolean);
procedure Set_Cursor
(Window : Gdk_Window; Cursor : Gdk.Cursor.Gdk_Cursor);
-- Note: the window must be realized first, ie have an associated X11/Win32
-- window.
procedure Set_Colormap
(Window : Gdk_Window; Colormap : Gdk.Color.Gdk_Colormap);
procedure Get_Geometry
(Window : Gdk_Window;
X : out Gint;
Y : out Gint;
Width : out Gint;
Height : out Gint;
Depth : out Gint);
-- You can get the size of the root window (ie the size of the screen)
-- simply by giving Null_Window as the first argument to this procedure.
procedure Get_Position
(Window : Gdk_Window;
X : out Gint;
Y : out Gint);
procedure Get_Size
(Window : Gdk_Window;
Width : out Gint;
Height : out Gint);
function Get_Visual (Window : Gdk_Window) return Gdk.Visual.Gdk_Visual;
function Get_Colormap (Window : Gdk_Window) return Gdk.Color.Gdk_Colormap;
function Get_Type (Window : Gdk_Window) return Gdk.Types.Gdk_Window_Type;
procedure Get_Origin
(Window : Gdk_Window;
X : out Gint;
Y : out Gint;
Success : out Boolean);
procedure Get_Desk_Relative_Origin
(Window : Gdk_Window;
X : out Gint;
Y : out Gint;
Success : out Boolean);
procedure Get_Root_Origin
(Window : Gdk_Window;
X : out Gint;
Y : out Gint);
procedure Get_Pointer
(Window : Gdk_Window;
X : out Gint;
Y : out Gint;
Mask : out Gdk.Types.Gdk_Modifier_Type;
Result : out Gdk_Window);
function Get_Parent (Window : Gdk_Window) return Gdk_Window;
function Get_Toplevel (Window : Gdk_Window) return Gdk_Window;
function Get_Events (Window : Gdk_Window) return Gdk.Types.Gdk_Event_Mask;
procedure Set_Events
(Window : Gdk_Window; Event_Mask : Gdk.Types.Gdk_Event_Mask);
procedure Set_Icon
(Window : Gdk_Window;
Icon_Window : Gdk_Window;
Pixmap : Gdk_Pixmap;
Mask : Gdk_Bitmap);
procedure Set_Icon_Name
(Window : Gdk_Window;
Name : String);
procedure Set_Group (Window : Gdk_Window; Leader : Gdk_Window);
procedure Set_Decorations
(Window : Gdk_Window;
Decorations : Gdk.Types.Gdk_Wm_Decoration);
procedure Set_Functions
(Window : Gdk_Window;
Functions : Gdk.Types.Gdk_Wm_Function);
-- Gdk_Window_List
--
function Convert is new Unchecked_Conversion (Gdk_Window, System.Address);
function Convert is new Unchecked_Conversion (System.Address, Gdk_Window);
package Gdk_Window_List is new
Glib.Glist.Generic_List (Gpointer => Gdk_Window);
function Get_Children
(Window : Gdk_Window) return Gdk_Window_List.Glist;
function Get_Toplevels return Gdk_Window_List.Glist;
private
Null_Window : constant Gdk_Window := null;
pragma Import (C, Clear, "gdk_window_clear");
pragma Import (C, Clear_Area, "gdk_window_clear_area");
pragma Import (C, Clear_Area_E, "gdk_window_clear_area_e");
pragma Import (C, Copy_Area, "gdk_window_copy_area");
pragma Import (C, Get_Events, "gdk_window_get_events");
pragma Import (C, Get_Geometry, "gdk_window_get_geometry");
pragma Import (C, Get_Parent, "gdk_window_get_parent");
pragma Import (C, Get_Position, "gdk_window_get_position");
pragma Import (C, Get_Root_Origin, "gdk_window_get_root_origin");
pragma Import (C, Get_Size, "gdk_window_get_size");
pragma Import (C, Get_Toplevel, "gdk_window_get_toplevel");
pragma Import (C, Get_Type, "gdk_window_get_type");
pragma Import (C, Hide, "gdk_window_hide");
pragma Import (C, Lower, "gdk_window_lower");
pragma Import (C, Merge_Child_Shapes, "gdk_window_merge_child_shapes");
pragma Import (C, Move, "gdk_window_move");
pragma Import (C, Move_Resize, "gdk_window_move_resize");
pragma Import (C, Gdk_Raise, "gdk_window_raise");
pragma Import (C, Ref, "gdk_window_ref");
pragma Import (C, Reparent, "gdk_window_reparent");
pragma Import (C, Resize, "gdk_window_resize");
pragma Import (C, Set_Child_Shapes, "gdk_window_set_child_shapes");
pragma Import (C, Set_Decorations, "gdk_window_set_decorations");
pragma Import (C, Set_Events, "gdk_window_set_events");
pragma Import (C, Set_Functions, "gdk_window_set_functions");
pragma Import (C, Set_Geometry_Hints, "gdk_window_set_geometry_hints");
pragma Import (C, Set_Group, "gdk_window_set_group");
pragma Import (C, Set_Hints, "gdk_window_set_hints");
pragma Import (C, Set_Transient_For, "gdk_window_set_transient_for");
pragma Import (C, Show, "gdk_window_show");
pragma Import (C, Unref, "gdk_window_unref");
pragma Import (C, Withdraw, "gdk_window_withdraw");
pragma Import (C, Set_Cursor, "gdk_window_set_cursor");
pragma Import (C, Get_Colormap, "gdk_window_get_colormap");
pragma Import (C, Get_Visual, "gdk_window_get_visual");
pragma Import (C, Set_Colormap, "gdk_window_set_colormap");
pragma Import (C, Set_Icon, "gdk_window_set_icon");
end Gdk.Window;
-----------------------------------------------------------------------
-- GtkAda - Ada95 binding for the Gimp Toolkit --
-- --
-- Copyright (C) 1998-2000 --
-- Emmanuel Briot, Joel Brobecker and Arnaud Charlet --
-- --
-- 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. --
-- --
-- As a special exception, if other files instantiate generics from --
-- this unit, or you link this unit with other files to produce an --
-- executable, this unit does not by itself cause the resulting --
-- executable to be covered by the GNU General Public License. This --
-- exception does not however invalidate any other reasons why the --
-- executable file might be covered by the GNU Public License. --
-----------------------------------------------------------------------
-- <description>
-- This package provides the capability to create predefined mouse cursors
-- as well as user defined ones.
-- </description>
-- <c_version>1.2.8</c_version>
with Glib;
with Gdk.Types;
with Gdk.Color;
package Gdk.Cursor is
type Gdk_Cursor is new Gdk.C_Proxy;
Null_Cursor : constant Gdk_Cursor;
procedure Gdk_New
(Widget : out Gdk_Cursor;
Cursor_Type : in Gdk.Types.Gdk_Cursor_Type);
-- Create a new standard cursor.
procedure Gdk_New
(Widget : out Gdk_Cursor;
Source : in Gdk.Gdk_Pixmap;
Mask : in Gdk.Gdk_Pixmap;
Fg : in Gdk.Color.Gdk_Color;
Bg : in Gdk.Color.Gdk_Color;
X : in Glib.Gint;
Y : in Glib.Gint);
-- Create a new cursor from a given pixmap and mask.
-- Both the pixmap and mask must have a depth of 1 (i.e. each pixel has
-- only 2 values - on or off). The standard cursor size is 16 by 16 pixels.
-- - Source is the pixmap specifying the cursor.
-- - Mask is the pixmap specifying the mask, which must be the same size
-- as source.
-- - Fg is the foreground color, used for the bits in the source which are
-- enabled. The color does not have to be allocated first.
-- - Bg is the background color, used for the bits in the source which are
-- disabled. The color does not have to be allocated first.
-- - X is the horizontal offset of the 'hotspot' of the cursor.
-- - Y is the vertical offset of the 'hotspot' of the cursor.
procedure Destroy (Cursor : in Gdk_Cursor);
-- Destroy a cursor, freeing any resources allocated for it.
private
Null_Cursor : constant Gdk_Cursor := null;
pragma Import (C, Destroy, "gdk_cursor_destroy");
end Gdk.Cursor;
-----------------------------------------------------------------------
-- GtkAda - Ada95 binding for the Gimp Toolkit --
-- --
-- Copyright (C) 1998-1999 --
-- Emmanuel Briot, Joel Brobecker and Arnaud Charlet --
-- --
-- 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. --
-- --
-- As a special exception, if other files instantiate generics from --
-- this unit, or you link this unit with other files to produce an --
-- executable, this unit does not by itself cause the resulting --
-- executable to be covered by the GNU General Public License. This --
-- exception does not however invalidate any other reasons why the --
-- executable file might be covered by the GNU Public License. --
-----------------------------------------------------------------------
with Gdk.Color;
with Gdk.Cursor;
with Gdk.Types;
with Gdk.Visual;
with Glib;
package Gdk.Window_Attr is
type Gdk_Window_Attr is new C_Proxy;
Null_Window_Attr : constant Gdk_Window_Attr;
procedure Gdk_New
(Window_Attr : out Gdk_Window_Attr;
Title : in String := "";
Event_Mask : in Gdk.Types.Gdk_Event_Mask :=
Gdk.Types.Null_Event_Mask;
X, Y : in Glib.Gint16 := 0;
Width : in Glib.Gint16 := 0;
Height : in Glib.Gint16 := 0;
Wclass : in Gdk.Types.Gdk_Window_Class :=
Gdk.Types.Input_Output;
Visual : in Gdk.Visual.Gdk_Visual :=
Gdk.Visual.Null_Visual;
Colormap : in Gdk.Color.Gdk_Colormap :=
Gdk.Color.Null_Colormap;
Window_Type : in Gdk.Types.Gdk_Window_Type :=
Gdk.Types.Window_Root;
Cursor : in Gdk.Cursor.Gdk_Cursor :=
Gdk.Cursor.Null_Cursor;
Wmclass_Name : in String := "";
Wmclass_Class : in String := "";
Override_Redirect : in Boolean := True);
procedure Destroy (Window_Attr : in out Gdk_Window_Attr);
procedure Set_Title
(Window_Attr : in Gdk_Window_Attr;
Title : in String);
function Get_Title (Window_Attr : in Gdk_Window_Attr) return String;
procedure Set_Event_Mask
(Window_Attr : in Gdk_Window_Attr;
Event_Mask : in Gdk.Types.Gdk_Event_Mask);
function Get_Event_Mask
(Window_Attr : in Gdk_Window_Attr)
return Gdk.Types.Gdk_Event_Mask;
procedure Set_X
(Window_Attr : in Gdk_Window_Attr;
X : in Glib.Gint16);
function Get_X (Window_Attr : in Gdk_Window_Attr) return Glib.Gint16;
procedure Set_Y
(Window_Attr : in Gdk_Window_Attr;
Y : in Glib.Gint16);
function Get_Y (Window_Attr : in Gdk_Window_Attr) return Glib.Gint16;
procedure Set_Width
(Window_Attr : in Gdk_Window_Attr;
Width : in Glib.Gint16);
function Get_Width (Window_Attr : in Gdk_Window_Attr) return Glib.Gint16;
procedure Set_Height
(Window_Attr : in Gdk_Window_Attr;
Height : in Glib.Gint16);
function Get_Height (Window_Attr : in Gdk_Window_Attr) return Glib.Gint16;
procedure Set_Window_Class
(Window_Attr : in Gdk_Window_Attr;
Wclass : in Gdk.Types.Gdk_Window_Class);
function Get_Window_Class
(Window_Attr : in Gdk_Window_Attr) return Gdk.Types.Gdk_Window_Class;
procedure Set_Visual
(Window_Attr : in Gdk_Window_Attr;
Visual : in Gdk.Visual.Gdk_Visual);
function Get_Visual
(Window_Attr : in Gdk_Window_Attr) return Gdk.Visual.Gdk_Visual;
procedure Set_Colormap
(Window_Attr : in Gdk_Window_Attr;
Colormap : in Gdk.Color.Gdk_Colormap);
function Get_Colormap
(Window_Attr : in Gdk_Window_Attr) return Gdk.Color.Gdk_Colormap;
procedure Set_Window_Type
(Window_Attr : in Gdk_Window_Attr;
Window_Type : in Gdk.Types.Gdk_Window_Type);
function Get_Window_Type
(Window_Attr : in Gdk_Window_Attr) return Gdk.Types.Gdk_Window_Type;
procedure Set_Cursor
(Window_Attr : in Gdk_Window_Attr;
Cursor : in Gdk.Cursor.Gdk_Cursor);
function Get_Cursor
(Window_Attr : in Gdk_Window_Attr)
return Gdk.Cursor.Gdk_Cursor;
procedure Set_Wmclass_Name
(Window_Attr : in Gdk_Window_Attr;
Wmclass_Name : in String);
function Get_Wmclass_Name (Window_Attr : in Gdk_Window_Attr) return String;
procedure Set_Wmclass_Class
(Window_Attr : in Gdk_Window_Attr;
Wmclass_Class : in String);
function Get_Wmclass_Class (Window_Attr : in Gdk_Window_Attr) return String;
procedure Set_Override_Redirect
(Window_Attr : in Gdk_Window_Attr;
Override_Redirect : in Boolean);
function Get_Override_Redirect
(Window_Attr : in Gdk_Window_Attr) return Boolean;
private
Null_Window_Attr : constant Gdk_Window_Attr := null;
pragma Import (C, Get_Colormap, "ada_gdk_window_attr_get_colormap");
pragma Import (C, Get_Cursor, "ada_gdk_window_attr_get_cursor");
pragma Import (C, Get_Event_Mask, "ada_gdk_window_attr_get_event_mask");
pragma Import (C, Get_Height, "ada_gdk_window_attr_get_height");
pragma Import (C, Get_Visual, "ada_gdk_window_attr_get_visual");
pragma Import (C, Get_Width, "ada_gdk_window_attr_get_width");
pragma Import (C, Get_Window_Class, "ada_gdk_window_attr_get_wclass");
pragma Import (C, Get_Window_Type, "ada_gdk_window_attr_get_window_type");
pragma Import (C, Get_X, "ada_gdk_window_attr_get_x");
pragma Import (C, Get_Y, "ada_gdk_window_attr_get_y");
pragma Import (C, Set_Colormap, "ada_gdk_window_attr_set_colormap");
pragma Import (C, Set_Cursor, "ada_gdk_window_attr_set_cursor");
pragma Import (C, Set_Event_Mask, "ada_gdk_window_attr_set_event_mask");
pragma Import (C, Set_Height, "ada_gdk_window_attr_set_height");
pragma Import (C, Set_Visual, "ada_gdk_window_attr_set_visual");
pragma Import (C, Set_Width, "ada_gdk_window_attr_set_width");
pragma Import (C, Set_Window_Class, "ada_gdk_window_attr_set_wclass");
pragma Import (C, Set_Window_Type, "ada_gdk_window_attr_set_window_type");
pragma Import (C, Set_X, "ada_gdk_window_attr_set_x");
pragma Import (C, Set_Y, "ada_gdk_window_attr_set_y");
end Gdk.Window_Attr;
-----------------------------------------------------------------------
-- GtkAda - Ada95 binding for Gtk+/Gnome --
-- --
-- Copyright (C) 1998-2000 E. Briot, J. Brobecker and A. Charlet --
-- Copyright (C) 2000-2001 ACT-Europe --
-- --
-- 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. --
-- --
-- As a special exception, if other files instantiate generics from --
-- this unit, or you link this unit with other files to produce an --
-- executable, this unit does not by itself cause the resulting --
-- executable to be covered by the GNU General Public License. This --
-- exception does not however invalidate any other reasons why the --
-- executable file might be covered by the GNU Public License. --
-----------------------------------------------------------------------
-- <description>
--
-- Pixmaps are off-screen drawables. They can be drawn upon with the standard
-- drawing primitives, then copied to another drawable (such as a Gdk_Window)
-- with Gdk.Pixmap.Draw. The depth of a pixmap is the number of bits per
-- pixels. Bitmaps are simply pixmaps with a depth of 1. (That is, they are
-- monochrome bitmaps - each pixel can be either on or off).
-- @pxref{Package_Gdk.Pixmap} for more details on pixmap handling.
--
-- </description>
-- <c_version>1.2.7</c_version>
with Glib; use Glib;
with Gdk.Window;
package Gdk.Bitmap is
subtype Gdk_Bitmap is Gdk.Gdk_Bitmap;
-- A black and white image.
-- This type is mainly used as a mask when drawing other colored images.
-- Each pixel can have two values, 0 or 1.
Null_Bitmap : constant Gdk_Bitmap;
procedure Gdk_New (Bitmap : out Gdk_Bitmap;
Window : in Gdk.Window.Gdk_Window;
Width : in Gint;
Height : in Gint);
-- Create a new bitmap with a given size.
-- Window is used to determine default values for the new bitmap.
-- Can be eventually null in which case the root window is used.
-- Width is the width of the new bitmap in pixels.
-- Height is the height of the new bitmap in pixels.
procedure Ref (Bitmap : in Gdk_Bitmap);
-- Add a reference to a bitmap.
procedure Unref (Bitmap : in Gdk_Bitmap);
-- This is the usual way to destroy a bitmap. The memory is freed when
-- there is no more reference
procedure Create_From_Data (Bitmap : out Gdk_Bitmap;
Window : in Gdk.Window.Gdk_Window;
Data : in String;
Width : in Gint;
Height : in Gint);
-- Create a bitmap from data in XBM format.
-- Window is used to determine default values for the new bitmap, can be
-- null in which case the root window is used.
-- Data is the XBM data.
-- Width is the width of the new bitmap in pixels.
-- Height is the height of the new bitmap in pixels.
private
Null_Bitmap : constant Gdk_Bitmap := null;
pragma Import (C, Ref, "gdk_bitmap_ref");
pragma Import (C, Unref, "gdk_bitmap_unref");
end Gdk.Bitmap;
-----------------------------------------------------------------------
-- GtkAda - Ada95 binding for the Gimp Toolkit --
-- --
-- Copyright (C) 1998-1999 --
-- Emmanuel Briot, Joel Brobecker and Arnaud Charlet --
-- --
-- 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. --
-- --
-- As a special exception, if other files instantiate generics from --
-- this unit, or you link this unit with other files to produce an --
-- executable, this unit does not by itself cause the resulting --
-- executable to be covered by the GNU General Public License. This --
-- exception does not however invalidate any other reasons why the --
-- executable file might be covered by the GNU Public License. --
-----------------------------------------------------------------------
with Gdk; use Gdk;
with Gdk.Types;
with Gtk.Object;
package Gtk.Accel_Group is
type Gtk_Accel_Group is new Gdk.C_Proxy;
type Gtk_Accel_Entry is new Gdk.C_Proxy;
type Gtk_Accel_Flags is new Guint;
Accel_Visible : constant Gtk_Accel_Flags;
Accel_Signal_Visible : constant Gtk_Accel_Flags;
Accel_Locked : constant Gtk_Accel_Flags;
Accel_Mask : constant Gtk_Accel_Flags;
--------------------------
-- Accelerator Groups --
--------------------------
procedure Gtk_New (Widget : out Gtk_Accel_Group);
function Get_Default return Gtk_Accel_Group;
-- procedure Ref
-- procedure Unref
function Activate
(Accel_Group : in Gtk_Accel_Group;
Accel_Key : in Gdk.Types.Gdk_Key_Type;
Accel_Mods : in Gdk.Types.Gdk_Modifier_Type) return Boolean;
function Accel_Groups_Activate
(Object : access Gtk.Object.Gtk_Object_Record'Class;
Accel_Key : in Gdk.Types.Gdk_Key_Type;
Accel_Mods : in Gdk.Types.Gdk_Modifier_Type) return Boolean;
procedure Attach
(Accel_Group : in Gtk_Accel_Group;
Object : access Gtk.Object.Gtk_Object_Record'Class);
-- Object should be able to get key_press and key_release events (ie
-- this won't work in a Gtk_Box which has no window).
-- The recommended way is to attach the Accel_Group to the toplevel window.
procedure Detach
(Accel_Group : in Gtk_Accel_Group;
Object : access Gtk.Object.Gtk_Object_Record'Class);
procedure Lock (Accel_Group : in Gtk_Accel_Group);
procedure Unlock (Accel_Group : in Gtk_Accel_Group);
---------------------------------
-- Accelerator Group Entries --
---------------------------------
function Get_Entry
(Accel_Group : in Gtk_Accel_Group;
Accel_Key : in Gdk.Types.Gdk_Key_Type;
Accel_Mods : in Gdk.Types.Gdk_Modifier_Type) return Gtk_Accel_Entry;
procedure Lock_Entry
(Accel_Group : in Gtk_Accel_Group;
Accel_Key : in Gdk.Types.Gdk_Key_Type;
Accel_Mods : in Gdk.Types.Gdk_Modifier_Type);
procedure Unlock_Entry
(Accel_Group : in Gtk_Accel_Group;
Accel_Key : in Gdk.Types.Gdk_Key_Type;
Accel_Mods : in Gdk.Types.Gdk_Modifier_Type);
procedure Add
(Accel_Group : in Gtk_Accel_Group;
Accel_Key : in Gdk.Types.Gdk_Key_Type;
Accel_Mods : in Gdk.Types.Gdk_Modifier_Type;
Accel_Flags : in Gtk_Accel_Flags;
Object : access Gtk.Object.Gtk_Object_Record'Class;
Accel_Signal : in String);
procedure Remove
(Accel_Group : in Gtk_Accel_Group;
Accel_Key : in Gdk.Types.Gdk_Key_Type;
Accel_Mods : in Gdk.Types.Gdk_Modifier_Type;
Object : access Gtk.Object.Gtk_Object_Record'Class);
---------------------------
-- Accelerator Signals --
---------------------------
procedure Handle_Add
(Object : access Gtk.Object.Gtk_Object_Record'Class;
Accel_Signal_Id : in Guint;
Accel_Group : in Gtk_Accel_Group;
Accel_Key : in Gdk.Types.Gdk_Key_Type;
Accel_Mods : in Gdk.Types.Gdk_Modifier_Type;
Accel_Flags : in Gtk_Accel_Flags);
procedure Handle_Remove
(Object : access Gtk.Object.Gtk_Object_Record'Class;
Accel_Group : in Gtk_Accel_Group;
Accel_Key : in Gdk.Types.Gdk_Key_Type;
Accel_Mods : in Gdk.Types.Gdk_Modifier_Type);
-- function Create_Add
-- function Create_Remove
-- procedure Marshal_Add
-- procedure Marshal_Remove
---------------------
-- Miscellaneous --
---------------------
-- function Accel_Groups_From_Object
-- function Entries_From_Object
--------------------
-- Accelerators --
--------------------
function Accelerator_Valid
(Keyval : in Gdk.Types.Gdk_Key_Type;
Modifiers : in Gdk.Types.Gdk_Modifier_Type) return Boolean;
procedure Accelerator_Parse
(Accelerator : in String;
Accelerator_Key : out Gdk.Types.Gdk_Key_Type;
Accelerator_Mods : out Gdk.Types.Gdk_Modifier_Type);
function Accelerator_Name
(Accelerator_Key : in Gdk.Types.Gdk_Key_Type;
Accelerator_Mods : in Gdk.Types.Gdk_Modifier_Type) return String;
procedure Accelerator_Set_Default_Mod_Mask
(Default_Mod_Mask : in Gdk.Types.Gdk_Modifier_Type);
function Accelerator_Get_Default_Mod_Mask
return Gdk.Types.Gdk_Modifier_Type;
private
Accel_Visible : constant Gtk_Accel_Flags := 2 ** 0;
Accel_Signal_Visible : constant Gtk_Accel_Flags := 2 ** 1;
Accel_Locked : constant Gtk_Accel_Flags := 2 ** 2;
Accel_Mask : constant Gtk_Accel_Flags := 16#07#;
pragma Import (C, Accelerator_Set_Default_Mod_Mask,
"gtk_accelerator_set_default_mod_mask");
pragma Import (C, Accelerator_Get_Default_Mod_Mask,
"gtk_accelerator_get_default_mod_mask");
pragma Import (C, Get_Default, "gtk_accel_group_get_default");
pragma Import (C, Lock, "gtk_accel_group_lock");
pragma Import (C, Unlock, "gtk_accel_group_unlock");
end Gtk.Accel_Group;
-----------------------------------------------------------------------
-- GtkAda - Ada95 binding for the Gimp Toolkit --
-- --
-- Copyright (C) 1998-2000 --
-- Emmanuel Briot, Joel Brobecker and Arnaud Charlet --
-- --
-- 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. --
-- --
-- As a special exception, if other files instantiate generics from --
-- this unit, or you link this unit with other files to produce an --
-- executable, this unit does not by itself cause the resulting --
-- executable to be covered by the GNU General Public License. This --
-- exception does not however invalidate any other reasons why the --
-- executable file might be covered by the GNU Public License. --
-----------------------------------------------------------------------
-- <description>
-- This is the base class of the widget hierarchy.
-- Everything in GtkAda inherits from this class Gtk_Object, except for a few
-- structures in the Gdk.* packages (low-level drawing routines).
--
-- This class provides a set of handful features that you can choose to reuse
-- in your applications:
--
-- - Reference counting: an object is not deleted while there exists at least
-- one reference to it. Although GtkAda mostly takes care of that aspect
-- transparently, you might need in some obscure cases to increment or
-- decrement the reference counting for a widget manually, so that it is not
-- removed from memory while you still need it.
--
-- - User data: any number of data can be attached to a Gtk_Object or one of
-- its children. Theses data are references by a String, in a hash-table.
-- GtkAda itself uses this feature to provide an easy conversion between C
-- and Ada widgets.
-- Although you might prefer to have a completely object-oriented
-- application (and thus associate data through class inheritance), it
-- might be convenient to directly attach some data to your objects.
--
-- - It also contains the basic structures and subprograms required for signal
-- emission. This is of course used to implement the signal mechanism in
-- GtkAda itself, but can also be used to implement a Model/View/Controller
-- framework.
--
-- Note that a lot of functions provided in the C interface are not provided
-- here. They are used to emulate an object-oriented language in C, which can
-- of course be done much more conveniently in Ada. Therefore most of these
-- functions are not needed.
--
-- Here is a brief explanation on how the reference counting and destruction
-- process work. You should not have to understand all this to use GtkAda, but
-- it might help anyway.
--
-- When an object (descendant of Gtk.Object) is created, it has initially a
-- ref_count of 1. A flag is set to say the object is "floating". See the
-- Flags functions in this package for how to retrieve the status of this
-- flag.
--
-- When the object gets a parent (ie Gtk.Widget.Set_Parent is called, possibly
-- from other subprograms like Gtk.Container.Add, Gtk.Box.Pack_Start, ...),
-- the ref_count of the object is incremented to 2.
-- If the object was still "floating", it is also "sinked", ie its ref_count
-- is decremented to 1, and the "floating" flag is cleared.
--
-- The same behavior as above happens when the object is registered as a
-- top-level widget (i.e. we know it won't have any parent).
--
-- Thus the normal life cycle of an object is to have a ref_count to 1, and
-- not be a "floating" object.
--
-- When the object is destroyed, the following happens:
-- A temporary reference to the object is created (call to Ref), and
-- ref_count to 2.
-- The object is shutdown:
-- It is removed from its parent (if any), and its ref_count is
-- decremented to 1.
-- The "destroy" signal is emitted, the user's handlers are called,
-- and then all the handlers connected to the object are destroyed.
-- The object is unref-ed. If its ref_count goes down to 0 (normal case),
-- the memory used by the object and its user_data is freed.
--
-- </description>
-- <c_version>1.2.6</c_version>
with System;
with Gtkada.Types;
package Gtk.Object is
type Gtk_Object_Record is new Gtk.Root_Type with private;
type Gtk_Object is access all Gtk_Object_Record'Class;
procedure Ref (Object : access Gtk_Object_Record);
-- Increment the reference count on the object.
-- Since an object is not deleted while its reference count is not null,
-- this is a way to keep an object in memory.
-- GtkAda mostly takes care of everything, and you should not need this
-- function except in special cases.
procedure Unref (Object : access Gtk_Object_Record);
-- Decrement the reference count for an object.
-- If it passed from 1 to 0, then the memory allocated for the object is
-- freed, and the object no longer usable.
-- It is better to use Destroy than Unref to destroy an object, although
-- both might be acceptable.
procedure Sink (Object : access Gtk_Object_Record);
-- Sink the object.
-- If the object is floating (does not have a parent yet), it is unref-ed
-- once and the floating flag is cleared.
procedure Destroy (Object : access Gtk_Object_Record);
-- Destroy the object.
-- This emits a "destroy" signal, calls all your handlers, and then
-- unconnects them all. The object is then unref-ed, and if its reference
-- count goes down to 0, the memory associated with the object and its
-- user data is freed.
-- Note that when you destroy handlers are called, the user_data is still
-- available.
function Get_Type return Gtk.Gtk_Type;
-- Return the internal value associated with a Gtk_Object internally.
pragma Import (C, Get_Type, "gtk_object_get_type");
function Get_Type (Object : access Gtk_Object_Record) return Gtk_Type;
-- Return the type of Object.
-- This function is mostly used internally, since in Ada you can simply
-- test whether an object belong to a class with a statement like:
--
-- if Object in Gtk_Button_Record'Class then ...
--
-- which is easier.
-------------
-- Flags --
-------------
-- Each object is associated with a set of flags, that reports the state
-- of the object.
-- The following flags are known by all objects:
--
-- - "Destroyed":
-- Set if the object is marked as destroyed (if its reference count is
-- not yet 0, the memory has not been freed, but you should not use it
-- anyway).
--
-- - "Floating":
-- The object has no parent yet, since it was just created. Its
-- reference count is still 1 (as it was initially). This flag is
-- cleared as soon as Set_Parent is called on the widget or the widget
-- is qualified as a toplevel widget (see
-- Gtk.Container.Register_Toplevel).
--
-- - "Connected":
-- Set if the object is connected to at least one handler
--
-- - "Constructed":
-- Set if the object has been fully constructed, and is now usable.
-- Every time you create an object at the GtkAda level, the object will
-- be fully constructed, and you shouldn't have to worry about that
-- flag.
Destroyed : constant := 2 ** 0;
Floating : constant := 2 ** 1;
Connected : constant := 2 ** 2;
Constructed : constant := 2 ** 3;
function Flags (Object : access Gtk_Object_Record) return Guint32;
-- Return the flags that are set for the object, as a binary mask.
procedure Set_Flags (Object : access Gtk_Object_Record;
Flags : in Guint32);
-- Set some specific flags for the object.
-- Flags is a mask that will be added to the current flags of the object.
procedure Unset_Flags (Object : access Gtk_Object_Record;
Flags : in Guint32);
-- Unset some specific flags for the object.
-- Flags is a mask that will be deleted from the current flags of the
-- object.
function Flag_Is_Set (Object : access Gtk_Object_Record;
Flag : in Guint32)
return Boolean;
-- Return True if the specific flag Flag is set for the object.
function Destroyed_Is_Set (Object : access Gtk_Object_Record'Class)
return Boolean;
-- Test if the Destroyed flag is set for the object.
function Floating_Is_Set (Object : access Gtk_Object_Record'Class)
return Boolean;
-- Test if the Floating flag is set for the object.
function Connected_Is_Set (Object : access Gtk_Object_Record'Class)
return Boolean;
-- Test if the Connected flag is set for the object.
function Constructed_Is_Set (Object : access Gtk_Object_Record'Class)
return Boolean;
-- Test if the Constructed flag is set for the object
--------------------------
-- Creating new widgets --
--------------------------
-- These types and functions are used only when creating new widget types
-- directly in Ada. These functions initialize the classes so that they are
-- correctly recognized by gtk+ itself
-- See the GtkAda user's guide for more information on how to create your
-- own widget types in Ada.
type Signal_Parameter_Types is array (Natural range <>, Natural range <>)
of Gtk_Type;
-- The description of the parameters for each event.
-- Each event defined with Initialize_Class_Record below should have an
-- entry in this table. If Gtk_Type_None is found in the table, it is
-- ignored. For instance, a Signal_Parameter_Type like:
-- (1 => (1 => Gdk_Type_Gdk_Event, 2 => Gdk_Type_Nonde),
-- 2 => (1 => Gdk_Type_Int, 2 => Gdk_Type_Int));
-- defines two signals, the first with a single Gdk_Event parameter, the
-- second with two ints parameters.
Null_Parameter_Types : constant Signal_Parameter_Types (1 .. 0, 1 .. 0) :=
(others => (others => Gtk_Type_None));
-- An empty array, used as a default parameter in Initialize_Class_Record.
procedure Initialize_Class_Record
(Object : access Gtk_Object_Record'Class;
Signals : Gtkada.Types.Chars_Ptr_Array;
Class_Record : in out System.Address;
Parameters : Signal_Parameter_Types :=
Null_Parameter_Types;
Scroll_Adjustments_Signal : Guint := 0);
-- Create the class record for a new widget type.
-- It is associated with Signals'Length new signals. A pointer to the
-- newly created structure is also returned in Class_Record.
-- If Class_Record /= System.Null_Address, no memory allocation is
-- performed, we just reuse it.
-- Note: The underlying C widget must already have been initialized
-- by a call to its parent's Initialize function.
-- Parameters'Length should be the same as Signals'Length, or the result
-- is undefined.
-- As a special case, if Parameters has its default value, all signals are
-- created with no argument. This is done for backward compatibility
-- mainly, and you should instead give it an explicit value.
--
-- Scroll_Adjustments_Signal is the index of the new signal that will be
-- emitted when Gtk.Widget.Set_Scroll_Adjustments is called. If it is 0,
-- no signal is emitted. The first signal in Signals has index 1. Note
-- that the handlers for this signal take two arguments in addition to the
-- widget (the horizontal and vertical adjustments to be used). See
-- Gtk.Scrolled_Window and Gtk.Widget.Set_Scroll_Adustment for more
-- information on this signal.
--
-- Only the signals with no parameter can be connected from C. However,
-- any signal can be connected from Ada. This is due to the way we define
-- default marshallers for the signals.
---------------
-- User_Data --
---------------
-- This package allow you to associate your own Data to the C widgets. No
-- type verification is made to check if you are using the correct
-- matching Get function. This is your own responsability.
--
-- We recommend using this package only if you want your data to be
-- available from your own C code. If you just want to access it from Ada,
-- you should consider creating a new tagged type instead.
-- <doc_ignore>
generic
type Data_Type (<>) is private;
package User_Data is
function Get (Object : access Gtk_Object_Record'Class;
Id : in String := "user_data") return Data_Type;
-- Get the information associated with the key ID.
-- Raise Gtkada.Types.Data_Error if there is none.
procedure Set (Object : access Gtk_Object_Record'Class;
Data : in Data_Type;
Id : in String := "user_data");
-- Associate some new user data with the object.
-- The strings starting with "gtkada_" are reserved for GtkAda's
-- internal use, please avoid using them.
procedure Remove (Object : access Gtk_Object_Record'Class;
Id : in String := "user_data");
-- Remove some data from the object
function Get (Object : access Gtk_Object_Record'Class;
Id : in Glib.GQuark)
return Data_Type;
-- Same function as Get above, but uses directly the Quark associated
-- with the string, which speeds up the access time significantly.
procedure Set (Object : access Gtk_Object_Record'Class;
Data : in Data_Type;
Id : in Glib.GQuark);
-- Same function as Set above, but uses directly the Quark associated
-- with the string, which speeds up the access time significantly.
procedure Remove (Object : access Gtk_Object_Record'Class;
Id : in Glib.GQuark);
-- Same function as Remove above, but uses directly the Quark associated
-- with the string, which speeds up the access time significantly.
end User_Data;
-- </doc_ignore>
-------------
-- Signals --
-------------
-- <signals>
-- The following new signals are defined for this widget:
--
-- - "destroy"
-- procedure Handler (Object : access Gtk_Object_Record'Class);
--
-- Raised when the object is about to be destroyed. The "destroyed"
-- flag has been set on the object first. Handlers should not keep
-- a reference on the object.
-- Note that when your destroy handlers are called, the user_data is
-- still available.
-- The default implementation destroys all the handlers.
-- </signals>
private
type Gtk_Object_Record is new Gtk.Root_Type with null record;
pragma Inline (Destroyed_Is_Set);
pragma Inline (Floating_Is_Set);
pragma Inline (Connected_Is_Set);
pragma Inline (Constructed_Is_Set);
end Gtk.Object;
-- Functions that have no Ada equivalent:
-- - gtk_object_class_user_signal_new
-- - gtk_object_class_user_signal_newv
-- - gtk_object_new
-- - gtk_object_newv
-- - gtk_object_default_construct
-- - gtk_object_constructed
-- - gtk_object_weakref
-- - gtk_object_weakunref
-- - gtk_object_getv
-- - gtk_object_get
-- - gtk_object_set
-- - gtk_object_setv
-- - gtk_object_query_args
-- - gtk_object_class_add_signals => in Initialize_Class_Record
-- - gtk_object_add_arg_type
-----------------------------------------------------------------------
-- GtkAda - Ada95 binding for the Gimp Toolkit --
-- --
-- Copyright (C) 1998-2000 --
-- Emmanuel Briot, Joel Brobecker and Arnaud Charlet --
-- --
-- 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. --
-- --
-- As a special exception, if other files instantiate generics from --
-- this unit, or you link this unit with other files to produce an --
-- executable, this unit does not by itself cause the resulting --
-- executable to be covered by the GNU General Public License. This --
-- exception does not however invalidate any other reasons why the --
-- executable file might be covered by the GNU Public License. --
-----------------------------------------------------------------------
-- <description>
--
-- This is the parent package for the GtkAda specific units.
--
-- </description>
package Gtkada is
pragma Pure (Gtkada);
end Gtkada;
-----------------------------------------------------------------------
-- GtkAda - Ada95 binding for the Gimp Toolkit --
-- --
-- Copyright (C) 1998-2000 --
-- Emmanuel Briot, Joel Brobecker and Arnaud Charlet --
-- --
-- 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. --
-- --
-- As a special exception, if other files instantiate generics from --
-- this unit, or you link this unit with other files to produce an --
-- executable, this unit does not by itself cause the resulting --
-- executable to be covered by the GNU General Public License. This --
-- exception does not however invalidate any other reasons why the --
-- executable file might be covered by the GNU Public License. --
-----------------------------------------------------------------------
-- <description>
--
-- This package provides GtkAda specific types and their associated functions.
--
-- </description>
with Interfaces.C.Strings;
package Gtkada.Types is
pragma Preelaborate;
Data_Error : exception;
-- <doc_ignore>
subtype Chars_Ptr is Interfaces.C.Strings.chars_ptr;
subtype Chars_Ptr_Array is Interfaces.C.Strings.chars_ptr_array;
-- </doc_ignore>
Null_Ptr : Chars_Ptr renames Interfaces.C.Strings.Null_Ptr;
function Null_Array return Chars_Ptr_Array;
-- Return a null array.
pragma Inline (Null_Array);
-------------------------------------
-- Handling of arrays of Strings --
-------------------------------------
-- The following functions provide a very convenient way to create
-- C arrays of null terminated strings in Ada.
--
-- You can either create such a String on the fly, or declare a variable:
--
-- Signals : Chars_Ptr_Array := "clicked" + "missed" + "new signal";
--
-- which corresponds to the C declaration:
--
-- char *signals[] = @{"clicked", "missed", "new signal"@};
--
-- Note that you still need to manually call Free (Signals) if you want to
-- release the memory dynamically allocated by the "+" functions.
function "+" (S1, S2 : String) return Chars_Ptr_Array;
-- Create an array containing S1 and S2.
-- Note that this function allocates memory to store S1 and S2 as null
-- terminated Strings. The user is responsible for calling Free on the
-- resulting array.
function "+" (S1 : Chars_Ptr_Array; S2 : String) return Chars_Ptr_Array;
-- Append S2 to S1.
-- Note that this function allocates memory to store S2 as a null
-- terminated Strings. The user is responsible for calling Free on the
-- resulting array.
function "+" (S1 : Chars_Ptr_Array; S2 : Chars_Ptr) return Chars_Ptr_Array;
-- Append S2 to S1.
-- Note that this function allocates memory to store S2 as a null
-- terminated Strings. The user is responsible for calling Free on the
-- resulting array.
function "+" (S1 : Chars_Ptr; S2 : String) return Chars_Ptr_Array;
-- Create an array containing S1 and S2.
-- Note that this function allocates memory to store S2 as a null
-- terminated string. The user is responsible for calling Free on the
-- resulting array.
procedure Free (A : in out Chars_Ptr_Array);
-- Free all the strings in A.
end Gtkada.Types;
-----------------------------------------------------------------------
-- GtkAda - Ada95 binding for the Gimp Toolkit --
-- --
-- Copyright (C) 1998-2000 --
-- Emmanuel Briot, Joel Brobecker and Arnaud Charlet --
-- --
-- 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. --
-- --
-- As a special exception, if other files instantiate generics from --
-- this unit, or you link this unit with other files to produce an --
-- executable, this unit does not by itself cause the resulting --
-- executable to be covered by the GNU General Public License. This --
-- exception does not however invalidate any other reasons why the --
-- executable file might be covered by the GNU Public License. --
-----------------------------------------------------------------------
-- <description>
--
-- This object represents an adjustable bounded value.
-- It is used in many other widgets that have such internal values,
-- like Gtk_Scrollbar, Gtk_Spin_Button, Gtk_Range, ...
-- Modifying the value of these widgets is done through their
-- associated adjustments.
--
-- The modification of the value is left to the user, who should
-- call Value_Changed or Changed to emit the relevant signals.
--
-- </description>
-- <example>
--
-- The meaning of the most important fields can be explained on the
-- following figure (imagine this is a scrollbar):
--
-- [-------|=================|-------------------]
-- lower value value + page_size upper
--
-- </example>
-- <c_version>1.2.6</c_version>
with Gtk.Data;
package Gtk.Adjustment is
type Gtk_Adjustment_Record is new Data.Gtk_Data_Record with private;
type Gtk_Adjustment is access all Gtk_Adjustment_Record'Class;
Null_Adjustment : constant Gtk_Adjustment;
procedure Gtk_New (Adjustment : out Gtk_Adjustment;
Value : in Gfloat;
Lower : in Gfloat;
Upper : in Gfloat;
Step_Increment : in Gfloat;
Page_Increment : in Gfloat;
Page_Size : in Gfloat);
-- Create a new adjustment.
-- Value is the initial value of the adjustment. It must be in the
-- range (Lower .. Upper) and the adjustment's value will never be
-- outside this range.
-- Step_Increment is the value used to make minor adjustments, such
-- as when the user clicks on the arrows of a scrollbar.
-- Page_Increment is used to make major adjustments, such as when
-- the user clicks in the through on a scrollbar.
-- Page_Size is the size of the area that is currently visible
-- (for instance in a Gtk_Scrolled_Window).
procedure Initialize (Adjustment : access Gtk_Adjustment_Record'Class;
Value : in Gfloat;
Lower : in Gfloat;
Upper : in Gfloat;
Step_Increment : in Gfloat;
Page_Increment : in Gfloat;
Page_Size : in Gfloat);
-- Internal initialization function.
-- See the section "Creating your own widgets" in the documentation.
function Get_Type return Gtk.Gtk_Type;
-- Return the internal value associated with a Gtk_Adjustment.
--------------------
-- Read functions --
--------------------
function Get_Value (Adjustment : access Gtk_Adjustment_Record)
return Gfloat;
-- Return the current value of the adjustment.
function Get_Lower (Adjustment : access Gtk_Adjustment_Record)
return Gfloat;
-- Return the lower bound of the adjustment.
function Get_Upper (Adjustment : access Gtk_Adjustment_Record)
return Gfloat;
-- Return the upper bound of the adjustment.
function Get_Step_Increment (Adjustment : access Gtk_Adjustment_Record)
return Gfloat;
-- Return the step increment of the adjustment.
function Get_Page_Increment (Adjustment : access Gtk_Adjustment_Record)
return Gfloat;
-- Return the page increment of the adjustment.
function Get_Page_Size (Adjustment : access Gtk_Adjustment_Record)
return Gfloat;
-- Return the page size of the adjustment.
---------------------
-- Write functions --
---------------------
procedure Set_Upper (Adjustment : access Gtk_Adjustment_Record;
Upper : in Gfloat);
-- Modify the upper bound of the adjustment.
-- You should call Changed after modifying this value.
procedure Set_Lower (Adjustment : access Gtk_Adjustment_Record;
Lower : in Gfloat);
-- Modify the lower bound of the adjustment.
-- You should call Changed after modifying this value.
procedure Set_Value (Adjustment : access Gtk_Adjustment_Record;
Value : in Gfloat);
-- Modify the current value of the adjustment.
-- You do not need to call Value_Changed after modifying this value,
-- this is done automatically.
procedure Set_Page_Size (Adjustment : access Gtk_Adjustment_Record;
Page_Size : in Gfloat);
-- Modify the page size of the adjustment.
-- You should call Changed after modifying this value.
procedure Set_Page_Increment (Adjustment : access Gtk_Adjustment_Record;
Page_Increment : in Gfloat);
-- Modify the page increment of the adjustment.
-- You should call Changed after modifying this value.
procedure Set_Step_Increment (Adjustment : access Gtk_Adjustment_Record;
Step_Increment : in Gfloat);
-- Modify the step increment of the adjustment.
-- You should call Changed after modifying this value.
--------------------
-- Misc functions --
--------------------
procedure Clamp_Page (Adjustment : access Gtk_Adjustment_Record;
Lower : in Gfloat;
Upper : in Gfloat);
-- Update the Adjustment value to ensure that the range between Lower and
-- Upper is in the current page (i.e. between value and value +
-- page_size). If the range is larger than the page size, then only the
-- start of it will be in the current page.
-- A "value_changed" signal will be emitted if the value is changed.
----------------------
-- Signals emission --
----------------------
procedure Changed (Adjustment : access Gtk_Adjustment_Record);
-- Emit the "changed" signal on Adjustment.
-- This warns any listener that some field other than the value has been
-- changed.
procedure Value_Changed (Adjustment : access Gtk_Adjustment_Record);
-- Emit the "value_changed" signal on Adjustment.
-- This warns any listener that the value has been changed.
-------------
-- Signals --
-------------
-- <signals>
-- The following new signals are defined for this widget:
--
-- - "changed"
-- procedure Handler (Adjustment : access Gtk_Adjustment_Record'Class);
--
-- This signal is emitted every time one of the parameters is modified,
-- except the value.
--
-- - "value_changed"
-- procedure Handler (Adjustment : access Gtk_Adjustment_Record'Class);
--
-- This signal is emitted every time the value of the adjustment is
-- modified
-- </signals>
private
type Gtk_Adjustment_Record is new Data.Gtk_Data_Record with null record;
Null_Adjustment : constant Gtk_Adjustment := null;
pragma Import (C, Get_Type, "gtk_adjustment_get_type");
end Gtk.Adjustment;
-----------------------------------------------------------------------
-- GtkAda - Ada95 binding for the Gimp Toolkit --
-- --
-- Copyright (C) 1998-1999 --
-- Emmanuel Briot, Joel Brobecker and Arnaud Charlet --
-- --
-- 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. --
-- --
-- As a special exception, if other files instantiate generics from --
-- this unit, or you link this unit with other files to produce an --
-- executable, this unit does not by itself cause the resulting --
-- executable to be covered by the GNU General Public License. This --
-- exception does not however invalidate any other reasons why the --
-- executable file might be covered by the GNU Public License. --
-----------------------------------------------------------------------
-- <description>
--
-- Abstract class for objects containing data
-- This object is currently not very useful since it only provides
-- a single "disconnect" signal.
--
-- This is the "Model" in the Model/View/Controller framework.
-- </description>
-- <c_version>1.2.6</c_version>
with Gtk.Object;
package Gtk.Data is
type Gtk_Data_Record is new Object.Gtk_Object_Record with private;
type Gtk_Data is access all Gtk_Data_Record'Class;
function Get_Type return Gtk.Gtk_Type;
-- Return the internal value associated with a Gtk_Data.
-------------
-- Signals --
-------------
-- <signals>
-- The following new signals are defined for this widget:
--
-- - "disconnect"
-- procedure Handler (Data : access Gtk_Data_Record'Class);
--
-- Emitted just before Data is destroyed.
-- </signals>
private
type Gtk_Data_Record is new Object.Gtk_Object_Record with null record;
pragma Import (C, Get_Type, "gtk_data_get_type");
end Gtk.Data;
-----------------------------------------------------------------------
-- GtkAda - Ada95 binding for the Gimp Toolkit --
-- --
-- Copyright (C) 1998-1999 --
-- Emmanuel Briot, Joel Brobecker and Arnaud Charlet --
-- --
-- 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. --
-- --
-- As a special exception, if other files instantiate generics from --
-- this unit, or you link this unit with other files to produce an --
-- executable, this unit does not by itself cause the resulting --
-- executable to be covered by the GNU General Public License. This --
-- exception does not however invalidate any other reasons why the --
-- executable file might be covered by the GNU Public License. --
-----------------------------------------------------------------------
with Glib;
with Glib.Glist;
pragma Elaborate_All (Glib.Glist);
with System;
package Gtk.Enums is
type Gtk_State_Type is
(State_Normal,
State_Active,
State_Prelight,
State_Selected,
State_Insensitive);
type Gtk_Window_Type is (Window_Toplevel, Window_Dialog, Window_Popup);
type Gtk_Button_Action is new Guint;
Button_Ignored : constant Gtk_Button_Action := 0;
Button_Selects : constant Gtk_Button_Action := 1 ** 0;
Button_Drags : constant Gtk_Button_Action := 1 ** 1;
Button_Expands : constant Gtk_Button_Action := 1 ** 2;
type Gtk_Button_Box_Style is
(Buttonbox_Default_Style,
Buttonbox_Spread,
Buttonbox_Edge,
Buttonbox_Start,
Buttonbox_End);
type Gtk_Direction_Type is
(Dir_Tab_Forward,
Dir_Tab_Backward,
Dir_Up,
Dir_Down,
Dir_Left,
Dir_Right);
type Gtk_Shadow_Type is
(Shadow_None,
Shadow_In,
Shadow_Out,
Shadow_Etched_In,
Shadow_Etched_Out);
type Gtk_Arrow_Type is (Arrow_Up, Arrow_Down, Arrow_Left, Arrow_Right);
type Gtk_Cell_Type is
(Cell_Empty,
Cell_Text,
Cell_Pixmap,
Cell_Pixtext,
Cell_Widget);
type Gtk_Pack_Type is (Pack_Start, Pack_End);
type Gtk_Policy_Type is (Policy_Always, Policy_Automatic, Policy_Never);
type Gtk_Update_Type is
(Update_Continuous,
Update_Discontinuous,
Update_Delayed);
type Gtk_Relief_Style is (Relief_Normal, Relief_Half, Relief_None);
type Gtk_Attach_Options is new Glib.Guint32;
Expand : constant Gtk_Attach_Options := 1;
Shrink : constant Gtk_Attach_Options := 2;
Fill : constant Gtk_Attach_Options := 4;
type Gtk_Window_Position is
(Win_Pos_None,
Win_Pos_Center,
Win_Pos_Mouse,
Win_Pos_Center_Always);
type Gtk_Submenu_Direction is (Direction_Left, Direction_Right);
type Gtk_Submenu_Placement is (Top_Bottom, Left_Right);
type Gtk_Resize_Mode is
(Resize_Parent, -- Pass request to the parent
Resize_Queue, -- Queue resizes on this widget
Resize_Immediate); -- Perform the resizes now
type Gtk_Metric_Type is (Pixels, Inches, Centimeters);
type Gtk_Scroll_Type is
(Scroll_None,
Scroll_Step_Backward,
Scroll_Step_Forward,
Scroll_Page_Backward,
Scroll_Page_Forward,
Scroll_Jump);
type Gtk_Trough_Type is
(Trough_None,
Trough_Start,
Trough_End,
Trough_Jump);
type Gtk_Position_Type is
(Pos_Left,
Pos_Right,
Pos_Top,
Pos_Bottom);
type Gtk_Preview_Type is (Preview_Color, Preview_Grayscale);
type Gtk_Justification is
(Justify_Left,
Justify_Right,
Justify_Center,
Justify_Fill);
type Gtk_Selection_Mode is
(Selection_Single,
Selection_Browse,
Selection_Multiple,
Selection_Extended);
type Gtk_Orientation is (Orientation_Horizontal, Orientation_Vertical);
type Gtk_Spin_Button_Update_Policy is (Update_Always, Update_If_Valid);
type Gtk_Toolbar_Child_Type is
(Toolbar_Child_Space,
Toolbar_Child_Button,
Toolbar_Child_Togglebutton,
Toolbar_Child_Radiobutton,
Toolbar_Child_Widget);
type Gtk_Toolbar_Style is (Toolbar_Icons, Toolbar_Text, Toolbar_Both);
type Gtk_Toolbar_Space_Style is (Toolbar_Space_Empty, Toolbar_Space_Line);
type Gtk_Tree_View_Mode is (Tree_View_Line, Tree_View_Item);
type Gtk_Visibility is
(Visibility_None, Visibility_Partial, Visibility_Full);
type Gtk_Progress_Bar_Style is
(Progress_Continuous, Progress_Discrete);
type Gtk_Progress_Bar_Orientation is
(Progress_Left_To_Right,
Progress_Right_To_Left,
Progress_Bottom_To_Top,
Progress_Top_To_Bottom);
type Gtk_Ctree_Line_Style is
(Ctree_Lines_None,
-- No line will be drawn in the Ctree
Ctree_Lines_Solid,
-- Solid lines will be drawn
Ctree_Lines_Dotted,
-- Dotted lines will be drawn
Ctree_Lines_Tabbed
-- The tree won't be highlighted by lines but by tabs surrounding nodes
);
-- See Gtk.Ctree.Set_Line_Style for more details.
type Gtk_Ctree_Expander_Style is
(Ctree_Expander_None,
-- No pixmap will be drawn, you will have to double-click on the node to
-- expand it.
Ctree_Expander_Square,
-- The pixmap will be a square
Ctree_Expander_Triangle,
-- The pixmap will be a triangle
Ctree_Expander_Circular
-- The pixmap will be a circle
);
-- See Gtk.Ctree.Set_Expander_Style for more details.
-- Some Glib instantiations
function Convert (S : String) return System.Address;
function Convert (S : System.Address) return String;
function Convert_I (I : Gint) return System.Address;
function Convert_A (S : System.Address) return Gint;
pragma Import (C, Convert_I, "convert_i");
pragma Import (C, Convert_A, "convert_a");
package String_List is new Glib.Glist.Generic_List (String);
-- Warning: when you create this list, new memory gets allocated for
-- all the strings. You should use the function Free_String_List
-- instead of Glib.Glist.Free to be sure to free this memory.
procedure Free_String_List (List : in out String_List.Glist);
-- Free the memory occupied by all the strings in the list, as well
-- as the memory occupied by the list itself.
package Gint_List is new
Glib.Glist.Generic_List (Gint, Convert_I, Convert_A);
function Convert_UI (I : Guint) return System.Address;
function Convert_UA (S : System.Address) return Guint;
pragma Import (C, Convert_UI, "convert_ui");
pragma Import (C, Convert_UA, "convert_ua");
package Guint_List is new
Glib.Glist.Generic_List (Guint, Convert_UI, Convert_UA);
end Gtk.Enums;
-----------------------------------------------------------------------
-- GtkAda - Ada95 binding for the Gimp Toolkit --
-- --
-- Copyright (C) 1998-2000 --
-- Emmanuel Briot, Joel Brobecker and Arnaud Charlet --
-- --
-- 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. --
-- --
-- As a special exception, if other files instantiate generics from --
-- this unit, or you link this unit with other files to produce an --
-- executable, this unit does not by itself cause the resulting --
-- executable to be covered by the GNU General Public License. This --
-- exception does not however invalidate any other reasons why the --
-- executable file might be covered by the GNU Public License. --
-----------------------------------------------------------------------
with Gdk; use Gdk;
with Gdk.Color;
with Gdk.GC;
with Gdk.Font;
with Gdk.Types;
with Gdk.Pixmap;
with Gdk.Window;
with Gtk.Enums;
package Gtk.Style is
type Gtk_Style is new Gdk.C_Proxy;
-- Type used to handle styles.
-- @pxref{Package_Gtk.Widget} for style handling.
Null_Style : constant Gtk_Style := null;
procedure Gtk_New (Style : out Gtk_Style);
function Copy (Source : in Gtk_Style) return Gtk_Style;
function Attach
(Style : in Gtk_Style;
Window : in Gdk.Window.Gdk_Window) return Gtk_Style;
procedure Detach (Style : in Gtk_Style);
procedure Set_Background
(Style : in Gtk_Style;
Window : in Gdk.Window.Gdk_Window;
State_Type : in Enums.Gtk_State_Type);
procedure Set_Foreground
(Style : in Gtk_Style;
State_Type : in Enums.Gtk_State_Type;
Color : in Gdk.Color.Gdk_Color);
procedure Set_Fg
(Style : in Gtk_Style;
State_Type : in Enums.Gtk_State_Type;
Color : in Gdk.Color.Gdk_Color) renames Set_Foreground;
function Get_Foreground
(Style : in Gtk_Style;
State_Type : in Enums.Gtk_State_Type) return Gdk.Color.Gdk_Color;
function Get_Fg
(Style : in Gtk_Style;
State_Type : in Enums.Gtk_State_Type) return Gdk.Color.Gdk_Color
renames Get_Foreground;
procedure Set_Background
(Style : in Gtk_Style;
State_Type : in Enums.Gtk_State_Type;
Color : in Gdk.Color.Gdk_Color);
procedure Set_Bg
(Style : in Gtk_Style;
State_Type : in Enums.Gtk_State_Type;
Color : in Gdk.Color.Gdk_Color) renames Set_Background;
function Get_Background
(Style : in Gtk_Style;
State_Type : in Enums.Gtk_State_Type) return Gdk.Color.Gdk_Color;
function Get_Bg
(Style : in Gtk_Style;
State_Type : in Enums.Gtk_State_Type) return Gdk.Color.Gdk_Color
renames Get_Background;
procedure Set_Light
(Style : in Gtk_Style;
State_Type : in Enums.Gtk_State_Type;
Color : in Gdk.Color.Gdk_Color);
function Get_Light
(Style : in Gtk_Style;
State_Type : in Enums.Gtk_State_Type) return Gdk.Color.Gdk_Color;
procedure Set_Dark
(Style : in Gtk_Style;
State_Type : in Enums.Gtk_State_Type;
Color : in Gdk.Color.Gdk_Color);
function Get_Dark
(Style : in Gtk_Style;
State_Type : in Enums.Gtk_State_Type) return Gdk.Color.Gdk_Color;
procedure Set_Middle
(Style : in Gtk_Style;
State_Type : in Enums.Gtk_State_Type;
Color : in Gdk.Color.Gdk_Color);
procedure Set_Mid
(Style : in Gtk_Style;
State_Type : in Enums.Gtk_State_Type;
Color : in Gdk.Color.Gdk_Color) renames Set_Middle;
function Get_Middle
(Style : in Gtk_Style;
State_Type : in Enums.Gtk_State_Type) return Gdk.Color.Gdk_Color;
function Get_Mid
(Style : in Gtk_Style;
State_Type : in Enums.Gtk_State_Type) return Gdk.Color.Gdk_Color
renames Get_Middle;
procedure Set_Text
(Style : in Gtk_Style;
State_Type : in Enums.Gtk_State_Type;
Color : in Gdk.Color.Gdk_Color);
function Get_Text
(Style : in Gtk_Style;
State_Type : in Enums.Gtk_State_Type) return Gdk.Color.Gdk_Color;
procedure Set_Base
(Style : in Gtk_Style;
State_Type : in Enums.Gtk_State_Type;
Color : in Gdk.Color.Gdk_Color);
function Get_Base
(Style : in Gtk_Style;
State_Type : in Enums.Gtk_State_Type) return Gdk.Color.Gdk_Color;
procedure Set_Black
(Style : in Gtk_Style;
Color : in Gdk.Color.Gdk_Color);
function Get_Black (Style : in Gtk_Style) return Gdk.Color.Gdk_Color;
procedure Set_White (Style : in Gtk_Style; Color : in Gdk.Color.Gdk_Color);
function Get_White (Style : in Gtk_Style) return Gdk.Color.Gdk_Color;
procedure Set_Font (Style : in Gtk_Style; Font : in Gdk.Font.Gdk_Font);
function Get_Font (Style : in Gtk_Style) return Gdk.Font.Gdk_Font;
procedure Set_Black_GC (Style : in Gtk_Style; GC : in Gdk.GC.Gdk_GC);
function Get_Black_GC (Style : in Gtk_Style) return Gdk.GC.Gdk_GC;
procedure Set_Black
(Style : in Gtk_Style; GC : in Gdk.GC.Gdk_GC) renames Set_Black_GC;
function Get_Black
(Style : in Gtk_Style) return Gdk.GC.Gdk_GC renames Get_Black_GC;
procedure Set_White_GC (Style : in Gtk_Style; GC : in Gdk.GC.Gdk_GC);
function Get_White_GC (Style : in Gtk_Style) return Gdk.GC.Gdk_GC;
procedure Set_White
(Style : in Gtk_Style; GC : in Gdk.GC.Gdk_GC) renames Set_White_GC;
function Get_White
(Style : in Gtk_Style) return Gdk.GC.Gdk_GC renames Get_White_GC;
procedure Set_Foreground_GC
(Style : in Gtk_Style;
State_Type : in Enums.Gtk_State_Type;
GC : in Gdk.GC.Gdk_GC);
function Get_Foreground_GC
(Style : in Gtk_Style;
State_Type : in Enums.Gtk_State_Type) return Gdk.GC.Gdk_GC;
procedure Set_Foreground
(Style : in Gtk_Style;
State_Type : in Enums.Gtk_State_Type;
GC : in Gdk.GC.Gdk_GC) renames Set_Foreground_GC;
function Get_Foreground
(Style : in Gtk_Style;
State_Type : in Enums.Gtk_State_Type) return Gdk.GC.Gdk_GC
renames Get_Foreground_GC;
procedure Set_Fg
(Style : in Gtk_Style;
State_Type : in Enums.Gtk_State_Type;
GC : in Gdk.GC.Gdk_GC) renames Set_Foreground_GC;
function Get_Fg
(Style : in Gtk_Style;
State_Type : in Enums.Gtk_State_Type) return Gdk.GC.Gdk_GC
renames Get_Foreground_GC;
procedure Set_Fg_GC
(Style : in Gtk_Style;
State_Type : in Enums.Gtk_State_Type;
GC : in Gdk.GC.Gdk_GC) renames Set_Foreground_GC;
function Get_Fg_GC
(Style : in Gtk_Style;
State_Type : in Enums.Gtk_State_Type) return Gdk.GC.Gdk_GC
renames Get_Foreground_GC;
procedure Set_Background_GC
(Style : in Gtk_Style;
State_Type : in Enums.Gtk_State_Type;
GC : in Gdk.GC.Gdk_GC);
function Get_Background_GC
(Style : in Gtk_Style;
State_Type : in Enums.Gtk_State_Type) return Gdk.GC.Gdk_GC;
procedure Set_Background
(Style : in Gtk_Style;
State_Type : in Enums.Gtk_State_Type;
GC : in Gdk.GC.Gdk_GC) renames Set_Background_GC;
function Get_Background
(Style : in Gtk_Style;
State_Type : in Enums.Gtk_State_Type) return Gdk.GC.Gdk_GC
renames Get_Background_GC;
procedure Set_Bg
(Style : in Gtk_Style;
State_Type : in Enums.Gtk_State_Type;
GC : in Gdk.GC.Gdk_GC) renames Set_Background_GC;
function Get_Bg
(Style : in Gtk_Style;
State_Type : in Enums.Gtk_State_Type) return Gdk.GC.Gdk_GC
renames Get_Background_GC;
procedure Set_Bg_GC
(Style : in Gtk_Style;
State_Type : in Enums.Gtk_State_Type;
GC : in Gdk.GC.Gdk_GC) renames Set_Background_GC;
function Get_Bg_GC
(Style : in Gtk_Style;
State_Type : in Enums.Gtk_State_Type) return Gdk.GC.Gdk_GC
renames Get_Background_GC;
procedure Set_Light_GC
(Style : in Gtk_Style;
State_Type : in Enums.Gtk_State_Type;
GC : in Gdk.GC.Gdk_GC);
function Get_Light_GC
(Style : in Gtk_Style;
State_Type : in Enums.Gtk_State_Type) return Gdk.GC.Gdk_GC;
procedure Set_Light
(Style : in Gtk_Style;
State_Type : in Enums.Gtk_State_Type;
GC : in Gdk.GC.Gdk_GC) renames Set_Light_GC;
function Get_Light
(Style : in Gtk_Style;
State_Type : in Enums.Gtk_State_Type) return Gdk.GC.Gdk_GC
renames Get_Light_GC;
procedure Set_Dark_GC
(Style : in Gtk_Style;
State_Type : in Enums.Gtk_State_Type;
GC : in Gdk.GC.Gdk_GC);
function Get_Dark_GC
(Style : in Gtk_Style;
State_Type : in Enums.Gtk_State_Type) return Gdk.GC.Gdk_GC;
procedure Set_Dark
(Style : in Gtk_Style;
State_Type : in Enums.Gtk_State_Type;
GC : in Gdk.GC.Gdk_GC) renames Set_Dark_GC;
function Get_Dark
(Style : in Gtk_Style;
State_Type : in Enums.Gtk_State_Type) return Gdk.GC.Gdk_GC
renames Get_Dark_GC;
procedure Set_Middle_GC
(Style : in Gtk_Style;
State_Type : in Enums.Gtk_State_Type;
GC : in Gdk.GC.Gdk_GC);
function Get_Middle_GC
(Style : in Gtk_Style;
State_Type : in Enums.Gtk_State_Type) return Gdk.GC.Gdk_GC;
procedure Set_Middle
(Style : in Gtk_Style;
State_Type : in Enums.Gtk_State_Type;
GC : in Gdk.GC.Gdk_GC) renames Set_Middle_GC;
function Get_Middle
(Style : in Gtk_Style;
State_Type : in Enums.Gtk_State_Type) return Gdk.GC.Gdk_GC
renames Get_Middle_GC;
procedure Set_Mid_GC
(Style : in Gtk_Style;
State_Type : in Enums.Gtk_State_Type;
GC : in Gdk.GC.Gdk_GC) renames Set_Middle_GC;
function Get_Mid_GC
(Style : in Gtk_Style;
State_Type : in Enums.Gtk_State_Type) return Gdk.GC.Gdk_GC
renames Get_Middle_GC;
procedure Set_Mid
(Style : in Gtk_Style;
State_Type : in Enums.Gtk_State_Type;
GC : in Gdk.GC.Gdk_GC) renames Set_Middle_GC;
function Get_Mid
(Style : in Gtk_Style;
State_Type : in Enums.Gtk_State_Type) return Gdk.GC.Gdk_GC
renames Get_Middle_GC;
procedure Set_Text_GC
(Style : in Gtk_Style;
State_Type : in Enums.Gtk_State_Type;
GC : in Gdk.GC.Gdk_GC);
function Get_Text_GC
(Style : in Gtk_Style;
State_Type : in Enums.Gtk_State_Type) return Gdk.GC.Gdk_GC;
procedure Set_Text
(Style : in Gtk_Style;
State_Type : in Enums.Gtk_State_Type;
GC : in Gdk.GC.Gdk_GC) renames Set_Text_GC;
function Get_Text
(Style : in Gtk_Style;
State_Type : in Enums.Gtk_State_Type) return Gdk.GC.Gdk_GC
renames Get_Text_GC;
procedure Set_Base_GC
(Style : in Gtk_Style;
State_Type : in Enums.Gtk_State_Type;
GC : in Gdk.GC.Gdk_GC);
function Get_Base_GC
(Style : in Gtk_Style;
State_Type : in Enums.Gtk_State_Type) return Gdk.GC.Gdk_GC;
procedure Set_Base
(Style : in Gtk_Style;
State_Type : in Enums.Gtk_State_Type;
GC : in Gdk.GC.Gdk_GC) renames Set_Base_GC;
function Get_Base
(Style : in Gtk_Style;
State_Type : in Enums.Gtk_State_Type) return Gdk.GC.Gdk_GC
renames Get_Base_GC;
procedure Set_Bg_Pixmap
(Style : in Gtk_Style;
State_Type : in Enums.Gtk_State_Type;
Pixmap : in Gdk.Pixmap.Gdk_Pixmap);
function Get_Bg_Pixmap
(Style : in Gtk_Style;
State_Type : in Enums.Gtk_State_Type) return Gdk.Pixmap.Gdk_Pixmap;
function X_Thickness (Style : in Gtk_Style) return Gint;
-- Width of the vertical scrollbars and ranges when Style is applied.
-- In fact, this thickness is used for a lot of widgets whose width
-- does not depend on their content, such as rulers,...
function Y_Thickness (Style : in Gtk_Style) return Gint;
-- Height of the horizontal scrollbars and ranges when Style is applied.
procedure Draw_Hline
(Style : in Gtk_Style;
Window : in Gdk.Window.Gdk_Window;
State_Type : in Enums.Gtk_State_Type;
X1, X2 : in Gint;
Y : in Gint);
procedure Draw_Vline
(Style : in Gtk_Style;
Window : in Gdk.Window.Gdk_Window;
State_Type : in Enums.Gtk_State_Type;
Y1, Y2 : in Gint;
X : in Gint);
procedure Draw_Shadow
(Style : in Gtk_Style;
Window : in Gdk.Window.Gdk_Window;
State_Type : in Enums.Gtk_State_Type;
Shadow_Type : in Enums.Gtk_Shadow_Type;
X, Y : in Gint;
Width : in Gint;
Height : in Gint);
procedure Draw_Polygon
(Style : in Gtk_Style;
Window : in Gdk.Window.Gdk_Window;
State_Type : in Enums.Gtk_State_Type;
Shadow_Type : in Enums.Gtk_Shadow_Type;
Points : in Gdk.Types.Gdk_Points_Array;
Fill : in Boolean);
procedure Draw_Arrow
(Style : in Gtk_Style;
Window : in Gdk.Window.Gdk_Window;
State_Type : in Enums.Gtk_State_Type;
Shadow_Type : in Enums.Gtk_Shadow_Type;
Arrow_Type : in Enums.Gtk_Arrow_Type;
Fill : in Boolean;
X, Y : in Gint;
Width : in Gint;
Height : in Gint);
procedure Draw_Diamond
(Style : in Gtk_Style;
Window : in Gdk.Window.Gdk_Window;
State_Type : in Enums.Gtk_State_Type;
Shadow_Type : in Enums.Gtk_Shadow_Type;
X, Y : in Gint;
Width : in Gint;
Height : in Gint);
procedure Draw_Oval
(Style : in Gtk_Style;
Window : in Gdk.Window.Gdk_Window;
State_Type : in Enums.Gtk_State_Type;
Shadow_Type : in Enums.Gtk_Shadow_Type;
X, Y : in Gint;
Width : in Gint;
Height : in Gint);
procedure Draw_String
(Style : in Gtk_Style;
Window : in Gdk.Window.Gdk_Window;
State_Type : in Enums.Gtk_State_Type;
X, Y : in Gint;
Str : in String);
procedure Ref (Object : in Gtk_Style);
procedure Unref (Object : in Gtk_Style);
private
pragma Import (C, Attach, "gtk_style_attach");
pragma Import (C, Copy, "gtk_style_copy");
pragma Import (C, Detach, "gtk_style_detach");
pragma Import (C, Ref, "gtk_style_ref");
pragma Import (C, Unref, "gtk_style_unref");
pragma Import (C, Draw_Diamond, "gtk_draw_diamond");
pragma Import (C, Draw_Hline, "gtk_draw_hline");
pragma Import (C, Draw_Oval, "gtk_draw_oval");
pragma Import (C, Draw_Shadow, "gtk_draw_shadow");
pragma Import (C, Draw_Vline, "gtk_draw_vline");
pragma Import (C, Set_Font, "ada_style_set_font");
pragma Import (C, Get_Font, "ada_style_get_font");
pragma Import (C, Set_Black_GC, "ada_style_set_black_gc");
pragma Import (C, Get_Black_GC, "ada_style_get_black_gc");
pragma Import (C, Set_White_GC, "ada_style_set_white_gc");
pragma Import (C, Get_White_GC, "ada_style_get_white_gc");
pragma Import (C, X_Thickness, "ada_style_get_x_thickness");
pragma Import (C, Y_Thickness, "ada_style_get_y_thickness");
end Gtk.Style;
-----------------------------------------------------------------------
-- GtkAda - Ada95 binding for the Gimp Toolkit --
-- --
-- Copyright (C) 1998-2000 --
-- Emmanuel Briot, Joel Brobecker and Arnaud Charlet --
-- --
-- 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. --
-- --
-- As a special exception, if other files instantiate generics from --
-- this unit, or you link this unit with other files to produce an --
-- executable, this unit does not by itself cause the resulting --
-- executable to be covered by the GNU General Public License. This --
-- exception does not however invalidate any other reasons why the --
-- executable file might be covered by the GNU Public License. --
-----------------------------------------------------------------------
-- <description>
--
-- A graphic context is a structure that describes all the attributes
-- used by the drawing functions in Gdk.
-- The colors, line styles, Fill styles and so on are defined through
-- this structure.
--
-- On X11 systems, this structure is stored directly on the XServer,
-- which speeds up the transfer of the drawing attributes a lot. Instead
-- of transferring all of them every time you call one of the drawing
-- functions, you simply specify which GC you want to use.
--
-- Thus, it is recommended to create as many GCs as you need, instead
-- of creating a single one that is modified every time you need to
-- modify one of the attributes.
--
-- On Unix machines, you should have a look at the external utility 'xgc'
-- which demonstrates all the basic settings of the graphic contexts.
--
-- </description>
-- <c_version>1.2.6</c_version>
with Glib; use Glib;
with Gdk.Color;
with Gdk.Font;
with Gdk.Rectangle;
with Gdk.Region;
with Gdk.Types;
with Gdk.Window;
package Gdk.GC is
subtype Gdk_GC is Gdk.Gdk_GC;
-- A graphic context that contain all the information to draw graphics
-- on the screen.
-- Creating these GC is more efficient than passing a lot of parameters
-- to each of the drawing functions, since these GC are stored on the
-- server side and do not need to be pass through the network.
type Gdk_GC_Values is new Gdk.C_Proxy;
-- A structure used on the client side to store the same information
-- as the GC. Creating a GC from this structure is more efficient than
-- calling a lot of functions to modify the GC directly, since there is
-- a single call to the server.
Null_GC : constant Gdk_GC;
Null_GC_Values : constant Gdk_GC_Values;
------------
-- Gdk_GC --
------------
procedure Gdk_New (GC : out Gdk_GC;
Window : in Gdk.Window.Gdk_Window);
-- Create a new graphic context.
-- The window must have been realized first (so that it is associated
-- with some resources on the Xserver).
-- The GC can then be used for any window that has the same root window,
-- and same color depth as Window.
-- See the manual page for XCreateGC on Unix systems for more information.
procedure Gdk_New (GC : out Gdk_GC;
Window : in Gdk.Window.Gdk_Window;
Values : in Gdk_GC_Values;
Values_Mask : in Types.Gdk_GC_Values_Mask);
-- Create a new graphic context.
-- It is directly created with the values set in Values, and whose
-- associated field has been set in Values_Mask.
-- This is faster than calling the simple Gdk_New function and each of
-- other functions in this package, since each of them requires a call
-- to the server.
procedure Destroy (GC : in Gdk_GC);
-- Free the memory allocated on the server for the graphic context.
-- Graphic contexts are never freed automatically by GtkAda, this is
-- the user responsibility to do so.
procedure Ref (GC : in Gdk_GC);
-- Increment the reference counting for the graphic context.
-- You should usually not have to use it.
procedure Unref (GC : in Gdk_GC);
-- Decrement the reference counting for the graphic context.
-- When this reaches 0, the graphic context is destroyed.
procedure Get_Values (GC : in Gdk_GC;
Values : in Gdk_GC_Values);
-- Get the values set in the GC.
-- This copies the values from the server to client, allowing faster
-- modifications. Values can then be copied back to the server by
-- creating a new graphic context with the function Gdk_New above.
-- Values should have been allocated first with a call to Gdk_New.
procedure Set_Foreground (GC : in Gdk_GC;
Color : in Gdk.Color.Gdk_Color);
-- Set the foreground color for the graphic context.
-- This color is the one that is used by most drawing functions.
procedure Set_Background (GC : in Gdk_GC;
Color : in Gdk.Color.Gdk_Color);
-- Set the background color for the graphic context.
procedure Set_Font (GC : in Gdk_GC;
Font : in Gdk.Font.Gdk_Font);
-- Set the font used by the graphic context.
-- This font is used by the function Gdk.Drawable.Draw_Text.
procedure Set_Function (GC : in Gdk_GC;
Func : in Types.Gdk_Function);
-- Set the function in the graphic context.
-- This function specifies how the points are put on the screen, ie
-- if GtkAda how GtkAda should mix the point already on the screen
-- and the new point being put.
-- Note that setting the function to Gdk_Xor is not the right way
-- to do animation. You should instead save the background pixmap,
-- put the image, and then restore the background.
--
-- In general, there are three basic steps to drawing: reading the source
-- pixels, reading the destination pixels, and writing the destination
-- pixels. Some functions only perform the third step (Set and Clear),
-- some do not need the middle step (Copy), whereas most require the three
-- steps, and thus can be much slower.
procedure Set_Fill (GC : in Gdk_GC;
Fill : in Types.Gdk_Fill);
-- Set the pattern used for filling the polygons.
procedure Set_Tile (GC : in Gdk_GC;
Tile : in Gdk.Gdk_Pixmap);
procedure Set_Stipple (GC : in Gdk_GC;
Stipple : in Gdk.Gdk_Pixmap);
procedure Set_Clip_Mask (GC : in Gdk.GC.Gdk_GC;
Mask : in Gdk.Gdk_Bitmap);
-- If Mask is set to Null_Bitmap, then no clip_mask is used for drawing.
-- Points will be drawn through this GC only where the bits are set to 1
-- in the mask. See also the function Set_Clip_Origin for
-- how to move the mask inside the GC.
procedure Set_Ts_Origin (GC : in Gdk_GC;
X, Y : in Gint);
-- Set the Tile and Stipple origin in the graphic context.
procedure Set_Clip_Origin (GC : in Gdk_GC;
X, Y : in Gint);
-- Set the origin of the clip mask.
-- See the functions Set_Clip_Rectangle, Set_Clip_Region and
-- Gdk.Bitmap.Set_Clip_Mask for more explanation.
procedure Set_Clip_Rectangle
(GC : in Gdk_GC;
Rectangle : in Gdk.Rectangle.Gdk_Rectangle);
-- Set the clip rectangle.
-- Only the points that are drawn inside this rectangle will be displayed
-- on the screen. Note that you might have to modify the Clip origin first
-- with Set_Clip_Origin.
-- See Set_Clip_Mask to delete the current clip mask.
procedure Set_Clip_Region (GC : in Gdk_GC;
Region : in Gdk.Region.Gdk_Region);
-- Define a clip region on the screen.
-- This is just like Set_Clip_Rectangle, except that a region is a more
-- complex region, that can be the intersection or union of multiple
-- rectangles. Note that the Clip_Origin can have an influence on this
-- function.
procedure Set_Subwindow (GC : in Gdk_GC;
Mode : in Types.Gdk_Subwindow_Mode);
-- Set the subwindow mode for the graphic context.
-- This specifies whether the drawing routines should be clipped to
-- the specific window they are drawn into, or if they should extend
-- to subwindows as well.
procedure Set_Exposures (GC : in Gdk_GC;
Exposures : in Boolean);
-- Exposures indicates whether you want "expose" and "noexpose" events to
-- be reported when calling Copy_Area and Copy_Plane with this GC.
-- You should disable this if you don't need the event and want to optimize
-- your application.
-- If Exposures is True, then any call to Copy_Area or Draw_Pixmap will
-- generate an expose event. Otherwise, these will generate a no_expose
-- event.
procedure Set_Line_Attributes (GC : in Gdk_GC;
Line_Width : in Gint;
Line_Style : in Types.Gdk_Line_Style;
Cap_Style : in Types.Gdk_Cap_Style;
Join_Style : in Types.Gdk_Join_Style);
-- Set the line attributes for this GC.
-- Line_Width is the width of the line. If its value is 0, the line is as
-- thin as possible, possibly even more so than if the width is 1. It is
-- also faster to draw a line with width 0 than any other line width.
--
-- Line_Style specifies whether the line should be solid or dashed.
-- With Line_On_Off_Dash, the colors are alternatively the foreground
-- color, and blank. With Line_Double_Dash, the colors are
-- alternatively the foreground and background colors.
--
-- Cap_Style specifies how the line should end, either flat or rounded.
--
-- Join_Style specifies how two consecutive lines drawn by Draw_Lines are
-- connected.
procedure Set_Dashes (Gc : in Gdk_GC;
Dash_Offset : in Gint;
Dash_List : in Guchar_Array);
-- Specify the dash pattern when the line's style is anything but solid.
-- The values in the array alternatively give the length (in pixels) of
-- the plain dash, the empty dash, the second plain dash, ... None of
-- these values can be 0. If there is an odd number of items in Dash_List,
-- this is equivalent to giving the array concatenated with itself.
-- Dash_Offset specifies the phase of the pattern to start with.
procedure Copy (Dst_GC : in Gdk_GC;
Src_GC : in Gdk_GC);
-- Copy a Src_GC to Dst_GC.
----------------------
-- Gdk_Color_Values --
----------------------
function Gdk_New return Gdk_GC_Values;
-- Allocate a new Values structure on the client.
-- Note that this function allocates a C structure, and thus needs to
-- be freed with a call to Free below.
procedure Free (Values : in Gdk_GC_Values);
-- Free the C structure associated with Values.
procedure Set_Foreground (Values : in Gdk_GC_Values;
Color : in Gdk.Color.Gdk_Color);
-- Same as Set_Foreground, but on the client side
procedure Set_Background (Values : in Gdk_GC_Values;
Color : in Gdk.Color.Gdk_Color);
-- Same as Set_Background, but on the client side
procedure Set_Font (Values : in Gdk_GC_Values;
Font : in Gdk.Font.Gdk_Font);
-- Same as Set_Font, but on the client side
procedure Set_Function (Values : in Gdk_GC_Values;
Func : in Types.Gdk_Function);
-- Same as Set_Function, but on the client side
procedure Set_Fill (Values : in Gdk_GC_Values;
Fill : in Types.Gdk_Fill);
-- Same as Set_Fill, but on the client side
procedure Set_Ts_Origin (Values : in Gdk_GC_Values;
X, Y : in Gint);
-- Same as Set_Ts_Origin, but on the client side
procedure Set_Clip_Origin (Values : in Gdk_GC_Values;
X, Y : in Gint);
-- Same as Set_Clip_Origin, but on the client side
procedure Set_Subwindow (Values : in Gdk_GC_Values;
Mode : in Types.Gdk_Subwindow_Mode);
-- Same as Set_Subwindow, but on the client side
procedure Set_Exposures (Values : in Gdk_GC_Values;
Exposures : in Boolean);
-- Same as Set_Exposures, but on the client side
procedure Set_Line_Attributes (Values : in Gdk_GC_Values;
Line_Width : in Gint;
Line_Style : in Types.Gdk_Line_Style;
Cap_Style : in Types.Gdk_Cap_Style;
Join_Style : in Types.Gdk_Join_Style);
-- Same as Set_Line_Attributes, but on the client side
private
Null_GC : constant Gdk_GC := null;
Null_GC_Values : constant Gdk_GC_Values := null;
pragma Import (C, Copy, "gdk_gc_copy");
pragma Import (C, Destroy, "gdk_gc_destroy");
pragma Import (C, Free, "ada_gdk_gc_free_values");
pragma Import (C, Get_Values, "gdk_gc_get_values");
pragma Import (C, Ref, "gdk_gc_ref");
pragma Import (C, Unref, "gdk_gc_unref");
pragma Import (C, Set_Stipple, "gdk_gc_set_stipple");
pragma Import (C, Set_Tile, "gdk_gc_set_tile");
pragma Import (C, Set_Clip_Mask, "gdk_gc_set_clip_mask");
end Gdk.GC;
-----------------------------------------------------------------------
-- GtkAda - Ada95 binding for the Gimp Toolkit --
-- --
-- Copyright (C) 1998-2000 --
-- Emmanuel Briot, Joel Brobecker and Arnaud Charlet --
-- --
-- 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. --
-- --
-- As a special exception, if other files instantiate generics from --
-- this unit, or you link this unit with other files to produce an --
-- executable, this unit does not by itself cause the resulting --
-- executable to be covered by the GNU General Public License. This --
-- exception does not however invalidate any other reasons why the --
-- executable file might be covered by the GNU Public License. --
-----------------------------------------------------------------------
-- <description>
-- This is the base package for handling fonts.
-- GtkAda knows about bitmap and vectorial fonts, and can draw both.
-- The list of fonts available to you depends on what is installed on
-- your system.
--
-- The name of the font is indicated in the standard X11 fashion, namely:
-- (example extracted from the Xlib manual):
--
-- -adobe-courier-bold-o-normal--10-100-75-75-m-60-iso8859-1
-- where:
-- - adobe : foundry
-- - courier : font family
-- - bold : weight (e.g. bold, medium)
-- - o : slant (e.g. roman, italic, oblique)
-- - normal : set width (e.g. normal, condensed, narrow, double)
-- - 10 : pixels
-- - 100 : points (in tenths of a point)
-- - 75 : horizontal resolution in dpi
-- - 75 : vertical resolution in dpi
-- - m : spacing (e.g. monospace or proportional)
-- - 60 : average width (in tenths of a pixel)
-- - iso8859-1 : character set
--
-- Any of the fields can have a '*' instead, so that the system will
-- automatically find a font that matches the rest of the string, and won't
-- care about that specific field.
--
-- But the easiest way to select a font is by using some external programs,
-- for instance xfontsel, xlsfont, gfontsel, or even the font selection
-- dialog example in the testgtk/ directory of the GtkAda distribution.
--
-- @pxref{Package_Gtk.Extra.PsFont} for a package that processes postscript
-- fonts, with their more usual names, and can easily convert them to standard
-- Gdk_Font structures.
--
-- Some of the functions below should be used only for wide-character strings.
-- This is needed for languages with more than 256 characters.
--
-- Wide character values between 0 and 127 are always identical in meaning to
-- the ASCII character codes.
-- An alternative to wide characters is multi-byte characters, which extend
-- normal char strings to cope with larger character sets. As the name
-- suggests, multi-byte characters use a different number of bytes to store
-- different character codes. For example codes 0-127 (i.e. the ASCII codes)
-- often use just one byte of memory, while other codes may use 2, 3 or even
-- 4 bytes. Multi-byte characters have the advantage that they can often be
-- used in an application with little change, since strings are still
-- represented as arrays of char values. However multi-byte strings are much
-- easier to manipulate since the character are all of the same size.
--
-- On Unix systems, the external utility 'xfd' can be used to display all
-- the characters in a font.
--
-- </description>
-- <c_version>1.2.7</c_version>
-- <screenshot>font</screenshot>
with Glib; use Glib;
with Gdk.Types;
package Gdk.Font is
type Gdk_Font is new Gdk.C_Proxy;
-- A font used to draw text.
-- This can represent a bitmap font, a scalable (vectorial) font, or
-- a fontset. A fontset is a list of comma-separated fonts, that permits
-- GtkAda to obtain the fonts needed for a variety of locales from a
-- single locale-independent base font name. The single base font name
-- should name a family of fonts whose members are encoded in the various
-- charsets needed by the locales of interest.
-- The algorithm used to select the font is described in the manual page
-- for XCreateFontSet(3X).
Null_Font : constant Gdk_Font;
procedure Load (Font : out Gdk_Font;
Font_Name : in String);
-- Load a new font, given its name.
-- This is the first step before using a font.
-- The font is first looked up in the cache, and if it was already
-- loaded, it is not reloaded again. Thus, it does not harm to call
-- this function multiple times with the same Font_Name.
-- Null_Font is returned if the font could not be loaded.
procedure Fontset_Load (Font : out Gdk_Font;
Fontset_Name : in String);
-- Load a new font set.
-- Fontset_Name is a comma-separated list of fonts that will be loaded
-- as part of the fontset.
procedure Ref (Font : in Gdk_Font);
-- Increment the reference counter for the font.
-- You should not make any assumption of the initial value of the fonts
-- returned by Load or Fontset_Load, since these can be extracted from a
-- cache.
procedure Unref (Font : in Gdk_Font);
-- Decrement the reference counter for the font.
-- When this counter reaches 0, the font is deleted from memory.
function Id (Font : in Gdk_Font) return Gint;
-- Return the X font id for the font.
-- This Id will only be needed if you want to call directly X11 functions,
-- you won't need it with GtkAda.
function Equal (Fonta, Fontb : in Gdk_Font) return Boolean;
-- Compare two fonts or two fontsets for equality.
-- Two fonts are equal if they have the same font Id.
-- Two fontsets are equal if the name given to Fontset_Load was the same.
function Get_Ascent (Font : in Gdk_Font) return Gint;
-- Return the maximal ascent for the font.
-- This is the logical extent above the baseline for spacing between two
-- lines.
function Get_Descent (Font : in Gdk_Font) return Gint;
-- Return the maximal descent for the font.
-- This is the logical extent below the baseline for spacing between two
-- lines.
function String_Width (Font : in Gdk_Font;
Str : in String)
return Gint;
-- Return the width in pixels that Str will occupy if drawn with Font.
-- The value returned is the distance between the origin of the text and
-- the position at which the next string should be drawn.
function Text_Width (Font : in Gdk_Font;
Text : in String)
return Gint;
-- This is the same function as String_Width.
-- In C, this function is intended to measure only the width of a part
-- of the string, but you can simply pass it a substring in Ada.
function Text_Width (Font : in Gdk_Font;
Text : in Gdk.Types.Gdk_WString)
return Gint;
-- Return the width in pixels that Text will occupy on the screen.
-- This function should be used with strings that contain Unicode
-- characters
function Char_Width (Font : in Gdk_Font;
Char : in Character)
return Gint;
-- Return the width in pixels occupied by a single character on the screen.
-- The value returned is the distance between Char's origin on the screen
-- and the origin of the next character in the string.
function Char_Width (Font : in Gdk_Font;
Char : in Gdk.Types.Gdk_WChar)
return Gint;
-- Return the width in pixels occupied by a single wide-character.
function String_Measure (Font : in Gdk_Font;
Str : in String)
return Gint;
-- Determine the distance from the origin to the rightmost portion of Str.
-- This is not the correct value for determining the origin of the next
-- portion when drawing text in multiple pieces.
-- See String_Width instead.
function Text_Measure (Font : in Gdk_Font;
Text : in String)
return Gint;
-- Same function a String_Measure.
-- In C, this function is intended to measure only the width of a part of
-- the string, but you can simply pass it a substring in Ada.
-- This is also called the right bearing of the string.
function Char_Measure (Font : in Gdk_Font;
Char : in Character)
return Gint;
-- Return the width in pixels of Char.
-- As opposed to Char_Width, the value returned is not the distance at
-- which the next character should be drawn.
-- This is also called the right bearing of the character.
procedure String_Extents (Font : in Gdk.Font.Gdk_Font;
Str : in String;
Lbearing : out Gint;
Rbearing : out Gint;
Width : out Gint;
Ascent : out Gint;
Descent : out Gint);
-- Return the metrics for a given text.
-- See the picture for more explanations on all the fields.
-- Lbearing : Origin to left edge of character.
-- Rbearing : Origin to right edge of character.
-- Width : Advance to next character's origin.
-- Ascent : Baseline to top edge of character.
-- Descent : Baseline to bottom edge of character.
procedure Text_Extents (Font : in Gdk_Font;
Text : in String;
Lbearing : out Gint;
Rbearing : out Gint;
Width : out Gint;
Ascent : out Gint;
Descent : out Gint);
-- Return all the metrics for a given text.
-- See the picture for more explanations on all the fields.
-- in C, this function would be used for part of a string, which you can
-- simulate in Ada with a substring.
procedure Text_Extents (Font : in Gdk_Font;
Text : in Gdk.Types.Gdk_WString;
Lbearing : out Gint;
Rbearing : out Gint;
Width : out Gint;
Ascent : out Gint;
Descent : out Gint);
-- Return all the metrics for a given wide-character string.
-- See the picture for more explanations on the returned values.
function String_Height (Font : in Gdk_Font;
Str : in String)
return Gint;
-- Return the height in pixels of the string.
-- This is the total height, and you can not easily tell how this height
-- is split around the baseline.
function Text_Height (Font : in Gdk_Font;
Str : in String)
return Gint;
-- Same as String_Height.
-- In C, this function is intended to measure only the width of a part of
-- the string, but you can simply pass it a substring in Ada.
-- This is also called the right bearing of the string.
function Char_Height (Font : in Gdk_Font;
Char : in Character)
return Gint;
-- Return the total height in pixels of a single character.
private
Null_Font : constant Gdk_Font := null;
pragma Import (C, Char_Height, "gdk_char_height");
pragma Import (C, Id, "gdk_font_id");
pragma Import (C, Ref, "gdk_font_ref");
pragma Import (C, Unref, "gdk_font_unref");
pragma Import (C, Get_Ascent, "ada_gdk_font_get_ascent");
pragma Import (C, Get_Descent, "ada_gdk_font_get_descent");
end Gdk.Font;
-----------------------------------------------------------------------
-- GtkAda - Ada95 binding for the Gimp Toolkit --
-- --
-- Copyright (C) 1998-1999 --
-- Emmanuel Briot, Joel Brobecker and Arnaud Charlet --
-- --
-- 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. --
-- --
-- As a special exception, if other files instantiate generics from --
-- this unit, or you link this unit with other files to produce an --
-- executable, this unit does not by itself cause the resulting --
-- executable to be covered by the GNU General Public License. This --
-- exception does not however invalidate any other reasons why the --
-- executable file might be covered by the GNU Public License. --
-----------------------------------------------------------------------
with Glib; use Glib;
with Gdk.Rectangle;
with Gdk.Types;
package Gdk.Region is
type Gdk_Region is new Gdk.C_Proxy;
Null_Region : constant Gdk_Region;
procedure Gdk_New (Region : out Gdk_Region);
procedure Destroy (Region : in out Gdk_Region);
procedure Get_Clipbox
(Region : in Gdk_Region;
Rectangle : out Gdk.Rectangle.Gdk_Rectangle);
function Empty (Region : in Gdk_Region) return Boolean;
function "=" (Left, Right : in Gdk_Region) return Boolean;
function Point_In
(Region : in Gdk_Region;
X, Y : in Integer) return Boolean;
function Rect_In
(Region : in Gdk_Region;
Rect : in Rectangle.Gdk_Rectangle) return Types.Gdk_Overlap_Type;
procedure Polygon
(Region : out Gdk_Region;
Points : in Gdk.Types.Gdk_Points_Array;
Fill_Rule : in Types.Gdk_Fill_Rule);
procedure Offset
(Region : in Gdk_Region;
Dx : in Gint;
Dy : in Gint);
procedure Shrink
(Region : in Gdk_Region;
Dx : in Gint;
Dy : in Gint);
procedure Union_With_Rect
(Result : out Gdk_Region;
Region : in Gdk_Region;
Rect : in Rectangle.Gdk_Rectangle);
procedure Intersect
(Result : out Gdk_Region;
Source1 : in Gdk_Region;
Source2 : in Gdk_Region);
procedure Union
(Result : out Gdk_Region;
Source1 : in Gdk_Region;
Source2 : in Gdk_Region);
procedure Substract
(Result : out Gdk_Region;
Source1 : in Gdk_Region;
Source2 : in Gdk_Region);
procedure Gdk_Xor
(Result : out Gdk_Region;
Source1 : in Gdk_Region;
Source2 : in Gdk_Region);
private
Null_Region : constant Gdk_Region := null;
pragma Import (C, Offset, "gdk_region_offset");
pragma Import (C, Shrink, "gdk_region_shrink");
end Gdk.Region;
-----------------------------------------------------------------------
-- GtkAda - Ada95 binding for the Gimp Toolkit --
-- --
-- Copyright (C) 1998-2000 --
-- Emmanuel Briot, Joel Brobecker and Arnaud Charlet --
-- --
-- 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. --
-- --
-- As a special exception, if other files instantiate generics from --
-- this unit, or you link this unit with other files to produce an --
-- executable, this unit does not by itself cause the resulting --
-- executable to be covered by the GNU General Public License. This --
-- exception does not however invalidate any other reasons why the --
-- executable file might be covered by the GNU Public License. --
-----------------------------------------------------------------------
-- <description>
--
-- Pixmaps are off-screen drawables. They can be drawn upon with the standard
-- drawing primitives, then copied to another drawable (such as a Gdk_Window)
-- with Gdk.Pixmap.Draw. The depth of a pixmap is the number of bits per
-- pixels. Bitmaps are simply pixmaps with a depth of 1. (That is, they are
-- monochrome bitmaps - each pixel can be either on or off).
-- @pxref{Package_Gdk.Bitmap} for more details on bitmap handling.
--
-- </description>
-- <c_version>1.2.7</c_version>
with Glib; use Glib;
with Gdk.Bitmap;
with Gdk.Color;
with Gdk.Window;
with Gtkada.Types;
package Gdk.Pixmap is
subtype Gdk_Pixmap is Gdk.Gdk_Pixmap;
-- A server-side image.
-- You can create an empty pixmap, or load if from external files in
-- bitmap and pixmap format. See Gdk.Pixbuf if you need to load
-- images in other formats.
Null_Pixmap : constant Gdk_Pixmap;
procedure Gdk_New (Pixmap : out Gdk_Pixmap;
Window : in Gdk.Window.Gdk_Window;
Width : in Gint;
Height : in Gint;
Depth : in Gint := -1);
-- Create a new pixmap with a given size.
-- Window is used to determine default values for the new pixmap.
-- Can be eventually null.
-- Width is the width of the new pixmap in pixels.
-- Height is the height of the new pixmap in pixels.
-- Depth is the depth (number of bits per pixel) of the new pixmap.
-- If -1, and window is not null, the depth of the new pixmap will be
-- equal to that of window.
-- Automatically reference the pixmap once.
procedure Ref (Pixmap : in Gdk_Pixmap);
-- Add a reference to a pixmap.
procedure Unref (Pixmap : in Gdk_Pixmap);
-- This is the usual way to destroy a pixmap. The memory is freed when
-- there is no more reference
procedure Create_From_Data (Pixmap : out Gdk_Pixmap;
Window : in Gdk.Window.Gdk_Window;
Data : in String;
Width : in Gint;
Height : in Gint;
Depth : in Gint;
Fg : in Color.Gdk_Color;
Bg : in Color.Gdk_Color);
-- Create a pixmap from data in XBM format.
-- Window is used to determine default values for the new bitmap, can be
-- null in which case the root window is used.
-- Data is the XBM data.
-- Width is the width of the new bitmap in pixels.
-- Height is the height of the new bitmap in pixels.
-- Depth is the depth (number of bits per pixel) of the new pixmap.
-- Fg is the foreground color.
-- Bg is the background color.
procedure Create_From_Xpm (Pixmap : out Gdk_Pixmap;
Window : in Gdk.Window.Gdk_Window;
Mask : in out Gdk.Bitmap.Gdk_Bitmap;
Transparent : in Gdk.Color.Gdk_Color;
Filename : in String);
-- Create a pixmap from a XPM file.
-- Window is used to determine default values for the new pixmap.
-- Mask is a pointer to a place to store a bitmap representing the
-- transparency mask of the XPM file. Can be null, in which case
-- transparency will be ignored.
-- Transparent is the color to be used for the pixels that are transparent
-- in the input file. Can be null, in which case a default color will be
-- used.
-- Filename is the filename of a file containing XPM data.
procedure Create_From_Xpm (Pixmap : out Gdk_Pixmap;
Window : in Gdk.Window.Gdk_Window;
Colormap : in Gdk.Color.Gdk_Colormap;
Mask : in out Gdk.Bitmap.Gdk_Bitmap;
Transparent : in Gdk.Color.Gdk_Color;
Filename : in String);
-- Create a pixmap from a XPM file using a particular colormap.
-- Window is used to determine default values for the new pixmap. Can be
-- null if colormap is given.
-- Colormap is the Gdk_Colormap that the new pixmap will use. If omitted,
-- the colormap for window will be used.
-- Mask is a pointer to a place to store a bitmap representing the
-- transparency mask of the XPM file. Can be null, in which case
-- transparency will be ignored.
-- Transparent is the color to be used for the pixels that are transparent
-- in the input file. Can be null, in which case a default color will be
-- used.
-- Filename is the filename of a file containing XPM data.
procedure Create_From_Xpm_D
(Pixmap : out Gdk_Pixmap;
Window : in Gdk.Window.Gdk_Window;
Mask : in out Gdk.Bitmap.Gdk_Bitmap;
Transparent : in Gdk.Color.Gdk_Color;
Data : in Gtkada.Types.Chars_Ptr_Array);
-- Create a pixmap from data in XPM format.
-- Window is used to determine default values for the new pixmap.
-- Mask is a pointer to a place to store a bitmap representing the
-- transparency mask of the XPM file. Can be null, in which case
-- transparency will be ignored.
-- Transparent will be used for the pixels that are transparent in the
-- input file. Can be null in which case a default color will be used.
-- Data is a pointer to a string containing the XPM data.
procedure Create_From_Xpm_D
(Pixmap : out Gdk_Pixmap;
Window : in Gdk.Window.Gdk_Window;
Colormap : in Gdk.Color.Gdk_Colormap;
Mask : in out Gdk.Bitmap.Gdk_Bitmap;
Transparent : in Gdk.Color.Gdk_Color;
Data : in Gtkada.Types.Chars_Ptr_Array);
-- Create a pixmap from data in XPM format using a particular colormap.
-- Window is used to determine default values for the new pixmap.
-- Colormap is the Gdk_Colormap that the new pixmap will be use. If
-- omitted, the colormap for window will be used.
-- Mask is a pointer to a place to store a bitmap representing the
-- transparency mask of the XPM file. Can be null, in which case
-- transparency will be ignored.
-- Transparent will be used for the pixels that are transparent in the
-- input file. Can be null in which case a default color will be used.
-- Data is a pointer to a string containing the XPM data.
private
Null_Pixmap : constant Gdk_Pixmap := null;
pragma Import (C, Ref, "gdk_pixmap_ref");
pragma Import (C, Unref, "gdk_pixmap_unref");
end Gdk.Pixmap;
-----------------------------------------------------------------------
-- GtkAda - Ada95 binding for the Gimp Toolkit --
-- --
-- Copyright (C) 1998-2000 --
-- Emmanuel Briot, Joel Brobecker and Arnaud Charlet --
-- --
-- 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. --
-- --
-- As a special exception, if other files instantiate generics from --
-- this unit, or you link this unit with other files to produce an --
-- executable, this unit does not by itself cause the resulting --
-- executable to be covered by the GNU General Public License. This --
-- exception does not however invalidate any other reasons why the --
-- executable file might be covered by the GNU Public License. --
-----------------------------------------------------------------------
-- <description>
--
-- This packages provides the implementation of a generic single-linked
-- list.
-- One instantiation is found in Gtk.Widget.Widget_Slist for a list of
-- widgets.
--
-- See the documentation of Glib.Glist for more information, it provides
-- the same API as this package.
-- Single linked lists are traversed the same way as double-linked lists,
-- even though most subprograms are less efficient than their
-- double-linked counterparts.
--
-- </description>
-- <c_version>1.2.6</c_version>
with System;
package Glib.GSlist is
-- <doc_ignore>
generic
type Gpointer (<>) is private;
with function Convert (P : Gpointer) return System.Address is <>;
with function Convert (S : System.Address) return Gpointer is <>;
package Generic_SList is
type GSlist is private;
Null_List : constant GSlist;
procedure Alloc (List : out GSlist);
procedure Append (List : in out GSlist;
Data : in Gpointer);
function Concat (List1 : in GSlist;
List2 : in GSlist)
return GSlist;
procedure Insert (List : in out GSlist;
Data : in Gpointer;
Position : in Gint);
function Find (List : in GSlist;
Data : in Gpointer)
return GSlist;
procedure Free (List : in out GSlist);
function Get_Data (List : in GSlist)
return Gpointer;
function Index (List : in GSlist;
Data : in Gpointer)
return Gint;
function Last (List : in GSlist)
return GSlist;
function Length (List : in GSlist)
return Guint;
procedure List_Reverse (List : in out GSlist);
function Next (List : in GSlist)
return GSlist;
function Nth (List : in GSlist;
N : in Guint)
return GSlist;
function Nth_Data (List : in GSlist;
N : in Guint)
return Gpointer;
function Position (List : in GSlist;
Link : in GSlist)
return Gint;
procedure Prepend (List : in out GSlist;
Data : in Gpointer);
procedure Remove (List : in out GSlist;
Data : in Gpointer);
procedure Remove_Link (List : in out GSlist;
Link : in GSlist);
function Get_Object (Obj : in GSlist)
return System.Address;
pragma Inline (Get_Object);
procedure Set_Object (Obj : in out GSlist;
Value : in System.Address);
pragma Inline (Set_Object);
private
type GSlist is
record
Ptr : System.Address := System.Null_Address;
end record;
Null_List : constant GSlist := (Ptr => System.Null_Address);
end Generic_SList;
-- </doc_ignore>
end Glib.GSlist;
-----------------------------------------------------------------------
-- GtkAda - Ada95 binding for the Gimp Toolkit --
-- --
-- Copyright (C) 1998-2000 --
-- Emmanuel Briot, Joel Brobecker and Arnaud Charlet --
-- --
-- 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. --
-- --
-- As a special exception, if other files instantiate generics from --
-- this unit, or you link this unit with other files to produce an --
-- executable, this unit does not by itself cause the resulting --
-- executable to be covered by the GNU General Public License. This --
-- exception does not however invalidate any other reasons why the --
-- executable file might be covered by the GNU Public License. --
-----------------------------------------------------------------------
package body Glib.Glist is
use type System.Address;
package body Generic_List is
-----------
-- Alloc --
-----------
procedure Alloc (List : out Glist) is
function Internal return System.Address;
pragma Import (C, Internal, "g_list_alloc");
begin
Set_Object (List, Internal);
end Alloc;
------------
-- Append --
------------
procedure Append
(List : in out Glist;
Data : in Gpointer)
is
function Internal (List : System.Address;
Data : System.Address)
return System.Address;
pragma Import (C, Internal, "g_list_append");
begin
Set_Object (List, Internal (Get_Object (List),
Convert (Data)));
end Append;
------------
-- Concat --
------------
function Concat
(List1 : in Glist;
List2 : in Glist)
return Glist
is
function Internal (List1 : System.Address;
List2 : System.Address)
return System.Address;
pragma Import (C, Internal, "g_list_append");
Tmp : Glist;
begin
Set_Object (Tmp, Internal (Get_Object (List1),
Get_Object (List2)));
return Tmp;
end Concat;
------------
-- Insert --
------------
procedure Insert
(List : in out Glist;
Data : in Gpointer;
Position : in Gint)
is
function Internal (List : System.Address;
Data : System.Address;
Pos : Gint)
return System.Address;
pragma Import (C, Internal, "g_list_insert");
begin
Set_Object (List, Internal (Get_Object (List),
Convert (Data), Position));
end Insert;
----------
-- Find --
----------
function Find
(List : in Glist;
Data : in Gpointer)
return Glist
is
function Internal (List : System.Address;
Data : System.Address)
return System.Address;
pragma Import (C, Internal, "g_list_find");
Tmp : Glist;
begin
Set_Object (Tmp, Internal (Get_Object (List),
Convert (Data)));
return Tmp;
end Find;
-----------
-- First --
-----------
function First (List : in Glist)
return Glist
is
function Internal (List : System.Address)
return System.Address;
pragma Import (C, Internal, "g_list_first");
Tmp : Glist;
begin
Set_Object (Tmp, Internal (Get_Object (List)));
return Tmp;
end First;
----------
-- Free --
----------
procedure Free (List : in out Glist) is
procedure Internal (List : System.Address);
pragma Import (C, Internal, "g_list_free");
begin
Internal (Get_Object (List));
end Free;
--------------
-- Get_Data --
--------------
function Get_Data (List : in Glist) return Gpointer is
function Internal (List : in System.Address)
return System.Address;
pragma Import (C, Internal, "ada_list_get_data");
begin
return Convert (Internal (Get_Object (List)));
end Get_Data;
--------------
-- Get_Data --
--------------
function Get_Data_Address (List : in Glist) return System.Address is
function Internal (List : in System.Address)
return System.Address;
pragma Import (C, Internal, "ada_list_get_data");
begin
return Internal (Get_Object (List));
end Get_Data_Address;
--------------------
-- Get_Gpointer --
--------------------
function Get_Gpointer (List : in Glist) return Gpointer is
begin
return Convert (Get_Object (List));
end Get_Gpointer;
----------------
-- Get_Object --
----------------
function Get_Object (Obj : in Glist)
return System.Address is
begin
return Obj.Ptr;
end Get_Object;
-----------
-- Index --
-----------
function Index
(List : in Glist;
Data : in Gpointer)
return Gint
is
function Internal (List : System.Address;
Data : System.Address)
return Gint;
pragma Import (C, Internal, "g_list_index");
begin
return Internal (Get_Object (List),
Convert (Data));
end Index;
------------------
-- Is_Created --
------------------
function Is_Created (List : in Glist) return Boolean is
begin
return Get_Object (List) /= System.Null_Address;
end Is_Created;
----------
-- Last --
----------
function Last (List : in Glist) return Glist is
function Internal (List : System.Address)
return System.Address;
pragma Import (C, Internal, "g_list_last");
Tmp : Glist;
begin
Set_Object (Tmp, Internal (Get_Object (List)));
return Tmp;
end Last;
------------
-- Length --
------------
function Length (List : in Glist) return Guint is
function Internal (List : System.Address)
return Guint;
pragma Import (C, Internal, "g_list_length");
begin
return Internal (Get_Object (List));
end Length;
------------------
-- List_Reverse --
------------------
procedure List_Reverse (List : in out Glist) is
function Internal (List : System.Address)
return System.Address;
pragma Import (C, Internal, "g_list_reverse");
begin
Set_Object (List, Internal (Get_Object (List)));
end List_Reverse;
----------
-- Next --
----------
function Next (List : in Glist) return Glist is
function Internal (List : System.Address)
return System.Address;
pragma Import (C, Internal, "ada_list_next");
Tmp : Glist;
begin
Set_Object (Tmp, Internal (Get_Object (List)));
return Tmp;
end Next;
---------
-- Nth --
---------
function Nth
(List : in Glist;
N : in Guint)
return Glist
is
function Internal (List : System.Address;
N : Guint)
return System.Address;
pragma Import (C, Internal, "g_list_nth");
Tmp : Glist;
begin
Set_Object (Tmp, Internal (Get_Object (List), N));
return Tmp;
end Nth;
--------------
-- Nth_Data --
--------------
function Nth_Data
(List : in Glist;
N : in Guint)
return Gpointer
is
function Internal (List : System.Address;
N : Guint)
return System.Address;
pragma Import (C, Internal, "g_list_nth_data");
begin
return Convert (Internal (Get_Object (List), N));
end Nth_Data;
--------------
-- Position --
--------------
function Position
(List : in Glist;
Link : in Glist)
return Gint
is
function Internal (List : System.Address;
Link : System.Address)
return Gint;
pragma Import (C, Internal, "g_list_position");
begin
return Internal (Get_Object (List), Get_Object (Link));
end Position;
-------------
-- Prepend --
-------------
procedure Prepend
(List : in out Glist;
Data : in Gpointer)
is
function Internal (List : System.Address;
Data : System.Address)
return System.Address;
pragma Import (C, Internal, "g_list_prepend");
begin
Set_Object (List, Internal (Get_Object (List),
Convert (Data)));
end Prepend;
----------
-- Prev --
----------
function Prev (List : in Glist) return Glist is
function Internal (List : System.Address)
return System.Address;
pragma Import (C, Internal, "ada_list_prev");
Tmp : Glist;
begin
Set_Object (Tmp, Internal (Get_Object (List)));
return Tmp;
end Prev;
------------
-- Remove --
------------
procedure Remove
(List : in out Glist;
Data : in Gpointer)
is
function Internal (List : System.Address;
Data : System.Address)
return System.Address;
pragma Import (C, Internal, "g_list_remove");
begin
Set_Object (List, Internal (Get_Object (List),
Convert (Data)));
end Remove;
-----------------
-- Remove_Link --
-----------------
procedure Remove_Link
(List : in out Glist;
Link : in Glist)
is
function Internal (List : System.Address;
Link : System.Address)
return System.Address;
pragma Import (C, Internal, "g_list_remove_link");
begin
Set_Object (List, Internal (Get_Object (List),
Get_Object (Link)));
end Remove_Link;
----------------
-- Set_Object --
----------------
procedure Set_Object (Obj : in out Glist;
Value : in System.Address) is
begin
Obj.Ptr := Value;
end Set_Object;
end Generic_List;
end Glib.Glist;
-----------------------------------------------------------------------
-- GtkAda - Ada95 binding for the Gimp Toolkit --
-- --
-- Copyright (C) 1998-2000 --
-- Emmanuel Briot, Joel Brobecker and Arnaud Charlet --
-- --
-- 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. --
-- --
-- As a special exception, if other files instantiate generics from --
-- this unit, or you link this unit with other files to produce an --
-- executable, this unit does not by itself cause the resulting --
-- executable to be covered by the GNU General Public License. This --
-- exception does not however invalidate any other reasons why the --
-- executable file might be covered by the GNU Public License. --
-----------------------------------------------------------------------
package body Glib.GSlist is
package body Generic_SList is
-----------
-- Alloc --
-----------
procedure Alloc (List : out GSlist) is
function Internal return System.Address;
pragma Import (C, Internal, "g_slist_alloc");
begin
Set_Object (List, Internal);
end Alloc;
------------
-- Append --
------------
procedure Append
(List : in out GSlist;
Data : in Gpointer)
is
function Internal (List : System.Address;
Data : System.Address)
return System.Address;
pragma Import (C, Internal, "g_slist_append");
begin
Set_Object (List, Internal (Get_Object (List),
Convert (Data)));
end Append;
------------
-- Concat --
------------
function Concat
(List1 : in GSlist;
List2 : in GSlist)
return GSlist
is
function Internal (List1 : System.Address;
List2 : System.Address)
return System.Address;
pragma Import (C, Internal, "g_slist_append");
Tmp : GSlist;
begin
Set_Object (Tmp, Internal (Get_Object (List1),
Get_Object (List2)));
return Tmp;
end Concat;
--------------
-- Get_Data --
--------------
function Get_Data (List : in GSlist)
return Gpointer
is
function Internal (List : System.Address) return System.Address;
pragma Import (C, Internal, "ada_gslist_get_data");
begin
return Convert (Internal (Get_Object (List)));
end Get_Data;
------------
-- Insert --
------------
procedure Insert
(List : in out GSlist;
Data : in Gpointer;
Position : in Gint)
is
function Internal (List : System.Address;
Data : System.Address;
Pos : Gint)
return System.Address;
pragma Import (C, Internal, "g_slist_insert");
begin
Set_Object (List, Internal (Get_Object (List),
Convert (Data), Position));
end Insert;
----------
-- Find --
----------
function Find
(List : in GSlist;
Data : in Gpointer)
return GSlist
is
function Internal (List : System.Address;
Data : System.Address)
return System.Address;
pragma Import (C, Internal, "g_slist_find");
Tmp : GSlist;
begin
Set_Object (Tmp, Internal (Get_Object (List),
Convert (Data)));
return Tmp;
end Find;
----------
-- Free --
----------
procedure Free (List : in out GSlist) is
procedure Internal (List : System.Address);
pragma Import (C, Internal, "g_slist_free");
begin
Internal (Get_Object (List));
end Free;
----------------
-- Get_Object --
----------------
function Get_Object (Obj : in GSlist)
return System.Address is
begin
return Obj.Ptr;
end Get_Object;
-----------
-- Index --
-----------
function Index
(List : in GSlist;
Data : in Gpointer)
return Gint
is
function Internal (List : System.Address;
Data : System.Address)
return Gint;
pragma Import (C, Internal, "g_slist_index");
begin
return Internal (Get_Object (List),
Convert (Data));
end Index;
----------
-- Last --
----------
function Last (List : in GSlist) return GSlist is
function Internal (List : System.Address)
return System.Address;
pragma Import (C, Internal, "g_slist_last");
Tmp : GSlist;
begin
Set_Object (Tmp, Internal (Get_Object (List)));
return Tmp;
end Last;
------------
-- Length --
------------
function Length (List : in GSlist) return Guint is
function Internal (List : System.Address)
return Guint;
pragma Import (C, Internal, "g_slist_length");
begin
return Internal (Get_Object (List));
end Length;
------------------
-- List_Reverse --
------------------
procedure List_Reverse (List : in out GSlist) is
function Internal (List : System.Address)
return System.Address;
pragma Import (C, Internal, "g_slist_reverse");
begin
Set_Object (List, Internal (Get_Object (List)));
end List_Reverse;
----------
-- Next --
----------
function Next (List : in GSlist) return GSlist is
function Internal (List : System.Address)
return System.Address;
pragma Import (C, Internal, "ada_gslist_next");
Tmp : GSlist;
begin
Set_Object (Tmp, Internal (Get_Object (List)));
return Tmp;
end Next;
---------
-- Nth --
---------
function Nth
(List : in GSlist;
N : in Guint)
return GSlist
is
function Internal (List : System.Address;
N : Guint)
return System.Address;
pragma Import (C, Internal, "g_slist_nth");
Tmp : GSlist;
begin
Set_Object (Tmp, Internal (Get_Object (List), N));
return Tmp;
end Nth;
--------------
-- Nth_Data --
--------------
function Nth_Data
(List : in GSlist;
N : in Guint)
return Gpointer
is
function Internal (List : System.Address;
N : Guint)
return System.Address;
pragma Import (C, Internal, "g_slist_nth_data");
begin
return Convert (Internal (Get_Object (List), N));
end Nth_Data;
--------------
-- Position --
--------------
function Position
(List : in GSlist;
Link : in GSlist)
return Gint
is
function Internal (List : System.Address;
Link : System.Address)
return Gint;
pragma Import (C, Internal, "g_slist_position");
begin
return Internal (Get_Object (List), Get_Object (Link));
end Position;
-------------
-- Prepend --
-------------
procedure Prepend
(List : in out GSlist;
Data : in Gpointer)
is
function Internal (List : System.Address;
Data : System.Address)
return System.Address;
pragma Import (C, Internal, "g_slist_prepend");
begin
Set_Object (List, Internal (Get_Object (List),
Convert (Data)));
end Prepend;
------------
-- Remove --
------------
procedure Remove
(List : in out GSlist;
Data : in Gpointer)
is
function Internal (List : System.Address;
Data : System.Address)
return System.Address;
pragma Import (C, Internal, "g_slist_remove");
begin
Set_Object (List, Internal (Get_Object (List),
Convert (Data)));
end Remove;
-----------------
-- Remove_Link --
-----------------
procedure Remove_Link
(List : in out GSlist;
Link : in GSlist)
is
function Internal (List : System.Address;
Link : System.Address)
return System.Address;
pragma Import (C, Internal, "g_slist_remove_link");
begin
Set_Object (List, Internal (Get_Object (List),
Get_Object (Link)));
end Remove_Link;
----------------
-- Set_Object --
----------------
procedure Set_Object (Obj : in out GSlist;
Value : in System.Address) is
begin
Obj.Ptr := Value;
end Set_Object;
end Generic_SList;
end Glib.GSlist;
>Release-Note:
>Audit-Trail:
>Unformatted: