1. ----------------------------------------------------------------------- 
  2. --               GtkAda - Ada95 binding for Gtk+/Gnome               -- 
  3. --                                                                   -- 
  4. --   Copyright (C) 1998-2000 E. Briot, J. Brobecker and A. Charlet   -- 
  5. --                Copyright (C) 2000-2010, AdaCore                   -- 
  6. --                                                                   -- 
  7. -- This library is free software; you can redistribute it and/or     -- 
  8. -- modify it under the terms of the GNU General Public               -- 
  9. -- License as published by the Free Software Foundation; either      -- 
  10. -- version 2 of the License, or (at your option) any later version.  -- 
  11. --                                                                   -- 
  12. -- This library is distributed in the hope that it will be useful,   -- 
  13. -- but WITHOUT ANY WARRANTY; without even the implied warranty of    -- 
  14. -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU -- 
  15. -- General Public License for more details.                          -- 
  16. --                                                                   -- 
  17. -- You should have received a copy of the GNU General Public         -- 
  18. -- License along with this library; if not, write to the             -- 
  19. -- Free Software Foundation, Inc., 59 Temple Place - Suite 330,      -- 
  20. -- Boston, MA 02111-1307, USA.                                       -- 
  21. --                                                                   -- 
  22. -- -- -- -- -- -- -- -- -- -- -- --
  23. ----------------------------------------------------------------------- 
  24.  
  25. --  <description> 
  26. --  This widget implements a top level window. 
  27. --  It is used as the base class for dialogs, ... 
  28. -- 
  29. --  A window has both a default widget (to which events are sent if no other 
  30. --  widget has been selected and has the focus), and a focus widget (which 
  31. --  gets the events and overrides the default widget). 
  32. -- 
  33. --  You can set many hints on the window (its minimum and maximum size, its 
  34. --  decoration, etc.) but these are only hints to the window manager, which 
  35. --  might not respect them. 
  36. -- 
  37. --  A useful hint, respected by most window managers, can be used to force 
  38. --  some secondary windows to stay on top of the main window on the screen 
  39. --  (for instance, so that a smaller window can not be hidden by a bigger 
  40. --  one). See the function Set_Transient_For below. 
  41. -- 
  42. --  A window can also be modal, i.e. grab all the mouse and keyboard events 
  43. --  in the application while it is displayed. 
  44. -- 
  45. --  </description> 
  46. --  <c_version>2.16.6</c_version> 
  47. --  <group>Windows</group> 
  48. --  <screenshot>gtk-window</screenshot> 
  49.  
  50. with Glib.Object; 
  51. with Glib.Properties; 
  52. with Gdk.Event; 
  53. with Gdk.Pixbuf; 
  54. with Gdk.Types; 
  55. with Gdk.Window; 
  56. with Gtk.Accel_Group; 
  57. with Gtk.Bin; 
  58. with Gtk.Enums; 
  59. with Gtk.Widget; 
  60.  
  61. package Gtk.Window is 
  62.  
  63.    type Gtk_Window_Record is new Bin.Gtk_Bin_Record with private; 
  64.    type Gtk_Window is access all Gtk_Window_Record'Class; 
  65.  
  66.    type Gtk_Window_Group_Record is 
  67.      new Glib.Object.GObject_Record with null record; 
  68.    type Gtk_Window_Group is access all Gtk_Window_Group_Record'Class; 
  69.  
  70.    procedure Gtk_New 
  71.      (Window   : out Gtk_Window; 
  72.       The_Type : Gtk.Enums.Gtk_Window_Type := Gtk.Enums.Window_Toplevel); 
  73.    --  Create a new window. 
  74.    --  The_Type specifies the type of the window, and can be either a 
  75.    --  top level window, a dialog or a popup window. You will most often only 
  76.    --  need to use Window_Toplevel, the other types are mostly used internally 
  77.    --  by gtk+. 
  78.    --  A Popup window is used to display a temporary information window. It has 
  79.    --  no borders nor resizing handles. 
  80.  
  81.    procedure Initialize 
  82.      (Window   : access Gtk_Window_Record'Class; 
  83.       The_Type : Gtk.Enums.Gtk_Window_Type); 
  84.    --  Internal initialization function. 
  85.    --  See the section "Creating your own widgets" in the documentation. 
  86.  
  87.    function Get_Type return Glib.GType; 
  88.    --  Return the internal value associated with a Gtk_Window. 
  89.  
  90.    procedure Set_Title 
  91.      (Window : access Gtk_Window_Record; Title : UTF8_String); 
  92.    function Get_Title (Window : access Gtk_Window_Record) return UTF8_String; 
  93.    --  Change the title of the window, as it appears in the title bar. 
  94.    --  Note that on some systems you might not be able to change it. 
  95.  
  96.    procedure Set_Wmclass 
  97.      (Window        : access Gtk_Window_Record; 
  98.       Wmclass_Name  : String; 
  99.       Wmclass_Class : String); 
  100.    --  Don't use this function. It sets the X Window System "class" and 
  101.    --  "name" hints for a window. According to the ICCCM, you should 
  102.    --  always set these to the same value for all windows in an 
  103.    --  application, and GTK sets them to that value by default, so calling 
  104.    --  this function is sort of pointless. However, you may want to call 
  105.    --  Set_Role on each window in your application, for the 
  106.    --  benefit of the session manager. Setting the role allows the window 
  107.    --  manager to restore window positions when loading a saved session. 
  108.  
  109.    procedure Set_Role (Window : access Gtk_Window_Record; Role : String); 
  110.    function Get_Role  (Window : access Gtk_Window_Record) return String; 
  111.    --  In combination with the window title, the window role allows a 
  112.    --  window manager to identify "the same" window when an application is 
  113.    --  restarted. So for example you might set the "toolbox" role on your 
  114.    --  app's toolbox window, so that when the user restarts their session, 
  115.    --  the window manager can put the toolbox back in the same place. 
  116.    --  If a window already has a unique title, you don't need to set the 
  117.    --  role, since the WM can use the title to identify the window when 
  118.    --  restoring the session. 
  119.    --  Role: unique identifier for the window to be used when restoring a 
  120.    --  session 
  121.  
  122.    function Activate_Focus (Window : access Gtk_Window_Record) return Boolean; 
  123.    --  Call Gtk.Widget.Activate on the widget that currently has the focus in 
  124.    --  the window, ie sends an "activate" signal to that widget. Note that this 
  125.    --  signal does not really exists and is mapped to some widget-specific 
  126.    --  signal. 
  127.    --  Return True if the widget could be activated, False otherwise. 
  128.    --  The Focus widget is set through a signal "set_focus". 
  129.  
  130.    function Activate_Default 
  131.      (Window : access Gtk_Window_Record) return Boolean; 
  132.    --  Activate the default widget in the window. 
  133.    --  In other words, send an "activate" signal to that widget. Note that 
  134.    --  this signal is a virtual one and is mapped to some widget specific 
  135.    --  signal. 
  136.    --  Return False is the widget could not be activated or if there was 
  137.    --  no default widget. 
  138.    --  You can set the default widget with the following calls: 
  139.    -- 
  140.    --     Gtk.Widget.Set_Flags (Widget, Can_Default); 
  141.    --     Gtk.Widget.Grab_Default (Widget); 
  142.  
  143.    procedure Set_Transient_For 
  144.      (Window : access Gtk_Window_Record; 
  145.       Parent : access Gtk_Window_Record'Class); 
  146.    function Get_Transient_For 
  147.      (Window : access Gtk_Window_Record) return Gtk_Window; 
  148.    --  Specify that Window is a transient window. 
  149.    --  A transient window is a temporary window, like a popup menu or a 
  150.    --  dialog box). Parent is the toplevel window of the application to which 
  151.    --  Window belongs. A window that has set this can expect less decoration 
  152.    --  from the window manager (for instance no title bar and no borders). 
  153.    --  (see XSetTransientForHint(3) on Unix systems) 
  154.    -- 
  155.    --  The main usage of this function is to force Window to be on top of 
  156.    --  Parent on the screen at all times. Most window managers respect this 
  157.    --  hint, even if this is not mandatory. 
  158.  
  159.    procedure Set_Type_Hint 
  160.      (Window : access Gtk_Window_Record; 
  161.       Hint   : Gdk.Window.Gdk_Window_Type_Hint); 
  162.    function Get_Type_Hint 
  163.      (Window : access Gtk_Window_Record) 
  164.       return Gdk.Window.Gdk_Window_Type_Hint; 
  165.    --  allow the window manager to decorate and handle the window in a way 
  166.    --  which is suitable to the function of the window in your application. 
  167.    --  This function should be called before the window becomes visible. 
  168.  
  169.    procedure Set_Keep_Above 
  170.      (Window  : access Gtk_Window_Record; Setting : Boolean); 
  171.    procedure Set_Keep_Below 
  172.      (Window  : access Gtk_Window_Record; Setting : Boolean); 
  173.    --  Asks to keep Window above, so that it stays on top. Note that you 
  174.    --  shouldn't assume the window is definitely above afterward, because other 
  175.    --  entities (e.g. the user or window managers) could not keep it above, and 
  176.    --  not all window managers support keeping windows above. But normally the 
  177.    --  window will end kept above. Just don't write code that crashes if not. 
  178.    -- 
  179.    --  It's permitted to call this function before showing a window, in which 
  180.    --  case the window will be kept above when it appears onscreen initially. 
  181.    -- 
  182.    --  You can track the above state via the "window_state_event" signal on 
  183.    --  Window. 
  184.    -- 
  185.    --  Note that, according to the "Extended Window Manager Hints" 
  186.    --  specification, the above state is mainly meant for user preferences and 
  187.    --  should not be used by applications e.g. for drawing attention to their 
  188.    --  dialogs. 
  189.  
  190.    procedure Set_Auto_Startup_Notification (Setting : Boolean); 
  191.    --  By default, after showing the first Window for each screen, GTK+ calls 
  192.    --  gdk_notify_startup_complete(). Call this function to disable the 
  193.    --  automatic startup notification. You might do this if your first window 
  194.    --  is a splash screen, and you want to delay notification until after your 
  195.    --  real main window has been shown, for example. 
  196.    -- 
  197.    --  In that example, you would disable startup notification temporarily, 
  198.    --  show your splash screen, then re-enable it so that showing the main 
  199.    --  window would automatically result in notification. 
  200.    -- 
  201.    --  Notification is used by the desktop environment to show the user that 
  202.    --  your application is still loading. 
  203.  
  204.    procedure Set_Startup_Id 
  205.      (Window     : access Gtk_Window_Record; 
  206.       Startup_Id : String); 
  207.    --  Startup notification identifiers are used by desktop environment to 
  208.    --  track application startup, to provide user feedback and other 
  209.    --  features. This function changes the corresponding property on the 
  210.    --  underlying Gdk_Window. Normally, startup identifier is managed 
  211.    --  automatically and you should only use this function in special cases 
  212.    --  like transferring focus from other processes. You should use this 
  213.    --  function before calling Present or any equivalent function generating 
  214.    --  a window map event. 
  215.    -- 
  216.    --  This function is only useful on X11, not with other GTK+ targets. 
  217.  
  218.    function Get_Deletable (Window : access Gtk_Window_Record) return Boolean; 
  219.    procedure Set_Deletable 
  220.      (Window  : access Gtk_Window_Record; 
  221.       Setting : Boolean); 
  222.    --  By default, windows have a close button in the window frame. Some 
  223.    --  window managers allow GTK+ to disable this button. If you set the 
  224.    --  deletable property to False using this function, GTK+ will do its best 
  225.    --  to convince the window manager not to show a close button. Depending on 
  226.    --  the system, this function may not have any effect when called on a 
  227.    --  window that is already visible, so you should call it before calling 
  228.    --  Gtk.Window.Show. 
  229.    -- 
  230.    --  On Windows, this function always works, since there's no window manager 
  231.    --  policy involved. 
  232.  
  233.    procedure Set_Destroy_With_Parent 
  234.      (Window  : access Gtk_Window_Record; 
  235.       Setting : Boolean := True); 
  236.    function Get_Destroy_With_Parent 
  237.      (Window : access Gtk_Window_Record) return Boolean; 
  238.    --  Set whether destroying the transient parent of Window will also destroy 
  239.    --  Window itself. 
  240.    --  This is useful for dialogs that shouldn't persist beyond the lifetime 
  241.    --  of the main window they're associated with, for example. 
  242.  
  243.    procedure Set_Geometry_Hints 
  244.      (Window          : access Gtk_Window_Record; 
  245.       Geometry_Widget : Gtk.Widget.Gtk_Widget; 
  246.       Geometry        : Gdk.Window.Gdk_Geometry; 
  247.       Geom_Mask       : Gdk.Window.Gdk_Window_Hints); 
  248.    --  Specify some geometry hints for the window. 
  249.    --  This includes its minimal and maximal sizes, ... 
  250.    --  These attributes are specified in Geometry. 
  251.    --  Geom_Mask indicates which of the fields in Geometry are set. 
  252.    --  Geometry_Widget can be null (and thus is not an access parameter). It 
  253.    --  adds some extra size to Geometry based on the actual size of 
  254.    --  Geometry_Widget (the extra amount is Window'Size - Geometry_Widget'Size) 
  255.    -- 
  256.    --  Geometry.Base_* indicates the size that is used by the window manager 
  257.    --  to report the size: for instance, if Base_Width = 600 and actual width 
  258.    --  is 200, the window manager will indicate a width of -400. 
  259.    -- 
  260.    --  If your window manager respects the hints (and its doesn't have to), 
  261.    --  then the user will never be able to resize the window to a size not 
  262.    --  in Geometry.Min_* .. Geometry.Max_*. 
  263.    -- 
  264.    --  Geometry.*_Inc specifies by which amount the size will be multiplied. 
  265.    --  For instance, if Width_Inc = 50 and the size reported by the Window 
  266.    --  Manager is 2x3, then the actual width of the window is 100. 
  267.    --  Your window's size will always be a multiple of the *_Inc values. 
  268.    -- 
  269.    --  Geometry.*_Aspect specifies the aspect ratio for the window. The window 
  270.    --  will always be resized so that the ratio between its width and its 
  271.    --  height remains in the range Min_Aspect .. Max_Aspect. 
  272.  
  273.    procedure Set_Decorated 
  274.      (Window  : access Gtk_Window_Record; 
  275.       Setting : Boolean := True); 
  276.    function Get_Decorated (Window : access Gtk_Window_Record) return Boolean; 
  277.    --  By default, windows are decorated with a title bar, resize 
  278.    --  controls, etc. Some window managers allow GtkAda to disable these 
  279.    --  decorations, creating a borderless window. If you set the decorated 
  280.    --  property to False using this function, GtkAda will do its best to 
  281.    --  convince the window manager not to decorate the window. 
  282.  
  283.    procedure Set_Modal 
  284.      (Window : access Gtk_Window_Record;  Modal  : Boolean := True); 
  285.    function Get_Modal (Window : access Gtk_Window_Record) return Boolean; 
  286.    --  Define the window as being Modal. 
  287.    --  It will grab the input from the keyboard and the mouse while it is 
  288.    --  displayed and will release it when it is hidden. The grab is only in 
  289.    --  effect for the windows that belong to the same application, and will not 
  290.    --  affect other applications running on the same screen. 
  291.    --  In cunjunction with Gtk.Main.Main, this is the easiest way to show a 
  292.    --  dialog to which the user has to answer before the application can 
  293.    --  continue. 
  294.  
  295.    procedure Set_Skip_Pager_Hint 
  296.      (Window  : access Gtk_Window_Record; 
  297.       Setting : Boolean); 
  298.    function Get_Skip_Taskbar_Hint 
  299.      (Window : access Gtk_Window_Record) 
  300.       return Boolean; 
  301.    --  Windows may set a hint asking the desktop environment not to display 
  302.    --  the window in the pager. This function sets this hint. 
  303.    --  (A "pager" is any desktop navigation tool such as a workspace 
  304.    --  switcher that displays a thumbnail representation of the windows 
  305.    --  on the screen). 
  306.  
  307.    procedure Set_Skip_Taskbar_Hint 
  308.      (Window  : access Gtk_Window_Record; 
  309.       Setting : Boolean); 
  310.    function Get_Skip_Pager_Hint 
  311.      (Window : access Gtk_Window_Record) 
  312.       return Boolean; 
  313.    --  Windows may set a hint asking the desktop environment not to display 
  314.    --  the window in the task bar. This function sets this hint. 
  315.  
  316.    procedure Set_Urgency_Hint 
  317.      (Window  : access Gtk_Window_Record; 
  318.       Setting : Boolean); 
  319.    function Get_Urgency_Hint 
  320.      (Window : access Gtk_Window_Record) 
  321.       return Boolean; 
  322.    --  Windows may set a hint asking the desktop environment to draw 
  323.    --  the users attention to the window. This function sets this hint. 
  324.  
  325.    function List_Toplevels return Gtk.Widget.Widget_List.Glist; 
  326.    --  Return a list of all existing toplevel windows. 
  327.    --  The widgets in the list are not individually referenced. If you want 
  328.    --  to iterate through the list and perform actions involving 
  329.    --  callbacks that might destroy the widgets, you must "ref"erence 
  330.    --  all the widgets in the list first and then unref all the widgets 
  331.    --  afterwards. 
  332.    --  The list itself must be freed by the caller 
  333.  
  334.    procedure Present (Window : access Gtk_Window_Record); 
  335.    --  Present a window to the user. 
  336.    --  This may mean raising the window in the stacking order, deiconifying it, 
  337.    --  moving it to the current desktop, and/or giving it the keyboard focus, 
  338.    --  possibly dependent on the user's platform, window manager, and 
  339.    --  preferences. 
  340.    -- 
  341.    --  If Window is hidden, this function calls Gtk.Widget.Show as well. 
  342.    -- 
  343.    --  If you are calling this function in response to a user interaction, it 
  344.    --  is preferable to use Present_With_Time. 
  345.  
  346.    procedure Present_With_Time 
  347.      (Window    : access Gtk_Window_Record; 
  348.       Timestamp : Guint32); 
  349.    --  Present a window to the user in response to a user interaction. 
  350.    --  Timestamp is the timestamp of the user interaction (typically a button 
  351.    --  or key press event) which triggered this call. 
  352.    -- 
  353.    --  This function should be used when the user tries to open a window 
  354.    --  that's already open. Say for example the preferences dialog is 
  355.    --  currently open, and the user chooses Preferences from the menu 
  356.    --  a second time; use Present to move the already-open dialog 
  357.    --  where the user can see it. 
  358.  
  359.    procedure Stick (Window : access Gtk_Window_Record); 
  360.    --  Ask to stick Window, which means that it will appear on all user 
  361.    --  desktops. Note that you shouldn't assume the window is definitely 
  362.    --  stuck afterward, because other entities (e.g. the user or window 
  363.    --  manager) could unstick it again, and some window managers do not 
  364.    --  support sticking windows. But normally the window will end up 
  365.    --  stuck. 
  366.    -- 
  367.    --  It's permitted to call this function before showing a window. 
  368.    -- 
  369.    --  You can track stickiness via the "window_state_event" signal 
  370.    --  on Gtk_Widget. 
  371.  
  372.    procedure Unstick (Window : access Gtk_Window_Record); 
  373.    --  Ask to unstick Window, which means that it will appear on only 
  374.    --  one of the user's desktops. Note that you shouldn't assume the 
  375.    --  window is definitely unstuck afterward, because other entities 
  376.    --  (e.g. the user or window manager) could stick it again. But 
  377.    --  normally the window will end up stuck. 
  378.    -- 
  379.    --  You can track stickiness via the "window_state_event" signal 
  380.    --  on Gtk_Widget. 
  381.  
  382.    function Get_Opacity (Window : access Gtk_Window_Record) return Gdouble; 
  383.    procedure Set_Opacity 
  384.      (Window  : access Gtk_Window_Record; 
  385.       Opacity : Gdouble); 
  386.    --  Request the windowing system to make Window partially transparent, 
  387.    --  with opacity 0.0 being fully transparent and 1.0 fully opaque. (Values 
  388.    --  of the opacity parameter are clamped to the [0.0,1.0] range.) On X11 
  389.    --  this has any effect only on X screens with a compositing manager 
  390.    --  running. See Gtk.Widget.Is_Composited. On Windows it should always work. 
  391.    -- 
  392.    --  Note that on Windows, setting a window's opacity after the window has 
  393.    --  been shown causes it to flicker once. 
  394.  
  395.    -------------- 
  396.    -- Position -- 
  397.    -------------- 
  398.  
  399.    procedure Move (Window : access Gtk_Window_Record; X, Y : Gint); 
  400.    --  Asks the window manager to move Window to the given position. Window 
  401.    --  managers are free to ignore this; most window managers ignore requests 
  402.    --  for initial window positions (instead using a user-defined placement 
  403.    --  algorithm) and honor requests after the window has already been shown. 
  404.    -- 
  405.    --  Note: the position is the position of the gravity-determined reference 
  406.    --  point for the window. The gravity determines two things: first, the 
  407.    --  location of the reference point in root window coordinates; and second, 
  408.    --  which point on the window is positioned at the reference point. 
  409.    -- 
  410.    --  By default the gravity is GRAVITY_NORTH_WEST, so the reference point is 
  411.    --  simply the (x, y) supplied to Move. The top-left corner of the window 
  412.    --  decorations (aka window frame or border) will be placed at (x, y). 
  413.    --  Therefore, to position a window at the top left of the screen, you want 
  414.    --  to use the default gravity (which is GRAVITY_NORTH_WEST) and move the 
  415.    --  window to 0,0. 
  416.    -- 
  417.    --  To position a window at the bottom right corner of the screen, you would 
  418.    --  set GRAVITY_SOUTH_EAST, which means that the reference point is at x + 
  419.    --  the window width and y + the window height, and the bottom-right corner 
  420.    --  of the window border will be placed at that reference point. So, to 
  421.    --  place a window in the bottom right corner you would first set gravity to 
  422.    --  south east, then write: 
  423.    --    Move (Window, Gdk_Screen_Width  - Window_Width, 
  424.    --                  Gdk_Screen_Height - Window_Height); 
  425.  
  426.    procedure Set_Position 
  427.      (Window   : access Gtk_Window_Record; 
  428.       Position : Gtk.Enums.Gtk_Window_Position); 
  429.    --  Specify how the position of the window should be computed. 
  430.    --  If Position is Win_Pos_Center_Always or Win_Pos_Center, then the window 
  431.    --  is centered on the screen. In the first case, it is also recentered 
  432.    --  when the window is resized with Gtk.Widget.Set_Usize (ie except on 
  433.    --  user action). 
  434.    --  If Position is Win_Pos_Mouse, then the window is positioned so that it 
  435.    --  centered around the mouse. 
  436.    --  If Position is Win_Pos_None, no calculation is done. If 
  437.    --  Gtk.Widget.Set_Uposition has been called, it is respected. This is the 
  438.    --  default case. 
  439.  
  440.    procedure Get_Position 
  441.      (Window         : access Gtk_Window_Record; 
  442.       Root_X, Root_Y : out Gint); 
  443.    --  This function returns the position you need to pass to gtk.window.move 
  444.    --  to keep Window in its current position. This means that the meaning of 
  445.    --  the returned value varies with window gravity. See Gtk.Window.Move for 
  446.    --  more details. 
  447.    -- 
  448.    --  If you haven't changed the window gravity, its gravity will be 
  449.    --  GRAVITY_NORTH_WEST. This means that Get_Position gets the position of 
  450.    --  the top-left corner of the window manager frame for the window. 
  451.    --  gtk.window.move sets the position of this same top-left corner. 
  452.    -- 
  453.    --  Get_Position is not 100% reliable because the X Window System does not 
  454.    --  specify a way to obtain the geometry of the decorations placed on a 
  455.    --  window by the window manager. Thus GTK+ is using a "best guess" that 
  456.    --  works with most window managers. 
  457.    -- 
  458.    --  Moreover, nearly all window managers are historically broken with 
  459.    --  respect to their handling of window gravity. So moving a window to its 
  460.    --  current position as returned by Get_Position tends to result in moving 
  461.    --  the window slightly. Window managers are slowly getting better over 
  462.    --  time. 
  463.    -- 
  464.    --  If a window has gravity GRAVITY_STATIC the window manager frame is not 
  465.    --  relevant, and thus Get_Position will always produce accurate results. 
  466.    --  However you can't use static gravity to do things like place a window in 
  467.    --  a corner of the screen, because static gravity ignores the window 
  468.    --  manager decorations. 
  469.    -- 
  470.    --  If you are saving and restoring your application's window positions, you 
  471.    --  should know that it's impossible for applications to do this without 
  472.    --  getting it somewhat wrong because applications do not have sufficient 
  473.    --  knowledge of window manager state. The Correct Mechanism is to support 
  474.    --  the session management protocol (see the "GnomeClient" object in the 
  475.    --  GNOME libraries for example) and allow the window manager to save your 
  476.    --  window sizes and positions. 
  477.  
  478.    procedure Begin_Move_Drag 
  479.      (Window    : access Gtk_Window_Record; 
  480.       Button    : Gint; 
  481.       Root_X    : Gint; 
  482.       Root_Y    : Gint; 
  483.       Timestamp : Guint32); 
  484.    --  Starts moving a window. This function is used if an application has 
  485.    --  window movement grips. When GDK can support it, the window movement will 
  486.    --  be done using the standard mechanism for the window manager or windowing 
  487.    --  system. Otherwise, GDK will try to emulate window movement, potentially 
  488.    --  not all that well, depending on the windowing system. 
  489.    --  (Root_X, Root_Y): Position where the user clicked to initiate the drag, 
  490.    --  in root window coordinates. Timestamp is the timestamp of the event that 
  491.    --  initiated the drag 
  492.  
  493.    function Parse_Geometry 
  494.      (Window   : access Gtk_Window_Record; 
  495.       Geometry : String) 
  496.       return Boolean; 
  497.    --  Parses a standard X Window System geometry string - see the manual page 
  498.    --  for X (type 'man X') for details on this. Parse_Geometry does work on 
  499.    --  all GTK+ ports including Win32 but is primarily intended for an X 
  500.    --  environment. 
  501.    -- 
  502.    --  If either a size or a position can be extracted from the geometry 
  503.    --  string, Parse_Geometry returns True and calls Set_Default_Size and/or 
  504.    --  Move to resize/move the window. 
  505.    -- 
  506.    --  If Parse_Geometry returns True, it will also set the HINT_USER_POS 
  507.    --  and/or HINT_USER_SIZE hints indicating to the window manager that the 
  508.    --  size/position of the window was user-specified. This causes most window 
  509.    --  managers to honor the geometry. 
  510.    -- 
  511.    --  Note that for Parse_Geometry to work as expected, it has to be called 
  512.    --  when the window has its "final" size, i.e. after calling Show_All on the 
  513.    --  contents and Set_Geometry_Hints on the window. 
  514.  
  515.    ----------- 
  516.    -- Sizes -- 
  517.    ----------- 
  518.  
  519.    procedure Set_Resizable 
  520.      (Window    : access Gtk_Window_Record; 
  521.       Resizable : Boolean := True); 
  522.    function Get_Resizable (Window : access Gtk_Window_Record) return Boolean; 
  523.    --  Sets or gets whether the user can resize a window. 
  524.    --  Windows are user resizable by default. 
  525.  
  526.    procedure Set_Gravity 
  527.      (Window  : access Gtk_Window_Record; 
  528.       Gravity : Gdk.Window.Gdk_Gravity); 
  529.    function Get_Gravity 
  530.      (Window : access Gtk_Window_Record) return Gdk.Window.Gdk_Gravity; 
  531.    --  Window gravity defines the "reference point" to be used when 
  532.    --  positioning or resizing a window. Calls to 
  533.    --  Gtk.Widget.Set_UPosition will position a different point on the 
  534.    --  window depending on the window gravity. When the window changes size 
  535.    --  the reference point determined by the window's gravity will stay in 
  536.    --  a fixed location. 
  537.    -- 
  538.    --  See Gdk_Gravity for full details. To briefly summarize, 
  539.    --  Gravity_North_West means that the reference point is the 
  540.    --  northwest (top left) corner of the window 
  541.    --  frame. Gravity_South_East would be the bottom right corner of 
  542.    --  the frame, and so on. If you want to position the window contents, 
  543.    --  rather than the window manager's frame, Gravity_Static moves 
  544.    --  the reference point to the northwest corner of the Gtk_Window 
  545.    --  itself. 
  546.    -- 
  547.    --  The default window gravity is Gravity_North_West. 
  548.  
  549.    procedure Set_Has_Frame (Window : access Gtk_Window_Record); 
  550.    function Get_Has_Frame  (Window : access Gtk_Window_Record) return Boolean; 
  551.    --  If this function is called on a window before it is realized 
  552.    --  or showed it will have a "frame" window around widget-window. 
  553.    --  Using the signal frame_event you can receive all events targeted at the 
  554.    --  frame. 
  555.    -- 
  556.    --  This function is used by the linux-fb port to implement managed 
  557.    --  windows, but it could concievably be used by X-programs that 
  558.    --  want to do their own window decorations. 
  559.  
  560.    procedure Set_Frame_Dimensions 
  561.      (Window                   : access Gtk_Window_Record; 
  562.       Left, Top, Right, Bottom : Gint); 
  563.    procedure Get_Frame_Dimensions 
  564.      (Window                   : access Gtk_Window_Record; 
  565.       Left, Top, Right, Bottom : out Gint); 
  566.    --  Change the size of the frame border. 
  567.    --  This has only an effect for windows with frames (see Set_Has_Frame). 
  568.  
  569.    procedure Fullscreen   (Window : access Gtk_Window_Record); 
  570.    procedure Unfullscreen (Window : access Gtk_Window_Record); 
  571.    --  Ask to place Window in fullscreen state. 
  572.    --  You shouldn't assume the window is definitely full screen afterward, 
  573.    --  because other entities (user or window manager) could unfullscreen it 
  574.    --  again and not all window managers honor requests to fullscreen windows. 
  575.    --  You can track the fullscreen state via the "window_state_event" signal. 
  576.  
  577.    procedure Iconify (Window : access Gtk_Window_Record); 
  578.    --  Ask to iconify Window. 
  579.    --  Note that you shouldn't assume the window is definitely iconified 
  580.    --  afterward, because other entities (e.g. the user or window manager) 
  581.    --  could deiconify it again, or there may not be a window manager in which 
  582.    --  case iconification isn't possible, etc. But normally the window will end 
  583.    --  up iconified. Just don't write code that crashes if not. 
  584.    -- 
  585.    --  It's permitted to call this function before showing a window, 
  586.    --  in which case the window will be iconified before it ever appears 
  587.    --  onscreen. 
  588.    -- 
  589.    --  You can track iconification via the "window_state_event" signal 
  590.    --  on Gtk_Widget. 
  591.  
  592.    procedure Deiconify (Window : access Gtk_Window_Record); 
  593.    --  Ask to deiconify Window. 
  594.    --  Note that you shouldn't assume the window is definitely deiconified 
  595.    --  afterward, because other entities (e.g. the user or window manager) 
  596.    --  could iconify it again before your code which assumes deiconification 
  597.    --  gets to run. 
  598.    -- 
  599.    --  You can track iconification via the "window_state_event" signal 
  600.    --  on Gtk_Widget. 
  601.  
  602.    procedure Maximize (Window : access Gtk_Window_Record); 
  603.    --  Ask to maximize Window, so that it becomes full-screen. 
  604.    --  Note that you shouldn't assume the window is definitely maximized 
  605.    --  afterward, because other entities (e.g. the user or window manager) 
  606.    --  could unmaximize it again, and not all window managers support 
  607.    --  maximization. But normally the window will end up maximized. 
  608.    -- 
  609.    --  It's permitted to call this function before showing a window, 
  610.    --  in which case the window will be maximized when it appears onscreen 
  611.    --  initially. 
  612.    -- 
  613.    --  You can track maximization via the "window_state_event" signal 
  614.    --  on Gtk_Widget. 
  615.  
  616.    procedure Unmaximize (Window : access Gtk_Window_Record); 
  617.    --  Ask to unmaximize Window. 
  618.    --  Note that you shouldn't assume the window is definitely unmaximized 
  619.    --  afterward, because other entities (e.g. the user or window manager) 
  620.    --  could maximize it again, and not all window managers honor requests to 
  621.    --  unmaximize. But normally the window will end up unmaximized. 
  622.    -- 
  623.    --  You can track maximization via the "window_state_event" signal 
  624.    --  on Gtk_Widget. 
  625.  
  626.    procedure Set_Default_Size 
  627.      (Window : access Gtk_Window_Record; Width : Gint; Height : Gint); 
  628.    procedure Get_Default_Size 
  629.      (Window : access Gtk_Window_Record; 
  630.       Width  : out Gint; 
  631.       Height : out Gint); 
  632.    --  Sets the default size of a window. If the window's "natural" size (its 
  633.    --  size request) is larger than the default, the default will be 
  634.    --  ignored. More generally, if the default size does not obey the geometry 
  635.    --  hints for the window (Set_Geometry_Hints can be used to set these 
  636.    --  explicitly), the default size will be clamped to the nearest permitted 
  637.    --  size. 
  638.    -- 
  639.    --  Unlike Gtk.Widget.Set_Size_Request, which sets a size request for a 
  640.    --  widget and thus would keep users from shrinking the window, this 
  641.    --  function only sets the initial size, just as if the user had resized the 
  642.    --  window themselves. Users can still shrink the window again as they 
  643.    --  normally would. Setting a default size of -1 means to use the "natural" 
  644.    --  default size (the size request of the window). 
  645.    -- 
  646.    --  For more control over a window's initial size and how resizing works, 
  647.    --  investigate Set_Geometry_Hints. 
  648.    -- 
  649.    --  For some uses, Resize is a more appropriate function.  Resize changes 
  650.    --  the current size of the window, rather than the size to be used on 
  651.    --  initial display. Resize always affects the window itself, not the 
  652.    --  geometry widget. 
  653.    -- 
  654.    --  The default size of a window only affects the first time a window is 
  655.    --  shown; if a window is hidden and re-shown, it will remember the size it 
  656.    --  had prior to hiding, rather than using the default size. 
  657.    -- 
  658.    --  Windows can't actually be 0x0 in size, they must be at least 1x1, but 
  659.    --  passing 0 for Width and Height is OK, resulting in a 1x1 default size. 
  660.    -- 
  661.    --  This has no effect on Popup windows (set in call to Gtk_New). 
  662.  
  663.    procedure Resize 
  664.      (Window : access Gtk_Window_Record; 
  665.       Width, Height : Gint); 
  666.    --  Resize the window as if the user had done so, obeying geometry 
  667.    --  constraints. The default geometry constraint is that windows may 
  668.    --  not be smaller than their size request; to override this 
  669.    --  constraint, call Gtk.Widget.Set_Size_Request to set the window's 
  670.    --  request to a smaller value. 
  671.    -- 
  672.    --  If Resize is called before showing a window for the -- first time, it 
  673.    --  overrides any default size set with -- Set_Default_Size. 
  674.    -- 
  675.    --  Windows may not be resized smaller than 1 by 1 pixels. However, as a 
  676.    --  special case, if both Width and Height are set to -1, the best requested 
  677.    --  size is recomputed for the window, and used. 
  678.  
  679.    procedure Get_Size 
  680.      (Window        : access Gtk_Window_Record; 
  681.       Width, Height : out Gint); 
  682.    --  Obtains the current size of Window. If Window is not onscreen, it 
  683.    --  returns the size GTK+ will suggest to the window manager for the initial 
  684.    --  window size (but this is not reliably the same as the size the window 
  685.    --  manager will actually select). The size obtained by Get_Size is the last 
  686.    --  size received in Gdk_Event_Configure, that is, GTK+ uses its 
  687.    --  locally-stored size, rather than querying the X server for the size. As 
  688.    --  a result, if you call Resize then immediately call Get_Size, the size 
  689.    --  won't have taken effect yet. After the window manager processes the 
  690.    --  resize request, GTK+ receives notification that the size has changed via 
  691.    --  a configure event, and the size of the window gets updated. 
  692.    -- 
  693.    --  Note 1: Nearly any use of this function creates a race condition, 
  694.    --  because the size of the window may change between the time that you get 
  695.    --  the size and the time that you perform some action assuming that size is 
  696.    --  the current size. To avoid race conditions, connect to "configure_event" 
  697.    --  on the window and adjust your size-dependent state to match the size 
  698.    --  delivered in the Gdk_Event_Configure. 
  699.    -- 
  700.    --  Note 2: The returned size does *not* include the size of the window 
  701.    --  manager decorations (aka the window frame or border). Those are not 
  702.    --  drawn by GTK+ and GTK+ has no reliable method of determining their size. 
  703.    -- 
  704.    --  Note 3: If you are getting a window size in order to position the window 
  705.    --  onscreen, there may be a better way. The preferred way is to simply set 
  706.    --  the window's semantic type with Set_Type_Hint, which allows the window 
  707.    --  manager to e.g. center dialogs. Also, if you set the transient parent of 
  708.    --  dialogs with Set_Transient_For window managers will often center the 
  709.    --  dialog over its parent window. It's much preferred to let the window 
  710.    --  manager handle these things rather than doing it yourself, because all 
  711.    --  apps will behave consistently and according to user prefs if the window 
  712.    --  manager handles it. Also, the window manager can take the size of the 
  713.    --  window decorations/border into account, while your application cannot. 
  714.    -- 
  715.    --  In any case, if you insist on application-specified window positioning, 
  716.    --  there's *still*> a better way than doing it yourself - Set_Position will 
  717.    --  frequently handle the details for you. 
  718.  
  719.    procedure Reshow_With_Initial_Size (Window : access Gtk_Window_Record); 
  720.    --  Hide Window, then reshows it, resetting the default size and position. 
  721.    --  Used by GUI builders only. 
  722.  
  723.    procedure Begin_Resize_Drag 
  724.      (Window    : access Gtk_Window_Record; 
  725.       Edge      : Gdk.Window.Gdk_Window_Edge; 
  726.       Button    : Gint; 
  727.       Root_X    : Gint; 
  728.       Root_Y    : Gint; 
  729.       Timestamp : Guint32); 
  730.    --  Starts resizing a window. This function is used if an application has 
  731.    --  window resizing controls. When GDK can support it, the resize will be 
  732.    --  done using the standard mechanism for the window manager or windowing 
  733.    --  system. Otherwise, GDK will try to emulate window resizing, potentially 
  734.    --  not all that well, depending on the windowing system. 
  735.  
  736.    ----------- 
  737.    -- Icons -- 
  738.    ----------- 
  739.  
  740.    procedure Set_Icon_Name (Window : access Gtk_Window_Record; Name : String); 
  741.    function Get_Icon_Name  (Window : access Gtk_Window_Record) return String; 
  742.    --  Set the icon for the window from a named themed icon. See 
  743.    --  Gtk.Icon_Them for more details. This has nothing to do with the 
  744.    --  WM_ICON_NAME property which is mentioned in the ICCCM (and related to 
  745.    --  window managers) 
  746.  
  747.    procedure Set_Icon 
  748.      (Window : access Gtk_Window_Record; Icon : Gdk.Pixbuf.Gdk_Pixbuf); 
  749.    function Get_Icon 
  750.      (Window : access Gtk_Window_Record) return Gdk.Pixbuf.Gdk_Pixbuf; 
  751.    --  Sets up the icon representing Window. This icon is used when the window 
  752.    --  is minimized (also known as iconified). Some window managers or desktop 
  753.    --  environments may also place it in the window frame, or display it in 
  754.    --  other contexts. 
  755.    -- 
  756.    --  The icon should be provided in whatever size it was naturally drawn; 
  757.    --  that is, don't scale the image before passing it to GTK+. Scaling is 
  758.    --  postponed until the last minute, when the desired final size is known, 
  759.    --  to allow best quality. 
  760.    -- 
  761.    --  If you have your icon hand-drawn in multiple sizes, use 
  762.    --  Set_Icon_List. Then the best size will be used. 
  763.    -- 
  764.    --  This function is equivalent to calling Set_Icon_List with a single 
  765.    --  element. 
  766.    -- 
  767.    --  See also Set_Default_Icon_List to set the icon for all windows in your 
  768.    --  application in one go. 
  769.  
  770.    procedure Set_Icon_List 
  771.      (Window : access Gtk_Window_Record; 
  772.       List   : Glib.Object.Object_Simple_List.Glist); 
  773.    function Get_Icon_List 
  774.      (Window : access Gtk_Window_Record) 
  775.       return Glib.Object.Object_Simple_List.Glist; 
  776.    --  Sets up the icon representing Window. The icon is used when the window 
  777.    --  is minimized (also known as iconified). Some window managers or desktop 
  778.    --  environments may also place it in the window frame, or display it in 
  779.    --  other contexts. 
  780.    -- 
  781.    --  Set_Icon_List allows you to pass in the same icon in several hand-drawn 
  782.    --  sizes. The list should contain the natural sizes your icon is available 
  783.    --  in; that is, don't scale the image before passing it to GTK+. Scaling is 
  784.    --  postponed until the last minute, when the desired final size is known, 
  785.    --  to allow best quality. 
  786.    -- 
  787.    --  By passing several sizes, you may improve the final image quality of the 
  788.    --  icon, by reducing or eliminating automatic image scaling. 
  789.    -- 
  790.    --  Recommended sizes to provide: 16x16, 32x32, 48x48 at minimum, and larger 
  791.    --  images (64x64, 128x128) if you have them. 
  792.    -- 
  793.    --  Note that transient windows (those who have been set transient for 
  794.    --  another window using Set_Transient_For) will inherit their icon from 
  795.    --  their transient parent. So there's no need to explicitly set the icon on 
  796.    --  transient windows. 
  797.  
  798.    function Set_Icon_From_File 
  799.      (Window   : access Gtk_Window_Record; 
  800.       Filename : String) return Boolean; 
  801.    --  Equivalent to calling Set_Icon with a pixbuf loaded from Filename. 
  802.    --  return False on failure. 
  803.  
  804.    procedure Set_Default_Icon_List 
  805.      (List : Glib.Object.Object_Simple_List.Glist); 
  806.    function Get_Default_Icon_List 
  807.      return Glib.Object.Object_Simple_List.Glist; 
  808.    --  Sets an icon list to be used as fallback for windows that haven't had 
  809.    --  Set_Icon_List called on them to setup a window-specific icon list. 
  810.  
  811.    procedure Set_Default_Icon (Icon : Gdk.Pixbuf.Gdk_Pixbuf); 
  812.    --  Sets an icon to be used as a fallback for windows that haven't had 
  813.    --  Set_Icon called on them 
  814.  
  815.    function Set_Default_Icon_From_File (Filename : String) return Boolean; 
  816.    --  Same as Set_Default_Icon, loads the pixbuf automatically. 
  817.  
  818.    function Get_Default_Icon_Name return String; 
  819.    procedure Set_Default_Icon_Name (Name : String); 
  820.    --  Gets/Sets icon to be used as a fallback for windows that haven't had a 
  821.    --  themed icon set (set Set_Icon_Name). 
  822.  
  823.    ------------ 
  824.    -- Groups -- 
  825.    ------------ 
  826.  
  827.    procedure Gtk_New (Group : out Gtk_Window_Group); 
  828.    --  Create a new window group. 
  829.    --  Grabs added with Gtk.Main.Grab_Add only affect windows within the same 
  830.    --  group. 
  831.  
  832.    function Group_Get_Type return GType; 
  833.    --  Return the internal type used for window groups 
  834.  
  835.    procedure Group_Add_Window 
  836.      (Window_Group : access Gtk_Window_Group_Record; 
  837.       Window       : access Gtk_Window_Record'Class); 
  838.    --  Add a window to Window_Group 
  839.  
  840.    procedure Group_Remove_Window 
  841.      (Window_Group : access Gtk_Window_Group_Record; 
  842.       Window       : access Gtk_Window_Record'Class); 
  843.    --  Remove a specific window from the group 
  844.  
  845.    function Group_List_Windows 
  846.      (Window_Group : access Gtk_Window_Group_Record) 
  847.       return Gtk.Widget.Widget_List.Glist; 
  848.    --  Returns a list of the Gtk_Windows that belong to Window_Group. 
  849.  
  850.    function Get_Group 
  851.      (Window : access Gtk_Window_Record) return Gtk_Window_Group; 
  852.    --  Returns the group for Window or the default group, if 
  853.    --  Window is null or if Window does not have an explicit 
  854.    --  window group. 
  855.  
  856.    ----------- 
  857.    -- Focus -- 
  858.    ----------- 
  859.  
  860.    function Get_Focus (Window : access Gtk_Window_Record) 
  861.       return Gtk.Widget.Gtk_Widget; 
  862.    --  Return the widget that would have the keyboard focus if 
  863.    --  Window itself has the focus. It currently has the focus 
  864.    --  only if Has_Focus_Is_Set returns True. 
  865.    --  To know whether the Window itself currently has the focus, check the 
  866.    --    Has_Toplevel_Focus_Property 
  867.    --  property described below 
  868.  
  869.    procedure Set_Focus 
  870.      (Window : access Gtk_Window_Record; 
  871.       Focus  : Gtk.Widget.Gtk_Widget); 
  872.    --  Set the focus child for Window. 
  873.    --  If Focus is not the current focus widget, and is focusable, sets 
  874.    --  it as the focus widget for the window. If Focus is null, unsets 
  875.    --  the focus widget for this window. To set the focus to a particular 
  876.    --  widget in the toplevel, it is usually more convenient to use 
  877.    --  gtk_widget_grab_focus() instead of this function. 
  878.  
  879.    procedure Set_Accept_Focus 
  880.      (Window  : access Gtk_Window_Record;  Setting : Boolean); 
  881.    function Get_Accept_Focus 
  882.      (Window : access Gtk_Window_Record) return Boolean; 
  883.    --  Windows may set a hint asking the desktop environment not to receive 
  884.    --  the input focus. 
  885.  
  886.    procedure Set_Focus_On_Map 
  887.      (Window  : access Gtk_Window_Record; Setting : Boolean); 
  888.    function Get_Focus_On_Map 
  889.      (Window : access Gtk_Window_Record) return Boolean; 
  890.    --  Windows may set a hint asking the desktop environment not to receive 
  891.    --  the input focus when the window is mapped. 
  892.  
  893.    function Has_Toplevel_Focus 
  894.      (Window : access Gtk_Window_Record) return Boolean; 
  895.    --  Returns whether the input focus is within this Window. For real toplevel 
  896.    --  windows, this is identical to Is_Active, but for embedded windows the 
  897.    --  results will differ 
  898.  
  899.    function Is_Active (Window : access Gtk_Window_Record) return Boolean; 
  900.    --  Returns whether the window is part of the current active toplevel. (That 
  901.    --  is, the toplevel window receiving keystrokes.) The return value is True 
  902.    --  if the window is active toplevel itself, but also if it is, say, a 
  903.    --  Gtk_Plug embedded in the active toplevel. You might use this function if 
  904.    --  you wanted to draw a widget differently in an active window from a 
  905.    --  widget in an inactive window. 
  906.  
  907.    ------------------------ 
  908.    -- Keys and shortcuts -- 
  909.    ------------------------ 
  910.  
  911.    function Get_Default_Widget 
  912.      (Window : access Gtk_Window_Record) return Gtk.Widget.Gtk_Widget; 
  913.    procedure Set_Default 
  914.      (Window         : access Gtk_Window_Record; 
  915.       Default_Widget : access Gtk.Widget.Gtk_Widget_Record'Class); 
  916.    --  The default widget is the widget that's activated when the user presses 
  917.    --  Enter in a dialog (for example). This function sets or unsets the 
  918.    --  default widget for a Window. When setting (rather than unsetting) the 
  919.    --  default widget it's generally easier to call Grab_Focus on the widget. 
  920.    --  Before making a widget the default widget, you must set the CAN_DEFAULT 
  921.    --  flag on the widget you'd like to make the default using 
  922.    --  Gtk.Widget.Set_Flags. A null value indicates no default widget. 
  923.  
  924.    procedure Set_Mnemonic_Modifier 
  925.      (Window   : access Gtk_Window_Record; 
  926.       Modifier : Gdk.Types.Gdk_Modifier_Type); 
  927.    function Get_Mnemonic_Modifier 
  928.      (Window : access Gtk_Window_Record) 
  929.       return Gdk.Types.Gdk_Modifier_Type; 
  930.    --  Sets the mnemonic modifier for this window. 
  931.    --  Modifier is the mask used to active mnemonics in this window 
  932.  
  933.    procedure Add_Mnemonic 
  934.      (Window : access Gtk_Window_Record; 
  935.       Keyval : Gdk.Types.Gdk_Key_Type; 
  936.       Target : access Gtk.Widget.Gtk_Widget_Record'Class); 
  937.    procedure Remove_Mnemonic 
  938.      (Window : access Gtk_Window_Record; 
  939.       Keyval : Gdk.Types.Gdk_Key_Type; 
  940.       Target : access Gtk.Widget.Gtk_Widget_Record'Class); 
  941.    --  Add a mnemonic to this window. 
  942.    --  Target will receive the "activate" signal when Keyval is pressed inside 
  943.    --  the window. In addition to keyval, the user must press the special key 
  944.    --  defined through Set_Mnemonic_Modifier 
  945.  
  946.    function Mnemonic_Activate 
  947.      (Window   : access Gtk_Window_Record; 
  948.       Keyval   : Gdk.Types.Gdk_Key_Type; 
  949.       Modifier : Gdk.Types.Gdk_Modifier_Type) 
  950.      return Boolean; 
  951.    --  Activates the targets associated with the mnemonic. This sends the 
  952.    --  "activate" signal to the corresponding signal 
  953.  
  954.    function Activate_Key 
  955.      (Window : access Gtk_Window_Record; 
  956.       Event  : Gdk.Event.Gdk_Event_Key) return Boolean; 
  957.    --  Activates mnemonics and accelerators for this window. This is normally 
  958.    --  called by the default key_press_event_handler for toplevel windows, 
  959.    --  however in some cases it may be useful to call this directly when 
  960.    --  overriding the standard key handling for a toplevel window. 
  961.    --  Return True if the mnemonic was found and activated. 
  962.  
  963.    function Propagate_Key_Event 
  964.      (Window : access Gtk_Window_Record; 
  965.       Event  : Gdk.Event.Gdk_Event_Key) return Boolean; 
  966.    --  Propagate a key press or release event to the focus widget and up the 
  967.    --  focus container chain until a widget handles Event. 
  968.    --  This is normally called by the default key_press_event handler, but 
  969.    --  might be useful when overriding the standard key handling for a 
  970.    --  toplevel window. 
  971.  
  972.    procedure Add_Accel_Group 
  973.      (Window      : access Gtk_Window_Record; 
  974.       Accel_Group : Gtk.Accel_Group.Gtk_Accel_Group); 
  975.    procedure Remove_Accel_Group 
  976.      (Window      : access Gtk_Window_Record; 
  977.       Accel_Group : Gtk.Accel_Group.Gtk_Accel_Group); 
  978.    --  Adds or Removes the specified accelerator group for the window, such 
  979.    --  that calling Gtk.Accel_Groups.Active on Window will activate 
  980.    --  accelerators in Accel_Group. 
  981.  
  982.    ----------------- 
  983.    -- Obsolescent -- 
  984.    ----------------- 
  985.    --  All subprograms below are now obsolescent in gtk+. They might be removed 
  986.    --  from future versions of gtk+ (and therefore GtkAda). 
  987.    --  To find out whether your code uses any of these, we recommend compiling 
  988.    --  with the -gnatwj switch 
  989.    --  <doc_ignore> 
  990.  
  991.    procedure Set_Resizeable 
  992.      (Window    : access Gtk_Window_Record; 
  993.       Resizable : Boolean := True) renames Set_Resizable; 
  994.    --  pragma Obsolescent ("Use Gtk.Window.Set_Resizable instead"); 
  995.  
  996.    function Get_Resizeable (Window : access Gtk_Window_Record) return Boolean 
  997.      renames Get_Resizable; 
  998.    --  pragma Obsolescent ("Use Gtk.Window.Get_Resizable instead"); 
  999.  
  1000.    procedure Set_Policy 
  1001.      (Window       : access Gtk_Window_Record; 
  1002.       Allow_Shrink : Boolean; 
  1003.       Allow_Grow   : Boolean; 
  1004.       Auto_Shrink  : Boolean); 
  1005.    pragma Obsolescent;  --  Set_Policy 
  1006.    --  Specify the behavior of the window with regards to size modifications. 
  1007.    --  Default values when the window is created are: 
  1008.    --    Allow_Shrink => False, 
  1009.    --    Allow_Grow   => True, 
  1010.    --    Auto_Shrink  => False. 
  1011.    -- 
  1012.    --  If Allow_Shrink is False, then the minimum size of the window is 
  1013.    --  calculated once depending on its children, and the window can never be 
  1014.    --  smaller. 
  1015.    --  If Allow_Grow is False, then the maximum size of the window is 
  1016.    --  calculated once depending on its children, and the window can never be 
  1017.    --  bigger. 
  1018.    --  If Auto_Shrink if False, then the window is not shrinked when its 
  1019.    --  content changes. 
  1020.  
  1021.    --  </doc_ignore> 
  1022.  
  1023.    ---------------- 
  1024.    -- Properties -- 
  1025.    ---------------- 
  1026.  
  1027.    --  <properties> 
  1028.    --  The following properties are defined for this widget. See 
  1029.    --  Glib.Properties for more information on properties. 
  1030.    -- 
  1031.    --  - Name:  Type_Property 
  1032.    --    Type:  Gtk_Window_Type 
  1033.    --    Flags: read-write (construct only) 
  1034.    --    Descr: The type of the window 
  1035.    --    See also:  Gtk_New 
  1036.    -- 
  1037.    --  - Name:  Title_Property 
  1038.    --    Type:  UTF8_String 
  1039.    --    Flags: read-write 
  1040.    --    Descr: The title of the window 
  1041.    --    See also:  Set_Title and Get_Title 
  1042.    -- 
  1043.    --  - Name:  Role_Property 
  1044.    --    Type:  String 
  1045.    --    See:   Set_Role / Get_Role 
  1046.    -- 
  1047.    --  - Name:  Allow_Shrink_Property 
  1048.    --    Type:  Boolean 
  1049.    --    Flags: read-write 
  1050.    --    Descr: If TRUE, the window has no mimimum size. Don't use this 
  1051.    --           feature, it makes no sense 
  1052.    --    See also:  Set_Policy 
  1053.    -- 
  1054.    --  - Name:  Allow_Grow_Property 
  1055.    --    Type:  Boolean 
  1056.    --    Flags: read-write 
  1057.    --    Descr: If TRUE, users can expand the window beyond its minimum size. 
  1058.    --    See also:  Set_Policy 
  1059.    -- 
  1060.    --  - Name: Resizable_Property 
  1061.    --    Type: Boolean 
  1062.    --    See:  Set_Resizable / Get_Resizable 
  1063.    -- 
  1064.    --  - Name:  Modal_Property 
  1065.    --    Type:  Boolean 
  1066.    --    Flags: read-write 
  1067.    --    Descr: If TRUE, the window is modal (other windows are not usable 
  1068.    --           while this one is up) 
  1069.    --    See also:  Set_Modal 
  1070.    -- 
  1071.    --  - Name:  Win_Pos_Property 
  1072.    --    Type:  Gtk_Window_Position 
  1073.    --    Flags: read-write 
  1074.    --    Descr: The initial position of the window. 
  1075.    --    See also:  Set_Position 
  1076.    -- 
  1077.    --  - Name:  Default_Width_Property 
  1078.    --    Type:  Gint 
  1079.    --    Flags: read-write 
  1080.    --    Descr: The default width of the window, or 0 to use the size request. 
  1081.    --    See also:  Set_Default_Size 
  1082.    -- 
  1083.    --  - Name:  Default_Height_Property 
  1084.    --    Type:  Gint 
  1085.    --    Flags: read-write 
  1086.    --    Descr: The default height of the window, or 0 to use the size request. 
  1087.    --    See also:  Set_Default_Size 
  1088.    -- 
  1089.    --  - Name:  Destroy_With_Parent_Property 
  1090.    --    Type:  Boolean 
  1091.    --    Flags: read-write 
  1092.    --    Descr: If this window should be destroyed when the parent is destroyed 
  1093.    --    See also:  Set_Destroy_With_Parent 
  1094.    -- 
  1095.    --  - Name:  Has_Toplevel_Focus_Property 
  1096.    --    Type:  Boolean 
  1097.    --    Flags: read-only 
  1098.    --    Descr: Whether the input focus is within this Gtk_Window 
  1099.    -- 
  1100.    --  - Name:  Is_Active_Property 
  1101.    --    Type:  Boolean 
  1102.    --    Flags: read-only 
  1103.    --    Descr: Whether the toplevel is the current active window 
  1104.    -- 
  1105.    --  Name:  Deletable_Property 
  1106.    --  Type:  Boolean 
  1107.    --  Descr: Whether the window frame should have a close button 
  1108.    -- 
  1109.    --  Name:  Opacity_Property 
  1110.    --  Type:  Double 
  1111.    --  Descr: The opacity of the window, from 0.0 to 1.0 
  1112.    -- 
  1113.    --  Name:  Startup_Id_Property 
  1114.    --  Type:  String 
  1115.    --  Descr: Unique startup identifier for the window used by 
  1116.    --         startup-notification 
  1117.    -- 
  1118.    --  Name:  Transient_For_Property 
  1119.    --  Type:  Object 
  1120.    --  Descr: The transient parent of the dialog 
  1121.    -- 
  1122.    --  </properties> 
  1123.  
  1124.    Type_Property                : constant Gtk.Enums.Property_Gtk_Window_Type; 
  1125.    Title_Property               : constant Glib.Properties.Property_String; 
  1126.    Role_Property                : constant Glib.Properties.Property_String; 
  1127.    Allow_Shrink_Property        : constant Glib.Properties.Property_Boolean; 
  1128.    Allow_Grow_Property          : constant Glib.Properties.Property_Boolean; 
  1129.    Modal_Property               : constant Glib.Properties.Property_Boolean; 
  1130.    Resizable_Property           : constant Glib.Properties.Property_Boolean; 
  1131.    Has_Toplevel_Focus_Property  : constant Glib.Properties.Property_Boolean; 
  1132.    Is_Active_Property           : constant Glib.Properties.Property_Boolean; 
  1133.    Window_Position_Property  : constant Gtk.Enums.Property_Gtk_Window_Position; 
  1134.    Default_Width_Property       : constant Glib.Properties.Property_Int; 
  1135.    Default_Height_Property      : constant Glib.Properties.Property_Int; 
  1136.    Destroy_With_Parent_Property : constant Glib.Properties.Property_Boolean; 
  1137.    Icon_Property                : constant Glib.Properties.Property_Object; 
  1138.    Icon_Name_Property           : constant Glib.Properties.Property_String; 
  1139.    Screen_Property              : constant Glib.Properties.Property_Object; 
  1140.    Type_Hint_Property          : constant Gdk.Window.Property_Window_Type_Hint; 
  1141.    Skip_Taskbar_Hint_Property   : constant Glib.Properties.Property_Boolean; 
  1142.    Skip_Pager_Hint_Property     : constant Glib.Properties.Property_Boolean; 
  1143.    Urgency_Hint_Property        : constant Glib.Properties.Property_Boolean; 
  1144.    Accept_Focus_Property        : constant Glib.Properties.Property_Boolean; 
  1145.    Focus_On_Map_Property        : constant Glib.Properties.Property_Boolean; 
  1146.    Decorated_Property           : constant Glib.Properties.Property_Boolean; 
  1147.    Gravity_Property             : constant Gdk.Window.Property_Gravity; 
  1148.    Deletable_Property           : constant Glib.Properties.Property_Boolean; 
  1149.    Opacity_Property             : constant Glib.Properties.Property_Double; 
  1150.    Startup_Id_Property          : constant Glib.Properties.Property_String; 
  1151.    Transient_For_Property       : constant Glib.Properties.Property_Object; 
  1152.  
  1153.    ------------- 
  1154.    -- Signals -- 
  1155.    ------------- 
  1156.  
  1157.    --  <signals> 
  1158.    --  The following new signals are defined for this widget: 
  1159.    -- 
  1160.    --  - "set_focus" 
  1161.    --    procedure Handler (Window : access Gtk_Window_Record'Class; 
  1162.    --                       Widget : access Gtk_Widget_Record'Class); 
  1163.    --    Called when the widget that has the focus has changed. 
  1164.    --    This widget gets all keyboard events that happen in the window. 
  1165.    --    You should not block the emission of this signal, since most of 
  1166.    --    the work is done in the default handler. 
  1167.    -- 
  1168.    --  - "frame_event" 
  1169.    --    function Handler 
  1170.    --      (Window : access Gtk_Window_Record'Class; 
  1171.    --       Event  : Gdk.Event.Gdk_Event) return Boolean; 
  1172.    --    If this function is called on a window before it is realized 
  1173.    --    or showed it will have a "frame" window around widget-window. 
  1174.    --    Called when the "frame" window set around a window receives events. 
  1175.    --    This is mainly used by the linux-fb port to implement managed 
  1176.    --    windows, but it could concievably be used by X-programs that 
  1177.    --    want to do their own window decorations. 
  1178.    -- 
  1179.    --  - "activate_focus" 
  1180.    --    procedure Handler (Window : access Gtk_Window_Record'Class); 
  1181.    --    You should emit this signal to request that the currently focused 
  1182.    --    widget receives the "activate" signal. This is the same as calling 
  1183.    --    Activate_Focus, but can be bound to a key binding 
  1184.    -- 
  1185.    --  - "activate_default" 
  1186.    --    procedure Handler (Window : access Gtk_Window_Record'Class); 
  1187.    --    Same as Activate_Default, but can be bound to a key binding 
  1188.    -- 
  1189.    --  - "move_focus" 
  1190.    --    procedure Handler 
  1191.    --       (Window    : access Gtk_Window_Record'Class; 
  1192.    --        Direction : Gtk_Direction_Type); 
  1193.    --    Emitted when a new child gains the focus 
  1194.    -- 
  1195.    --  - "keys_changed" 
  1196.    --    procedure Handler (Window : access Gtk_Window_Record'Class); 
  1197.    --    Emitted when the key accelerators or mnemonics are changed for the 
  1198.    --    window. 
  1199.    -- 
  1200.    --  </signals> 
  1201.  
  1202.    Signal_Set_Focus        : constant Glib.Signal_Name := "set_focus"; 
  1203.    Signal_Frame_Event      : constant Glib.Signal_Name := "frame_event"; 
  1204.    Signal_Activate_Focus   : constant Glib.Signal_Name := "activate_focus"; 
  1205.    Signal_Activate_Default : constant Glib.Signal_Name := "activate_default"; 
  1206.    Signal_Move_Focus       : constant Glib.Signal_Name := "move_focus"; 
  1207.    Signal_Keys_Changed     : constant Glib.Signal_Name := "keys_changed"; 
  1208.  
  1209. private 
  1210.    type Gtk_Window_Record is new Bin.Gtk_Bin_Record with null record; 
  1211.  
  1212.    Type_Property              : constant Gtk.Enums.Property_Gtk_Window_Type := 
  1213.      Gtk.Enums.Build ("type"); 
  1214.    Title_Property               : constant Glib.Properties.Property_String := 
  1215.      Glib.Properties.Build ("title"); 
  1216.    Allow_Shrink_Property        : constant Glib.Properties.Property_Boolean := 
  1217.      Glib.Properties.Build ("allow_shrink"); 
  1218.    Allow_Grow_Property          : constant Glib.Properties.Property_Boolean := 
  1219.      Glib.Properties.Build ("allow_grow"); 
  1220.    Modal_Property               : constant Glib.Properties.Property_Boolean := 
  1221.      Glib.Properties.Build ("modal"); 
  1222.    Win_Pos_Property       : constant Gtk.Enums.Property_Gtk_Window_Position := 
  1223.      Gtk.Enums.Build ("window_position"); 
  1224.    Default_Width_Property       : constant Glib.Properties.Property_Int := 
  1225.      Glib.Properties.Build ("default_width"); 
  1226.    Default_Height_Property      : constant Glib.Properties.Property_Int := 
  1227.      Glib.Properties.Build ("default_height"); 
  1228.    Destroy_With_Parent_Property : constant Glib.Properties.Property_Boolean := 
  1229.      Glib.Properties.Build ("destroy_with_parent"); 
  1230.    Has_Toplevel_Focus_Property : constant Glib.Properties.Property_Boolean := 
  1231.      Glib.Properties.Build ("has_toplevel_focus"); 
  1232.    Is_Active_Property        : constant Glib.Properties.Property_Boolean := 
  1233.      Glib.Properties.Build ("is_active"); 
  1234.    Icon_Property                : constant Glib.Properties.Property_Object := 
  1235.      Glib.Properties.Build ("icon"); 
  1236.    Icon_Name_Property           : constant Glib.Properties.Property_String := 
  1237.      Glib.Properties.Build ("icon-name"); 
  1238.    Screen_Property              : constant Glib.Properties.Property_Object := 
  1239.      Glib.Properties.Build ("screen"); 
  1240.    Type_Hint_Property        : constant Gdk.Window.Property_Window_Type_Hint := 
  1241.      Gdk.Window.Build ("type-hint"); 
  1242.    Skip_Taskbar_Hint_Property   : constant Glib.Properties.Property_Boolean := 
  1243.      Glib.Properties.Build ("skip-taskbar-hint"); 
  1244.    Skip_Pager_Hint_Property     : constant Glib.Properties.Property_Boolean := 
  1245.      Glib.Properties.Build ("skip-pager-hint"); 
  1246.    Urgency_Hint_Property        : constant Glib.Properties.Property_Boolean := 
  1247.      Glib.Properties.Build ("urgency-hint"); 
  1248.    Accept_Focus_Property        : constant Glib.Properties.Property_Boolean := 
  1249.      Glib.Properties.Build ("accept-focus"); 
  1250.    Focus_On_Map_Property        : constant Glib.Properties.Property_Boolean := 
  1251.      Glib.Properties.Build ("focus-on-map"); 
  1252.    Decorated_Property           : constant Glib.Properties.Property_Boolean := 
  1253.      Glib.Properties.Build ("decorated"); 
  1254.    Gravity_Property             : constant Gdk.Window.Property_Gravity := 
  1255.      Gdk.Window.Build ("gravity"); 
  1256.    Window_Position_Property     : 
  1257.      constant Gtk.Enums.Property_Gtk_Window_Position := 
  1258.      Gtk.Enums.Build ("window-position"); 
  1259.    Resizable_Property           : constant Glib.Properties.Property_Boolean := 
  1260.      Glib.Properties.Build ("resizable"); 
  1261.    Role_Property                : constant Glib.Properties.Property_String := 
  1262.      Glib.Properties.Build ("role"); 
  1263.    Deletable_Property : constant Glib.Properties.Property_Boolean := 
  1264.      Glib.Properties.Build ("deletable"); 
  1265.    Opacity_Property : constant Glib.Properties.Property_Double := 
  1266.      Glib.Properties.Build ("opacity"); 
  1267.    Startup_Id_Property : constant Glib.Properties.Property_String := 
  1268.      Glib.Properties.Build ("startup-id"); 
  1269.    Transient_For_Property : constant Glib.Properties.Property_Object := 
  1270.      Glib.Properties.Build ("transient-for"); 
  1271.  
  1272.    pragma Import (C, Get_Type, "gtk_window_get_type"); 
  1273.    pragma Import (C, Group_Get_Type, "gtk_window_group_get_type"); 
  1274. end Gtk.Window; 
  1275.  
  1276. --  <example> 
  1277. --  <include>../examples/documentation/banner.adb</include> 
  1278. --  </example> 
  1279.  
  1280. --  No binding: gtk_window_get_screen 
  1281. --  No binding: gtk_window_set_screen 
  1282. --  No binding: gtk_window_add_embedded_xid 
  1283. --  No binding: gtk_window_remove_embedded_xid