diff options
author | Alex Merry <dev@randomguy3.me.uk> | 2012-06-08 19:59:07 +0100 |
---|---|---|
committer | Alex Merry <dev@randomguy3.me.uk> | 2012-06-08 19:59:07 +0100 |
commit | ee3648293706ce512277532951fa015ecfc0ee3e (patch) | |
tree | c58ae3a73fa00bf91d7ea11d19c84ebf53c0f502 /tikzit/src/gtk/WidgetSurface.m | |
parent | 96bb49b438646b54f1a667a66a9bb1b2c27d7b4f (diff) |
Set the cursor when dragging would resize bounding box
This makes it obvious to users when clicking will resize the bounding
box, rather than creating a new one.
Diffstat (limited to 'tikzit/src/gtk/WidgetSurface.m')
-rw-r--r-- | tikzit/src/gtk/WidgetSurface.m | 48 |
1 files changed, 42 insertions, 6 deletions
diff --git a/tikzit/src/gtk/WidgetSurface.m b/tikzit/src/gtk/WidgetSurface.m index 3538f72..14d799b 100644 --- a/tikzit/src/gtk/WidgetSurface.m +++ b/tikzit/src/gtk/WidgetSurface.m @@ -82,6 +82,14 @@ static gboolean scroll_event_cb (GtkWidget *widget, GdkEventScroll *event, Widge return self; } +- (void) dealloc { + [[NSNotificationCenter defaultCenter] removeObserver:self]; + [transformer release]; + g_object_unref (G_OBJECT (widget)); + + [super dealloc]; +} + - (void) invalidateRect:(NSRect)rect { if (!NSIsEmptyRect (rect)) { GdkWindow *window = gtk_widget_get_window (widget); @@ -278,12 +286,40 @@ static gboolean scroll_event_cb (GtkWidget *widget, GdkEventScroll *event, Widge [self zoomTo:defaultScale aboutPoint:p]; } -- (void) dealloc { - [[NSNotificationCenter defaultCenter] removeObserver:self]; - [transformer release]; - g_object_unref (G_OBJECT (widget)); - - [super dealloc]; +- (void) setCursor:(Cursor)c { + GdkWindow *window = gtk_widget_get_window (widget); + GdkCursor *cursor = NULL; + switch (c) { + case ResizeRightCursor: + cursor = gdk_cursor_new (GDK_RIGHT_SIDE); + break; + case ResizeBottomRightCursor: + cursor = gdk_cursor_new (GDK_BOTTOM_RIGHT_CORNER); + break; + case ResizeBottomCursor: + cursor = gdk_cursor_new (GDK_BOTTOM_SIDE); + break; + case ResizeBottomLeftCursor: + cursor = gdk_cursor_new (GDK_BOTTOM_LEFT_CORNER); + break; + case ResizeLeftCursor: + cursor = gdk_cursor_new (GDK_LEFT_SIDE); + break; + case ResizeTopLeftCursor: + cursor = gdk_cursor_new (GDK_TOP_LEFT_CORNER); + break; + case ResizeTopCursor: + cursor = gdk_cursor_new (GDK_TOP_SIDE); + break; + case ResizeTopRightCursor: + cursor = gdk_cursor_new (GDK_TOP_RIGHT_CORNER); + break; + default: break; + } + gdk_window_set_cursor (window, cursor); + if (cursor != NULL) { + gdk_cursor_unref (cursor); + } } @end |