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