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.Fixed.Gtk_Fixed widget is a container which can place child 
  26. --  widgets at fixed positions and with fixed sizes, given in pixels. 
  27. --  Gtk.Fixed.Gtk_Fixed performs no automatic layout management. 
  28. -- 
  29. --  For most applications, you should not use this container! It keeps you 
  30. --  from having to learn about the other GTK+ containers, but it results in 
  31. --  broken applications. With Gtk.Fixed.Gtk_Fixed, the following things will 
  32. --  result in truncated text, overlapping widgets, and other display bugs: 
  33. -- 
  34. --  
  35. -- 
  36. --     * Themes, which may change widget sizes. 
  37. -- 
  38. --     * Fonts other than the one you used to write the app will of course 
  39. --  change the size of widgets containing text; keep in mind that users may use 
  40. --  a larger font because of difficulty reading the default, or they may be 
  41. --  using Windows or the framebuffer port of GTK+, where different fonts are 
  42. --  available. 
  43. -- 
  44. --     * Translation of text into other languages changes its size. Also, 
  45. --  display of non-English text will use a different font in many cases. 
  46. -- 
  47. --  In addition, the fixed widget can't properly be mirrored in right-to-left 
  48. --  languages such as Hebrew and Arabic. i.e. normally GTK+ will flip the 
  49. --  interface to put labels to the right of the thing they label, but it can't 
  50. --  do that with Gtk.Fixed.Gtk_Fixed. So your application will not be usable in 
  51. --  right-to-left languages. 
  52. -- 
  53. --  Finally, fixed positioning makes it kind of annoying to add/remove GUI 
  54. --  elements, since you have to reposition all the other elements. This is a 
  55. --  long-term maintenance problem for your application. 
  56. -- 
  57. --  If you know none of these things are an issue for your application, and 
  58. --  prefer the simplicity of Gtk.Fixed.Gtk_Fixed, by all means use the widget. 
  59. --  But you should be aware of the tradeoffs. 
  60. -- 
  61. --  </description> 
  62. --  <screenshot>gtk-fixed</screenshot> 
  63. --  <group>Layout containers</group> 
  64. --  <testgtk>create_fixed.adb</testgtk> 
  65. pragma Ada_2005; 
  66.  
  67. pragma Warnings (Off, "*is already use-visible*"); 
  68. with Glib;          use Glib; 
  69. with Glib.Types;    use Glib.Types; 
  70. with Gtk.Buildable; use Gtk.Buildable; 
  71. with Gtk.Container; use Gtk.Container; 
  72. with Gtk.Widget;    use Gtk.Widget; 
  73.  
  74. package Gtk.Fixed is 
  75.  
  76.    type Gtk_Fixed_Record is new Gtk_Container_Record with null record; 
  77.    type Gtk_Fixed is access all Gtk_Fixed_Record'Class; 
  78.  
  79.    ------------------ 
  80.    -- Constructors -- 
  81.    ------------------ 
  82.  
  83.    procedure Gtk_New (Fixed : out Gtk_Fixed); 
  84.    procedure Initialize (Fixed : not null access Gtk_Fixed_Record'Class); 
  85.    --  Creates a new Gtk.Fixed.Gtk_Fixed. 
  86.  
  87.    function Gtk_Fixed_New return Gtk_Fixed; 
  88.    --  Creates a new Gtk.Fixed.Gtk_Fixed. 
  89.  
  90.    function Get_Type return Glib.GType; 
  91.    pragma Import (C, Get_Type, "gtk_fixed_get_type"); 
  92.  
  93.    ------------- 
  94.    -- Methods -- 
  95.    ------------- 
  96.  
  97.    procedure Move 
  98.       (Fixed  : not null access Gtk_Fixed_Record; 
  99.        Widget : not null access Gtk.Widget.Gtk_Widget_Record'Class; 
  100.        X      : Gint; 
  101.        Y      : Gint); 
  102.    --  Move a child of a GtkFixed container to the given position. X indicates 
  103.    --  the horizontal position to place the widget at. Y is the vertical 
  104.    --  position to place the widget at. 
  105.    --  "widget": the child widget. 
  106.    --  "x": the horizontal position to move the widget to. 
  107.    --  "y": the vertical position to move the widget to. 
  108.  
  109.    procedure Put 
  110.       (Fixed  : not null access Gtk_Fixed_Record; 
  111.        Widget : not null access Gtk.Widget.Gtk_Widget_Record'Class; 
  112.        X      : Gint; 
  113.        Y      : Gint); 
  114.    --  Add Widget to a Fixed container at the given position. X indicates the 
  115.    --  horizontal position to place the widget at. Y is the vertical position 
  116.    --  to place the widget at. 
  117.    --  "widget": the widget to add. 
  118.    --  "x": the horizontal position to place the widget at. 
  119.    --  "y": the vertical position to place the widget at. 
  120.  
  121.    ---------------- 
  122.    -- Interfaces -- 
  123.    ---------------- 
  124.    --  This class implements several interfaces. See Glib.Types 
  125.    -- 
  126.    --  - "Buildable" 
  127.  
  128.    package Implements_Gtk_Buildable is new Glib.Types.Implements 
  129.      (Gtk.Buildable.Gtk_Buildable, Gtk_Fixed_Record, Gtk_Fixed); 
  130.    function "+" 
  131.      (Widget : access Gtk_Fixed_Record'Class) 
  132.    return Gtk.Buildable.Gtk_Buildable 
  133.    renames Implements_Gtk_Buildable.To_Interface; 
  134.    function "-" 
  135.      (Interf : Gtk.Buildable.Gtk_Buildable) 
  136.    return Gtk_Fixed 
  137.    renames Implements_Gtk_Buildable.To_Object; 
  138.  
  139. end Gtk.Fixed;