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