Commit Graph

97 Commits

Author SHA1 Message Date
Emmanuele Bassi
9a78eacb72 build: Fix distcheck in cookbook/examples 2011-09-05 21:16:01 +01:00
Emmanuele Bassi
72caef0de0 cookbooks/examples: Use g_signal_handlers_disconnect_by_func()
The disconnect_matched() function is a bit too complicated, and its
simpler wrapper disconnect_by_func() is functionally equivalent in the
cases used by the cookbook examples.
2011-09-02 12:19:30 +01:00
Emmanuele Bassi
b0f868edfd build: Install the cookbook examples code
Use $(datadir)/clutter-1.0/cookbook/examples as the target directory.
2011-09-01 13:51:20 +01:00
Emmanuele Bassi
3bdd49dc19 docs/cookbook: Add script->state connection recipe
Script definitions can connect a signal to a State transition; this is a
useful thing to document with a recipe in the cookbook.
2011-08-31 12:25:01 +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
Neil Roberts
7d233241f1 Fix include location for cogl-pango.h
In Cogl, cogl-pango.h has moved to <cogl-pango/cogl-pango.h>. When
using the experimental 2.0 API (which Clutter does) it is no longer
possible to include it under the old name of <cogl/cogl-pango.h> so we
need to update the include location.
2011-05-16 16:04:27 +01:00
Elliot Smith
57a5f2296a docs: Remove checks for whether an effect is disabled
pre_paint() and post_paint() implementations don't need
to check whether an effect is disabled: Clutter will
not apply an effect unless it is enabled.

So remove code which checks whether the effect is
enabled or disabled from the example applications and the
documentation.
2011-03-17 15:56:55 +00:00
Elliot Smith
5732b1184f docs: Add example of setting background color with ClutterEffect
Add example of a simple background color effect applied via
pre_paint() implementation in a ClutterEffect subclass.

This is a simple effect with an incomplete GObject
implementation (no properties, setters or getters)
to make it as easy to follow as possible.
2011-03-17 15:56:55 +00:00
Elliot Smith
a81dbcf483 docs: Add example of a border added through ClutterEffect
Add a basic example showing how to implement a ClutterEffect
post_paint() function to overlay a highlight border over a
rectangular actor.
2011-03-17 15:56:55 +00:00
nobled
aece642adb doc: fix clutter_init() usage in examples
Make sure users get the idea that clutter_init()
has a return value that needs to be checked.

These were fixed via sed magic:

sed -i -s -e "s/clutter_init (.*)/\
if (& != CLUTTER_INIT_SUCCESS)\n    return 1/"\
 doc/*/*/*.{c,xml} doc/*/*.xml

http://bugzilla.clutter-project.org/show_bug.cgi?id=2574
2011-02-28 14:10:05 +00:00
Elliot Smith
74de3cfdf3 docs: Add effects chapter, with introduction and first recipe
Add an effects chapter which gives a broad overview of
the abstract classes in the effects API, plus a short
example of how to apply one of the stock Clutter
effects (ClutterColorizeEffect).

The recipe explains how to create a custom ClutterDeformEffect
to produce a page fold (code based on ClutterPageTurnEffect).

The example code includes the effect class plus a small
application to apply it to a texture.
2011-02-21 16:44:09 +00:00
Elliot Smith
cf18836ca0 docs: Add recipe for animating an actor on a curved path
Show how to animate an actor using a ClutterPathConstraint.

This demonstrates how to get effects similar to
ClutterPathBehaviour with the modern animation APIs.

Includes 3 examples:

1) Simple ClutterPathConstraint used with implicit animations
2) ClutterPathConstraint used to simulate circular animation,
using ClutterAnimator
3) Creating simple curved path animations with non-linear
easing
2011-02-08 14:41:51 +00:00
Emmanuele Bassi
428f64212c build: Fixes to pass distcheck
Try to make the cookbook pass the distcheck phase, so that we can run
distcheck with --enable-docs, and make sure that a tarballed clutter
release can actually build the cookbook.
2011-02-01 14:39:21 +00:00
Emmanuele Bassi
c4d4a5469a build: Dist cb-button.h in the cookbook examples
The header is missing, so we have a build failure if you try to build
Clutter's cookbook from the tarball.
2011-02-01 12:45:52 +00:00
Elliot Smith
e69d60e8b6 docs: Implement destroy() rather than dispose()
Remove the dispose() implementation and replace
with destroy().

This should be promoted as the standard approach
for implementing a composite actor, as it emits a
signal when instances of the actor subclass are destroyed.
2011-01-31 13:36:37 +00:00
Elliot Smith
f63158c2a2 docs: Don't use clutter_stage_get_default()
clutter_stage_get_new() is the recommended way to
get a stage instance, so use that instead.
2011-01-31 12:18:58 +00:00
Elliot Smith
3f64137a79 docs: Change text on button
Modify the text shown on the button to "hello / world"
rather than "winkle / pickers". Slightly more
sensible.
2011-01-31 11:06:01 +00:00
Elliot Smith
5530c5e2ec docs: Add a note about other state variables
Explain that the private structure would be the
place to store other state variables for the instance.
2011-01-31 11:05:27 +00:00
Elliot Smith
238fd52c4b docs: Change order of functions in example to match docs
Moved the functions around in the C code file, to match
the order Clutter uses them, and the order they are explained
in the recipe.
2011-01-31 10:38:15 +00:00
Elliot Smith
6934b36451 docs: Add more comments on how allocate() works
Add some extra description to the allocate() function,
explaining how the allocation has to be adjusted to
coordinates relative to the actor as a whole, before
applying to the single child actor it is composed from.
2011-01-31 10:08:08 +00:00
Elliot Smith
5f676ce325 docs: Explain enums for properties and signals
Add some more explanatory comments about the PROP_ and
signals enums.
2011-01-31 10:08:07 +00:00
Elliot Smith
18b90f100c docs: Don't set explicit size on button
Rather than set a size on the CbButton instance, let it
size itself automatically, based on the size requisition
functions.
2011-01-31 10:08:07 +00:00
Elliot Smith
951f13bb8d docs: Add example of preferred_height() and preferred_width()
As most actor subclasses will probably want to implement
size requisition, give a simple example of how to do this
on the basis of the composed actor's size, plus some padding.
2011-01-31 10:08:07 +00:00
Elliot Smith
7059be499a docs: Add more comments on code example for composite actor
Add more comments about the specific purpose of functions
and variables in the composite actor example, particularly
around GObject implementation.
2011-01-31 10:08:07 +00:00
Elliot Smith
b3954878c2 docs: Improve example code formatting
Improve code formatting to adhere to Clutter uncrustify rules.
2011-01-31 10:08:07 +00:00
Elliot Smith
7b9eaeeadb docs: Add some gtk-doc annotations to example
As this is a full GObject class implementation, add some
gtk-doc annotations to demonstrate how how custom actor subclasses
should be documented.
2011-01-31 10:08:07 +00:00
Elliot Smith
8a5967f0cc docs: Add custom ClutterActor example which uses composition 2011-01-31 10:08:07 +00:00
Elliot Smith
accdd92110 cookbook: Add examples and more text for "box layout" recipe
Added 3 examples for the box layout recipe:
1) Simple box layout demonstrating how to set actor properties
2) Trivial menu implementation using box layout
3) Demonstration app which enables tweaking and testing
   of layout property interactions

Also inlined example 1 in the solution section and added
more explanatory text in the discussion.
2010-12-17 14:41:42 +00:00
Emmanuele Bassi
c444447cd3 timeline: Rename the reverse property to auto-reverse
Other frameworks expose the same functionality as "auto-reverse",
probably to match the cassette tape player. It actually makes sense
for Clutter to follow suit.
2010-12-17 12:07:52 +00:00
Elliot Smith
50849ac1fd cookbook: Use new API to reverse timeline
clutter_timeline_set_reverse() can be used to
automatically reverse a timeline's direction each time
it completes, so use that in looping animation recipe and
examples.
2010-12-02 10:56:06 +00:00
Elliot Smith
ee9a4d02bb cookbook: Add example of scaling a texture
Added a simple application for scaling a
texture while keeping the mouse pointer over
the same coordinates on its surface.
2010-11-24 12:45:12 +00:00
Elliot Smith
b47b2f4749 cookbook: Added animated scaling example
Added an example showing scaling of an actor on
each of the scaling gravity settings (NORTH_WEST, NORTH etc.),
with a mark indicating the center being used.

Displays the transformed size and position, updated
on each paint of the actor.
2010-11-24 12:45:12 +00:00
Emmanuele Bassi
f3295a3f36 Merge remote branch 'elliot/cookbook-opacity-values-fix'
* elliot/cookbook-opacity-values-fix:
  cookbook: Fix opacity examples in recipe
  cookbook: Fix incorrect value for opacity
2010-11-15 15:41:46 +00:00
Emmanuele Bassi
9f2c31547c Merge remote branch 'elliot/cookbook-animations-looping'
* elliot/cookbook-animations-looping:
  cookbook: Recipe for "looping animations"
  cookbook: Clarify how signals are emitted during looped animation
  cookbook: First draft for looping animations recipe
  cookbook: Recipe skeleton for "looping animations"
  cookbook: Looping animation examples
2010-11-15 15:37:42 +00:00
Elliot Smith
e205bd0fdc cookbook: Clarify how signals are emitted during looped animation
Added a comment to the example code about how timeline
emits "completed" during looped animation, while the
animation itself doesn't.
2010-11-15 11:23:04 +00:00
Elliot Smith
0d8c730558 cookbook: Looping animation examples
Added code examples for creating a looped animation with
each of the animation approaches (implicit, ClutterAnimation,
ClutterState).
2010-11-15 11:23:04 +00:00
Elliot Smith
f9d2310b72 cookbook: Make example code C90 compliant
Modified all cookbook example code to prevent ISO C90 compliance
warnings occurring during compilation.
2010-11-12 10:18:31 +00:00
Elliot Smith
f135f2e7d5 cookbook: Fix incorrect value for opacity
Opacity is a guint, so don't use floating point numbers
to set its value.
2010-11-12 09:59:33 +00:00
Emmanuele Bassi
6a95457b3f cookbook: Remove unused variable from the animator example 2010-09-30 12:32:08 +01:00
Elliot Smith
94439e5526 cookbook: Example of using button press and release events
A longer example of using button press and release events
to draw rectangles with random colors.
2010-09-30 10:48:07 +01:00
Elliot Smith
0cda6c006b cookbook: Example of ClutterClickAction
Example of handling clicks on an actor; part of the recipe on
handling button events.
2010-09-30 10:48:07 +01:00
Elliot Smith
fc9ecdf82e cookbook: Example of simple handling of button events
Added an example showing how to examine the content
of a ClutterButtonEvent in a signal handler.
2010-09-30 10:48:07 +01:00
Elliot Smith
34407c14b0 cookbook: Reduce complexity of sample ClutterAnimator code for recipe
http://bugzilla.clutter-project.org/show_bug.cgi?id=2341

Signed-off-by: Emmanuele Bassi <ebassi@linux.intel.com>
2010-09-24 14:48:53 +01:00
Elliot Smith
6307876552 cookbook: Example of animated movement with ClutterAnimator
Added an example showing how to randomly animate the
simultaneous movement on the x axis of three actors,
using ClutterAnimator.
2010-09-23 16:24:21 +01:00
Elliot Smith
f1b2f1e8c5 cookbook: Example of animated movement with ClutterState
Added an example showing how to move two actors between
two states (one minimised, one maximised) using ClutterState
to do the movement. Also shows how movement can be mixed
with other animation (in this case, scaling).
2010-09-23 16:24:21 +01:00
Elliot Smith
5bca30300e cookbook: Example of simple movement animation
Added example showing how to move an actor in one of the
three axes (x,y,z) in response to a button event on the
actor.
2010-09-23 16:24:21 +01:00
Elliot Smith
c3cbf1533f cookbook: Example using allocation-changed to sync actor size
An alternative method (not using constraints) to bind
one actor's size and position to another. Used as
an example in the recipe about resizing one actor in
sync with a source actor.
2010-09-17 15:58:48 +01:00
Elliot Smith
8a149521ce cookbook: Simple example to demonstrate bind constraint
A simple example showing how to scale an actor to the stage.

Demonstrates ClutterBindConstraint and ClutterAlignConstraint
in a fashion suitable for a short recipe.
2010-09-17 15:58:48 +01:00
Elliot Smith
a0f63a3153 cookbook: Example of using a bind constraint for an overlay
Example code which loads an image into a texture, and resizes
the image in response to +/- key presses. The overlay is
a transparent rectangle which is bound to the height and
width of the texture; on clicking the texture, the overlay
is made visible by increasing its opacity.

This demonstrates how to use constraints to simplify code
for resizing an actor which is "dependent" on another actor.
2010-09-17 15:58:48 +01:00
Elliot Smith
82ab00930b cookbook: Simplified and clarified example code
Modified the "animation reuse" sample code to provide
a simpler example to explain in the recipe.

Also modified variable names to mirror the names used
for the previous "complex animation" example and added
some more comments, to further simplify and support the
recipe.
2010-09-13 12:25:47 +01:00