PageRenderTime 22ms CodeModel.GetById 16ms app.highlight 2ms RepoModel.GetById 1ms app.codeStats 0ms

/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
  1indexing
  2	description: "GtkCellRendererText Renders text in a cell."
  3	copyright: "[
  4					Copyright (C) 2006 eiffel-libraries team, GTK+ team
  5					
  6					This library is free software; you can redistribute it and/or
  7					modify it under the terms of the GNU Lesser General Public License
  8					as published by the Free Software Foundation; either version 2.1 of
  9					the License, or (at your option) any later version.
 10					
 11					This library is distributed in the hope that it will be useful, but
 12					WITHOUT ANY WARRANTY; without even the implied warranty of
 13					MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 14					Lesser General Public License for more details.
 15
 16					You should have received a copy of the GNU Lesser General Public
 17					License along with this library; if not, write to the Free Software
 18					Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
 19					02110-1301 USA
 20					]"
 21
 22class GTK_CELL_RENDERER_TEXT
 23	-- A GtkCellRendererText renders a given text in its cell, using
 24	-- the font, color and style information provided by its
 25	-- properties. The text will be ellipsized if it is too long and
 26	-- the ellipsize property allows it.
 27
 28	-- If the mode is GTK_CELL_RENDERER_MODE_EDITABLE, the
 29	-- GtkCellRendererText allows to edit its text using an entry.
 30
 31inherit GTK_CELL_RENDERER
 32
 33insert
 34	PANGO_STYLE
 35	GTK_CELL_RENDERER_TEXT_EXTERNALS
 36
 37creation make, from_external_pointer
 38
 39feature -- size
 40	struct_size: INTEGER is
 41		external "C inline use <gtk/gtk.h>"
 42		alias "sizeof(GtkCellRendererText)"
 43		end
 44
 45feature {} -- Creation
 46
 47	make is
 48			-- Creates a new GtkCellRendererText. Adjust how text is
 49			-- drawn using object properties. Object properties can be
 50			-- set globally (with `G_OBJECT.set'). Also, with
 51			-- GtkTreeViewColumn, you can bind a property to a value in a
 52			-- GtkTreeModel. For example, you can bind the "text"
 53			-- property on the cell renderer to a string value in the
 54			-- model, thus rendering a different string in each row of
 55			-- the GtkTreeView
 56		do
 57			from_external_pointer (gtk_cell_renderer_text_new)
 58		end
 59
 60feature
 61	set_fixed_height_from_font (number_of_rows: INTEGER) is
 62			-- Sets the height of a renderer to explicitly be determined
 63			-- by the "font" and "y_pad" property set on it. Further
 64			-- changes in these properties do not affect the height, so
 65			-- they must be accompanied by a subsequent call to this
 66			-- function. Using this function is unflexible, and should
 67			-- really only be used if calculating the size of a cell is
 68			-- too slow (ie, a massive number of cells displayed). If
 69			-- number_of_rows is -1, then the fixed height is unset, and
 70			-- the height is determined by the properties again.
 71		require valid_number_of_rows: number_of_rows >= -1
 72		do
 73			gtk_cell_renderer_text_set_fixed_height_from_font (handle,number_of_rows)
 74		end
 75
 76feature -- Property Details
 77-- The "attributes" property
 78
 79--   "attributes"           PangoAttrList         : Read / Write
 80
 81-- A list of style attributes to apply to the text of the renderer.
 82-- The "background" property
 83
 84--   "background"           gchararray            : Write
 85
 86-- Background color as a string.
 87
 88-- Default value: NULL
 89-- The "background-gdk" property
 90
 91--   "background-gdk"       GdkColor              : Read / Write
 92
 93-- Background color as a GdkColor.
 94-- The "background-set" property
 95
 96--   "background-set"       gboolean              : Read / Write
 97
 98-- Whether this tag affects the background color.
 99
100-- Default value: FALSE
101-- The "editable" property
102
103--   "editable"             gboolean              : Read / Write
104
105-- Whether the text can be modified by the user.
106
107-- Default value: FALSE
108-- The "editable-set" property
109
110--   "editable-set"         gboolean              : Read / Write
111
112-- Whether this tag affects text editability.
113
114-- Default value: FALSE
115-- The "ellipsize" property
116
117--   "ellipsize"            PangoEllipsizeMode    : Read / Write
118
119-- 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.
120
121-- Default value: PANGO_ELLIPSIZE_NONE
122
123-- Since 2.6
124-- The "ellipsize-set" property
125
126--   "ellipsize-set"        gboolean              : Read / Write
127
128-- Whether this tag affects the ellipsize mode.
129
130-- Default value: FALSE
131-- The "family" property
132
133--   "family"               gchararray            : Read / Write
134
135-- Name of the font family, e.g. Sans, Helvetica, Times, Monospace.
136
137-- Default value: NULL
138-- The "family-set" property
139
140--   "family-set"           gboolean              : Read / Write
141
142-- Whether this tag affects the font family.
143
144-- Default value: FALSE
145-- The "font" property
146
147--   "font"                 gchararray            : Read / Write
148
149-- Font description as a string.
150
151-- Default value: NULL
152-- The "font-desc" property
153
154--   "font-desc"            PangoFontDescription  : Read / Write
155
156-- Font description as a PangoFontDescription struct.
157-- The "foreground" property
158
159--   "foreground"           gchararray            : Write
160
161-- Foreground color as a string.
162
163-- Default value: NULL
164-- The "foreground-gdk" property
165
166--   "foreground-gdk"       GdkColor              : Read / Write
167
168-- Foreground color as a GdkColor.
169-- The "foreground-set" property
170
171--   "foreground-set"       gboolean              : Read / Write
172
173-- Whether this tag affects the foreground color.
174
175-- Default value: FALSE
176-- The "language" property
177
178--   "language"             gchararray            : Read / Write
179
180-- 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.
181
182-- Default value: NULL
183-- The "language-set" property
184
185--   "language-set"         gboolean              : Read / Write
186
187-- Whether this tag affects the language the text is rendered as.
188
189-- Default value: FALSE
190-- The "markup" property
191
192--   "markup"               gchararray            : Write
193
194-- Marked up text to render.
195
196-- Default value: NULL
197-- The "rise" property
198
199--   "rise"                 gint                  : Read / Write
200
201-- Offset of text above the baseline (below the baseline if rise is negative).
202
203-- Allowed values: >= -2147483647
204
205-- Default value: 0
206-- The "rise-set" property
207
208--   "rise-set"             gboolean              : Read / Write
209
210-- Whether this tag affects the rise.
211
212-- Default value: FALSE
213-- The "scale" property
214
215--   "scale"                gdouble               : Read / Write
216
217-- Font scaling factor.
218
219-- Allowed values: >= 0
220
221-- Default value: 1
222-- The "scale-set" property
223
224--   "scale-set"            gboolean              : Read / Write
225
226-- Whether this tag scales the font size by a factor.
227
228-- Default value: FALSE
229-- The "single-paragraph-mode" property
230
231--   "single-paragraph-mode" gboolean              : Read / Write
232
233-- Whether or not to keep all text in a single paragraph.
234
235-- Default value: FALSE
236-- The "size" property
237
238--   "size"                 gint                  : Read / Write
239
240-- Font size.
241
242-- Allowed values: >= 0
243
244-- Default value: 0
245-- The "size-points" property
246
247--   "size-points"          gdouble               : Read / Write
248
249-- Font size in points.
250
251-- Allowed values: >= 0
252
253-- Default value: 0
254-- The "size-set" property
255
256--   "size-set"             gboolean              : Read / Write
257
258-- Whether this tag affects the font size.
259
260-- Default value: FALSE
261-- The "stretch" property
262
263--   "stretch"              PangoStretch          : Read / Write
264
265-- Font stretch.
266
267-- Default value: PANGO_STRETCH_NORMAL
268-- The "stretch-set" property
269
270--   "stretch-set"          gboolean              : Read / Write
271
272-- Whether this tag affects the font stretch.
273
274-- Default value: FALSE
275-- The "strikethrough" property
276
277--   "strikethrough"        gboolean              : Read / Write
278
279-- Whether to strike through the text.
280
281-- Default value: FALSE
282-- The "strikethrough-set" property
283
284--   "strikethrough-set"    gboolean              : Read / Write
285
286-- Whether this tag affects strikethrough.
287
288-- Default value: FALSE
289
290feature -- The "style" property
291	--   "style"                PangoStyle            : Read / Write
292
293	style: INTEGER is
294			-- Font style. Default value: PANGO_STYLE_NORMAL
295		do
296			Result:= property(style_property_name).integer
297		ensure is_valid_pango_style (Result)
298		end
299
300	set_style (a_style: INTEGER) is
301		require valid_style: is_valid_pango_style (a_style)
302		do
303			set_enum_property (style_property_name, a_style)
304		end
305
306feature -- The "style-set" property
307	--   "style-set"            gboolean              : Read / Write
308
309	is_style_set: BOOLEAN is
310			-- Does this tag affect the font style? Default value: False
311		do
312			Result:= boolean_property (style_set_property_name)
313		end
314
315	enable_style is
316			-- Makes current tag affects the font style
317		do
318			set_boolean_property (style_set_property_name, True)
319		ensure enabled: is_style_set
320		end
321
322	disable_style is
323			-- Makes current tag not to affect the font style
324		do
325			set_boolean_property (style_set_property_name,False)
326		ensure disabled: not is_style_set
327		end
328
329feature -- The "text" property
330	--   "text"                 gchararray            : Read / Write
331	-- Default value: NULL
332
333	text: STRING is
334			-- Text to render.
335		do
336			--create Result.from_external (property (text_property_name).string)
337			Result := property (text_property_name).string
338		end
339
340	set_text (a_text: STRING) is
341		require text_not_void: a_text /= Void
342		do
343			set_property (text_property_name, create {G_VALUE}.from_string (a_text))
344		ensure set: text.is_equal (a_text)
345		end
346
347
348feature -- The "underline" property
349
350--   "underline"            PangoUnderline        : Read / Write
351
352-- Style of underline for this text.
353
354-- Default value: PANGO_UNDERLINE_NONE
355-- The "underline-set" property
356
357--   "underline-set"        gboolean              : Read / Write
358
359-- Whether this tag affects underlining.
360
361-- Default value: FALSE
362-- The "variant" property
363
364--   "variant"              PangoVariant          : Read / Write
365
366-- Font variant.
367
368-- Default value: PANGO_VARIANT_NORMAL
369-- The "variant-set" property
370
371--   "variant-set"          gboolean              : Read / Write
372
373-- Whether this tag affects the font variant.
374
375-- Default value: FALSE
376-- The "weight" property
377
378--   "weight"               gint                  : Read / Write
379
380-- Font weight.
381
382-- Allowed values: >= 0
383
384-- Default value: 400
385-- The "weight-set" property
386
387--   "weight-set"           gboolean              : Read / Write
388
389-- Whether this tag affects the font weight.
390
391-- Default value: FALSE
392-- The "width-chars" property
393
394--   "width-chars"          gint                  : Read / Write
395
396-- 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.
397
398-- Allowed values: >= -1
399
400-- Default value: -1
401
402-- Since 2.6
403-- The "wrap-mode" property
404
405--   "wrap-mode"            PangoWrapMode         : Read / Write
406
407-- 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.
408
409-- Default value: PANGO_WRAP_CHAR
410
411-- Since 2.8
412-- The "wrap-width" property
413
414--   "wrap-width"           gint                  : Read / Write
415
416-- 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.
417
418-- Allowed values: >= -1
419
420-- Default value: -1
421
422-- Since 2.8
423
424feature -- "edited"
425
426	edited_signal_name: STRING is "edited"
427		-- "edited"
428		-- void        user_function                  (GtkCellRendererText *cellrenderertext,
429		--                                             gchar *arg1,
430		--                                             gchar *arg2,
431		--                                             gpointer user_data);
432
433	enable_on_edited is
434			-- Connects "edited" signal to `on_edited' feature.
435		do
436			connect (Current, edited_signal_name, $on_edited)
437		end
438
439	on_edited: INTEGER is
440		do
441		end
442
443	connect_agent_to_edited_signal (a_procedure: PROCEDURE[ANY, TUPLE [STRING, STRING, GTK_CELL_RENDERER_TEXT]]) is
444			-- cellrenderertext : 	the object which received the signal.
445		require
446			valid_procedure: a_procedure /= Void
447			wrapper_is_stored: is_eiffel_wrapper_stored
448		local
449			edited_callback: EDITED_CALLBACK
450		do
451			create edited_callback.make
452			edited_callback.connect (Current, a_procedure)
453		end
454
455feature -- Properties name strings
456
457	alignment_property_name: STRING is "alignment"
458	attributes_property_name: STRING is "attributes"
459	background_property_name: STRING is "background"
460	background_gdk_property_name: STRING is "background-gdk"
461	background_set_property_name: STRING is "background-set"
462	editable_property_name: STRING is "editable"
463	editable_set_property_name: STRING is "editable-set"
464	ellipsize_property_name: STRING is "ellipsize"
465	ellipsize_set_property_name: STRING is "ellipsize-set"
466	family_property_name: STRING is "family"
467	family_set_property_name: STRING is "family-set"
468	font_property_name: STRING is "font"
469	font_desc_property_name: STRING is "font-desc"
470	foreground_property_name: STRING is "foreground"
471	foreground_gdk_property_name: STRING is "foreground-gdk"
472	foreground_set_property_name: STRING is "foreground-set"
473	language_property_name: STRING is "language"
474	language_set_property_name: STRING is "language-set"
475	markup_property_name: STRING is "markup"
476	rise_property_name: STRING is "rise"
477	rise_set_property_name: STRING is "rise-set"
478	scale_property_name: STRING is "scale"
479	scale_set_property_name: STRING is "scale-set"
480	single_paragraph_mode_property_name: STRING is "single-paragraph-mode"
481	size_property_name: STRING is "size"
482	size_points_property_name: STRING is "size-points"
483	size_set_property_name: STRING is "size-set"
484	stretch_property_name: STRING is "stretch"
485	stretch_set_property_name: STRING is "stretch-set"
486	strikethrough_property_name: STRING is "strikethrough"
487	strikethrough_set_property_name: STRING is "strikethrough-set"
488	style_property_name: STRING is "style"
489	style_set_property_name: STRING is "style-set"
490	text_property_name: STRING is "text"
491	underline_property_name: STRING is "underline"
492	underline_set_property_name: STRING is "underline-set"
493	variant_property_name: STRING is "variant"
494	variant_set_property_name: STRING is "variant-set"
495	weight_property_name: STRING is "weight"
496	weight_set_property_name: STRING is "weight-set"
497	width_chars_property_name: STRING is "width-chars"
498	wrap_mode_property_name: STRING is "wrap-mode"
499	wrap_width_property_name: STRING is "wrap-width"
500
501end -- class GTK_CELL_RENDERER_TEXT