summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDodji Seketeli <dodji@src.gnome.org>2003-04-23 14:57:11 +0000
committerDodji Seketeli <dodji@src.gnome.org>2003-04-23 14:57:11 +0000
commita69162c29f53e62cabe09460230887fe9aa434f5 (patch)
tree0af01e8893c12a6e9a49204a30b515c8abf7c4d3
parentf18a6bed7d5f6e1ed5bde510a58efad6308daf7e (diff)
downloadlibcroco-a69162c29f53e62cabe09460230887fe9aa434f5.tar.gz
started to write the CRBoxView widget.
Dodji.
-rw-r--r--src/layeng/Makefile.am2
-rw-r--r--src/layeng/cr-box-view.c136
-rw-r--r--src/layeng/cr-box-view.h29
3 files changed, 160 insertions, 7 deletions
diff --git a/src/layeng/Makefile.am b/src/layeng/Makefile.am
index a856007..1897190 100644
--- a/src/layeng/Makefile.am
+++ b/src/layeng/Makefile.am
@@ -5,7 +5,7 @@ crlayenginc_HEADERS= *.h
#the layout engine files
if HAVE_LAYENG
-LAYENG_SRCS= cr-style.c cr-box.c cr-lay-eng.c
+LAYENG_SRCS= cr-style.c cr-box.c cr-box-view.c cr-lay-eng.c
endif
libcrlayeng_la_SOURCES=$(LAYENG_SRCS)
diff --git a/src/layeng/cr-box-view.c b/src/layeng/cr-box-view.c
new file mode 100644
index 0000000..38c13f9
--- /dev/null
+++ b/src/layeng/cr-box-view.c
@@ -0,0 +1,136 @@
+/* -*- Mode: C; indent-tabs-mode:nil; c-basic-offset: 8-*- */
+
+/*
+ * This file is part of The Croco Library
+ *
+ * Copyright (C) 2002-2003 Dodji Seketeli <dodji@seketeli.org>
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of version 2.1 of
+ * the GNU Lesser General Public
+ * License as published by the Free Software Foundation.
+ *
+ * This program 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 General Public License for more details.
+ *
+ * You should have received a copy of the
+ * GNU Lesser General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+ * USA
+ */
+
+/*
+ *$Id$
+ */
+
+#include "cr-box-view.h"
+
+#define PRIVATE(a_this) ((a_this)->priv)
+struct _CRBoxViewPriv
+{
+ CRBox *box ;
+} ;
+
+
+static GtkLayoutClass *gv_parent_class = NULL ;
+
+
+static void
+cr_box_view_class_init (CRBoxViewClass *a_klass) ;
+
+
+static void
+cr_box_view_init (CRBoxView *a_this) ;
+
+
+static void
+cr_box_view_class_init (CRBoxViewClass *a_klass)
+{
+ GObjectClass *gobject_class = G_OBJECT_CLASS (a_klass) ;
+ GtkObjectClass *gtk_object_class = GTK_OBJECT_CLASS (a_klass) ;
+
+ gv_parent_class = (GtkLayoutClass *)
+ g_type_class_peek_parent (gobject_class) ;
+
+ gtk_object_class->destroy = cr_box_view_destroy ;
+}
+
+static void
+cr_box_view_init (CRBoxView *a_this)
+{
+ g_return_if_fail (a_this) ;
+
+ PRIVATE (a_this) = g_try_malloc (sizeof (CRBoxView)) ;
+ if (!PRIVATE (a_this))
+ {
+ cr_utils_trace_info ("Out of memory") ;
+ return ;
+ }
+ memset (PRIVATE (a_this), 0, sizeof (CRBoxView)) ;
+}
+
+
+/**********************************
+ *Public funtions
+ **********************************/
+
+GType
+cr_box_view_get_type (void)
+{
+ static GType type = 0 ;
+
+ if (type == 0)
+ {
+ static const GTypeInfo type_info =
+ {
+ sizeof (CRBoxViewClass),
+ NULL,NULL,
+ (GClassInitFunc)cr_box_view_class_init,
+ NULL, NULL,
+ sizeof (CRBoxView),
+ 0,
+ (GInstanceInitFunc)cr_box_view_init
+ } ;
+
+ type = g_type_register_static (GTK_TYPE_LAYOUT,
+ "CRBoxView", &type_info, 0) ;
+ }
+
+ return type ;
+}
+
+CRBoxView *
+cr_box_view_new (void)
+{
+ CRBoxView *result = NULL ;
+
+ result = g_object_new (CR_TYPE_BOX_VIEW, NULL) ;
+
+ return result ;
+}
+
+
+void
+cr_box_view_destroy (GtkObject *a_this)
+{
+ CRBoxView *self = NULL ;
+
+ g_return_if_fail (a_this && CR_IS_BOX_VIEW (a_this)) ;
+
+ self = CR_BOX_VIEW (a_this) ;
+
+ if (PRIVATE (self))
+ {
+ g_free (PRIVATE (self)) ;
+ PRIVATE (self) = NULL ;
+ }
+
+ if (gv_parent_class
+ && GTK_OBJECT_CLASS (gv_parent_class)->destroy)
+ {
+ GTK_OBJECT_CLASS (gv_parent_class)->destroy (a_this) ;
+ }
+}
diff --git a/src/layeng/cr-box-view.h b/src/layeng/cr-box-view.h
index ddbb3f4..f1f8c05 100644
--- a/src/layeng/cr-box-view.h
+++ b/src/layeng/cr-box-view.h
@@ -35,27 +35,44 @@
G_BEGIN_DECLS
#define CR_TYPE_BOX_VIEW (cr_box_view_get_type ())
-#define CR_BOX_VIEW(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), CR_TYPE_BOX_VIEW, GtkLayout))
-#define CR_BOX_VIEW_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), CR_TYPE_BOX_VIEW, GtkLayoutClass))
+#define CR_BOX_VIEW(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), CR_TYPE_BOX_VIEW, CRBoxView))
+#define CR_BOX_VIEW_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), CR_TYPE_BOX_VIEW, CRBoxViewClass))
#define CR_IS_BOX_VIEW(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), CR_TYPE_BOX_VIEW))
#define CR_IS_BOX_VIEW_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), CR_TYPE_BOX_VIEW))
-#define CR_BOX_VIEW_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), CR_TYPE_BOX_VIEW, GtkLayoutClass))
+#define CR_BOX_VIEW_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), CR_TYPE_BOX_VIEW, CRBoxViewClass))
typedef struct _CRBoxView CRBoxView ;
typedef struct _CRBoxViewClass CRBoxViewClass ;
+typedef struct _CRBoxViewPriv CRBoxViewPriv ;
struct _CRBoxView
{
- GtkLayout view ;
- CRBox *box ;
+ GtkLayout parent ;
+ CRBoxViewPriv *priv ;
+
+ /**<public fields>*/
+ CRBoxView *children ;
+ CRBoxView *next ;
+ CRBoxView *prev ;
+
} ;
struct _CRBoxViewClass
{
GtkLayoutClass parent_class ;
-
} ;
+
+GType
+cr_box_view_get_type (void) ;
+
+CRBoxView *
+cr_box_view_new (void) ;
+
+void
+cr_box_view_destroy (GtkObject *a_this) ;
+
+
G_END_DECLS
#endif