gnomemm r1958 - in cluttermm_tutorial/trunk: . examples/actor examples/actor_group examples/actor_transformations examples/behaviour examples/custom_actor examples/custom_container examples/effects examples/full_example examples/multiline_text_entry examples/score examples/scrolling examples/stage examples/stage_widget examples/timeline
- From: murrayc svn gnome org
- To: svn-commits-list gnome org
- Subject: gnomemm r1958 - in cluttermm_tutorial/trunk: . examples/actor examples/actor_group examples/actor_transformations examples/behaviour examples/custom_actor examples/custom_container examples/effects examples/full_example examples/multiline_text_entry examples/score examples/scrolling examples/stage examples/stage_widget examples/timeline
- Date: Tue, 6 Jan 2009 21:30:28 +0000 (UTC)
Author: murrayc
Date: Tue Jan 6 21:30:27 2009
New Revision: 1958
URL: http://svn.gnome.org/viewvc/gnomemm?rev=1958&view=rev
Log:
2009-01-06 Murray Cumming <murrayc murrayc com>
* examples/: Mostly whitespace changes to be more like the gtkmm
examples.
Modified:
cluttermm_tutorial/trunk/ChangeLog
cluttermm_tutorial/trunk/examples/actor/main.cc
cluttermm_tutorial/trunk/examples/actor_group/main.cc
cluttermm_tutorial/trunk/examples/actor_transformations/main.cc
cluttermm_tutorial/trunk/examples/behaviour/main.cc
cluttermm_tutorial/trunk/examples/custom_actor/main.cc
cluttermm_tutorial/trunk/examples/custom_actor/triangle_actor.cc
cluttermm_tutorial/trunk/examples/custom_container/examplebox.cc
cluttermm_tutorial/trunk/examples/custom_container/examplebox.h
cluttermm_tutorial/trunk/examples/custom_container/main.cc
cluttermm_tutorial/trunk/examples/effects/main.cc
cluttermm_tutorial/trunk/examples/full_example/main.cc
cluttermm_tutorial/trunk/examples/multiline_text_entry/main.cc
cluttermm_tutorial/trunk/examples/multiline_text_entry/multiline_entry.cc
cluttermm_tutorial/trunk/examples/multiline_text_entry/multiline_entry.h
cluttermm_tutorial/trunk/examples/score/main.cc
cluttermm_tutorial/trunk/examples/scrolling/main.cc
cluttermm_tutorial/trunk/examples/scrolling/scrollingcontainer.cc
cluttermm_tutorial/trunk/examples/scrolling/scrollingcontainer.h
cluttermm_tutorial/trunk/examples/stage/main.cc
cluttermm_tutorial/trunk/examples/stage_widget/main.cc
cluttermm_tutorial/trunk/examples/timeline/main.cc
Modified: cluttermm_tutorial/trunk/examples/actor/main.cc
==============================================================================
--- cluttermm_tutorial/trunk/examples/actor/main.cc (original)
+++ cluttermm_tutorial/trunk/examples/actor/main.cc Tue Jan 6 21:30:27 2009
@@ -21,32 +21,32 @@
{
Clutter::init(&argc, &argv);
- // Get the stage and set its size and color
+ // Get the stage and set its size and color:
const Glib::RefPtr<Clutter::Stage> stage = Clutter::Stage::get_default();
stage->set_size(200, 200);
stage->set_color(Clutter::Color(0, 0, 0, 255)); // black
Clutter::Color actor_color (0xff, 0xff, 0xff, 0x99);
- // Add a rectangle to the stage
+ // Add a rectangle to the stage:
const Glib::RefPtr<Clutter::Rectangle> rect = Clutter::Rectangle::create(actor_color);
rect->set_size(100, 100);
rect->set_position(20, 20);
stage->add_actor(rect);
rect->show();
- // Add a label to the stage
+ // Add a label to the stage:
const Glib::RefPtr<Clutter::Actor> label =
- Clutter::Label::create("Sans 12", "Some Text", actor_color);
+ Clutter::Label::create("Sans 12", "Some Text", actor_color);
label->set_size(500, 500);
label->set_position(20, 150);
stage->add_actor(label);
label->show();
- // Show the stage
+ // Show the stage:
stage->show();
- // Start the main loop, so we can respond to events
+ // Start the main loop, so we can respond to events:
Clutter::main();
return 0;
Modified: cluttermm_tutorial/trunk/examples/actor_group/main.cc
==============================================================================
--- cluttermm_tutorial/trunk/examples/actor_group/main.cc (original)
+++ cluttermm_tutorial/trunk/examples/actor_group/main.cc Tue Jan 6 21:30:27 2009
@@ -21,12 +21,12 @@
{
Clutter::init(&argc, &argv);
- // Get the stage and set its size and color
+ // Get the stage and set its size and color:
const Glib::RefPtr<Clutter::Stage> stage = Clutter::Stage::get_default();
stage->set_size(200, 200);
stage->set_color(Clutter::Color(0, 0, 0, 0xFF)); // black
- // Add a group to the stage
+ // Add a group to the stage:
const Glib::RefPtr<Clutter::Group> group = Clutter::Group::create();
group->set_position(40, 40);
stage->add_actor(group);
@@ -34,7 +34,7 @@
const Clutter::Color actor_color (0xFF, 0xFF, 0xFF, 0x99);
- // Add a rectangle to the group
+ // Add a rectangle to the group:
const Glib::RefPtr<Clutter::Rectangle>
rect = Clutter::Rectangle::create(actor_color);
rect->set_size(50, 50);
@@ -42,23 +42,23 @@
group->add_actor(rect);
rect->show();
- // Add a label to the group
+ // Add a label to the group:
const Glib::RefPtr<Clutter::Label>
label = Clutter::Label::create("Sans 9", "Some Text", actor_color);
label->set_position(0, 60);
group->add_actor (label);
label->show();
- // Scale the group 120% along the x axis
+ // Scale the group 120% along the x axis:
group->set_scale(3.00, 1.0);
- // Rotate it around the z axis
+ // Rotate it around the z axis:
group->set_rotation(Clutter::Z_AXIS, 10, 0, 0, 0);
- // Show the stage
+ // Show the stage:
stage->show();
- // Start the main loop, so we can respond to events
+ // Start the main loop, so we can respond to events:
Clutter::main();
return 0;
Modified: cluttermm_tutorial/trunk/examples/actor_transformations/main.cc
==============================================================================
--- cluttermm_tutorial/trunk/examples/actor_transformations/main.cc (original)
+++ cluttermm_tutorial/trunk/examples/actor_transformations/main.cc Tue Jan 6 21:30:27 2009
@@ -21,14 +21,14 @@
{
Clutter::init(&argc, &argv);
- // Get the stage and set its size and color
+ // Get the stage and set its size and color:
const Glib::RefPtr<Clutter::Stage> stage = Clutter::Stage::get_default();
stage->set_size(200, 200);
stage->set_color(Clutter::Color(0, 0, 0, 0xFF)); // black
const Clutter::Color actor_color (0xff, 0xff, 0xff, 0x99);
- // Add a rectangle to the stage
+ // Add a rectangle to the stage:
const Glib::RefPtr<Clutter::Rectangle> rect = Clutter::Rectangle::create(actor_color);
rect->set_size(100, 100);
rect->set_position(20, 20);
@@ -36,10 +36,10 @@
rect->show();
// Rotate it 20 degrees away from us around the x axis
- // (around its top edge)
+ // (around its top edge):
rect->set_rotation(Clutter::X_AXIS, -20, 0, 0, 0);
- // Add a label to the stage
+ // Add a label to the stage:
const Glib::RefPtr<Clutter::Label> label =
Clutter::Label::create("Sans 12", "Some Text", actor_color);
label->set_size(500, 500);
@@ -47,19 +47,19 @@
stage->add_actor(label);
label->show();
- // Scale it 300% along the x axis
+ // Scale it 300% along the x axis:
label->set_scale(3.0, 1.0);
- // Move it up and to the right
+ // Move it up and to the right:
label->move_by(10, -10);
- // Move it along the z axis, further from the viewer
+ // Move it along the z axis, further from the viewer:
label->set_depth(-20);
- // Show the stage
+ // Show the stage:
stage->show();
- // Start the main loop, so we can respond to events
+ // Start the main loop, so we can respond to events:
Clutter::main();
return 0;
Modified: cluttermm_tutorial/trunk/examples/behaviour/main.cc
==============================================================================
--- cluttermm_tutorial/trunk/examples/behaviour/main.cc (original)
+++ cluttermm_tutorial/trunk/examples/behaviour/main.cc Tue Jan 6 21:30:27 2009
@@ -35,12 +35,12 @@
*/
static guint32 on_alpha(Glib::RefPtr<Clutter::Alpha> alpha)
{
- // Get the position in the timeline, so we can base our value upon it
+ // Get the position in the timeline, so we can base our value upon it:
const Glib::RefPtr<Clutter::Timeline> timeline = alpha->get_timeline();
const int current_frame_num = timeline->get_current_frame();
const int n_frames = timeline->get_n_frames();
- // Return a value that is simply proportional to the frame position
+ // Return a value that is simply proportional to the frame position:
return Clutter::Alpha::MAX_ALPHA * current_frame_num / n_frames;
}
@@ -50,19 +50,19 @@
{
Clutter::init(&argc, &argv);
- // Get the stage and set its size and color
+ // Get the stage and set its size and color:
const Glib::RefPtr<Clutter::Stage> stage = Clutter::Stage::get_default();
stage->set_size(200, 200);
stage->set_color(Clutter::Color(0x00, 0x00, 0x00, 0xFF)); // black
- // Add a rectangle to the stage
+ // Add a rectangle to the stage:
rect = Clutter::Rectangle::create(Clutter::Color(0xFF, 0xFF, 0xFF, 0x99));
rect->set_size(40, 40);
rect->set_position(10, 10);
stage->add_actor(rect);
rect->show();
- // Show the stage
+ // Show the stage:
stage->show();
{
@@ -85,7 +85,7 @@
behaviour->apply(rect);
}
- // Start the main loop, so we can respond to events
+ // Start the main loop, so we can respond to events:
Clutter::main();
return 0;
Modified: cluttermm_tutorial/trunk/examples/custom_actor/main.cc
==============================================================================
--- cluttermm_tutorial/trunk/examples/custom_actor/main.cc (original)
+++ cluttermm_tutorial/trunk/examples/custom_actor/main.cc Tue Jan 6 21:30:27 2009
@@ -22,23 +22,23 @@
{
Clutter::init(&argc, &argv);
- // Get the stage and set its size and color
+ // Get the stage and set its size and color:
Glib::RefPtr<Clutter::Stage> stage = Clutter::Stage::get_default();
stage->set_size(200, 200);
stage->set_color(Clutter::Color(0x00, 0x00, 0x00, 0xFF)); // black
- // Add our custom actor to the stage
+ // Add our custom actor to the stage:
Glib::RefPtr<Tutorial::Triangle> actor =
- Tutorial::Triangle::create(Clutter::Color(0xFF, 0xFF, 0xFF, 0x99));
+ Tutorial::Triangle::create(Clutter::Color(0xFF, 0xFF, 0xFF, 0x99));
actor->set_size(100, 100);
actor->set_position(20, 20);
stage->add_actor(actor);
actor->show();
- // Show the stage
+ // Show the stage:
stage->show();
- // Start the main loop, so we can respond to events
+ // Start the main loop, so we can respond to events:
Clutter::main();
return 0;
Modified: cluttermm_tutorial/trunk/examples/custom_actor/triangle_actor.cc
==============================================================================
--- cluttermm_tutorial/trunk/examples/custom_actor/triangle_actor.cc (original)
+++ cluttermm_tutorial/trunk/examples/custom_actor/triangle_actor.cc Tue Jan 6 21:30:27 2009
@@ -73,21 +73,22 @@
{
CoglColor coglcolor;
- // Paint the triangle with the actor's color
+ // Paint the triangle with the actor's color:
cogl_color_set_from_4ub(&coglcolor,
- color_.get_red(),
- color_.get_green(),
- color_.get_blue(),
- get_opacity());
+ color_.get_red(),
+ color_.get_green(),
+ color_.get_blue(),
+ get_opacity());
+
do_triangle_paint(&coglcolor);
}
void Triangle::pick_vfunc(const Clutter::Color& color)
{
- CoglColor coglcolor;
// Paint the triangle with the pick color, offscreen.
// This is used by Clutter to detect the actor under the cursor
// by identifying the unique color under the cursor.
+ CoglColor coglcolor;
cogl_color_set_from_4ub(&coglcolor,
color.get_red(),
color.get_green(),
@@ -117,7 +118,7 @@
color_ = color;
set_opacity(color_.get_alpha());
- if (is_visible())
+ if(is_visible())
queue_redraw();
}
Modified: cluttermm_tutorial/trunk/examples/custom_container/examplebox.cc
==============================================================================
--- cluttermm_tutorial/trunk/examples/custom_container/examplebox.cc (original)
+++ cluttermm_tutorial/trunk/examples/custom_container/examplebox.cc Tue Jan 6 21:30:27 2009
@@ -35,7 +35,7 @@
Box::Box()
:
- // Create a named GObject type for the custom container class
+ // Create a named GObject type for the custom container class:
Glib::ObjectBase(typeid(Box))
{
property_request_mode() = Clutter::REQUEST_WIDTH_FOR_HEIGHT;
@@ -73,7 +73,7 @@
const Glib::RefPtr<Clutter::Actor> element = actor;
const ChildrenList::iterator p = std::find(children_.begin(), children_.end(), element);
- if (p != children_.end())
+ if(p != children_.end())
{
element->unparent();
children_.erase(p);
@@ -99,7 +99,7 @@
void Box::foreach_vfunc(ClutterCallback callback, gpointer user_data)
{
- for (ChildrenList::iterator p = children_.begin(); p != children_.end(); ++p)
+ for(ChildrenList::iterator p = children_.begin(); p != children_.end(); ++p)
callback((*p)->gobj(), user_data);
}
@@ -107,9 +107,9 @@
{
cogl_push_matrix();
- for (ChildrenList::iterator p = children_.begin(); p != children_.end(); ++p)
+ for(ChildrenList::iterator p = children_.begin(); p != children_.end(); ++p)
{
- if ((*p)->is_mapped())
+ if((*p)->is_mapped())
(*p)->paint();
}
@@ -118,7 +118,7 @@
void Box::show_all_vfunc()
{
- for (ChildrenList::iterator p = children_.begin(); p != children_.end(); ++p)
+ for(ChildrenList::iterator p = children_.begin(); p != children_.end(); ++p)
(*p)->show();
show();
@@ -128,15 +128,15 @@
{
hide();
- for (ChildrenList::iterator p = children_.begin(); p != children_.end(); ++p)
+ for(ChildrenList::iterator p = children_.begin(); p != children_.end(); ++p)
(*p)->hide();
}
void Box::pick_vfunc(const Clutter::Color& color)
{
- for (ChildrenList::iterator p = children_.begin(); p != children_.end(); ++p)
+ for(ChildrenList::iterator p = children_.begin(); p != children_.end(); ++p)
{
- if ((*p)->is_mapped())
+ if((*p)->is_mapped())
(*p)->pick(color);
}
}
@@ -155,8 +155,8 @@
// Calculate the preferred width for this container,
// based on the preferred width requested by the children.
- for (ChildrenList::iterator p = children_.begin(); p != children_.end(); ++p)
- if ((*p)->is_visible())
+ for(ChildrenList::iterator p = children_.begin(); p != children_.end(); ++p)
+ if((*p)->is_visible())
{
Clutter::Unit child_min_width = 0;
Clutter::Unit child_natural_width = 0;
@@ -184,8 +184,8 @@
// Calculate the preferred height for this container,
// based on the preferred height requested by the children.
- for (ChildrenList::iterator p = children_.begin(); p != children_.end(); ++p)
- if ((*p)->is_visible())
+ for(ChildrenList::iterator p = children_.begin(); p != children_.end(); ++p)
+ if((*p)->is_visible())
{
Clutter::Unit child_min_height = 0;
Clutter::Unit child_natural_height = 0;
@@ -204,7 +204,7 @@
{
Clutter::Unit child_x = 0;
- for (ChildrenList::iterator p = children_.begin(); p != children_.end(); ++p)
+ for(ChildrenList::iterator p = children_.begin(); p != children_.end(); ++p)
{
Clutter::Unit min_width = 0;
Clutter::Unit min_height = 0;
@@ -218,7 +218,7 @@
const Clutter::ActorBox child_box (child_x, 0, child_x + child_width, child_height);
child_x += child_width;
- // Tell the child what position and size it may actually have
+ // Tell the child what position and size it may actually have:
(*p)->allocate(child_box, absolute_origin_changed);
}
Modified: cluttermm_tutorial/trunk/examples/custom_container/examplebox.h
==============================================================================
--- cluttermm_tutorial/trunk/examples/custom_container/examplebox.h (original)
+++ cluttermm_tutorial/trunk/examples/custom_container/examplebox.h Tue Jan 6 21:30:27 2009
@@ -36,25 +36,23 @@
protected:
Box();
- // Clutter::Container interface
- virtual void add_vfunc (const Glib::RefPtr<Actor>& actor);
+ // Clutter::Container interface:
+ virtual void add_vfunc(const Glib::RefPtr<Actor>& actor);
virtual void remove_vfunc(const Glib::RefPtr<Actor>& actor);
- virtual void raise_vfunc (const Glib::RefPtr<Actor>& actor, const Glib::RefPtr<Actor>& sibling);
- virtual void lower_vfunc (const Glib::RefPtr<Actor>& actor, const Glib::RefPtr<Actor>& sibling);
+ virtual void raise_vfunc(const Glib::RefPtr<Actor>& actor, const Glib::RefPtr<Actor>& sibling);
+ virtual void lower_vfunc(const Glib::RefPtr<Actor>& actor, const Glib::RefPtr<Actor>& sibling);
virtual void sort_depth_order_vfunc();
virtual void foreach_vfunc(ClutterCallback callback, gpointer user_data);
- // Clutter::Actor interface
+ // Clutter::Actor interface:
virtual void on_paint();
virtual void show_all_vfunc();
virtual void hide_all_vfunc();
virtual void pick_vfunc(const Clutter::Color& color);
- virtual void get_preferred_width_vfunc (Clutter::Unit for_height,
- Clutter::Unit& min_width_p,
- Clutter::Unit& natural_width_p);
- virtual void get_preferred_height_vfunc(Clutter::Unit for_width,
- Clutter::Unit& min_height_p,
- Clutter::Unit& natural_height_p);
+ virtual void get_preferred_width_vfunc(Clutter::Unit for_height,
+ Clutter::Unit& min_width_p, Clutter::Unit& natural_width_p);
+ virtual void get_preferred_height_vfunc(Clutter::Unit for_width,
+ Clutter::Unit& min_height_p, Clutter::Unit& natural_height_p);
virtual void allocate_vfunc(const Clutter::ActorBox& box, bool absolute_origin_changed);
private:
Modified: cluttermm_tutorial/trunk/examples/custom_container/main.cc
==============================================================================
--- cluttermm_tutorial/trunk/examples/custom_container/main.cc (original)
+++ cluttermm_tutorial/trunk/examples/custom_container/main.cc Tue Jan 6 21:30:27 2009
@@ -23,19 +23,19 @@
{
Clutter::init(&argc, &argv);
- // Get the stage and set its size and color
+ // Get the stage and set its size and color:
const Glib::RefPtr<Clutter::Stage> stage = Clutter::Stage::get_default();
stage->set_size(200, 200);
stage->set_color(Clutter::Color(0x00, 0x00, 0x00, 0xFF)); // black
- // Add our custom container to the stage
+ // Add our custom container to the stage:
const Glib::RefPtr<Tutorial::Box> box = Tutorial::Box::create();
- // Set the size to the preferred size of the container
+ // Set the size to the preferred size of the container:
box->set_size(-1, -1);
box->set_position(20, 20);
- // Add some actors to our container
+ // Add some actors to our container:
const Glib::RefPtr<Clutter::Rectangle>
rect1 = Clutter::Rectangle::create(Clutter::Color(0xFF, 0xFF, 0xFF, 0x99));
rect1->set_size(75, 75);
@@ -50,7 +50,7 @@
box->show_all();
stage->show();
- // Start the main loop, so we can respond to events
+ // Start the main loop, so we can respond to events:
Clutter::main();
return 0;
Modified: cluttermm_tutorial/trunk/examples/effects/main.cc
==============================================================================
--- cluttermm_tutorial/trunk/examples/effects/main.cc (original)
+++ cluttermm_tutorial/trunk/examples/effects/main.cc Tue Jan 6 21:30:27 2009
@@ -36,12 +36,12 @@
*/
static guint32 on_alpha(const Glib::RefPtr<Clutter::Alpha>& alpha)
{
- // Get the position in the timeline, so we can base our value upon it
+ // Get the position in the timeline, so we can base our value upon it:
const Glib::RefPtr<Clutter::Timeline> timeline = alpha->get_timeline();
const int current_frame_num = timeline->get_current_frame();
const int n_frames = timeline->get_n_frames();
- // Return a value that is simply proportional to the frame position
+ // Return a value that is simply proportional to the frame position:
return Clutter::Alpha::MAX_ALPHA * current_frame_num / n_frames;
}
@@ -51,25 +51,25 @@
{
Clutter::init(&argc, &argv);
- // Get the stage and set its size and color
+ // Get the stage and set its size and color:
const Glib::RefPtr<Clutter::Stage> stage = Clutter::Stage::get_default();
stage->set_size(200, 200);
stage->set_color(Clutter::Color(0x00, 0x00, 0x00, 0xFF));
- // Add a rectangle to the stage
+ // Add a rectangle to the stage:
rect = Clutter::Rectangle::create(Clutter::Color(0xFF, 0xFF, 0xFF, 0x99));
rect->set_size(40, 40);
rect->set_position(10, 10);
stage->add_actor(rect);
rect->show();
- // Show the stage
+ // Show the stage:
stage->show();
{
const Glib::RefPtr<Clutter::Timeline>
timeline = Clutter::Timeline::create(100 /*frames*/, 30 /*fps*/);
- timeline->set_loop(true);
+ timeline->set_loop();
timeline->start();
// Instead of our custom callback, we could use a standard callback.
@@ -81,7 +81,7 @@
knots[0].set_xy(10, 10);
knots[1].set_xy(150, 150);
- // Move the actor along the path
+ // Move the actor along the path:
effect->path(rect, knots);
// Also change the actor's opacity while moving it along the path:
@@ -90,7 +90,7 @@
effect->fade(rect, 50);
}
- // Start the main loop, so we can respond to events
+ // Start the main loop, so we can respond to events:
Clutter::main();
return 0;
Modified: cluttermm_tutorial/trunk/examples/full_example/main.cc
==============================================================================
--- cluttermm_tutorial/trunk/examples/full_example/main.cc (original)
+++ cluttermm_tutorial/trunk/examples/full_example/main.cc Tue Jan 6 21:30:27 2009
@@ -26,17 +26,17 @@
enum
{
- ELLIPSE_Y = 390, // the y position of the ellipse of images
- ELLIPSE_HEIGHT = 450, // the distance from front to back when it's rotated 90 degrees
- IMAGE_HEIGHT = 100
+ ELLIPSE_Y = 390, // The y position of the ellipse of images.
+ ELLIPSE_HEIGHT = 450, // The distance from front to back when it's rotated 90 degrees.
+ IMAGE_HEIGHT = 100
};
const double angle_step = 30.0;
struct Item
{
- std::string filepath;
- Glib::RefPtr<Clutter::Texture> texture;
+ std::string filepath;
+ Glib::RefPtr<Clutter::Texture> texture;
Glib::RefPtr<Clutter::BehaviourEllipse> behaviour;
Item() {}
@@ -51,22 +51,22 @@
virtual ~Example();
private:
- std::list<Item> items_;
- std::list<Item>::iterator front_item_;
+ std::list<Item> items_;
+ std::list<Item>::iterator front_item_;
- Glib::RefPtr<Clutter::Stage> stage_;
+ Glib::RefPtr<Clutter::Stage> stage_;
// For showing the filename:
- Glib::RefPtr<Clutter::Label> label_filename_;
+ Glib::RefPtr<Clutter::Label> label_filename_;
- // For rotating all images around an ellipse:
- Glib::RefPtr<Clutter::Timeline> timeline_rotation_;
+ // For rotating all images around an ellipse::
+ Glib::RefPtr<Clutter::Timeline> timeline_rotation_;
- // For moving one image up and scaling it:
- Glib::RefPtr<Clutter::Timeline> timeline_moveup_;
- Glib::RefPtr<Clutter::Behaviour> behaviour_scale_;
- Glib::RefPtr<Clutter::Behaviour> behaviour_path_;
- Glib::RefPtr<Clutter::Behaviour> behaviour_opacity_;
+ // For moving one image up and scaling it::
+ Glib::RefPtr<Clutter::Timeline> timeline_moveup_;
+ Glib::RefPtr<Clutter::Behaviour> behaviour_scale_;
+ Glib::RefPtr<Clutter::Behaviour> behaviour_path_;
+ Glib::RefPtr<Clutter::Behaviour> behaviour_opacity_;
void load_images(const std::string& directory_path);
void add_image_actors();
@@ -79,11 +79,11 @@
static void scale_texture_default(const Glib::RefPtr<Clutter::Texture>& texture)
{
- int width = 0;
+ int width = 0;
int height = 0;
texture->get_base_size(width, height);
- if (height > 0)
+ if(height > 0)
{
const double scale = IMAGE_HEIGHT / double(height);
texture->set_scale(scale, scale);
@@ -101,7 +101,7 @@
stage_->set_size(800, 600);
stage_->set_color(Clutter::Color(0xB0, 0xB0, 0xB0, 0xFF)); // light gray
- // Create and add a label actor, hidden at first
+ // Create and add a label actor, hidden at first:
label_filename_->set_color(Clutter::Color(0x60, 0x60, 0x90, 0xFF)); // blueish
label_filename_->set_font_name("Sans 24");
label_filename_->set_position(10, 10);
@@ -109,34 +109,35 @@
stage_->add_actor(label_filename_);
label_filename_->show();
- // Add a plane under the ellipse of images
+ // Add a plane under the ellipse of images:
const Glib::RefPtr<Clutter::Actor> rect =
Clutter::Rectangle::create(Clutter::Color(0xFF, 0xFF, 0xFF, 0xFF)); // white
rect->set_width(stage_->get_width() + 100);
rect->set_height(ELLIPSE_HEIGHT + 20);
- // Position it so that its center is under the images
+ // Position it so that its center is under the images:
rect->set_position(-(rect->get_width() - stage_->get_width()) / 2,
ELLIPSE_Y + IMAGE_HEIGHT - rect->get_height() / 2);
- // Rotate it around its center
+
+ // Rotate it around its center:
rect->set_rotation(Clutter::X_AXIS, -90.0, 0, rect->get_height() / 2, 0);
stage_->add_actor(rect);
rect->show();
- // Show the stage
+ // Show the stage:
stage_->show();
timeline_rotation_->signal_completed()
.connect(sigc::mem_fun(*this, &Example::on_timeline_rotation_completed));
- // Add an actor for each image
+ // Add an actor for each image:
load_images("images");
add_image_actors();
-#if 0
+#if 0 //TODO: What's this?
timeline_rotation_->set_loop(true);
#endif
- // Move them a bit to start with
- if (!items_.empty())
+ // Move them a bit to start with:
+ if(!items_.empty())
rotate_item_to_front(items_.begin());
}
@@ -150,7 +151,7 @@
Glib::Dir dir (directory_path);
- for (Glib::Dir::iterator p = dir.begin(); p != dir.end(); ++p)
+ for(Glib::Dir::iterator p = dir.begin(); p != dir.end(); ++p)
{
const std::string path = Glib::build_filename(directory_path, *p);
try
@@ -171,14 +172,14 @@
int y = 0;
double angle = 0.0;
- for (std::list<Item>::iterator p = items_.begin(); p != items_.end(); ++p)
+ for(std::list<Item>::iterator p = items_.begin(); p != items_.end(); ++p)
{
const Glib::RefPtr<Clutter::Actor> actor = p->texture;
- // Add the actor to the stage
+ // Add the actor to the stage:
stage_->add_actor(actor);
- // Set an initial position
+ // Set an initial position:
actor->set_position(x, y);
y += 100;
@@ -211,7 +212,7 @@
*/
void Example::on_timeline_moveup_completed()
{
- // Unref this timeline because we have now finished with it
+ // Forget this timeline because we have now finished with it:
timeline_moveup_.clear();
behaviour_scale_.clear();
behaviour_path_.clear();
@@ -228,13 +229,13 @@
// front. Now we transform just this one item gradually some more, and
// show the filename.
- // Transform the image
+ // Transform the image:
const Glib::RefPtr<Clutter::Actor> actor = front_item_->texture;
timeline_moveup_ = Clutter::Timeline::create(60 /*frames*/, 30 /*fps*/);
const Glib::RefPtr<Clutter::Alpha> alpha =
Clutter::Alpha::create(timeline_moveup_, &Clutter::Alpha::sine_inc_func);
- // Scale the item from its normal scale to approximately twice the normal scale
+ // Scale the item from its normal scale to approximately twice the normal scale:
double scale_start = 0.0;
actor->get_scale(scale_start, scale_start);
const double scale_end = scale_start * 1.8;
@@ -244,7 +245,7 @@
scale_end, scale_end);
behaviour_scale_->apply(actor);
- // Move the item up the y axis
+ // Move the item up the y axis:
std::vector<Clutter::Knot> knots (2);
knots[0].set_xy(actor->get_x(), actor->get_y());
knots[1].set_xy(knots[0].get_x(), knots[0].get_y() - 250);
@@ -252,12 +253,12 @@
behaviour_path_ = Clutter::BehaviourPath::create_with_knots(alpha, knots);
behaviour_path_->apply(actor);
- // Show the filename gradually
+ // Show the filename gradually:
label_filename_->set_text(front_item_->filepath);
behaviour_opacity_ = Clutter::BehaviourOpacity::create(alpha, 0, 255);
behaviour_opacity_->apply(label_filename_);
- // Start the timeline and handle its "completed" signal so we can unref it
+ // Start the timeline and handle its "completed" signal so we can unref it:
timeline_moveup_->signal_completed()
.connect(sigc::mem_fun(*this, &Example::on_timeline_moveup_completed));
timeline_moveup_->start();
@@ -269,31 +270,31 @@
timeline_rotation_->stop();
- // Stop the other timeline in case that is active at the same time
- if (timeline_moveup_)
+ // Stop the other timeline in case that is active at the same time:
+ if(timeline_moveup_)
timeline_moveup_->stop();
label_filename_->set_opacity(0);
- // Get the item's position in the list
+ // Get the item's position in the list:
const int pos = std::distance(items_.begin(), pitem);
- if (front_item_ == items_.end())
+ if(front_item_ == items_.end())
front_item_ = items_.begin();
const int pos_front = std::distance(items_.begin(), front_item_);
- // Calculate the end angle of the first item
+ // Calculate the end angle of the first item:
const double angle_front = 180.0;
double angle_start = std::fmod(angle_front - (angle_step * pos_front), 360.0);
double angle_end = angle_front - (angle_step * pos);
double angle_diff = 0.0;
- // Set the end angles
- for (std::list<Item>::iterator p = items_.begin(); p != items_.end(); ++p)
+ // Set the end angles:
+ for(std::list<Item>::iterator p = items_.begin(); p != items_.end(); ++p)
{
- // Reset its size
+ // Reset its size:
scale_texture_default(p->texture);
angle_start = std::fmod(angle_start, 360.0);
@@ -301,15 +302,15 @@
// Move 360Â instead of 0Â when moving for the first time,
// and when clicking on something that is already at the front.
- if (front_item_ == pitem)
+ if(front_item_ == pitem)
angle_end += 360.0;
p->behaviour->set_angle_start(angle_start);
p->behaviour->set_angle_end(angle_end);
- if (p == pitem)
+ if(p == pitem)
{
- if (angle_start < angle_end)
+ if(angle_start < angle_end)
angle_diff = angle_end - angle_start;
else
angle_diff = 360 - (angle_start - angle_end);
@@ -324,12 +325,12 @@
}
// Set the number of frames to be proportional to the distance to travel,
- // so the speed is always the same
+ // so the speed is always the same:
const int pos_to_move = (pos_front < pos) ? items_.size() + (pos - pos_front)
: pos_front - pos;
timeline_rotation_->set_n_frames(angle_diff);
- // Remember what item will be at the front when this timeline finishes
+ // Remember what item will be at the front when this timeline finishes:
front_item_ = pitem;
timeline_rotation_->start();
@@ -339,7 +340,7 @@
{
// Ignore the events if the timeline_rotation is running (meaning,
// if the objects are moving), to simplify things.
- if (timeline_rotation_ && timeline_rotation_->is_playing())
+ if(timeline_rotation_ && timeline_rotation_->is_playing())
{
g_print("on_texture_button_press(): ignoring\n");
return false;
@@ -359,7 +360,7 @@
Example example;
- // Start the main loop, so we can respond to events
+ // Start the main loop, so we can respond to events:
Clutter::main();
return 0;
Modified: cluttermm_tutorial/trunk/examples/multiline_text_entry/main.cc
==============================================================================
--- cluttermm_tutorial/trunk/examples/multiline_text_entry/main.cc (original)
+++ cluttermm_tutorial/trunk/examples/multiline_text_entry/main.cc Tue Jan 6 21:30:27 2009
@@ -24,7 +24,7 @@
Pango::init();
Clutter::init(&argc, &argv);
- // Get the stage and set its size and color
+ // Get the stage and set its size and color:
const Glib::RefPtr<Clutter::Stage> stage = Clutter::Stage::get_default();
stage->set_size(400, 400);
stage->set_color(Clutter::Color(0x00, 0x00, 0x00, 0xFF)); // black
@@ -46,13 +46,13 @@
stage->add_actor(multiline);
multiline->show();
- // Connect signal handlers to handle key presses on the stage
+ // Connect signal handlers to handle key presses on the stage:
stage->signal_key_press_event().connect(
- sigc::mem_fun(*multiline.operator->(), &Tutorial::MultilineEntry::handle_key_event));
+ sigc::mem_fun(*multiline.operator->(), &Tutorial::MultilineEntry::handle_key_event));
stage->show();
- // Start the main loop, so we can respond to events
+ // Start the main loop, so we can respond to events:
Clutter::main();
return 0;
Modified: cluttermm_tutorial/trunk/examples/multiline_text_entry/multiline_entry.cc
==============================================================================
--- cluttermm_tutorial/trunk/examples/multiline_text_entry/multiline_entry.cc (original)
+++ cluttermm_tutorial/trunk/examples/multiline_text_entry/multiline_entry.cc Tue Jan 6 21:30:27 2009
@@ -30,11 +30,11 @@
{
static void* context = 0;
- if (context == 0)
+ if(context == 0)
{
double resolution = clutter_backend_get_resolution(clutter_get_default_backend());
- if (resolution < 0.0)
+ if(resolution < 0.0)
resolution = 96.0; // fallback
PangoFontMap *const fontmap = cogl_pango_font_map_new();
@@ -42,14 +42,14 @@
context = cogl_pango_font_map_create_context(COGL_PANGO_FONT_MAP(fontmap));
- // Clear the pointer when the object is destroyed
+ // Clear the pointer when the object is destroyed:
g_object_add_weak_pointer(static_cast<GObject*>(context), &context);
- // Transfer ownership
+ // Transfer ownership:
return Glib::wrap(static_cast<PangoContext*>(context), false);
}
- // Increase reference count
+ // Increase reference count:
return Glib::wrap(static_cast<PangoContext*>(context), true);
}
@@ -103,7 +103,7 @@
layout_.clear();
cursor_pos_.set_width(0);
- if (is_visible())
+ if(is_visible())
queue_redraw();
signal_text_changed_.emit();
@@ -123,16 +123,16 @@
{
Pango::FontDescription font ((font_name.empty()) ? Glib::ustring(default_font_name) : font_name);
- if (font == font_)
+ if(font == font_)
return;
swap(font_, font);
- if (!text_.empty())
+ if(!text_.empty())
{
layout_.clear();
- if (is_visible())
+ if(is_visible())
queue_redraw();
}
}
@@ -149,7 +149,7 @@
cursor_->set_color(fgcol_);
- if (is_visible())
+ if(is_visible())
queue_redraw();
}
@@ -180,13 +180,13 @@
set_text(ustring(text_).erase(start, end - start));
- if (position_ != ustring::npos)
+ if(position_ != ustring::npos)
set_cursor_position(start);
}
void MultilineEntry::ensure_layout(int width)
{
- if (!layout_)
+ if(!layout_)
{
Glib::RefPtr<Pango::Layout> layout = Pango::Layout::create(context_);
@@ -203,10 +203,9 @@
void MultilineEntry::ensure_cursor_position()
{
-
Glib::ustring::iterator pos = text_.begin();
- if (position_ == Glib::ustring::npos)
+ if(position_ == Glib::ustring::npos)
pos = text_.end();
else
std::advance(pos, position_);
@@ -227,14 +226,14 @@
*/
void MultilineEntry::set_cursor_position(Glib::ustring::size_type position)
{
- if (position < text_.length())
+ if(position < text_.length())
position_ = position;
else
position_ = Glib::ustring::npos;
cursor_pos_.set_width(0);
- if (is_visible())
+ if(is_visible())
queue_redraw();
}
@@ -246,17 +245,17 @@
{
g_return_if_fail(Glib::Unicode::validate(wc));
- if (wc == 0)
+ if(wc == 0)
return;
using Glib::ustring;
- if (position_ == ustring::npos)
+ if(position_ == ustring::npos)
set_text(text_ + wc);
else
set_text(ustring(text_).insert(position_, 1, wc));
- if (position_ != ustring::npos)
+ if(position_ != ustring::npos)
set_cursor_position(position_ + 1);
}
@@ -294,33 +293,33 @@
const Pango::Rectangle logical = layout_->get_logical_extents();
int text_width = logical.get_width() / Pango::SCALE;
- if (actor_width < text_width)
+ if(actor_width < text_width)
{
- // We need to do some scrolling
+ // We need to do some scrolling:
const int cursor_x = cursor_pos_.get_x();
// If the cursor is at the begining or the end of the text, the placement
// is easy, however, if the cursor is in the middle somewhere, we need to
// make sure the text doesn't move until the cursor is either in the
- // far left or far right
- if (position_ == 0)
+ // far left or far right.
+ if(position_ == 0)
{
text_x_ = 0;
}
- else if (position_ == Glib::ustring::npos)
+ else if(position_ == Glib::ustring::npos)
{
text_x_ = actor_width - text_width;
cursor_pos_.set_x(cursor_x + text_x_);
}
else
{
- if (text_x_ <= 0)
+ if(text_x_ <= 0)
{
const int diff = -text_x_;
- if (cursor_x < diff)
+ if(cursor_x < diff)
text_x_ += diff - cursor_x;
- else if (cursor_x > diff + actor_width)
+ else if(cursor_x > diff + actor_width)
text_x_ -= cursor_x - (diff + actor_width);
}
cursor_pos_.set_x(cursor_x + text_x_);
@@ -346,7 +345,7 @@
{
const int width = CLUTTER_UNITS_TO_DEVICE(box.get_x2() - box.get_x1());
- if (width_ != width)
+ if(width_ != width)
{
layout_.clear();
ensure_layout(width);
@@ -367,38 +366,38 @@
*/
bool MultilineEntry::handle_key_event(Clutter::KeyEvent* event)
{
- switch (Clutter::key_event_symbol(event))
+ switch(Clutter::key_event_symbol(event))
{
case CLUTTER_Escape:
case CLUTTER_Shift_L:
case CLUTTER_Shift_R:
- // Ignore these - Don't try to insert them as characters
+ // Ignore these - Don't try to insert them as characters:
return false;
case CLUTTER_BackSpace:
- // Delete the current character
- if (position_ != 0 && !text_.empty())
+ // Delete the current character:
+ if(position_ != 0 && !text_.empty())
delete_chars(1);
break;
case CLUTTER_Delete:
case CLUTTER_KP_Delete:
- // Delete the current character
- if (!text_.empty() && position_ != Glib::ustring::npos)
+ // Delete the current character:
+ if(!text_.empty() && position_ != Glib::ustring::npos)
delete_text(position_, position_ + 1);
break;
case CLUTTER_Left:
case CLUTTER_KP_Left:
- // Move the cursor one character left
- if (position_ != 0 && !text_.empty())
+ // Move the cursor one character left:
+ if(position_ != 0 && !text_.empty())
set_cursor_position(((position_ == Glib::ustring::npos) ? text_.length() : position_) - 1);
break;
case CLUTTER_Right:
case CLUTTER_KP_Right:
- // Move the cursor one character right
- if (position_ != Glib::ustring::npos && !text_.empty() && position_ < text_.length())
+ // Move the cursor one character right:
+ if(position_ != Glib::ustring::npos && !text_.empty() && position_ < text_.length())
set_cursor_position(position_ + 1);
break;
@@ -416,14 +415,14 @@
case CLUTTER_End:
case CLUTTER_KP_End:
- // Move the cursor to the end of the text
+ // Move the cursor to the end of the text:
set_cursor_position(Glib::ustring::npos);
break;
case CLUTTER_Begin:
case CLUTTER_Home:
case CLUTTER_KP_Home:
- // Move the cursor to the start of the text
+ // Move the cursor to the start of the text:
set_cursor_position(0);
break;
Modified: cluttermm_tutorial/trunk/examples/multiline_text_entry/multiline_entry.h
==============================================================================
--- cluttermm_tutorial/trunk/examples/multiline_text_entry/multiline_entry.h (original)
+++ cluttermm_tutorial/trunk/examples/multiline_text_entry/multiline_entry.h Tue Jan 6 21:30:27 2009
@@ -30,9 +30,9 @@
virtual ~MultilineEntry();
static Glib::RefPtr<MultilineEntry> create();
- sigc::signal<void>& signal_text_changed() { return signal_text_changed_; }
+ sigc::signal<void>& signal_text_changed() { return signal_text_changed_; }
sigc::signal<void, Clutter::Geometry&>& signal_cursor_event() { return signal_cursor_event_; }
- sigc::signal<void>& signal_activate() { return signal_activate_; }
+ sigc::signal<void>& signal_activate() { return signal_activate_; }
void set_text(const Glib::ustring& text);
Glib::ustring get_text() const;
@@ -57,25 +57,25 @@
virtual void on_activate();
private:
- sigc::signal<void> signal_text_changed_;
- sigc::signal<void, Clutter::Geometry&> signal_cursor_event_;
- sigc::signal<void> signal_activate_;
+ sigc::signal<void> signal_text_changed_;
+ sigc::signal<void, Clutter::Geometry&> signal_cursor_event_;
+ sigc::signal<void> signal_activate_;
- Glib::RefPtr<Pango::Context> context_;
- Pango::FontDescription font_;
+ Glib::RefPtr<Pango::Context> context_;
+ Pango::FontDescription font_;
- Clutter::Color fgcol_;
- Glib::ustring text_;
+ Clutter::Color fgcol_;
+ Glib::ustring text_;
- int width_;
- Glib::ustring::size_type position_;
- int text_x_;
+ int width_;
+ Glib::ustring::size_type position_;
+ int text_x_;
- Pango::AttrList effective_attrs_;
- Glib::RefPtr<Pango::Layout> layout_;
+ Pango::AttrList effective_attrs_;
+ Glib::RefPtr<Pango::Layout> layout_;
- Clutter::Geometry cursor_pos_;
- Glib::RefPtr<Clutter::Rectangle> cursor_;
+ Clutter::Geometry cursor_pos_;
+ Glib::RefPtr<Clutter::Rectangle> cursor_;
void ensure_layout(int width);
void ensure_cursor_position();
Modified: cluttermm_tutorial/trunk/examples/score/main.cc
==============================================================================
--- cluttermm_tutorial/trunk/examples/score/main.cc (original)
+++ cluttermm_tutorial/trunk/examples/score/main.cc Tue Jan 6 21:30:27 2009
@@ -22,30 +22,30 @@
static Glib::RefPtr<Clutter::Rectangle> rect;
-static int rotation_angle = 0;
+static int rotation_angle = 0;
static int color_change_count = 0;
/*
* Rotate the rectangle and alternate its color.
*/
static void on_timeline_rotation_new_frame(int frame_num,
- Glib::RefPtr<Clutter::Timeline> timeline)
+ Glib::RefPtr<Clutter::Timeline> timeline)
{
- if (++rotation_angle >= 360)
+ if(++rotation_angle >= 360)
rotation_angle = 0;
// Rotate the rectangle clockwise around the z axis, around
- // it's top-left corner
+ // it's top-left corner:
rect->set_rotation(Clutter::X_AXIS, rotation_angle, 0, 0, 0);
// Change the color
// (This is a silly example, making the rectangle flash)
- if (++color_change_count > 100)
+ if(++color_change_count > 100)
color_change_count = 0;
- if (color_change_count == 0)
+ if(color_change_count == 0)
rect->set_color(Clutter::Color(0xFF, 0xFF, 0xFF, 0x99));
- else if (color_change_count == 50)
+ else if(color_change_count == 50)
rect->set_color(Clutter::Color(0x10, 0x40, 0x90, 0xFF));
}
@@ -53,11 +53,11 @@
* Move the rectangle.
*/
static void on_timeline_move_new_frame(int frame_num,
- Glib::RefPtr<Clutter::Timeline> timeline)
+ Glib::RefPtr<Clutter::Timeline> timeline)
{
int x_position = rect->get_x();
- if (++x_position >= 150)
+ if(++x_position >= 150)
x_position = 0;
rect->set_x(x_position);
@@ -69,23 +69,23 @@
{
Clutter::init(&argc, &argv);
- // Get the stage and set its size and color
+ // Get the stage and set its size and color:
const Glib::RefPtr<Clutter::Stage> stage = Clutter::Stage::get_default();
stage->set_size(200, 200);
stage->set_color(Clutter::Color(0x00, 0x00, 0x00, 0xFF));
- // Add a rectangle to the stage
+ // Add a rectangle to the stage:
rect = Clutter::Rectangle::create(Clutter::Color(0xFF, 0xFF, 0xFF, 0x99));
rect->set_size(70, 70);
rect->set_position(50, 100);
stage->add_actor(rect);
rect->show();
- // Show the stage
+ // Show the stage:
stage->show();
// Create a score and add two timelines to it,
- // so the second timeline starts when the first one stops
+ // so the second timeline starts when the first one stops:
const Glib::RefPtr<Clutter::Score> score = Clutter::Score::create();
score->set_loop(true);
@@ -103,7 +103,7 @@
score->start();
- // Start the main loop, so we can respond to events
+ // Start the main loop, so we can respond to events:
Clutter::main();
return 0;
Modified: cluttermm_tutorial/trunk/examples/scrolling/main.cc
==============================================================================
--- cluttermm_tutorial/trunk/examples/scrolling/main.cc (original)
+++ cluttermm_tutorial/trunk/examples/scrolling/main.cc Tue Jan 6 21:30:27 2009
@@ -23,7 +23,7 @@
{
static bool on_stage_button_press(Clutter::ButtonEvent*,
- Glib::RefPtr<Tutorial::ScrollingContainer> scrolling)
+ Glib::RefPtr<Tutorial::ScrollingContainer> scrolling)
{
std::cout << "Scrolling\n";
@@ -38,7 +38,7 @@
{
Clutter::init(&argc, &argv);
- // Get the stage and set its size and color
+ // Get the stage and set its size and color:
const Glib::RefPtr<Clutter::Stage> stage = Clutter::Stage::get_default();
stage->set_size(200, 200);
stage->set_color(Clutter::Color(0x00, 0x00, 0x00, 0xFF)); // black
@@ -50,19 +50,21 @@
scrolling->set_position(10, 10);
stage->add_actor(scrolling);
- // Add some actors to our container
+ // Add some actors to our container:
{
const Glib::RefPtr<Clutter::Actor>
actor = Clutter::Rectangle::create(Clutter::Color(0x7F, 0xAE, 0xFF, 0xFF));
actor->set_size(75, 75);
scrolling->add_actor(actor);
}
+
{
const Glib::RefPtr<Clutter::Actor>
actor = Clutter::Rectangle::create(Clutter::Color(0xFF, 0x7F, 0xAE, 0xFF));
actor->set_size(75, 75);
scrolling->add_actor(actor);
}
+
{
const Glib::RefPtr<Clutter::Actor>
actor = Clutter::Rectangle::create(Clutter::Color(0xAE, 0xFF, 0x7F, 0xFF));
@@ -73,10 +75,10 @@
scrolling->show_all();
stage->show();
- // Connect signal handlers to handle mouse clicks on the stage
+ // Connect signal handlers to handle mouse clicks on the stage:
stage->signal_button_press_event().connect(sigc::bind(&on_stage_button_press, scrolling));
- // Start the main loop, so we can respond to events
+ // Start the main loop, so we can respond to events:
Clutter::main();
return 0;
Modified: cluttermm_tutorial/trunk/examples/scrolling/scrollingcontainer.cc
==============================================================================
--- cluttermm_tutorial/trunk/examples/scrolling/scrollingcontainer.cc (original)
+++ cluttermm_tutorial/trunk/examples/scrolling/scrollingcontainer.cc Tue Jan 6 21:30:27 2009
@@ -22,7 +22,7 @@
{
static void allocate_child(const Glib::RefPtr<Clutter::Actor>& actor,
- int& child_x, bool absolute_origin_changed)
+ int& child_x, bool absolute_origin_changed)
{
Clutter::Unit min_width = 0;
Clutter::Unit min_height = 0;
@@ -32,7 +32,7 @@
actor->get_preferred_size(min_width, min_height, width, height);
const Clutter::ActorBox child_box (CLUTTER_UNITS_FROM_DEVICE(child_x), 0,
- CLUTTER_UNITS_FROM_DEVICE(child_x) + width, height);
+ CLUTTER_UNITS_FROM_DEVICE(child_x) + width, height);
actor->allocate(child_box, absolute_origin_changed);
@@ -52,24 +52,24 @@
ScrollingContainer::ScrollingContainer()
:
Glib::ObjectBase(typeid(ScrollingContainer)),
- border_ (Clutter::Rectangle::create(Clutter::Color(0xFF, 0xFF, 0xCC, 0xFF))),
- children_ (Clutter::Group::create()),
- offset_ (0)
+ border_(Clutter::Rectangle::create(Clutter::Color(0xFF, 0xFF, 0xCC, 0xFF))),
+ children_(Clutter::Group::create()),
+ offset_(0)
{
- // Ugly but necessary: Explicitely acquire an additional reference
+ // Ugly but necessary: Explicitely acquire an additional reference
// because Glib::RefPtr assumes ownership.
const Glib::RefPtr<Clutter::Actor> self ((reference(), this));
- border_ ->set_parent(self);
+ border_->set_parent(self);
children_->set_parent(self);
- children_->signal_actor_added() .connect(sigc::mem_fun(*this, &ScrollingContainer::actor_added));
+ children_->signal_actor_added().connect(sigc::mem_fun(*this, &ScrollingContainer::actor_added));
children_->signal_actor_removed().connect(sigc::mem_fun(*this, &ScrollingContainer::actor_removed));
}
ScrollingContainer::~ScrollingContainer()
{
children_->unparent();
- border_ ->unparent();
+ border_->unparent();
}
Glib::RefPtr<ScrollingContainer> ScrollingContainer::create()
@@ -100,13 +100,13 @@
}
void ScrollingContainer::raise_vfunc(const Glib::RefPtr<Clutter::Actor>&,
- const Glib::RefPtr<Clutter::Actor>&)
+ const Glib::RefPtr<Clutter::Actor>&)
{
g_assert_not_reached();
}
void ScrollingContainer::lower_vfunc(const Glib::RefPtr<Clutter::Actor>&,
- const Glib::RefPtr<Clutter::Actor>&)
+ const Glib::RefPtr<Clutter::Actor>&)
{
g_assert_not_reached();
}
@@ -155,7 +155,7 @@
void ScrollingContainer::pick_vfunc(const Clutter::Color& color)
{
- if (border_->is_mapped())
+ if(border_->is_mapped())
border_->pick(color);
children_->pick(color);
@@ -168,13 +168,13 @@
Clutter::ActorBox child_box (0, 0, width, height);
- // Position the child at the top of the container
+ // Position the child at the top of the container:
children_->allocate(child_box, absolute_origin_changed);
- // Make sure that the group only shows the specified area, by clipping
+ // Make sure that the group only shows the specified area, by clipping:
children_->set_clip(0, 0, CLUTTER_UNITS_TO_DEVICE(width), CLUTTER_UNITS_TO_DEVICE(height));
- // Show a rectangle border to show the area
+ // Show a rectangle border to show the area:
border_->allocate(child_box, absolute_origin_changed);
int child_x = -offset_;
Modified: cluttermm_tutorial/trunk/examples/scrolling/scrollingcontainer.h
==============================================================================
--- cluttermm_tutorial/trunk/examples/scrolling/scrollingcontainer.h (original)
+++ cluttermm_tutorial/trunk/examples/scrolling/scrollingcontainer.h Tue Jan 6 21:30:27 2009
@@ -34,15 +34,15 @@
protected:
ScrollingContainer();
- // Clutter::Container interface
- virtual void add_vfunc (const Glib::RefPtr<Actor>& actor);
+ // Clutter::Container interface:
+ virtual void add_vfunc(const Glib::RefPtr<Actor>& actor);
virtual void remove_vfunc(const Glib::RefPtr<Actor>& actor);
- virtual void raise_vfunc (const Glib::RefPtr<Actor>& actor, const Glib::RefPtr<Actor>& sibling);
- virtual void lower_vfunc (const Glib::RefPtr<Actor>& actor, const Glib::RefPtr<Actor>& sibling);
+ virtual void raise_vfunc(const Glib::RefPtr<Actor>& actor, const Glib::RefPtr<Actor>& sibling);
+ virtual void lower_vfunc(const Glib::RefPtr<Actor>& actor, const Glib::RefPtr<Actor>& sibling);
virtual void sort_depth_order_vfunc();
virtual void foreach_vfunc(ClutterCallback callback, gpointer user_data);
- // Clutter::Actor interface
+ // Clutter::Actor interface:
virtual void on_paint();
virtual void on_show();
virtual void on_hide();
@@ -53,8 +53,8 @@
private:
Glib::RefPtr<Clutter::Rectangle> border_;
- Glib::RefPtr<Clutter::Group> children_;
- int offset_;
+ Glib::RefPtr<Clutter::Group> children_;
+ int offset_;
};
} // namespace Tutorial
Modified: cluttermm_tutorial/trunk/examples/stage/main.cc
==============================================================================
--- cluttermm_tutorial/trunk/examples/stage/main.cc (original)
+++ cluttermm_tutorial/trunk/examples/stage/main.cc Tue Jan 6 21:30:27 2009
@@ -41,17 +41,17 @@
{
Clutter::init(&argc, &argv);
- // Get the stage and set its size and color
+ // Get the stage and set its size and color:
Glib::RefPtr<Clutter::Stage> stage = Clutter::Stage::get_default();
stage->set_size(200, 200);
stage->set_color(Clutter::Color(0, 0, 0)); // black
stage->show();
- // Connect a signal handler to handle mouse clicks
+ // Connect a signal handler to handle mouse clicks:
stage->signal_button_press_event().connect(&on_stage_button_press);
- // Start the main loop, so we can respond to events
+ // Start the main loop, so we can respond to events:
Clutter::main();
}
catch (const Glib::Error& error)
Modified: cluttermm_tutorial/trunk/examples/stage_widget/main.cc
==============================================================================
--- cluttermm_tutorial/trunk/examples/stage_widget/main.cc (original)
+++ cluttermm_tutorial/trunk/examples/stage_widget/main.cc Tue Jan 6 21:30:27 2009
@@ -29,9 +29,9 @@
virtual ~StageWindow();
private:
- Clutter::Gtk::Embed* embed_;
- Glib::RefPtr<Clutter::Stage> stage_;
- bool colored_;
+ Clutter::Gtk::Embed* embed_;
+ Glib::RefPtr<Clutter::Stage> stage_;
+ bool colored_;
void on_button_clicked();
static bool on_stage_button_press(Clutter::ButtonEvent* event);
@@ -39,8 +39,8 @@
StageWindow::StageWindow()
:
- embed_ (0),
- colored_ (false)
+ embed_(0),
+ colored_(false)
{
Gtk::Box *const box = new Gtk::VBox(false, 6);
add(*Gtk::manage(box));
@@ -70,7 +70,7 @@
{
colored_ = !colored_;
stage_->set_color((colored_) ? Clutter::Color(32, 32, 160)
- : Clutter::Color(0, 0, 0));
+ : Clutter::Color(0, 0, 0));
}
bool StageWindow::on_stage_button_press(Clutter::ButtonEvent* event)
Modified: cluttermm_tutorial/trunk/examples/timeline/main.cc
==============================================================================
--- cluttermm_tutorial/trunk/examples/timeline/main.cc (original)
+++ cluttermm_tutorial/trunk/examples/timeline/main.cc Tue Jan 6 21:30:27 2009
@@ -22,27 +22,27 @@
static Glib::RefPtr<Clutter::Rectangle> rect;
-static int rotation_angle = 0;
+static int rotation_angle = 0;
static int color_change_count = 0;
static void on_timeline_new_frame(int frame_num,
- Glib::RefPtr<Clutter::Timeline> timeline)
+ Glib::RefPtr<Clutter::Timeline> timeline)
{
- if (++rotation_angle >= 360)
+ if(++rotation_angle >= 360)
rotation_angle = 0;
// Rotate the rectangle clockwise around the z axis, around
- // it's top-left corner
+ // it's top-left corner:
rect->set_rotation(Clutter::X_AXIS, rotation_angle, 0, 0, 0);
// Change the color
- // (This is a silly example, making the rectangle flash)
- if (++color_change_count > 100)
+ // (This is a silly example, making the rectangle flash):
+ if(++color_change_count > 100)
color_change_count = 0;
- if (color_change_count == 0)
+ if(color_change_count == 0)
rect->set_color(Clutter::Color(0xFF, 0xFF, 0xFF, 0x99));
- else if (color_change_count == 50)
+ else if(color_change_count == 50)
rect->set_color(Clutter::Color(0x10, 0x40, 0x90, 0xFF));
}
@@ -52,19 +52,19 @@
{
Clutter::init(&argc, &argv);
- // Get the stage and set its size and color
+ // Get the stage and set its size and color:
const Glib::RefPtr<Clutter::Stage> stage = Clutter::Stage::get_default();
stage->set_size(200, 200);
stage->set_color(Clutter::Color(0x00, 0x00, 0x00, 0xFF));
- // Add a rectangle to the stage
+ // Add a rectangle to the stage:
rect = Clutter::Rectangle::create(Clutter::Color(0xFF, 0xFF, 0xFF, 0x99));
rect->set_size(70, 70);
rect->set_position(50, 100);
stage->add_actor(rect);
rect->show();
- // Show the stage
+ // Show the stage:
stage->show();
const Glib::RefPtr<Clutter::Timeline>
@@ -74,7 +74,7 @@
timeline->set_loop(true);
timeline->start();
- // Start the main loop, so we can respond to events
+ // Start the main loop, so we can respond to events:
Clutter::main();
return 0;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]