r221 - in trunk/src/target/OM-2007: artwork/themes/openmoko-standard/gtk-2.0 examples/openmoko-finger-demo openmoko-libs/libmokoui
mickey at gta01.hmw-consulting.de
mickey at gta01.hmw-consulting.de
Mon Nov 13 19:46:52 CET 2006
Author: mickey
Date: 2006-11-13 18:46:51 +0000 (Mon, 13 Nov 2006)
New Revision: 221
Added:
trunk/src/target/OM-2007/openmoko-libs/libmokoui/moko-fixed.c
trunk/src/target/OM-2007/openmoko-libs/libmokoui/moko-fixed.h
Removed:
trunk/src/target/OM-2007/openmoko-libs/libmokoui/moko-pixmap-container.c
trunk/src/target/OM-2007/openmoko-libs/libmokoui/moko-pixmap-container.h
Modified:
trunk/src/target/OM-2007/artwork/themes/openmoko-standard/gtk-2.0/mokotoolbox
trunk/src/target/OM-2007/artwork/themes/openmoko-standard/gtk-2.0/mokotreeview
trunk/src/target/OM-2007/examples/openmoko-finger-demo/demo-main.c
trunk/src/target/OM-2007/openmoko-libs/libmokoui/Makefile.am
trunk/src/target/OM-2007/openmoko-libs/libmokoui/libmokoui.pro
trunk/src/target/OM-2007/openmoko-libs/libmokoui/moko-alignment.c
trunk/src/target/OM-2007/openmoko-libs/libmokoui/moko-tool-box.c
Log:
mokoui: change MokoPixmapContainer to MokoFixed. Sorry I had to break API, but this is for better consistency, since the parent class is named
GtkFixed
Modified: trunk/src/target/OM-2007/artwork/themes/openmoko-standard/gtk-2.0/mokotoolbox
===================================================================
--- trunk/src/target/OM-2007/artwork/themes/openmoko-standard/gtk-2.0/mokotoolbox 2006-11-13 18:03:45 UTC (rev 220)
+++ trunk/src/target/OM-2007/artwork/themes/openmoko-standard/gtk-2.0/mokotoolbox 2006-11-13 18:46:51 UTC (rev 221)
@@ -1,14 +1,14 @@
style "mokotoolbox-normal-mode" {
bg_pixmap[NORMAL] = "openmoko-mokotoolbox-normal-mode-background.png"
- MokoPixmapContainer::size-request = { 0, 480, 0, 52 }
- MokoPixmapContainer::cargo-border = { 80, 480, 0, 52 }
+ MokoFixed::size-request = { 0, 480, 0, 52 }
+ MokoFixed::cargo-border = { 80, 480, 0, 52 }
}
widget "*.mokotoolbox-normal-mode" style "mokotoolbox-normal-mode"
style "mokotoolbox-search-mode" {
bg_pixmap[NORMAL] = "openmoko-mokotoolbox-search-mode-background.png"
- MokoPixmapContainer::size-request = { 0, 480, 0, 52 }
- MokoPixmapContainer::cargo-border = { 36, 340, 17, 40 }
+ MokoFixed::size-request = { 0, 480, 0, 52 }
+ MokoFixed::cargo-border = { 36, 340, 17, 40 }
}
widget "*.mokotoolbox-search-mode" style "mokotoolbox-search-mode"
Modified: trunk/src/target/OM-2007/artwork/themes/openmoko-standard/gtk-2.0/mokotreeview
===================================================================
--- trunk/src/target/OM-2007/artwork/themes/openmoko-standard/gtk-2.0/mokotreeview 2006-11-13 18:03:45 UTC (rev 220)
+++ trunk/src/target/OM-2007/artwork/themes/openmoko-standard/gtk-2.0/mokotreeview 2006-11-13 18:46:51 UTC (rev 221)
@@ -36,6 +36,8 @@
}
}
GtkButton::focus-line-width = 0
+ xthickness = 0
+ ythickness = 5
}
widget_class "*.MokoTreeView.GtkButton" style "mokotreeview-button"
Modified: trunk/src/target/OM-2007/examples/openmoko-finger-demo/demo-main.c
===================================================================
--- trunk/src/target/OM-2007/examples/openmoko-finger-demo/demo-main.c 2006-11-13 18:03:45 UTC (rev 220)
+++ trunk/src/target/OM-2007/examples/openmoko-finger-demo/demo-main.c 2006-11-13 18:46:51 UTC (rev 221)
@@ -19,7 +19,7 @@
#include <libmokoui/moko-application.h>
#include <libmokoui/moko-finger-window.h>
-#include <libmokoui/moko-pixmap-container.h>
+#include <libmokoui/moko-finger-wheel.h>
#include <gtk/gtkalignment.h>
#include <gtk/gtkbutton.h>
@@ -40,6 +40,17 @@
void cb_orange_button_clicked( GtkButton* button, MokoFingerWindow* window )
{
g_debug( "openmoko-finger-demo: orange button clicked" );
+ static gboolean show = TRUE;
+ static MokoFingerWheel* wheel = NULL;
+
+ if (!wheel) wheel = moko_finger_wheel_new();
+
+ if ( show )
+ gtk_widget_show( GTK_WIDGET(wheel) );
+ else
+ gtk_widget_hide( GTK_WIDGET(wheel) );
+
+ show = !show;
}
int main( int argc, char** argv )
Modified: trunk/src/target/OM-2007/openmoko-libs/libmokoui/Makefile.am
===================================================================
--- trunk/src/target/OM-2007/openmoko-libs/libmokoui/Makefile.am 2006-11-13 18:03:45 UTC (rev 220)
+++ trunk/src/target/OM-2007/openmoko-libs/libmokoui/Makefile.am 2006-11-13 18:46:51 UTC (rev 221)
@@ -3,8 +3,8 @@
moko-application.h \
moko-finger-wheel.h \
moko-finger-window.h \
+ moko-fixed.h
moko-menu-box.h \
- moko-pixmap-container.h \
moko-pixmap-button.h \
moko-paned-window.h \
moko-search-bar.h \
@@ -17,8 +17,8 @@
moko-application.c \
moko-finger-wheel.c \
moko-finger-window.c \
+ moko-fixed.c
moko-menu-box.c \
- moko-pixmap-container.c \
moko-pixmap-button.c \
moko-paned-window.c \
moko-search-bar.c \
Modified: trunk/src/target/OM-2007/openmoko-libs/libmokoui/libmokoui.pro
===================================================================
--- trunk/src/target/OM-2007/openmoko-libs/libmokoui/libmokoui.pro 2006-11-13 18:03:45 UTC (rev 220)
+++ trunk/src/target/OM-2007/openmoko-libs/libmokoui/libmokoui.pro 2006-11-13 18:46:51 UTC (rev 221)
@@ -7,8 +7,8 @@
moko-application.h \
moko-finger-wheel.h \
moko-finger-window.h \
+ moko-fixed.h \
moko-menu-box.h \
- moko-pixmap-container.h \
moko-pixmap-button.h \
moko-paned-window.h \
moko-search-bar.h \
@@ -21,8 +21,8 @@
moko-application.c \
moko-finger-wheel.c \
moko-finger-window.c \
+ moko-fixed.c \
moko-menu-box.c \
- moko-pixmap-container.c \
moko-pixmap-button.c \
moko-paned-window.c \
moko-search-bar.c \
Modified: trunk/src/target/OM-2007/openmoko-libs/libmokoui/moko-alignment.c
===================================================================
--- trunk/src/target/OM-2007/openmoko-libs/libmokoui/moko-alignment.c 2006-11-13 18:03:45 UTC (rev 220)
+++ trunk/src/target/OM-2007/openmoko-libs/libmokoui/moko-alignment.c 2006-11-13 18:46:51 UTC (rev 221)
@@ -19,7 +19,7 @@
#include "moko-alignment.h"
-G_DEFINE_TYPE (MokoAlignment, moko_alignment, GTK_TYPE_ALIGNMENT);
+G_DEFINE_TYPE (MokoAlignment, moko_alignment, GTK_TYPE_ALIGNMENT)
#define MOKO_ALIGNMENT_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), MOKO_TYPE_ALIGNMENT, MokoAlignmentPrivate))
Copied: trunk/src/target/OM-2007/openmoko-libs/libmokoui/moko-fixed.c (from rev 218, trunk/src/target/OM-2007/openmoko-libs/libmokoui/moko-pixmap-container.c)
===================================================================
--- trunk/src/target/OM-2007/openmoko-libs/libmokoui/moko-pixmap-container.c 2006-11-13 15:09:20 UTC (rev 218)
+++ trunk/src/target/OM-2007/openmoko-libs/libmokoui/moko-fixed.c 2006-11-13 18:46:51 UTC (rev 221)
@@ -0,0 +1,255 @@
+
+/* moko_fixed.c
+ *
+ * Authored By Michael 'Mickey' Lauer <mlauer at vanille-media.de>
+ *
+ * Copyright (C) 2006 Vanille-Media
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU 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 Public License for more details.
+ *
+ * Current Version: $Rev$ ($Date: 2006/10/05 17:38:14 $) [$Author: mickey $]
+ */
+
+#include "moko-fixed.h"
+
+G_DEFINE_TYPE (MokoFixed, moko_fixed, GTK_TYPE_FIXED);
+
+#define PIXMAP_CONTAINER_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), MOKO_TYPE_FIXED, MokoFixedPrivate))
+
+typedef struct _MokoFixedPrivate MokoFixedPrivate;
+
+struct _MokoFixedPrivate
+{
+};
+
+static GtkFixedClass *parent_class = NULL;
+
+/* declare virtual methods */
+static void
+moko_fixed_realize(GtkWidget *widget);
+static void
+moko_fixed_size_request(GtkWidget *widget, GtkRequisition *requisition);
+static void
+moko_fixed_size_allocate(GtkWidget *widget, GtkAllocation *allocation);
+
+static void
+moko_fixed_dispose (GObject *object)
+{
+ if (G_OBJECT_CLASS (moko_fixed_parent_class)->dispose)
+ G_OBJECT_CLASS (moko_fixed_parent_class)->dispose (object);
+}
+
+static void
+moko_fixed_finalize (GObject *object)
+{
+ G_OBJECT_CLASS (moko_fixed_parent_class)->finalize (object);
+}
+
+static void
+moko_fixed_class_init (MokoFixedClass *klass)
+{
+ GObjectClass *object_class = G_OBJECT_CLASS(klass);
+ GtkWidgetClass *widget_class = GTK_WIDGET_CLASS(klass);
+
+ /* get pointer to parent */
+ parent_class = g_type_class_peek_parent(klass);
+
+ /* add private data */
+ g_type_class_add_private (klass, sizeof (MokoFixedPrivate));
+
+ /* hook virtual methods */
+ widget_class->realize = moko_fixed_realize;
+ widget_class->size_request = moko_fixed_size_request;
+ widget_class->size_allocate = moko_fixed_size_allocate;
+
+ /* install properties */
+ gtk_widget_class_install_style_property( widget_class, g_param_spec_boxed(
+ "size-request",
+ "Size Request",
+ "Sets the widget size request to a fixed value",
+ GTK_TYPE_BORDER, G_PARAM_READABLE) );
+
+ gtk_widget_class_install_style_property( widget_class, g_param_spec_boxed(
+ "cargo-border",
+ "Cargo Border",
+ "Position and Size of the cargo element",
+ GTK_TYPE_BORDER, G_PARAM_READABLE) );
+}
+
+static void
+moko_fixed_init(MokoFixed *self)
+{
+ g_debug( "moko_fixed_init" );
+ gtk_fixed_set_has_window( self, TRUE );
+}
+
+MokoFixed*
+moko_fixed_new (void)
+{
+ return g_object_new(MOKO_TYPE_FIXED, NULL);
+}
+
+static void
+moko_fixed_realize(GtkWidget *widget)
+{
+ g_debug( "moko_fixed_realize" );
+
+ GdkWindowAttr attributes;
+ gint attributes_mask;
+
+ if (GTK_WIDGET_NO_WINDOW (widget))
+ GTK_WIDGET_CLASS (parent_class)->realize (widget);
+ else
+ {
+ GTK_WIDGET_SET_FLAGS (widget, GTK_REALIZED);
+
+ attributes.window_type = GDK_WINDOW_CHILD;
+ attributes.x = widget->allocation.x;
+ attributes.y = widget->allocation.y;
+ attributes.width = widget->allocation.width;
+ attributes.height = widget->allocation.height;
+ attributes.wclass = GDK_INPUT_OUTPUT;
+ attributes.visual = gtk_widget_get_visual (widget);
+ attributes.colormap = gtk_widget_get_colormap (widget);
+ attributes.event_mask = gtk_widget_get_events (widget);
+ attributes.event_mask |= GDK_EXPOSURE_MASK | GDK_BUTTON_PRESS_MASK;
+
+ attributes_mask = GDK_WA_X | GDK_WA_Y | GDK_WA_VISUAL | GDK_WA_COLORMAP;
+
+ widget->window = gdk_window_new (gtk_widget_get_parent_window (widget), &attributes,
+ attributes_mask);
+ gdk_window_set_user_data (widget->window, widget);
+
+ widget->style = gtk_style_attach (widget->style, widget->window);
+ gtk_style_set_background (widget->style, widget->window, GTK_STATE_NORMAL);
+ }
+}
+
+static void
+moko_fixed_size_request(GtkWidget *widget, GtkRequisition *requisition)
+{
+ g_debug( "moko_fixed_size_request" );
+
+ GtkBorder* size_request;
+ GtkBorder* cargo_border;
+ gtk_widget_style_get(widget, "size-request", &size_request,
+ "cargo-border", &cargo_border, NULL );
+
+
+ GtkFixed *fixed;
+ GtkFixedChild *child;
+ GList *children;
+ GtkRequisition child_requisition;
+
+ fixed = GTK_FIXED (widget);
+ requisition->width = 0;
+ requisition->height = 0;
+
+ children = fixed->children;
+ while (children)
+ {
+ child = children->data;
+ children = children->next;
+
+ if ( cargo_border && cargo_border->left + cargo_border->right + cargo_border->top + cargo_border->bottom
+ && child->x == -1 && child->y == -1 )
+ {
+ g_warning( "moko_fixed_set_cargo: style requested cargo = '%d, %d x %d, %d'", size_request->left, size_request->top, size_request->right, size_request->bottom );
+ gtk_widget_set_size_request( child->widget, cargo_border->right - cargo_border->left, cargo_border->bottom - cargo_border->top );
+ child->x = cargo_border->left;
+ child->y = cargo_border->top;
+ }
+
+ if (GTK_WIDGET_VISIBLE(child->widget))
+ {
+ gtk_widget_size_request(child->widget, &child_requisition);
+
+ requisition->height = MAX (requisition->height,
+ child->y +
+ child_requisition.height);
+ requisition->width = MAX (requisition->width,
+ child->x +
+ child_requisition.width);
+ }
+ }
+
+ requisition->height += GTK_CONTAINER(fixed)->border_width * 2;
+ requisition->width += GTK_CONTAINER(fixed)->border_width * 2;
+
+ if ( size_request && size_request->left + size_request->right + size_request->top + size_request->bottom )
+ {
+ g_warning( "moko_fixed_size_request: style requested size = '%d x %d'", size_request->right, size_request->bottom );
+ requisition->height = MAX( requisition->height, size_request->bottom );
+ requisition->width = MAX( requisition->height, size_request->right );
+ }
+}
+
+static void
+moko_fixed_size_allocate (GtkWidget *widget, GtkAllocation *allocation)
+{
+ g_debug( "moko_fixed_size_allocate" );
+ GtkFixed *fixed;
+ GtkFixedChild *child;
+ GtkAllocation child_allocation;
+ GtkRequisition child_requisition;
+ GList *children;
+ guint16 border_width;
+
+ fixed = GTK_FIXED (widget);
+
+ widget->allocation = *allocation;
+
+ g_debug( "widget allocation is: %d %d, %d %d", allocation->x,
+ allocation->y,
+ allocation->width,
+ allocation->height);
+
+ if (!GTK_WIDGET_NO_WINDOW (widget))
+ {
+ if (GTK_WIDGET_REALIZED (widget))
+ gdk_window_move_resize (widget->window,
+ allocation->x,
+ allocation->y,
+ allocation->width,
+ allocation->height);
+ }
+
+ border_width = GTK_CONTAINER (fixed)->border_width;
+
+ children = fixed->children;
+ while (children)
+ {
+ child = children->data;
+ children = children->next;
+
+ if (GTK_WIDGET_VISIBLE (child->widget))
+ {
+ gtk_widget_get_child_requisition (child->widget, &child_requisition);
+ child_allocation.x = child->x + border_width;
+ child_allocation.y = child->y + border_width;
+
+ if (GTK_WIDGET_NO_WINDOW (widget))
+ {
+ child_allocation.x += widget->allocation.x;
+ child_allocation.y += widget->allocation.y;
+ }
+
+ child_allocation.width = child_requisition.width;
+ child_allocation.height = child_requisition.height;
+ gtk_widget_size_allocate (child->widget, &child_allocation);
+ }
+ }
+}
+
+void
+moko_fixed_set_cargo(MokoFixed* self, GtkWidget* child)
+{
+ gtk_fixed_put( GTK_FIXED(self), child, -1, -1 );
+}
Copied: trunk/src/target/OM-2007/openmoko-libs/libmokoui/moko-fixed.h (from rev 218, trunk/src/target/OM-2007/openmoko-libs/libmokoui/moko-pixmap-container.h)
===================================================================
--- trunk/src/target/OM-2007/openmoko-libs/libmokoui/moko-pixmap-container.h 2006-11-13 15:09:20 UTC (rev 218)
+++ trunk/src/target/OM-2007/openmoko-libs/libmokoui/moko-fixed.h 2006-11-13 18:46:51 UTC (rev 221)
@@ -0,0 +1,57 @@
+
+/* moko_fixed.h
+ *
+ * Authored By Michael 'Mickey' Lauer <mlauer at vanille-media.de>
+ *
+ * Copyright (C) 2006 Vanille-Media
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU 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 Public License for more details.
+ *
+ * Current Version: $Rev$ ($Date: 2006/10/05 17:38:14 $) [$Author: mickey $]
+ */
+
+#ifndef _MOKO_FIXED_H_
+#define _MOKO_FIXED_H_
+
+#include <gtk/gtkfixed.h>
+#include <glib-object.h>
+
+G_BEGIN_DECLS
+
+#define MOKO_TYPE_FIXED moko_fixed_get_type()
+
+#define MOKO_FIXED(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), MOKO_TYPE_FIXED, MokoFixed))
+
+#define MOKO_FIXED_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), MOKO_TYPE_FIXED, MokoFixedClass))
+
+#define MOKO_IS_FIXED(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), MOKO_TYPE_FIXED))
+
+#define MOKO_IS_FIXED_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), MOKO_TYPE_FIXED))
+
+#define MOKO_FIXED_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), MOKO_TYPE_FIXED, MokoFixedClass))
+
+typedef struct {
+ GtkFixed parent;
+} MokoFixed;
+
+typedef struct {
+ GtkFixedClass parent_class;
+} MokoFixedClass;
+
+GType moko_fixed_get_type (void);
+
+MokoFixed* moko_fixed_new (void);
+
+void moko_fixed_set_cargo(MokoFixed* self, GtkWidget* child);
+
+G_END_DECLS
+
+#endif // _MOKO_FIXED_H_
+
Deleted: trunk/src/target/OM-2007/openmoko-libs/libmokoui/moko-pixmap-container.c
===================================================================
--- trunk/src/target/OM-2007/openmoko-libs/libmokoui/moko-pixmap-container.c 2006-11-13 18:03:45 UTC (rev 220)
+++ trunk/src/target/OM-2007/openmoko-libs/libmokoui/moko-pixmap-container.c 2006-11-13 18:46:51 UTC (rev 221)
@@ -1,255 +0,0 @@
-
-/* moko_pixmap_container.c
- *
- * Authored By Michael 'Mickey' Lauer <mlauer at vanille-media.de>
- *
- * Copyright (C) 2006 Vanille-Media
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU 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 Public License for more details.
- *
- * Current Version: $Rev$ ($Date: 2006/10/05 17:38:14 $) [$Author: mickey $]
- */
-
-#include "moko-pixmap-container.h"
-
-G_DEFINE_TYPE (MokoPixmapContainer, moko_pixmap_container, GTK_TYPE_FIXED);
-
-#define PIXMAP_CONTAINER_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), MOKO_TYPE_PIXMAP_CONTAINER, MokoPixmapContainerPrivate))
-
-typedef struct _MokoPixmapContainerPrivate MokoPixmapContainerPrivate;
-
-struct _MokoPixmapContainerPrivate
-{
-};
-
-static GtkFixedClass *parent_class = NULL;
-
-/* declare virtual methods */
-static void
-moko_pixmap_container_realize(GtkWidget *widget);
-static void
-moko_pixmap_container_size_request(GtkWidget *widget, GtkRequisition *requisition);
-static void
-moko_pixmap_container_size_allocate(GtkWidget *widget, GtkAllocation *allocation);
-
-static void
-moko_pixmap_container_dispose (GObject *object)
-{
- if (G_OBJECT_CLASS (moko_pixmap_container_parent_class)->dispose)
- G_OBJECT_CLASS (moko_pixmap_container_parent_class)->dispose (object);
-}
-
-static void
-moko_pixmap_container_finalize (GObject *object)
-{
- G_OBJECT_CLASS (moko_pixmap_container_parent_class)->finalize (object);
-}
-
-static void
-moko_pixmap_container_class_init (MokoPixmapContainerClass *klass)
-{
- GObjectClass *object_class = G_OBJECT_CLASS(klass);
- GtkWidgetClass *widget_class = GTK_WIDGET_CLASS(klass);
-
- /* get pointer to parent */
- parent_class = g_type_class_peek_parent(klass);
-
- /* add private data */
- g_type_class_add_private (klass, sizeof (MokoPixmapContainerPrivate));
-
- /* hook virtual methods */
- widget_class->realize = moko_pixmap_container_realize;
- widget_class->size_request = moko_pixmap_container_size_request;
- widget_class->size_allocate = moko_pixmap_container_size_allocate;
-
- /* install properties */
- gtk_widget_class_install_style_property( widget_class, g_param_spec_boxed(
- "size-request",
- "Size Request",
- "Sets the widget size request to a fixed value",
- GTK_TYPE_BORDER, G_PARAM_READABLE) );
-
- gtk_widget_class_install_style_property( widget_class, g_param_spec_boxed(
- "cargo-border",
- "Cargo Border",
- "Position and Size of the cargo element",
- GTK_TYPE_BORDER, G_PARAM_READABLE) );
-}
-
-static void
-moko_pixmap_container_init(MokoPixmapContainer *self)
-{
- g_debug( "moko_pixmap_container_init" );
- gtk_fixed_set_has_window( self, TRUE );
-}
-
-MokoPixmapContainer*
-moko_pixmap_container_new (void)
-{
- return g_object_new(MOKO_TYPE_PIXMAP_CONTAINER, NULL);
-}
-
-static void
-moko_pixmap_container_realize(GtkWidget *widget)
-{
- g_debug( "moko_pixmap_container_realize" );
-
- GdkWindowAttr attributes;
- gint attributes_mask;
-
- if (GTK_WIDGET_NO_WINDOW (widget))
- GTK_WIDGET_CLASS (parent_class)->realize (widget);
- else
- {
- GTK_WIDGET_SET_FLAGS (widget, GTK_REALIZED);
-
- attributes.window_type = GDK_WINDOW_CHILD;
- attributes.x = widget->allocation.x;
- attributes.y = widget->allocation.y;
- attributes.width = widget->allocation.width;
- attributes.height = widget->allocation.height;
- attributes.wclass = GDK_INPUT_OUTPUT;
- attributes.visual = gtk_widget_get_visual (widget);
- attributes.colormap = gtk_widget_get_colormap (widget);
- attributes.event_mask = gtk_widget_get_events (widget);
- attributes.event_mask |= GDK_EXPOSURE_MASK | GDK_BUTTON_PRESS_MASK;
-
- attributes_mask = GDK_WA_X | GDK_WA_Y | GDK_WA_VISUAL | GDK_WA_COLORMAP;
-
- widget->window = gdk_window_new (gtk_widget_get_parent_window (widget), &attributes,
- attributes_mask);
- gdk_window_set_user_data (widget->window, widget);
-
- widget->style = gtk_style_attach (widget->style, widget->window);
- gtk_style_set_background (widget->style, widget->window, GTK_STATE_NORMAL);
- }
-}
-
-static void
-moko_pixmap_container_size_request(GtkWidget *widget, GtkRequisition *requisition)
-{
- g_debug( "moko_pixmap_container_size_request" );
-
- GtkBorder* size_request;
- GtkBorder* cargo_border;
- gtk_widget_style_get(widget, "size-request", &size_request,
- "cargo-border", &cargo_border, NULL );
-
-
- GtkFixed *fixed;
- GtkFixedChild *child;
- GList *children;
- GtkRequisition child_requisition;
-
- fixed = GTK_FIXED (widget);
- requisition->width = 0;
- requisition->height = 0;
-
- children = fixed->children;
- while (children)
- {
- child = children->data;
- children = children->next;
-
- if ( cargo_border && cargo_border->left + cargo_border->right + cargo_border->top + cargo_border->bottom
- && child->x == -1 && child->y == -1 )
- {
- g_warning( "moko_pixmap_container_set_cargo: style requested cargo = '%d, %d x %d, %d'", size_request->left, size_request->top, size_request->right, size_request->bottom );
- gtk_widget_set_size_request( child->widget, cargo_border->right - cargo_border->left, cargo_border->bottom - cargo_border->top );
- child->x = cargo_border->left;
- child->y = cargo_border->top;
- }
-
- if (GTK_WIDGET_VISIBLE(child->widget))
- {
- gtk_widget_size_request(child->widget, &child_requisition);
-
- requisition->height = MAX (requisition->height,
- child->y +
- child_requisition.height);
- requisition->width = MAX (requisition->width,
- child->x +
- child_requisition.width);
- }
- }
-
- requisition->height += GTK_CONTAINER(fixed)->border_width * 2;
- requisition->width += GTK_CONTAINER(fixed)->border_width * 2;
-
- if ( size_request && size_request->left + size_request->right + size_request->top + size_request->bottom )
- {
- g_warning( "moko_pixmap_container_size_request: style requested size = '%d x %d'", size_request->right, size_request->bottom );
- requisition->height = MAX( requisition->height, size_request->bottom );
- requisition->width = MAX( requisition->height, size_request->right );
- }
-}
-
-static void
-moko_pixmap_container_size_allocate (GtkWidget *widget, GtkAllocation *allocation)
-{
- g_debug( "moko_pixmap_container_size_allocate" );
- GtkFixed *fixed;
- GtkFixedChild *child;
- GtkAllocation child_allocation;
- GtkRequisition child_requisition;
- GList *children;
- guint16 border_width;
-
- fixed = GTK_FIXED (widget);
-
- widget->allocation = *allocation;
-
- g_debug( "widget allocation is: %d %d, %d %d", allocation->x,
- allocation->y,
- allocation->width,
- allocation->height);
-
- if (!GTK_WIDGET_NO_WINDOW (widget))
- {
- if (GTK_WIDGET_REALIZED (widget))
- gdk_window_move_resize (widget->window,
- allocation->x,
- allocation->y,
- allocation->width,
- allocation->height);
- }
-
- border_width = GTK_CONTAINER (fixed)->border_width;
-
- children = fixed->children;
- while (children)
- {
- child = children->data;
- children = children->next;
-
- if (GTK_WIDGET_VISIBLE (child->widget))
- {
- gtk_widget_get_child_requisition (child->widget, &child_requisition);
- child_allocation.x = child->x + border_width;
- child_allocation.y = child->y + border_width;
-
- if (GTK_WIDGET_NO_WINDOW (widget))
- {
- child_allocation.x += widget->allocation.x;
- child_allocation.y += widget->allocation.y;
- }
-
- child_allocation.width = child_requisition.width;
- child_allocation.height = child_requisition.height;
- gtk_widget_size_allocate (child->widget, &child_allocation);
- }
- }
-}
-
-void
-moko_pixmap_container_set_cargo(MokoPixmapContainer* self, GtkWidget* child)
-{
- gtk_fixed_put( GTK_FIXED(self), child, -1, -1 );
-}
Deleted: trunk/src/target/OM-2007/openmoko-libs/libmokoui/moko-pixmap-container.h
===================================================================
--- trunk/src/target/OM-2007/openmoko-libs/libmokoui/moko-pixmap-container.h 2006-11-13 18:03:45 UTC (rev 220)
+++ trunk/src/target/OM-2007/openmoko-libs/libmokoui/moko-pixmap-container.h 2006-11-13 18:46:51 UTC (rev 221)
@@ -1,57 +0,0 @@
-
-/* moko_pixmap_container.h
- *
- * Authored By Michael 'Mickey' Lauer <mlauer at vanille-media.de>
- *
- * Copyright (C) 2006 Vanille-Media
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU 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 Public License for more details.
- *
- * Current Version: $Rev$ ($Date: 2006/10/05 17:38:14 $) [$Author: mickey $]
- */
-
-#ifndef _MOKO_PIXMAP_CONTAINER_H_
-#define _MOKO_PIXMAP_CONTAINER_H_
-
-#include <gtk/gtkfixed.h>
-#include <glib-object.h>
-
-G_BEGIN_DECLS
-
-#define MOKO_TYPE_PIXMAP_CONTAINER moko_pixmap_container_get_type()
-
-#define MOKO_PIXMAP_CONTAINER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), MOKO_TYPE_PIXMAP_CONTAINER, MokoPixmapContainer))
-
-#define MOKO_PIXMAP_CONTAINER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), MOKO_TYPE_PIXMAP_CONTAINER, MokoPixmapContainerClass))
-
-#define MOKO_IS_PIXMAP_CONTAINER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), MOKO_TYPE_PIXMAP_CONTAINER))
-
-#define MOKO_IS_PIXMAP_CONTAINER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), MOKO_TYPE_PIXMAP_CONTAINER))
-
-#define MOKO_PIXMAP_CONTAINER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), MOKO_TYPE_PIXMAP_CONTAINER, MokoPixmapContainerClass))
-
-typedef struct {
- GtkFixed parent;
-} MokoPixmapContainer;
-
-typedef struct {
- GtkFixedClass parent_class;
-} MokoPixmapContainerClass;
-
-GType moko_pixmap_container_get_type (void);
-
-MokoPixmapContainer* moko_pixmap_container_new (void);
-
-void moko_pixmap_container_set_cargo(MokoPixmapContainer* self, GtkWidget* child);
-
-G_END_DECLS
-
-#endif // _MOKO_PIXMAP_CONTAINER_H_
-
Modified: trunk/src/target/OM-2007/openmoko-libs/libmokoui/moko-tool-box.c
===================================================================
--- trunk/src/target/OM-2007/openmoko-libs/libmokoui/moko-tool-box.c 2006-11-13 18:03:45 UTC (rev 220)
+++ trunk/src/target/OM-2007/openmoko-libs/libmokoui/moko-tool-box.c 2006-11-13 18:46:51 UTC (rev 221)
@@ -17,7 +17,7 @@
* Current Version: $Rev$ ($Date$) [$Author$]
*/
#include "moko-tool-box.h"
-#include "moko-pixmap-container.h"
+#include "moko-fixed.h"
#include <gtk/gtkentry.h>
#include <gtk/gtkvbox.h>
@@ -26,9 +26,9 @@
typedef struct _MokoToolBoxPriv
{
- MokoPixmapContainer* toolbar_page;
+ MokoFixed* toolbar_page;
GtkHBox* buttonbox;
- MokoPixmapContainer* searchbar_page;
+ MokoFixed* searchbar_page;
GtkEntry* entry;
} MokoToolBoxPriv;
@@ -116,7 +116,7 @@
MokoToolBox* self = MOKO_TOOL_BOX(g_object_new(MOKO_TYPE_TOOL_BOX, NULL));
MokoToolBoxPriv* priv = MOKO_TOOL_BOX_GET_PRIVATE(self);
- priv->toolbar_page = moko_pixmap_container_new();
+ priv->toolbar_page = moko_fixed_new();
gtk_widget_set_name( GTK_WIDGET(priv->toolbar_page), "mokotoolbox-normal-mode" );
priv->buttonbox = gtk_hbox_new( FALSE, 17 ); //FIXME need to get from style
gtk_fixed_put( GTK_FIXED(priv->toolbar_page), GTK_WIDGET(priv->buttonbox), 1, 7 ); //FIXME need to get from style
@@ -131,7 +131,7 @@
MokoToolBox* self = MOKO_TOOL_BOX(g_object_new(MOKO_TYPE_TOOL_BOX, NULL));
MokoToolBoxPriv* priv = MOKO_TOOL_BOX_GET_PRIVATE(self);
- priv->toolbar_page = moko_pixmap_container_new();
+ priv->toolbar_page = moko_fixed_new();
gtk_widget_set_name( GTK_WIDGET(priv->toolbar_page), "mokotoolbox-normal-mode" );
MokoPixmapButton* search = moko_pixmap_button_new();
@@ -144,7 +144,7 @@
g_signal_connect( G_OBJECT(search), "clicked", G_CALLBACK(_button_release), self );
- priv->searchbar_page = moko_pixmap_container_new();
+ priv->searchbar_page = moko_fixed_new();
gtk_widget_set_name( GTK_WIDGET(priv->searchbar_page), "mokotoolbox-search-mode" );
gtk_notebook_append_page( GTK_NOTEBOOK(self), priv->searchbar_page, NULL );
@@ -157,7 +157,7 @@
gtk_entry_set_has_frame( priv->entry, FALSE );
// gtk_entry_set_inner_border( priv->entry, FALSE );
gtk_widget_set_name( GTK_WIDGET(priv->entry), "mokotoolbox-search-entry" );
- moko_pixmap_container_set_cargo( priv->searchbar_page, GTK_WIDGET(priv->entry) );
+ moko_fixed_set_cargo( priv->searchbar_page, GTK_WIDGET(priv->entry) );
return GTK_WIDGET(self);
}
More information about the commitlog
mailing list