This is gtkada_rm.info, produced by makeinfo version 4.5 from gtkada_rm.texi. INFO-DIR-SECTION User Interface Toolkit START-INFO-DIR-ENTRY * GtkAda_Rm: (gtkada_rm). Ada95 graphical tookit based on GTK+ (Reference Manual) END-INFO-DIR-ENTRY  File: gtkada_rm.info, Node: Gtk.Text_View Subprograms, Prev: Gtk.Text_View Signals, Up: Package_Gtk.Text_View Subprograms =========== procedure Gtk_New (Widget : out Gtk_Text_View; Buffer : Gtk.Text_Buffer.Gtk_Text_Buffer := null); Create a new Gtk_Text_View. If Buffer is null, an empty default buffer will be created for you. Get the buffer with Get_Buffer. Otherwise, create a new text view widget displaying Buffer. One buffer can be shared among many widgets. The text view adds its own reference count to the buffer; it does not take over an existing reference. function Get_Type return Glib.GType; Return the internal value associated with this widget. procedure Set_Buffer (Text_View : access Gtk_Text_View_Record; Buffer : access Gtk.Text_Buffer.Gtk_Text_Buffer_Record'Class); Set Buffer as the buffer being displayed by Text_View. The previous buffer displayed by the text view is unreferenced, and a reference is added to Buffer. If you owned a reference to Buffer before passing it to this function, you must remove that reference yourself; Gtk_Text_View will not "adopt" it. function Get_Buffer (Text_View : access Gtk_Text_View_Record) return Gtk.Text_Buffer.Gtk_Text_Buffer; Return the Gtk_Text_Buffer being displayed by this text view. The reference count on the buffer is not incremented; the caller of this function won't own a new reference. function Scroll_To_Iter (Text_View : access Gtk_Text_View_Record; Iter : Gtk.Text_Iter.Gtk_Text_Iter; Within_Margin : Gdouble; Use_Align : Boolean; Xalign : Gdouble; Yalign : Gdouble) return Boolean; Scroll Text_View so that Iter is on the screen in the position indicated by Xalign and Yalign. An alignment of 0.0 indicates left or top, 1.0 indicates right or bottom, 0.5 means center. If Use_Align is False, the text scrolls the minimal distance to get the mark onscreen, possibly not scrolling at all. The effective screen for purposes of this function is reduced by a margin of size Within_Margin. Note: This function uses the currently-computed height of the lines in the text buffer. Note that line heights are computed in an idle handler; so this function may not have the desired effect if it's called before the height computations. To avoid oddness, consider using Scroll_To_Mark which saves a point to be scrolled to after line validation. procedure Scroll_To_Mark (Text_View : access Gtk_Text_View_Record; Mark : access Gtk.Text_Mark.Gtk_Text_Mark_Record'Class; Within_Margin : Gdouble := 0.0; Use_Align : Boolean := False; Xalign : Gdouble := 0.0; Yalign : Gdouble := 0.0); Scroll Text_View so that Mark is on the screen in the position indicated by Xalign and Yalign. An alignment of 0.0 indicates left or top, 1.0 indicates right or bottom, 0.5 means center. If Use_Align is False, the text scrolls the minimal distance to get the mark onscreen, possibly not scrolling at all. The effective screen for purposes of this function is reduced by a margin of size Within_Margin. procedure Scroll_Mark_Onscreen (Text_View : access Gtk_Text_View_Record; Mark : access Gtk.Text_Mark.Gtk_Text_Mark_Record'Class); Same as the above with the default values function Move_Mark_Onscreen (Text_View : access Gtk_Text_View_Record; Mark : access Gtk.Text_Mark.Gtk_Text_Mark_Record'Class) return Boolean; Move a mark within the buffer so that it's located within the currently-visible text area. Return value: True if the mark moved (wasn't already onscreen). function Place_Cursor_Onscreen (Text_View : access Gtk_Text_View_Record) return Boolean; Move the cursor to the currently visible region of the buffer, if it isn't there already. Return value: True if the cursor had to be moved. procedure Get_Visible_Rect (Text_View : access Gtk_Text_View_Record; Visible_Rect : out Gdk.Rectangle.Gdk_Rectangle); Fill Visible_Rect with the currently-visible region of the buffer, in buffer coordinates. Convert to window coordinates with Buffer_To_Window_Coords. procedure Set_Cursor_Visible (Text_View : access Gtk_Text_View_Record; Setting : Boolean := True); Toggle whether the insertion point is displayed. A buffer with no editable text probably shouldn't have a visible cursor, so you may want to turn the cursor off. function Get_Cursor_Visible (Text_View : access Gtk_Text_View_Record) return Boolean; Whether the cursor is being displayed. procedure Get_Iter_Location (Text_View : access Gtk_Text_View_Record; Iter : Gtk.Text_Iter.Gtk_Text_Iter; Location : out Gdk.Rectangle.Gdk_Rectangle); Get a rectangle which roughly contains the character at iter. The rectangle position is in buffer coordinates; use Buffer_To_Window_Coords to convert these coordinates to coordinates for one of the windows in the text view. procedure Get_Iter_At_Location (Text_View : access Gtk_Text_View_Record; Iter : out Gtk.Text_Iter.Gtk_Text_Iter; X : Gint; Y : Gint); Retrieve the iterator at buffer coordinates X and Y. Buffer coordinates are coordinates for the entire buffer, not just the currently-displayed portion. If you have coordinates from an event, you have to convert those to buffer coordinates with Window_To_Buffer_Coords. procedure Get_Line_Yrange (Text_View : access Gtk_Text_View_Record; Iter : Gtk.Text_Iter.Gtk_Text_Iter; Y : out Gint; Height : out Gint); Get the Y coordinate of the top of the line containing Iter, and the Height of the line. The coordinate is a buffer coordinate; convert to window coordinates with Buffer_To_Window_Coords. procedure Get_Line_At_Y (Text_View : access Gtk_Text_View_Record; Target_Iter : out Gtk.Text_Iter.Gtk_Text_Iter; Y : Gint; Line_Top : out Gint); Get the Gtk_Text_Iter at the start of the line containing the coordinate Y. Y is in buffer coordinates, convert from window coordinates with Window_To_Buffer_Coords. Line_Top will be filled with the coordinate of the top edge of the line. procedure Buffer_To_Window_Coords (Text_View : access Gtk_Text_View_Record; Win : Gtk.Enums.Gtk_Text_Window_Type; Buffer_X : Gint; Buffer_Y : Gint; Window_X : out Gint; Window_Y : out Gint); Convert coordinate (Buffer_X, Buffer_Y) to coordinates for the window Win, and store the result in (Window_X, Window_Y). procedure Window_To_Buffer_Coords (Text_View : access Gtk_Text_View_Record; Win : Gtk.Enums.Gtk_Text_Window_Type; Window_X : Gint; Window_Y : Gint; Buffer_X : out Gint; Buffer_Y : out Gint); Convert coordinates on the window identified by Win to buffer coordinates, storing the result in (Buffer_X, Buffer_Y). function Get_Window (Text_View : access Gtk_Text_View_Record; Win : Gtk.Enums.Gtk_Text_Window_Type) return Gdk.Window.Gdk_Window; Retrieve the Gdk_Window corresponding to an area of the text view; possible windows include the overall widget window, child windows on the left, right, top, bottom, and the window that displays the text buffer. Windows are null and nonexistent if their width or height is 0, and are nonexistent before the widget has been realized. function Get_Window_Type (Text_View : access Gtk_Text_View_Record; Window : Gdk.Window.Gdk_Window) return Gtk.Enums.Gtk_Text_Window_Type; Usually used to find out which window an event corresponds to. If you connect to an event signal on Text_View, this function should be called on Get_Window (Event) to see which window it was. procedure Set_Border_Window_Size (Text_View : access Gtk_Text_View_Record; The_Type : Gtk.Enums.Gtk_Text_Window_Type; Size : Gint); Set the width of Text_Window_Left or Text_Window_Right, or the height of Text_Window_Top or Text_Window_Bottom. Automatically destroy the corresponding window if the size is set to 0, and create the window if the size is set to non-zero. procedure Forward_Display_Line (Text_View : access Gtk_Text_View_Record; Iter : in out Gtk.Text_Iter.Gtk_Text_Iter; Result : out Boolean); ??? procedure Backward_Display_Line (Text_View : access Gtk_Text_View_Record; Iter : in out Gtk.Text_Iter.Gtk_Text_Iter; Result : out Boolean); ??? procedure Forward_Display_Line_End (Text_View : access Gtk_Text_View_Record; Iter : in out Gtk.Text_Iter.Gtk_Text_Iter; Result : out Boolean); ??? procedure Backward_Display_Line_Start (Text_View : access Gtk_Text_View_Record; Iter : in out Gtk.Text_Iter.Gtk_Text_Iter; Result : out Boolean); ??? function Starts_Display_Line (Text_View : access Gtk_Text_View_Record; Iter : Gtk.Text_Iter.Gtk_Text_Iter) return Boolean; ??? procedure Move_Visually (Text_View : access Gtk_Text_View_Record; Iter : in out Gtk.Text_Iter.Gtk_Text_Iter; Count : Gint; Result : out Boolean); ??? procedure Add_Child_At_Anchor (Text_View : access Gtk_Text_View_Record; Child : access Gtk.Widget.Gtk_Widget_Record'Class; Anchor : access Gtk.Text_Child.Gtk_Text_Child_Anchor_Record'Class); ??? procedure Add_Child_In_Window (Text_View : access Gtk_Text_View_Record; Child : access Gtk.Widget.Gtk_Widget_Record'Class; Which_Window : Gtk.Enums.Gtk_Text_Window_Type; Xpos : Gint; Ypos : Gint); ??? procedure Move_Child (Text_View : access Gtk_Text_View_Record; Child : access Gtk.Widget.Gtk_Widget_Record'Class; Xpos : Gint; Ypos : Gint); ??? procedure Set_Wrap_Mode (Text_View : access Gtk_Text_View_Record; Wrap_Mode : Gtk.Enums.Gtk_Wrap_Mode); Set the line wrapping for the view. function Get_Wrap_Mode (Text_View : access Gtk_Text_View_Record) return Gtk.Enums.Gtk_Wrap_Mode; Get the line wrapping for the view. procedure Set_Editable (Text_View : access Gtk_Text_View_Record; Setting : Boolean := True); Set the default editability of the Gtk_Text_View. You can override this default setting with tags in the buffer, using the "editable" attribute of tags. function Get_Editable (Text_View : access Gtk_Text_View_Record) return Boolean; Return the default editability of the Gtk_Text_View. Tags in the buffer may override this setting for some ranges of text. procedure Set_Pixels_Above_Lines (Text_View : access Gtk_Text_View_Record; Pixels_Above_Lines : Gint); ??? function Get_Pixels_Above_Lines (Text_View : access Gtk_Text_View_Record) return Gint; ??? procedure Set_Pixels_Below_Lines (Text_View : access Gtk_Text_View_Record; Pixels_Below_Lines : Gint); ??? function Get_Pixels_Below_Lines (Text_View : access Gtk_Text_View_Record) return Gint; ??? procedure Set_Pixels_Inside_Wrap (Text_View : access Gtk_Text_View_Record; Pixels_Inside_Wrap : Gint); ??? function Get_Pixels_Inside_Wrap (Text_View : access Gtk_Text_View_Record) return Gint; ??? procedure Set_Justification (Text_View : access Gtk_Text_View_Record; Justification : Gtk.Enums.Gtk_Justification); ??? function Get_Justification (Text_View : access Gtk_Text_View_Record) return Gtk.Enums.Gtk_Justification; ??? procedure Set_Left_Margin (Text_View : access Gtk_Text_View_Record; Left_Margin : Gint); ??? function Get_Left_Margin (Text_View : access Gtk_Text_View_Record) return Gint; ??? procedure Set_Right_Margin (Text_View : access Gtk_Text_View_Record; Right_Margin : Gint); ??? function Get_Right_Margin (Text_View : access Gtk_Text_View_Record) return Gint; ??? procedure Set_Indent (Text_View : access Gtk_Text_View_Record; Indent : Gint); ??? function Get_Indent (Text_View : access Gtk_Text_View_Record) return Gint; ???  File: gtkada_rm.info, Node: Package_Gtk.Toggle_Button, Next: Package_Gtk.Toolbar, Prev: Package_Gtk.Text_View, Up: Top Package Gtk.Toggle`_'Button *************************** 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. * Menu: * Gtk.Toggle_Button Widget Hierarchy:: * Gtk.Toggle_Button Signals:: * Gtk.Toggle_Button Subprograms:: * Gtk.Toggle_Button Example::  File: gtkada_rm.info, Node: Gtk.Toggle_Button Widget Hierarchy, Next: Gtk.Toggle_Button Signals, Up: Package_Gtk.Toggle_Button Widget Hierarchy ================ GObject (*note Package_Glib.Object::) Gtk_Object (*note Package_Gtk.Object::) \___ Gtk_Widget (*note Package_Gtk.Widget::) \___ Gtk_Container (*note Package_Gtk.Container::) \___ Gtk_Bin (*note Package_Gtk.Bin::) \___ Gtk_Button (*note Package_Gtk.Button::) \___ Gtk_Toggle_Button (*note Package_Gtk.Toggle_Button::)  File: gtkada_rm.info, Node: Gtk.Toggle_Button Signals, Next: Gtk.Toggle_Button Subprograms, Prev: Gtk.Toggle_Button Widget Hierarchy, Up: Package_Gtk.Toggle_Button Signals ======= * "toggled" procedure Handler (Toggle : access Gtk_Toggle_Button_Record'Class); This signal is emitted every time the state of the button is modified.  File: gtkada_rm.info, Node: Gtk.Toggle_Button Subprograms, Next: Gtk.Toggle_Button Example, Prev: Gtk.Toggle_Button Signals, Up: Package_Gtk.Toggle_Button Subprograms =========== procedure Gtk_New (Toggle_Button : out Gtk_Toggle_Button; Label : UTF8_String := ""); 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. procedure Gtk_New_With_Mnemonic (Toggle_Button : out Gtk_Toggle_Button; Label : UTF8_String); Create a Gtk_Toggle_Button containing Label. The Label will be created using Gtk.Label.Gtk_New_With_Mnemonic, so underscores in Label indicate the mnemonic for the button. procedure Initialize_With_Mnemonic (Toggle_Button : access Gtk_Toggle_Button_Record'Class; Label : UTF8_String); Internal initialization function. function Get_Type return Glib.GType; Return the internal value associated with a Gtk_Toggle_Button. procedure Set_Mode (Toggle_Button : access Gtk_Toggle_Button_Record; Draw_Indicator : Boolean); Change the mode of the button. If Draw_Indicator is False, then the button is hidden. function Get_Mode (Toggle_Button : access Gtk_Toggle_Button_Record) return Boolean; Return the mode of the button. procedure Set_Active (Toggle_Button : access Gtk_Toggle_Button_Record; Is_Active : Boolean); Change the state of the button. When Is_Active is True, the button is drawn as a pressed button. function Get_Active (Toggle_Button : access Gtk_Toggle_Button_Record) return Boolean; Return true if the button is in its active state, i.e is pressed. procedure Set_Inconsistent (Toggle_Button : access Gtk_Toggle_Button_Record; Setting : Boolean := True); If the user has selected a range of elements (such as some text or spreadsheet cells) that are affected by a toggle button, and the current values in that range are inconsistent, you may want to display the toggle in an "in between" state. This function turns on "in between" display. Normally you would turn off the inconsistent state again if the user toggles the toggle button. This has to be done manually, Set_Inconsistent only affects visual appearance, it doesn't affect the semantics of the button. function Get_Inconsistent (Toggle_Button : access Gtk_Toggle_Button_Record) return Boolean; Get the value set by Set_Inconsistent. Signals emission ---------------- procedure Toggled (Toggle_Button : access Gtk_Toggle_Button_Record); Emit the toggled signal on this widget. Note that the state of the button is not changed, only the callbacks are called.  File: gtkada_rm.info, Node: Gtk.Toggle_Button Example, Prev: Gtk.Toggle_Button Subprograms, Up: Package_Gtk.Toggle_Button Example ======= -- This example creates a toggle button with a pixmap in it with Gtk.Toggle_Button, Gdk.Pixmap, Gdk.Bitmap, Gtk.Pixmap; with Gtk.Style, Gtk.Enums; procedure Toggle is Toggle : Gtk.Toggle_Button.Gtk_Toggle_Button; Style : Gtk.Style.Gtk_Style; Pixmap : Gdk.Pixmap.Gdk_Pixmap; Mask : Gdk.Bitmap.Gdk_Bitmap; PixmapWid : Gtk.Pixmap.Gtk_Pixmap; begin -- Do not specify a label Gtk.Toggle_Button.Gtk_New (Toggle); Style := Gtk.Toggle_Button.Get_Style (Toggle); Gdk.Pixmap.Create_From_Xpm (Pixmap, Gtk.Toggle_Button.Get_Window (Toggle), Mask, Gtk.Style.Get_Bg (Style, Gtk.Enums.State_Normal), "icon.xpm"); Gtk.Pixmap.Gtk_New (PixmapWid, Pixmap, Mask); -- Add the pixmap to the button Gtk.Toggle_Button.Add (Toggle, PixmapWid); end Toggle;  File: gtkada_rm.info, Node: Package_Gtk.Toolbar, Next: Package_Gtk.Tooltips, Prev: Package_Gtk.Toggle_Button, Up: Top Package Gtk.Toolbar *******************  File: gtkada_rm.info, Node: Package_Gtk.Tooltips, Next: Package_Gtk.Tree_Model, Prev: Package_Gtk.Toolbar, Up: Top Package Gtk.Tooltips ******************** Tooltips are the small text windows that popup when the mouse rests over a widget, and that provide a quick help for the user. In GtkAda, all tooltips belong to a group (a Gtk_Tooltips). All the individual tooltips in a group can be disabled or enabled at the same time. Likewise, the colors and style of a tooltip can be set on a group basis. See the example at the end for how to change the default colors used for tooltips. * Menu: * Gtk.Tooltips Widget Hierarchy:: * Gtk.Tooltips Subprograms:: * Gtk.Tooltips Example::  File: gtkada_rm.info, Node: Gtk.Tooltips Widget Hierarchy, Next: Gtk.Tooltips Subprograms, Up: Package_Gtk.Tooltips Widget Hierarchy ================ GObject (*note Package_Glib.Object::) Gtk_Object (*note Package_Gtk.Object::) \___ Gtk_Tooltips (*note Package_Gtk.Tooltips::)  File: gtkada_rm.info, Node: Gtk.Tooltips Subprograms, Next: Gtk.Tooltips Example, Prev: Gtk.Tooltips Widget Hierarchy, Up: Package_Gtk.Tooltips Subprograms =========== procedure Gtk_New (Widget : out Gtk_Tooltips); Create a new group of tooltips. function Get_Type return Glib.GType; Return the internal value associated with a Gtk_Tooltips. procedure Enable (Tooltips : access Gtk_Tooltips_Record); Enable all the tooltips in the group. From now on, when the mouse rests over a widget for a short period of time, the help text is automatically displayed. procedure Disable (Tooltips : access Gtk_Tooltips_Record); Disable all the tooptips in the group. From now on, no tooltips in this group will appear, unless they are re-enabled. procedure Set_Tip (Tooltips : access Gtk_Tooltips_Record; Widget : access Gtk.Widget.Gtk_Widget_Record'Class; Tip_Text : UTF8_String; Tip_Private : UTF8_String := ""); Add a new tooltip to Widget. The message that appears in the tooltip is Tip_Text, and the tooltip belongs to the group Tooltips. Tip_Private contains more information, that can be displayed by a Gtk_Tips_Query widget through the "widget_selected" signal. In most cases, Tip_Private should simply keep its default empty value. function Get_Data (Widget : access Gtk.Widget.Gtk_Widget_Record'Class) return Tooltips_Data; Return the tooltip data associated with the Widget. If there is none, the two text fields in the returned structure have a length 0. procedure Force_Window (Widget : access Gtk_Tooltips_Record); Make sure the window in which the tooltips will be displayed is created. This is useful if you want to modify some characteristics of that window.  File: gtkada_rm.info, Node: Gtk.Tooltips Example, Prev: Gtk.Tooltips Subprograms, Up: Package_Gtk.Tooltips Example ======= -- This example demonstrates how you can change the color scheme used -- for tooltips. -- This is of course done through styles. However, you can not directly -- associate a Gtk_Tooltips with a style, so you have to do the following. -- Note also that this choice should probably left to the user, who can -- modify it through a RC file that contains the following: -- style "postie" -- { -- bg[NORMAL]={1.0, 0.93, 0.22} -- } -- widget "gtk-tooltips*" style "postie" with Gtk.Tooltips, Gtk.Style, Gtk.Enums, Gtk.Widget, Gdk.Color; use Gtk.Tooltips, Gtk.Style, Gtk.Enums, Gtk.Widget, Gdk.Color; procedure Tooltips is Style : Gtk_Style; Tips : Gtk_Tooltips; Color : Gdk_Color; begin Gtk_New (Style); -- blue foreground Set_Rgb (Color, 255, 255, 65535); Alloc (Get_Default_Colormap, Color); Set_Foreground (Style, State_Normal, Color); -- green background Set_Rgb (Color, 255, 65535, 255); Alloc (Get_Default_Colormap, Color); Set_Background (Style, State_Normal, Color); Gtk_New (Tips); Force_Window (Tips); end Tooltips;  File: gtkada_rm.info, Node: Package_Gtk.Tree_Model, Next: Package_Gtk.Tree_Store, Prev: Package_Gtk.Tooltips, Up: Top Package Gtk.Tree`_'Model ************************ The type Gtk_Tree_Model defined in this model defines an abstract interface to represent sets of data that will be displayed in a Gtk_Tree_View. Various default implementations are provided in the Gtk.Tree_Store and Gtk.List_Store packages. Data are considered as being organized into a tree-like structure. This package also defines a number of other types to manipulate these models: A Gtk_Tree_Path is a textual pointer to a specific row/node in the model. It is a column separate list of numbers, that indicate the index of the child they point to. For instance, "10:4:0" would points to the first (0) child of the fifth (4) child of the eleventh child of the root. The depth of this path is 3. A Gtk_Tree_Iter is similar to a path, but is a direct pointer to the actual data. It is also more efficient to use than paths. A Gtk_Row_Reference is an object that tracks model changes, so that it always refere to the same row. A Gtk_Tree_Path refers to a position in the model, not a fixed row. * Menu: * Gtk.Tree_Model Widget Hierarchy:: * Gtk.Tree_Model Signals:: * Gtk.Tree_Model Types:: * Gtk.Tree_Model Subprograms::  File: gtkada_rm.info, Node: Gtk.Tree_Model Widget Hierarchy, Next: Gtk.Tree_Model Signals, Up: Package_Gtk.Tree_Model Widget Hierarchy ================ GObject (*note Package_Glib.Object::) Gtk_Object (*note Package_Gtk.Object::) \___ Gtk_Tree_Model (*note Package_Gtk.Tree_Model::)  File: gtkada_rm.info, Node: Gtk.Tree_Model Signals, Next: Gtk.Tree_Model Types, Prev: Gtk.Tree_Model Widget Hierarchy, Up: Package_Gtk.Tree_Model Signals ======= * "row_changed" procedure Handler (Tree_Model : access Gtk_Tree_Model_Record'Class; Path : Gtk_Tree_Path; Iter : Gtk_Tree_Iter); This signal should be emitted every time the contents of a row (any column) has changed. This forces the tree_view to refresh the display. * "row_deleted" procedure Handler (Tree_Model : access Gtk_Tree_Model_Record'Class; Path : Gtk_Tree_Path); This should be emitted by models after the child state of a node changes. * "row_has_child_toggled" procedure Handler (Tree_Model : access Gtk_Tree_Model_Record'Class; Path : Gtk_Tree_Path; Iter : Gtk_Tree_Iter); This should be emitted by models after the child state of a node changes. * "row_inserted" procedure Handler (Tree_Model : access Gtk_Tree_Model_Record'Class; Path : Gtk_Tree_Path; Iter : Gtk_Tree_Iter); This signal should be emitted every time a new row has been inserted. * "rows_reordered" procedure Handler (Tree_Model : access Gtk_Tree_Model_Record'Class; Path : Gtk_Tree_Path; Iter : Gtk_Tree_Iter; New_Order : Gint_Array); This should be emitted when the rows have been reordered  File: gtkada_rm.info, Node: Gtk.Tree_Model Types, Next: Gtk.Tree_Model Subprograms, Prev: Gtk.Tree_Model Signals, Up: Package_Gtk.Tree_Model Types ===== type Gtk_Tree_Iter is private; type Gtk_Tree_Path is new Glib.C_Proxy; type Gtk_Tree_Row_Reference is new Glib.C_Proxy; type Tree_Model_Flags is mod 2 ** 32;  File: gtkada_rm.info, Node: Gtk.Tree_Model Subprograms, Prev: Gtk.Tree_Model Types, Up: Package_Gtk.Tree_Model Subprograms =========== Tree models ----------- function Get_Type return Glib.GType; Return the internal value associated with a Gtk_Tree_Model. function Get_Flags (Model : access Gtk_Tree_Model_Record) return Tree_Model_Flags; Return a set of flags supported by this interface. The flags supported should not change during the lifecycle of the tree_model. The flags should not change in the lifetime of the model. function Get_N_Columns (Tree_Model : access Gtk_Tree_Model_Record) return Gint; Return the number of columns supported by Tree_Model. function Get_Column_Type (Tree_Model : access Gtk_Tree_Model_Record; Index : Gint) return GType; Return the type of the Index-th column in the model. Paths manipulation ------------------ function Gtk_New (Path : String := "") return Gtk_Tree_Path; Create a new Gtk_Tree_Path from a path string. Path should have the format described above, like "10:4:0". If it is the empty string, then a Gtk_Tree_Path of depth 0 is returned. The memory allocated for the path must be freed explicitely by calling Path_Free below. function To_String (Path : Gtk_Tree_Path) return String; Generate a string representation of the path. This string is a colon-separated list of numbers, as described above. procedure Append_Index (Path : Gtk_Tree_Path; Index : Gint); Append a new index to a path. As a result, the depth of the path is increased. See Path_Up for the opposite operation. procedure Prepend_Index (Path : Gtk_Tree_Path; Index : Gint); Prepend a new index to a path. As a result, the depth of the path is increased. function Get_Depth (Path : Gtk_Tree_Path) return Gint; Return the current depth of Path. function Get_Indices (Path : Gtk_Tree_Path) return Glib.Gint_Array; Return the list of indices from the path. This is an array of integers, each representing a node in a tree, as described in the path format. procedure Path_Free (Path : Gtk_Tree_Path); Free the memory allocated for Path. function Copy (Path : Gtk_Tree_Path) return Gtk_Tree_Path; Create a new Gtk_Tree_Path as a copy of Path. The memory allocated for the new path must be freed by a call to Path_Free. function Compare (A, B : Gtk_Tree_Path) return Gint; Compare two paths. If A appears before B in a tree, then -1 is returned. If B appears before A, then 1 is returned. If the two nodes are equal, then 0 is returned. procedure Next (Path : Gtk_Tree_Path); Move the Path to point to the next node at the current depth. In effect, it increments the last indice of the path. Note that the path might become invalid if there is no more node at this depth. function Prev (Path : Gtk_Tree_Path) return Boolean; Move Path to point to the previous node at the current depth, if it exists. Return True if Path has a previous node, and the move was made. If it returns False, then Path has not been changed. function Up (Path : Gtk_Tree_Path) return Boolean; Moves the Path to point to it's parent node, if it has a parent. Return True if Path has a parent, and the move was made. In practive, the depth of Path is decreased by 1. procedure Down (Path : Gtk_Tree_Path); Moves Path to point to the first child of the current path. function Is_Ancestor (Path, Descendant : Gtk_Tree_Path) return Boolean; Return True if Descendant is contained inside Path. function Is_Descendant (Path, Ancestor : Gtk_Tree_Path) return Boolean; Return True if Path is contained inside Ancestor. Row_Reference manipulation -------------------------- function Gtk_New (Model : access Gtk_Tree_Model_Record; Path : Gtk_Tree_Path) return Gtk_Tree_Row_Reference; Create a row reference based on Path. This reference will keep pointing to the node pointed to by Path, so long as it exists. It listens to all signals on model, and updates it's path appropriately. If Path isn't a valid path in Model, then null is returned. function Get_Path (Reference : Gtk_Tree_Row_Reference) return Gtk_Tree_Path; Return the path that Reference currently points to. null is returned if Reference is no longer valid. function Valid (Reference : Gtk_Tree_Row_Reference) return Boolean; Return True if Reference is non null and is still valid. procedure Row_Reference_Free (Reference : Gtk_Tree_Row_Reference); Free the memory occupied by Reference. Iterators --------- ??? Need to be able to access the user_data fields, so that new models can define their own iterators procedure Iter_Copy (Source : Gtk_Tree_Iter; Dest : out Gtk_Tree_Iter); Create a copy of Source. procedure Set_Tree_Iter (Val : in out Glib.Values.GValue; Iter : Gtk_Tree_Iter); Set the value of the given GValue to Iter. Note that Iter is stored by reference, which means no copy of Iter is made. Iter should remain allocated as long as Val is being used. procedure Get_Tree_Iter (Val : Glib.Values.GValue; Iter : out Gtk_Tree_Iter); Extract the iterator from the given GValue. Note that the iterator returned is a copy of the iterator referenced by the give GValue. Modifying the iterator returned does not modify the iterator referenced by the GValue. function Get_Iter (Tree_Model : access Gtk_Tree_Model_Record; Path : Gtk_Tree_Path) return Gtk_Tree_Iter; Return an iterator pointing to Path. Null_Iter is returned if Path was invalid or no iterator could be set. function Get_Iter_From_String (Tree_Model : access Gtk_Tree_Model_Record; Path_String : String) return Gtk_Tree_Iter; Return an iterator pointing to Path_String. Null_Iter is returned if Path was invalid or no iterator could be set. function Get_Iter_First (Tree_Model : access Gtk_Tree_Model_Record) return Gtk_Tree_Iter; Return an iterator pointing to the root of Tree_Model. Null_Iter is returned if Tree_Model is empty. function Get_Path (Tree_Model : access Gtk_Tree_Model_Record; Iter : Gtk_Tree_Iter) return Gtk_Tree_Path; Return a newly created Gtk_Tree_Path referenced by Iter. This path must be freed with Path_Free. procedure Next (Tree_Model : access Gtk_Tree_Model_Record; Iter : in out Gtk_Tree_Iter); Sets Iter to point to the node following it at the current level. If there is none, Iter is set to Null_Iter. function Children (Tree_Model : access Gtk_Tree_Model_Record; Parent : Gtk_Tree_Iter) return Gtk_Tree_Iter; Return the first child of Parent. If Parent has no children, return Null_Iter. Parent will remain a valid node after this function has been called. function Has_Child (Tree_Model : access Gtk_Tree_Model_Record; Iter : Gtk_Tree_Iter) return Boolean; Return True if Iter has children, False otherwise. function N_Children (Tree_Model : access Gtk_Tree_Model_Record; Iter : Gtk_Tree_Iter := Null_Iter) return Gint; Return the number of children that Iter has. As a special case, if Iter is Null_Iter, then the number of toplevel nodes is returned. function Nth_Child (Tree_Model : access Gtk_Tree_Model_Record; Parent : Gtk_Tree_Iter; N : Gint) return Gtk_Tree_Iter; Return the child of Parent, using the given index. The First index is 0. If Index is too big, or Parent has no children, return Null_Iter. If Parent is Null_Iter, then the nth root node is set. function Parent (Tree_Model : access Gtk_Tree_Model_Record; Child : Gtk_Tree_Iter) return Gtk_Tree_Iter; Return the parent of Child. If Child is at the toplevel, and doesn't have a parent, then Null_Iter is returned. procedure Ref_Node (Tree_Model : access Gtk_Tree_Model_Record; Iter : Gtk_Tree_Iter); Let the tree reference the node. This is an optional method for models to implement. To be more specific, models may ignore this call as it exists primarily for performance reasons. This function is primarily meant as a way for views to let caching model know when nodes are being displayed (and hence, whether or not to cache that node). For example, a file-system based model would not want to keep the entire file-hierarchy in memory, just the sections that are currently being displayed by every current view. procedure Unref_Node (Tree_Model : access Gtk_Tree_Model_Record; Iter : Gtk_Tree_Iter); Let the tree unref the node. This is an optional method for models to implement. To be more specific, models may ignore this call as it exists primarily for performance reasons. For more information on what this means, please see Tree_Model_Ref_Node. Please note that nodes that are deleted are not unreferenced. procedure Get_Value (Tree_Model : access Gtk_Tree_Model_Record; Iter : Gtk_Tree_Iter; Column : Gint; Value : out Glib.Values.GValue); Get a value from the model, at column Column and line Iter. Value must be freed by the caller. function Get_Int (Tree_Model : access Gtk_Tree_Model_Record; Iter : Gtk_Tree_Iter; Column : Gint) return Gint; Get the int value of one cell in the row referenced by Iter. function Get_Boolean (Tree_Model : access Gtk_Tree_Model_Record; Iter : Gtk_Tree_Iter; Column : Gint) return Boolean; Get the boolean value of one cell in the row referenced by Iter. function Get_Object (Tree_Model : access Gtk_Tree_Model_Record; Iter : Gtk_Tree_Iter; Column : Gint) return Glib.Object.GObject; Get the object value of one cell in the row referenced by Iter. function Get_String (Tree_Model : access Gtk_Tree_Model_Record; Iter : Gtk_Tree_Iter; Column : Gint) return UTF8_String; Get the string stored at a specific location in the model. function Get_Address (Tree_Model : access Gtk_Tree_Model_Record; Iter : Gtk_Tree_Iter; Column : Gint) return System.Address; Get the pointer stored at a specific location in the model. Signals ------- procedure Row_Changed (Tree_Model : access Gtk_Tree_Model_Record'Class; Path : Gtk_Tree_Path; Iter : Gtk_Tree_Iter); Emit the "row_changed" signal. procedure Row_Inserted (Tree_Model : access Gtk_Tree_Model_Record'Class; Path : Gtk_Tree_Path; Iter : Gtk_Tree_Iter); Emit the "row_inserted" signal. procedure Row_Has_Child_Toggled (Tree_Model : access Gtk_Tree_Model_Record'Class; Path : Gtk_Tree_Path; Iter : Gtk_Tree_Iter); Emit the "row_has_child_toggled" signal. procedure Row_Deleted (Tree_Model : access Gtk_Tree_Model_Record'Class; Path : Gtk_Tree_Path); Emit the "row_has_child_toggled" signal. procedure Rows_Reordered (Tree_Model : access Gtk_Tree_Model_Record'Class; Path : Gtk_Tree_Path; Iter : Gtk_Tree_Iter; New_Order : Gint_Array); Emit the "rows_reordered" signal  File: gtkada_rm.info, Node: Package_Gtk.Tree_Store, Next: Package_Gtk.Tree_View, Prev: Package_Gtk.Tree_Model, Up: Top Package Gtk.Tree`_'Store ************************ This package implements a specific model to store your data in. It is basically similar to a small database, in that each field can contain any number of columns. Each column can contain a different type of data, specified when the model is created. Adding new values in the model is done as in the example at the end. * Menu: * Gtk.Tree_Store Widget Hierarchy:: * Gtk.Tree_Store Types:: * Gtk.Tree_Store Subprograms:: * Gtk.Tree_Store Example::  File: gtkada_rm.info, Node: Gtk.Tree_Store Widget Hierarchy, Next: Gtk.Tree_Store Types, Up: Package_Gtk.Tree_Store Widget Hierarchy ================ GObject (*note Package_Glib.Object::) Gtk_Object (*note Package_Gtk.Object::) \___ Gtk_Tree_Model (*note Package_Gtk.Tree_Model::) \___ Gtk_Tree_Store (*note Package_Gtk.Tree_Store::)  File: gtkada_rm.info, Node: Gtk.Tree_Store Types, Next: Gtk.Tree_Store Subprograms, Prev: Gtk.Tree_Store Widget Hierarchy, Up: Package_Gtk.Tree_Store Types ===== type Data_Type is private; type Data_Type_Access is access all Data_Type;  File: gtkada_rm.info, Node: Gtk.Tree_Store Subprograms, Next: Gtk.Tree_Store Example, Prev: Gtk.Tree_Store Types, Up: Package_Gtk.Tree_Store Subprograms =========== procedure Gtk_New (Tree_Store : out Gtk_Tree_Store; Types : GType_Array); Create a new tree store using Types to fill the columns. function Get_Type return Glib.GType; Return the internal value associated with this widget. procedure Set_Column_Types (Tree_Store : access Gtk_Tree_Store_Record; Types : GType_Array); This function is meant primarily for GObjects that inherit from Gtk_Tree_Store, and should only be used when constructing a new Gtk_Tree_Store. It will not function after a row has been added, or a method on the Gtk_Tree_Model interface is called. procedure Set_Value (Tree_Store : access Gtk_Tree_Store_Record; Iter : Gtk.Tree_Model.Gtk_Tree_Iter; Column : Gint; Value : Glib.Values.GValue); Set a new value in the model. The value is added in the column Column, and in the line Iter. procedure Set (Tree_Store : access Gtk_Tree_Store_Record; Iter : Gtk.Tree_Model.Gtk_Tree_Iter; Column : Gint; Value : Data_Type_Access); Generic procedure used to store access objects in the model. For GObject and all of its descendents (including all widgets), you should use the Set procedure below that takes a GObject as parameter. Please see the example at the end for more information on how to create your own Set procedures adapted to your model. procedure Set (Tree_Store : access Gtk_Tree_Store_Record; Iter : Gtk.Tree_Model.Gtk_Tree_Iter; Column : Gint; Value : UTF8_String); Same as Generic_Set, but tailored to use with a string. procedure Set (Tree_Store : access Gtk_Tree_Store_Record; Iter : Gtk.Tree_Model.Gtk_Tree_Iter; Column : Gint; Value : Boolean); Same as Generic_Set, but tailored to use with a boolean. procedure Set (Tree_Store : access Gtk_Tree_Store_Record; Iter : Gtk.Tree_Model.Gtk_Tree_Iter; Column : Gint; Value : Gint); Same as Generic_Set, but tailored to use with an integer. procedure Set (Tree_Store : access Gtk_Tree_Store_Record; Iter : Gtk.Tree_Model.Gtk_Tree_Iter; Column : Gint; Value : Glib.C_Proxy); Same as Generic_Set, but tailored for Gdk types. procedure Set (Tree_Store : access Gtk_Tree_Store_Record; Iter : Gtk.Tree_Model.Gtk_Tree_Iter; Column : Gint; Value : Glib.Object.GObject); Same as Generic_Set, but tailored to objects/widgets. procedure Remove (Tree_Store : access Gtk_Tree_Store_Record; Iter : in out Gtk.Tree_Model.Gtk_Tree_Iter); Remove Iter from Tree_Store. After being removed, Iter is set to Null_Iter. procedure Insert (Tree_Store : access Gtk_Tree_Store_Record; Iter : in out Gtk.Tree_Model.Gtk_Tree_Iter; Parent : Gtk.Tree_Model.Gtk_Tree_Iter; Position : Gint); Create a new row at Position. If parent is non-null, then the row will be made a child of Parent. Otherwise, the row will be created at the toplevel. If Position is larger than the number of rows at that level, then the new row will be inserted to the end of the list. Iter will be changed to point to this new row. The row will be empty before this function is called. To fill in values, you need to call Set_Value. procedure Insert_Before (Tree_Store : access Gtk_Tree_Store_Record; Iter : in out Gtk.Tree_Model.Gtk_Tree_Iter; Parent : Gtk.Tree_Model.Gtk_Tree_Iter; Sibling : Gtk.Tree_Model.Gtk_Tree_Iter); Insert a new row before Sibling. If Sibling is Null_Iter, then the row will be appended to the beginning of the Parent's children. If Parent and Sibling are Null_Iter, then the row will be appended to the toplevel. If both Sibling and Parent are set, then Parent must be the parent of Sibling. When Sibling is set, Parent is optional. Iter will be changed to point to this new row. The row will be empty after this function is called. To fill in values, you need to call Set_Value. procedure Insert_After (Tree_Store : access Gtk_Tree_Store_Record; Iter : in out Gtk.Tree_Model.Gtk_Tree_Iter; Parent : Gtk.Tree_Model.Gtk_Tree_Iter; Sibling : Gtk.Tree_Model.Gtk_Tree_Iter); Insert a new row after Sibling. If Sibling is Null_Iter, then the row will be prepended to the beginning of the Parent's children. If Parent and Sibling are Null_Iter, then the row will be prepended to the toplevel. If both Sibling and Parent are set, then Parent must be the parent of Sibling. When Sibling is set, Parent is optional. Iter will be changed to point to this new row. The row will be empty after this function is called. To fill in values, you need to call Set_Value. procedure Prepend (Tree_Store : access Gtk_Tree_Store_Record; Iter : in out Gtk.Tree_Model.Gtk_Tree_Iter; Parent : Gtk.Tree_Model.Gtk_Tree_Iter); Prepend a new row to Tree_Store. If Parent is non-null, then it will prepend the new row before the first child of Parent, otherwise it will prepend a row to the top level. Iter will be changed to point to this new row. The row will be empty after this function is called. To fill in values, you need to call Set_Value. The efficiency of this procedure is O(N). procedure Append (Tree_Store : access Gtk_Tree_Store_Record; Iter : in out Gtk.Tree_Model.Gtk_Tree_Iter; Parent : Gtk.Tree_Model.Gtk_Tree_Iter); Append a new row to Tree_Store. If Parent is non-null, then it will append the new row after the last child of Parent, otherwise it will append a row to the top level. Iter will be changed to point to this new row. The row will be empty after this function is called. To fill in values, you need to call Set_Value. The efficiency of this procedure is O(N^2). function Is_Ancestor (Tree_Store : access Gtk_Tree_Store_Record; Iter : Gtk.Tree_Model.Gtk_Tree_Iter; Descendant : Gtk.Tree_Model.Gtk_Tree_Iter) return Boolean; Return True if Iter is an ancestor of Descendant. That is, Iter is the parent (or grandparent or great-grandparent) of Descendant. function Iter_Depth (Tree_Store : access Gtk_Tree_Store_Record; Iter : Gtk.Tree_Model.Gtk_Tree_Iter) return Gint; Returns the depth of Iter. This will be 0 for anything on the root level, 1 for anything down a level, etc. procedure Clear (Tree_Store : access Gtk_Tree_Store_Record); Removes all rows from Tree_Store Sorting Freeze / Thaw --------------------- function Freeze_Sort (Tree : access Gtk.Tree_Store.Gtk_Tree_Store_Record'Class) return Gint; Freeze the sorting in the tree view, and returns the current sort_column_id, which should be used when thawing. (See Thaw_Sort) procedure Thaw_Sort (Tree : access Gtk.Tree_Store.Gtk_Tree_Store_Record'Class; Column_Id : Gint); Thaw a frozen tree_view. Column_Id should be the value returned by the corresponding call to Freeze_Sort.