A Gtk_Aspect_Frame is the same type of widget as a frame, but it constrains its child to a specific aspect ratio between its width and its height. This ratio can either be given explicitly by the user, or chosen from the widget's initial size request (might be different from the one if was actually given). This package implements a general button widget. This button can be clicked on by the user to start any action. This button does not have multiple states, it can just be temporarily pressed while the mouse is on it, but does not keep its pressed state. The gtk+ sources provide the following drawing that explains the role of the various spacings that can be set for a button: This widget is a container that catches events for its child when its child does not have its own window (like a Gtk_Scrolled_Window or a Gtk_Label for instance). Some widgets in GtkAda do not have their own window, and thus can not directly get events from the server. The Gtk_Event_Box widget can be used to force its child to receive events anyway. For instance, this widget is used internally in a Gtk_Combo_Box so that the application can change the cursor when the mouse is in the popup window. In that case, it contains a frame, that itself contains the scrolled window of the popup. Create a new box. The box's child can then be set using the Gtk.Container.Add function. A Gtk_Frame is a simple border than can be added to any widget or group of widget to enhance its visual aspect. Optionally, a frame can have a title. This is a very convenient widget to visually group related widgets (like groups of buttons for instance), possibly with a title to explain the purpose of this group. A Gtk_Frame has only one child, so you have to put a container like for instance a Gtk_Box inside if you want the frame to surround multiple widgets. A Gtk_Label is a light widget associated with some text you want to display on the screen. You can change the text dynamically if needed. The text can be on multiple lines if you separate each line with the ASCII.LF character. However, this is not the recommended way to display long texts (see the Gtk_Text widget instead). == Mnemonics == Labels may contain mnemonics. Mnemonics are underlined characters in the label, used for keyboard navigation. Mnemonics are created by providing string with an underscore before the mnemonic character, such as "_File", to the functions gtk_new_with_mnemonic or set_text_with_mnemonic(). Mnemonics automatically activate any activatable widget the label is inside, such as a Gtk_Button; if the label is not inside the mnemonic's target widget, you have to tell the label about the target using set_mnemonic_widget(). For instance: declare Button : Gtk_Button; Label : Gtk_Label; begin Gtk_New (Button); Gtk_New_With_Mnemonic (Label, "_File"); Add (Button, Label); end; However, there exists a convenience function in Gtk.Button to create such a button already. == Markup == To make it easy to format text in a label (changing colors, fonts, etc.), label text can be provided in a simple markup format. Here's how to create a label with a small font: Gtk_New (Label, "<small>hello</small>"); The markup must be valid, and <>& characters must be escaped with &lt; &gt; and &amp; Markup strings are just a convenient way to set the Pango_Attr_List on label; Set_Attributes() may be a simpler way to set attributes in some cases. Be careful though; Pango_Attr_List tends to cause internationalization problems, unless you're applying attributes to the entire string (i.e. unless you set the range of each attribute to [0, G_MAXINT)). The reason is that specifying the start_index and end_index for a Pango_Attribute requires knowledge of the exact string being displayed, so translations will cause problems. == Selectable labels == Labels can be made selectable with Set_Selectable. Selectable labels allow the user to copy the label contents to the clipboard. Only should be made selectable. Change the underlines pattern. Pattern is a simple string made of underscore and space characters, matching the ones in the string. GtkAda will underline every letter that matches an underscore. An empty string disables the underlines. example: If the text is FooBarBaz and the Pattern is "___ ___" then both "Foo" and "Baz" will be underlined, but not "Bar". A Gtk_Paned is a container that organizes its two children either horizontally or vertically. The initial size allocated to the children depends on the size they request. However, the user has the possibility to interactively move a separation bar between the two to enlarge one of the children, while at the same time shrinking the second one. The bar can be moved by clicking with the mouse on a small cursor displayed in the bar, and then dragging the mouse. No additional decoration is provided around the children. Each child has two parameters, Resize and Shrink. If Shrink is True, then the widget can be made smaller than its requisition size by the user. Set this to False if you want to set a minimum size. if Resize is True, this means that the child accepts to be resized, and will not require any size. Thus, the size allocated to it will be the total size allocated to the container minus the size requested by the other child. If Resize is False, the child should ask for a specific size, which it will get. The other child will be resized accordingly. If both Child have the same value for Resize (either True or False), then the size allocated to each is a ratio between the size requested by both. When you use Set_Position with a parameter other than -1, or the user moves the handle to resize the widgets, the behavior of Resize is canceled. Add a child to the top or left pane. You can not change dynamically the attributes Resize and Shrink. Instead, you have to remove the child from the container, and put it back with the new value of the attributes. You should also first call Gtk.Object.Ref on the child so as to be sure it is not destroyed when you remove it, and Gtk.Object.Unref it at the end. See the example in testgtk/ in the GtkAda distribution. Add the first child of the container. The child will be displayed either in the top or in the left pane, depending on the orientation of the container. This is equivalent to using the Pack1 procedure with its default parameters. Add the second child of the container. It will be displayed in the bottom or right pane, depending on the container's orientation. This is equivalent to using Pack2 with its default parameters. The children will be displayed one on top of the other The children will be displayed next to each other A box is a container that can have multiple children, organized either horizontally or vertically. Two subtypes are provided, Gtk_Hbox and Gtk_Vbox, to conform to the C API. In Ada, you do not need to distinguish between the two, but note that the Gtk_Box type is conceptually an abstract type: there is no way to create a "Gtk_Box", only ways to create either an horizontal box, or a vertical box. Children can be added to one of two positions in the box, either at the beginning (ie left or top) or at the end (ie right or bottom). Each of these positions can contain multiple widgets. Every time a child is added to the start, it is placed to the right (resp. the bottom) of the previous widget added to the start. Every time a child is added to the end, it is placed to the left (resp. the top) of the previous widget added to the end. There are a number of parameters to specify the behavior of the box when it is resized, and how the children should be reorganized and/or resized. See the testgtk example in the GtkAda distribution to see concrete examples on how all the parameters for the boxes work. Return the Num-th child of the box, or null if there is no such child A scale is a horizontal or vertical widget that a user can slide to choose a value in a given range. This is a kind of cursor, similar to what one finds on audio systems to select the volume for instance. Gtk_Arrow should be used to draw simple arrows that need to point in one of the four cardinal directions (up, down, left, or right). The style of the arrow can be one of shadow in, shadow out, etched in, or etched out. Note that these directions and style types may be ammended in versions of Gtk to come. Gtk_Arrow will fill any space alloted to it, but since it is inherited from Gtk_Misc, it can be padded and/or aligned, to fill exactly the space you desire. Arrows are created with a call to Gtk_New. The direction or style of an arrow can be changed after creation by using Set. This widget is an adapter: it can contain any child, and will make it scrollable. Its use is not necessary inside a Gtk_Scrolled_Window, which automatically uses a Gtk_Viewport when necessary. Whether the pixmap should be grayed out, as is done for insensitive widgets that do not accept user interaction function Create_Pixmap (Filename : String; Window : access Gtk.Window.Gtk_Window_Record'Class) return Gtk_Pixmap; -- Create a pixmap given a window and a filename function Create_Pixmap (Data : Gtkada.Types.Chars_Ptr_Array; Window : access Gtk.Window.Gtk_Window_Record'Class) return Gtk_Pixmap; -- Create a pixmap given a window and a buffer. Dummy_Pixmap : constant GtkAda.Types.chars_ptr_array := (New_String ("1 1 1 1"), New_String ("c None"), New_String (" ")); -- This is a dummy pixmap we use when a pixmap can't be found. function Create_Pixmap (Filename : String; Window : access Gtk.Window.Gtk_Window_Record'Class) return Gtk_Pixmap is Gdkpixmap : Gdk.Pixmap.Gdk_Pixmap; Mask : Gdk.Bitmap.Gdk_Bitmap; Pixmap : Gtk_Pixmap; use Gtk.Widget; use Gtk.Window; begin if not Realized_Is_Set (Window) then Gtk.Window.Realize (Window); end if; if Filename = "" then Gdk.Pixmap.Create_From_Xpm_D (Gdkpixmap, Get_Window (Window), Mask, Gdk.Color.Null_Color, Dummy_Pixmap); else Gdk.Pixmap.Create_From_Xpm (Gdkpixmap, Get_Window (Window), Mask, Gdk.Color.Null_Color, Filename); end if; Gtk_New (Pixmap, Gdkpixmap, Mask); return Pixmap; end Create_Pixmap; function Create_Pixmap (Data : Gtkada.Types.Chars_Ptr_Array; Window : access Gtk.Window.Gtk_Window_Record'Class) return Gtk_Pixmap is Gdkpixmap : Gdk.Pixmap.Gdk_Pixmap; Mask : Gdk.Bitmap.Gdk_Bitmap; Pixmap : Gtk_Pixmap; use Gtk.Widget; use Gtk.Window; begin if not Realized_Is_Set (Window) then Gtk.Window.Realize (Window); end if; Gdk.Pixmap.Create_From_Xpm_D (Gdkpixmap, Get_Window (Window), Mask, Gdk.Color.Null_Color, Data); Gtk_New (Pixmap, Gdkpixmap, Mask); return Pixmap; end Create_Pixmap; This widget is a base class for all the widgets that require an alignment and padding. This widget can not be instantiated directly. Modify the alignment for the widget. Xalign and Yalign are both values between 0.0 and 1.0 that specify the alignment: if Xalign is 0.0, the widget will be left aligned; if it is 0.5, the widget will be centered; if it is 1.0 the widget will be right aligned. Yalign is from top (0.0) to bottom (1.0). Both Xalign and Yalign will be constrained to the range 0.0 .. 1.0 Note that if the widget fills its allocated area, these two parameters won't have any effect. Set the padding (i.e. the extra spaces on the side of the widget). If Xpad or Ypad is negative, they will be changed to 0. Base class for containers that have only one child. This widget can not be instantiated directly. Remove some items from the list. If The_End is negative, it means the end of the list. The first item in the list has an index of 0 function Get_Selection (Widget : access Gtk.List.Gtk_List_Record) return Widget_List.Glist; function Get_Selection (Widget : access Gtk.List.Gtk_List_Record) return Widget_List.Glist is use Widget_List; function Internal (Widget : in System.Address) return System.Address; pragma Import (C, Internal, "ada_list_get_selection"); List : Gtk.Widget.Widget_List.Glist; begin Set_Object (List, Internal (Get_Object (Widget))); return List; end Get_Selection; This package is deprecated. It now only acts as an abstract base class for other widgets. A Gtk_Layout is a widget that can have an almost infinite size, without occupying a lot of memory. Its children can be located anywhere within it, but will only appear on the screen if the visible area of the layout contains them. Just like a Gtk_Viewport, its visible area is indicated by two Gtk_Adjustment widgets, and thus a Gtk_Layout can be put as is in a Gtk_Scrolled_Window. As for Gtk_Fixed containers, the children can be located anywhere in the layout (no automatic organization is done). But, as opposed to Gtk_Fixed widgets, a Gtk_Layout does not try to resize itself to show all its children. Starting from GtkAda 2.0, you have to call Set_Size and specify the maximum size of the layout, otherwise children added with Put outside the size defined for the layout will never be visible. One way to do this is to systematically call Set_Size before calling Put, and make sure you specify a size big enough for the layout. The child will be displayed on the screen only if at least part of it intersects the visible area of the layout. The layout does not resize itself to automatically show the widget. You also need to call Set_Size, if the size you initially defined is smaller than (X, Y), or the child will never be visible even if the layout is scrolled. Return the adjustment that indicate the horizontal visual area of the layout. You generally do not have to modify the value of this adjustment yourself, since this is done automatically when the layout has been put in a Gtk_Scrolled_Window. This widget provides a low level graphical representation of a range of values. It is used by other widgets such as Gtk_Scale and Gtk_Scrollbar. A Gtk_Button_Box is a special type of Gtk_Box specially tailored to contain buttons. This is only a base class for Gtk_Hbutton_Box and Gtk_Vbutton_Box which provide a way to arrange their children horizontally (resp. vertically). You can not instantiate a Gtk_Button_Box directly, and have to use one the above two instead. Set whether Child should appear in a secondary group of children. A typical use of a secondary child is the help button in a dialog. This group appears after the other children if the style is Buttonbox_Start, Buttonbox_Spread or Buttonbox_Edge, and before the other children if the style is Buttonbox_End. For horizontal button boxes, the definition of before/after depends on direction of the widget. (See Gtk.Widget.Set_Direction) If the style is Buttonbox_Start, or Buttonbox_End, then the secondary children are aligned at the other end of the button box from the main children. For the other styles, they appear immediately next to the main children. Is_Secondary: if True, the Child appears in a secondary group of the button box. A Gtk_Hbutton_Box is a specific Gtk_Button_Box that organizes its children horizontally. The beginning of the box (when you add children with Gtk.Box.Pack_Start) is on the left of the box. Its end (for Gtk.Box.Pack_End) is on the right. Set the default spacing (space between two adjacent children). This is done for all the Hbutton_Boxes in your application. This can be overridden for a specific box by calling Gtk.Button_Box.Set_Spacing. Set the the default layout to use for all the hbutton_boxes in your application that don't have a specific value set by Gtk.Button_Box.Set_Layout. The default value is Buttonbox_Edge A Gtk_Vbutton_Box is a specific Gtk_Button_Box that organizes its children vertically. The beginning of the box (when you add children with Gtk.Box.Pack_Start) is on the top of the box. Its end (for Gtk.Box.Pack_End) is on the bottom. Gtk_Volume_Button is a subclass of Gtk_Scale_Button that has been tailored for use as a volume control widget with suitable icons, tooltips and accessible labels. The Gtk_About_Dialog offers a simple way to display information about a program like its logo, name, copyright, website and license. It is also possible to give credits to the authors, documenters, translators and artists who have worked on the program. An about dialog is typically opened when the user selects the About option from the Help menu. All parts of the dialog are optional. About dialog often contain links and email addresses. Gtk_About_Dialog supports this by offering global hooks, which are called when the user clicks on a link or email address, see Set_Email_Hook and Set_Url_Hook. Email addresses in the authors, documenters and artists properties are recognized by looking for <user@host>, URLs are recognized by looking for http://url, with url extending to the next space, tab or line break. To make constructing a Gtk_About_Dialog as convenient as possible, you can use the function gtk_show_about_dialog which constructs and shows a dialog and keeps it around so that it can be shown again. type Activate_Link_Func is access procedure (About : System.Address; Link : Interfaces.C.Strings.chars_ptr; Data : System.Address); pragma Convention (C, Activate_Link_Func); -- A callback called when the user presses an hyper link in the about -- dialog. This is a low-level function, and you'll need to convert the -- parameters to more useful types with: -- Stub : Gtk_About_Dialog_Record; -- A : constant Gtk_About_Dialog := -- Gtk_About_Dialog (Get_User_Data (About, Stub)); -- L : constant String := Interfaces.C.Strings.Value (Link); A Gtk_Entry is a single line text editing widget. The text is automatically scrolled if it is longer than can be displayed on the screen, so that the cursor position is visible at all times. See Gtk_Text_View for a multiple-line text editing widget. The Gtk_Combo widget consists of a single-line text entry field and a drop-down list. The drop-down list is displayed when the user clicks on a small arrow button to the right of the entry field. The drop-down list is a Gtk_List widget and can be accessed using the list member of the Gtk_Combo. List elements can contain arbitrary widgets, but if an element is not a plain label, then you must use the Gtk_List.Set_Item_String function. This sets the string which will be placed in the text entry field when the item is selected. By default, the user can step through the items in the list using the arrow (cursor) keys, though this behaviour can be turned off with Set_Use_Arrows. Normally the arrow keys are only active when the contents of the text entry field matches one of the items in the list. If the contents of the entry field do not match any of the list items, then pressing the arrow keys does nothing. However, by calling Set_Use_Arrows_Always you can specify that the arrow keys are always active. If the contents of the entry field does not match any of the items in the list, then pressing the up or down arrow key will set the entry field to the last or first item in the list, respectively. Specify whether the value entered in the text entry field must match one of the values in the list. If this is set then the user will not be able to perform any other action until a valid value has been entered. If an empty field is acceptable, the Ok_If_Empty parameter should be True. If the value entered must match one of the values in the list, val should be True. Specify if the arrow (cursor) keys can be used to step through the items in the list. This is on by default. Specify if the arrow keys will still work even if the current contents of the Gtk_Entry field do not match any of the list items. Specify whether the text entered into the Gtk_Entry field and the text in the list items are case sensitive. This may be useful, for example, when you have called Set_Value_In_List to limit the values entered, but you are not worried about differences in case. Set all the items in the popup list. Disable the standard handler for the return key in the entry field. The default behavior is to popdown the combo box list, so that the user can choose from it. However, if you want to add your own callback for the return key, you need to call this subprogram, and connect a handler to the "activate" signal for the entry. Set the string to place in the Gtk_Entry field when a particular list item is selected. This is needed if the list item is not a simple label. Dialog boxes are a convenient way to prompt the user for a small amount of input, eg. to display a message, ask a question, or anything else that does not require extensive effort on the user's part. Gtkada treats a dialog as a window split horizontally. The top section is a Gtk_Vbox, and is where widgets such as a Gtk_Label or a Gtk_Entry should be packed. The second area is known as the action_area. This is generally used for packing buttons into the dialog which may perform functions such as cancel, ok, or apply. The two areas are separated by a Gtk_Hseparator. If 'dialog' is a newly created dialog, the two primary areas of the window can be accessed using Get_Vbox and Get_Action_Area as can be seen from the example, below. A 'modal' dialog (that is, one which freezes the rest of the application from user input), can be created by calling Set_Modal on the dialog. See Gtkada.Dialogs for a higher level dialog interface. Create a new dialog with a specific title, and specific attributes. Parent is the transient parent for the dialog (ie the one that is used for reference for the flag Destroy_With_Parent, or to compute the initial position of the dialog). procedure Set_Alternative_Button_Order_From_Array (Dialog : access Gtk_Dialog_Record; New_Order : Response_Type_Array); -- Sets an alternative button order. If the gtk-alternative-button-order -- setting is set to %TRUE, the dialog buttons are reordered according to -- the order of the response ids passed to this function. -- -- By default, GTK+ dialogs use the button order advocated by the Gnome -- Human Interface Guidelines with the affirmative button at the far right, -- and the cancel button left of it. But the builtin GTK+ dialogs and -- message dialogs' do provide an alternative button order, which is more -- suitable on some platforms, e.g. Windows. -- -- Use this function after adding all the buttons to your dialog. function Gtk_Alternative_Dialog_Button_Order (Screen : Gdk.Gdk_Screen := null) return Boolean; -- Returns True if dialogs are expected to use an alternative button order -- on the given screen (or current screen if null) . See -- Set_Alternative_Button_Order_From_Array for more details about -- alternative button order. -- -- If you need to use this function, you should probably connect to the -- ::notify:gtk-alternative-button-order signal on the Gtk_Settings object -- associated to Screen, in order to be notified if the button order -- setting changes. -- -- Returns: Whether the alternative button order should be used procedure Set_Alternative_Button_Order_From_Array (Dialog : access Gtk_Dialog_Record; New_Order : Response_Type_Array) is procedure Internal (Dialog : System.Address; N_Params : Gint; New_Order : System.Address); pragma Import (C, Internal, "gtk_dialog_set_alternative_button_order_from_array"); begin Internal (Get_Object (Dialog), New_Order'Length, New_Order (New_Order'First)'Address); end Set_Alternative_Button_Order_From_Array; function Gtk_Alternative_Dialog_Button_Order (Screen : Gdk.Gdk_Screen := null) return Boolean is function Internal (Screen : Gdk.Gdk_Screen) return Gboolean; pragma Import (C, Internal, "gtk_alternative_dialog_button_order"); begin return Boolean'Val (Internal (Screen)); end Gtk_Alternative_Dialog_Button_Order; type Gtk_Dialog_Flags is mod 8; for Gtk_Dialog_Flags'Size use Gint'Size; pragma Convention (C, Gtk_Dialog_Flags); Modal : constant Gtk_Dialog_Flags := 2 ** 0; Destroy_With_Parent : constant Gtk_Dialog_Flags := 2 ** 1; No_Separator : constant Gtk_Dialog_Flags := 2 ** 2; -- Various flags that can be set for the dialog, with the following -- implications: -- - Modal : the dialog is modal, see Gtk.Window.Set_Modal -- - Destroy_With_Parent: The dialog is destroyed if its parent is -- destroyed. See Gtk.Window.Set_Destroy_With_Parent -- - No_Separator: No separator bar above the buttons. type Gtk_Response_Type is new Gint; -- Type used for Response_Id's. -- Positive values are totally user-interpreted. -- GtkAda will sometimes return Gtk_Response_None if no Response_Id is -- available. -- -- Typical usage is: -- if Gtk.Dialog.Run (Dialog) = Gtk_Response_Accept then -- blah; -- end if; Gtk_Response_None : constant Gtk_Response_Type := -1; -- GtkAda returns this if a response widget has no Response_Id, -- or if the dialog gets programmatically hidden or destroyed. Gtk_Response_Reject : constant Gtk_Response_Type := -2; Gtk_Response_Accept : constant Gtk_Response_Type := -3; -- GtkAda won't return these unless you pass them in -- as the response for an action widget. They are -- for your convenience. Gtk_Response_Delete_Event : constant Gtk_Response_Type := -4; -- If the dialog is deleted through the button in the titlebar Gtk_Response_OK : constant Gtk_Response_Type := -5; Gtk_Response_Cancel : constant Gtk_Response_Type := -6; Gtk_Response_Close : constant Gtk_Response_Type := -7; Gtk_Response_Yes : constant Gtk_Response_Type := -8; Gtk_Response_No : constant Gtk_Response_Type := -9; Gtk_Response_Apply : constant Gtk_Response_Type := -10; Gtk_Response_Help : constant Gtk_Response_Type := -11; -- These are returned from dialogs, and you can also use them -- yourself if you like. type Response_Type_Array is array (Natural range <>) of Gtk_Response_Type; The Gtk_Curve widget allows the user to edit a curve covering a range of values. It is typically used to fine-tune color balances in graphics applications like the Gimp. The Gtk_Curve widget has 3 modes of operation: spline, linear and free. In spline mode the user places points on the curve which are automatically connected together into a smooth curve. In linear mode the user places points on the curve which are connected by straight lines. In free mode the user can draw the points of the curve freely, and they are not connected at all. Recompute the entire curve using the given gamma value. A gamma value of 1.0 results in a straight line. Values greater than 1.0 result in a curve above the straight line. Values less than 1.0 result in a curve below the straight line. The curve type is changed to Curve_Type_Free. Set the minimum and maximum x & y values of the curve. The curve is also reset with a call to Reset. Set the type of the curve. The curve will remain unchanged except when changing from a free curve to a linear or spline curve, in which case the curve will be changed as little as possible. Reset the curve. Reset to a straight line from the minimum x & y values to the maximum x & y values (i.e. from the bottom-left to the top-right corners). The curve type is not changed. procedure Set_Vector (Curve : access Gtk_Curve_Record; Vector : Gfloat_Array); procedure Get_Vector (Curve : access Gtk_Curve_Record; Vector : out Gfloat_Array); -- Set the vector of points on the curve. -- The curve type is set to Curve_Type_Free. procedure Get_Vector (Curve : access Gtk_Curve_Record; Vector : out Gfloat_Array) is procedure Internal (Curve : System.Address; Veclen : Integer; Vector : System.Address); pragma Import (C, Internal, "gtk_curve_get_vector"); begin Internal (Get_Object (Curve), Vector'Length, Vector'Address); end Get_Vector; procedure Set_Vector (Curve : access Gtk_Curve_Record; Vector : Gfloat_Array) is procedure Internal (Curve : System.Address; Veclen : Integer; Vector : System.Address); pragma Import (C, Internal, "gtk_curve_set_vector"); begin Internal (Get_Object (Curve), Vector'Length, Vector (Vector'First)'Address); end Set_Vector; A container that can hide its child. This widget provides an empty canvas on which the application can draw anything. Note that this widget is simply an empty space, and that you need to connect it to events to make it useful. For instance, you might want to do one of the following : * Connect it to "expose_event": The handlers are called every time the widget needs to be redrawn. You can then draw anything you want on the canvas, after getting its associated window with a call to Gtk.Widget.Get_Window. Note that the event mask is automatically set up to accept expose_events. * Connect it to "button_press_event" and "button_release_event" events, when you want it to react to user input. Note that you need to set up the event mask with a call to Gtk.Widget.Set_Events. See also the Double_Buffer widget provided in the GtkAda examples for an advanced example that demonstrates how to use double buffering, to avoid flickering in your drawings. Request a new size for the area. This queues a resize request for the area. 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. 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 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 deprecated, use the default value. 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. The Gtk_Image widget displays a graphical image. The image is typically created using Gdk.Image.Gdk_New. The pixels in a Gtk_Image may be manipulated by the application after creation, as Gtk_Image store the pixel data on the client side. If you wish to store the pixel data on the server side (thus not allowing manipulation of the data after creation) you should use Gtk_Pixmap. type Gtk_Image_Type is (Image_Empty, Image_Pixmap, Image_Image, Image_Pixbuf, Image_Stock, Image_Icon_Set, Image_Animation, Image_Icon_Name, Image_Gicon); pragma Convention (C, Gtk_Image_Type); function Get (Image : access Gtk_Image_Record; Size : access Gtk.Enums.Gtk_Icon_Size) return String; -- Get the stock_id for the image displayed procedure Get_Icon_Name (Image : access Gtk_Image_Record; Name : out GNAT.Strings.String_Access; Size : out Gtk.Enums.Gtk_Icon_Size); procedure Get_Icon_Name (Image : access Gtk_Image_Record; Name : out GNAT.Strings.String_Access; Size : out Gtk_Icon_Size) is procedure Internal (Image : System.Address; Name : out Interfaces.C.Strings.chars_ptr; Size : out Gtk_Icon_Size); pragma Import (C, Internal, "gtk_image_get_icon_name"); Str : chars_ptr; begin Internal (Get_Object (Image), Str, Size); Name := new String'(Value (Str)); end Get_Icon_Name; function Get (Image : access Gtk_Image_Record; Size : access Gtk.Enums.Gtk_Icon_Size) return String is procedure Internal (Image : System.Address; Stock_Id : out Interfaces.C.Strings.chars_ptr; Size : out Gint); pragma Import (C, Internal, "gtk_image_get_stock"); Stock : Interfaces.C.Strings.chars_ptr; Sze : Gint; begin Internal (Get_Object (Image), Stock, Sze); Size.all := Gtk.Enums.Gtk_Icon_Size'Val (Sze); return Interfaces.C.Strings.Value (Stock); end Get; Gtk_Calendar is a widget that displays a calendar, one month at a time. It can be created with Gtk_New. The month and year currently displayed can be altered with Select_Month. The exact day can be selected from the displayed month using Select_Day. The way in which the calendar itself is displayed can be altered using Display_Options. The selected date can be retrieved from a Gtk_Calendar using Get_Date. If performing many 'mark' operations, the calendar can be frozen to prevent flicker, using Freeze, and 'thawed' again using Thaw. procedure Set_Detail_Func (Calendar : access Gtk_Calendar_Record; Func : Gtk_Calendar_Detail_Func; Data : System.Address; Destroy : G_Destroy_Notify_Address) is procedure Internal (Calendar : System.Address; Func : System.Address; Data : System.Address; Destroy : G_Destroy_Notify_Address); pragma Import (C, Internal, "gtk_calendar_set_detail_func"); D : constant Detail_Func_Data_Access := new Detail_Func_Data'(Func, Data, Destroy); begin Internal (Get_Object (Calendar), Detail_Callback'Address, D.all'Address, Free_Detail_Func_Data'Access); end Set_Detail_Func; type Gtk_Calendar_Display_Options is mod 2 ** 8; Show_Heading : constant Gtk_Calendar_Display_Options := 2 ** 0; -- Specify that the month and year should be displayed. Show_Day_Names : constant Gtk_Calendar_Display_Options := 2 ** 1; -- Specify that three letter day descriptions should be present. No_Month_Change : constant Gtk_Calendar_Display_Options := 2 ** 2; -- Prevent the user from switching months with the calendar. Show_Week_Numbers : constant Gtk_Calendar_Display_Options := 2 ** 3; -- Display each week numbers of the current year, down the left side of -- the calendar. Week_Start_Monday : constant Gtk_Calendar_Display_Options := 2 ** 4; -- Start the calendar week on Monday, instead of the default Sunday. type Gtk_Calendar_Detail_Func is access function (Calendar : access Gtk_Calendar_Record'Class; Year : Guint; Month : Guint; Day : Guint; User_Data : System.Address) return String; -- Return the details for the given day, or the empty string when there -- are no details. type Detail_Func_Data is record Callback : Gtk_Calendar_Detail_Func; User_Data : System.Address; On_Destroy : G_Destroy_Notify_Address; end record; type Detail_Func_Data_Access is access Detail_Func_Data; function Convert is new Ada.Unchecked_Conversion (System.Address, Detail_Func_Data_Access); procedure Free_Detail_Func_Data (Data : System.Address); pragma Convention (C, Free_Detail_Func_Data); function Detail_Callback (Calendar : System.Address; Year, Month, Day : Guint; User_Data : System.Address) return chars_ptr; pragma Convention (C, Detail_Callback); -- Support for GtkCalendarDetailFunc function Detail_Callback (Calendar : System.Address; Year, Month, Day : Guint; User_Data : System.Address) return Interfaces.C.Strings.chars_ptr is Stub : Gtk_Calendar_Record; Cal : constant Gtk_Calendar := Gtk_Calendar (Get_User_Data (Calendar, Stub)); Data : constant Detail_Func_Data_Access := Convert (User_Data); Details : constant String := Data.Callback (Cal, Year, Month, Day, Data.User_Data); begin if Details = "" then return Interfaces.C.Strings.Null_Ptr; else return New_String (Details); end if; end Detail_Callback; procedure Free_Detail_Func_Data (Data : System.Address) is use System; procedure Unchecked_Free is new Ada.Unchecked_Deallocation (Detail_Func_Data, Detail_Func_Data_Access); D : Detail_Func_Data_Access := Convert (Data); begin if D.On_Destroy /= null and then D.User_Data /= Null_Address then D.On_Destroy (D.User_Data); end if; Unchecked_Free (D); end Free_Detail_Func_Data; Gtk_Size_Group provides a mechanism for grouping a number of widgets together so they all request the same amount of space. This is typically useful when you want a column of widgets to have the same size, but you can't use a Gtk_Table widget. Note that size groups only affect the amount of space requested, not the size that the widgets finally receive. If you want the widgets in a Gtk_Size_Group to actually be the same size, you need to pack them in such a way that they get the size they request and not more. For example, if you are packing your widgets into a table, you would not include the Fill flag. type Size_Group_Mode is (None, Horizontal, Vertical, Both); pragma Convention (C, Size_Group_Mode); -- This type indicates how the size of all widgets in the group match: -- - None: The behavior is the same as if there was no size. Each widget -- requests its most appropriate size. -- - Horizontal: All the widgets in the group will have the same width. -- - Vertical: All the widgets in the group will have the same height -- - Both: All the widgets in the group will have exactly the same size. package Size_Group_Mode_Properties is new Glib.Generic_Properties.Generic_Internal_Discrete_Property (Size_Group_Mode); type Property_Size_Group_Mode is new Size_Group_Mode_Properties.Property; A Gtk_Alignment controls the size and alignment of its single child inside the area allocated to the alignment widget. The scale/size settings indicate how much the child will expand to fill the container. The values should be in the range 0.0 (no expansion) to 1.0 (full expansion). Note that the scale only indicates the minimal size for the child, it does not force an absolute size. The alignment settings indicate where in the alignment widget the child should be located. The values are in the range 0.0 (top or left) to 1.0 (bottom or right). These settings are irrelevant if the child is fully expanded. A status bar is a special widget in which you can display messages. This type of widget is generally found at the bottom of application windows, and is used to display help or error messages. This widget works as a stack of messages, ie all older messages are kept when a new one is inserted. It is of course possible to remove the most recent message from the stack. This stack behavior is especially useful when messages can be displayed from several places in your application. Thus, each one subprogram that needs to print a message can simply push it on the stack, and does not need to make sure that the user has had enough time to read the previous message (a timeout can be set to automatically remove the message after a specific delay) Each message is associated with a specific Context_Id. Each of this context can have a special name, and these context can be used to organize the messages into categories (for instance one for help messages and one for error messages). You can then selectively remove the most recent message of each category. type Context_Id is new Guint; type Message_Id is new Guint; type Status_Bar_Msg is record Text : Interfaces.C.Strings.chars_ptr; Context : Context_Id; Message : Message_Id; end record; -- A message from the queue. Each of this message is associated with a -- specific context, and has a specific number. -- <no_doc> function Convert (Msg : Status_Bar_Msg) return System.Address; function Convert (Msg : System.Address) return Status_Bar_Msg; package Messages_List is new Glib.GSlist.Generic_SList (Status_Bar_Msg); -- </no_doc> function Convert (Msg : Status_Bar_Msg) return System.Address is begin return Msg'Address; -- This function is anyway not supposed to be used end Convert; function Convert (Msg : System.Address) return Status_Bar_Msg is type Status_Bar_Msg_Access is access all Status_Bar_Msg; function Internal is new Ada.Unchecked_Conversion (System.Address, Status_Bar_Msg_Access); begin return Internal (Msg).all; end Convert; A Gtk_Table is a container that can contain any number of children. Each of them is attached to a specific row and a specific column in widget. Every row in the table must have the same height, and every column must have the same width if the table was said as Homogeneous. But you can also decide to have an heterogeneous table, where the width and height are set by the children contained in the table. Check out the Gtk_Sheet widget for a different kind of table that can also contain text and images in a more efficient way. Create a new table. The width allocated to the table is divided into Columns columns, which all have the same width if Homogeneous is True. If Homogeneous is False, the width will be calculated with the children contained in the table. Same behavior for the rows. Insert a new widget in the table. All the attachments are relative to the separations between columns and rows (for instance, to insert a widget spanning the first two columns in the table, you should put Left_Attach=0 and Right_Attach=2). Same behavior for the rows. Xoptions and Yoptions indicate the behavior of the child when the table is resized (whether the child can shrink or expand). See the description in Gtk.Box for more information on the possible values. Xpadding and Ypadding are the amount of space left around the child. Insert a new widget in the table, with default values. No padding is put around the child, and the options are set to Expand and Fill. This call is similar to Attach with default values and is only provided for compatibility. Set the spacing in pixels between Column and the next one. Indicate the homogeneous status of the table. If Homogeneous is True, the rows and columns of the table will all be allocated the same width or height. A Gtk_Combo_Box is a widget that allows the user to choose from a list of valid choices. The Gtk_Combo_Box displays the selected choice. When activated, the Gtk_Combo_Box displays a popup which allows the user to make new choice. The style in which the selected value is displayed, and the style of the popup is determined by the current theme. It may be similar to a Gtk_Option_Menu, or similar to a Windows-style combo box. Unlike its predecessors Gtk.Combo.Gtk_Combo and Gtk.Option_Menu.Gtk_Option_Menu, the Gtk_Combo_Box uses the model-view pattern; the list of valid choices is specified in the form of a tree model, and the display of the choices can be adapted to the data in the model by using cell renderers, as you would in a tree view. This is possible since Gtk_Combo_Box implements the Gtk_Cell_Layout interface. The tree model holding the valid choices is not restricted to a flat list, it can be a real tree, and the popup will reflect the tree structure. In addition to the model-view API, Gtk_Combo_Box offers a simple API which is suitable for text-only combo boxes, and hides the complexity of managing the data in a model. function Get_Active_Iter (Combo_Box : access Gtk_Combo_Box_Record) return Gtk.Tree_Model.Gtk_Tree_Iter; function Get_Active_Iter (Combo_Box : access Gtk_Combo_Box_Record) return Gtk_Tree_Iter is function Internal (Combo_Box : System.Address; Iter : System.Address) return Gboolean; pragma Import (C, Internal, "gtk_combo_box_get_active_iter"); Iter : aliased Gtk_Tree_Iter; Tmp : constant Gboolean := Internal (Get_Object (Combo_Box), Iter'Address); begin if Tmp /= 0 then return Iter; else return Null_Iter; end if; end Get_Active_Iter; A Gtk_Check_Button places a discrete Gtk_Toggle_Button next to a widget, (usually a Gtk_Label). Create a check button. if Label is null, then no widget is associated with the button, and any widget can be added to the button (with Gtk.Container.Add). A Gtk_Toggle_Button is like a regular button, but can be in one of two states, "active" or "inactive". Its visual aspect is modified when the state is changed. You should consider using a Gtk_Check_Button instead, since it looks nicer and provides more visual clues that the button can be toggled. Initialize a button. If Label is "", then no label is created inside the button and you will have to provide your own child through a call to Gtk.Container.Add. This is the recommended way to put a pixmap inside a toggle button. Change the state of the button. When Is_Active is True, the button is drawn as a pressed button An accel group represents a group of keyboard accelerators, generally attached to a toplevel window. Accelerators are different from mnemonics. Accelerators are shortcuts for activating a menu item. They appear alongside the menu item they are a shortcut for. Mnemonics are shortcuts for GUI elements, such as buttons. They appear as underline characters. Menu items can have both. Creates a new Gtk.Accel_Group.Gtk_Accel_Group. Remember to call Gtk.Window.Add_Accel_Group to active the group. type Gtk_Accel_Flags is new Guint; Accel_Visible : constant Gtk_Accel_Flags := 2 ** 0; Accel_Locked : constant Gtk_Accel_Flags := 2 ** 1; Accel_Mask : constant Gtk_Accel_Flags := 16#07#; type Gtk_Accel_Key is record Accel_Key : Gdk.Types.Gdk_Key_Type; Accel_Mods : Gdk.Types.Gdk_Modifier_Type; Flags : Gtk_Accel_Flags; end record; pragma Convention (C, Gtk_Accel_Key); type Gtk_Accel_Group_Activate is access function (Accel_Group : access Gtk_Accel_Group_Record'Class; Acceleratable : Glib.Object.GObject; Keyval : Gdk.Types.Gdk_Key_Type; Modifier : Gdk.Types.Gdk_Modifier_Type) return Boolean; type C_Gtk_Accel_Group_Activate is access function (Accel_Group : System.Address; Acceleratable : System.Address; Keyval : Gdk.Types.Gdk_Key_Type; Modifier : Gdk.Types.Gdk_Modifier_Type) return Boolean; pragma Convention (C, C_Gtk_Accel_Group_Activate); -- Same as Gtk_Accel_Group_Activate, but passing directly the C values. -- You must use Get_User_Data to convert to the Ada types. type C_Gtk_Accel_Group_Find_Func is access function (Key : access Gtk_Accel_Key; Closure : C_Gtk_Accel_Group_Activate; Data : System.Address) return Boolean; pragma Convention (C, C_Gtk_Accel_Group_Find_Func); -- When a match is found, must return True. -- Must not modify Key A Gtk_Radio_Button is a simple button that has two states, like a Gtk_Toggle_Button. However, Gtk_Radio_Buttons can be grouped together to get a special behavior: only one button in the group can be active at any given time. Thus, when the user selects one of the buttons from the group, the button that was previously selected is disabled. The radio buttons always belongs to a group, even if there is only one in this group. Creates or initializes a new radio button, belonging to Group. If Label is left as the empty string, then the button will not have any child and you are free to put any thing you want in it, including a pixmap. To initialize the group (when creating the first button), leave Group to the Null_List. You can later get the new group that is created with a call to the Group subprogram below. To initialize a new group (when creating the first button), you should pass it null or a button that has not been created with Gtk_New, as in the example below. A Gtk_Radio_Action is similar to Gtk_Radio_Menu_Item. A number of radio actions can be linked together so that only one may be active at any one time. A common way to set up a group of radio group is the following: %PRE% Group : GSlist := null; Action : Gtk_Radio_Action; while ... loop Gtk_New (Action, ...); Set_Group (Action, Group); Group := Get_Group (Action); end loop; A separator is a vertical or horizontal line that can be displayed between widgets, to provide visual grouping of the widgets into meaningful groups. It is for instance used in dialogs to isolate the actual contents of the dialogs and the various buttons to acknowledge the dialog (OK, Cancel,...) This widget serves as separator between menu items. It is represented graphically as a horizontal line between two items, and is used to group items into meaningful groups. This package defines a separator widget that can be inserted in a toolbar, to create groups of widgets in the latter. This widget is generally put on the sides of a drawing area to help the user measure distances. It indicates the current position of the mouse cursor within the drawing area, and can be graduated in multiple units. Set or get the units used for a Gtk_Ruler. See Set_Metric The Gtk_Fixed widget is a container which can place child widgets at fixed positions and with fixed sizes, given in pixels. Note that it is usually bad practice to use the Gtk_Fixed container in GtkAda. Instead, you should consider using one of the other many containers available, that will allow you to handle resizing of your windows, as well as font size changes easily. Add Widget to a Fixed container at the given position. X indicates the horizontal position to place the widget at. Y is the vertical position to place the widget at. Move a child of a GtkFixed container to the given position. X indicates the horizontal position to place the widget at. Y is the vertical position to place the widget at. The Gtk_Cell_Editable interface must be implemented for widgets to be usable when editing the contents of a Gtk_Tree_View cell Activatable widgets can be connected to a Gtk_Action and reflects the state of its action. A Gtk_Activatable can also provide feedback through its action, as they are responsible for activating their related actions. The Gtk_Orientable interface is implemented by all widgets that can be oriented horizontally or vertically. Historically, such widgets have been realized as subclasses of a common base class (e.g Gtk_Box/Gtk_HBox/Gtk_VBox or Gtk_Scale/Gtk_HScale/Gtk_VScale). Gtk_Orientable is more flexible in that it allows the orientation to be changed at runtime, allowing the widgets to 'flip'. Gtk_Buildable allows objects to extend and customize their deserialization from Gtk_Builder UI descriptions. The interface includes methods for setting names and properties of objects, parsing custom tags and constructing child objects. The Gtk_Buildable interface is implemented by all widgets and many of the non-widget objects that are provided by GTK+. The main user of this interface is Gtk_Builder. There should be very little need for applications to call any gtk_buildable_... functions. This package provides an interface implemented by Gtk.File_Chooser_Widget and Gtk.File_Chooser_Button, and by your own file selection widgets if you wish to expose a standard interface. Gtk_File_Chooser allows for shortcuts to various places in the filesystem. In the default implementation these are displayed in the left pane. It may be a bit confusing at first that these shortcuts come from various sources and in various flavours, so lets explain the terminology here: %PRE% - Bookmarks are created by the user, by dragging folders from the right pane to the left pane, or by using the "Add". Bookmarks can be renamed and deleted by the user. - Shortcuts can be provided by the application or by the underlying filesystem abstraction (e.g. both the gnome-vfs and the Windows filesystems provide "Desktop" shortcuts). Shortcuts cannot be modified by the user. - Volumes are provided by the underlying filesystem abstraction. They are the "roots" of the filesystem. File Names and Encodings When the user is finished selecting files in a Gtk_File_Chooser, your program can get the selected names either as filenames or as URIs. For URIs, the normal escaping rules are applied if the URI contains non-ASCII characters. However, filenames are always returned in the character set specified by the G_FILENAME_ENCODING environment variable. Please see the Glib documentation for more details about this variable. Important: This means that while you can pass the result of Get_Filename to low-level file system primitives , you will need to convert it to UTF-8 before using it in a Gtk_Label for instance. Conversion is done through Glib.Convert.Filename_To_UTF8. You can add a custom preview widget to a file chooser and then get notification about when the preview needs to be updated. To install a preview widget, use gtk_file_chooser_set_preview_widget(). Then, connect to the GtkFileChooser::update-preview signal to get notified when you need to update the contents of the preview. Preview widgets You can add a custom preview widget to a file chooser and then get notification about when the preview needs to be updated. To install a preview widget, use Set_Preview_Widget. Then, connect to the GtkFileChooser::update-preview signal to get notified when you need to update the contents of the preview. Your callback should use Get_Preview_Filename to see what needs previewing. Once you have generated the preview for the corresponding file, you must call Set_Preview_Widget_Active with a boolean flag that indicates whether your callback could successfully generate a preview. Adding Extra Widgets You can add extra widgets to a file chooser to provide options that are not present in the default design. For example, you can add a toggle button to give the user the option to open a file in read-only mode. You can use Set_Extra_Widget to insert additional widgets in a file chooser. If you want to set more than one extra widget in the file chooser, you can a container such as a GtkVBox or a GtkTable and include your widgets in it. Then, set the container as the whole extra widget. Key bindings The following default key bindings are provided, but you can use a gtkrc file to override them if you need (see gtk-rc.ads). %PRE% Signal name | Key binding location-popup | Control-L (empty path) | / (path of "/") | ~ (home directory) up-folder | Alt-Up or backspace down-folder | Alt-Down home-folder | Alt-Home desktop-folder | Alt-D quick-bookmark | Alt-1 through Alt-0 Gtk_Cell_Layout is an interface to be implemented by all objects which want to provide a Gtk_Tree_View_Column like API for packing cells, setting attributes and data funcs. The rendering of the widget is done through various Gtk_Cell_Renderer, and by reading data from a Gtk_Tree_Model. A Gtk_Spinner widget displays an icon-size spinning animation. It is often used as an alternative to a Gtk_Progress for displaying indefinite activity, instead of actual progress. To start the animation, use Gtk.Spinner.Start; to stop it use Gtk.Spinner.Stop. This widget provides completion functionality for Gtk.Gentry.Gtk_Entry. "Completion functionality" means that when the user modifies the text in the entry, GtkEntryCompletion checks which rows in the model match the current content of the entry, and displays a list of matches. By default, the matching is done by comparing the entry text case-insensitively against the text column of the model (see Set_Text_Column), but this can be overridden with a custom match function (see Set_Match_Func). When the user selects a completion, the content of the entry is updated. By default, the content of the entry is replaced by the text column of the model, but this can be overridden by connecting to the ::match-selected signal and updating the entry in the signal handler. Note that you should return TRUE from the signal handler to suppress the default behaviour. To add completion functionality to an entry, use Gtk.Entry.Set_Completion. In addition to regular completion matches, which will be inserted into the entry when they are selected, GtkEntryCompletion also allows to display "actions" in the popup window. Their appearance is similar to menuitems, to differentiate them clearly from completion strings. When an action is selected, the ::action-activated signal is emitted. type C_Gtk_Entry_Completion_Match_Func is access function (Completion : System.Address; Key : Interfaces.C.Strings.chars_ptr; Iter : Gtk.Tree_Model.Gtk_Tree_Iter; Data : System.Address) return Boolean; pragma Convention (C, C_Gtk_Entry_Completion_Match_Func); generic type Data_Type (<>) is private; package Match_Functions is type Gtk_Entry_Completion_Match_Func is access function (Completion : access Gtk_Entry_Completion_Record'Class; Key : String; Iter : Gtk.Tree_Model.Gtk_Tree_Iter; User_Data : Data_Type) return Boolean; type Destroy_Notify is access procedure (Data : in out Data_Type); procedure Set_Match_Func (Completion : access Gtk_Entry_Completion_Record; Func : Gtk_Entry_Completion_Match_Func; Func_Data : Data_Type; Func_Notify : Destroy_Notify); -- Sets the match function for completion to be Func. The match function -- is used to determine if a row should or should not be in the -- completion list. end Match_Functions; package body Match_Functions is function Internal_Completion_Func (Completion : System.Address; Key : Interfaces.C.Strings.chars_ptr; Iter : Gtk_Tree_Iter; Data : System.Address) return Gboolean; pragma Convention (C, Internal_Completion_Func); -- Internal callback procedure Internal_Notify (Data : System.Address); pragma Convention (C, Internal_Notify); -- Internal notification function type Data_Type_Access is access Data_Type; type Completion_User_Data_Record is record Callback : Gtk_Entry_Completion_Match_Func; User_Data : Data_Type_Access; Notify : Destroy_Notify; end record; type Completion_User_Data is access Completion_User_Data_Record; procedure Unchecked_Free is new Ada.Unchecked_Deallocation (Completion_User_Data_Record, Completion_User_Data); procedure Unchecked_Free is new Ada.Unchecked_Deallocation (Data_Type, Data_Type_Access); function Convert is new Ada.Unchecked_Conversion (System.Address, Completion_User_Data); ------------------------------ -- Internal_Completion_Func -- ------------------------------ function Internal_Completion_Func (Completion : System.Address; Key : Interfaces.C.Strings.chars_ptr; Iter : Gtk_Tree_Iter; Data : System.Address) return Gboolean is D : constant Completion_User_Data := Convert (Data); Stub : Gtk_Entry_Completion_Record; Complete : Gtk_Entry_Completion; begin Complete := Gtk_Entry_Completion (Get_User_Data (Completion, Stub)); return Boolean'Pos (D.Callback (Complete, Value (Key), Iter, D.User_Data.all)); end Internal_Completion_Func; --------------------- -- Internal_Notify -- --------------------- procedure Internal_Notify (Data : System.Address) is D : Completion_User_Data := Convert (Data); begin D.Notify (D.User_Data.all); Unchecked_Free (D.User_Data); Unchecked_Free (D); end Internal_Notify; -------------------- -- Set_Match_Func -- -------------------- procedure Set_Match_Func (Completion : access Gtk_Entry_Completion_Record; Func : Gtk_Entry_Completion_Match_Func; Func_Data : Data_Type; Func_Notify : Destroy_Notify) is procedure Internal (Completion : System.Address; Func : System.Address; Func_Data : Completion_User_Data; Func_Notify : System.Address); pragma Import (C, Internal, "gtk_entry_completion_set_match_func"); Data : constant Completion_User_Data := new Completion_User_Data_Record' (Callback => Func, User_Data => new Data_Type'(Func_Data), Notify => Func_Notify); begin Internal (Get_Object (Completion), Internal_Completion_Func'Address, Data, Internal_Notify'Address); end Set_Match_Func; end Match_Functions;