1
0
Fork 0
Commit graph

32 commits

Author SHA1 Message Date
Emmanuele Bassi
1724536cda text: Add ::cursor-changed signal
Since we are trying to eliminate the ClutterGeometry type, we should
replace the only entry point still using it: the ::cursor-event signal
of ClutterText.

Instead of passing the cursor geometry, we should add an accessor
function.

The combination of signal and getter for the cursor geometry means that
we can deprecate ClutterText::cursor-event, and mark it for removal in
Clutter 2.0.

https://bugzilla.gnome.org/show_bug.cgi?id=682789
2013-04-04 11:53:39 +01:00
Emmanuele Bassi
fb9df4bef2 Annotate all functions available since 1.10 2012-02-27 16:35:09 +00:00
Emmanuele Bassi
7ba9774572 text: Add the coords_to_position() method
The reverse of position_to_coords().

While providing documentation on how to implement it using the
PangoLayout API, I realized that the verbosity of it all, plus the usage
of the Pango API, was not worth it, and decided to expose the method we
are using internally.
2012-02-06 18:27:58 +00:00
Stef Walter
c073764369 text: Implement ClutterTextBuffer
* Abstracts the buffer for text in ClutterText
 * Allows implementation of undo/redo.
 * Allows use of non-pageable memory for text
   in the case of sensitive passwords.
 * Implement a test with two ClutterText using the same
   buffer.

https://bugzilla.gnome.org/show_bug.cgi?id=652653
2012-01-17 14:29:44 +00:00
Philippe Normand
494629d4b9 clutter-text: new clutter_text_get_layout_offsets API
This new function can be used to retrieve the coordinates where the
ClutterText will draw the PangoLayout representing the text.

http://bugzilla.clutter-project.org/show_bug.cgi?id=2553
2011-06-13 16:15:22 +01:00
Emmanuele Bassi
2b81d90dd7 Eliminate G_CONST_RETURN
The G_CONST_RETURN define in GLib is, and has always been, a bit fuzzy.

We always used it to conform to the platform, at least for public-facing
API.

At first I assumed it has something to do with brain-damaged compilers
or with weird platforms where const was not really supported; sadly,
it's something much, much worse: it's a define that can be toggled at
compile-time to remove const from the signature of public API. This is a
truly terrifying feature that I assume was added in the past century,
and whose inception clearly had something to do with massive doses of
absynthe and opium — because any other explanation would make the
existence of such a feature even worse than assuming drugs had anything
to do with it.

Anyway, and pleasing the gods, this dubious feature is being
removed/deprecated in GLib; see bug:

  https://bugzilla.gnome.org/show_bug.cgi?id=644611

Before deprecation, though, we should just remove its usage from the
whole API. We should especially remove its usage from Cally's internals,
since there it never made sense in the first place.
2011-06-07 16:06:24 +01:00
Jasper St. Pierre
94c9c07509 clutter-text: Add a selected-text-color
http://bugzilla.clutter-project.org/show_bug.cgi?id=2595
2011-05-13 15:44:08 +01:00
Emmanuele Bassi
cb52581a24 text: Add :font-description
High level toolkits might wish to construct a PangoFontDescription and
then set it directly on a ClutterText actor proxy or sub-class.
ClutterText should have a :font-description property to set (and get)
the PangoFontDescription.

http://bugzilla.openedhand.com/show_bug.cgi?id=1960
2010-02-03 14:38:13 +00:00
Emmanuele Bassi
23cd0b7925 docs: Documentation fixes
• Fix list_stages() and peek_stages() documentation

 • Fix clutter_text_set_preedit_string() arguments in the header
   to match source and documentation

 • Add clutter_units_cm() to the private section for Units

 • Rename the LayoutManager section

 • Add FlowLayout:homogeneous accessors
2009-10-19 12:01:38 +01:00
Emmanuele Bassi
2883728387 [text] Add pre-edit string to ClutterText
Input Methods require to be able to set a "pre-edit string", that is
a string that it's just displayed into the Text actor without being
committed to the actor's buffer. The string might require custom Pango
attributes, and an update of the cursor position.
2009-10-16 12:45:29 +01:00
Emmanuele Bassi
21e3901d62 [text] Expose position_to_coords()
The clutter_text_position_to_coords() is useful for ClutterText
subclasses.

See bug:

  http://bugzilla.openedhand.com/show_bug.cgi?id=1521

Based on a patch by: Raymond Liu <raymond.liu@intel.com>
2009-05-14 16:19:15 +01:00
Emmanuele Bassi
ca23838752 [text] Add ClutterText::delete_selection()
Add a method for deleting the current selection inside a Text actor.

This is useful for subclasses.

See bug:

  http://bugzilla.openedhand.com/show_bug.cgi?id=1521

Based on a patch by: Raymond Liu <raymond.liu@intel.com>
2009-05-14 16:16:06 +01:00
Neil Roberts
1edc19d1d3 [clutter-text] Add a separate property for the selection color
Adds a new property so that the selection color can be different from
the cursor color. If no selection color is specified it will use the
cursor color as before. If no cursor color is specified either it will
use the text color.
2009-04-06 15:22:31 +01:00
Bastian Winkler
28a3cbf38e Remove redundant declaration in clutter-text.h
clutter-text.h declares clutter_text_get_layout twice.

Signed-off-by: Emmanuele Bassi <ebassi@linux.intel.com>
2009-02-26 12:49:50 +00:00
Emmanuele Bassi
9cf02bfdb9 [text] Rename :alignment to :line-alignment
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
2009-02-05 19:54:48 +00:00
Emmanuele Bassi
488de99fc6 [text] Merge the attributes with markup enabled
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.
2009-02-02 12:07:28 +00:00
Emmanuele Bassi
ad7d1b54bc Re-align ClutterText header file
The addition of the single line mode accessor methods caused the
re-alignment of the entire file.
2009-01-07 11:46:22 +00:00
Emmanuele Bassi
43f82332dd [text] Add single-line-mode to ClutterText
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.
2009-01-07 00:25:24 +00:00
Emmanuele Bassi
979b6794bb [text] Coalesce text visibility and password character
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), '*');
2009-01-06 15:22:31 +00:00
Emmanuele Bassi
a3fbdb5949 Add ClutterText::set_selection()
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.
2008-12-16 12:41:20 +00:00
Emmanuele Bassi
93d96dca52 Add ClutterText::activate()
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.
2008-12-16 12:02:58 +00:00
Emmanuele Bassi
ea5a6abd9d Add :cursor-size property to ClutterText
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.
2008-12-16 10:37:45 +00:00
Emmanuele Bassi
2714397fd5 Constify the cursor geometry in ::cursor-event
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.
2008-12-15 18:23:25 +00:00
Emmanuele Bassi
2d166b250c [docs] Add annotations for ClutterText structures
ClutterText and ClutterTextClass were missing annotations for
gtk-doc to pick up.
2008-12-15 15:10:55 +00:00
Emmanuele Bassi
a50dfefbc3 Fix documentation issues
Provide a description for the ClutterText section, and fix some
misnamed arguments inside the header file.
2008-12-11 15:00:22 +00:00
Emmanuele Bassi
eae98800d2 Use ClutterBindPool inside ClutterText
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.
2008-12-11 12:03:17 +00:00
Emmanuele Bassi
74257dfa27 Add missing basic constructor
ClutterText should have an empty constructor, mostly for
bindings to use, that just proxies call to g_object_new()
without setting any property.
2008-12-11 11:43:37 +00:00
Emmanuele Bassi
d5df1bebcf Add text-visibility accessors for ClutterText
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.
2008-12-11 11:40:55 +00:00
Emmanuele Bassi
c5f51f7027 Add Text::get_chars() method declaration
Add the declaration for a clutter_text_get_chars() function that
returns a portion of the contents of a Text actor.
2008-12-11 11:31:48 +00:00
Emmanuele Bassi
40fb75052b Merge Label and Entry API into ClutterText
ClutterText should expose both ClutterLabel and ClutterEntry
functionality using an API that matches the one provided by
those two classes.
2008-12-11 11:21:39 +00:00
Emmanuele Bassi
437f96982e Expose the Text accessors as public API
Fix up the header to expose ClutterText accessors for the main
properties, matching ClutterLabel.
2008-12-11 11:20:14 +00:00
Emmanuele Bassi
a98720ae19 Initial import of the Text actor from Tidy
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.
2008-12-11 11:12:48 +00:00