r195 - in trunk/src/target/OM-2007: applications/openmoko-chordmaster artwork/themes/openmoko-standard/gtk-2.0 examples/openmoko-paned-demo libraries/mokoui
mickey at gta01.hmw-consulting.de
mickey at gta01.hmw-consulting.de
Sun Nov 12 10:56:23 CET 2006
Author: mickey
Date: 2006-11-12 09:56:21 +0000 (Sun, 12 Nov 2006)
New Revision: 195
Added:
trunk/src/target/OM-2007/artwork/themes/openmoko-standard/gtk-2.0/gtkwidget.png
trunk/src/target/OM-2007/libraries/mokoui/moko-menu-box.c
trunk/src/target/OM-2007/libraries/mokoui/moko-menu-box.h
trunk/src/target/OM-2007/libraries/mokoui/moko-tool-box.c
trunk/src/target/OM-2007/libraries/mokoui/moko-tool-box.h
Removed:
trunk/src/target/OM-2007/libraries/mokoui/moko-menubox.c
trunk/src/target/OM-2007/libraries/mokoui/moko-menubox.h
trunk/src/target/OM-2007/libraries/mokoui/moko-toolbox.c
trunk/src/target/OM-2007/libraries/mokoui/moko-toolbox.h
Modified:
trunk/src/target/OM-2007/applications/openmoko-chordmaster/callbacks.h
trunk/src/target/OM-2007/applications/openmoko-chordmaster/main.c
trunk/src/target/OM-2007/applications/openmoko-chordmaster/main.h
trunk/src/target/OM-2007/artwork/themes/openmoko-standard/gtk-2.0/gtkrc
trunk/src/target/OM-2007/artwork/themes/openmoko-standard/gtk-2.0/gtktreeview
trunk/src/target/OM-2007/artwork/themes/openmoko-standard/gtk-2.0/openmoko-shadow-in.png
trunk/src/target/OM-2007/examples/openmoko-paned-demo/demo-main.c
trunk/src/target/OM-2007/libraries/mokoui/moko-paned-window.c
trunk/src/target/OM-2007/libraries/mokoui/moko-paned-window.h
trunk/src/target/OM-2007/libraries/mokoui/mokoui.pro
Log:
mokoui: change filenames for consistency
Modified: trunk/src/target/OM-2007/applications/openmoko-chordmaster/callbacks.h
===================================================================
--- trunk/src/target/OM-2007/applications/openmoko-chordmaster/callbacks.h 2006-11-11 13:37:31 UTC (rev 194)
+++ trunk/src/target/OM-2007/applications/openmoko-chordmaster/callbacks.h 2006-11-12 09:56:21 UTC (rev 195)
@@ -3,7 +3,7 @@
#include "main.h"
-#include <mokoui/moko-toolbox.h>
+#include <mokoui/moko-tool-box.h>
#include <gtk/gtkbutton.h>
#include <gtk/gtkwidget.h>
Modified: trunk/src/target/OM-2007/applications/openmoko-chordmaster/main.c
===================================================================
--- trunk/src/target/OM-2007/applications/openmoko-chordmaster/main.c 2006-11-11 13:37:31 UTC (rev 194)
+++ trunk/src/target/OM-2007/applications/openmoko-chordmaster/main.c 2006-11-12 09:56:21 UTC (rev 195)
@@ -24,7 +24,7 @@
#include <mokoui/moko-application.h>
#include <mokoui/moko-paned-window.h>
-#include <mokoui/moko-toolbox.h>
+#include <mokoui/moko-tool-box.h>
#include <gtk/gtkbutton.h>
#include <gtk/gtklabel.h>
Modified: trunk/src/target/OM-2007/applications/openmoko-chordmaster/main.h
===================================================================
--- trunk/src/target/OM-2007/applications/openmoko-chordmaster/main.h 2006-11-11 13:37:31 UTC (rev 194)
+++ trunk/src/target/OM-2007/applications/openmoko-chordmaster/main.h 2006-11-12 09:56:21 UTC (rev 195)
@@ -25,7 +25,7 @@
#include <mokoui/moko-application.h>
#include <mokoui/moko-paned-window.h>
-#include <mokoui/moko-toolbox.h>
+#include <mokoui/moko-tool-box.h>
#include <gtk/gtkliststore.h>
#include <gtk/gtktreeview.h>
Modified: trunk/src/target/OM-2007/artwork/themes/openmoko-standard/gtk-2.0/gtkrc
===================================================================
--- trunk/src/target/OM-2007/artwork/themes/openmoko-standard/gtk-2.0/gtkrc 2006-11-11 13:37:31 UTC (rev 194)
+++ trunk/src/target/OM-2007/artwork/themes/openmoko-standard/gtk-2.0/gtkrc 2006-11-12 09:56:21 UTC (rev 195)
@@ -3,12 +3,6 @@
# NOTE bg_pixmap[NORMAL] _must_ match with the SHADOW pixmaps
bg_pixmap[NORMAL] = "gtkwidget.png"
- fg[NORMAL] = "#e5e5e5" # very dark brown
- fg[PRELIGHT] = "#ff0000" # very dark brown
- fg[ACTIVE] = "#e5e5e5" # very dark brown
- fg[SELECTED] = "#0000ff" # very dark brown
- fg[INSENSITIVE] = "#00ff00" # grey
-
bg[NORMAL] = "#ff0000" # beige
bg[PRELIGHT] = "#ff0000" # light beige
bg[ACTIVE] = "#ff0000" # dark beige
@@ -21,11 +15,17 @@
base[SELECTED] = "#ff0000" # olive
base[INSENSITIVE] = "#ff0000" # beige
- text[NORMAL] = "#e5e5e5" # black
- text[PRELIGHT] = "#ff0000" # black
- text[ACTIVE] = "#e5e5e5" # white
- text[SELECTED] = "#0000ff" # white
- text[INSENSITIVE] = "#00ff00" # very dark brown
+ fg[NORMAL] = "#d3d3d3" # light grey
+ fg[PRELIGHT] = "#ffffff" # white
+ fg[ACTIVE] = "#e5e5e5" # light grey
+ fg[SELECTED] = "#ffffff" # white
+ fg[INSENSITIVE] = "#223344" # dark grey
+
+ text[NORMAL] = "#d3d3d3" # light grey
+ text[PRELIGHT] = "#ffffff" # white
+ text[ACTIVE] = "#e5e5e5" # light grey
+ text[SELECTED] = "#ffffff" # white
+ text[INSENSITIVE] = "#223344" # dark grey
#
# How to draw shadows in general
#
Modified: trunk/src/target/OM-2007/artwork/themes/openmoko-standard/gtk-2.0/gtktreeview
===================================================================
--- trunk/src/target/OM-2007/artwork/themes/openmoko-standard/gtk-2.0/gtktreeview 2006-11-11 13:37:31 UTC (rev 194)
+++ trunk/src/target/OM-2007/artwork/themes/openmoko-standard/gtk-2.0/gtktreeview 2006-11-12 09:56:21 UTC (rev 195)
@@ -1,9 +1,18 @@
style "gtktreeview" {
engine "pixmap" {
-
+
image {
function = FLAT_BOX
recolorable = TRUE
+ state = NORMAL
+ file = "gtkwidget.png"
+ border = { 0, 0, 0, 0 }
+ stretch = TRUE
+ }
+
+ image {
+ function = FLAT_BOX
+ recolorable = TRUE
state = SELECTED
file = "list_bg_row_sel_stretch.png"
border = { 0, 0, 0, 0 }
@@ -23,6 +32,7 @@
GtkTreeView::vertical_separator = 6
GtkTreeView::even_row_color = "#f7f7f7"
GtkTreeView::odd_row_color = "#e7e7e7"
+
GtkButton::focus-line-width = 0
}
class "GtkTreeView" style "gtktreeview"
Added: trunk/src/target/OM-2007/artwork/themes/openmoko-standard/gtk-2.0/gtkwidget.png
===================================================================
(Binary files differ)
Property changes on: trunk/src/target/OM-2007/artwork/themes/openmoko-standard/gtk-2.0/gtkwidget.png
___________________________________________________________________
Name: svn:mime-type
+ image/png
Modified: trunk/src/target/OM-2007/artwork/themes/openmoko-standard/gtk-2.0/openmoko-shadow-in.png
===================================================================
(Binary files differ)
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-11-11 13:37:31 UTC (rev 194)
+++ trunk/src/target/OM-2007/examples/openmoko-paned-demo/demo-main.c 2006-11-12 09:56:21 UTC (rev 195)
@@ -19,7 +19,7 @@
#include <mokoui/moko-application.h>
#include <mokoui/moko-paned-window.h>
-#include <mokoui/moko-toolbox.h>
+#include <mokoui/moko-tool-box.h>
#include <gtk/gtkactiongroup.h>
#include <gtk/gtkbutton.h>
Copied: trunk/src/target/OM-2007/libraries/mokoui/moko-menu-box.c (from rev 194, trunk/src/target/OM-2007/libraries/mokoui/moko-menubox.c)
===================================================================
--- trunk/src/target/OM-2007/libraries/mokoui/moko-menubox.c 2006-11-11 13:37:31 UTC (rev 194)
+++ trunk/src/target/OM-2007/libraries/mokoui/moko-menu-box.c 2006-11-12 09:56:21 UTC (rev 195)
@@ -0,0 +1,248 @@
+/*
+ * 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-menu-box.h"
+
+#include <gtk/gtklabel.h>
+#include <gtk/gtkmenubar.h>
+#include <gtk/gtkmenuitem.h>
+
+#include <string.h>
+
+#define MOKO_MENU_BOX_GET_PRIVATE(obj) (G_TYPE_INSTANCE_GET_PRIVATE ((obj), MOKO_TYPE_MENU_BOX, MokoMenuBoxPriv));
+
+typedef struct _MokoMenuBoxPriv
+{
+ GtkMenuBar* menubar_l;
+ GtkMenuItem* appitem;
+ GtkMenu* appmenu;
+ GtkMenuBar* menubar_r;
+ GtkMenuItem* filteritem;
+ GtkMenu* filtermenu;
+} MokoMenuBoxPriv;
+
+/* add your signals here */
+enum {
+ FILTER_CHANGED,
+ LAST_SIGNAL
+};
+
+static void moko_menu_box_class_init (MokoMenuBoxClass *klass);
+static void moko_menu_box_init (MokoMenuBox *f);
+
+static guint moko_menu_box_signals[LAST_SIGNAL] = { 0, };
+
+GType moko_menu_box_get_type (void) /* Typechecking */
+{
+ static GType self_type = 0;
+
+ if (!self_type)
+ {
+ static const GTypeInfo f_info =
+ {
+ sizeof (MokoMenuBoxClass),
+ NULL, /* base_init */
+ NULL, /* base_finalize */
+ (GClassInitFunc) moko_menu_box_class_init,
+ NULL, /* class_finalize */
+ NULL, /* class_data */
+ sizeof (MokoMenuBox),
+ 0,
+ (GInstanceInitFunc) moko_menu_box_init,
+ };
+
+ /* add the type of your parent class here */
+ self_type = g_type_register_static(GTK_TYPE_HBOX, "MokoMenuBox", &f_info, 0);
+ }
+
+ return self_type;
+}
+
+static void moko_menu_box_class_init (MokoMenuBoxClass *klass) /* Class Initialization */
+{
+ g_type_class_add_private(klass, sizeof(MokoMenuBoxPriv));
+
+ moko_menu_box_signals[FILTER_CHANGED] =
+ g_signal_new ("filter-changed",
+ G_TYPE_FROM_CLASS (klass),
+ G_SIGNAL_RUN_FIRST | G_SIGNAL_ACTION,
+ G_STRUCT_OFFSET(MokoMenuBoxClass, filter_changed),
+ NULL,
+ NULL,
+ g_cclosure_marshal_VOID__STRING,
+ G_TYPE_NONE, 1, G_TYPE_STRING );
+}
+
+static void moko_menu_box_init (MokoMenuBox *self) /* Instance Construction */
+{
+ g_debug( "moko_menu_box_init" );
+ MokoMenuBoxPriv* priv = MOKO_MENU_BOX_GET_PRIVATE(self);
+
+ priv->menubar_l = NULL;
+ priv->menubar_r = NULL;
+
+}
+
+GtkWidget* moko_menu_box_new() /* Construction */
+{
+ return GTK_WIDGET(g_object_new(moko_menu_box_get_type(), NULL));
+}
+
+void moko_menu_box_clear(MokoMenuBox *f) /* Destruction */
+{
+ /* destruct your widgets here */
+}
+
+static gboolean cb_button_release(GtkWidget *widget, GdkEventButton *event, GtkMenu* menu)
+{
+ MokoMenuBoxPriv* priv = MOKO_MENU_BOX_GET_PRIVATE( MOKO_MENU_BOX(widget->parent) );
+
+ g_debug( "menu open forwarder: clicked on %f, %f", event->x, event->y );
+ g_debug( "menu open forwarder: clicked on window %p, whereas our window is %p", event->window, widget->window );
+
+ if ( event->window != widget->window ) return FALSE;
+
+ if ( !GTK_WIDGET_VISIBLE(menu) )
+ {
+ g_debug( "menu open forwarder: not yet open -- popping up" );
+ /* this is kind of funny, if you don't add the grab manually,
+ then Gtk+ won't recognize the next click (selection) */
+ gtk_grab_add(GTK_WIDGET(widget) );
+ gtk_menu_shell_select_first( GTK_MENU_SHELL(widget), TRUE );
+ return TRUE;
+ }
+ else
+ {
+ g_debug( "menu open forwarder: already open -- ignoring" );
+ gtk_menu_popdown( menu );
+ return FALSE;
+ }
+ g_debug( "menu open forwarder: out of bounds" );
+ return FALSE;
+}
+
+static void cb_filter_menu_update( GtkMenu* menu, MokoMenuBox* self )
+{
+ MokoMenuBoxPriv* priv = MOKO_MENU_BOX_GET_PRIVATE(self);
+
+ gchar* text;
+ GtkMenuItem* item = gtk_menu_get_active( menu );
+ if (GTK_BIN(item)->child)
+ {
+ GtkWidget *child = GTK_BIN(item)->child;
+ g_assert( GTK_IS_LABEL(child) );
+ gtk_label_get(GTK_LABEL (child), &text);
+ g_debug(" selection done. menu item text: %s", text );
+ }
+ if (GTK_BIN(priv->filteritem)->child)
+ {
+ GtkWidget *child = GTK_BIN(priv->filteritem)->child;
+ g_assert( GTK_IS_LABEL(child) );
+ gtk_label_set(GTK_LABEL (child), text);
+ g_debug(" selection done. menu label updated." );
+ }
+
+ g_signal_emit( G_OBJECT(self), moko_menu_box_signals[FILTER_CHANGED], 0, text );
+}
+
+void moko_menu_box_set_application_menu(MokoMenuBox* self, GtkMenu* menu)
+{
+ g_debug( "moko_menu_box_set_application_menu" );
+
+ MokoMenuBoxPriv* priv = MOKO_MENU_BOX_GET_PRIVATE(self);
+ if (!priv->menubar_l )
+ {
+ priv->menubar_l = gtk_menu_bar_new();
+ gtk_widget_set_name( GTK_WIDGET(priv->menubar_l), "mokomenubox-application-menubar" );
+ gtk_box_pack_start( GTK_BOX(self), GTK_WIDGET(priv->menubar_l), TRUE, TRUE, 0 );
+
+ }
+ GtkMenuItem* appitem = gtk_menu_item_new_with_label( g_get_application_name() );
+ gtk_widget_set_name( GTK_WIDGET(appitem), "transparent" );
+ priv->appitem = appitem;
+ priv->appmenu = menu;
+ gtk_menu_item_set_submenu( appitem, menu );
+ gtk_menu_shell_append( GTK_MENU_BAR(priv->menubar_l), appitem );
+
+ //FIXME hack to popup the first menu if user clicks on menubar
+ g_signal_connect( GTK_WIDGET(priv->menubar_l), "button-press-event", G_CALLBACK(cb_button_release), menu );
+}
+
+void moko_menu_box_set_filter_menu(MokoMenuBox* self, GtkMenu* menu)
+{
+ g_debug( "moko_menu_box_set_filter_menu" );
+
+ MokoMenuBoxPriv* priv = MOKO_MENU_BOX_GET_PRIVATE(self);
+ if (!priv->menubar_r )
+ {
+ priv->menubar_r = gtk_menu_bar_new();
+ gtk_widget_set_name( GTK_WIDGET(priv->menubar_r), "mokomenubox-filter-menubar" );
+ gtk_box_pack_end( GTK_BOX(self), GTK_WIDGET(priv->menubar_r), TRUE, TRUE, 0 );
+ }
+ GtkMenuItem* filtitem = gtk_menu_item_new_with_label( "Filter Menu" );
+ gtk_widget_set_name( GTK_WIDGET(filtitem), "transparent" );
+ priv->filteritem = filtitem;
+ priv->filtermenu = menu;
+ g_signal_connect (G_OBJECT(menu), "selection_done", G_CALLBACK(cb_filter_menu_update), self );
+ gtk_menu_item_set_submenu( filtitem, menu );
+ gtk_menu_shell_append( GTK_MENU_BAR(priv->menubar_r), filtitem );
+
+ //FIXME hack to popup the first menu if user clicks on menubar
+ g_signal_connect( GTK_WIDGET(priv->menubar_r), "button-press-event", G_CALLBACK(cb_button_release), menu );
+}
+
+void
+moko_menu_box_set_active_filter(MokoMenuBox* self, gchar* text)
+{
+ //FIXME this only works with text labels
+ g_debug( "moko_menu_box_set_active_filter" );
+
+ // wander through all filter menu items, check their labels
+ // if one is matching, then select it
+
+ MokoMenuBoxPriv* priv = MOKO_MENU_BOX_GET_PRIVATE(self);
+
+ guint index = 0;
+ GList* child = gtk_container_get_children( GTK_CONTAINER(priv->filtermenu) );
+ while (child && GTK_IS_MENU_ITEM(child->data) )
+ {
+ GtkWidget *label = GTK_BIN(child->data)->child;
+ if ( !label )
+ {
+ ++index;
+ child = g_list_next(child);
+ continue;
+ }
+ g_assert( GTK_IS_LABEL(label) );
+ gchar* ltext;
+ gtk_label_get( GTK_LABEL(label), <ext );
+ g_debug( "moko_menu_box_set_active_filter: comparing '%s' with '%s'", ltext, text );
+ if ( strcmp( ltext, text ) == 0 )
+ {
+ g_debug( "moko_menu_box_set_active_filter: match found" );
+ //FIXME this is a bit hackish or is it?
+ gtk_menu_set_active( GTK_MENU(priv->filtermenu), index );
+ cb_filter_menu_update( priv->filtermenu, self ); //need to sync. manually, since we it didn't go through popupmenu
+ break;
+ }
+ ++index;
+ child = g_list_next(child);
+ }
+ if (!child)
+ g_warning( "moko_menu_box_set_active_filter: filter menu entry '%s' not found", text );
+}
Copied: trunk/src/target/OM-2007/libraries/mokoui/moko-menu-box.h (from rev 194, trunk/src/target/OM-2007/libraries/mokoui/moko-menubox.h)
Deleted: trunk/src/target/OM-2007/libraries/mokoui/moko-menubox.c
===================================================================
--- trunk/src/target/OM-2007/libraries/mokoui/moko-menubox.c 2006-11-11 13:37:31 UTC (rev 194)
+++ trunk/src/target/OM-2007/libraries/mokoui/moko-menubox.c 2006-11-12 09:56:21 UTC (rev 195)
@@ -1,248 +0,0 @@
-/*
- * 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-menubox.h"
-
-#include <gtk/gtklabel.h>
-#include <gtk/gtkmenubar.h>
-#include <gtk/gtkmenuitem.h>
-
-#include <string.h>
-
-#define MOKO_MENU_BOX_GET_PRIVATE(obj) (G_TYPE_INSTANCE_GET_PRIVATE ((obj), MOKO_TYPE_MENU_BOX, MokoMenuBoxPriv));
-
-typedef struct _MokoMenuBoxPriv
-{
- GtkMenuBar* menubar_l;
- GtkMenuItem* appitem;
- GtkMenu* appmenu;
- GtkMenuBar* menubar_r;
- GtkMenuItem* filteritem;
- GtkMenu* filtermenu;
-} MokoMenuBoxPriv;
-
-/* add your signals here */
-enum {
- FILTER_CHANGED,
- LAST_SIGNAL
-};
-
-static void moko_menu_box_class_init (MokoMenuBoxClass *klass);
-static void moko_menu_box_init (MokoMenuBox *f);
-
-static guint moko_menu_box_signals[LAST_SIGNAL] = { 0, };
-
-GType moko_menu_box_get_type (void) /* Typechecking */
-{
- static GType self_type = 0;
-
- if (!self_type)
- {
- static const GTypeInfo f_info =
- {
- sizeof (MokoMenuBoxClass),
- NULL, /* base_init */
- NULL, /* base_finalize */
- (GClassInitFunc) moko_menu_box_class_init,
- NULL, /* class_finalize */
- NULL, /* class_data */
- sizeof (MokoMenuBox),
- 0,
- (GInstanceInitFunc) moko_menu_box_init,
- };
-
- /* add the type of your parent class here */
- self_type = g_type_register_static(GTK_TYPE_HBOX, "MokoMenuBox", &f_info, 0);
- }
-
- return self_type;
-}
-
-static void moko_menu_box_class_init (MokoMenuBoxClass *klass) /* Class Initialization */
-{
- g_type_class_add_private(klass, sizeof(MokoMenuBoxPriv));
-
- moko_menu_box_signals[FILTER_CHANGED] =
- g_signal_new ("filter-changed",
- G_TYPE_FROM_CLASS (klass),
- G_SIGNAL_RUN_FIRST | G_SIGNAL_ACTION,
- G_STRUCT_OFFSET(MokoMenuBoxClass, filter_changed),
- NULL,
- NULL,
- g_cclosure_marshal_VOID__STRING,
- G_TYPE_NONE, 1, G_TYPE_STRING );
-}
-
-static void moko_menu_box_init (MokoMenuBox *self) /* Instance Construction */
-{
- g_debug( "moko_menu_box_init" );
- MokoMenuBoxPriv* priv = MOKO_MENU_BOX_GET_PRIVATE(self);
-
- priv->menubar_l = NULL;
- priv->menubar_r = NULL;
-
-}
-
-GtkWidget* moko_menu_box_new() /* Construction */
-{
- return GTK_WIDGET(g_object_new(moko_menu_box_get_type(), NULL));
-}
-
-void moko_menu_box_clear(MokoMenuBox *f) /* Destruction */
-{
- /* destruct your widgets here */
-}
-
-static gboolean cb_button_release(GtkWidget *widget, GdkEventButton *event, GtkMenu* menu)
-{
- MokoMenuBoxPriv* priv = MOKO_MENU_BOX_GET_PRIVATE( MOKO_MENU_BOX(widget->parent) );
-
- g_debug( "menu open forwarder: clicked on %f, %f", event->x, event->y );
- g_debug( "menu open forwarder: clicked on window %p, whereas our window is %p", event->window, widget->window );
-
- if ( event->window != widget->window ) return FALSE;
-
- if ( !GTK_WIDGET_VISIBLE(menu) )
- {
- g_debug( "menu open forwarder: not yet open -- popping up" );
- /* this is kind of funny, if you don't add the grab manually,
- then Gtk+ won't recognize the next click (selection) */
- gtk_grab_add(GTK_WIDGET(widget) );
- gtk_menu_shell_select_first( GTK_MENU_SHELL(widget), TRUE );
- return TRUE;
- }
- else
- {
- g_debug( "menu open forwarder: already open -- ignoring" );
- gtk_menu_popdown( menu );
- return FALSE;
- }
- g_debug( "menu open forwarder: out of bounds" );
- return FALSE;
-}
-
-static void cb_filter_menu_update( GtkMenu* menu, MokoMenuBox* self )
-{
- MokoMenuBoxPriv* priv = MOKO_MENU_BOX_GET_PRIVATE(self);
-
- gchar* text;
- GtkMenuItem* item = gtk_menu_get_active( menu );
- if (GTK_BIN(item)->child)
- {
- GtkWidget *child = GTK_BIN(item)->child;
- g_assert( GTK_IS_LABEL(child) );
- gtk_label_get(GTK_LABEL (child), &text);
- g_debug(" selection done. menu item text: %s", text );
- }
- if (GTK_BIN(priv->filteritem)->child)
- {
- GtkWidget *child = GTK_BIN(priv->filteritem)->child;
- g_assert( GTK_IS_LABEL(child) );
- gtk_label_set(GTK_LABEL (child), text);
- g_debug(" selection done. menu label updated." );
- }
-
- g_signal_emit( G_OBJECT(self), moko_menu_box_signals[FILTER_CHANGED], 0, text );
-}
-
-void moko_menu_box_set_application_menu(MokoMenuBox* self, GtkMenu* menu)
-{
- g_debug( "moko_menu_box_set_application_menu" );
-
- MokoMenuBoxPriv* priv = MOKO_MENU_BOX_GET_PRIVATE(self);
- if (!priv->menubar_l )
- {
- priv->menubar_l = gtk_menu_bar_new();
- gtk_widget_set_name( GTK_WIDGET(priv->menubar_l), "mokomenubox-application-menubar" );
- gtk_box_pack_start( GTK_BOX(self), GTK_WIDGET(priv->menubar_l), TRUE, TRUE, 0 );
-
- }
- GtkMenuItem* appitem = gtk_menu_item_new_with_label( g_get_application_name() );
- gtk_widget_set_name( GTK_WIDGET(appitem), "transparent" );
- priv->appitem = appitem;
- priv->appmenu = menu;
- gtk_menu_item_set_submenu( appitem, menu );
- gtk_menu_shell_append( GTK_MENU_BAR(priv->menubar_l), appitem );
-
- //FIXME hack to popup the first menu if user clicks on menubar
- g_signal_connect( GTK_WIDGET(priv->menubar_l), "button-press-event", G_CALLBACK(cb_button_release), menu );
-}
-
-void moko_menu_box_set_filter_menu(MokoMenuBox* self, GtkMenu* menu)
-{
- g_debug( "moko_menu_box_set_filter_menu" );
-
- MokoMenuBoxPriv* priv = MOKO_MENU_BOX_GET_PRIVATE(self);
- if (!priv->menubar_r )
- {
- priv->menubar_r = gtk_menu_bar_new();
- gtk_widget_set_name( GTK_WIDGET(priv->menubar_r), "mokomenubox-filter-menubar" );
- gtk_box_pack_end( GTK_BOX(self), GTK_WIDGET(priv->menubar_r), TRUE, TRUE, 0 );
- }
- GtkMenuItem* filtitem = gtk_menu_item_new_with_label( "Filter Menu" );
- gtk_widget_set_name( GTK_WIDGET(filtitem), "transparent" );
- priv->filteritem = filtitem;
- priv->filtermenu = menu;
- g_signal_connect (G_OBJECT(menu), "selection_done", G_CALLBACK(cb_filter_menu_update), self );
- gtk_menu_item_set_submenu( filtitem, menu );
- gtk_menu_shell_append( GTK_MENU_BAR(priv->menubar_r), filtitem );
-
- //FIXME hack to popup the first menu if user clicks on menubar
- g_signal_connect( GTK_WIDGET(priv->menubar_r), "button-press-event", G_CALLBACK(cb_button_release), menu );
-}
-
-void
-moko_menu_box_set_active_filter(MokoMenuBox* self, gchar* text)
-{
- //FIXME this only works with text labels
- g_debug( "moko_menu_box_set_active_filter" );
-
- // wander through all filter menu items, check their labels
- // if one is matching, then select it
-
- MokoMenuBoxPriv* priv = MOKO_MENU_BOX_GET_PRIVATE(self);
-
- guint index = 0;
- GList* child = gtk_container_get_children( GTK_CONTAINER(priv->filtermenu) );
- while (child && GTK_IS_MENU_ITEM(child->data) )
- {
- GtkWidget *label = GTK_BIN(child->data)->child;
- if ( !label )
- {
- ++index;
- child = g_list_next(child);
- continue;
- }
- g_assert( GTK_IS_LABEL(label) );
- gchar* ltext;
- gtk_label_get( GTK_LABEL(label), <ext );
- g_debug( "moko_menu_box_set_active_filter: comparing '%s' with '%s'", ltext, text );
- if ( strcmp( ltext, text ) == 0 )
- {
- g_debug( "moko_menu_box_set_active_filter: match found" );
- //FIXME this is a bit hackish or is it?
- gtk_menu_set_active( GTK_MENU(priv->filtermenu), index );
- cb_filter_menu_update( priv->filtermenu, self ); //need to sync. manually, since we it didn't go through popupmenu
- break;
- }
- ++index;
- child = g_list_next(child);
- }
- if (!child)
- g_warning( "moko_menu_box_set_active_filter: filter menu entry '%s' not found", text );
-}
Deleted: trunk/src/target/OM-2007/libraries/mokoui/moko-menubox.h
===================================================================
--- trunk/src/target/OM-2007/libraries/mokoui/moko-menubox.h 2006-11-11 13:37:31 UTC (rev 194)
+++ trunk/src/target/OM-2007/libraries/mokoui/moko-menubox.h 2006-11-12 09:56:21 UTC (rev 195)
@@ -1,74 +0,0 @@
-/*
- * 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_MENU_BOX_H_
-#define _MOKO_MENU_BOX_H_
-
-#include <glib.h>
-#include <glib-object.h>
-#include <gtk/gtkhbox.h>
-#include <gtk/gtkmenu.h>
-
-G_BEGIN_DECLS
-
-#define MOKO_TYPE_MENU_BOX (moko_menu_box_get_type())
-#define MOKO_MENU_BOX(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), MOKO_TYPE_MENU_BOX, MokoMenuBox))
-#define MOKO_MENU_BOX_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), MOKO_TYPE_MENU_BOX, MokoMenuBoxClass))
-#define IS_MOKO_MENU_BOX(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), MOKO_TYPE_MENU_BOX))
-#define IS_MOKO_MENU_BOX_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), MOKO_TYPE_MENU_BOX))
-
-typedef struct _MokoMenuBox MokoMenuBox;
-typedef struct _MokoMenuBoxClass MokoMenuBoxClass;
-
-struct _MokoMenuBox
-{
- GtkHBox parent;
- /* add pointers to new members here */
-};
-
-struct _MokoMenuBoxClass
-{
- /* add your parent class here */
- GtkHBoxClass parent_class;
- /* signals */
-
- /**
- * MokoMenuBox::filter_changed:
- * @widget: the object which received the signal
- * @text: the new menu text
- *
- * The changed signal gets emitted when the active
- * filter menu item is changed. The can be due to
- * the user selecting a different item from the list,
- * or due to a call to moko_menubox_set_active_filter().
- */
- void (*filter_changed) (MokoMenuBox *widget, gchar* text);
-};
-
-GType moko_menu_box_get_type (void);
-GtkWidget* moko_menu_box_new (void);
-void moko_menu_box_clear (MokoMenuBox *self);
-
-void moko_menu_box_set_application_menu(MokoMenuBox* self, GtkMenu* menu);
-void moko_menu_box_set_filter_menu(MokoMenuBox* self, GtkMenu* menu);
-
-void moko_menu_box_set_active_filter(MokoMenuBox* self, gchar* text);
-
-G_END_DECLS
-
-#endif /* _MOKO_MENU_BOX_H_ */
Modified: trunk/src/target/OM-2007/libraries/mokoui/moko-paned-window.c
===================================================================
--- trunk/src/target/OM-2007/libraries/mokoui/moko-paned-window.c 2006-11-11 13:37:31 UTC (rev 194)
+++ trunk/src/target/OM-2007/libraries/mokoui/moko-paned-window.c 2006-11-12 09:56:21 UTC (rev 195)
@@ -17,10 +17,7 @@
* Current Version: $Rev$ ($Date$) [$Author$]
*/
#include "moko-paned-window.h"
-
#include "moko-alignment.h"
-#include "moko-menubox.h"
-#include "moko-toolbox.h"
#include <gtk/gtktoolbar.h>
#include <gtk/gtkvbox.h>
Modified: trunk/src/target/OM-2007/libraries/mokoui/moko-paned-window.h
===================================================================
--- trunk/src/target/OM-2007/libraries/mokoui/moko-paned-window.h 2006-11-11 13:37:31 UTC (rev 194)
+++ trunk/src/target/OM-2007/libraries/mokoui/moko-paned-window.h 2006-11-12 09:56:21 UTC (rev 195)
@@ -20,8 +20,8 @@
#define _MOKO_PANED_WINDOW_H_
#include "moko-window.h"
-#include "moko-menubox.h"
-#include "moko-toolbox.h"
+#include "moko-menu-box.h"
+#include "moko-tool-box.h"
#include <gtk/gtkmenu.h>
Copied: trunk/src/target/OM-2007/libraries/mokoui/moko-tool-box.c (from rev 194, trunk/src/target/OM-2007/libraries/mokoui/moko-toolbox.c)
===================================================================
--- trunk/src/target/OM-2007/libraries/mokoui/moko-toolbox.c 2006-11-11 13:37:31 UTC (rev 194)
+++ trunk/src/target/OM-2007/libraries/mokoui/moko-tool-box.c 2006-11-12 09:56:21 UTC (rev 195)
@@ -0,0 +1,207 @@
+/*
+ * 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-tool-box.h"
+#include "moko-pixmap-container.h"
+
+#include <gtk/gtkentry.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;
+ GtkHBox* buttonbox;
+ MokoPixmapContainer* searchbar_page;
+ GtkEntry* entry;
+} MokoToolBoxPriv;
+
+/* add your signals here */
+enum {
+ SEARCHBOX_VISIBLE,
+ SEARCHBOX_INVISIBLE,
+ LAST_SIGNAL
+};
+
+static void moko_tool_box_class_init (MokoToolBoxClass *klass);
+static void moko_tool_box_init (MokoToolBox *self);
+
+static guint moko_tool_box_signals[LAST_SIGNAL] = { 0 };
+
+static void _button_release(GtkWidget* w, MokoToolBox* self)
+{
+ static int current_page = 1;
+ gtk_notebook_set_current_page( GTK_NOTEBOOK(self), current_page );
+ g_debug( "moko_tool_box_button_release: current_page is now: %d", current_page );
+ current_page = 1 - current_page;
+ g_signal_emit( G_OBJECT(self), current_page ? moko_tool_box_signals[SEARCHBOX_INVISIBLE] : moko_tool_box_signals[SEARCHBOX_VISIBLE], 0, NULL );
+}
+
+GType moko_tool_box_get_type (void) /* Typechecking */
+{
+ static GType self_type = 0;
+
+ if (!self_type)
+ {
+ static const GTypeInfo self_info =
+ {
+ sizeof (MokoToolBoxClass),
+ NULL, /* base_init */
+ NULL, /* base_finalize */
+ (GClassInitFunc) moko_tool_box_class_init,
+ NULL, /* class_finalize */
+ NULL, /* class_data */
+ sizeof (MokoToolBox),
+ 0,
+ (GInstanceInitFunc) moko_tool_box_init,
+ };
+
+ /* add the type of your parent class here */
+ self_type = g_type_register_static(GTK_TYPE_NOTEBOOK, "MokoToolBox", &self_info, 0);
+ }
+
+ return self_type;
+}
+
+static void moko_tool_box_class_init (MokoToolBoxClass *klass) /* Class Initialization */
+{
+ g_type_class_add_private(klass, sizeof(MokoToolBoxPriv));
+
+ moko_tool_box_signals[SEARCHBOX_VISIBLE] = g_signal_new ("searchbox_visible",
+ G_TYPE_FROM_CLASS (klass),
+ G_SIGNAL_RUN_FIRST | G_SIGNAL_ACTION,
+ G_STRUCT_OFFSET (MokoToolBoxClass, searchbox_visible),
+ NULL,
+ NULL,
+ g_cclosure_marshal_VOID__VOID,
+ G_TYPE_NONE, 0);
+
+ moko_tool_box_signals[SEARCHBOX_INVISIBLE] = g_signal_new ("searchbox_invisible",
+ G_TYPE_FROM_CLASS (klass),
+ G_SIGNAL_RUN_FIRST | G_SIGNAL_ACTION,
+ G_STRUCT_OFFSET (MokoToolBoxClass, searchbox_invisible),
+ NULL,
+ NULL,
+ g_cclosure_marshal_VOID__VOID,
+ G_TYPE_NONE, 0);
+}
+
+static void moko_tool_box_init(MokoToolBox* self) /* Instance Construction */
+{
+ g_debug( "moko_tool_box_init" );
+ gtk_notebook_set_show_border( GTK_NOTEBOOK(self), FALSE );
+ gtk_notebook_set_show_tabs( GTK_NOTEBOOK(self), FALSE );
+}
+
+//FIXME 1st: rewrite moko_tool_box_new / moko_tool_box_new_with_search for using g_object properties
+//FIXME 2nd: support enabling/disabling search mode on-the-fly
+GtkWidget* moko_tool_box_new() /* Construction */
+{
+ 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();
+ 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
+
+ gtk_notebook_append_page( GTK_NOTEBOOK(self), priv->toolbar_page, NULL );
+
+ return GTK_WIDGET(self);
+}
+
+GtkWidget* moko_tool_box_new_with_search()
+{
+ 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();
+ 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 );
+ 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), 84, 7 ); //FIXME need to get from style
+
+ 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" );
+ gtk_fixed_put( GTK_FIXED(priv->searchbar_page), back, 400, 0 ); //FIXME need to get from style
+ g_signal_connect( G_OBJECT(back), "clicked", G_CALLBACK(_button_release), self );
+
+ priv->entry = gtk_entry_new();
+ 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) );
+
+ return GTK_WIDGET(self);
+}
+
+void moko_tool_box_clear(MokoToolBox* self) /* Destruction */
+{
+ /* destruct your widgets here */
+}
+
+/* add new methods here */
+
+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
+}
+
+GtkHBox* moko_tool_box_get_button_box(MokoToolBox* self)
+{
+ MokoToolBoxPriv* priv = MOKO_TOOL_BOX_GET_PRIVATE(self);
+ return priv->buttonbox;
+}
+
+MokoPixmapButton* moko_tool_box_add_action_button(MokoToolBox* self)
+{
+ g_debug( "moko_tool_box_add_action_button" );
+ MokoToolBoxPriv* priv = MOKO_TOOL_BOX_GET_PRIVATE(self);
+
+ MokoPixmapButton* button = moko_pixmap_button_new();
+ gtk_widget_set_name( GTK_WIDGET(button), "mokotoolbox-action-button" );
+
+ gtk_box_pack_start( GTK_BOX(priv->buttonbox), GTK_WIDGET(button), FALSE, FALSE, 0 );
+
+ return button;
+}
+
+GtkEntry* moko_tool_box_get_entry(MokoToolBox* self)
+{
+ MokoToolBoxPriv* priv = MOKO_TOOL_BOX_GET_PRIVATE(self);
+ return priv->entry;
+}
Copied: trunk/src/target/OM-2007/libraries/mokoui/moko-tool-box.h (from rev 194, trunk/src/target/OM-2007/libraries/mokoui/moko-toolbox.h)
Deleted: trunk/src/target/OM-2007/libraries/mokoui/moko-toolbox.c
===================================================================
--- trunk/src/target/OM-2007/libraries/mokoui/moko-toolbox.c 2006-11-11 13:37:31 UTC (rev 194)
+++ trunk/src/target/OM-2007/libraries/mokoui/moko-toolbox.c 2006-11-12 09:56:21 UTC (rev 195)
@@ -1,208 +0,0 @@
-/*
- * 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-toolbox.h"
-#include "moko-pixmap-container.h"
-#include "moko-pixmap-button.h"
-
-#include <gtk/gtkentry.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;
- GtkHBox* buttonbox;
- MokoPixmapContainer* searchbar_page;
- GtkEntry* entry;
-} MokoToolBoxPriv;
-
-/* add your signals here */
-enum {
- SEARCHBOX_VISIBLE,
- SEARCHBOX_INVISIBLE,
- LAST_SIGNAL
-};
-
-static void moko_tool_box_class_init (MokoToolBoxClass *klass);
-static void moko_tool_box_init (MokoToolBox *self);
-
-static guint moko_tool_box_signals[LAST_SIGNAL] = { 0 };
-
-static void _button_release(GtkWidget* w, MokoToolBox* self)
-{
- static int current_page = 1;
- gtk_notebook_set_current_page( GTK_NOTEBOOK(self), current_page );
- g_debug( "moko_tool_box_button_release: current_page is now: %d", current_page );
- current_page = 1 - current_page;
- g_signal_emit( G_OBJECT(self), current_page ? moko_tool_box_signals[SEARCHBOX_INVISIBLE] : moko_tool_box_signals[SEARCHBOX_VISIBLE], 0, NULL );
-}
-
-GType moko_tool_box_get_type (void) /* Typechecking */
-{
- static GType self_type = 0;
-
- if (!self_type)
- {
- static const GTypeInfo self_info =
- {
- sizeof (MokoToolBoxClass),
- NULL, /* base_init */
- NULL, /* base_finalize */
- (GClassInitFunc) moko_tool_box_class_init,
- NULL, /* class_finalize */
- NULL, /* class_data */
- sizeof (MokoToolBox),
- 0,
- (GInstanceInitFunc) moko_tool_box_init,
- };
-
- /* add the type of your parent class here */
- self_type = g_type_register_static(GTK_TYPE_NOTEBOOK, "MokoToolBox", &self_info, 0);
- }
-
- return self_type;
-}
-
-static void moko_tool_box_class_init (MokoToolBoxClass *klass) /* Class Initialization */
-{
- g_type_class_add_private(klass, sizeof(MokoToolBoxPriv));
-
- moko_tool_box_signals[SEARCHBOX_VISIBLE] = g_signal_new ("searchbox_visible",
- G_TYPE_FROM_CLASS (klass),
- G_SIGNAL_RUN_FIRST | G_SIGNAL_ACTION,
- G_STRUCT_OFFSET (MokoToolBoxClass, searchbox_visible),
- NULL,
- NULL,
- g_cclosure_marshal_VOID__VOID,
- G_TYPE_NONE, 0);
-
- moko_tool_box_signals[SEARCHBOX_INVISIBLE] = g_signal_new ("searchbox_invisible",
- G_TYPE_FROM_CLASS (klass),
- G_SIGNAL_RUN_FIRST | G_SIGNAL_ACTION,
- G_STRUCT_OFFSET (MokoToolBoxClass, searchbox_invisible),
- NULL,
- NULL,
- g_cclosure_marshal_VOID__VOID,
- G_TYPE_NONE, 0);
-}
-
-static void moko_tool_box_init(MokoToolBox* self) /* Instance Construction */
-{
- g_debug( "moko_tool_box_init" );
- gtk_notebook_set_show_border( GTK_NOTEBOOK(self), FALSE );
- gtk_notebook_set_show_tabs( GTK_NOTEBOOK(self), FALSE );
-}
-
-//FIXME 1st: rewrite moko_tool_box_new / moko_tool_box_new_with_search for using g_object properties
-//FIXME 2nd: support enabling/disabling search mode on-the-fly
-GtkWidget* moko_tool_box_new() /* Construction */
-{
- 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();
- 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
-
- gtk_notebook_append_page( GTK_NOTEBOOK(self), priv->toolbar_page, NULL );
-
- return GTK_WIDGET(self);
-}
-
-GtkWidget* moko_tool_box_new_with_search()
-{
- 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();
- 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 );
- 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), 84, 7 ); //FIXME need to get from style
-
- 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" );
- gtk_fixed_put( GTK_FIXED(priv->searchbar_page), back, 400, 0 ); //FIXME need to get from style
- g_signal_connect( G_OBJECT(back), "clicked", G_CALLBACK(_button_release), self );
-
- priv->entry = gtk_entry_new();
- 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) );
-
- return GTK_WIDGET(self);
-}
-
-void moko_tool_box_clear(MokoToolBox* self) /* Destruction */
-{
- /* destruct your widgets here */
-}
-
-/* add new methods here */
-
-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
-}
-
-GtkHBox* moko_tool_box_get_button_box(MokoToolBox* self)
-{
- MokoToolBoxPriv* priv = MOKO_TOOL_BOX_GET_PRIVATE(self);
- return priv->buttonbox;
-}
-
-MokoPixmapButton* moko_tool_box_add_action_button(MokoToolBox* self)
-{
- g_debug( "moko_tool_box_add_action_button" );
- MokoToolBoxPriv* priv = MOKO_TOOL_BOX_GET_PRIVATE(self);
-
- MokoPixmapButton* button = moko_pixmap_button_new();
- gtk_widget_set_name( GTK_WIDGET(button), "mokotoolbox-action-button" );
-
- gtk_box_pack_start( GTK_BOX(priv->buttonbox), GTK_WIDGET(button), FALSE, FALSE, 0 );
-
- return button;
-}
-
-GtkEntry* moko_tool_box_get_entry(MokoToolBox* self)
-{
- MokoToolBoxPriv* priv = MOKO_TOOL_BOX_GET_PRIVATE(self);
- return priv->entry;
-}
Deleted: trunk/src/target/OM-2007/libraries/mokoui/moko-toolbox.h
===================================================================
--- trunk/src/target/OM-2007/libraries/mokoui/moko-toolbox.h 2006-11-11 13:37:31 UTC (rev 194)
+++ trunk/src/target/OM-2007/libraries/mokoui/moko-toolbox.h 2006-11-12 09:56:21 UTC (rev 195)
@@ -1,66 +0,0 @@
-/*
- * 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_TOOL_BOX_H_
-#define _MOKO_TOOL_BOX_H_
-
-#include "moko-pixmap-button.h"
-
-#include <gtk/gtkentry.h>
-#include <gtk/gtkhbox.h>
-#include <gtk/gtknotebook.h>
-
-#include <glib.h>
-#include <glib-object.h>
-
-
-G_BEGIN_DECLS
-
-#define MOKO_TYPE_TOOL_BOX (moko_tool_box_get_type())
-#define MOKO_TOOL_BOX(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), MOKO_TYPE_TOOL_BOX, MokoToolBox))
-#define MOKO_TOOL_BOX_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), MOKO_TYPE_TOOL_BOX, MokoToolBoxClass))
-#define MOKO_IS_TOOL_BOX(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), MOKO_TYPE_TOOL_BOX))
-#define MOKO_IS_TOOL_BOX_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), MOKO_TYPE_TOOL_BOX))
-
-typedef struct _MokoToolBox MokoToolBox;
-typedef struct _MokoToolBoxClass MokoToolBoxClass;
-
-struct _MokoToolBox
-{
- GtkNotebook parent;
-};
-
-struct _MokoToolBoxClass
-{
- GtkNotebookClass parent_class;
- void (*searchbox_visible) (MokoToolBox *self);
- void (*searchbox_invisible) (MokoToolBox *self);
-};
-
-GType moko_tool_box_get_type();
-GtkWidget* moko_tool_box_new();
-GtkWidget* moko_tool_box_new_with_search();
-void moko_tool_box_clear(MokoToolBox* self);
-
-GtkHBox* moko_tool_box_get_button_box( MokoToolBox* self );
-GtkEntry* moko_tool_box_get_entry(MokoToolBox* self);
-MokoPixmapButton* moko_tool_box_add_action_button(MokoToolBox* self);
-
-G_END_DECLS
-
-#endif /* _MOKO_TOOL_BOX_H_ */
Modified: trunk/src/target/OM-2007/libraries/mokoui/mokoui.pro
===================================================================
--- trunk/src/target/OM-2007/libraries/mokoui/mokoui.pro 2006-11-11 13:37:31 UTC (rev 194)
+++ trunk/src/target/OM-2007/libraries/mokoui/mokoui.pro 2006-11-12 09:56:21 UTC (rev 195)
@@ -2,27 +2,30 @@
VERSION = 0.0.1
HEADERS = \
- moko-alignment.h \
- moko-pixmap-container.h \
- moko-pixmap-button.h \
- moko-application.h \
- moko-window.h \
- moko-finger-window.h \
- moko-paned-window.h \
- moko-menubox.h \
- moko-toolbox.h \
- moko-search-bar.h
+ moko-alignment.h \
+ moko-application.h \
+ moko-finger-window.h \
+ moko-menu-box.h \
+ moko-pixmap-container.h \
+ moko-pixmap-button.h \
+ moko-paned-window.h \
+ moko-search-bar.h \
+ moko-tool-box.h \
+ moko-tree-view.h \
+ moko-window.h
+
SOURCES = \
- moko-alignment.c \
+ moko-alignment.c \
+ moko-application.c \
+ moko-finger-window.c \
+ moko-menu-box.c \
moko-pixmap-container.c \
- moko-pixmap-button.c \
- moko-application.c \
- moko-window.c \
- moko-finger-window.c \
- moko-paned-window.c \
- moko-menubox.c \
- moko-toolbox.c \
- moko-search-bar.c
+ moko-pixmap-button.c \
+ moko-paned-window.c \
+ moko-search-bar.c \
+ moko-tree-view.c \
+ moko-tool-box.c \
+ moko-window.c
PKGCONFIG += gtk+-2.0
More information about the commitlog
mailing list