r131 - in trunk/src/target/OM-2007: examples/openmoko-paned-demo libraries/mokoui
mickey at gta01.hmw-consulting.de
mickey at gta01.hmw-consulting.de
Fri Oct 27 01:23:55 CEST 2006
Author: mickey
Date: 2006-10-26 23:23:54 +0000 (Thu, 26 Oct 2006)
New Revision: 131
Added:
trunk/src/target/OM-2007/libraries/mokoui/moko-pixmap-button.c
trunk/src/target/OM-2007/libraries/mokoui/moko-pixmap-button.h
trunk/src/target/OM-2007/libraries/mokoui/moko-search-bar.c
trunk/src/target/OM-2007/libraries/mokoui/moko-search-bar.h
Modified:
trunk/src/target/OM-2007/examples/openmoko-paned-demo/demo-main.c
trunk/src/target/OM-2007/libraries/mokoui/moko-pixmap-container.c
trunk/src/target/OM-2007/libraries/mokoui/moko-toolbox.c
trunk/src/target/OM-2007/libraries/mokoui/moko-toolbox.h
trunk/src/target/OM-2007/libraries/mokoui/mokoui.pro
Log:
great progress w/ theming
Modified: trunk/src/target/OM-2007/examples/openmoko-paned-demo/demo-main.c
===================================================================
--- trunk/src/target/OM-2007/examples/openmoko-paned-demo/demo-main.c 2006-10-26 23:23:29 UTC (rev 130)
+++ trunk/src/target/OM-2007/examples/openmoko-paned-demo/demo-main.c 2006-10-26 23:23:54 UTC (rev 131)
@@ -77,6 +77,7 @@
GtkToolbar* toolbar = moko_tool_box_get_tool_bar(toolbox);
moko_paned_window_add_toolbox( window, toolbox );
+#if 0
GtkToolButton* tool_action1 = GTK_TOOL_BUTTON(gtk_tool_button_new( NULL, "action1" ));
gtk_toolbar_insert( GTK_TOOLBAR(toolbar), tool_action1, 1 );
@@ -97,7 +98,7 @@
GtkToolButton* tool_action4 = GTK_TOOL_BUTTON(gtk_tool_button_new( NULL, "action4" ));
gtk_toolbar_insert( GTK_TOOLBAR(toolbar), tool_action4, 4 );
-
+#endif
/* details area */
GtkButton* detailslist = gtk_button_new_with_label( "Hello Details Area!" );
moko_paned_window_set_lower_pane( window, GTK_WIDGET(detailslist) );
Added: trunk/src/target/OM-2007/libraries/mokoui/moko-pixmap-button.c
===================================================================
--- trunk/src/target/OM-2007/libraries/mokoui/moko-pixmap-button.c 2006-10-26 23:23:29 UTC (rev 130)
+++ trunk/src/target/OM-2007/libraries/mokoui/moko-pixmap-button.c 2006-10-26 23:23:54 UTC (rev 131)
@@ -0,0 +1,133 @@
+/* moko-pixmap-button.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-button.h"
+
+G_DEFINE_TYPE (MokoPixmapButton, moko_pixmap_button, GTK_TYPE_BUTTON);
+
+#define PIXMAP_BUTTON_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), MOKO_TYPE_PIXMAP_BUTTON, MokoPixmapButtonPrivate))
+#define CHILD_SPACING 1
+
+typedef struct _MokoPixmapButtonPrivate MokoPixmapButtonPrivate;
+
+struct _MokoPixmapButtonPrivate
+{
+};
+
+static void
+moko_pixmap_button_size_request (GtkWidget *widget, GtkRequisition *requisition);
+
+static void
+moko_pixmap_button_dispose (GObject *object)
+{
+ if (G_OBJECT_CLASS (moko_pixmap_button_parent_class)->dispose)
+ G_OBJECT_CLASS (moko_pixmap_button_parent_class)->dispose (object);
+}
+
+static void
+moko_pixmap_button_finalize (GObject *object)
+{
+ G_OBJECT_CLASS (moko_pixmap_button_parent_class)->finalize (object);
+}
+
+static void
+moko_pixmap_button_class_init (MokoPixmapButtonClass *klass)
+{
+ GObjectClass *object_class = G_OBJECT_CLASS (klass);
+ GtkWidgetClass *widget_class = GTK_WIDGET_CLASS(klass);
+
+ /* register private data */
+ g_type_class_add_private (klass, sizeof (MokoPixmapButtonPrivate));
+
+ /* hook virtual methods */
+ widget_class->size_request = moko_pixmap_button_size_request;
+
+ /* 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) );
+
+ object_class->dispose = moko_pixmap_button_dispose;
+ object_class->finalize = moko_pixmap_button_finalize;
+}
+
+static void
+moko_pixmap_button_init (MokoPixmapButton *self)
+{
+ g_debug( "moko_pixmap_button_init" );
+ gtk_button_set_focus_on_click( GTK_BUTTON(self), FALSE );
+}
+
+MokoPixmapButton*
+moko_pixmap_button_new (void)
+{
+ return g_object_new (MOKO_TYPE_PIXMAP_BUTTON, NULL);
+}
+
+static void
+moko_pixmap_button_size_request (GtkWidget *widget, GtkRequisition *requisition)
+{
+ g_debug( "moko_pixmap_button_size_request" );
+ GtkButton *button = GTK_BUTTON (widget);
+ GtkBorder default_border;
+ GtkBorder* size_request; // modified
+ gint focus_width;
+ gint focus_pad;
+
+ //gtk_button_get_props (button, &default_border, NULL, NULL);
+ gtk_widget_style_get (GTK_WIDGET (widget),
+ "focus-line-width", &focus_width,
+ "focus-padding", &focus_pad,
+ "size-request", &size_request, // modified
+ NULL);
+
+ if ( size_request && size_request->left + size_request->right + size_request->top + size_request->bottom ) // new fixed thing
+ {
+ g_debug( "moko_pixmap_button_size_request: style requested size = '%d x %d'", size_request->right, size_request->bottom );
+ requisition->width = size_request->right;
+ requisition->height = size_request->bottom;
+ }
+ else // old dynamic routine
+ {
+ requisition->width = (GTK_CONTAINER (widget)->border_width + CHILD_SPACING +
+ GTK_WIDGET (widget)->style->xthickness) * 2;
+ requisition->height = (GTK_CONTAINER (widget)->border_width + CHILD_SPACING +
+ GTK_WIDGET (widget)->style->ythickness) * 2;
+
+ if (GTK_WIDGET_CAN_DEFAULT (widget))
+ {
+ requisition->width += default_border.left + default_border.right;
+ requisition->height += default_border.top + default_border.bottom;
+ }
+
+ if (GTK_BIN (button)->child && GTK_WIDGET_VISIBLE (GTK_BIN (button)->child))
+ {
+ GtkRequisition child_requisition;
+
+ gtk_widget_size_request (GTK_BIN (button)->child, &child_requisition);
+
+ requisition->width += child_requisition.width;
+ requisition->height += child_requisition.height;
+ }
+
+ requisition->width += 2 * (focus_width + focus_pad);
+ requisition->height += 2 * (focus_width + focus_pad);
+ }
+}
Property changes on: trunk/src/target/OM-2007/libraries/mokoui/moko-pixmap-button.c
___________________________________________________________________
Name: svn:eol-style
+ native
Added: trunk/src/target/OM-2007/libraries/mokoui/moko-pixmap-button.h
===================================================================
--- trunk/src/target/OM-2007/libraries/mokoui/moko-pixmap-button.h 2006-10-26 23:23:29 UTC (rev 130)
+++ trunk/src/target/OM-2007/libraries/mokoui/moko-pixmap-button.h 2006-10-26 23:23:54 UTC (rev 131)
@@ -0,0 +1,49 @@
+/* moko-pixmap-button.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_BUTTON_H_
+#define _MOKO_PIXMAP_BUTTON_H_
+
+#include <gtk/gtkbutton.h>
+#include <glib-object.h>
+
+G_BEGIN_DECLS
+
+#define MOKO_TYPE_PIXMAP_BUTTON moko_pixmap_button_get_type()
+#define MOKO_PIXMAP_BUTTON(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), MOKO_TYPE_PIXMAP_BUTTON, MokoPixmapButton))
+#define MOKO_PIXMAP_BUTTON_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), MOKO_TYPE_PIXMAP_BUTTON, MokoPixmapButtonClass))
+#define MOKO_IS_PIXMAP_BUTTON(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), MOKO_TYPE_PIXMAP_BUTTON))
+#define MOKO_IS_PIXMAP_BUTTON_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), MOKO_TYPE_PIXMAP_BUTTON))
+#define MOKO_PIXMAP_BUTTON_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), MOKO_TYPE_PIXMAP_BUTTON, MokoPixmapButtonClass))
+
+typedef struct {
+ GtkButton parent;
+} MokoPixmapButton;
+
+typedef struct {
+ GtkButtonClass parent_class;
+} MokoPixmapButtonClass;
+
+GType moko_pixmap_button_get_type (void);
+
+MokoPixmapButton* moko_pixmap_button_new (void);
+
+G_END_DECLS
+
+#endif // _MOKO_PIXMAP_BUTTON_H_
+
Property changes on: trunk/src/target/OM-2007/libraries/mokoui/moko-pixmap-button.h
___________________________________________________________________
Name: svn:eol-style
+ native
Modified: trunk/src/target/OM-2007/libraries/mokoui/moko-pixmap-container.c
===================================================================
--- trunk/src/target/OM-2007/libraries/mokoui/moko-pixmap-container.c 2006-10-26 23:23:29 UTC (rev 130)
+++ trunk/src/target/OM-2007/libraries/mokoui/moko-pixmap-container.c 2006-10-26 23:23:54 UTC (rev 131)
@@ -31,10 +31,13 @@
static GtkFixedClass *parent_class = NULL;
-/* virtual methods */
-
+/* 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)
@@ -62,7 +65,9 @@
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(
@@ -79,7 +84,7 @@
}
static void
-moko_pixmap_container_init (MokoPixmapContainer *self)
+moko_pixmap_container_init(MokoPixmapContainer *self)
{
g_debug( "moko_pixmap_container_init" );
gtk_fixed_set_has_window( self, TRUE );
@@ -88,10 +93,46 @@
MokoPixmapContainer*
moko_pixmap_container_new (void)
{
- return g_object_new (MOKO_TYPE_PIXMAP_CONTAINER, NULL);
+ 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" );
@@ -118,7 +159,7 @@
children = children->next;
if ( cargo_border && cargo_border->left + cargo_border->right + cargo_border->top + cargo_border->bottom
- && !child->x && !child->y )
+ && 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 );
@@ -142,7 +183,7 @@
requisition->height += GTK_CONTAINER(fixed)->border_width * 2;
requisition->width += GTK_CONTAINER(fixed)->border_width * 2;
- if ( size_request->left + size_request->right + size_request->top + size_request->bottom )
+ 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 );
@@ -150,8 +191,65 @@
}
}
+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, 0, 0 );
+ gtk_fixed_put( GTK_FIXED(self), child, -1, -1 );
}
Added: trunk/src/target/OM-2007/libraries/mokoui/moko-search-bar.c
===================================================================
--- trunk/src/target/OM-2007/libraries/mokoui/moko-search-bar.c 2006-10-26 23:23:29 UTC (rev 130)
+++ trunk/src/target/OM-2007/libraries/mokoui/moko-search-bar.c 2006-10-26 23:23:54 UTC (rev 131)
@@ -0,0 +1,92 @@
+
+/* moko_search_bar.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-search-bar.h"
+#include <gtk/gtkalignment.h>
+#include <gtk/gtkentry.h>
+
+#define MOKO_SEARCH_BAR_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), MOKO_TYPE_SEARCH_BAR, MokoSearchBarPrivate))
+
+typedef struct _MokoSearchBarPrivate MokoSearchBarPrivate;
+
+struct _MokoSearchBarPrivate
+{
+ GtkAlignment* alignment;
+ GtkEntry* entry;
+};
+
+static void
+moko_search_bar_class_init (MokoSearchBarClass *klass);
+static void
+moko_search_bar_init (MokoSearchBar *self);
+
+
+GType moko_search_bar_get_type (void) /* Typechecking */
+{
+ static GType self_type = 0;
+
+ if (!self_type)
+ {
+ static const GTypeInfo f_info =
+ {
+ sizeof (MokoSearchBarClass),
+ NULL, /* base_init */
+ NULL, /* base_finalize */
+ (GClassInitFunc) moko_search_bar_class_init,
+ NULL, /* class_finalize */
+ NULL, /* class_data */
+ sizeof (MokoSearchBar),
+ 0,
+ (GInstanceInitFunc) moko_search_bar_init,
+ };
+
+ /* add the type of your parent class here */
+ self_type = g_type_register_static(GTK_TYPE_TOOLBAR, "MokoSearchBar", &f_info, 0);
+ }
+
+ return self_type;
+}
+
+static void
+moko_search_bar_class_init (MokoSearchBarClass *klass)
+{
+ GObjectClass *object_class = G_OBJECT_CLASS (klass);
+
+ g_type_class_add_private (klass, sizeof (MokoSearchBarPrivate));
+}
+
+static void
+moko_search_bar_init (MokoSearchBar *self)
+{
+ MokoSearchBarPrivate* priv = MOKO_SEARCH_BAR_GET_PRIVATE(self);
+ GtkToolItem* item = gtk_tool_item_new();
+ gtk_widget_set_size_request( GTK_WIDGET(item), 320, 10 ); //FIXME get from style
+ GtkEntry* entry = gtk_entry_new();
+ gtk_widget_set_name( GTK_WIDGET(entry), "moko_search_entry" );
+ gtk_entry_set_has_frame( entry, FALSE );
+ gtk_entry_set_text( GTK_ENTRY(entry), "foo" );
+ gtk_container_add( GTK_CONTAINER(item), GTK_WIDGET(entry) );
+ gtk_toolbar_insert( self, GTK_TOOL_ITEM(item), 0 );
+}
+
+MokoSearchBar*
+moko_search_bar_new (void)
+{
+ return GTK_WIDGET(g_object_new(moko_search_bar_get_type(), NULL));
+}
Property changes on: trunk/src/target/OM-2007/libraries/mokoui/moko-search-bar.c
___________________________________________________________________
Name: svn:eol-style
+ native
Added: trunk/src/target/OM-2007/libraries/mokoui/moko-search-bar.h
===================================================================
--- trunk/src/target/OM-2007/libraries/mokoui/moko-search-bar.h 2006-10-26 23:23:29 UTC (rev 130)
+++ trunk/src/target/OM-2007/libraries/mokoui/moko-search-bar.h 2006-10-26 23:23:54 UTC (rev 131)
@@ -0,0 +1,55 @@
+
+/* moko_search_bar.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_SEARCH_BAR_H_
+#define _MOKO_SEARCH_BAR_H_
+
+#include <glib-object.h>
+#include <gtk/gtktoolbar.h>
+
+G_BEGIN_DECLS
+
+#define MOKO_TYPE_SEARCH_BAR (moko_search_bar_get_type())
+
+#define MOKO_SEARCH_BAR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), MOKO_TYPE_SEARCH_BAR, MokoSearchBar))
+
+#define MOKO_SEARCH_BAR_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), MOKO_TYPE_SEARCH_BAR, MokoSearchBarClass))
+
+#define MOKO_IS_SEARCH_BAR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), MOKO_TYPE_SEARCH_BAR))
+
+#define MOKO_IS_SEARCH_BAR_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), MOKO_TYPE_SEARCH_BAR))
+
+#define MOKO_SEARCH_BAR_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), MOKO_TYPE_SEARCH_BAR, MokoSearchBarClass))
+
+typedef struct {
+ GtkToolbar parent;
+} MokoSearchBar;
+
+typedef struct {
+ GtkToolbarClass parent_class;
+} MokoSearchBarClass;
+
+GType moko_search_bar_get_type (void);
+
+MokoSearchBar* moko_search_bar_new (void);
+
+G_END_DECLS
+
+#endif // _MOKO_SEARCH_BAR_H_
+
Property changes on: trunk/src/target/OM-2007/libraries/mokoui/moko-search-bar.h
___________________________________________________________________
Name: svn:eol-style
+ native
Modified: trunk/src/target/OM-2007/libraries/mokoui/moko-toolbox.c
===================================================================
--- trunk/src/target/OM-2007/libraries/mokoui/moko-toolbox.c 2006-10-26 23:23:29 UTC (rev 130)
+++ trunk/src/target/OM-2007/libraries/mokoui/moko-toolbox.c 2006-10-26 23:23:54 UTC (rev 131)
@@ -17,17 +17,21 @@
* Current Version: $Rev$ ($Date$) [$Author$]
*/
#include "moko-toolbox.h"
-#include "moko-search-bar.h"
+#include "moko-pixmap-container.h"
+#include "moko-pixmap-button.h"
-#include <gtk/gtktoolbutton.h>
-#include <gtk/gtkimage.h>
+#include <gtk/gtkentry.h>
+#include <gtk/gtktoolbar.h>
+#include <gtk/gtkvbox.h>
#define MOKO_TOOL_BOX_GET_PRIVATE(obj) (G_TYPE_INSTANCE_GET_PRIVATE ((obj), MOKO_TYPE_TOOL_BOX, MokoToolBoxPriv));
typedef struct _MokoToolBoxPriv
{
+ MokoPixmapContainer* toolbar_page;
GtkToolbar* toolbar;
- MokoSearchBar* searchbar;
+ MokoPixmapContainer* searchbar_page;
+ GtkEntry* entry;
} MokoToolBoxPriv;
/* add your signals here */
@@ -61,7 +65,7 @@
};
/* add the type of your parent class here */
- self_type = g_type_register_static(GTK_TYPE_VBOX, "MokoToolBox", &self_info, 0);
+ self_type = g_type_register_static(GTK_TYPE_NOTEBOOK, "MokoToolBox", &self_info, 0);
}
return self_type;
@@ -83,40 +87,9 @@
static void moko_tool_box_init(MokoToolBox* self) /* Instance Construction */
{
- gboolean button_release(GtkWidget *widget, GdkEventButton *event, gpointer user_data)
- {
- g_assert( MOKO_IS_TOOL_BOX(widget) );
- MokoToolBoxPriv* priv = MOKO_TOOL_BOX_GET_PRIVATE(widget);
- static gboolean foo = FALSE;
- if ( foo )
- {
- gtk_widget_hide( GTK_WIDGET(priv->searchbar) );
- gtk_widget_show( GTK_WIDGET(priv->toolbar) );
- }
- else
- {
- gtk_widget_hide( GTK_WIDGET(priv->toolbar) );
- gtk_widget_show( GTK_WIDGET(priv->searchbar) );
- }
- g_debug( "hello world %d", foo );
- foo = !foo;
- return FALSE;
- }
-
- MokoToolBoxPriv* priv = MOKO_TOOL_BOX_GET_PRIVATE(self);
- priv->toolbar = gtk_toolbar_new();
- gtk_widget_set_name( GTK_WIDGET(priv->toolbar), "moko_toolbar1" );
- gtk_widget_set_size_request( GTK_WIDGET(priv->toolbar), 50, 52 ); //FIXME get from style
- gtk_box_pack_start( GTK_BOX(self), priv->toolbar, TRUE, TRUE, 0 );
-
- priv->searchbar = moko_search_bar_new();
- gtk_widget_set_name( GTK_WIDGET(priv->searchbar), "moko_toolbar2" );
- gtk_box_pack_start( GTK_BOX(self), priv->searchbar, TRUE, TRUE, 0 );
- gtk_widget_set_size_request( GTK_WIDGET(priv->searchbar), 50, 52 ); //FIXME get from style
-
- g_signal_connect( GTK_WIDGET(self), "button-release-event", G_CALLBACK(button_release), NULL );
-
- gtk_widget_set_no_show_all( GTK_WIDGET(priv->searchbar), TRUE );
+ g_debug( "moko_tool_box_init" );
+ gtk_notebook_set_show_border( GTK_NOTEBOOK(self), FALSE );
+ gtk_notebook_set_show_tabs( GTK_NOTEBOOK(self), FALSE );
}
GtkWidget* moko_tool_box_new() /* Construction */
@@ -126,10 +99,44 @@
GtkWidget* moko_tool_box_new_with_search()
{
- MokoToolBox* toolbox = g_object_new(moko_tool_box_get_type(), NULL);
- g_assert( toolbox );
- moko_tool_box_add_search_button( toolbox );
- return GTK_WIDGET(toolbox);
+ void button_release(GtkWidget* w, MokoToolBox* self)
+ {
+ static int current_page = 1;
+ gtk_notebook_set_current_page( GTK_NOTEBOOK(self), current_page );
+ g_debug( "button_release: current_page is now: %d", current_page );
+ current_page = 1 - current_page;
+ }
+ MokoToolBox* self = MOKO_TOOL_BOX(moko_tool_box_new());
+ MokoToolBoxPriv* priv = MOKO_TOOL_BOX_GET_PRIVATE(self);
+
+ priv->toolbar_page = moko_pixmap_container_new();
+ gtk_widget_set_name( GTK_WIDGET(priv->toolbar_page), "mokotoolbox-normal-mode" );
+
+ MokoPixmapButton* search = moko_pixmap_button_new();
+ gtk_widget_set_name( GTK_WIDGET(search), "mokotoolbox-search-button" );
+ gtk_fixed_put( GTK_FIXED(priv->toolbar_page), search, 0, 0 );
+
+ gtk_notebook_append_page( GTK_NOTEBOOK(self), priv->toolbar_page, NULL );
+
+ g_signal_connect( G_OBJECT(search), "clicked", G_CALLBACK(button_release), self );
+
+ priv->searchbar_page = moko_pixmap_container_new();
+ gtk_widget_set_name( GTK_WIDGET(priv->searchbar_page), "mokotoolbox-search-mode" );
+ gtk_notebook_append_page( GTK_NOTEBOOK(self), priv->searchbar_page, NULL );
+
+ MokoPixmapButton* back = moko_pixmap_button_new();
+ gtk_widget_set_name( GTK_WIDGET(back), "mokotoolbox-back-button" );
+#warning NEED TO GET FROM STYLE
+ gtk_fixed_put( GTK_FIXED(priv->searchbar_page), back, 400, 0 );
+ g_signal_connect( G_OBJECT(back), "clicked", G_CALLBACK(button_release), self );
+
+ GtkEntry* entry = gtk_entry_new();
+ gtk_entry_set_has_frame( entry, FALSE );
+ gtk_entry_set_inner_border( entry, FALSE );
+ gtk_widget_set_name( GTK_WIDGET(entry), "mokotoolbox-search-entry" );
+ moko_pixmap_container_set_cargo( priv->searchbar_page, GTK_WIDGET(entry) );
+
+ return GTK_WIDGET(self);
}
void moko_tool_box_clear(MokoToolBox* self) /* Destruction */
@@ -141,12 +148,14 @@
void moko_tool_box_add_search_button(MokoToolBox* self )
{
+#if 0
MokoToolBoxPriv* priv = MOKO_TOOL_BOX_GET_PRIVATE(self);
GtkToolButton* tool_search = GTK_TOOL_BUTTON(gtk_tool_button_new( NULL, "" ));
GtkImage* icon = gtk_image_new_from_file( "/local/pkg/openmoko/OM-2007/artwork/themes/openmoko-standard/gtk-2.0/openmoko-search-button.png" );
gtk_tool_button_set_icon_widget( tool_search, icon );
gtk_widget_set_name( GTK_WIDGET(tool_search), "moko_search_button" );
gtk_toolbar_insert( priv->toolbar, tool_search, 0 );
+#endif
}
GtkToolbar* moko_tool_box_get_tool_bar(MokoToolBox* self)
Modified: trunk/src/target/OM-2007/libraries/mokoui/moko-toolbox.h
===================================================================
--- trunk/src/target/OM-2007/libraries/mokoui/moko-toolbox.h 2006-10-26 23:23:29 UTC (rev 130)
+++ trunk/src/target/OM-2007/libraries/mokoui/moko-toolbox.h 2006-10-26 23:23:54 UTC (rev 131)
@@ -21,7 +21,7 @@
#include <glib.h>
#include <glib-object.h>
-#include <gtk/gtkvbox.h>
+#include <gtk/gtknotebook.h>
#include <gtk/gtktoolbar.h>
G_BEGIN_DECLS
@@ -37,14 +37,14 @@
struct _MokoToolBox
{
- GtkVBox parent;
+ GtkNotebook parent;
/* add pointers to new members here */
};
struct _MokoToolBoxClass
{
/* add your parent class here */
- GtkVBoxClass parent_class;
+ GtkNotebookClass parent_class;
void (*moko_tool_box) (MokoToolBox *self);
};
Modified: trunk/src/target/OM-2007/libraries/mokoui/mokoui.pro
===================================================================
--- trunk/src/target/OM-2007/libraries/mokoui/mokoui.pro 2006-10-26 23:23:29 UTC (rev 130)
+++ trunk/src/target/OM-2007/libraries/mokoui/mokoui.pro 2006-10-26 23:23:54 UTC (rev 131)
@@ -2,7 +2,8 @@
VERSION = 0.0.1
HEADERS = \
- moko-pixmap-container.h \
+ moko-pixmap-container.h \
+ moko-pixmap-button.h \
moko-application.h \
moko-window.h \
moko-finger-window.h \
@@ -12,6 +13,7 @@
moko-search-bar.h
SOURCES = \
moko-pixmap-container.c \
+ moko-pixmap-button.c \
moko-application.c \
moko-window.c \
moko-finger-window.c \
More information about the commitlog
mailing list