summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAleks Kissinger <aleks0@gmail.com>2012-05-21 23:09:50 +0100
committerAleks Kissinger <aleks0@gmail.com>2012-05-21 23:09:50 +0100
commit22340a8bf97abe934e107069c5ec1dc1d6b97507 (patch)
tree1fce5932bdc65000c3c7f1fe502cb0f935526ddf
parentec48fc2bcce2483d89eb51a185c5826a8fcc7c6c (diff)
add callback on window resize
-rw-r--r--tikzit/src/gtk/PreviewWindow.h1
-rw-r--r--tikzit/src/gtk/PreviewWindow.m27
2 files changed, 27 insertions, 1 deletions
diff --git a/tikzit/src/gtk/PreviewWindow.h b/tikzit/src/gtk/PreviewWindow.h
index ca6b30c..32c7991 100644
--- a/tikzit/src/gtk/PreviewWindow.h
+++ b/tikzit/src/gtk/PreviewWindow.h
@@ -42,6 +42,7 @@
- (void) show;
- (void) hide;
+- (void) resize;
- (BOOL) isVisible;
- (void) setVisible:(BOOL)visible;
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