r58 - in trunk/src/target/OM-2007/libraries: . mokoui
mickey at gta01.hmw-consulting.de
mickey at gta01.hmw-consulting.de
Tue Sep 26 23:04:28 CEST 2006
Author: mickey
Date: 2006-09-26 21:04:27 +0000 (Tue, 26 Sep 2006)
New Revision: 58
Added:
trunk/src/target/OM-2007/libraries/mokoui/moko-application.c
trunk/src/target/OM-2007/libraries/mokoui/moko-application.h
trunk/src/target/OM-2007/libraries/mokoui/moko-menubar.c
trunk/src/target/OM-2007/libraries/mokoui/moko-menubar.h
trunk/src/target/OM-2007/libraries/mokoui/moko-window.c
trunk/src/target/OM-2007/libraries/mokoui/moko-window.h
Removed:
trunk/src/target/OM-2007/libraries/framework/
Log:
add first mokoui classes
Added: trunk/src/target/OM-2007/libraries/mokoui/moko-application.c
===================================================================
--- trunk/src/target/OM-2007/libraries/mokoui/moko-application.c 2006-09-26 14:55:15 UTC (rev 57)
+++ trunk/src/target/OM-2007/libraries/mokoui/moko-application.c 2006-09-26 21:04:27 UTC (rev 58)
@@ -0,0 +1,232 @@
+/*
+ * libmokoui -- OpenMoko Application Framework UI Library
+ *
+ * Authored By Michael 'Mickey' Lauer <mlauer at vanille-media.de>
+ *
+ * Copyright (C) 2006 First International Computer Inc.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser Public License as published by
+ * the Free Software Foundation; version 2.1 of the license.
+ *
+ * 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 Lesser Public License for more details.
+ *
+ * Current Version: $Rev$ ($Date$) [$Author$]
+ */
+#include "moko-application.h"
+
+#include <X11/Xlib.h>
+#include <X11/Xatom.h>
+#include <gdk/gdkx.h>
+
+#define MOKO_APPLICATION_GET_PRIVATE(obj) (G_TYPE_INSTANCE_GET_PRIVATE ((obj), MOKO_TYPE_APPLICATION, MokoApplicationPriv));
+
+typedef struct _MokoApplicationPriv
+{
+ gboolean killable;
+ gboolean is_topmost;
+ GdkWindow *group_leader;
+ guint window_count;
+ GtkWidget *common_application_menu;
+ GtkWidget *common_filter_menu;
+ GtkWidget *common_toolbar;
+ GSList *windows;
+ Window window_group;
+ gchar *name;
+} MokoApplicationPriv;
+
+enum
+{
+ PROP_0,
+ PROP_IS_TOPMOST,
+ PROP_KILLABLE
+};
+
+static void moko_application_class_init (MokoApplicationClass *self);
+static void moko_application_init (MokoApplication *self);
+static void moko_application_set_property (GObject * object, guint property_id, const GValue * value, GParamSpec * pspec);
+static void moko_application_get_property (GObject * object, guint property_id, GValue * value, GParamSpec * pspec);
+
+GType moko_application_get_type (void)
+{
+ static GType program_type = 0;
+
+ if (!program_type)
+ {
+ static const GTypeInfo program_info =
+ {
+ sizeof(MokoApplicationClass),
+ NULL, /* base_init */
+ NULL, /* base_finalize */
+ (GClassInitFunc) moko_application_class_init,
+ NULL, /* class_finalize */
+ NULL, /* class_data */
+ sizeof(MokoApplication),
+ 0, /* n_preallocs */
+ (GInstanceInitFunc) moko_application_init,
+ };
+ program_type = g_type_register_static(G_TYPE_OBJECT, "MokoApplication", &program_info, 0);
+ }
+ return program_type;
+}
+
+static void moko_application_init (MokoApplication *self)
+{
+ MokoApplicationPriv *priv = MOKO_APPLICATION_GET_PRIVATE (self);
+
+ priv->killable = FALSE;
+ priv->window_count = 0;
+ priv->is_topmost = FALSE;
+ priv->window_group = GDK_WINDOW_XID(gdk_display_get_default_group(gdk_display_get_default()));
+ priv->common_application_menu = NULL;
+ priv->common_toolbar = NULL;
+ priv->common_toolbar = NULL;
+ priv->name = NULL;
+}
+
+static void moko_application_finalize (GObject *self)
+{
+ MokoApplicationPriv *priv = MOKO_APPLICATION_GET_PRIVATE (MOKO_APPLICATION(self));
+
+ if (priv->common_toolbar)
+ {
+ g_object_unref (priv->common_toolbar);
+ priv->common_toolbar = NULL;
+ }
+
+ if (priv->common_application_menu)
+ {
+ g_object_unref (priv->common_application_menu);
+ priv->common_application_menu = NULL;
+ }
+
+ if (priv->common_filter_menu)
+ {
+ g_object_unref (priv->common_filter_menu);
+ priv->common_filter_menu = NULL;
+ }
+
+ g_free (priv->name);
+
+}
+
+static void moko_application_class_init (MokoApplicationClass *self)
+{
+ GObjectClass *object_class = G_OBJECT_CLASS(self);
+
+ g_type_class_add_private (self, sizeof(MokoApplicationPriv));
+
+ /* Set up object virtual functions */
+ object_class->finalize = moko_application_finalize;
+ object_class->set_property = moko_application_set_property;
+ object_class->get_property = moko_application_get_property;
+
+ /* Install properties */
+ g_object_class_install_property (object_class, PROP_IS_TOPMOST,
+ g_param_spec_boolean ("is-topmost",
+ "Is top-most",
+ "Whether one of the program's window or dialog currently "
+ "is activated by window manager",
+ FALSE,
+ G_PARAM_READABLE));
+
+ g_object_class_install_property (object_class, PROP_KILLABLE,
+ g_param_spec_boolean ("can-hibernate",
+ "Can hibernate",
+ "Whether the program should be set to hibernate by the Task "
+ "Navigator in low memory situation",
+ FALSE,
+ G_PARAM_READWRITE));
+ return;
+}
+
+
+static void moko_application_set_property (GObject * object, guint property_id, const GValue * value, GParamSpec * pspec)
+{
+ switch (property_id){
+ case PROP_KILLABLE:
+ g_warning( "NYI: moko_application_set_can_hibernate()" );
+ //moko_application_set_can_hibernate (MOKO_APPLICATION (object),
+ // g_value_get_boolean (value));
+ break;
+
+ default:
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+ break;
+ }
+
+}
+
+static void moko_application_get_property (GObject * object, guint property_id, GValue * value, GParamSpec * pspec)
+{
+ MokoApplicationPriv *priv = MOKO_APPLICATION_GET_PRIVATE (object);
+
+ switch (property_id)
+ {
+ case PROP_KILLABLE:
+ g_value_set_boolean (value, priv->killable);
+ break;
+ case PROP_IS_TOPMOST:
+ g_value_set_boolean (value, priv->is_topmost);
+ break;
+ default:
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+ break;
+ }
+
+}
+
+/* Event filter */
+
+/*
+ * We keep track of the _MB_CURRENT_APP_WINDOW property on the root window,
+ * to detect when a window belonging to this program was is_topmost. This
+ * is based on the window group WM hint.
+ */
+static GdkFilterReturn moko_application_root_window_event_filter(
+ GdkXEvent *xevent,
+ GdkEvent *event,
+ gpointer data)
+{
+ XAnyEvent *eventti = xevent;
+ MokoApplication *program = MOKO_APPLICATION (data);
+ Atom active_app_atom =
+ XInternAtom (GDK_DISPLAY (), "_MB_CURRENT_APP_WINDOW", False);
+
+ if (eventti->type == PropertyNotify)
+ {
+ XPropertyEvent *pevent = xevent;
+
+ if (pevent->atom == active_app_atom)
+ {
+ g_warning( "NYI: moko_application_update_top_most(program)" );
+ //moko_application_update_top_most( program );
+ }
+ }
+
+ return GDK_FILTER_CONTINUE;
+}
+
+/* Public methods */
+
+/**
+ * moko_application_get_instance:
+ *
+ * Return value: Returns the #MokoApplication for the current process.
+ * The object is created on the first call.
+ **/
+MokoApplication* moko_application_get_instance (void)
+{
+ static MokoApplication *program = NULL;
+
+ if (!program)
+ {
+ program = g_object_new (MOKO_TYPE_APPLICATION, NULL);
+ }
+
+ return program;
+}
+
Property changes on: trunk/src/target/OM-2007/libraries/mokoui/moko-application.c
___________________________________________________________________
Name: svn:eol-style
+ native
Added: trunk/src/target/OM-2007/libraries/mokoui/moko-application.h
===================================================================
--- trunk/src/target/OM-2007/libraries/mokoui/moko-application.h 2006-09-26 14:55:15 UTC (rev 57)
+++ trunk/src/target/OM-2007/libraries/mokoui/moko-application.h 2006-09-26 21:04:27 UTC (rev 58)
@@ -0,0 +1,58 @@
+/*
+ * libmokoui -- OpenMoko Application Framework UI Library
+ *
+ * Authored By Michael 'Mickey' Lauer <mlauer at vanille-media.de>
+ *
+ * Copyright (C) 2006 First International Computer Inc.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser Public License as published by
+ * the Free Software Foundation; version 2.1 of the license.
+ *
+ * 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 Lesser Public License for more details.
+ *
+ * Current Version: $Rev$ ($Date$) [$Author$]
+ */
+
+#ifndef _MOKO_APPLICATION_H_
+#define _MOKO_APPLICATION_H_
+
+#include <glib-object.h>
+#include <gtk/gtkmenu.h>
+#include <gtk/gtktoolbar.h>
+//#include "hildon-window.h"
+
+G_BEGIN_DECLS
+
+#define MOKO_TYPE_APPLICATION (moko_application_get_type())
+#define MOKO_APPLICATION(obj) (G_TYPE_CHECK_INSTANCE_CAST (obj, MOKO_TYPE_APPLICATION, MokoApplication))
+#define MOKO_IS_APPLICATION(obj) (G_TYPE_CHECK_INSTANCE_TYPE (obj, MOKO_TYPE_APPLICATION))
+
+typedef struct _MokoApplication
+{
+ GObject parent;
+} MokoApplication;
+
+typedef struct _MokoApplicationClass
+{
+ GObjectClass parent;
+
+ /* Padding for future extension */
+ void (*_moko_reserved1)(void);
+ void (*_moko_reserved2)(void);
+ void (*_moko_reserved3)(void);
+ void (*_moko_reserved4)(void);
+} MokoApplicationClass;
+
+GType moko_application_get_type (void);
+
+/* Public methods */
+MokoApplication* moko_application_get_instance(void);
+
+gboolean moko_application_get_is_topmost (MokoApplication* self);
+
+G_END_DECLS
+#endif /* _MOKO_APPLICATION_H_ */
Property changes on: trunk/src/target/OM-2007/libraries/mokoui/moko-application.h
___________________________________________________________________
Name: svn:eol-style
+ native
Added: trunk/src/target/OM-2007/libraries/mokoui/moko-menubar.c
===================================================================
--- trunk/src/target/OM-2007/libraries/mokoui/moko-menubar.c 2006-09-26 14:55:15 UTC (rev 57)
+++ trunk/src/target/OM-2007/libraries/mokoui/moko-menubar.c 2006-09-26 21:04:27 UTC (rev 58)
@@ -0,0 +1,85 @@
+/*
+ * libmokoui -- OpenMoko Application Framework UI Library
+ *
+ * Authored By Michael 'Mickey' Lauer <mlauer at vanille-media.de>
+ *
+ * Copyright (C) 2006 First International Computer Inc.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser Public License as published by
+ * the Free Software Foundation; version 2.1 of the license.
+ *
+ * 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 Lesser Public License for more details.
+ *
+ * Current Version: $Rev$ ($Date$) [$Author$]
+ */
+#include "moko-menubar.h"
+
+/* add your signals here */
+enum {
+ MYOBJECT_SIGNAL,
+ LAST_SIGNAL
+};
+
+static void moko_menu_bar_class_init (MokoMenuBarClass *klass);
+static void moko_menu_bar_init (MokoMenuBar *f);
+
+static guint moko_menu_bar_signals[LAST_SIGNAL] = { 0 };
+
+GType moko_menu_bar_get_type (void) /* Typechecking */
+{
+ static GType self_type = 0;
+
+ if (!self_type)
+ {
+ static const GTypeInfo f_info =
+ {
+ sizeof (MokoMenuBarClass),
+ NULL, /* base_init */
+ NULL, /* base_finalize */
+ (GClassInitFunc) moko_menu_bar_class_init,
+ NULL, /* class_finalize */
+ NULL, /* class_data */
+ sizeof (MokoMenuBar),
+ 0,
+ (GInstanceInitFunc) moko_menu_bar_init,
+ };
+
+ /* add the type of your parent class here */
+ self_type = g_type_register_static(GTK_TYPE_MENU_BAR, "MokoMenuBar", &f_info, 0);
+ }
+
+ return self_type;
+}
+
+static void moko_menu_bar_class_init (MokoMenuBarClass *klass) /* Class Initialization */
+{
+ moko_menu_bar_signals[MYOBJECT_SIGNAL] = g_signal_new ("moko_menu_bar",
+ G_TYPE_FROM_CLASS (klass),
+ G_SIGNAL_RUN_FIRST | G_SIGNAL_ACTION,
+ G_STRUCT_OFFSET (MokoMenuBarClass, moko_menu_bar),
+ NULL,
+ NULL,
+ g_cclosure_marshal_VOID__VOID,
+ G_TYPE_NONE, 0);
+}
+
+static void moko_menu_bar_init (MokoMenuBar *f) /* Instance Construction */
+{
+ /* populate your widget here */
+}
+
+GtkWidget* moko_menu_bar_new() /* Construction */
+{
+ return GTK_WIDGET(g_object_new(moko_menu_bar_get_type(), NULL));
+}
+
+void moko_menu_bar_clear(MokoMenuBar *f) /* Destruction */
+{
+ /* destruct your widgets here */
+}
+
+/* add new methods here */
\ No newline at end of file
Property changes on: trunk/src/target/OM-2007/libraries/mokoui/moko-menubar.c
___________________________________________________________________
Name: svn:eol-style
+ native
Added: trunk/src/target/OM-2007/libraries/mokoui/moko-menubar.h
===================================================================
--- trunk/src/target/OM-2007/libraries/mokoui/moko-menubar.h 2006-09-26 14:55:15 UTC (rev 57)
+++ trunk/src/target/OM-2007/libraries/mokoui/moko-menubar.h 2006-09-26 21:04:27 UTC (rev 58)
@@ -0,0 +1,58 @@
+/*
+ * libmokoui -- OpenMoko Application Framework UI Library
+ *
+ * Authored By Michael 'Mickey' Lauer <mlauer at vanille-media.de>
+ *
+ * Copyright (C) 2006 First International Computer Inc.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser Public License as published by
+ * the Free Software Foundation; version 2.1 of the license.
+ *
+ * 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 Lesser Public License for more details.
+ *
+ * Current Version: $Rev$ ($Date$) [$Author$]
+ */
+#ifndef _MOKO_MENUBAR_H_
+#define _MOKO_MENUBAR_H_
+
+#include <glib.h>
+#include <glib-object.h>
+#include <gtk/gtkmenubar.h>
+
+G_BEGIN_DECLS
+
+#define MENUBAR_TYPE (moko_menu_bar_get_type())
+#define MENUBAR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), MENUBAR_TYPE, MokoMenuBar))
+#define MENUBAR_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), MENUBAR_TYPE, MokoMenuBarClass))
+#define IS_MENUBAR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), MENUBAR_TYPE))
+#define IS_MENUBAR_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), MENUBAR_TYPE))
+
+typedef struct _MokoMenuBar MokoMenuBar;
+typedef struct _MokoMenuBarClass MokoMenuBarClass;
+
+struct _MokoMenuBar
+{
+ GtkMenuBar parent;
+ /* add pointers to new members here */
+};
+
+struct _MokoMenuBarClass
+{
+ /* add your parent class here */
+ GtkMenuBarClass parent_class;
+ void (*moko_menu_bar) (MokoMenuBar *self);
+};
+
+GType moko_menu_bar_get_type (void);
+GtkWidget* moko_menu_bar_new (void);
+void moko_menu_bar_clera (MokoMenuBar *self);
+
+/* add additional methods here */
+
+G_END_DECLS
+
+#endif /* _MOKO_MENUBAR_H_ */
Property changes on: trunk/src/target/OM-2007/libraries/mokoui/moko-menubar.h
___________________________________________________________________
Name: svn:eol-style
+ native
Added: trunk/src/target/OM-2007/libraries/mokoui/moko-window.c
===================================================================
--- trunk/src/target/OM-2007/libraries/mokoui/moko-window.c 2006-09-26 14:55:15 UTC (rev 57)
+++ trunk/src/target/OM-2007/libraries/mokoui/moko-window.c 2006-09-26 21:04:27 UTC (rev 58)
@@ -0,0 +1,85 @@
+/*
+ * libmokoui -- OpenMoko Application Framework UI Library
+ *
+ * Authored By Michael 'Mickey' Lauer <mlauer at vanille-media.de>
+ *
+ * Copyright (C) 2006 First International Computer Inc.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser Public License as published by
+ * the Free Software Foundation; version 2.1 of the license.
+ *
+ * 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 Lesser Public License for more details.
+ *
+ * Current Version: $Rev$ ($Date$) [$Author$]
+ */
+#include "moko-window.h"
+
+/* add your signals here */
+enum {
+ MOKO_WINDOW_SIGNAL,
+ LAST_SIGNAL
+};
+
+static void moko_window_class_init (MokoWindowClass *klass);
+static void moko_window_init (MokoWindow *self);
+
+static guint moko_window_signals[LAST_SIGNAL] = { 0 };
+
+GType moko_window_get_type (void) /* Typechecking */
+{
+ static GType self_type = 0;
+
+ if (!self_type)
+ {
+ static const GTypeInfo f_info =
+ {
+ sizeof (MokoWindowClass),
+ NULL, /* base_init */
+ NULL, /* base_finalize */
+ (GClassInitFunc) moko_window_class_init,
+ NULL, /* class_finalize */
+ NULL, /* class_data */
+ sizeof (MokoWindow),
+ 0,
+ (GInstanceInitFunc) moko_window_init,
+ };
+
+ /* add the type of your parent class here */
+ self_type = g_type_register_static(GTK_TYPE_WINDOW, "MokoWindow", &f_info, 0);
+ }
+
+ return self_type;
+}
+
+static void moko_window_class_init (MokoWindowClass *klass) /* Class Initialization */
+{
+ moko_window_signals[MOKO_WINDOW_SIGNAL] = g_signal_new ("moko_window",
+ G_TYPE_FROM_CLASS (klass),
+ G_SIGNAL_RUN_FIRST | G_SIGNAL_ACTION,
+ G_STRUCT_OFFSET (MokoWindowClass, moko_window),
+ NULL,
+ NULL,
+ g_cclosure_marshal_VOID__VOID,
+ G_TYPE_NONE, 0);
+}
+
+static void moko_window_init (MokoWindow *self) /* Instance Construction */
+{
+ /* populate your widget here */
+}
+
+GtkWidget* moko_window_new() /* Construction */
+{
+ return GTK_WIDGET(g_object_new(moko_window_get_type(), NULL));
+}
+
+void moko_window_clear(MokoWindow *self) /* Destruction */
+{
+ /* destruct your widgets here */
+}
+
+/* add new methods here */
Property changes on: trunk/src/target/OM-2007/libraries/mokoui/moko-window.c
___________________________________________________________________
Name: svn:eol-style
+ native
Added: trunk/src/target/OM-2007/libraries/mokoui/moko-window.h
===================================================================
--- trunk/src/target/OM-2007/libraries/mokoui/moko-window.h 2006-09-26 14:55:15 UTC (rev 57)
+++ trunk/src/target/OM-2007/libraries/mokoui/moko-window.h 2006-09-26 21:04:27 UTC (rev 58)
@@ -0,0 +1,59 @@
+/*
+ * libmokoui -- OpenMoko Application Framework UI Library
+ *
+ * Authored By Michael 'Mickey' Lauer <mlauer at vanille-media.de>
+ *
+ * Copyright (C) 2006 First International Computer Inc.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser Public License as published by
+ * the Free Software Foundation; version 2.1 of the license.
+ *
+ * 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 Lesser Public License for more details.
+ *
+ * Current Version: $Rev$ ($Date$) [$Author$]
+ */
+#ifndef _MOKO_WINDOW_H_
+#define _MOKO_WINDOW_H_
+
+#include <glib.h>
+#include <glib-object.h>
+#include <gtk/gtkwindow.h>
+
+G_BEGIN_DECLS
+
+#define MOKO_WINDOW_TYPE (moko_window_get_type())
+#define MOKO_WINDOW(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), MOKO_WINDOW_TYPE, MokoWindow))
+#define MOKO_WINDOW_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), MOKO_WINDOW_TYPE, MokoWindowClass))
+#define IS_MOKO_WINDOW(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), MOKO_WINDOW_TYPE))
+#define IS_MOKO_WINDOW_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), MOKO_WINDOW_TYPE))
+
+typedef struct _MokoWindow MokoWindow;
+typedef struct _MokoWindowClass MokoWindowClass;
+
+struct _MokoWindow
+{
+ GtkWindow parent;
+ /* add pointers to new members here */
+
+};
+
+struct _MokoWindowClass
+{
+ /* add your parent class here */
+ GtkWindowClass parent_class;
+ void (*moko_window) (MokoWindow *self);
+};
+
+GType moko_window_get_type (void);
+GtkWidget* moko_window_new (void);
+void moko_window_clear (MokoWindow *self);
+
+/* add additional methods here */
+
+G_END_DECLS
+
+#endif /* _MOKO_WINDOW_H_ */
Property changes on: trunk/src/target/OM-2007/libraries/mokoui/moko-window.h
___________________________________________________________________
Name: svn:eol-style
+ native
More information about the commitlog
mailing list