[libchamplainmm] Label: Wrap missing create(), simplify others
- From: Juan R. Garcia Blanco <juanrgar src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [libchamplainmm] Label: Wrap missing create(), simplify others
- Date: Tue, 10 Jun 2014 18:05:34 +0000 (UTC)
commit 8576b0475378e9b818453575c196ae559cfe1ab6
Author: Juan R. GarcĂa Blanco <juanrgar gmail com>
Date: Tue Jun 10 20:04:57 2014 +0200
Label: Wrap missing create(), simplify others
champlain/src/label.ccg | 82 -------------------------------------------
champlain/src/label.hg | 52 +++++----------------------
tools/m4/convert_clutter.m4 | 1 +
3 files changed, 10 insertions(+), 125 deletions(-)
---
diff --git a/champlain/src/label.ccg b/champlain/src/label.ccg
index bfd2d6e..ae6681f 100644
--- a/champlain/src/label.ccg
+++ b/champlain/src/label.ccg
@@ -21,88 +21,6 @@
namespace Champlain
{
-Glib::RefPtr<Label> Label::create(const Glib::ustring& text,
- const Glib::ustring& font,
- const Clutter::Color& text_color,
- const Clutter::Color& label_color)
-{
- const Glib::RefPtr<Label> label(new Label());
-
- label->set_text(text);
- label->set_font_name(font);
- label->set_text_color(text_color);
- label->set_color(label_color);
-
- return label;
-}
-
-//Glib::RefPtr<Label> Label::create(const std::string& filename)
-//{
-// const Glib::RefPtr<Label> label(new Label());
-//
-//
-// ChamplainLabel *label = CHAMPLAIN_LABEL (champlain_label_new ());
-//
-// ClutterActor *actor;
-// GdkPixbuf *pixbuf;
-// ClutterContent *content;
-// gfloat width, height;
-//
-// if (filename == NULL)
-// return CLUTTER_ACTOR (label);
-//
-// pixbuf = gdk_pixbuf_new_from_file (filename, error);
-// if (pixbuf == NULL)
-// return CLUTTER_ACTOR (label);
-//
-// content = clutter_image_new ();
-// clutter_image_set_data (CLUTTER_IMAGE (content),
-// gdk_pixbuf_get_pixels (pixbuf),
-// gdk_pixbuf_get_has_alpha (pixbuf)
-// ? COGL_PIXEL_FORMAT_RGBA_8888
-// : COGL_PIXEL_FORMAT_RGB_888,
-// gdk_pixbuf_get_width (pixbuf),
-// gdk_pixbuf_get_height (pixbuf),
-// gdk_pixbuf_get_rowstride (pixbuf),
-// error);
-// g_object_unref (pixbuf);
-//
-// actor = clutter_actor_new ();
-// clutter_content_get_preferred_size (content, &width, &height);
-// clutter_actor_set_size (actor, width, height);
-// clutter_actor_set_content (actor, content);
-// clutter_content_invalidate (content);
-// g_object_unref (content);
-//
-// champlain_label_set_image (label, actor);
-//
-// return CLUTTER_ACTOR (label);
-//
-//
-//
-// return label;
-//}
-
-Glib::RefPtr<Label> Label::create(const Glib::RefPtr<Clutter::Actor>& actor)
-{
- const Glib::RefPtr<Label> label(new Label());
-
- label->set_image(actor);
-
- return label;
-}
-
-Glib::RefPtr<Label> Label::create(const Glib::ustring& text,
- const Glib::RefPtr<Clutter::Actor>& actor)
-{
- const Glib::RefPtr<Label> label(new Label());
-
- label->set_image(actor);
- label->set_text(text);
-
- return label;
-}
-
void Label::unset_color()
{
champlain_label_set_color(gobj(), NULL);
diff --git a/champlain/src/label.hg b/champlain/src/label.hg
index 567cf68..f7f22bd 100644
--- a/champlain/src/label.hg
+++ b/champlain/src/label.hg
@@ -59,9 +59,8 @@ protected:
*/
explicit Label(const Glib::ustring& text,
const Glib::ustring& font = Glib::ustring("Sans 11"),
- const Clutter::Color& text_color = Clutter::Color(0xee, 0xee, 0xee, 0xff),
- const Clutter::Color& label_color = Clutter::Color(0x33, 0x33, 0x33, 0xff));
- _IGNORE(champlain_label_new_with_text)
+ Clutter::Color text_color = Clutter::Color(0xee, 0xee, 0xee, 0xff),
+ Clutter::Color label_color = Clutter::Color(0x33, 0x33, 0x33, 0xff));
/** Creates a new instance of Label with image.
*
@@ -70,7 +69,6 @@ protected:
* @newin{0,10}
*/
explicit Label(const Glib::RefPtr<Clutter::Actor>& actor);
- _IGNORE(champlain_label_new_with_image)
/** Creates a new instance of Label with image loaded from file.
*
@@ -79,7 +77,6 @@ protected:
* @newin{0,10}
*/
explicit Label(const std::string& filename);
- _IGNORE(champlain_label_new_from_file)
/** Creates a new instance of Label consisting of a custom Clutter::Actor.
*
@@ -90,51 +87,20 @@ protected:
*/
explicit Label(const Glib::ustring& text,
const Glib::RefPtr<Clutter::Actor>& actor);
- _IGNORE(champlain_label_new_full)
public:
_WRAP_CREATE()
- /** Creates a new instance of Label with text value.
- *
- * @param text The text of the label
- * @param font The font to use to draw the text, for example "Courrier Bold 11"
- * @param text_color A Clutter::Color, the color of the text; default is {0xee, 0xee, 0xee, 0xff}
- * @param label_color A Clutter::Color, the color of the label; default is {0x33, 0x33, 0x33, 0xff}
- *
- * @newin{0,10}
- */
- static Glib::RefPtr<Label> create(const Glib::ustring& text,
- const Glib::ustring& font = Glib::ustring("Sans 11"),
- const Clutter::Color& text_color = Clutter::Color(0xee, 0xee, 0xee,
0xff),
- const Clutter::Color& label_color = Clutter::Color(0x33, 0x33, 0x33,
0xff));
+ _WRAP_METHOD(static Glib::RefPtr<Clutter::Actor> create(const Glib::ustring& text,
+ const Glib::ustring& font = Glib::ustring("Sans
11"),
+ Clutter::Color text_color = Clutter::Color(0xee,
0xee, 0xee, 0xff),
+ Clutter::Color label_color = Clutter::Color(0x33,
0x33, 0x33, 0xff)), champlain_label_new_with_text)
- /** Creates a new instance of Label with image.
- *
- * @param actor The image as a Clutter::Actor.
- *
- * @newin{0,10}
- */
- static Glib::RefPtr<Label> create(const Glib::RefPtr<Clutter::Actor>& actor);
+ _WRAP_METHOD(static Glib::RefPtr<Clutter::Actor> create(const Glib::RefPtr<Clutter::Actor>& actor),
champlain_label_new_with_image)
-//TODO
-// /** Creates a new instance of Label with image loaded from file.
-// *
-// * @param filename The filename of the image.
-// *
-// * @newin{0,10}
-// */
-// static Glib::RefPtr<Label> create(const std::string & filename);
+ _WRAP_METHOD(static Glib::RefPtr<Clutter::Actor> create(const std::string& filename),
champlain_label_new_from_file, errthrow)
- /** Creates a new instance of Label consisting of a custom Clutter::Actor.
- *
- * @param text The text of the label
- * @param actor The image as a Clutter::Actor
- *
- * @newin{0,10}
- */
- static Glib::RefPtr<Label> create(const Glib::ustring& text,
- const Glib::RefPtr<Clutter::Actor>& actor);
+ _WRAP_METHOD(static Glib::RefPtr<Clutter::Actor> create(const Glib::ustring& text, const
Glib::RefPtr<Clutter::Actor>& actor), champlain_label_new_full)
_WRAP_METHOD(Pango::Alignment get_alignment() const, champlain_label_get_alignment)
_WRAP_METHOD(void set_alignment(Pango::Alignment alignment), champlain_label_set_alignment)
diff --git a/tools/m4/convert_clutter.m4 b/tools/m4/convert_clutter.m4
index 260352f..5a76cde 100644
--- a/tools/m4/convert_clutter.m4
+++ b/tools/m4/convert_clutter.m4
@@ -6,6 +6,7 @@ _CONVERSION(`const Glib::RefPtr<Clutter::Actor>&',`ClutterActor*',__CONVERT_REFP
# Color
_CONVERSION(`ClutterColor*', `Clutter::Color', `Clutter::Color($3, true)')
_CONVERSION(`const Clutter::Color&',`const ClutterColor*',__FR2P)
+_CONVERSION(`Clutter::Color',`ClutterColor*',__FR2P)
# Content
_CONVERSION(`const Glib::RefPtr<Clutter::Content>&',`ClutterContent*',__CONVERT_REFPTR_TO_P)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]