1. ----------------------------------------------------------------------- 
  2. --               GtkAda - Ada95 binding for Gtk+/Gnome               -- 
  3. --                                                                   -- 
  4. --                Copyright (C) 2006 AdaCore                         -- 
  5. --                                                                   -- 
  6. -- This library is free software; you can redistribute it and/or     -- 
  7. -- modify it under the terms of the GNU General Public               -- 
  8. -- License as published by the Free Software Foundation; either      -- 
  9. -- version 2 of the License, or (at your option) any later version.  -- 
  10. --                                                                   -- 
  11. -- This library is distributed in the hope that it will be useful,   -- 
  12. -- but WITHOUT ANY WARRANTY; without even the implied warranty of    -- 
  13. -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU -- 
  14. -- General Public License for more details.                          -- 
  15. --                                                                   -- 
  16. -- You should have received a copy of the GNU General Public         -- 
  17. -- License along with this library; if not, write to the             -- 
  18. -- Free Software Foundation, Inc., 59 Temple Place - Suite 330,      -- 
  19. -- Boston, MA 02111-1307, USA.                                       -- 
  20. --                                                                   -- 
  21. -- As a special exception, if other files instantiate generics from  -- 
  22. -- this unit, or you link this unit with other files to produce an   -- 
  23. -- executable, this  unit  does not  by itself cause  the resulting  -- 
  24. -- executable to be covered by the GNU General Public License. This  -- 
  25. -- exception does not however invalidate any other reasons why the   -- 
  26. -- executable file  might be covered by the  GNU Public License.     -- 
  27. ----------------------------------------------------------------------- 
  28.  
  29. --  <description> 
  30. --  This package contains various subprograms to easily share settings between 
  31. --  applications, or even between various parts of your application. 
  32. --  </description> 
  33. --  <c_version>2.8.17</c_version> 
  34. --  <group>Configuration and Themes</group> 
  35.  
  36. with Gdk; 
  37. with Glib.Object; 
  38. with Glib.Values; 
  39. with Gtk.Style; 
  40. with Interfaces.C.Strings; 
  41.  
  42. package Gtk.Settings is 
  43.  
  44.    type Gtk_Settings_Record is new Glib.Object.GObject_Record with null record; 
  45.    type Gtk_Settings is access all Gtk_Settings_Record'Class; 
  46.  
  47.    function Get_Default return Gtk_Settings; 
  48.    --  Gets the settings object for the default GDK screen, creating 
  49.    --  it if necessary. 
  50.  
  51.    function Get_For_Screen (Screen : Gdk.Gdk_Screen) return Gtk_Settings; 
  52.    --  Gets the settings object for Screen, creating it if necessary. 
  53.  
  54.    function Get_Type return Glib.GType; 
  55.    --  Return the internal type used to identify a Gtk_Settings 
  56.  
  57.    procedure Install_Property (Pspec : Glib.Param_Spec); 
  58.    --  Declares a property that can be shared among various parts of the 
  59.    --  application 
  60.  
  61.    procedure Install_Property_Parser 
  62.      (Pspec  : Glib.Param_Spec; 
  63.       Parser : Gtk.Style.Gtk_Rc_Property_Parser); 
  64.    --  Install a new parser for the given property. This parser is responsible 
  65.    --  for reading the property's value in a gtk configuration file, and 
  66.    --  convert it to a suitable value. 
  67.  
  68.    -------------------------------- 
  69.    -- Precoded parsing functions -- 
  70.    -------------------------------- 
  71.  
  72.    function Parse_Color 
  73.      (Pspec     : Glib.Param_Spec; 
  74.       Rc_String : Interfaces.C.Strings.chars_ptr; 
  75.       Value     : access Glib.Values.GValue) return Gboolean; 
  76.    function Parse_Enum 
  77.      (Pspec     : Glib.Param_Spec; 
  78.       Rc_String : Interfaces.C.Strings.chars_ptr; 
  79.       Value     : access Glib.Values.GValue) return Gboolean; 
  80.    function Parse_Flags 
  81.      (Pspec     : Glib.Param_Spec; 
  82.       Rc_String : Interfaces.C.Strings.chars_ptr; 
  83.       Value     : access Glib.Values.GValue) return Gboolean; 
  84.    function Parse_Requisition 
  85.      (Pspec     : Glib.Param_Spec; 
  86.       Rc_String : Interfaces.C.Strings.chars_ptr; 
  87.       Value     : access Glib.Values.GValue) return Gboolean; 
  88.    function Parse_Border 
  89.      (Pspec     : Glib.Param_Spec; 
  90.       Rc_String : Interfaces.C.Strings.chars_ptr; 
  91.       Value     : access Glib.Values.GValue) return Gboolean; 
  92.    --  These functions parse some of the predefined property types 
  93.  
  94.    ----------------------------------- 
  95.    -- Setting predefined properties -- 
  96.    ----------------------------------- 
  97.  
  98.    procedure Set_Property_Value 
  99.      (Settings : access Gtk_Settings_Record; 
  100.       Name     : String; 
  101.       Value    : Glib.Values.GValue; 
  102.       Origin   : String); 
  103.    procedure Set_String_Property 
  104.      (Settings : access Gtk_Settings_Record; 
  105.       Name     : String; 
  106.       Value    : String; 
  107.       Origin   : String); 
  108.    procedure Set_Long_Property 
  109.      (Settings : access Gtk_Settings_Record; 
  110.       Name     : String; 
  111.       Value    : Glong; 
  112.       Origin   : String); 
  113.    procedure Set_Double_Property 
  114.      (Settings : access Gtk_Settings_Record; 
  115.       Name     : String; 
  116.       Value    : Gdouble; 
  117.       Origin   : String); 
  118.    --  Set the value of a property. This automatically propagates the new 
  119.    --  value to all listeners, so that they can refresh themselves. 
  120.    --  Origin should be something like "filename:line" for rc files, or the 
  121.    --  name of the function that sets it otherwise 
  122.  
  123.    ---------------- 
  124.    -- Properties -- 
  125.    ---------------- 
  126.    --  The following settings are predefined 
  127.    --  - "gtk-alternative-button-order" : Boolean 
  128.    --    Whether buttons in dialogs should use the alternative button order. 
  129.    --    This is used on systems like windows where OK and Cancel buttons are 
  130.    --    generally in an order different from that of GNOME and GTK 
  131.    -- 
  132.    --  - "gtk-button-images": Boolean 
  133.    --    Whether stock icons should be shown in buttons. 
  134.    -- 
  135.    --  - "gtk-can-change-accels": Boolean 
  136.    --    Whether menu accelerators can be changed by pressing a key over the 
  137.    --    menu item. 
  138.    -- 
  139.    --  - "gtk-color-palette": String 
  140.    --    Palette to use in the color selector. See Gtk.Color_Selection. 
  141.    --    Default is "black:white:gray50:red:purple" 
  142.    -- 
  143.    --  - "gtk-cursor-blink": Boolean 
  144.    --    Whether the cursor should blink. 
  145.    -- 
  146.    --  - "gtk-cursor-blink-time": Gint 
  147.    --    Length of the cursor blink cycle, in milliseconds. (>= 100) 
  148.    -- 
  149.    --  - "gtk-cursor-theme-name": String 
  150.    --    Name of the cursor theme to use. 
  151.    -- 
  152.    --  - "gtk-cursor-theme-size": Gint 
  153.    --    Size to use for cursors (0 to 128) 
  154.    -- 
  155.    --  - "gtk-dnd-drag-threshold": Gint 
  156.    --    Number of pixels the cursor can move before dragging (>= 1) 
  157.    -- 
  158.    --  - "gtk-double-click-distance": Gint 
  159.    --    Maximum distance allowed between two clicks for them to be considered 
  160.    --    a double click (in pixels). 
  161.    -- 
  162.    --  - "gtk-double-click-time": Gint 
  163.    --    Maximum time allowed between two clicks for them to be considered a 
  164.    --    double click (in milliseconds). 
  165.    -- 
  166.    --  - "gtk-entry-select-on-focus": Boolean 
  167.    --    Whether to select the contents of an entry when it is focused. 
  168.    -- 
  169.    --  - "gtk-fallback-icon-theme": String 
  170.    --    Name of a icon theme to fall back to. 
  171.    -- 
  172.    --  - "gtk-file-chooser-backend": String 
  173.    --    The default file system backend to use in the file chooser. See also 
  174.    --    Gtk.File_System 
  175.    -- 
  176.    --  - "gtk-font-name": String 
  177.    --    Name of default font to use. 
  178.    -- 
  179.    --  - "gtk-icon-sizes": String 
  180.    --    List of icon sizes (gtk-menu=16,16:gtk-button=20,20...) 
  181.    -- 
  182.    --  - "gtk-icon-theme-name": String 
  183.    --    Name of icon theme to use (default="hicolor") 
  184.    -- 
  185.    --  - "gtk-key-theme-name": String 
  186.    --    Name of key theme RC file to load (for instance "Emacs") 
  187.    -- 
  188.    --  - "gtk-menu-bar-accel": String 
  189.    --    Keybinding to activate the menu bar (default="F10") 
  190.    -- 
  191.    --  - "gtk-menu-bar-popup-delay": Gint 
  192.    --    Delay before the submenus of a menu bar appear (Default=0) 
  193.    -- 
  194.    --  - "gtk-menu-images": Boolean 
  195.    --    Whether images should be shown in menus (Default=True) 
  196.    -- 
  197.    --  - "gtk-menu-popdown-delay": Gint 
  198.    --    The time before hiding a submenu when the pointer is moving towards 
  199.    --    the submenu (Default=1000) 
  200.    -- 
  201.    --  - "gtk-menu-popup-delay": Gint 
  202.    --    Minimum time the pointer must stay over a menu item before the submenu 
  203.    --    appear (Default=225) 
  204.    -- 
  205.    --  - "gtk-modules": String 
  206.    --    List of currently active GTK modules. 
  207.    -- 
  208.    --  - "gtk-split-cursor": Boolean 
  209.    --    Whether two cursors should be displayed for mixed left-to-right and 
  210.    --    right-to-left text (Default True) 
  211.    -- 
  212.    --  - "gtk-theme-name": String 
  213.    --    Name of theme RC file to load (Default: "Raleigh") 
  214.    -- 
  215.    --  - "gtk-toolbar-icon-size": Gtk_Icon_Size 
  216.    --    Size of icons in default toolbars (default=Large) 
  217.    -- 
  218.    --  - "gtk-toolbar-style": Gtk_Toolbar_Style 
  219.    --    Whether default toolbars have text only, text and icons, icons only, 
  220.    --    etc (default: both) 
  221.    -- 
  222.    --  - "gtk-xft-antialias": Gint 
  223.    --    Whether to antialias Xft fonts; 0=no, 1=yes, -1=default 
  224.    -- 
  225.    --  - "gtk-xft-dpi": Gint 
  226.    --    Resolution for Xft, in 1024 * dots/inch. -1 to use default value. 
  227.    -- 
  228.    --  - "gtk-xft-hinting": Gint 
  229.    --    Whether to hint Xft fonts; 0=no, 1=yes, -1=default. 
  230.    -- 
  231.    --  - "gtk-xft-hintstyle": String 
  232.    --    What degree of hinting to use; hintnone, hintslight, hintmedium, or 
  233.    --    hintfull. 
  234.    -- 
  235.    --  - "gtk-xft-rgba": String 
  236.    --    Type of subpixel antialiasing; none, rgb, bgr, vrgb, vbgr. 
  237.  
  238.    Gtk_Alternative_Button_Order : constant String := 
  239.      "gtk-alternative-button-order"; 
  240.    Gtk_Button_Images         : constant String := "gtk-button-images"; 
  241.    Gtk_Can_Change_Accels     : constant String := "gtk-can-change-accels"; 
  242.    Gtk_Color_Palette         : constant String := "gtk-color-palette"; 
  243.    Gtk_Cursor_Blink          : constant String := "gtk-cursor-blink"; 
  244.    Gtk_Cursor_Blink_Time     : constant String := "gtk-cursor-blink-time"; 
  245.    Gtk_Cursor_Theme_Name     : constant String := "gtk-cursor-theme-name"; 
  246.    Gtk_Cursor_Theme_Size     : constant String := "gtk-cursor-theme-size"; 
  247.    Gtk_Dnd_Drag_Threshold    : constant String := "gtk-dnd-drag-threshold"; 
  248.    Gtk_Double_Click_Distance : constant String := "gtk-double-click-distance"; 
  249.    Gtk_Double_Click_Time     : constant String := "gtk-double-click-time"; 
  250.    Gtk_Entry_Select_On_Focus : constant String := "gtk-entry-select-on-focus"; 
  251.    Gtk_Fallback_Icon_Theme   : constant String := "gtk-fallback-icon-theme"; 
  252.    Gtk_File_Chooser_Backend  : constant String := "gtk-file-chooser-backend"; 
  253.    Gtk_Font_Name             : constant String := "gtk-font-name"; 
  254.    Gtk_Icon_Sizes            : constant String := "gtk-icon-sizes"; 
  255.    Gtk_Icon_Theme_Name       : constant String := "gtk-icon-theme-name"; 
  256.    Gtk_Key_Theme_Name        : constant String := "gtk-key-theme-name"; 
  257.    Gtk_Menu_Bar_Accel        : constant String := "gtk-menu-bar-accel"; 
  258.    Gtk_Menu_Bar_Popup_Delay  : constant String := "gtk-menu-bar-popup-delay"; 
  259.    Gtk_Menu_Images           : constant String := "gtk-menu-images"; 
  260.    Gtk_Menu_Popdown_Delay    : constant String := "gtk-menu-popdown-delay"; 
  261.    Gtk_Menu_Popup_Delay      : constant String := "gtk-menu-popup-delay"; 
  262.    Gtk_Modules               : constant String := "gtk-modules"; 
  263.    Gtk_Split_Cursor          : constant String := "gtk-split-cursor"; 
  264.    Gtk_Theme_Name            : constant String := "gtk-theme-name"; 
  265.    Gtk_Toolbar_Icon_Size     : constant String := "gtk-toolbar-icon-size"; 
  266.    Gtk_Toolbar_Style         : constant String := "gtk-toolbar-style"; 
  267.    Gtk_Xft_Antialias         : constant String := "gtk-xft-antialias"; 
  268.    Gtk_Xft_Dpi               : constant String := "gtk-xft-dpi"; 
  269.    Gtk_Xft_Hinting           : constant String := "gtk-xft-hinting"; 
  270.    Gtk_Xft_Hintstyle         : constant String := "gtk-xft-hintstyle"; 
  271.    Gtk_Xft_Rgba              : constant String := "gtk-xft-rgba"; 
  272.  
  273. private 
  274.    pragma Import (C, Get_Type,          "gtk_settings_get_type"); 
  275.    pragma Import (C, Install_Property_Parser, 
  276.                   "gtk_settings_install_property_parser"); 
  277.    pragma Import (C, Install_Property,  "gtk_settings_install_property"); 
  278.    pragma Import (C, Parse_Color,       "gtk_rc_property_parse_color"); 
  279.    pragma Import (C, Parse_Enum,        "gtk_rc_property_parse_enum"); 
  280.    pragma Import (C, Parse_Flags,       "gtk_rc_property_parse_flags"); 
  281.    pragma Import (C, Parse_Requisition, "gtk_rc_property_parse_requisition"); 
  282.    pragma Import (C, Parse_Border,      "gtk_rc_property_parse_border"); 
  283. end Gtk.Settings;