/src/wrappers/gtk/library/gtk_cell_renderer_text.e

http://github.com/tybor/Liberty · Specman e · 501 lines · 142 code · 157 blank · 202 comment · 2 complexity · 9717c9ea6f0fbe953c9f9f5421cf8a5a MD5 · raw file

  1. indexing
  2. description: "GtkCellRendererText Renders text in a cell."
  3. copyright: "[
  4. Copyright (C) 2006 eiffel-libraries team, GTK+ team
  5. This library is free software; you can redistribute it and/or
  6. modify it under the terms of the GNU Lesser General Public License
  7. as published by the Free Software Foundation; either version 2.1 of
  8. the License, or (at your option) any later version.
  9. This library is distributed in the hope that it will be useful, but
  10. WITHOUT ANY WARRANTY; without even the implied warranty of
  11. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  12. Lesser General Public License for more details.
  13. You should have received a copy of the GNU Lesser General Public
  14. License along with this library; if not, write to the Free Software
  15. Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
  16. 02110-1301 USA
  17. ]"
  18. class GTK_CELL_RENDERER_TEXT
  19. -- A GtkCellRendererText renders a given text in its cell, using
  20. -- the font, color and style information provided by its
  21. -- properties. The text will be ellipsized if it is too long and
  22. -- the ellipsize property allows it.
  23. -- If the mode is GTK_CELL_RENDERER_MODE_EDITABLE, the
  24. -- GtkCellRendererText allows to edit its text using an entry.
  25. inherit GTK_CELL_RENDERER
  26. insert
  27. PANGO_STYLE
  28. GTK_CELL_RENDERER_TEXT_EXTERNALS
  29. creation make, from_external_pointer
  30. feature -- size
  31. struct_size: INTEGER is
  32. external "C inline use <gtk/gtk.h>"
  33. alias "sizeof(GtkCellRendererText)"
  34. end
  35. feature {} -- Creation
  36. make is
  37. -- Creates a new GtkCellRendererText. Adjust how text is
  38. -- drawn using object properties. Object properties can be
  39. -- set globally (with `G_OBJECT.set'). Also, with
  40. -- GtkTreeViewColumn, you can bind a property to a value in a
  41. -- GtkTreeModel. For example, you can bind the "text"
  42. -- property on the cell renderer to a string value in the
  43. -- model, thus rendering a different string in each row of
  44. -- the GtkTreeView
  45. do
  46. from_external_pointer (gtk_cell_renderer_text_new)
  47. end
  48. feature
  49. set_fixed_height_from_font (number_of_rows: INTEGER) is
  50. -- Sets the height of a renderer to explicitly be determined
  51. -- by the "font" and "y_pad" property set on it. Further
  52. -- changes in these properties do not affect the height, so
  53. -- they must be accompanied by a subsequent call to this
  54. -- function. Using this function is unflexible, and should
  55. -- really only be used if calculating the size of a cell is
  56. -- too slow (ie, a massive number of cells displayed). If
  57. -- number_of_rows is -1, then the fixed height is unset, and
  58. -- the height is determined by the properties again.
  59. require valid_number_of_rows: number_of_rows >= -1
  60. do
  61. gtk_cell_renderer_text_set_fixed_height_from_font (handle,number_of_rows)
  62. end
  63. feature -- Property Details
  64. -- The "attributes" property
  65. -- "attributes" PangoAttrList : Read / Write
  66. -- A list of style attributes to apply to the text of the renderer.
  67. -- The "background" property
  68. -- "background" gchararray : Write
  69. -- Background color as a string.
  70. -- Default value: NULL
  71. -- The "background-gdk" property
  72. -- "background-gdk" GdkColor : Read / Write
  73. -- Background color as a GdkColor.
  74. -- The "background-set" property
  75. -- "background-set" gboolean : Read / Write
  76. -- Whether this tag affects the background color.
  77. -- Default value: FALSE
  78. -- The "editable" property
  79. -- "editable" gboolean : Read / Write
  80. -- Whether the text can be modified by the user.
  81. -- Default value: FALSE
  82. -- The "editable-set" property
  83. -- "editable-set" gboolean : Read / Write
  84. -- Whether this tag affects text editability.
  85. -- Default value: FALSE
  86. -- The "ellipsize" property
  87. -- "ellipsize" PangoEllipsizeMode : Read / Write
  88. -- Specifies the preferred place to ellipsize the string, if the cell renderer does not have enough room to display the entire string. Setting it to PANGO_ELLIPSIZE_NONE turns off ellipsizing. See the wrap-width property for another way of making the text fit into a given width.
  89. -- Default value: PANGO_ELLIPSIZE_NONE
  90. -- Since 2.6
  91. -- The "ellipsize-set" property
  92. -- "ellipsize-set" gboolean : Read / Write
  93. -- Whether this tag affects the ellipsize mode.
  94. -- Default value: FALSE
  95. -- The "family" property
  96. -- "family" gchararray : Read / Write
  97. -- Name of the font family, e.g. Sans, Helvetica, Times, Monospace.
  98. -- Default value: NULL
  99. -- The "family-set" property
  100. -- "family-set" gboolean : Read / Write
  101. -- Whether this tag affects the font family.
  102. -- Default value: FALSE
  103. -- The "font" property
  104. -- "font" gchararray : Read / Write
  105. -- Font description as a string.
  106. -- Default value: NULL
  107. -- The "font-desc" property
  108. -- "font-desc" PangoFontDescription : Read / Write
  109. -- Font description as a PangoFontDescription struct.
  110. -- The "foreground" property
  111. -- "foreground" gchararray : Write
  112. -- Foreground color as a string.
  113. -- Default value: NULL
  114. -- The "foreground-gdk" property
  115. -- "foreground-gdk" GdkColor : Read / Write
  116. -- Foreground color as a GdkColor.
  117. -- The "foreground-set" property
  118. -- "foreground-set" gboolean : Read / Write
  119. -- Whether this tag affects the foreground color.
  120. -- Default value: FALSE
  121. -- The "language" property
  122. -- "language" gchararray : Read / Write
  123. -- The language this text is in, as an ISO code. Pango can use this as a hint when rendering the text. If you don't understand this parameter, you probably don't need it.
  124. -- Default value: NULL
  125. -- The "language-set" property
  126. -- "language-set" gboolean : Read / Write
  127. -- Whether this tag affects the language the text is rendered as.
  128. -- Default value: FALSE
  129. -- The "markup" property
  130. -- "markup" gchararray : Write
  131. -- Marked up text to render.
  132. -- Default value: NULL
  133. -- The "rise" property
  134. -- "rise" gint : Read / Write
  135. -- Offset of text above the baseline (below the baseline if rise is negative).
  136. -- Allowed values: >= -2147483647
  137. -- Default value: 0
  138. -- The "rise-set" property
  139. -- "rise-set" gboolean : Read / Write
  140. -- Whether this tag affects the rise.
  141. -- Default value: FALSE
  142. -- The "scale" property
  143. -- "scale" gdouble : Read / Write
  144. -- Font scaling factor.
  145. -- Allowed values: >= 0
  146. -- Default value: 1
  147. -- The "scale-set" property
  148. -- "scale-set" gboolean : Read / Write
  149. -- Whether this tag scales the font size by a factor.
  150. -- Default value: FALSE
  151. -- The "single-paragraph-mode" property
  152. -- "single-paragraph-mode" gboolean : Read / Write
  153. -- Whether or not to keep all text in a single paragraph.
  154. -- Default value: FALSE
  155. -- The "size" property
  156. -- "size" gint : Read / Write
  157. -- Font size.
  158. -- Allowed values: >= 0
  159. -- Default value: 0
  160. -- The "size-points" property
  161. -- "size-points" gdouble : Read / Write
  162. -- Font size in points.
  163. -- Allowed values: >= 0
  164. -- Default value: 0
  165. -- The "size-set" property
  166. -- "size-set" gboolean : Read / Write
  167. -- Whether this tag affects the font size.
  168. -- Default value: FALSE
  169. -- The "stretch" property
  170. -- "stretch" PangoStretch : Read / Write
  171. -- Font stretch.
  172. -- Default value: PANGO_STRETCH_NORMAL
  173. -- The "stretch-set" property
  174. -- "stretch-set" gboolean : Read / Write
  175. -- Whether this tag affects the font stretch.
  176. -- Default value: FALSE
  177. -- The "strikethrough" property
  178. -- "strikethrough" gboolean : Read / Write
  179. -- Whether to strike through the text.
  180. -- Default value: FALSE
  181. -- The "strikethrough-set" property
  182. -- "strikethrough-set" gboolean : Read / Write
  183. -- Whether this tag affects strikethrough.
  184. -- Default value: FALSE
  185. feature -- The "style" property
  186. -- "style" PangoStyle : Read / Write
  187. style: INTEGER is
  188. -- Font style. Default value: PANGO_STYLE_NORMAL
  189. do
  190. Result:= property(style_property_name).integer
  191. ensure is_valid_pango_style (Result)
  192. end
  193. set_style (a_style: INTEGER) is
  194. require valid_style: is_valid_pango_style (a_style)
  195. do
  196. set_enum_property (style_property_name, a_style)
  197. end
  198. feature -- The "style-set" property
  199. -- "style-set" gboolean : Read / Write
  200. is_style_set: BOOLEAN is
  201. -- Does this tag affect the font style? Default value: False
  202. do
  203. Result:= boolean_property (style_set_property_name)
  204. end
  205. enable_style is
  206. -- Makes current tag affects the font style
  207. do
  208. set_boolean_property (style_set_property_name, True)
  209. ensure enabled: is_style_set
  210. end
  211. disable_style is
  212. -- Makes current tag not to affect the font style
  213. do
  214. set_boolean_property (style_set_property_name,False)
  215. ensure disabled: not is_style_set
  216. end
  217. feature -- The "text" property
  218. -- "text" gchararray : Read / Write
  219. -- Default value: NULL
  220. text: STRING is
  221. -- Text to render.
  222. do
  223. --create Result.from_external (property (text_property_name).string)
  224. Result := property (text_property_name).string
  225. end
  226. set_text (a_text: STRING) is
  227. require text_not_void: a_text /= Void
  228. do
  229. set_property (text_property_name, create {G_VALUE}.from_string (a_text))
  230. ensure set: text.is_equal (a_text)
  231. end
  232. feature -- The "underline" property
  233. -- "underline" PangoUnderline : Read / Write
  234. -- Style of underline for this text.
  235. -- Default value: PANGO_UNDERLINE_NONE
  236. -- The "underline-set" property
  237. -- "underline-set" gboolean : Read / Write
  238. -- Whether this tag affects underlining.
  239. -- Default value: FALSE
  240. -- The "variant" property
  241. -- "variant" PangoVariant : Read / Write
  242. -- Font variant.
  243. -- Default value: PANGO_VARIANT_NORMAL
  244. -- The "variant-set" property
  245. -- "variant-set" gboolean : Read / Write
  246. -- Whether this tag affects the font variant.
  247. -- Default value: FALSE
  248. -- The "weight" property
  249. -- "weight" gint : Read / Write
  250. -- Font weight.
  251. -- Allowed values: >= 0
  252. -- Default value: 400
  253. -- The "weight-set" property
  254. -- "weight-set" gboolean : Read / Write
  255. -- Whether this tag affects the font weight.
  256. -- Default value: FALSE
  257. -- The "width-chars" property
  258. -- "width-chars" gint : Read / Write
  259. -- The desired width of the cell, in characters. If this property is set to -1, the width will be calculated automatically, otherwise the cell will request either 3 characters or the property value, whichever is greater.
  260. -- Allowed values: >= -1
  261. -- Default value: -1
  262. -- Since 2.6
  263. -- The "wrap-mode" property
  264. -- "wrap-mode" PangoWrapMode : Read / Write
  265. -- Specifies how to break the string into multiple lines, if the cell renderer does not have enough room to display the entire string. This property has no effect unless the wrap-width property is set.
  266. -- Default value: PANGO_WRAP_CHAR
  267. -- Since 2.8
  268. -- The "wrap-width" property
  269. -- "wrap-width" gint : Read / Write
  270. -- Specifies the width at which the text is wrapped. The wrap-mode property can be used to influence at what character positions the line breaks can be placed. Setting wrap-width to -1 turns wrapping off.
  271. -- Allowed values: >= -1
  272. -- Default value: -1
  273. -- Since 2.8
  274. feature -- "edited"
  275. edited_signal_name: STRING is "edited"
  276. -- "edited"
  277. -- void user_function (GtkCellRendererText *cellrenderertext,
  278. -- gchar *arg1,
  279. -- gchar *arg2,
  280. -- gpointer user_data);
  281. enable_on_edited is
  282. -- Connects "edited" signal to `on_edited' feature.
  283. do
  284. connect (Current, edited_signal_name, $on_edited)
  285. end
  286. on_edited: INTEGER is
  287. do
  288. end
  289. connect_agent_to_edited_signal (a_procedure: PROCEDURE[ANY, TUPLE [STRING, STRING, GTK_CELL_RENDERER_TEXT]]) is
  290. -- cellrenderertext : the object which received the signal.
  291. require
  292. valid_procedure: a_procedure /= Void
  293. wrapper_is_stored: is_eiffel_wrapper_stored
  294. local
  295. edited_callback: EDITED_CALLBACK
  296. do
  297. create edited_callback.make
  298. edited_callback.connect (Current, a_procedure)
  299. end
  300. feature -- Properties name strings
  301. alignment_property_name: STRING is "alignment"
  302. attributes_property_name: STRING is "attributes"
  303. background_property_name: STRING is "background"
  304. background_gdk_property_name: STRING is "background-gdk"
  305. background_set_property_name: STRING is "background-set"
  306. editable_property_name: STRING is "editable"
  307. editable_set_property_name: STRING is "editable-set"
  308. ellipsize_property_name: STRING is "ellipsize"
  309. ellipsize_set_property_name: STRING is "ellipsize-set"
  310. family_property_name: STRING is "family"
  311. family_set_property_name: STRING is "family-set"
  312. font_property_name: STRING is "font"
  313. font_desc_property_name: STRING is "font-desc"
  314. foreground_property_name: STRING is "foreground"
  315. foreground_gdk_property_name: STRING is "foreground-gdk"
  316. foreground_set_property_name: STRING is "foreground-set"
  317. language_property_name: STRING is "language"
  318. language_set_property_name: STRING is "language-set"
  319. markup_property_name: STRING is "markup"
  320. rise_property_name: STRING is "rise"
  321. rise_set_property_name: STRING is "rise-set"
  322. scale_property_name: STRING is "scale"
  323. scale_set_property_name: STRING is "scale-set"
  324. single_paragraph_mode_property_name: STRING is "single-paragraph-mode"
  325. size_property_name: STRING is "size"
  326. size_points_property_name: STRING is "size-points"
  327. size_set_property_name: STRING is "size-set"
  328. stretch_property_name: STRING is "stretch"
  329. stretch_set_property_name: STRING is "stretch-set"
  330. strikethrough_property_name: STRING is "strikethrough"
  331. strikethrough_set_property_name: STRING is "strikethrough-set"
  332. style_property_name: STRING is "style"
  333. style_set_property_name: STRING is "style-set"
  334. text_property_name: STRING is "text"
  335. underline_property_name: STRING is "underline"
  336. underline_set_property_name: STRING is "underline-set"
  337. variant_property_name: STRING is "variant"
  338. variant_set_property_name: STRING is "variant-set"
  339. weight_property_name: STRING is "weight"
  340. weight_set_property_name: STRING is "weight-set"
  341. width_chars_property_name: STRING is "width-chars"
  342. wrap_mode_property_name: STRING is "wrap-mode"
  343. wrap_width_property_name: STRING is "wrap-width"
  344. end -- class GTK_CELL_RENDERER_TEXT