[monet/monet-xml] Add support for toolbars



commit 31b4ae01e265cdef13d676a6bdd772b2d15f9150
Author: Thomas Wood <thos gnome org>
Date:   Sun Jul 25 16:30:00 2010 +0100

    Add support for toolbars

 monet-gtk/monet.xml |    9 +++++++++
 monet-gtk/style.c   |   13 +++++++++++--
 monet/mn-config.c   |    4 ++++
 monet/mn-config.h   |    1 +
 monet/mn-style.c    |   18 ++++++++++++++++++
 monet/mn-style.h    |    9 +++++++++
 6 files changed, 52 insertions(+), 2 deletions(-)
---
diff --git a/monet-gtk/monet.xml b/monet-gtk/monet.xml
index d43c535..f692b03 100644
--- a/monet-gtk/monet.xml
+++ b/monet-gtk/monet.xml
@@ -45,4 +45,13 @@
   </rect>
 </widget>
 
+<widget type="tool-bar">
+  <rect x="0" y="0" width="width-2" height="height-2" stroke="#000" stroke-width="1">
+    <stroke-gradient x1="0" y1="0" x2="0" y2="20">
+      <stop color="#fff" position="0"/>
+      <stop color="#000" position="1"/>
+    </stroke-gradient>
+  </rect>
+</widget>
+
 </monet>
diff --git a/monet-gtk/style.c b/monet-gtk/style.c
index 1c83116..bd70983 100644
--- a/monet-gtk/style.c
+++ b/monet-gtk/style.c
@@ -304,9 +304,18 @@ monet_gtk_draw_box (GtkStyle      *style,
       mn_style_paint_menu_bar (mn_style, cr, x, y, width, height, mn_palette,
                                mn_state, mn_flags);
     }
+  else if (DETAIL ("toolbar"))
+    {
+      mn_style_paint_tool_bar (mn_style, cr, x, y, width, height, mn_palette,
+                               mn_state, mn_flags);
+    }
   else
-    monet_gtk_style_parent_class->draw_box (style, window, state_type, shadow_type, area, widget, detail, x, y, width, height);
-
+    {
+      g_debug ("draw_box detail not handled: \"%s\"", detail);
+      monet_gtk_style_parent_class->draw_box (style, window, state_type,
+                                              shadow_type, area, widget,
+                                              detail, x, y, width, height);
+    }
 
   cairo_destroy (cr);
 }
diff --git a/monet/mn-config.c b/monet/mn-config.c
index 1bce4a9..a5acc7c 100644
--- a/monet/mn-config.c
+++ b/monet/mn-config.c
@@ -88,6 +88,8 @@ mn_config_finalize (GObject *object)
 
   mn_config_free_ops (config->menu_bar_ops);
 
+  mn_config_free_ops (config->tool_bar_ops);
+
   G_OBJECT_CLASS (mn_config_parent_class)->finalize (object);
 }
 
@@ -406,6 +408,8 @@ monet_start_element (GMarkupParseContext  *context,
         ops = &config->menu_item_ops[wstate];
       else if (!strcmp (type, "menu-bar"))
         ops = &config->menu_bar_ops[wstate];
+      else if (!strcmp (type, "tool-bar"))
+        ops = &config->tool_bar_ops[wstate];
 
       g_markup_parse_context_push (context, &widget_parser, ops);
     }
diff --git a/monet/mn-config.h b/monet/mn-config.h
index ed2753b..e6b7147 100644
--- a/monet/mn-config.h
+++ b/monet/mn-config.h
@@ -65,6 +65,7 @@ struct _MnConfig
   GSList *menu_ops[4];
   GSList *menu_item_ops[4];
   GSList *menu_bar_ops[4];
+  GSList *tool_bar_ops[4];
 };
 
 struct _MnConfigClass
diff --git a/monet/mn-style.c b/monet/mn-style.c
index 60b5587..43a69ac 100644
--- a/monet/mn-style.c
+++ b/monet/mn-style.c
@@ -448,3 +448,21 @@ mn_style_paint_menu_bar (MnStyle   *style,
 
   mn_style_draw_ops (style, ops, cr, x, y, width, height, colors, state, flags);
 }
+
+void
+mn_style_paint_tool_bar (MnStyle   *style,
+                         cairo_t   *cr,
+                         gdouble    x,
+                         gdouble    y,
+                         gdouble    width,
+                         gdouble    height,
+                         MnPalette *colors,
+                         MnState    state,
+                         MnFlags    flags)
+{
+  GSList **ops;
+
+  ops = style->priv->config->tool_bar_ops;
+
+  mn_style_draw_ops (style, ops, cr, x, y, width, height, colors, state, flags);
+}
diff --git a/monet/mn-style.h b/monet/mn-style.h
index 9fcf8fe..c748289 100644
--- a/monet/mn-style.h
+++ b/monet/mn-style.h
@@ -224,6 +224,15 @@ void mn_style_paint_scroll_bar   (MnStyle *style,
                                   MnState    state,
                                   MnFlags    flags);
 
+void mn_style_paint_tool_bar     (MnStyle *style,
+                                  cairo_t   *cr,
+                                  gdouble    x,
+                                  gdouble    y,
+                                  gdouble    width,
+                                  gdouble    height,
+                                  MnPalette *colors,
+                                  MnState    state,
+                                  MnFlags    flags);
 
 
 G_END_DECLS



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]