summaryrefslogtreecommitdiff
path: root/docs/reference/pygtk-gtktextattributes.xml
blob: 89b1fbd4ab3cf3ccd33920c3e66e615da55b7a9e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
<?xml version="1.0" standalone="no"?>
<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.1.2//EN"
    "http://www.oasis-open.org/docbook/xml/4.1.2/docbookx.dtd">

<refentry id="class-gtktextattributes">
  <refnamediv>
    <refname>gtk.TextAttributes</refname>
    <refpurpose>an object containing the attributes set on some
text</refpurpose>
  </refnamediv>

  <refsect1>
    <title>Synopsis</title>

    <classsynopsis language="python">
      <ooclass><classname>gtk.TextAttributes</classname></ooclass>
      <ooclass><classname>gobject.GBoxed</classname></ooclass>
      <constructorsynopsis language="python">
	<methodname><link
linkend="constructor-gtktextattributes">gtk.TextAttributes</link></methodname>
	<methodparam></methodparam>  </constructorsynopsis>
      <methodsynopsis language="python">
	<methodname><link
linkend="method-gtktextattributes--copy">copy</link></methodname>
	<methodparam></methodparam>  </methodsynopsis>
      <methodsynopsis language="python">
	<methodname><link
linkend="method-gtktextattributes--copy-values">copy_values</link></methodname>
	<methodparam><parameter role="keyword">dest</parameter></methodparam>
      </methodsynopsis>
    </classsynopsis>

  </refsect1>

  <refsect1>
    <title>Attributes</title>

    <blockquote role="properties">
      <informaltable pgwide="1" frame="none">
	<tgroup cols="3">
	<?dbhtml cellpadding="5"?>
	  <colspec column="1" colwidth="1in"/>
	  <colspec column="2" colwidth="1in"/>
	  <colspec column="3" colwidth="4in"/>
	  <tbody>

	    <row valign="top">
	      <entry>"bg_color"</entry>
	      <entry>Read</entry>
	      <entry>The background color</entry>
	    </row>

	    <row valign="top">
	      <entry>"fg_color"</entry>
	      <entry>Read</entry>
	      <entry>The foreground color</entry>
	    </row>

	    <row valign="top">
	      <entry>"bg_stipple"</entry>
	      <entry>Read</entry>
	      <entry>The background stipple bitmap</entry>
	    </row>

	    <row valign="top">
	      <entry>"fg_stipple"</entry>
	      <entry>Read</entry>
	      <entry>The foreground stipple bitmap</entry>
	    </row>

	    <row valign="top">
	      <entry>"rise"</entry>
	      <entry>Read</entry>
	      <entry>The subscript or superscript rise</entry>
	    </row>

	    <row valign="top">
	      <entry>"underline"</entry>
	      <entry>Read</entry>
	      <entry>The style of underline - one of:
<literal>pango.UNDERLINE_NONE</literal>,
<literal>pango.UNDERLINE_SINGLE</literal>,
<literal>pango.UNDERLINE_DOUBLE</literal>,
<literal>pango.UNDERLINE_LOW</literal></entry>
	    </row>

	    <row valign="top">
	      <entry>"strikethrough"</entry>
	      <entry>Read</entry>
	      <entry>If <literal>True</literal> strikethrough the text</entry>
	    </row>

	    <row valign="top">
	      <entry>"draw_bg"</entry>
	      <entry>Read</entry>
	      <entry>If <literal>True</literal> some background attributes
are set</entry>
	    </row>

	    <row valign="top">
	      <entry>"justification"</entry>
	      <entry>Read</entry>
	      <entry>The type of justification - one of:
<literal>gtk.JUSTIFY_LEFT</literal>, <literal>gtk.JUSTIFY_RIGHT</literal>,
<literal>gtk.JUSTIFY_CENTER</literal>,
<literal>gtk.JUSTIFY_FILL</literal></entry>
	    </row>

	    <row valign="top">
	      <entry>"direction"</entry>
	      <entry>Read</entry>
	      <entry>The text direction - one of:
<literal>gtk.TEXT_DIR_NONE</literal>, <literal>gtk.TEXT_DIR_LTR</literal>,
<literal>gtk.TEXT_DIR_RTL</literal></entry>
	    </row>

	    <row valign="top">
	      <entry>"font"</entry>
	      <entry>Read</entry>
	      <entry>A <classname>pango.FontDescription</classname></entry>
	    </row>

	    <row valign="top">
	      <entry>"font_scale"</entry>
	      <entry>Read</entry>
	      <entry>The scale of the font e.g. 2.5</entry>
	    </row>

	    <row valign="top">
	      <entry>"left_margin"</entry>
	      <entry>Read</entry>
	      <entry>The width of the left margin in pixels</entry>
	    </row>

	    <row valign="top">
	      <entry>"indent"</entry>
	      <entry>Read</entry>
	      <entry>The width of the paragraph indent in pixels</entry>
	    </row>

	    <row valign="top">
	      <entry>"right_margin"</entry>
	      <entry>Read</entry>
	      <entry>The width of the right margin</entry>
	    </row>

	    <row valign="top">
	      <entry>"pixels_above_lines"</entry>
	      <entry>Read</entry>
	      <entry>The number of pixels space above a paragraph</entry>
	    </row>

	    <row valign="top">
	      <entry>"pixels_below_lines"</entry>
	      <entry>Read</entry>
	      <entry>The number of pixels space below a paragraph</entry>
	    </row>

	    <row valign="top">
	      <entry>"pixels_inside_wrap"</entry>
	      <entry>Read</entry>
	      <entry>The number of pixels of space between wrapped lines in
a paragraph</entry>
	    </row>

	    <row valign="top">
	      <entry>"tabs"</entry>
	      <entry>Read</entry>
	      <entry>A set of tabs contained in a
<classname>pango.TabArray</classname></entry>
	    </row>

	    <row valign="top">
	      <entry>"wrap_mode"</entry>
	      <entry>Read</entry>
	      <entry>The wrap mode - one of: <literal>gtk.WRAP_NONE</literal>,
  <literal>gtk.WRAP_CHAR</literal>,
  <literal>gtk.WRAP_WORD</literal></entry>
	    </row>

	    <row valign="top">
	      <entry>"language"</entry>
	      <entry>Read</entry>
	      <entry>The <classname>pango.Language</classname> object
describing the text language</entry>
	    </row>

	    <row valign="top">
	      <entry>"invisible"</entry>
	      <entry>Read</entry>
	      <entry>If <literal>True</literal> the text is hidden (Not
implemented in PyGTK2)</entry>
	    </row>

	    <row valign="top">
	      <entry>"bg_full_height"</entry>
	      <entry>Read</entry>
	      <entry>If <literal>True</literal> the background is fit to the
full line height</entry>
	    </row>

	    <row valign="top">
	      <entry>"editable"</entry>
	      <entry>Read</entry>
	      <entry>If <literal>True</literal> the text is editable</entry>
	    </row>

	    <row valign="top">
	      <entry>"realized"</entry>
	      <entry>Read</entry>
	      <entry>If <literal>True</literal> the text has been
realized</entry>
	    </row>

	    <row valign="top">
	      <entry>"pad1"</entry>
	      <entry>Read</entry>
	      <entry></entry>
	    </row>

	    <row valign="top">
	      <entry>"pad2"</entry>
	      <entry>Read</entry>
	      <entry></entry>
	    </row>

	    <row valign="top">
	      <entry>"pad3"</entry>
	      <entry>Read</entry>
	      <entry></entry>
	    </row>

	    <row valign="top">
	      <entry>"pad4"</entry>
	      <entry>Read</entry>
	      <entry></entry>
	    </row>

	</tbody>
      </tgroup>
      </informaltable>
    </blockquote>

  </refsect1>

  <refsect1>
    <title>Description</title>

    <para>A <link
linkend="class-gtktextattributes"><classname>gtk.TextAttributes</classname></link> 
object holds a set of attributes that describe the properties of a section
of text. A <link
linkend="class-gtktextattributes"><classname>gtk.TextAttributes</classname></link> 
object is usually obtained by calling either of the <link
linkend="method-gtktextiter--get-attributes"><methodname>gtk.TextIter.get_attributes</methodname>()</link> 
or <link
linkend="method-gtktextview--get-default-attributes"><methodname>gtk.TextView.get_default_attributes</methodname>()</link> 
methods to retrieve the attributes in effect.</para>

    <para>A <link
linkend="class-gtktextattributes"><classname>gtk.TextAttributes</classname></link> 
object created with <link
linkend="constructor-gtktextattributes">gtk.TextAttributes</link>() cannot
be applied within PyGTK because there is no way to set the attributes.
Likewise, the <link
linkend="method-gtktextattributes--copy"><methodname>copy</methodname>()</link> 
and <link
linkend="method-gtktextattributes--copy-values"><methodname>copy_values</methodname>()</link> 
methods can create a new copy or copy the attributes but there are no
methods in PyGTK that take a <link
linkend="class-gtktextattributes"><classname>gtk.TextAttributes</classname></link> 
object as an argument. The most effective way to use a <link
linkend="class-gtktextattributes"><classname>gtk.TextAttributes</classname></link> 
object is to read its attributes and use them to set the properties of a
<link
linkend="class-gtktexttag"><classname>gtk.TextTag</classname></link>.</para>

  </refsect1>

  <refsect1 id="constructor-gtktextattributes">
    <title>Constructor</title>

    <programlisting><constructorsynopsis language="python">
	<methodname>gtk.TextAttributes</methodname>
	<methodparam></methodparam>  </constructorsynopsis></programlisting>
    <variablelist>
      <varlistentry>
	<term><emphasis>Returns</emphasis>&nbsp;:</term>
	<listitem><simpara>a new <link
linkend="class-gtktextattributes"><classname>gtk.TextAttributes</classname></link></simpara></listitem>
      </varlistentry>
    </variablelist>

    <para>Creates a <link
linkend="class-gtktextattributes"><classname>gtk.TextAttributes</classname></link> 
object, that contains a set of attributes of some text.</para>

  </refsect1>

  <refsect1>
    <title>Methods</title>

  <refsect2 id="method-gtktextattributes--copy">
      <title>gtk.TextAttributes.copy</title>

      <programlisting><methodsynopsis language="python">
	  <methodname>copy</methodname>
	  <methodparam></methodparam>  </methodsynopsis></programlisting>
      <variablelist>
	<varlistentry>
	  <term><emphasis>Returns</emphasis>&nbsp;:</term>
	  <listitem><simpara>a copy of the <link
linkend="class-gtktextattributes"><classname>gtk.TextAttributes</classname></link> 
object</simpara></listitem>
	</varlistentry>
      </variablelist>

      <para>The <methodname>copy</methodname>() method copies the text
attributes and returns a new <link
linkend="class-gtktextattributes"><classname>gtk.TextAttributes</classname></link> 
object.</para>

    </refsect2>

    <refsect2 id="method-gtktextattributes--copy-values">
      <title>gtk.TextAttributes.copy_values</title>

      <programlisting><methodsynopsis language="python">
	  <methodname>copy_values</methodname>
	  <methodparam><parameter
			 role="keyword">dest</parameter></methodparam>
	</methodsynopsis></programlisting>
      <variablelist>
	<varlistentry>
	  <term><parameter role="keyword">dest</parameter>&nbsp;:</term>
	  <listitem><simpara>the <link
linkend="class-gtktextattributes"><classname>gtk.TextAttributes</classname></link> 
whose attributes will be set</simpara></listitem>
	</varlistentry>
      </variablelist>

      <para>The <methodname>copy_values</methodname>() method copies the
values from the <link
linkend="class-gtktextattributes"><classname>gtk.TextAttributes</classname></link> 
object to <parameter>dest</parameter> so that <parameter>dest</parameter>
has the same values. Frees existing values in
<parameter>dest</parameter>.</para>

      </refsect2>

  </refsect1>

</refentry>