From 22340a8bf97abe934e107069c5ec1dc1d6b97507 Mon Sep 17 00:00:00 2001 From: Aleks Kissinger Date: Mon, 21 May 2012 23:09:50 +0100 Subject: add callback on window resize --- tikzit/src/gtk/PreviewWindow.m | 27 ++++++++++++++++++++++++++- 1 file changed, 26 insertions(+), 1 deletion(-) (limited to 'tikzit/src/gtk/PreviewWindow.m') diff --git a/tikzit/src/gtk/PreviewWindow.m b/tikzit/src/gtk/PreviewWindow.m index 418886e..6126bc1 100644 --- a/tikzit/src/gtk/PreviewWindow.m +++ b/tikzit/src/gtk/PreviewWindow.m @@ -29,6 +29,12 @@ @end // {{{ API +// {{{ Signals +static gboolean window_configure_event_cb (GtkWindow *window, + GdkEvent *event, + PreviewWindow *preview); +// }}} + @implementation PreviewWindow - (id) init { @@ -46,11 +52,15 @@ window = GTK_WINDOW (gtk_window_new (GTK_WINDOW_TOPLEVEL)); gtk_window_set_title (window, "Preview"); - gtk_window_set_resizable (window, FALSE); + //gtk_window_set_resizable (window, FALSE); g_signal_connect (G_OBJECT (window), "delete-event", G_CALLBACK (gtk_widget_hide_on_delete), NULL); + g_signal_connect (G_OBJECT(window), + "configure-event", + G_CALLBACK (window_configure_event_cb), + self); GtkWidget *pdfArea = gtk_drawing_area_new (); gtk_container_add (GTK_CONTAINER (window), pdfArea); @@ -107,6 +117,10 @@ return NO; } +- (void) resize { + NSLog(@"got that resize event!"); +} + - (void) show { if ([self updateOrShowError]) { [self updateSize]; @@ -188,4 +202,15 @@ } @end +// {{{ GTK+ callbacks +static gboolean window_configure_event_cb (GtkWindow *window, + GdkEvent *event, + PreviewWindow *preview) { + NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; + [preview resize]; + [pool drain]; + return TRUE; // we dealt with this event +} +// }}} + // vim:ft=objc:ts=8:et:sts=4:sw=4 -- cgit v1.2.3