/src/wrappers/gtk/library/gtk_label.e

http://github.com/tybor/Liberty · Specman e · 765 lines · 245 code · 148 blank · 372 comment · 2 complexity · 0bdd44f59e6b94316c15d831f9363037 MD5 · raw file

  1. indexing
  2. description: "GtkLabel -- A widget that displays a small to medium amount of text."
  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. date: "$Date:$"
  19. revision: "$Revision:$"
  20. class GTK_LABEL
  21. -- The GTK_LABEL widget displays a small amount of text. As the name
  22. -- implies, most labels are used to label another widget such as a
  23. -- GTK_BUTTON, a GTK_MENU_ITEM, or a GTK_OPTION_MENU.
  24. -- Mnemonics: Labels may contain mnemonics. Mnemonics are
  25. -- underlined characters in the label, used for keyboard
  26. -- navigation. Mnemonics are created by providing a string with an
  27. -- underscore before the mnemonic character, such as "_File", to
  28. -- the `make_with_mnemonic' or `set_text_with_mnemonic' features.
  29. -- Mnemonics automatically activate any activatable widget the
  30. -- label is inside, such as a GtkButton; if the label is not inside
  31. -- the mnemonic's target widget, you have to tell the label about
  32. -- the target using `set_mnemonic_widget'. Here's a simple example
  33. -- where the label is inside a button:
  34. -- -- Pressing Alt+H will activate this button
  35. -- create button.make
  36. -- create label.with_mnemonic ("_Hello")
  37. -- button.add (label)
  38. -- There's a convenience function to create buttons with a mnemonic label already inside:
  39. -- -- Pressing Alt+H will activate this button
  40. -- create button.with_mnemonic ("_Hello")
  41. -- To create a mnemonic for a widget alongside the label, such as a
  42. -- GTK_ENTRY, you have to point the label at the entry with
  43. -- `set_mnemonic_widget':
  44. -- /* Pressing Alt+H will focus the entry */
  45. -- entry = gtk_entry_new ();
  46. -- label = gtk_label_new_with_mnemonic ("_Hello");
  47. -- gtk_label_set_mnemonic_widget (GTK_LABEL (label), entry);
  48. -- Markup (styled text):
  49. -- To make it easy to format text in a label (changing colors,
  50. -- fonts, etc.), label text can be provided in a simple markup
  51. -- format. Here's how to create a label with a small font:
  52. -- label = gtk_label_new (NULL);
  53. -- gtk_label_set_markup (GTK_LABEL (label), "<small>Small text</small>");
  54. -- (See complete documentation of available tags in the Pango
  55. -- manual.)
  56. -- The markup passed to `set_markup' must be valid; for example,
  57. -- literal </>/& characters must be escaped as &lt;, &gt;, and
  58. -- &amp;. If you pass text obtained from the user, file, or a
  59. -- network to `set_markup', you'll want to escape it with (TODO)
  60. -- g_markup_escape_text() or g_markup_printf_escaped().
  61. -- Markup strings are just a convenient way to set the
  62. -- PangoAttrList on a label; `set_attributes' may be a simpler way
  63. -- to set attributes in some cases. Be careful though;
  64. -- PangoAttrList tends to cause internationalization problems,
  65. -- unless you're applying attributes to the entire string
  66. -- (i.e. unless you set the range of each attribute to [0,
  67. -- G_MAXINT)). The reason is that specifying the start_index and
  68. -- end_index for a PangoAttribute requires knowledge of the exact
  69. -- string being displayed, so translations will cause problems.
  70. -- Selectable labels: Labels can be made selectable with
  71. -- gtk_label_set_selectable(). Selectable labels allow the user to
  72. -- copy the label contents to the clipboard. Only labels that
  73. -- contain useful-to-copy information - such as error messages -
  74. -- should be made selectable.
  75. -- Text layout: a label can contain any number of paragraphs, but
  76. -- will have performance problems if it contains more than a small
  77. -- number. Paragraphs are separated by newlines or other paragraph
  78. -- separators understood by Pango.
  79. -- Labels can automatically wrap text if you call `set_line_wrap'.
  80. -- `set_justify' sets how the lines in a label align with one
  81. -- another. If you want to set how the label as a whole aligns in
  82. -- its available space, see `set_alignment' (from GTK_MISC).
  83. inherit
  84. GTK_MISC
  85. -- Implemented Interfaces: GtkLabel implements
  86. -- AtkImplementorIface.
  87. insert GTK_LABEL_EXTERNALS
  88. creation empty, with_label, with_mnemonic, with_markup_label, from_external_pointer
  89. feature {} -- Creation
  90. empty is
  91. -- Creates a new empty label
  92. require gtk_initialized: gtk.is_initialized
  93. do
  94. from_external_pointer (gtk_label_new(default_pointer))
  95. end
  96. with_label (a_label: STRING) is
  97. -- Creates a new label with the given text inside it.
  98. require
  99. gtk_initialized: gtk.is_initialized
  100. valid_label: a_label/=Void
  101. do
  102. -- In gtk_label_new You can pass Void to get an empty label
  103. -- widget.w
  104. from_external_pointer (gtk_label_new(a_label.to_external))
  105. end
  106. with_mnemonic (a_label: STRING) is
  107. -- Creates a new GtkLabel, containing the text in
  108. -- `a_label'. If characters in `a_label' are preceded by an
  109. -- underscore, they are underlined. If you need a literal
  110. -- underscore character in a label, use `__' (two
  111. -- underscores). The first underlined character represents a
  112. -- keyboard accelerator called a mnemonic. The mnemonic key
  113. -- can be used to activate another widget, chosen
  114. -- automatically, or explicitly using
  115. -- `GTK_LABEL.set_mnemonic_widget'. If
  116. -- `GTK_LABEL.set_mnemonic_widget' is not called, then the
  117. -- first activatable ancestor of the GtkLabel will be chosen
  118. -- as the mnemonic widget. For instance, if the label is
  119. -- inside a button or menu item, the button or menu item will
  120. -- automatically become the mnemonic widget and be activated
  121. -- by the mnemonic.
  122. require
  123. gtk_initialized: gtk.is_initialized
  124. label_not_void: a_label/=Void
  125. do
  126. from_external_pointer (gtk_label_new_with_mnemonic(a_label.to_external))
  127. end
  128. with_markup_label (a_label: STRING) is
  129. -- Creates a new GtkLabel, containing the text in
  130. -- `a_label', formatted using Pango markup language.
  131. require
  132. gtk_initialized: gtk.is_initialized
  133. label_not_void: a_label/=Void
  134. do
  135. from_external_pointer (gtk_label_new(a_label.to_external))
  136. use_markup
  137. ensure is_marked_up
  138. end
  139. feature
  140. set_text (a_string: STRING) is
  141. -- Sets the text within the GtkLabel widget. It overwrites
  142. -- any text that was there before. This will also clear any
  143. -- previously set mnemonic accelerators.
  144. require valid_string: a_string/=Void
  145. do
  146. gtk_label_set_text (handle,a_string.to_external)
  147. end
  148. -- TODO: wrap gtk_label_set_attributes ()void
  149. -- gtk_label_set_attributes (GtkLabel *label, PangoAttrList
  150. -- *attrs); Sets a PangoAttrList; the attributes in the list are
  151. -- applied to the label text. The attributes set with this function
  152. -- will be ignored if the "use_underline" property or the
  153. -- "use_markup" property is TRUE. label : a GtkLabelattrs : a
  154. -- PangoAttrList
  155. set_markup (a_string: STRING) is
  156. -- Parses `a_string' which is marked up with the Pango text
  157. -- markup language, setting the label's text and attribute
  158. -- list based on the parse results. TODO: Eiffelize this "If
  159. -- the str is external data, you may need to escape it with
  160. -- g_markup_escape_text() or g_markup_printf_escaped(): char
  161. -- *markup; markup = g_markup_printf_escaped ("<span
  162. -- style=\"italic\">%s</span>", str); gtk_label_set_markup
  163. -- (GTK_LABEL (label), markup); g_free (markup);"
  164. require valid_string: a_string/=Void
  165. do
  166. gtk_label_set_markup (handle,a_string.to_external)
  167. end
  168. set_markup_with_mnemonic (a_string: STRING) is
  169. -- Parses `a_string' which is marked up with the Pango text
  170. -- markup language, setting the label's text and attribute
  171. -- list based on the parse results. If characters in
  172. -- `a_string' are preceded by an underscore, they are
  173. -- underlined indicating that they represent a keyboard
  174. -- accelerator called a mnemonic.
  175. -- The mnemonic key can be used to activate another widget,
  176. -- chosen automatically, or explicitly using
  177. -- `set_mnemonic_widget'.
  178. require valid_string: a_string/=Void
  179. do
  180. gtk_label_set_markup_with_mnemonic (handle, a_string.to_external)
  181. end
  182. set_pattern (a_pattern: STRING) is
  183. -- The pattern of underlines you want under the existing text
  184. -- within the GtkLabel widget. For example if the current
  185. -- text of the label says "FooBarBaz" passing a pattern of
  186. -- "___ ___" will underline "Foo" and "Baz" but not "Bar".
  187. require valid_pattern: a_pattern/=Void
  188. do
  189. gtk_label_set_pattern (handle, a_pattern.to_external)
  190. end
  191. feature -- Justification
  192. set_left_justify is
  193. -- Makes the lines in the text of the label left-aligned. If
  194. -- you instead want to set the alignment of the label as a
  195. -- whole, use `GTK_MISC.set_alignment' instead. Has no effect
  196. -- on labels containing only a single line.
  197. do
  198. gtk_label_set_justify (handle,gtk_justify_left)
  199. end
  200. set_right_justify is
  201. -- Makes the lines in the text of the label right-aligned. If
  202. -- you instead want to set the alignment of the label as a
  203. -- whole, use `GTK_MISC.set_alignment' instead. Has no effect
  204. -- on labels containing only a single line.
  205. do
  206. gtk_label_set_justify (handle,gtk_justify_left)
  207. end
  208. set_center_justify is
  209. -- Makes the lines in the text of the label center-aligned. If
  210. -- you instead want to set the alignment of the label as a
  211. -- whole, use `GTK_MISC.set_alignment' instead. Has no effect
  212. -- on labels containing only a single line.
  213. do
  214. gtk_label_set_justify (handle,gtk_justify_center)
  215. end
  216. set_fill_justify is
  217. -- Makes the lines in the text of the label distributed
  218. -- across the label. If you instead want to set the alignment
  219. -- of the label as a whole, use `GTK_MISC.set_alignment'
  220. -- instead. Has no effect on labels containing only a single
  221. -- line.
  222. do
  223. gtk_label_set_justify (handle,gtk_justify_fill)
  224. end
  225. is_justify_left: BOOLEAN is
  226. -- Is the text placed at the left edge of the label?
  227. do
  228. Result:=(gtk_label_get_justify(handle)=gtk_justify_left)
  229. end
  230. is_justify_right: BOOLEAN is
  231. -- Is the text placed at the right edge of the label?
  232. do
  233. Result:=(gtk_label_get_justify(handle)=gtk_justify_right)
  234. end
  235. is_justify_center: BOOLEAN is
  236. -- Is the text placed at the center of the label?
  237. do
  238. Result:=(gtk_label_get_justify(handle)=gtk_justify_center)
  239. end
  240. is_justify_fill: BOOLEAN is
  241. -- Is the text distribuited across the label?
  242. do
  243. Result:=(gtk_label_get_justify(handle)=gtk_justify_fill)
  244. end
  245. feature -- width desired or maximum
  246. -- TODO: wrap gtk_label_set_ellipsize () void
  247. -- gtk_label_set_ellipsize (GtkLabel *label, PangoEllipsizeMode
  248. -- mode);Sets the mode used to ellipsize (add an ellipsis: "...")
  249. -- to the text if there is not enough space to render the entire
  250. -- string.label : a GtkLabelmode : a PangoEllipsizeMode
  251. set_desired_width (n_chars: INTEGER) is
  252. -- Sets the desired width in characters of label to `n_chars' characters.
  253. do
  254. gtk_label_set_width_chars (handle, n_chars)
  255. end
  256. set_max_width (n_chars: INTEGER) is
  257. -- Sets the desired maximum width in characters of label to `n_chars'.
  258. do
  259. gtk_label_set_max_width_chars (handle, n_chars)
  260. end
  261. width_chars: INTEGER is
  262. -- the desired width of label, in characters. See `set_desired_width'.
  263. do
  264. Result := (gtk_label_get_width_chars(handle))
  265. end
  266. max_width: INTEGER is
  267. -- the desired maximum width of label, in characters. See `width_chars'.
  268. do
  269. Result:=gtk_label_get_max_width_chars(handle)
  270. end
  271. feature -- Line wrap
  272. set_line_wrap is
  273. -- Toggles line wrapping within the GtkLabel widget. It
  274. -- breaks lines if text exceeds the widget's size.
  275. do
  276. gtk_label_set_line_wrap (handle, 1)
  277. end
  278. unset_line_wrap is
  279. -- Toggles line wrapping within the GtkLabel widget. It lets
  280. -- the text get cut off by the edge of the widget if it
  281. -- exceeds the widget size.
  282. do
  283. gtk_label_set_line_wrap (handle, 0)
  284. end
  285. -- TODO: wrap gtk_label_get_layout_offsets () void
  286. -- gtk_label_get_layout_offsets (GtkLabel *label, gint *x, gint
  287. -- *y); Obtains the coordinates where the label will draw the
  288. -- PangoLayout representing the text in the label; useful to
  289. -- convert mouse events into coordinates inside the PangoLayout,
  290. -- e.g. to take some action if some part of the label is
  291. -- clicked. Of course you will need to create a GtkEventBox to
  292. -- receive the events, and pack the label inside it, since labels
  293. -- are a GTK_NO_WINDOW widget. Remember when using the PangoLayout
  294. -- functions you need to convert to and from pixels using
  295. -- PANGO_PIXELS() or PANGO_SCALE. label : a GtkLabel x : location
  296. -- to store X offset of layout, or NULL y : location to store Y
  297. -- offset of layout, or NULL
  298. feature -- mnemonic
  299. mnemonic_keyval: INTEGER is
  300. -- The keyval usable for accelerators, or GDK_VoidSymbol. If
  301. -- the label has been set so that it has an mnemonic key this
  302. -- function returns the keyval used for the mnemonic
  303. -- accelerator. If there is no mnemonic set up it returns
  304. -- GDK_VoidSymbol.
  305. do
  306. Result:=gtk_label_get_mnemonic_keyval (handle)
  307. end
  308. feature -- Seletability
  309. is_selectable: BOOLEAN is
  310. -- Can the user copy text from the label?
  311. do
  312. Result := gtk_label_get_selectable (handle).to_boolean
  313. end
  314. set_selectable is
  315. -- Makes the label selectable to allow the user to select
  316. -- text from the it, for copy-and-paste.
  317. do
  318. gtk_label_set_selectable (handle,1)
  319. end
  320. set_unselectable is
  321. -- Makes the label not selectable.
  322. do
  323. gtk_label_set_selectable (handle,0)
  324. end
  325. feature -- Text label
  326. text: STRING is
  327. -- the text from a label widget, as displayed on the
  328. -- screen. This does not include any embedded underlines
  329. -- indicating mnemonics or Pango markup. (See
  330. -- `GTK_LABEL.get_label')
  331. do
  332. -- gtk_label_get_text returns the internal string used by the
  333. -- label, and must not be modified, hence
  334. -- STRING.from_external_copy
  335. create Result.from_external_copy(gtk_label_get_text(handle))
  336. end
  337. label: STRING is
  338. -- the text from a label widget including any embedded underlines indicating mnemonics and Pango markup. (`text')
  339. do
  340. create Result.from_external_copy (gtk_label_get_label(handle))
  341. -- using from_external_copy since the returned but
  342. -- gtk_label_get_label is owned by the widget and must not be
  343. -- modified or freed.
  344. end
  345. set_label (a_string: STRING) is
  346. -- Sets the label's text from `a_string'. The label is
  347. -- interpreted as including embedded underlines and/or Pango
  348. -- markup depending on the values of is_underline_used and
  349. -- is_marked_up.
  350. require valid_string: a_string/=Void
  351. do
  352. gtk_label_set_label (handle,a_string.to_external)
  353. end
  354. set_text_with_mnemonic (a_string: STRING) is
  355. -- Sets the label's text from `a_string'. If characters in
  356. -- `a_string' are preceded by an underscore, they are
  357. -- underlined indicating that they represent a keyboard
  358. -- accelerator called a mnemonic. The mnemonic key can be
  359. -- used to activate another widget, chosen automatically, or
  360. -- explicitly using `set_mnemonic_widget'.
  361. require valid_string: a_string/=Void
  362. do
  363. gtk_label_set_text_with_mnemonic (handle, a_string.to_external)
  364. end
  365. feature -- mnemonic widget
  366. set_mnemonic_widget (a_widget: GTK_WIDGET) is
  367. -- If the label has been set so that it has an mnemonic key
  368. -- (using i.e. `set_markup_with_mnemonic'),
  369. -- `set_text_with_mnemonic', `with_mnemonic' or the
  370. -- "use_underline" property) the label can be associated with
  371. -- a widget that is the target of the mnemonic. When the
  372. -- label is inside a widget (like a GtkButton or a
  373. -- GtkNotebook tab) it is automatically associated with the
  374. -- correct widget, but sometimes (i.e. when the target is a
  375. -- GtkEntry next to the label) you need to set it explicitly
  376. -- using this function.
  377. -- The target widget will be accelerated by emitting
  378. -- "mnemonic_activate" on it. The default handler for this
  379. -- signal will activate the widget if there are no mnemonic
  380. -- collisions and toggle focus between the colliding widgets
  381. -- otherwise.
  382. require valid_widget: a_widget/=Void
  383. do
  384. gtk_label_set_mnemonic_widget (handle, a_widget.handle)
  385. end
  386. -- mnemonic_widget: GTK_WIDGET is
  387. -- -- the target of the mnemonic (keyboard shortcut) of this
  388. -- -- label. See `GTK_LABEL.set_mnemonic_widget'. Void if none
  389. -- -- has been set and the default algorithm will be used.
  390. -- local widget_ptr: POINTER
  391. -- do
  392. -- widget_ptr:=gtk_label_get_mnemonic_widget (handle)
  393. -- if widget_ptr.is_not_null
  394. -- then
  395. -- -- TODO: create the right widget, not just a generic GTK_WIDGET
  396. -- create Result.from_external_pointer (widget_ptr)
  397. -- else check Result=Void end
  398. -- end
  399. feature -- Other
  400. select_region (a_start_offset, an_end_offset: INTEGER) is
  401. -- Selects a range of characters in the label, if the label is
  402. -- selectable. See `set_selectable'. If the label is not
  403. -- selectable, this function has no effect. If `a_start_offset'
  404. -- or `an_end_offset' are -1, then the end of the label will be
  405. -- substituted. offset are given in characters not bytes.
  406. do
  407. gtk_label_select_region (handle, a_start_offset, an_end_offset)
  408. end
  409. -- TODO: attributes: PANGO_ATTR_LIST PangoAttrList*
  410. -- gtk_label_get_attributes (GtkLabel *label); Gets the attribute
  411. -- list that was set on the label using gtk_label_set_attributes(),
  412. -- if any. This function does not reflect attributes that come from
  413. -- the labels markup (see gtk_label_set_markup()). If you want to
  414. -- get the effective attributes for the label, use
  415. -- pango_layout_get_attribute (gtk_label_get_layout (label)). label
  416. -- : a GtkLabel Returns : the attribute list, or NULL if none was
  417. -- set.
  418. -- TODO: gtk_label_get_ellipsize () PangoEllipsizeMode
  419. -- gtk_label_get_ellipsize (GtkLabel *label); Returns the
  420. -- ellipsizing position of the label. See
  421. -- gtk_label_set_ellipsize(). label : a GtkLabel Returns :
  422. -- PangoEllipsizeMode
  423. -- TODO: gtk_label_get_layout () PangoLayout* gtk_label_get_layout
  424. -- (GtkLabel *label); Gets the PangoLayout used to display the
  425. -- label. The layout is useful to e.g. convert text positions to
  426. -- pixel positions, in combination with
  427. -- gtk_label_get_layout_offsets(). The returned layout is owned by
  428. -- the label so need not be freed by the caller.
  429. is_line_wrapped: BOOLEAN is
  430. -- Is the lines of the label automatically wrapped?
  431. do
  432. Result:=(gtk_label_get_line_wrap(handle)).to_boolean
  433. end
  434. selection_bounds: TUPLE[BOOLEAN,INTEGER,INTEGER] is
  435. -- the selected range of characters in the label, with the
  436. -- format: [`is_non_empty', `a_start', `an_end'] `a_start',
  437. -- the start of selection, as a character offset; `an_end'
  438. -- the end of selection, as a character offset.
  439. local is_non_empty, a_start, an_end: INTEGER
  440. do
  441. is_non_empty:=(gtk_label_get_selection_bounds (handle, $a_start, $an_end))
  442. end
  443. feature -- Markup
  444. use_markup is
  445. -- Signal that the text of the label contains markup in
  446. -- Pango's text markup language. See `set_markup'.
  447. do
  448. gtk_label_set_use_markup (handle,1)
  449. end
  450. dont_use_markup is
  451. -- Signal that the text of the label does not contain markup in
  452. -- Pango's text markup language.
  453. do
  454. gtk_label_set_use_markup (handle,0)
  455. end
  456. is_marked_up: BOOLEAN is
  457. -- Is the label's text interpreted as marked up with the Pango
  458. -- text markup language?. See `set_use_markup'.
  459. do
  460. Result:=(gtk_label_get_use_markup(handle)).to_boolean
  461. end
  462. feature -- Underline indicating mnemonic
  463. is_underline_used: BOOLEAN is
  464. -- Does an embedded underline indicate a mnemonic in the label? See `set_use_underline'.
  465. do
  466. Result:=(gtk_label_get_use_underline(handle)).to_boolean
  467. end
  468. use_underline is
  469. -- Puts an underline in the text indicating the next
  470. -- character used for the mnemonic accelerator key.
  471. do
  472. gtk_label_set_use_underline(handle,1)
  473. end
  474. use_no_underline is
  475. -- Remove the undeline that indicates the character used for
  476. -- the mnemonic accelerator key.
  477. do
  478. gtk_label_set_use_underline(handle,1)
  479. end
  480. feature -- single line mode
  481. is_mode_single_line_mode: BOOLEAN is
  482. -- Is the label in single line mode?
  483. do
  484. Result:=(gtk_label_get_single_line_mode(handle)).to_boolean
  485. end
  486. set_single_line_mode is
  487. -- Puts the label in single line mode.
  488. do
  489. gtk_label_set_single_line_mode (handle,1)
  490. end
  491. set_multi_line_mode is
  492. -- Puts the label in multi line mode.
  493. do
  494. gtk_label_set_single_line_mode (handle,0)
  495. end
  496. feature -- Angle
  497. angle: REAL is
  498. -- The angle of rotation for the label. See `set_angle'.
  499. do
  500. Result:=gtk_label_get_angle(handle)
  501. end
  502. set_angle (an_angle: REAL) is
  503. -- Sets the angle of rotation for the label. An angle of 90
  504. -- reads from from bottom to top, an angle of 270, from top
  505. -- to bottom. The angle setting for the label is ignored if
  506. -- the label is selectable, wrapped, or ellipsized.
  507. do
  508. gtk_label_set_angle (handle, an_angle)
  509. end
  510. feature -- Property Details
  511. -- The "angle" property
  512. -- "angle" gdouble : Read / Write
  513. -- The angle that the baseline of the label makes with the horizontal, in degrees, measured counterclockwise. An angle of 90 reads from from bottom to top, an angle of 270, from top to bottom. Ignored if the label is selectable, wrapped, or ellipsized.
  514. -- Allowed values: [0,360]
  515. -- Default value: 0
  516. -- Since 2.6
  517. -- The "attributes" property
  518. -- "attributes" PangoAttrList : Read / Write
  519. -- A list of style attributes to apply to the text of the label.
  520. -- The "cursor-position" property
  521. -- "cursor-position" gint : Read
  522. -- The current position of the insertion cursor in chars.
  523. -- Allowed values: >= 0
  524. -- Default value: 0
  525. -- The "ellipsize" property
  526. -- "ellipsize" PangoEllipsizeMode : Read / Write
  527. -- The preferred place to ellipsize the string, if the label does not have enough room to display the entire string, specified as a PangoEllisizeMode.
  528. -- Note that setting this property to a value other than PANGO_ELLIPSIZE_NONE has the side-effect that the label requests only enough space to display the ellipsis "...". In particular, this means that ellipsizing labels don't work well in notebook tabs, unless the tab's ::tab-expand property is set to TRUE. Other means to set a label's width are gtk_widget_set_size_request() and gtk_label_set_width_chars().
  529. -- Default value: PANGO_ELLIPSIZE_NONE
  530. -- Since 2.6
  531. -- The "justify" property
  532. -- "justify" GtkJustification : Read / Write
  533. -- The alignment of the lines in the text of the label relative to each other. This does NOT affect the alignment of the label within its allocation. See GtkMisc::xalign for that.
  534. -- Default value: GTK_JUSTIFY_LEFT
  535. -- The "label" property
  536. -- "label" gchararray : Read / Write
  537. -- The text of the label.
  538. -- Default value: NULL
  539. -- The "max-width-chars" property
  540. -- "max-width-chars" gint : Read / Write
  541. -- The desired maximum width of the label, in characters. If this property is set to -1, the width will be calculated automatically, otherwise the label will request space for no more than the requested number of characters. If the width-chars property is set to a positive value, then the max-width-chars property is ignored.
  542. -- Allowed values: >= -1
  543. -- Default value: -1
  544. -- Since 2.6
  545. -- The "mnemonic-keyval" property
  546. -- "mnemonic-keyval" guint : Read
  547. -- The mnemonic accelerator key for this label.
  548. -- Default value: 16777215
  549. -- The "mnemonic-widget" property
  550. -- "mnemonic-widget" GtkWidget : Read / Write
  551. -- The widget to be activated when the label's mnemonic key is pressed.
  552. -- The "pattern" property
  553. -- "pattern" gchararray : Write
  554. -- A string with _ characters in positions correspond to characters in the text to underline.
  555. -- Default value: NULL
  556. -- The "selectable" property
  557. -- "selectable" gboolean : Read / Write
  558. -- Whether the label text can be selected with the mouse.
  559. -- Default value: FALSE
  560. -- The "selection-bound" property
  561. -- "selection-bound" gint : Read
  562. -- The position of the opposite end of the selection from the cursor in chars.
  563. -- Allowed values: >= 0
  564. -- Default value: 0
  565. -- The "single-line-mode" property
  566. -- "single-line-mode" gboolean : Read / Write
  567. -- Whether the label is in single line mode. In single line mode, the height of the label does not depend on the actual text, it is always set to ascent + descent of the font. This can be an advantage in situations where resizing the label because of text changes would be distracting, e.g. in a statusbar.
  568. -- Default value: FALSE
  569. -- Since 2.6
  570. -- The "use-markup" property
  571. -- "use-markup" gboolean : Read / Write
  572. -- The text of the label includes XML markup. See pango_parse_markup().
  573. -- Default value: FALSE
  574. -- The "use-underline" property
  575. -- "use-underline" gboolean : Read / Write
  576. -- If set, an underline in the text indicates the next character should be used for the mnemonic accelerator key.
  577. -- Default value: FALSE
  578. -- The "width-chars" property
  579. -- "width-chars" gint : Read / Write
  580. -- The desired width of the label, in characters. If this property is set to -1, the width will be calculated automatically, otherwise the label will request either 3 characters or the property value, whichever is greater. If the width-chars property is set to a positive value, then the max-width-chars property is ignored.
  581. -- Allowed values: >= -1
  582. -- Default value: -1
  583. -- Since 2.6
  584. -- The "wrap" property
  585. -- "wrap" gboolean : Read / Write
  586. -- If set, wrap lines if the text becomes too wide.
  587. -- Default value: FALSE
  588. -- Signal Details
  589. -- The "copy-clipboard" signal
  590. -- void user_function (GtkLabel *label,
  591. -- gpointer user_data) : Run last / Action
  592. -- label : the object which received the signal.
  593. -- user_data : user data set when the signal handler was connected.
  594. -- The "move-cursor" signal
  595. -- void user_function (GtkLabel *label,
  596. -- GtkMovementStep arg1,
  597. -- gint arg2,
  598. -- gboolean arg3,
  599. -- gpointer user_data) : Run last / Action
  600. -- label : the object which received the signal.
  601. -- arg1 :
  602. -- arg2 :
  603. -- arg3 :
  604. -- user_data : user data set when the signal handler was connected.
  605. -- The "populate-popup" signal
  606. -- void user_function (GtkLabel *label,
  607. -- GtkMenu *arg1,
  608. -- gpointer user_data) : Run last
  609. -- label : the object which received the signal.
  610. -- arg1 :
  611. -- user_data : user data set when the signal handler was connected.
  612. feature -- size
  613. struct_size: INTEGER is
  614. external "C inline use <gtk/gtk.h>"
  615. alias "sizeof(GtkLabel)"
  616. end
  617. end