[cluttermm] Added Canvas.
- From: Murray Cumming <murrayc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [cluttermm] Added Canvas.
- Date: Thu, 10 Apr 2014 07:30:02 +0000 (UTC)
commit 42436d7201753ec27008b3ceebfaac5ff42338a1
Author: Ian Martin <martin_id vodafone co nz>
Date: Thu Apr 10 09:12:22 2014 +0200
Added Canvas.
* codegen/extradefs/generate_extra_defs_clutter.cc:
Add CLUTTER_TYPE_CANVAS.
* clutter/src/clutter_signals.defs: Regenerate
and change CairoContext to cairo_t.
* clutter/src/canvas.[hg|ccg]:
* clutter/src/filelist.am: Add the Canvas class.
* codegen/m4/convert_clutter.m4: Add a conversion.
* clutter/clutterm.h: Include canvas.h.
This commit is based on the patch here:
https://bugzilla.gnome.org/show_bug.cgi?id=725125#c10
clutter/cluttermm.h | 1 +
clutter/src/canvas.ccg | 32 ++++++++++
clutter/src/canvas.hg | 52 +++++++++++++++++
clutter/src/clutter_signals.defs | 67 +++++++++++++++++++---
clutter/src/filelist.am | 3 +-
codegen/extradefs/generate_extra_defs_clutter.cc | 1 +
codegen/m4/convert_clutter.m4 | 2 +
7 files changed, 148 insertions(+), 10 deletions(-)
---
diff --git a/clutter/cluttermm.h b/clutter/cluttermm.h
index 57efa4b..60cc407 100644
--- a/clutter/cluttermm.h
+++ b/clutter/cluttermm.h
@@ -77,6 +77,7 @@
#include <cluttermm/blur-effect.h>
#include <cluttermm/brightness-contrast-effect.h>
#include <cluttermm/cairo-texture.h>
+#include <cluttermm/canvas.h>
#include <cluttermm/childmeta.h>
#include <cluttermm/clone.h>
#include <cluttermm/color.h>
diff --git a/clutter/src/canvas.ccg b/clutter/src/canvas.ccg
new file mode 100644
index 0000000..c5c1ad0
--- /dev/null
+++ b/clutter/src/canvas.ccg
@@ -0,0 +1,32 @@
+/* Copyright (C) 2014 The cluttermm Development Team
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free
+ * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+
+#include <clutter/clutter.h>
+#include <cairomm/cairomm.h>
+
+namespace Clutter
+{
+
+//TODO IM: Can't get the cairo_t to wrap... partly because clutter uses a
+//CairoContext in some places, it seems.
+
+//~ bool draw(const ::Cairo::RefPtr< ::Cairo::Context>&, int width, int height)
+//~ {
+//~
+
+
+} //namespace Clutter
diff --git a/clutter/src/canvas.hg b/clutter/src/canvas.hg
new file mode 100644
index 0000000..34abb50
--- /dev/null
+++ b/clutter/src/canvas.hg
@@ -0,0 +1,52 @@
+/* Copyright (C) 2007 The cluttermm Development Team
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free
+ * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+
+#include <glibmm/object.h>
+#include <cluttermm/content.h>
+#include <cairomm/cairomm.h>
+#include <cairo/cairo.h>
+
+_DEFS(cluttermm,clutter)
+_PINCLUDE(glibmm/private/object_p.h)
+
+
+namespace Clutter
+{
+
+
+class Canvas : public Glib::Object
+{
+ _CLASS_GOBJECT(Canvas, ClutterCanvas, CLUTTER_CANVAS, Glib::Object, GObject)
+ _IMPLEMENTS_INTERFACE(Content)
+
+protected:
+ _CTOR_DEFAULT()
+
+public:
+ _WRAP_CREATE()
+
+#m4 _CONVERSION(`cairo_t*',`const ::Cairo::RefPtr< ::Cairo::Context>&',`::Cairo::RefPtr<
::Cairo::Context>(new ::Cairo::Context($3, false /* has_reference */))')
+ _WRAP_SIGNAL(bool draw(const ::Cairo::RefPtr< ::Cairo::Context>&, int width, int height), "draw")
+
+ _WRAP_METHOD(void set_size(int width, int height), clutter_canvas_set_size)
+
+protected:
+ _WRAP_PROPERTY("height", int)
+ _WRAP_PROPERTY("width", int)
+};
+
+ }//namespace Clutter
diff --git a/clutter/src/clutter_signals.defs b/clutter/src/clutter_signals.defs
index e1677bb..728b09a 100644
--- a/clutter/src/clutter_signals.defs
+++ b/clutter/src/clutter_signals.defs
@@ -1570,22 +1570,22 @@
;; From ClutterCairoTexture
-(define-signal create-surface
+(define-signal draw
(of-object "ClutterCairoTexture")
- (return-type "CairoSurface*")
+ (return-type "gboolean")
(when "last")
(parameters
- '("guint" "p0")
- '("guint" "p1")
+ '("cairo_t*" "p0")
)
)
-(define-signal draw
+(define-signal create-surface
(of-object "ClutterCairoTexture")
- (return-type "gboolean")
+ (return-type "CairoSurface*")
(when "last")
(parameters
- '("CairoContext*" "p0")
+ '("guint" "p0")
+ '("guint" "p1")
)
)
@@ -1616,6 +1616,55 @@
(construct-only #f)
)
+;; From ClutterCanvas
+
+(define-signal draw
+ (of-object "ClutterCanvas")
+ (return-type "gboolean")
+ (when "last")
+ (parameters
+ '("cairo_t*" "p0")
+ '("gint" "p1")
+ '("gint" "p2")
+ )
+)
+
+(define-property width
+ (of-object "ClutterCanvas")
+ (prop-type "GParamInt")
+ (docs "The width of the canvas")
+ (readable #t)
+ (writable #t)
+ (construct-only #f)
+)
+
+(define-property height
+ (of-object "ClutterCanvas")
+ (prop-type "GParamInt")
+ (docs "The height of the canvas")
+ (readable #t)
+ (writable #t)
+ (construct-only #f)
+)
+
+(define-property scale-factor
+ (of-object "ClutterCanvas")
+ (prop-type "GParamInt")
+ (docs "The scaling factor for the surface")
+ (readable #t)
+ (writable #t)
+ (construct-only #f)
+)
+
+(define-property scale-factor-set
+ (of-object "ClutterCanvas")
+ (prop-type "GParamBoolean")
+ (docs "Whether the scale-factor property is set")
+ (readable #t)
+ (writable #f)
+ (construct-only #f)
+)
+
;; From ClutterChildMeta
(define-property container
@@ -1647,7 +1696,7 @@
(construct-only #f)
)
-;; From ClutterColor
+;; ClutterColor is neither a GObject nor a GInterface. Not checked for signals and properties.
;; From ClutterConstraint
@@ -1732,7 +1781,7 @@
;; From ClutterEffect
-;; From ClutterEvent
+;; ClutterEvent is neither a GObject nor a GInterface. Not checked for signals and properties.
;; From ClutterFixedLayout
diff --git a/clutter/src/filelist.am b/clutter/src/filelist.am
index 3be077e..ba2dcba 100644
--- a/clutter/src/filelist.am
+++ b/clutter/src/filelist.am
@@ -29,12 +29,13 @@ files_hg = \
behaviour-rotate.hg \
behaviour-scale.hg \
bin-layout.hg \
- bind-constraint.hg \
+ bind-constraint.hg \
box.hg \
box-layout.hg \
blur-effect.hg \
brightness-contrast-effect.hg \
cairo-texture.hg \
+ canvas.hg \
childmeta.hg \
clone.hg \
color.hg \
diff --git a/codegen/extradefs/generate_extra_defs_clutter.cc
b/codegen/extradefs/generate_extra_defs_clutter.cc
index ac264c2..272df7f 100644
--- a/codegen/extradefs/generate_extra_defs_clutter.cc
+++ b/codegen/extradefs/generate_extra_defs_clutter.cc
@@ -55,6 +55,7 @@ int main(int argc, char** argv)
<< get_defs(CLUTTER_TYPE_BOX)
<< get_defs(CLUTTER_TYPE_BOX_LAYOUT)
<< get_defs(CLUTTER_TYPE_CAIRO_TEXTURE)
+ << get_defs(CLUTTER_TYPE_CANVAS)
<< get_defs(CLUTTER_TYPE_CHILD_META)
<< get_defs(CLUTTER_TYPE_CLONE)
<< get_defs(CLUTTER_TYPE_COLOR)
diff --git a/codegen/m4/convert_clutter.m4 b/codegen/m4/convert_clutter.m4
index a1bf039..872af9b 100644
--- a/codegen/m4/convert_clutter.m4
+++ b/codegen/m4/convert_clutter.m4
@@ -209,3 +209,5 @@ _CONVERSION(`BinAlignment&',`ClutterBinAlignment*',`(($2) &($3))')
_CONVERSION(`BoxAlignment&',`ClutterBoxAlignment*',`(($2) &($3))')
_CONVERSION(`PangoContext*',`Glib::RefPtr<const Pango::Context>',Glib::wrap($3))
+
+_CONVERSION(`const ::Cairo::RefPtr< ::Cairo::Context>&', `cairo_t*', `($3)->cobj()')
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]