r230 - 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
Fri Nov 17 01:40:41 CET 2006


Author: mickey
Date: 2006-11-17 00:40:38 +0000 (Fri, 17 Nov 2006)
New Revision: 230

Added:
   trunk/src/target/OM-2007/artwork/themes/openmoko-standard/gtk-2.0/btn_dialog_next.png
   trunk/src/target/OM-2007/artwork/themes/openmoko-standard/gtk-2.0/btn_dialog_next_p.png
   trunk/src/target/OM-2007/artwork/themes/openmoko-standard/gtk-2.0/btn_dialog_prev.png
   trunk/src/target/OM-2007/artwork/themes/openmoko-standard/gtk-2.0/btn_dialog_prev_p.png
   trunk/src/target/OM-2007/artwork/themes/openmoko-standard/gtk-2.0/gtkscrolledwindow
   trunk/src/target/OM-2007/artwork/themes/openmoko-standard/gtk-2.0/mokofingertoolbox
   trunk/src/target/OM-2007/openmoko-libs/libmokoui/moko-finger-tool-box.c
   trunk/src/target/OM-2007/openmoko-libs/libmokoui/moko-finger-tool-box.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/transparent
   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-alignment.h
   trunk/src/target/OM-2007/openmoko-libs/libmokoui/moko-fixed.c
   trunk/src/target/OM-2007/openmoko-libs/libmokoui/moko-fixed.h
   trunk/src/target/OM-2007/openmoko-libs/libmokoui/moko-menu-box.c
   trunk/src/target/OM-2007/openmoko-libs/libmokoui/moko-pixmap-button.c
   trunk/src/target/OM-2007/openmoko-libs/libmokoui/moko-pixmap-button.h
   trunk/src/target/OM-2007/openmoko-libs/libmokoui/moko-tree-view.c
   trunk/src/target/OM-2007/openmoko-libs/libmokoui/moko-tree-view.h
Log:
mokoui: start with MokoFingerToolBox. this will give some more headaches...


Added: trunk/src/target/OM-2007/artwork/themes/openmoko-standard/gtk-2.0/btn_dialog_next.png
===================================================================
(Binary files differ)


Property changes on: trunk/src/target/OM-2007/artwork/themes/openmoko-standard/gtk-2.0/btn_dialog_next.png
___________________________________________________________________
Name: svn:mime-type
   + image/png

Added: trunk/src/target/OM-2007/artwork/themes/openmoko-standard/gtk-2.0/btn_dialog_next_p.png
===================================================================
(Binary files differ)


Property changes on: trunk/src/target/OM-2007/artwork/themes/openmoko-standard/gtk-2.0/btn_dialog_next_p.png
___________________________________________________________________
Name: svn:mime-type
   + image/png

Added: trunk/src/target/OM-2007/artwork/themes/openmoko-standard/gtk-2.0/btn_dialog_prev.png
===================================================================
(Binary files differ)


Property changes on: trunk/src/target/OM-2007/artwork/themes/openmoko-standard/gtk-2.0/btn_dialog_prev.png
___________________________________________________________________
Name: svn:mime-type
   + image/png

Added: trunk/src/target/OM-2007/artwork/themes/openmoko-standard/gtk-2.0/btn_dialog_prev_p.png
===================================================================
(Binary files differ)


Property changes on: trunk/src/target/OM-2007/artwork/themes/openmoko-standard/gtk-2.0/btn_dialog_prev_p.png
___________________________________________________________________
Name: svn:mime-type
   + image/png

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-16 16:37:12 UTC (rev 229)
+++ trunk/src/target/OM-2007/artwork/themes/openmoko-standard/gtk-2.0/gtkrc	2006-11-17 00:40:38 UTC (rev 230)
@@ -3,17 +3,17 @@
 	# NOTE bg_pixmap[NORMAL] _must_ match with the SHADOW pixmaps
     bg_pixmap[NORMAL] = "gtkwidget.png"
 
-    bg[NORMAL]        = "#666666" # 
+    bg[NORMAL]        = "#666666" #
     bg[PRELIGHT]      = "#ff0000" # light beige
     bg[ACTIVE]        = "#ff0000" # dark beige
     bg[SELECTED]      = "#ff0000" # olive
     bg[INSENSITIVE]   = "#ff0000" # beige
 
     base[NORMAL]      = "#ffeddb" # light cherry
-    base[PRELIGHT]    = "#00ff00" # 
-    base[ACTIVE]      = "#00ff00" # 
-    base[SELECTED]    = "#00ff00" # 
-    base[INSENSITIVE] = "#00ff00" # 
+    base[PRELIGHT]    = "#00ff00" #
+    base[ACTIVE]      = "#00ff00" #
+    base[SELECTED]    = "#00ff00" #
+    base[INSENSITIVE] = "#00ff00" #
 
     fg[NORMAL]      = "#d3d3d3" # light grey
     fg[PRELIGHT]    = "#ffffff" # white
@@ -74,7 +74,7 @@
             function        = VLINE
             file            = "hline.png" # FIXME add proper vline
             stretch         = TRUE
-        }	
+        }
     }
     font_name = "Vera Sans 16"
 }
@@ -88,18 +88,22 @@
 # widget "MokoPanedWindow.*" style "moko-window-default"
 # class "GtkMenuItem" style "moko-window-default"
 
+include "transparent"
+
 include "gtkmenu"
 include "gtkmenuitem"
 include "gtkpaned"
+include "gtkscrolledwindow"
 include "gtkscrollbar"
 include "gtktreeview"
 include "gtkbutton"
 
 include "mokofingerbutton"
+include "mokofingertoolbox"
 include "mokofingerwheel"
 include "mokomenubox"
 include "mokopanedwindow"
 include "mokotoolbox"
 include "mokotreeview"
 
-include "transparent"
+class "GtkViewport" style "transparent"

Added: trunk/src/target/OM-2007/artwork/themes/openmoko-standard/gtk-2.0/gtkscrolledwindow
===================================================================
--- trunk/src/target/OM-2007/artwork/themes/openmoko-standard/gtk-2.0/gtkscrolledwindow	2006-11-16 16:37:12 UTC (rev 229)
+++ trunk/src/target/OM-2007/artwork/themes/openmoko-standard/gtk-2.0/gtkscrolledwindow	2006-11-17 00:40:38 UTC (rev 230)
@@ -0,0 +1,6 @@
+style "gtkscrolledwindow" {
+    GtkScrolledWindow::scrollbar-spacing = 2
+}
+
+class "GtkScrolledWindow" style "gtkscrolledwindow"
+

Added: trunk/src/target/OM-2007/artwork/themes/openmoko-standard/gtk-2.0/mokofingertoolbox
===================================================================
--- trunk/src/target/OM-2007/artwork/themes/openmoko-standard/gtk-2.0/mokofingertoolbox	2006-11-16 16:37:12 UTC (rev 229)
+++ trunk/src/target/OM-2007/artwork/themes/openmoko-standard/gtk-2.0/mokofingertoolbox	2006-11-17 00:40:38 UTC (rev 230)
@@ -0,0 +1,105 @@
+style "mokofingertoolbox-leftarrow" {
+   engine "pixmap" {
+        image {
+            function        = BOX
+            recolorable     = TRUE
+            state           = NORMAL
+            file            = "btn_dialog_prev.png"
+            border          = { 0, 0, 0, 0 }
+            stretch         = TRUE
+        }
+        image {
+            function        = BOX
+            recolorable     = TRUE
+            state           = PRELIGHT
+            file            = "btn_dialog_prev.png"
+            border          = { 0, 0, 0, 0 }
+            stretch         = TRUE
+        }
+        image {
+            function        = BOX
+            recolorable     = TRUE
+            state           = ACTIVE
+            file            = "btn_dialog_prev_p.png"
+            border          = { 0, 0, 0, 0 }
+            stretch         = TRUE
+        }
+    }
+    MokoPixmapButton::size-request = { 0, 47, 0, 90 }
+    xthickness = 0
+    ythickness = 0
+    GtkButton::focus-line-width = 0
+}
+widget "*.mokofingertoolbox-leftarrow" style "mokofingertoolbox-leftarrow"
+
+style "mokofingertoolbox-rightarrow" {
+   engine "pixmap" {
+        image {
+            function        = BOX
+            recolorable     = TRUE
+            state           = NORMAL
+            file            = "btn_dialog_next.png"
+            border          = { 0, 0, 0, 0 }
+            stretch         = TRUE
+        }
+        image {
+            function        = BOX
+            recolorable     = TRUE
+            state           = PRELIGHT
+            file            = "btn_dialog_next.png"
+            border          = { 0, 0, 0, 0 }
+            stretch         = TRUE
+        }
+        image {
+            function        = BOX
+            recolorable     = TRUE
+            state           = ACTIVE
+            file            = "btn_dialog_next_p.png"
+            border          = { 0, 0, 0, 0 }
+            stretch         = TRUE
+        }
+    }
+    MokoPixmapButton::size-request = { 0, 47, 0, 90 }
+    xthickness = 0
+    ythickness = 0
+    GtkButton::focus-line-width = 0
+}
+widget "*.mokofingertoolbox-rightarrow" style "mokofingertoolbox-rightarrow"
+
+style "mokofingertoolbox-toolbutton" {
+   engine "pixmap" {
+        image {
+            function        = BOX
+            recolorable     = TRUE
+            state           = NORMAL
+            file            = "btn_type03.png"
+            border          = { 0, 0, 0, 0 }
+            stretch         = TRUE
+        }
+        image {
+            function        = BOX
+            recolorable     = TRUE
+            state           = PRELIGHT
+            file            = "btn_type03.png"
+            border          = { 0, 0, 0, 0 }
+            stretch         = TRUE
+        }
+        image {
+            function        = BOX
+            recolorable     = TRUE
+            state           = ACTIVE
+            file            = "btn_type03_p.png"
+            border          = { 0, 0, 0, 0 }
+            stretch         = TRUE
+        }
+    }
+    #FIXME this button is vertically one pixel too large
+    MokoPixmapButton::size-request = { 0, 69, 0, 91 }
+    xthickness = 0
+    ythickness = 0
+    GtkButton::focus-line-width = 0
+}
+widget "*.mokofingertoolbox-toolbutton" style "mokofingertoolbox-toolbutton"
+
+widget_class "*.MokoFingerToolBox.*" style "transparent"
+

Modified: trunk/src/target/OM-2007/artwork/themes/openmoko-standard/gtk-2.0/transparent
===================================================================
--- trunk/src/target/OM-2007/artwork/themes/openmoko-standard/gtk-2.0/transparent	2006-11-16 16:37:12 UTC (rev 229)
+++ trunk/src/target/OM-2007/artwork/themes/openmoko-standard/gtk-2.0/transparent	2006-11-17 00:40:38 UTC (rev 230)
@@ -8,6 +8,16 @@
             border          = { 0, 0, 0, 0 }
             stretch         = TRUE
         }
+        image {
+            function        = FLAT_BOX
+            recolorable     = TRUE
+            # state = ALL
+            file            = "transparency100.png"
+            border          = { 0, 0, 0, 0 }
+            stretch         = TRUE
+        }
+
     }
 }
 widget "*.transparent" style "transparent"
+

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-16 16:37:12 UTC (rev 229)
+++ trunk/src/target/OM-2007/examples/openmoko-finger-demo/demo-main.c	2006-11-17 00:40:38 UTC (rev 230)
@@ -18,6 +18,7 @@
  */
 
 #include <libmokoui/moko-application.h>
+#include <libmokoui/moko-finger-tool-box.h>
 #include <libmokoui/moko-finger-window.h>
 #include <libmokoui/moko-finger-wheel.h>
 
@@ -30,6 +31,9 @@
 #include <gtk/gtktogglebutton.h>
 #include <gtk/gtkvbox.h>
 
+static GtkVBox* vbox = NULL;
+static MokoFingerToolBox* tools = NULL;
+
 void cb_orange_button_clicked( GtkButton* button, MokoFingerWindow* window )
 {
     g_debug( "openmoko-finger-demo: orange button clicked" );
@@ -49,11 +53,15 @@
 void cb_black_button_clicked( GtkButton* button, MokoFingerWindow* window )
 {
     g_debug( "openmoko-finger-demo: black button clicked" );
-#if 0
     static gboolean show = TRUE;
-    static MokoFingerTools* tools = NULL;
 
-    if (!tools) tools = moko_finger_tools_new();
+    if (!tools)
+    {
+        tools = moko_finger_tool_box_new();
+        for ( int i = 0; i < 10; ++i )
+            moko_finger_tool_box_add_button( tools );
+        gtk_box_pack_start( GTK_BOX(vbox), GTK_WIDGET(tools), FALSE, FALSE, 0 );
+    }
 
     if ( show )
         gtk_widget_show( GTK_WIDGET(tools) );
@@ -61,7 +69,6 @@
         gtk_widget_hide( GTK_WIDGET(tools) );
 
     show = !show;
-#endif
 }
 
 int main( int argc, char** argv )
@@ -88,7 +95,7 @@
     g_signal_connect( G_OBJECT(window), "delete_event", G_CALLBACK( gtk_main_quit ), NULL );
 
     /* contents */
-    GtkVBox* vbox = gtk_vbox_new( TRUE, 0 );
+    vbox = gtk_vbox_new( TRUE, 0 );
     GtkLabel* label1 = gtk_label_new( "Populate this area with finger widgets\n \nThere are three types of finger buttons:" );
 
     GtkLabel* label2 = gtk_label_new( "Orange button toggles finger scrolling wheel\nBlack button toggles finger toolbar\nDialer Button does nothing :)" );

Modified: trunk/src/target/OM-2007/openmoko-libs/libmokoui/Makefile.am
===================================================================
--- trunk/src/target/OM-2007/openmoko-libs/libmokoui/Makefile.am	2006-11-16 16:37:12 UTC (rev 229)
+++ trunk/src/target/OM-2007/openmoko-libs/libmokoui/Makefile.am	2006-11-17 00:40:38 UTC (rev 230)
@@ -1,6 +1,7 @@
 source_h = \
     moko-alignment.h \
     moko-application.h \
+    moko-finger-tool-box.h \
     moko-finger-wheel.h \
     moko-finger-window.h \
     moko-fixed.h
@@ -15,6 +16,7 @@
 source_c = \
     moko-alignment.c \
     moko-application.c \
+    moko-finger-tool-box.c \
     moko-finger-wheel.c \
     moko-finger-window.c \
     moko-fixed.c

Modified: trunk/src/target/OM-2007/openmoko-libs/libmokoui/libmokoui.pro
===================================================================
--- trunk/src/target/OM-2007/openmoko-libs/libmokoui/libmokoui.pro	2006-11-16 16:37:12 UTC (rev 229)
+++ trunk/src/target/OM-2007/openmoko-libs/libmokoui/libmokoui.pro	2006-11-17 00:40:38 UTC (rev 230)
@@ -5,6 +5,7 @@
 HEADERS = \
     moko-alignment.h \
     moko-application.h \
+    moko-finger-tool-box.h \
     moko-finger-wheel.h \
     moko-finger-window.h \
     moko-fixed.h \
@@ -19,6 +20,7 @@
 SOURCES = \
     moko-alignment.c \
     moko-application.c \
+    moko-finger-tool-box.c \
     moko-finger-wheel.c \
     moko-finger-window.c \
     moko-fixed.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-16 16:37:12 UTC (rev 229)
+++ trunk/src/target/OM-2007/openmoko-libs/libmokoui/moko-alignment.c	2006-11-17 00:40:38 UTC (rev 230)
@@ -172,8 +172,8 @@
     GTK_WIDGET_UNSET_FLAGS( GTK_WIDGET(self), GTK_NO_WINDOW );
 }
 
-MokoAlignment*
+GtkWidget*
 moko_alignment_new (void)
 {
-    return g_object_new (MOKO_TYPE_ALIGNMENT, NULL);
+    return GTK_WIDGET(g_object_new(moko_alignment_get_type(), NULL));
 }

Modified: trunk/src/target/OM-2007/openmoko-libs/libmokoui/moko-alignment.h
===================================================================
--- trunk/src/target/OM-2007/openmoko-libs/libmokoui/moko-alignment.h	2006-11-16 16:37:12 UTC (rev 229)
+++ trunk/src/target/OM-2007/openmoko-libs/libmokoui/moko-alignment.h	2006-11-17 00:40:38 UTC (rev 230)
@@ -42,7 +42,7 @@
 
 GType moko_alignment_get_type (void);
 
-MokoAlignment* moko_alignment_new (void);
+GtkWidget* moko_alignment_new (void);
 
 G_END_DECLS
 

Added: trunk/src/target/OM-2007/openmoko-libs/libmokoui/moko-finger-tool-box.c
===================================================================
--- trunk/src/target/OM-2007/openmoko-libs/libmokoui/moko-finger-tool-box.c	2006-11-16 16:37:12 UTC (rev 229)
+++ trunk/src/target/OM-2007/openmoko-libs/libmokoui/moko-finger-tool-box.c	2006-11-17 00:40:38 UTC (rev 230)
@@ -0,0 +1,347 @@
+/*  moko-finger-tool-box.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-finger-tool-box.h"
+
+#include "moko-pixmap-button.h"
+
+#include <gtk/gtkscrolledwindow.h>
+
+G_DEFINE_TYPE (MokoFingerToolBox, moko_finger_tool_box, GTK_TYPE_HBOX)
+
+#define MOKO_FINGER_TOOL_BOX_GET_PRIVATE(o)     (G_TYPE_INSTANCE_GET_PRIVATE ((o), MOKO_TYPE_FINGER_TOOL_BOX, MokoFingerToolBoxPrivate))
+
+typedef struct _MokoFingerToolBoxPrivate
+{
+    MokoPixmapButton* leftarrow;
+    GtkScrolledWindow* toolwindow;
+    GtkHBox* hbox;
+    MokoPixmapButton* rightarrow;
+} MokoFingerToolBoxPrivate;
+
+static void moko_finger_tool_box_size_request  (GtkWidget      *widget,
+                    GtkRequisition *requisition);
+static void moko_finger_tool_box_size_allocate (GtkWidget      *widget,
+                    GtkAllocation  *allocation);
+
+static void
+moko_finger_tool_box_dispose (GObject *object)
+{
+    if (G_OBJECT_CLASS (moko_finger_tool_box_parent_class)->dispose)
+        G_OBJECT_CLASS (moko_finger_tool_box_parent_class)->dispose (object);
+}
+
+static void
+moko_finger_tool_box_finalize (GObject *object)
+{
+    G_OBJECT_CLASS (moko_finger_tool_box_parent_class)->finalize (object);
+}
+
+static void
+moko_finger_tool_box_class_init (MokoFingerToolBoxClass *klass)
+{
+    GObjectClass *object_class = G_OBJECT_CLASS (klass);
+
+    /* register private data */
+    g_type_class_add_private (klass, sizeof (MokoFingerToolBoxPrivate));
+
+    GtkWidgetClass *widget_class = (GtkWidgetClass*) klass;
+
+    widget_class->size_request = moko_finger_tool_box_size_request;
+    widget_class->size_allocate = moko_finger_tool_box_size_allocate;
+
+    /* install properties */
+    /* ... */
+
+    object_class->dispose = moko_finger_tool_box_dispose;
+    object_class->finalize = moko_finger_tool_box_finalize;
+}
+
+static void
+moko_finger_tool_box_init (MokoFingerToolBox *self)
+{
+    MokoFingerToolBoxPrivate* priv = MOKO_FINGER_TOOL_BOX_GET_PRIVATE(self);
+    priv->leftarrow = MOKO_PIXMAP_BUTTON( moko_pixmap_button_new() );
+    gtk_widget_set_name( GTK_WIDGET(priv->leftarrow), "mokofingertoolbox-leftarrow" );
+    priv->rightarrow = MOKO_PIXMAP_BUTTON( moko_pixmap_button_new() );
+    gtk_widget_set_name( GTK_WIDGET(priv->rightarrow), "mokofingertoolbox-rightarrow" );
+
+    gtk_box_pack_start( GTK_BOX(self), priv->leftarrow, FALSE, FALSE, 0 );
+    gtk_box_pack_start( GTK_BOX(self), priv->toolwindow, TRUE, TRUE, 0 );
+    gtk_box_pack_start( GTK_BOX(self), priv->rightarrow, FALSE, FALSE, 0 );
+
+    gtk_widget_show_all( priv->toolwindow );
+}
+
+static void
+moko_finger_tool_box_size_request (GtkWidget *widget, GtkRequisition *requisition)
+{
+    GtkBox *box;
+    GtkBoxChild *child;
+    GList *children;
+    gint nvis_children;
+    gint width;
+
+    box = GTK_BOX (widget);
+    requisition->width = 0;
+    requisition->height = 0;
+    nvis_children = 0;
+
+    children = box->children;
+    while (children)
+    {
+        g_debug( "current req width = %d", requisition->width );
+        child = children->data;
+        children = children->next;
+
+        if (GTK_WIDGET_VISIBLE (child->widget))
+        {
+            GtkRequisition child_requisition;
+
+            gtk_widget_size_request (child->widget, &child_requisition);
+
+            if (box->homogeneous)
+            {
+                width = child_requisition.width + child->padding * 2;
+                requisition->width = MAX (requisition->width, width);
+            }
+            else
+            {
+                requisition->width += child_requisition.width + child->padding * 2;
+            }
+
+            requisition->height = MAX (requisition->height, child_requisition.height);
+
+            nvis_children += 1;
+        }
+    }
+
+    if (nvis_children > 0)
+    {
+        if (box->homogeneous)
+            requisition->width *= nvis_children;
+        requisition->width += (nvis_children - 1) * box->spacing;
+    }
+
+    requisition->width += GTK_CONTAINER (box)->border_width * 2;
+    requisition->height += GTK_CONTAINER (box)->border_width * 2;
+}
+
+static void
+moko_finger_tool_box_size_allocate(GtkWidget *widget, GtkAllocation *allocation)
+{
+    GtkBox *box;
+    GtkBoxChild *child;
+    GList *children;
+    GtkAllocation child_allocation;
+    gint nvis_children;
+    gint nexpand_children;
+    gint child_width;
+    gint width;
+    gint extra;
+    gint x;
+    GtkTextDirection direction;
+
+    box = GTK_BOX (widget);
+    widget->allocation = *allocation;
+
+    direction = gtk_widget_get_direction (widget);
+
+    nvis_children = 0;
+    nexpand_children = 0;
+    children = box->children;
+
+    while (children)
+    {
+        child = children->data;
+        children = children->next;
+
+        if (GTK_WIDGET_VISIBLE (child->widget))
+        {
+            nvis_children += 1;
+            if (child->expand)
+                nexpand_children += 1;
+        }
+    }
+
+    if (nvis_children > 0)
+    {
+        if (box->homogeneous)
+        {
+            width = (allocation->width -
+                    GTK_CONTAINER (box)->border_width * 2 -
+                    (nvis_children - 1) * box->spacing);
+            extra = width / nvis_children;
+        }
+        else if (nexpand_children > 0)
+        {
+            width = (gint) allocation->width - (gint) widget->requisition.width;
+            extra = width / nexpand_children;
+        }
+        else
+        {
+            width = 0;
+            extra = 0;
+        }
+
+        x = allocation->x + GTK_CONTAINER (box)->border_width;
+        child_allocation.y = allocation->y + GTK_CONTAINER (box)->border_width;
+        child_allocation.height = MAX (1, (gint) allocation->height - (gint) GTK_CONTAINER (box)->border_width * 2);
+
+        children = box->children;
+        while (children)
+        {
+            child = children->data;
+            children = children->next;
+
+            if ((child->pack == GTK_PACK_START) && GTK_WIDGET_VISIBLE (child->widget))
+            {
+                if (box->homogeneous)
+                {
+                    if (nvis_children == 1)
+                        child_width = width;
+                    else
+                        child_width = extra;
+
+                    nvis_children -= 1;
+                    width -= extra;
+                }
+                else
+                {
+                    GtkRequisition child_requisition;
+
+                    gtk_widget_get_child_requisition (child->widget, &child_requisition);
+
+                    child_width = child_requisition.width + child->padding * 2;
+
+                    if (child->expand)
+                    {
+                        if (nexpand_children == 1)
+                            child_width += width;
+                        else
+                            child_width += extra;
+
+                        nexpand_children -= 1;
+                        width -= extra;
+                    }
+                }
+
+                if (child->fill)
+                {
+                    child_allocation.width = MAX (1, (gint) child_width - (gint) child->padding * 2);
+                    child_allocation.x = x + child->padding;
+                }
+                else
+                {
+                    GtkRequisition child_requisition;
+
+                    gtk_widget_get_child_requisition (child->widget, &child_requisition);
+                    child_allocation.width = child_requisition.width;
+                    child_allocation.x = x + (child_width - child_allocation.width) / 2;
+                }
+
+                if (direction == GTK_TEXT_DIR_RTL)
+                    child_allocation.x = allocation->x + allocation->width - (child_allocation.x - allocation->x) - child_allocation.width;
+
+                gtk_widget_size_allocate (child->widget, &child_allocation);
+
+                x += child_width + box->spacing;
+            }
+        }
+
+        x = allocation->x + allocation->width - GTK_CONTAINER (box)->border_width;
+
+        children = box->children;
+        while (children)
+        {
+            child = children->data;
+            children = children->next;
+
+            if ((child->pack == GTK_PACK_END) && GTK_WIDGET_VISIBLE (child->widget))
+            {
+                GtkRequisition child_requisition;
+                gtk_widget_get_child_requisition (child->widget, &child_requisition);
+
+                if (box->homogeneous)
+                {
+                    if (nvis_children == 1)
+                        child_width = width;
+                    else
+                        child_width = extra;
+
+                    nvis_children -= 1;
+                    width -= extra;
+                }
+                else
+                {
+                    child_width = child_requisition.width + child->padding * 2;
+
+                    if (child->expand)
+                    {
+                        if (nexpand_children == 1)
+                            child_width += width;
+                        else
+                            child_width += extra;
+
+                        nexpand_children -= 1;
+                        width -= extra;
+                    }
+                }
+
+                if (child->fill)
+                {
+                    child_allocation.width = MAX (1, (gint)child_width - (gint)child->padding * 2);
+                    child_allocation.x = x + child->padding - child_width;
+                }
+                else
+                {
+                    child_allocation.width = child_requisition.width;
+                    child_allocation.x = x + (child_width - child_allocation.width) / 2 - child_width;
+                }
+
+                if (direction == GTK_TEXT_DIR_RTL)
+                    child_allocation.x = allocation->x + allocation->width - (child_allocation.x - allocation->x) - child_allocation.width;
+
+                gtk_widget_size_allocate (child->widget, &child_allocation);
+
+                x -= (child_width + box->spacing);
+            }
+        }
+    }
+}
+
+/* public API */
+
+GtkWidget*
+moko_finger_tool_box_new (void)
+{
+    return GTK_WIDGET(g_object_new(moko_finger_tool_box_get_type(), NULL));
+}
+
+GtkButton*
+moko_finger_tool_box_add_button(MokoFingerToolBox* self)
+{
+    MokoFingerToolBoxPrivate* priv = MOKO_FINGER_TOOL_BOX_GET_PRIVATE(self);
+
+    MokoPixmapButton* b = moko_pixmap_button_new();
+    gtk_widget_set_name( GTK_WIDGET(b), "mokofingertoolbox-toolbutton" );
+
+    gtk_box_pack_start( GTK_BOX(self), b, FALSE, FALSE, 10 );
+    gtk_widget_show( GTK_WIDGET(b) );
+    return b;
+}


Property changes on: trunk/src/target/OM-2007/openmoko-libs/libmokoui/moko-finger-tool-box.c
___________________________________________________________________
Name: svn:eol-style
   + native

Added: trunk/src/target/OM-2007/openmoko-libs/libmokoui/moko-finger-tool-box.h
===================================================================
--- trunk/src/target/OM-2007/openmoko-libs/libmokoui/moko-finger-tool-box.h	2006-11-16 16:37:12 UTC (rev 229)
+++ trunk/src/target/OM-2007/openmoko-libs/libmokoui/moko-finger-tool-box.h	2006-11-17 00:40:38 UTC (rev 230)
@@ -0,0 +1,53 @@
+/*  moko-finger-tool-box.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_FINGER_TOOL_BOX_H_
+#define _MOKO_FINGER_TOOL_BOX_H_
+
+#include <gtk/gtkbutton.h>
+#include <gtk/gtkhbox.h>
+
+#include <glib-object.h>
+
+G_BEGIN_DECLS
+
+#define MOKO_TYPE_FINGER_TOOL_BOX moko_finger_tool_box_get_type()
+#define MOKO_FINGER_TOOL_BOX(obj)     (G_TYPE_CHECK_INSTANCE_CAST ((obj),     MOKO_TYPE_FINGER_TOOL_BOX, MokoFingerToolBox))
+#define MOKO_FINGER_TOOL_BOX_CLASS(klass)     (G_TYPE_CHECK_CLASS_CAST ((klass),     MOKO_TYPE_FINGER_TOOL_BOX, MokoFingerToolBoxClass))
+#define MOKO_IS_FINGER_TOOL_BOX(obj)     (G_TYPE_CHECK_INSTANCE_TYPE ((obj),     MOKO_TYPE_FINGER_TOOL_BOX))
+#define MOKO_IS_FINGER_TOOL_BOX_CLASS(klass)     (G_TYPE_CHECK_CLASS_TYPE ((klass),     MOKO_TYPE_FINGER_TOOL_BOX))
+#define MOKO_FINGER_TOOL_BOX_GET_CLASS(obj)     (G_TYPE_INSTANCE_GET_CLASS ((obj),     MOKO_TYPE_FINGER_TOOL_BOX, MokoFingerToolBoxClass))
+
+typedef struct {
+    GtkHBox parent;
+} MokoFingerToolBox;
+
+typedef struct {
+    GtkHBoxClass parent_class;
+} MokoFingerToolBoxClass;
+
+GType moko_finger_tool_box_get_type (void);
+
+GtkWidget* moko_finger_tool_box_new (void);
+
+GtkButton* moko_finger_tool_box_add_button(MokoFingerToolBox* self);
+
+G_END_DECLS
+
+#endif // _MOKO_FINGER_TOOL_BOX_H_
+


Property changes on: trunk/src/target/OM-2007/openmoko-libs/libmokoui/moko-finger-tool-box.h
___________________________________________________________________
Name: svn:eol-style
   + native

Modified: trunk/src/target/OM-2007/openmoko-libs/libmokoui/moko-fixed.c
===================================================================
--- trunk/src/target/OM-2007/openmoko-libs/libmokoui/moko-fixed.c	2006-11-16 16:37:12 UTC (rev 229)
+++ trunk/src/target/OM-2007/openmoko-libs/libmokoui/moko-fixed.c	2006-11-17 00:40:38 UTC (rev 230)
@@ -90,10 +90,10 @@
     gtk_fixed_set_has_window( self, TRUE );
 }
 
-MokoFixed*
+GtkWidget*
 moko_fixed_new (void)
 {
-    return g_object_new(MOKO_TYPE_FIXED, NULL);
+    return GTK_WIDGET(g_object_new(moko_fixed_get_type(), NULL));
 }
 
 static void

Modified: trunk/src/target/OM-2007/openmoko-libs/libmokoui/moko-fixed.h
===================================================================
--- trunk/src/target/OM-2007/openmoko-libs/libmokoui/moko-fixed.h	2006-11-16 16:37:12 UTC (rev 229)
+++ trunk/src/target/OM-2007/openmoko-libs/libmokoui/moko-fixed.h	2006-11-17 00:40:38 UTC (rev 230)
@@ -47,7 +47,7 @@
 
 GType moko_fixed_get_type (void);
 
-MokoFixed* moko_fixed_new (void);
+GtkWidget* moko_fixed_new (void);
 
 void moko_fixed_set_cargo(MokoFixed* self, GtkWidget* child);
 

Modified: trunk/src/target/OM-2007/openmoko-libs/libmokoui/moko-menu-box.c
===================================================================
--- trunk/src/target/OM-2007/openmoko-libs/libmokoui/moko-menu-box.c	2006-11-16 16:37:12 UTC (rev 229)
+++ trunk/src/target/OM-2007/openmoko-libs/libmokoui/moko-menu-box.c	2006-11-17 00:40:38 UTC (rev 230)
@@ -47,32 +47,8 @@
 
 static guint moko_menu_box_signals[LAST_SIGNAL] = { 0, };
 
-GType moko_menu_box_get_type (void) /* Typechecking */
-{
-    static GType self_type = 0;
+G_DEFINE_TYPE (MokoMenuBox, moko_menu_box, GTK_TYPE_HBOX)
 
-    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));

Modified: trunk/src/target/OM-2007/openmoko-libs/libmokoui/moko-pixmap-button.c
===================================================================
--- trunk/src/target/OM-2007/openmoko-libs/libmokoui/moko-pixmap-button.c	2006-11-16 16:37:12 UTC (rev 229)
+++ trunk/src/target/OM-2007/openmoko-libs/libmokoui/moko-pixmap-button.c	2006-11-17 00:40:38 UTC (rev 230)
@@ -176,10 +176,10 @@
 }
 
 /* public API */
-MokoPixmapButton*
+GtkWidget*
 moko_pixmap_button_new (void)
 {
-    return g_object_new (MOKO_TYPE_PIXMAP_BUTTON, NULL);
+    return GTK_WIDGET(g_object_new(moko_pixmap_button_get_type(), NULL));
 }
 
 void

Modified: trunk/src/target/OM-2007/openmoko-libs/libmokoui/moko-pixmap-button.h
===================================================================
--- trunk/src/target/OM-2007/openmoko-libs/libmokoui/moko-pixmap-button.h	2006-11-16 16:37:12 UTC (rev 229)
+++ trunk/src/target/OM-2007/openmoko-libs/libmokoui/moko-pixmap-button.h	2006-11-17 00:40:38 UTC (rev 230)
@@ -43,7 +43,7 @@
 
 GType moko_pixmap_button_get_type(void);
 
-MokoPixmapButton* moko_pixmap_button_new(void);
+GtkWidget* moko_pixmap_button_new(void);
 void moko_pixmap_button_set_menu(MokoPixmapButton* self, GtkMenu* menu);
 
 G_END_DECLS

Modified: trunk/src/target/OM-2007/openmoko-libs/libmokoui/moko-tree-view.c
===================================================================
--- trunk/src/target/OM-2007/openmoko-libs/libmokoui/moko-tree-view.c	2006-11-16 16:37:12 UTC (rev 229)
+++ trunk/src/target/OM-2007/openmoko-libs/libmokoui/moko-tree-view.c	2006-11-17 00:40:38 UTC (rev 230)
@@ -67,16 +67,16 @@
     gtk_tree_view_set_headers_visible( GTK_TREE_VIEW(self), TRUE );
 }
 
-MokoTreeView*
+GtkWidget*
 moko_tree_view_new (void)
 {
-    return g_object_new (MOKO_TYPE_TREE_VIEW, NULL);
+    return GTK_WIDGET(g_object_new(moko_tree_view_get_type(), NULL));
 }
 
-MokoTreeView*
+GtkWidget*
 moko_tree_view_new_with_model (GtkTreeModel *model)
 {
-    return g_object_new (MOKO_TYPE_TREE_VIEW, "model", model, NULL);
+    return GTK_WIDGET(g_object_new(moko_tree_view_get_type(), "model", model, NULL));
 }
 
 GtkTreeViewColumn* moko_tree_view_append_column_new_with_name(MokoTreeView* self, gchar* name)

Modified: trunk/src/target/OM-2007/openmoko-libs/libmokoui/moko-tree-view.h
===================================================================
--- trunk/src/target/OM-2007/openmoko-libs/libmokoui/moko-tree-view.h	2006-11-16 16:37:12 UTC (rev 229)
+++ trunk/src/target/OM-2007/openmoko-libs/libmokoui/moko-tree-view.h	2006-11-17 00:40:38 UTC (rev 230)
@@ -42,7 +42,8 @@
 } MokoTreeViewClass;
 
 GType moko_tree_view_get_type (void);
-MokoTreeView* moko_tree_view_new (void);
+GtkWidget* moko_tree_view_new (void);
+GtkWidget* moko_tree_view_new_with_model(GtkTreeModel* model);
 
 GtkTreeViewColumn* moko_tree_view_append_column_new_with_name(MokoTreeView* self, gchar* name);
 GtkScrolledWindow* moko_tree_view_put_into_scrolled_window(MokoTreeView* self);





More information about the commitlog mailing list