diff options
author | randomguy3 <randomguy3@7c02a99a-9b00-45e3-bf44-6f3dd7fddb64> | 2012-01-10 15:40:11 +0000 |
---|---|---|
committer | randomguy3 <randomguy3@7c02a99a-9b00-45e3-bf44-6f3dd7fddb64> | 2012-01-10 15:40:11 +0000 |
commit | 87294b7ebc03156f223052ca2a6c70463df568f0 (patch) | |
tree | 7200a2cb348b18c8d255931058ffab260f4225c3 /tikzit/src/linux/NodeStyleSelector.m | |
parent | c372b719b84a320f6fb7cab6dc0d1ab94beacd78 (diff) |
GTK: Edge style support
git-svn-id: https://tikzit.svn.sourceforge.net/svnroot/tikzit/trunk@375 7c02a99a-9b00-45e3-bf44-6f3dd7fddb64
Diffstat (limited to 'tikzit/src/linux/NodeStyleSelector.m')
-rw-r--r-- | tikzit/src/linux/NodeStyleSelector.m | 48 |
1 files changed, 22 insertions, 26 deletions
diff --git a/tikzit/src/linux/NodeStyleSelector.m b/tikzit/src/linux/NodeStyleSelector.m index 5539b93..395d9ca 100644 --- a/tikzit/src/linux/NodeStyleSelector.m +++ b/tikzit/src/linux/NodeStyleSelector.m @@ -23,8 +23,9 @@ #import "ShapeNames.h" #import "StyleManager.h" -#import "gdk-pixbuf/gdk-pixbuf.h" +#import <gdk-pixbuf/gdk-pixbuf.h> +// {{{ Internal interfaces // {{{ Signals static void selection_changed_cb (GtkIconView *widget, NodeStyleSelector *mgr); // }}} @@ -56,7 +57,9 @@ enum { - (void) reloadStyles; @end +// }}} // {{{ API + @implementation NodeStyleSelector - (id) init { @@ -64,17 +67,7 @@ enum { return self; } -- (id) initWithIconView:(GtkIconView*)view { - self = [self initWithIconView:GTK_ICON_VIEW (gtk_icon_view_new ()) andStyleManager:[StyleManager manager]]; - return self; -} - - (id) initWithStyleManager:(StyleManager*)m { - self = [self initWithIconView:GTK_ICON_VIEW (gtk_icon_view_new ()) andStyleManager:m]; - return self; -} - -- (id) initWithIconView:(GtkIconView*)v andStyleManager:(StyleManager*)m { self = [super init]; if (self) { @@ -87,7 +80,7 @@ enum { G_TYPE_POINTER); g_object_ref (store); - view = v; + view = GTK_ICON_VIEW (gtk_icon_view_new ()); g_object_ref (view); gtk_icon_view_set_model (view, GTK_TREE_MODEL (store)); @@ -115,6 +108,16 @@ enum { return self; } +- (void) dealloc { + [[NSNotificationCenter defaultCenter] removeObserver:self]; + g_object_unref (view); + [self clearModel]; + g_object_unref (store); + [styleManager release]; + + [super dealloc]; +} + - (void) clearModel { [self setSelectedStyle:nil]; GtkTreeModel *model = GTK_TREE_MODEL (store); @@ -226,20 +229,11 @@ enum { } } -- (void) dealloc { - [[NSNotificationCenter defaultCenter] removeObserver:self]; - g_object_unref (view); - [self clearModel]; - g_object_unref (store); - [styleManager release]; - - [super dealloc]; -} - @end -// }}} +// }}} // {{{ Notifications + @implementation NodeStyleSelector (Notifications) - (void) stylesReplaced:(NSNotification*)notification { @@ -313,9 +307,10 @@ enum { [self postSelectedStyleChanged]; } @end -// }}} +// }}} // {{{ Private + @implementation NodeStyleSelector (Private) - (cairo_surface_t*) createNodeIconSurface { return cairo_image_surface_create (CAIRO_FORMAT_ARGB32, 24, 24); @@ -416,9 +411,10 @@ enum { } } @end -// }}} +// }}} // {{{ GTK+ callbacks + static void selection_changed_cb (GtkIconView *view, NodeStyleSelector *mgr) { NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; [mgr selectionChanged]; @@ -426,4 +422,4 @@ static void selection_changed_cb (GtkIconView *view, NodeStyleSelector *mgr) { } // }}} -// vim:ft=objc:ts=8:et:sts=4:sw=4 +// vim:ft=objc:ts=8:et:sts=4:sw=4:foldmethod=marker |