1. ------------------------------------------------------------------------------ 
  2. --                                                                          -- 
  3. --      Copyright (C) 1998-2000 E. Briot, J. Brobecker and A. Charlet       -- 
  4. --                     Copyright (C) 2000-2014, AdaCore                     -- 
  5. --                                                                          -- 
  6. -- This library is free software;  you can redistribute it and/or modify it -- 
  7. -- under terms of the  GNU General Public License  as published by the Free -- 
  8. -- Software  Foundation;  either version 3,  or (at your  option) any later -- 
  9. -- version. This library is distributed in the hope that it will be useful, -- 
  10. -- but WITHOUT ANY WARRANTY;  without even the implied warranty of MERCHAN- -- 
  11. -- TABILITY or FITNESS FOR A PARTICULAR PURPOSE.                            -- 
  12. --                                                                          -- 
  13. -- As a special exception under Section 7 of GPL version 3, you are granted -- 
  14. -- additional permissions described in the GCC Runtime Library Exception,   -- 
  15. -- version 3.1, as published by the Free Software Foundation.               -- 
  16. --                                                                          -- 
  17. -- You should have received a copy of the GNU General Public License and    -- 
  18. -- a copy of the GCC Runtime Library Exception along with this program;     -- 
  19. -- see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see    -- 
  20. -- <http://www.gnu.org/licenses/>.                                          -- 
  21. --                                                                          -- 
  22. ------------------------------------------------------------------------------ 
  23.  
  24. --  <description> 
  25. --  The Gtk.Notebook.Gtk_Notebook widget is a Gtk.Container.Gtk_Container 
  26. --  whose children are pages that can be switched between using tab labels 
  27. --  along one edge. 
  28. -- 
  29. --  There are many configuration options for GtkNotebook. Among other things, 
  30. --  you can choose on which edge the tabs appear (see 
  31. --  Gtk.Notebook.Set_Tab_Pos), whether, if there are too many tabs to fit the 
  32. --  notebook should be made bigger or scrolling arrows added (see 
  33. --  Gtk.Notebook.Set_Scrollable), and whether there will be a popup menu 
  34. --  allowing the users to switch pages. (see Gtk.Notebook.Popup_Enable, 
  35. --  Gtk.Notebook.Popup_Disable) 
  36. -- 
  37. --  == GtkNotebook as GtkBuildable == 
  38. -- 
  39. --  The GtkNotebook implementation of the Gtk.Buildable.Gtk_Buildable 
  40. --  interface supports placing children into tabs by specifying "tab" as the 
  41. --  "type" attribute of a <child> element. Note that the content of the tab 
  42. --  must be created before the tab can be filled. A tab child can be specified 
  43. --  without specifying a <child> type attribute. 
  44. -- 
  45. --  To add a child widget in the notebooks action area, specify "action-start" 
  46. --  or "action-end" as the "type" attribute of the <child> element. 
  47. -- 
  48. --  == A UI definition fragment with GtkNotebook == 
  49. -- 
  50. --    <object class="GtkNotebook"> 
  51. --    <child> 
  52. --    <object class="GtkLabel" id="notebook-content"> 
  53. --    <property name="label">Content</property> 
  54. --    </object> 
  55. --    </child> 
  56. --    <child type="tab"> 
  57. --    <object class="GtkLabel" id="notebook-tab"> 
  58. --    <property name="label">Tab</property> 
  59. --    </object> 
  60. --    </child> 
  61. --    </object> 
  62. --  </description> 
  63. --  <screenshot>gtk-notebook</screenshot> 
  64. --  <group>Layout containers</group> 
  65. --  <testgtk>create_notebook.adb</testgtk> 
  66. pragma Ada_2005; 
  67.  
  68. pragma Warnings (Off, "*is already use-visible*"); 
  69. with Glib;                    use Glib; 
  70. with Glib.Generic_Properties; use Glib.Generic_Properties; 
  71. with Glib.Object;             use Glib.Object; 
  72. with Glib.Properties;         use Glib.Properties; 
  73. with Glib.Types;              use Glib.Types; 
  74. with Gtk.Buildable;           use Gtk.Buildable; 
  75. with Gtk.Container;           use Gtk.Container; 
  76. with Gtk.Enums;               use Gtk.Enums; 
  77. with Gtk.Widget;              use Gtk.Widget; 
  78.  
  79. package Gtk.Notebook is 
  80.  
  81.    type Gtk_Notebook_Record is new Gtk_Container_Record with null record; 
  82.    type Gtk_Notebook is access all Gtk_Notebook_Record'Class; 
  83.  
  84.    type Gtk_Notebook_Tab is ( 
  85.       Notebook_Tab_First, 
  86.       Notebook_Tab_Last); 
  87.    pragma Convention (C, Gtk_Notebook_Tab); 
  88.  
  89.    ---------------------------- 
  90.    -- Enumeration Properties -- 
  91.    ---------------------------- 
  92.  
  93.    package Gtk_Notebook_Tab_Properties is 
  94.       new Generic_Internal_Discrete_Property (Gtk_Notebook_Tab); 
  95.    type Property_Gtk_Notebook_Tab is new Gtk_Notebook_Tab_Properties.Property; 
  96.  
  97.    ------------------ 
  98.    -- Constructors -- 
  99.    ------------------ 
  100.  
  101.    procedure Gtk_New (Notebook : out Gtk_Notebook); 
  102.    procedure Initialize 
  103.       (Notebook : not null access Gtk_Notebook_Record'Class); 
  104.    --  Creates a new Gtk.Notebook.Gtk_Notebook widget with no pages. 
  105.  
  106.    function Gtk_Notebook_New return Gtk_Notebook; 
  107.    --  Creates a new Gtk.Notebook.Gtk_Notebook widget with no pages. 
  108.  
  109.    function Get_Type return Glib.GType; 
  110.    pragma Import (C, Get_Type, "gtk_notebook_get_type"); 
  111.  
  112.    ------------- 
  113.    -- Methods -- 
  114.    ------------- 
  115.  
  116.    function Append_Page 
  117.       (Notebook  : not null access Gtk_Notebook_Record; 
  118.        Child     : not null access Gtk.Widget.Gtk_Widget_Record'Class; 
  119.        Tab_Label : access Gtk.Widget.Gtk_Widget_Record'Class) return Gint; 
  120.    --  Appends a page to Notebook. 
  121.    --  "child": the Gtk.Widget.Gtk_Widget to use as the contents of the page 
  122.    --  "tab_label": the Gtk.Widget.Gtk_Widget to be used as the label for the 
  123.    --  page, or null to use the default label, 'page N' 
  124.  
  125.    procedure Append_Page_Menu 
  126.       (Notebook   : not null access Gtk_Notebook_Record; 
  127.        Child      : not null access Gtk.Widget.Gtk_Widget_Record'Class; 
  128.        Tab_Label  : access Gtk.Widget.Gtk_Widget_Record'Class; 
  129.        Menu_Label : access Gtk.Widget.Gtk_Widget_Record'Class); 
  130.    --  Appends a page to Notebook, specifying the widget to use as the label 
  131.    --  in the popup menu. 
  132.    --  "child": the Gtk.Widget.Gtk_Widget to use as the contents of the page 
  133.    --  "tab_label": the Gtk.Widget.Gtk_Widget to be used as the label for the 
  134.    --  page, or null to use the default label, 'page N' 
  135.    --  "menu_label": the widget to use as a label for the page-switch menu, if 
  136.    --  that is enabled. If null, and Tab_Label is a Gtk.Label.Gtk_Label or 
  137.    --  null, then the menu label will be a newly created label with the same 
  138.    --  text as Tab_Label; if Tab_Label is not a Gtk.Label.Gtk_Label, Menu_Label 
  139.    --  must be specified if the page-switch menu is to be used. 
  140.  
  141.    function Get_Action_Widget 
  142.       (Notebook  : not null access Gtk_Notebook_Record; 
  143.        Pack_Type : Gtk.Enums.Gtk_Pack_Type) return Gtk.Widget.Gtk_Widget; 
  144.    --  Gets one of the action widgets. See Gtk.Notebook.Set_Action_Widget. 
  145.    --  Since: gtk+ 2.20 
  146.    --  "pack_type": pack type of the action widget to receive 
  147.  
  148.    procedure Set_Action_Widget 
  149.       (Notebook  : not null access Gtk_Notebook_Record; 
  150.        Widget    : not null access Gtk.Widget.Gtk_Widget_Record'Class; 
  151.        Pack_Type : Gtk.Enums.Gtk_Pack_Type); 
  152.    --  Sets Widget as one of the action widgets. Depending on the pack type 
  153.    --  the widget will be placed before or after the tabs. You can use a 
  154.    --  Gtk.Box.Gtk_Box if you need to pack more than one widget on the same 
  155.    --  side. 
  156.    --  Note that action widgets are "internal" children of the notebook and 
  157.    --  thus not included in the list returned from Gtk.Container.Foreach. 
  158.    --  Since: gtk+ 2.20 
  159.    --  "widget": a Gtk.Widget.Gtk_Widget 
  160.    --  "pack_type": pack type of the action widget 
  161.  
  162.    function Get_Current_Page 
  163.       (Notebook : not null access Gtk_Notebook_Record) return Gint; 
  164.    --  Returns the page number of the current page. 
  165.  
  166.    procedure Set_Current_Page 
  167.       (Notebook : not null access Gtk_Notebook_Record; 
  168.        Page_Num : Gint := -1); 
  169.    --  Switches to the page number Page_Num. 
  170.    --  Note that due to historical reasons, GtkNotebook refuses to switch to a 
  171.    --  page unless the child widget is visible. Therefore, it is recommended to 
  172.    --  show child widgets before adding them to a notebook. 
  173.    --  "page_num": index of the page to switch to, starting from 0. If 
  174.    --  negative, the last page will be used. If greater than the number of 
  175.    --  pages in the notebook, nothing will be done. 
  176.  
  177.    function Get_Group_Name 
  178.       (Notebook : not null access Gtk_Notebook_Record) return UTF8_String; 
  179.    --  Gets the current group name for Notebook. 
  180.    --  Since: gtk+ 2.24 
  181.  
  182.    procedure Set_Group_Name 
  183.       (Notebook   : not null access Gtk_Notebook_Record; 
  184.        Group_Name : UTF8_String := ""); 
  185.    --  Sets a group name for Notebook. 
  186.    --  Notebooks with the same name will be able to exchange tabs via drag and 
  187.    --  drop. A notebook with a null group name will not be able to exchange 
  188.    --  tabs with any other notebook. 
  189.    --  Since: gtk+ 2.24 
  190.    --  "group_name": the name of the notebook group, or null to unset it 
  191.  
  192.    function Get_Menu_Label 
  193.       (Notebook : not null access Gtk_Notebook_Record; 
  194.        Child    : not null access Gtk.Widget.Gtk_Widget_Record'Class) 
  195.        return Gtk.Widget.Gtk_Widget; 
  196.    --  Retrieves the menu label widget of the page containing Child. 
  197.    --  "child": a widget contained in a page of Notebook 
  198.  
  199.    procedure Set_Menu_Label 
  200.       (Notebook   : not null access Gtk_Notebook_Record; 
  201.        Child      : not null access Gtk.Widget.Gtk_Widget_Record'Class; 
  202.        Menu_Label : access Gtk.Widget.Gtk_Widget_Record'Class); 
  203.    --  Changes the menu label for the page containing Child. 
  204.    --  "child": the child widget 
  205.    --  "menu_label": the menu label, or null for default 
  206.  
  207.    function Get_Menu_Label_Text 
  208.       (Notebook : not null access Gtk_Notebook_Record; 
  209.        Child    : not null access Gtk.Widget.Gtk_Widget_Record'Class) 
  210.        return UTF8_String; 
  211.    --  Retrieves the text of the menu label for the page containing Child. 
  212.    --  "child": the child widget of a page of the notebook. 
  213.  
  214.    procedure Set_Menu_Label_Text 
  215.       (Notebook  : not null access Gtk_Notebook_Record; 
  216.        Child     : not null access Gtk.Widget.Gtk_Widget_Record'Class; 
  217.        Menu_Text : UTF8_String); 
  218.    --  Creates a new label and sets it as the menu label of Child. 
  219.    --  "child": the child widget 
  220.    --  "menu_text": the label text 
  221.  
  222.    function Get_N_Pages 
  223.       (Notebook : not null access Gtk_Notebook_Record) return Gint; 
  224.    --  Gets the number of pages in a notebook. 
  225.    --  Since: gtk+ 2.2 
  226.  
  227.    function Get_Nth_Page 
  228.       (Notebook : not null access Gtk_Notebook_Record; 
  229.        Page_Num : Gint) return Gtk.Widget.Gtk_Widget; 
  230.    --  Returns the child widget contained in page number Page_Num. 
  231.    --  "page_num": the index of a page in the notebook, or -1 to get the last 
  232.    --  page 
  233.  
  234.    function Get_Scrollable 
  235.       (Notebook : not null access Gtk_Notebook_Record) return Boolean; 
  236.    --  Returns whether the tab label area has arrows for scrolling. See 
  237.    --  Gtk.Notebook.Set_Scrollable. 
  238.  
  239.    procedure Set_Scrollable 
  240.       (Notebook   : not null access Gtk_Notebook_Record; 
  241.        Scrollable : Boolean := True); 
  242.    --  Sets whether the tab label area will have arrows for scrolling if there 
  243.    --  are too many tabs to fit in the area. 
  244.    --  "scrollable": True if scroll arrows should be added 
  245.  
  246.    function Get_Show_Border 
  247.       (Notebook : not null access Gtk_Notebook_Record) return Boolean; 
  248.    --  Returns whether a bevel will be drawn around the notebook pages. See 
  249.    --  Gtk.Notebook.Set_Show_Border. 
  250.  
  251.    procedure Set_Show_Border 
  252.       (Notebook    : not null access Gtk_Notebook_Record; 
  253.        Show_Border : Boolean := True); 
  254.    --  Sets whether a bevel will be drawn around the notebook pages. This only 
  255.    --  has a visual effect when the tabs are not shown. See 
  256.    --  Gtk.Notebook.Set_Show_Tabs. 
  257.    --  "show_border": True if a bevel should be drawn around the notebook 
  258.  
  259.    function Get_Show_Tabs 
  260.       (Notebook : not null access Gtk_Notebook_Record) return Boolean; 
  261.    --  Returns whether the tabs of the notebook are shown. See 
  262.    --  Gtk.Notebook.Set_Show_Tabs. 
  263.  
  264.    procedure Set_Show_Tabs 
  265.       (Notebook  : not null access Gtk_Notebook_Record; 
  266.        Show_Tabs : Boolean := True); 
  267.    --  Sets whether to show the tabs for the notebook or not. 
  268.    --  "show_tabs": True if the tabs should be shown 
  269.  
  270.    function Get_Tab_Detachable 
  271.       (Notebook : not null access Gtk_Notebook_Record; 
  272.        Child    : not null access Gtk.Widget.Gtk_Widget_Record'Class) 
  273.        return Boolean; 
  274.    --  Returns whether the tab contents can be detached from Notebook. 
  275.    --  Since: gtk+ 2.10 
  276.    --  "child": a child Gtk.Widget.Gtk_Widget 
  277.  
  278.    procedure Set_Tab_Detachable 
  279.       (Notebook   : not null access Gtk_Notebook_Record; 
  280.        Child      : not null access Gtk.Widget.Gtk_Widget_Record'Class; 
  281.        Detachable : Boolean := True); 
  282.    --  Sets whether the tab can be detached from Notebook to another notebook 
  283.    --  or widget. 
  284.    --  Note that 2 notebooks must share a common group identificator (see 
  285.    --  Gtk.Notebook.Set_Group_Name) to allow automatic tabs interchange between 
  286.    --  them. 
  287.    --  If you want a widget to interact with a notebook through DnD (i.e.: 
  288.    --  accept dragged tabs from it) it must be set as a drop destination and 
  289.    --  accept the target "GTK_NOTEBOOK_TAB". The notebook will fill the 
  290.    --  selection with a GtkWidget** pointing to the child widget that 
  291.    --  corresponds to the dropped tab. |[ static void 
  292.    --  on_drop_zone_drag_data_received (GtkWidget *widget, GdkDragContext 
  293.    --  *context, gint x, gint y, GtkSelectionData *selection_data, guint info, 
  294.    --  guint time, gpointer user_data) { GtkWidget *notebook; GtkWidget 
  295.    --  **child; 
  296.    --  notebook = gtk_drag_get_source_widget (context); child = (void*) 
  297.    --  gtk_selection_data_get_data (selection_data); 
  298.    --  process_widget (*child); gtk_container_remove (GTK_CONTAINER 
  299.    --  (notebook), *child); } ]| 
  300.    --  If you want a notebook to accept drags from other widgets, you will 
  301.    --  have to set your own DnD code to do it. 
  302.    --  Since: gtk+ 2.10 
  303.    --  "child": a child Gtk.Widget.Gtk_Widget 
  304.    --  "detachable": whether the tab is detachable or not 
  305.  
  306.    function Get_Tab_Hborder 
  307.       (Notebook : not null access Gtk_Notebook_Record) return Guint16; 
  308.    pragma Obsolescent (Get_Tab_Hborder); 
  309.    --  Returns the horizontal width of a tab border. 
  310.    --  Since: gtk+ 2.22 
  311.    --  Deprecated since 3.4, this function returns zero 
  312.  
  313.    function Get_Tab_Label 
  314.       (Notebook : not null access Gtk_Notebook_Record; 
  315.        Child    : not null access Gtk.Widget.Gtk_Widget_Record'Class) 
  316.        return Gtk.Widget.Gtk_Widget; 
  317.    --  Returns the tab label widget for the page Child. null is returned if 
  318.    --  Child is not in Notebook or if no tab label has specifically been set 
  319.    --  for Child. 
  320.    --  "child": the page 
  321.  
  322.    procedure Set_Tab_Label 
  323.       (Notebook  : not null access Gtk_Notebook_Record; 
  324.        Child     : not null access Gtk.Widget.Gtk_Widget_Record'Class; 
  325.        Tab_Label : access Gtk.Widget.Gtk_Widget_Record'Class); 
  326.    --  Changes the tab label for Child. If null is specified for Tab_Label, 
  327.    --  then the page will have the label 'page N'. 
  328.    --  "child": the page 
  329.    --  "tab_label": the tab label widget to use, or null for default tab label 
  330.  
  331.    function Get_Tab_Label_Text 
  332.       (Notebook : not null access Gtk_Notebook_Record; 
  333.        Child    : not null access Gtk.Widget.Gtk_Widget_Record'Class) 
  334.        return UTF8_String; 
  335.    --  Retrieves the text of the tab label for the page containing Child. 
  336.    --  "child": a widget contained in a page of Notebook 
  337.  
  338.    procedure Set_Tab_Label_Text 
  339.       (Notebook : not null access Gtk_Notebook_Record; 
  340.        Child    : not null access Gtk.Widget.Gtk_Widget_Record'Class; 
  341.        Tab_Text : UTF8_String); 
  342.    --  Creates a new label and sets it as the tab label for the page 
  343.    --  containing Child. 
  344.    --  "child": the page 
  345.    --  "tab_text": the label text 
  346.  
  347.    function Get_Tab_Pos 
  348.       (Notebook : not null access Gtk_Notebook_Record) 
  349.        return Gtk.Enums.Gtk_Position_Type; 
  350.    --  Gets the edge at which the tabs for switching pages in the notebook are 
  351.    --  drawn. 
  352.  
  353.    procedure Set_Tab_Pos 
  354.       (Notebook : not null access Gtk_Notebook_Record; 
  355.        Pos      : Gtk.Enums.Gtk_Position_Type); 
  356.    --  Sets the edge at which the tabs for switching pages in the notebook are 
  357.    --  drawn. 
  358.    --  "pos": the edge to draw the tabs at 
  359.  
  360.    function Get_Tab_Reorderable 
  361.       (Notebook : not null access Gtk_Notebook_Record; 
  362.        Child    : not null access Gtk.Widget.Gtk_Widget_Record'Class) 
  363.        return Boolean; 
  364.    --  Gets whether the tab can be reordered via drag and drop or not. 
  365.    --  Since: gtk+ 2.10 
  366.    --  "child": a child Gtk.Widget.Gtk_Widget 
  367.  
  368.    procedure Set_Tab_Reorderable 
  369.       (Notebook    : not null access Gtk_Notebook_Record; 
  370.        Child       : not null access Gtk.Widget.Gtk_Widget_Record'Class; 
  371.        Reorderable : Boolean := True); 
  372.    --  Sets whether the notebook tab can be reordered via drag and drop or 
  373.    --  not. 
  374.    --  Since: gtk+ 2.10 
  375.    --  "child": a child Gtk.Widget.Gtk_Widget 
  376.    --  "reorderable": whether the tab is reorderable or not 
  377.  
  378.    function Get_Tab_Vborder 
  379.       (Notebook : not null access Gtk_Notebook_Record) return Guint16; 
  380.    pragma Obsolescent (Get_Tab_Vborder); 
  381.    --  Returns the vertical width of a tab border. 
  382.    --  Since: gtk+ 2.22 
  383.    --  Deprecated since 3.4, this function returns zero 
  384.  
  385.    function Insert_Page 
  386.       (Notebook  : not null access Gtk_Notebook_Record; 
  387.        Child     : not null access Gtk.Widget.Gtk_Widget_Record'Class; 
  388.        Tab_Label : access Gtk.Widget.Gtk_Widget_Record'Class; 
  389.        Position  : Gint) return Gint; 
  390.    --  Insert a page into Notebook at the given position. 
  391.    --  "child": the Gtk.Widget.Gtk_Widget to use as the contents of the page 
  392.    --  "tab_label": the Gtk.Widget.Gtk_Widget to be used as the label for the 
  393.    --  page, or null to use the default label, 'page N' 
  394.    --  "position": the index (starting at 0) at which to insert the page, or 
  395.    --  -1 to append the page after all other pages 
  396.  
  397.    function Insert_Page_Menu 
  398.       (Notebook   : not null access Gtk_Notebook_Record; 
  399.        Child      : not null access Gtk.Widget.Gtk_Widget_Record'Class; 
  400.        Tab_Label  : access Gtk.Widget.Gtk_Widget_Record'Class; 
  401.        Menu_Label : access Gtk.Widget.Gtk_Widget_Record'Class; 
  402.        Position   : Gint) return Gint; 
  403.    --  Insert a page into Notebook at the given position, specifying the 
  404.    --  widget to use as the label in the popup menu. 
  405.    --  "child": the Gtk.Widget.Gtk_Widget to use as the contents of the page 
  406.    --  "tab_label": the Gtk.Widget.Gtk_Widget to be used as the label for the 
  407.    --  page, or null to use the default label, 'page N' 
  408.    --  "menu_label": the widget to use as a label for the page-switch menu, if 
  409.    --  that is enabled. If null, and Tab_Label is a Gtk.Label.Gtk_Label or 
  410.    --  null, then the menu label will be a newly created label with the same 
  411.    --  text as Tab_Label; if Tab_Label is not a Gtk.Label.Gtk_Label, Menu_Label 
  412.    --  must be specified if the page-switch menu is to be used. 
  413.    --  "position": the index (starting at 0) at which to insert the page, or 
  414.    --  -1 to append the page after all other pages. 
  415.  
  416.    procedure Next_Page (Notebook : not null access Gtk_Notebook_Record); 
  417.    --  Switches to the next page. Nothing happens if the current page is the 
  418.    --  last page. 
  419.  
  420.    function Page_Num 
  421.       (Notebook : not null access Gtk_Notebook_Record; 
  422.        Child    : not null access Gtk.Widget.Gtk_Widget_Record'Class) 
  423.        return Gint; 
  424.    --  Finds the index of the page which contains the given child widget. 
  425.    --  "child": a Gtk.Widget.Gtk_Widget 
  426.  
  427.    procedure Popup_Disable (Notebook : not null access Gtk_Notebook_Record); 
  428.    --  Disables the popup menu. 
  429.  
  430.    procedure Popup_Enable (Notebook : not null access Gtk_Notebook_Record); 
  431.    --  Enables the popup menu: if the user clicks with the right mouse button 
  432.    --  on the tab labels, a menu with all the pages will be popped up. 
  433.  
  434.    function Prepend_Page 
  435.       (Notebook  : not null access Gtk_Notebook_Record; 
  436.        Child     : not null access Gtk.Widget.Gtk_Widget_Record'Class; 
  437.        Tab_Label : access Gtk.Widget.Gtk_Widget_Record'Class) return Gint; 
  438.    --  Prepends a page to Notebook. 
  439.    --  "child": the Gtk.Widget.Gtk_Widget to use as the contents of the page 
  440.    --  "tab_label": the Gtk.Widget.Gtk_Widget to be used as the label for the 
  441.    --  page, or null to use the default label, 'page N' 
  442.  
  443.    function Prepend_Page_Menu 
  444.       (Notebook   : not null access Gtk_Notebook_Record; 
  445.        Child      : not null access Gtk.Widget.Gtk_Widget_Record'Class; 
  446.        Tab_Label  : access Gtk.Widget.Gtk_Widget_Record'Class; 
  447.        Menu_Label : access Gtk.Widget.Gtk_Widget_Record'Class) return Gint; 
  448.    --  Prepends a page to Notebook, specifying the widget to use as the label 
  449.    --  in the popup menu. 
  450.    --  "child": the Gtk.Widget.Gtk_Widget to use as the contents of the page 
  451.    --  "tab_label": the Gtk.Widget.Gtk_Widget to be used as the label for the 
  452.    --  page, or null to use the default label, 'page N' 
  453.    --  "menu_label": the widget to use as a label for the page-switch menu, if 
  454.    --  that is enabled. If null, and Tab_Label is a Gtk.Label.Gtk_Label or 
  455.    --  null, then the menu label will be a newly created label with the same 
  456.    --  text as Tab_Label; if Tab_Label is not a Gtk.Label.Gtk_Label, Menu_Label 
  457.    --  must be specified if the page-switch menu is to be used. 
  458.  
  459.    procedure Prev_Page (Notebook : not null access Gtk_Notebook_Record); 
  460.    --  Switches to the previous page. Nothing happens if the current page is 
  461.    --  the first page. 
  462.  
  463.    procedure Remove_Page 
  464.       (Notebook : not null access Gtk_Notebook_Record; 
  465.        Page_Num : Gint); 
  466.    --  Removes a page from the notebook given its index in the notebook. 
  467.    --  "page_num": the index of a notebook page, starting from 0. If -1, the 
  468.    --  last page will be removed. 
  469.  
  470.    procedure Reorder_Child 
  471.       (Notebook : not null access Gtk_Notebook_Record; 
  472.        Child    : not null access Gtk.Widget.Gtk_Widget_Record'Class; 
  473.        Position : Gint); 
  474.    --  Reorders the page containing Child, so that it appears in position 
  475.    --  Position. If Position is greater than or equal to the number of children 
  476.    --  in the list or negative, Child will be moved to the end of the list. 
  477.    --  "child": the child to move 
  478.    --  "position": the new position, or -1 to move to the end 
  479.  
  480.    ---------------------- 
  481.    -- GtkAda additions -- 
  482.    ---------------------- 
  483.  
  484.    procedure Append_Page 
  485.      (Notebook  : access Gtk_Notebook_Record; 
  486.       Child     : access Gtk.Widget.Gtk_Widget_Record'Class); 
  487.    procedure Append_Page 
  488.      (Notebook  : access Gtk_Notebook_Record; 
  489.       Child     : access Gtk.Widget.Gtk_Widget_Record'Class; 
  490.       Tab_Label : access Gtk.Widget.Gtk_Widget_Record'Class); 
  491.    procedure Prepend_Page 
  492.      (Notebook  : access Gtk_Notebook_Record; 
  493.       Child     : access Gtk.Widget.Gtk_Widget_Record'Class; 
  494.       Tab_Label : access Gtk.Widget.Gtk_Widget_Record'Class); 
  495.    --  Convenience functions, same as above but discarding the return value. 
  496.  
  497.    ---------------- 
  498.    -- Properties -- 
  499.    ---------------- 
  500.    --  The following properties are defined for this widget. See 
  501.    --  Glib.Properties for more information on properties) 
  502.  
  503.    Enable_Popup_Property : constant Glib.Properties.Property_Boolean; 
  504.  
  505.    Group_Name_Property : constant Glib.Properties.Property_String; 
  506.    --  Group name for tab drag and drop. 
  507.  
  508.    Page_Property : constant Glib.Properties.Property_Int; 
  509.  
  510.    Scrollable_Property : constant Glib.Properties.Property_Boolean; 
  511.  
  512.    Show_Border_Property : constant Glib.Properties.Property_Boolean; 
  513.  
  514.    Show_Tabs_Property : constant Glib.Properties.Property_Boolean; 
  515.  
  516.    Tab_Pos_Property : constant Gtk.Enums.Property_Gtk_Position_Type; 
  517.  
  518.    ------------- 
  519.    -- Signals -- 
  520.    ------------- 
  521.  
  522.    type Cb_Gtk_Notebook_Gint_Boolean is not null access function 
  523.      (Self   : access Gtk_Notebook_Record'Class; 
  524.       Object : Gint) return Boolean; 
  525.  
  526.    type Cb_GObject_Gint_Boolean is not null access function 
  527.      (Self   : access Glib.Object.GObject_Record'Class; 
  528.       Object : Gint) return Boolean; 
  529.  
  530.    Signal_Change_Current_Page : constant Glib.Signal_Name := "change-current-page"; 
  531.    procedure On_Change_Current_Page 
  532.       (Self  : not null access Gtk_Notebook_Record; 
  533.        Call  : Cb_Gtk_Notebook_Gint_Boolean; 
  534.        After : Boolean := False); 
  535.    procedure On_Change_Current_Page 
  536.       (Self  : not null access Gtk_Notebook_Record; 
  537.        Call  : Cb_GObject_Gint_Boolean; 
  538.        Slot  : not null access Glib.Object.GObject_Record'Class; 
  539.        After : Boolean := False); 
  540.  
  541.    type Cb_Gtk_Notebook_Gtk_Widget_Gint_Gint_Gtk_Notebook is not null access function 
  542.      (Self : access Gtk_Notebook_Record'Class; 
  543.       Page : not null access Gtk.Widget.Gtk_Widget_Record'Class; 
  544.       X    : Gint; 
  545.       Y    : Gint) return Gtk_Notebook; 
  546.  
  547.    type Cb_GObject_Gtk_Widget_Gint_Gint_Gtk_Notebook is not null access function 
  548.      (Self : access Glib.Object.GObject_Record'Class; 
  549.       Page : not null access Gtk.Widget.Gtk_Widget_Record'Class; 
  550.       X    : Gint; 
  551.       Y    : Gint) return Gtk_Notebook; 
  552.  
  553.    Signal_Create_Window : constant Glib.Signal_Name := "create-window"; 
  554.    procedure On_Create_Window 
  555.       (Self  : not null access Gtk_Notebook_Record; 
  556.        Call  : Cb_Gtk_Notebook_Gtk_Widget_Gint_Gint_Gtk_Notebook; 
  557.        After : Boolean := False); 
  558.    procedure On_Create_Window 
  559.       (Self  : not null access Gtk_Notebook_Record; 
  560.        Call  : Cb_GObject_Gtk_Widget_Gint_Gint_Gtk_Notebook; 
  561.        Slot  : not null access Glib.Object.GObject_Record'Class; 
  562.        After : Boolean := False); 
  563.    --  The ::create-window signal is emitted when a detachable tab is dropped 
  564.    --  on the root window. 
  565.    -- 
  566.    --  A handler for this signal can create a window containing a notebook 
  567.    --  where the tab will be attached. It is also responsible for 
  568.    --  moving/resizing the window and adding the necessary properties to the 
  569.    --  notebook (e.g. the Gtk.Notebook.Gtk_Notebook:group-name ). 
  570.    --  
  571.    --  Callback parameters: 
  572.    --    --  "page": the tab of Notebook that is being detached 
  573.    --    --  "x": the X coordinate where the drop happens 
  574.    --    --  "y": the Y coordinate where the drop happens 
  575.    --    --  Returns a Gtk.Notebook.Gtk_Notebook that Page should be added to, or null. 
  576.  
  577.    type Cb_Gtk_Notebook_Gtk_Notebook_Tab_Boolean is not null access function 
  578.      (Self   : access Gtk_Notebook_Record'Class; 
  579.       Object : Gtk_Notebook_Tab) return Boolean; 
  580.  
  581.    type Cb_GObject_Gtk_Notebook_Tab_Boolean is not null access function 
  582.      (Self   : access Glib.Object.GObject_Record'Class; 
  583.       Object : Gtk_Notebook_Tab) return Boolean; 
  584.  
  585.    Signal_Focus_Tab : constant Glib.Signal_Name := "focus-tab"; 
  586.    procedure On_Focus_Tab 
  587.       (Self  : not null access Gtk_Notebook_Record; 
  588.        Call  : Cb_Gtk_Notebook_Gtk_Notebook_Tab_Boolean; 
  589.        After : Boolean := False); 
  590.    procedure On_Focus_Tab 
  591.       (Self  : not null access Gtk_Notebook_Record; 
  592.        Call  : Cb_GObject_Gtk_Notebook_Tab_Boolean; 
  593.        Slot  : not null access Glib.Object.GObject_Record'Class; 
  594.        After : Boolean := False); 
  595.  
  596.    type Cb_Gtk_Notebook_Gtk_Direction_Type_Void is not null access procedure 
  597.      (Self   : access Gtk_Notebook_Record'Class; 
  598.       Object : Gtk.Enums.Gtk_Direction_Type); 
  599.  
  600.    type Cb_GObject_Gtk_Direction_Type_Void is not null access procedure 
  601.      (Self   : access Glib.Object.GObject_Record'Class; 
  602.       Object : Gtk.Enums.Gtk_Direction_Type); 
  603.  
  604.    Signal_Move_Focus_Out : constant Glib.Signal_Name := "move-focus-out"; 
  605.    procedure On_Move_Focus_Out 
  606.       (Self  : not null access Gtk_Notebook_Record; 
  607.        Call  : Cb_Gtk_Notebook_Gtk_Direction_Type_Void; 
  608.        After : Boolean := False); 
  609.    procedure On_Move_Focus_Out 
  610.       (Self  : not null access Gtk_Notebook_Record; 
  611.        Call  : Cb_GObject_Gtk_Direction_Type_Void; 
  612.        Slot  : not null access Glib.Object.GObject_Record'Class; 
  613.        After : Boolean := False); 
  614.  
  615.    type Cb_Gtk_Notebook_Gtk_Widget_Guint_Void is not null access procedure 
  616.      (Self     : access Gtk_Notebook_Record'Class; 
  617.       Child    : not null access Gtk.Widget.Gtk_Widget_Record'Class; 
  618.       Page_Num : Guint); 
  619.  
  620.    type Cb_GObject_Gtk_Widget_Guint_Void is not null access procedure 
  621.      (Self     : access Glib.Object.GObject_Record'Class; 
  622.       Child    : not null access Gtk.Widget.Gtk_Widget_Record'Class; 
  623.       Page_Num : Guint); 
  624.  
  625.    Signal_Page_Added : constant Glib.Signal_Name := "page-added"; 
  626.    procedure On_Page_Added 
  627.       (Self  : not null access Gtk_Notebook_Record; 
  628.        Call  : Cb_Gtk_Notebook_Gtk_Widget_Guint_Void; 
  629.        After : Boolean := False); 
  630.    procedure On_Page_Added 
  631.       (Self  : not null access Gtk_Notebook_Record; 
  632.        Call  : Cb_GObject_Gtk_Widget_Guint_Void; 
  633.        Slot  : not null access Glib.Object.GObject_Record'Class; 
  634.        After : Boolean := False); 
  635.    --  the ::page-added signal is emitted in the notebook right after a page 
  636.    --  is added to the notebook. 
  637.    --  
  638.    --  Callback parameters: 
  639.    --    --  "child": the child Gtk.Widget.Gtk_Widget affected 
  640.    --    --  "page_num": the new page number for Child 
  641.  
  642.    Signal_Page_Removed : constant Glib.Signal_Name := "page-removed"; 
  643.    procedure On_Page_Removed 
  644.       (Self  : not null access Gtk_Notebook_Record; 
  645.        Call  : Cb_Gtk_Notebook_Gtk_Widget_Guint_Void; 
  646.        After : Boolean := False); 
  647.    procedure On_Page_Removed 
  648.       (Self  : not null access Gtk_Notebook_Record; 
  649.        Call  : Cb_GObject_Gtk_Widget_Guint_Void; 
  650.        Slot  : not null access Glib.Object.GObject_Record'Class; 
  651.        After : Boolean := False); 
  652.    --  the ::page-removed signal is emitted in the notebook right after a page 
  653.    --  is removed from the notebook. 
  654.    --  
  655.    --  Callback parameters: 
  656.    --    --  "child": the child Gtk.Widget.Gtk_Widget affected 
  657.    --    --  "page_num": the Child page number 
  658.  
  659.    Signal_Page_Reordered : constant Glib.Signal_Name := "page-reordered"; 
  660.    procedure On_Page_Reordered 
  661.       (Self  : not null access Gtk_Notebook_Record; 
  662.        Call  : Cb_Gtk_Notebook_Gtk_Widget_Guint_Void; 
  663.        After : Boolean := False); 
  664.    procedure On_Page_Reordered 
  665.       (Self  : not null access Gtk_Notebook_Record; 
  666.        Call  : Cb_GObject_Gtk_Widget_Guint_Void; 
  667.        Slot  : not null access Glib.Object.GObject_Record'Class; 
  668.        After : Boolean := False); 
  669.    --  the ::page-reordered signal is emitted in the notebook right after a 
  670.    --  page has been reordered. 
  671.    --  
  672.    --  Callback parameters: 
  673.    --    --  "child": the child Gtk.Widget.Gtk_Widget affected 
  674.    --    --  "page_num": the new page number for Child 
  675.  
  676.    type Cb_Gtk_Notebook_Gtk_Direction_Type_Boolean_Boolean is not null access function 
  677.      (Self   : access Gtk_Notebook_Record'Class; 
  678.       Object : Gtk.Enums.Gtk_Direction_Type; 
  679.       P0     : Boolean) return Boolean; 
  680.  
  681.    type Cb_GObject_Gtk_Direction_Type_Boolean_Boolean is not null access function 
  682.      (Self   : access Glib.Object.GObject_Record'Class; 
  683.       Object : Gtk.Enums.Gtk_Direction_Type; 
  684.       P0     : Boolean) return Boolean; 
  685.  
  686.    Signal_Reorder_Tab : constant Glib.Signal_Name := "reorder-tab"; 
  687.    procedure On_Reorder_Tab 
  688.       (Self  : not null access Gtk_Notebook_Record; 
  689.        Call  : Cb_Gtk_Notebook_Gtk_Direction_Type_Boolean_Boolean; 
  690.        After : Boolean := False); 
  691.    procedure On_Reorder_Tab 
  692.       (Self  : not null access Gtk_Notebook_Record; 
  693.        Call  : Cb_GObject_Gtk_Direction_Type_Boolean_Boolean; 
  694.        Slot  : not null access Glib.Object.GObject_Record'Class; 
  695.        After : Boolean := False); 
  696.    --  
  697.    --  Callback parameters: 
  698.  
  699.    type Cb_Gtk_Notebook_Boolean_Boolean is not null access function 
  700.      (Self   : access Gtk_Notebook_Record'Class; 
  701.       Object : Boolean) return Boolean; 
  702.  
  703.    type Cb_GObject_Boolean_Boolean is not null access function 
  704.      (Self   : access Glib.Object.GObject_Record'Class; 
  705.       Object : Boolean) return Boolean; 
  706.  
  707.    Signal_Select_Page : constant Glib.Signal_Name := "select-page"; 
  708.    procedure On_Select_Page 
  709.       (Self  : not null access Gtk_Notebook_Record; 
  710.        Call  : Cb_Gtk_Notebook_Boolean_Boolean; 
  711.        After : Boolean := False); 
  712.    procedure On_Select_Page 
  713.       (Self  : not null access Gtk_Notebook_Record; 
  714.        Call  : Cb_GObject_Boolean_Boolean; 
  715.        Slot  : not null access Glib.Object.GObject_Record'Class; 
  716.        After : Boolean := False); 
  717.  
  718.    Signal_Switch_Page : constant Glib.Signal_Name := "switch-page"; 
  719.    procedure On_Switch_Page 
  720.       (Self  : not null access Gtk_Notebook_Record; 
  721.        Call  : Cb_Gtk_Notebook_Gtk_Widget_Guint_Void; 
  722.        After : Boolean := False); 
  723.    procedure On_Switch_Page 
  724.       (Self  : not null access Gtk_Notebook_Record; 
  725.        Call  : Cb_GObject_Gtk_Widget_Guint_Void; 
  726.        Slot  : not null access Glib.Object.GObject_Record'Class; 
  727.        After : Boolean := False); 
  728.    --  Emitted when the user or a function changes the current page. 
  729.    --  
  730.    --  Callback parameters: 
  731.    --    --  "page": the new current page 
  732.    --    --  "page_num": the index of the page 
  733.  
  734.    ---------------- 
  735.    -- Interfaces -- 
  736.    ---------------- 
  737.    --  This class implements several interfaces. See Glib.Types 
  738.    -- 
  739.    --  - "Buildable" 
  740.  
  741.    package Implements_Gtk_Buildable is new Glib.Types.Implements 
  742.      (Gtk.Buildable.Gtk_Buildable, Gtk_Notebook_Record, Gtk_Notebook); 
  743.    function "+" 
  744.      (Widget : access Gtk_Notebook_Record'Class) 
  745.    return Gtk.Buildable.Gtk_Buildable 
  746.    renames Implements_Gtk_Buildable.To_Interface; 
  747.    function "-" 
  748.      (Interf : Gtk.Buildable.Gtk_Buildable) 
  749.    return Gtk_Notebook 
  750.    renames Implements_Gtk_Buildable.To_Object; 
  751.  
  752. private 
  753.    Tab_Pos_Property : constant Gtk.Enums.Property_Gtk_Position_Type := 
  754.      Gtk.Enums.Build ("tab-pos"); 
  755.    Show_Tabs_Property : constant Glib.Properties.Property_Boolean := 
  756.      Glib.Properties.Build ("show-tabs"); 
  757.    Show_Border_Property : constant Glib.Properties.Property_Boolean := 
  758.      Glib.Properties.Build ("show-border"); 
  759.    Scrollable_Property : constant Glib.Properties.Property_Boolean := 
  760.      Glib.Properties.Build ("scrollable"); 
  761.    Page_Property : constant Glib.Properties.Property_Int := 
  762.      Glib.Properties.Build ("page"); 
  763.    Group_Name_Property : constant Glib.Properties.Property_String := 
  764.      Glib.Properties.Build ("group-name"); 
  765.    Enable_Popup_Property : constant Glib.Properties.Property_Boolean := 
  766.      Glib.Properties.Build ("enable-popup"); 
  767. end Gtk.Notebook;