1. ----------------------------------------------------------------------- 
  2. --              GtkAda - Ada95 binding for Gtk+/Gnome                -- 
  3. --                                                                   -- 
  4. --                Copyright (C) 2001-2009, 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. --  A Gtk_Cell_Renderer_Text renders a given text in its cell, using the font, 
  26. --  color and style information provided by its properties. The text will be 
  27. --  ellipsized if it is too long and the ellipsize property allows it. 
  28. -- 
  29. --  If the mode is CELL_RENDERER_MODE_EDITABLE, the Gtk_Cell_Renderer_Text 
  30. --  allows to edit its text using an entry. 
  31. --  </description> 
  32. --  <c_version>2.14</c_version> 
  33. --  <group>Trees and Lists</group> 
  34.  
  35. with Pango.Enums; 
  36. with Glib.Properties; 
  37. with Gdk.Color; 
  38. with Gtk; 
  39. with Gtk.Cell_Renderer; 
  40.  
  41. package Gtk.Cell_Renderer_Text is 
  42.  
  43.    type Gtk_Cell_Renderer_Text_Record is 
  44.      new Gtk.Cell_Renderer.Gtk_Cell_Renderer_Record with private; 
  45.    type Gtk_Cell_Renderer_Text is 
  46.      access all Gtk_Cell_Renderer_Text_Record'Class; 
  47.  
  48.    procedure Gtk_New (Widget : out Gtk_Cell_Renderer_Text); 
  49.    procedure Initialize (Widget : access Gtk_Cell_Renderer_Text_Record'Class); 
  50.    --  Creates or initializes a new renderer 
  51.  
  52.    function Get_Type return Gtk.Gtk_Type; 
  53.    --  Return the internal value associated with this widget. 
  54.  
  55.    procedure Set_Fixed_Height_From_Font 
  56.      (Renderer       : access Gtk_Cell_Renderer_Text_Record; 
  57.       Number_Of_Rows : Gint); 
  58.    --  Sets the height of a renderer to explicitly be determined by the "font" 
  59.    --  and "y_pad" property set on it. Further changes in these properties do 
  60.    --  not affect the height, so they must be accompanied by a subsequent call 
  61.    --  to this function. Using this function is unflexible, and should really 
  62.    --  only be used if calculating the size of a cell is too slow (ie, a 
  63.    --  massive number of cells displayed). If number_of_rows is -1, then the 
  64.    --  fixed height is unset, and the height is determined by the properties 
  65.    --  again. 
  66.  
  67.    ------------- 
  68.    -- Signals -- 
  69.    ------------- 
  70.  
  71.    --  <signals> 
  72.    --  The following new signals are defined for this widget: 
  73.    -- 
  74.    --  - "edited" 
  75.    --    procedure Handler 
  76.    --     (Widget : access Gtk_Cell_Renderer_Text_Record'Class; 
  77.    --       Path : UTF8_String; 
  78.    --       New_Text : UTF8_String); 
  79.    -- 
  80.    --    Called when the text has been edited interactively . Note that you 
  81.    --    also need to set the attribute "editable" for users to be able to 
  82.    --    interactively edit the cell. If you want to take into account the 
  83.    --    change, you need to change the value in the model appropriately, for 
  84.    --    instance through a call to Set_Value 
  85.    --  </signals> 
  86.  
  87.    Signal_Edited : constant Glib.Signal_Name := "edited"; 
  88.  
  89.    ---------------- 
  90.    -- Properties -- 
  91.    ---------------- 
  92.  
  93.    --  The following properties are defined for this cell_renderer : 
  94.    --  <properties> 
  95.    -- 
  96.    --  Name:  Attributes_Property 
  97.    --  Type:  Boxed 
  98.    --  Descr: A list of style attributes to apply to the text of the renderer 
  99.    -- 
  100.    --  Name:  Background_Property 
  101.    --  Type:  String 
  102.    --  Descr: Background color as a string 
  103.    -- 
  104.    --  Name:  Background_Gdk_Property 
  105.    --  Type:  Boxed 
  106.    --  Descr: Background color as a GdkColor 
  107.    -- 
  108.    --  Name:  Editable_Property 
  109.    --  Type:  Boolean 
  110.    --  Descr: Whether the text can be modified by the user 
  111.    -- 
  112.    --  Name:  Ellipsize_Property 
  113.    --  Type:  Enum 
  114.    --  Descr: The preferred place to ellipsize the string, 
  115.    -- 
  116.    --  Name:  Family_Property 
  117.    --  Type:  String 
  118.    --  Descr: Name of the font family, e.g. Sans, Helvetica, Times, Monospace 
  119.    -- 
  120.    --  Name:  Font_Property 
  121.    --  Type:  String 
  122.    --  Descr: Font description as a string 
  123.    -- 
  124.    --  Name:  Font_Desc_Property 
  125.    --  Type:  Boxed 
  126.    --  Descr: Font description as a PangoFontDescription struct 
  127.    -- 
  128.    --  Name:  Foreground_Property 
  129.    --  Type:  String 
  130.    --  Descr: Foreground color as a string 
  131.    -- 
  132.    --  Name:  Foreground_Gdk_Property 
  133.    --  Type:  Boxed 
  134.    --  Descr: Foreground color as a GdkColor 
  135.    -- 
  136.    --  Name:  Language_Property 
  137.    --  Type:  String 
  138.    --  Descr: The language this text is in, as an ISO code. 
  139.    -- 
  140.    --  Name:  Markup_Property 
  141.    --  Type:  String 
  142.    --  Descr: Marked up text to render 
  143.    -- 
  144.    --  Name:  Rise_Property 
  145.    --  Type:  Int 
  146.    --  Descr: Offset of text above the baseline 
  147.    -- 
  148.    --  Name:  Scale_Property 
  149.    --  Type:  Double 
  150.    --  Descr: Font scaling factor 
  151.    -- 
  152.    --  Name:  Single_Paragraph_Mode_Property 
  153.    --  Type:  Boolean 
  154.    --  Descr: Whether or not to keep all text in a single paragraph 
  155.    -- 
  156.    --  Name:  Size_Property 
  157.    --  Type:  Int 
  158.    --  Descr: Font size 
  159.    -- 
  160.    --  Name:  Size_Points_Property 
  161.    --  Type:  Double 
  162.    --  Descr: Font size in points 
  163.    -- 
  164.    --  Name:  Stretch_Property 
  165.    --  Type:  Enum 
  166.    --  Descr: Font stretch 
  167.    -- 
  168.    --  Name:  Strikethrough_Property 
  169.    --  Type:  Boolean 
  170.    --  Descr: Whether to strike through the text 
  171.    -- 
  172.    --  Name:  Style_Property 
  173.    --  Type:  Enum 
  174.    --  Descr: Font style 
  175.    -- 
  176.    --  Name:  Text_Property 
  177.    --  Type:  String 
  178.    --  Descr: Text to render 
  179.    -- 
  180.    --  Name:  Underline_Property 
  181.    --  Type:  Enum 
  182.    --  Descr: Style of underline for this text 
  183.    -- 
  184.    --  Name:  Variant_Property 
  185.    --  Type:  Enum 
  186.    --  Descr: Font variant 
  187.    -- 
  188.    --  Name:  Weight_Property 
  189.    --  Type:  Int 
  190.    --  Descr: Font weight 
  191.    -- 
  192.    --  Name:  Width_Chars_Property 
  193.    --  Type:  Int 
  194.    --  Descr: The desired width of the label, in characters 
  195.    -- 
  196.    --  Name:  Wrap_Mode_Property 
  197.    --  Type:  Enum 
  198.    --  Descr: How to break the string into multiple lines, 
  199.    -- 
  200.    --  Name:  Wrap_Width_Property 
  201.    --  Type:  Int 
  202.    --  Descr: The width at which the text is wrapped 
  203.    -- 
  204.    --  Name:  Alignment_Property 
  205.    --  Type:  Enum 
  206.    --  Descr: How to align the lines 
  207.    -- 
  208.    --  </properties> 
  209.  
  210.    --  Attributes_Property        : constant Glib.Properties.Property_Boxed; 
  211.    --  Alignment_Property : constant Glib.Properties.Property_Enum; 
  212.    Background_Property            : constant Glib.Properties.Property_String; 
  213.    --  Background_Gdk_Property    : constant Glib.Properties.Property_Boxed; 
  214.    Editable_Property              : constant Glib.Properties.Property_Boolean; 
  215.    --  Ellipsize_Property : constant Glib.Properties.Property_Enum; 
  216.    Family_Property                : constant Glib.Properties.Property_String; 
  217.    Font_Property                  : constant Glib.Properties.Property_String; 
  218.    --  Font_Desc_Property         : constant Glib.Properties.Property_Boxed; 
  219.    Foreground_Property            : constant Glib.Properties.Property_String; 
  220.    Foreground_Gdk_Property        : constant Gdk.Color.Property_Gdk_Color; 
  221.    Language_Property              : constant Glib.Properties.Property_String; 
  222.    Markup_Property                : constant Glib.Properties.Property_String; 
  223.    Rise_Property                  : constant Glib.Properties.Property_Int; 
  224.    Scale_Property                 : constant Glib.Properties.Property_Double; 
  225.    Single_Paragraph_Mode_Property : constant Glib.Properties.Property_Boolean; 
  226.    Size_Property                  : constant Glib.Properties.Property_Int; 
  227.    Size_Points_Property           : constant Glib.Properties.Property_Double; 
  228.    --  Stretch_Property               : constant Glib.Properties.Property_Enum; 
  229.    Strikethrough_Property         : constant Glib.Properties.Property_Boolean; 
  230.    --  Style_Property                 : constant Glib.Properties.Property_Enum; 
  231.    Text_Property                  : constant Glib.Properties.Property_String; 
  232.    --  Underline_Property         : constant Glib.Properties.Property_Enum; 
  233.    --  Variant_Property           : constant Glib.Properties.Property_Enum; 
  234.    Weight_Property                : constant Glib.Properties.Property_Int; 
  235.    Width_Chars_Property           : constant Glib.Properties.Property_Int; 
  236.    Wrap_Mode_Property             : constant Pango.Enums.Property_Wrap_Mode; 
  237.    Wrap_Width_Property            : constant Glib.Properties.Property_Int; 
  238.  
  239.    --   Attribute             Type in Model             Mode 
  240.    --   =========             =============             ==== 
  241.    -- 
  242.    --   "text"                UTF8_String               Read / Write 
  243.    --   "markup"              String                    Write 
  244.    --   "attributes"          PangoAttrList             Read / Write 
  245.    --   "background"          String                    Write 
  246.    --   "foreground"          String                    Write 
  247.    --   "background_gdk"      Gdk_Color                 Read / Write 
  248.    --   "foreground_gdk"      Gdk_Color                 Read / Write 
  249.    --   "font"                String                    Read / Write 
  250.    --   "font-desc"           Pango_Font_Description    Read / Write 
  251.    --   "family"              String                    Read / Write 
  252.    --   "style"               PangoStyle                Read / Write 
  253.    --   "variant"             PangoVariant              Read / Write 
  254.    --   "weight"              Gint                      Read / Write 
  255.    --   "stretch"             PangoStretch              Read / Write 
  256.    --   "size"                Gint                      Read / Write 
  257.    --   "size-points"         Gdouble                   Read / Write 
  258.    --   "scale"               Gdouble                   Read / Write 
  259.    --   "editable"            Boolean                   Read / Write 
  260.    --   "strikethrough"       Boolean                   Read / Write 
  261.    --   "underline"           PangoUnderline            Read / Write 
  262.    --   "rise"                Gint                      Read / Write 
  263.    --   "background-set"      Boolean                   Read / Write 
  264.    --   "foreground-set"      Boolean                   Read / Write 
  265.    --   "family-set"          Boolean                   Read / Write 
  266.    --   "style-set"           Boolean                   Read / Write 
  267.    --   "variant-set"         Boolean                   Read / Write 
  268.    --   "weight-set"          Boolean                   Read / Write 
  269.    --   "stretch-set"         Boolean                   Read / Write 
  270.    --   "size-set"            Boolean                   Read / Write 
  271.    --   "scale-set"           Boolean                   Read / Write 
  272.    --   "editable-set"        Boolean                   Read / Write 
  273.    --   "strikethrough-set"   Boolean                   Read / Write 
  274.    --   "underline-set"       Boolean                   Read / Write 
  275.    --   "rise-set"            Boolean                   Read / Write 
  276.  
  277. private 
  278.    type Gtk_Cell_Renderer_Text_Record is 
  279.      new Gtk.Cell_Renderer.Gtk_Cell_Renderer_Record with null record; 
  280.  
  281.    --  Alignment_Property : constant Glib.Properties.Property_Enum := 
  282.    --     Glib.Properties.Build ("alignment"); 
  283.    --  Attributes_Property : constant Glib.Properties.Property_Boxed := 
  284.    --     Glib.Properties.Build ("attributes"); 
  285.    Background_Property : constant Glib.Properties.Property_String := 
  286.      Glib.Properties.Build ("background"); 
  287. --     Background_Gdk_Property : constant Glib.Properties.Property_Boxed := 
  288. --       Glib.Properties.Build ("background-gdk"); 
  289.    Editable_Property : constant Glib.Properties.Property_Boolean := 
  290.      Glib.Properties.Build ("editable"); 
  291. --     Ellipsize_Property : constant Glib.Properties.Property_Enum := 
  292. --       Glib.Properties.Build ("ellipsize"); 
  293.    Family_Property : constant Glib.Properties.Property_String := 
  294.      Glib.Properties.Build ("family"); 
  295.    Font_Property : constant Glib.Properties.Property_String := 
  296.      Glib.Properties.Build ("font"); 
  297. --     Font_Desc_Property : constant Glib.Properties.Property_Boxed := 
  298. --       Glib.Properties.Build ("font-desc"); 
  299.    Foreground_Property : constant Glib.Properties.Property_String := 
  300.      Glib.Properties.Build ("foreground"); 
  301.    Foreground_Gdk_Property : constant Gdk.Color.Property_Gdk_Color := 
  302.      Gdk.Color.Build ("foreground_gdk"); 
  303.    Language_Property : constant Glib.Properties.Property_String := 
  304.      Glib.Properties.Build ("language"); 
  305.    Markup_Property : constant Glib.Properties.Property_String := 
  306.      Glib.Properties.Build ("markup"); 
  307.    Rise_Property : constant Glib.Properties.Property_Int := 
  308.      Glib.Properties.Build ("rise"); 
  309.    Scale_Property : constant Glib.Properties.Property_Double := 
  310.      Glib.Properties.Build ("scale"); 
  311.    Single_Paragraph_Mode_Property : constant Glib.Properties.Property_Boolean 
  312.      := Glib.Properties.Build ("single-paragraph-mode"); 
  313.    Size_Property : constant Glib.Properties.Property_Int := 
  314.      Glib.Properties.Build ("size"); 
  315.    Size_Points_Property : constant Glib.Properties.Property_Double := 
  316.      Glib.Properties.Build ("size-points"); 
  317. --     Stretch_Property : constant Glib.Properties.Property_Enum := 
  318. --       Glib.Properties.Build ("stretch"); 
  319.    Strikethrough_Property : constant Glib.Properties.Property_Boolean := 
  320.      Glib.Properties.Build ("strikethrough"); 
  321. --     Style_Property : constant Glib.Properties.Property_Enum := 
  322. --       Glib.Properties.Build ("style"); 
  323.    Text_Property : constant Glib.Properties.Property_String := 
  324.      Glib.Properties.Build ("text"); 
  325. --     Underline_Property : constant Glib.Properties.Property_Enum := 
  326. --       Glib.Properties.Build ("underline"); 
  327. --     Variant_Property : constant Glib.Properties.Property_Enum := 
  328. --       Glib.Properties.Build ("variant"); 
  329.    Weight_Property : constant Glib.Properties.Property_Int := 
  330.      Glib.Properties.Build ("weight"); 
  331.    Width_Chars_Property : constant Glib.Properties.Property_Int := 
  332.      Glib.Properties.Build ("width-chars"); 
  333.    Wrap_Mode_Property : constant Pango.Enums.Property_Wrap_Mode := 
  334.      Pango.Enums.Property_Wrap_Mode (Glib.Build ("wrap-mode")); 
  335.    Wrap_Width_Property : constant Glib.Properties.Property_Int := 
  336.      Glib.Properties.Build ("wrap-width"); 
  337.  
  338.    pragma Import (C, Get_Type,  "gtk_cell_renderer_text_get_type"); 
  339. end Gtk.Cell_Renderer_Text;