The :alignment property is prone to generate confusion: developers
will set it thinking that the contents of a ClutterText will
automagically align themselves.
Instead of using the generic term :alignment, and following the
GTK+ convention, we should use a more specific term, conveying the
actual effect of the property: alignment of the lines with respect
to each other, and not to the overall allocated area.
See bug 1428:
http://bugzilla.openedhand.com/show_bug.cgi?id=1428
ClutterText should merge the PangoAttributes set by using
clutter_text_set_attributes() with the attributes generated by
parsing Pango markup.
For this to work we must parse the markup and merge the attributes
we get out of pango_parse_markup() with the attributes set by
the user.
Setting the markup or the attributes on an editable text should
not work for the time being.
Allow using ClutterText as a single line text field. This is useful for
text fields that accept just a single line of contents by default, and
respond to the Enter key press to execute some action.
The :single-line-mode property enables this behaviour inside ClutterText
by clipping and scrolling the contents of the PangoLayout if they do
not fit the allocated width of the Text actor.
Using two properties to set a password entry can be construed as
both cumbersome and a gtk-ism. And rightly so on both counts.
The :text-visible property has also conflicting semantics with the
:cursor-visible one: while the latter hides the cursor, the former
changes the display of the contents of the Text actor. It is, thus,
not a matter of "visibility" but of "rendering".
Instead of setting the :text-visible and :invisible-char properties
to have a password text field, the Text actor should just have a
single :password-char property holding a Unicode character. If the
value of the :password-char is non-zero, the Text actor will use the
Unicode character to render the contents of the text entry.
This commit removes the following methods:
clutter_text_set_text_visible()
clutter_text_get_text_visible()
clutter_text_set_invisible_char()
clutter_text_get_invisible_char()
And the following properties:
ClutterText:text-visible
ClutterText:invisible-char
In favour of:
clutter_text_set_password_char()
clutter_text_get_password_char()
And:
ClutterText:password-char
Thus making obvious what use the property and accessor methods are
for and simplifying the process of creating a simple password text
field to:
text = clutter_text_new ();
clutter_text_set_password_char (CLUTTER_TEXT (text), '*');
The clutter_text_set_selection() function is a convenience
method for setting the cursor position and the selection
boundary to a given position in a single call, with sanity
checks for the positions.
The clutter_text_activate() function will emit the ::activate
signal if the :activatable property is set.
This function is useful for subclasses or application code, for
example if we are going to use ::captured-event or ::key-press-event
signal handlers to intercept the Return key and emit the ::activate
signal ourselves.
We can control the width of the cursor when painting by using
a simple property.
The magic -1 number passed to the setter method will reset the
cursor size to the default one of 2px.
The getter method will return an unsigned integer with the
current size.
We don't allow changing the cursor geometry inside the ::cursor-event
signal handlers; for starters, it would make binding the signal a
huge mess, and it would also potentially break the whole actor.
ClutterText should use the newly added ClutterBindingPool API to
handle key events, instead of its homegrown code.
This commit removes the action/mapping code and defers the entire
key binding matching to a ClutterBindingPool created inside the
Text class initialization function.
A ClutterText can be put in "password mode" by setting the
text as "invisible": every character inside the Text actor's
contents will be replaced when building the Pango layout with
a specific Unicode character.
The Unicode character is set to '*' by default, but the user
can be changed using the provided API.
The TidyText actor is meant as a replacement for both ClutterLabel
and ClutterText.
Any text-displaying and editing actor should derive from ClutterText
and implement the various visual cues to differentiate the editable
from the non-editable state. Those visual cues usually belong to
a high-level toolkit, especially if themeing is involved.