1
/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2
/* vim:expandtab:shiftwidth=4:tabstop=4:
4
#include <gtk/gtkmain.h>
5
#include <gtk/gtkwindow.h>
6
#include <gtk/gtkvscrollbar.h>
7
#include <gtk/gtkbutton.h>
8
#include <gtk/gtkcontainer.h>
9
#include <gtk/gtksignal.h>
10
#include <gdk/gdkwindow.h>
12
#include "mozcontainer.h"
13
#include "mozdrawingarea.h"
17
GtkWidget *toplevel_window = NULL;
18
GtkWidget *moz_container = NULL;
19
MozDrawingarea *drawingarea1 = NULL;
20
GtkWidget *button = NULL;
21
GtkWidget *scrollbar = NULL;
24
expose_handler (GtkWidget *widget, GdkEventExpose *event);
27
size_allocate_handler (GtkWidget *widget, GtkAllocation *allocation);
29
int main(int argc, char **argv)
31
gtk_init(&argc, &argv);
33
// gdk_window_set_debug_updates(TRUE);
35
toplevel_window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
36
printf("toplevel window is %p\n", toplevel_window);
38
moz_container = moz_container_new();
39
printf("moz_container is %p\n", moz_container);
40
gtk_signal_connect(GTK_OBJECT(moz_container), "expose_event",
41
GTK_SIGNAL_FUNC(expose_handler), NULL);
42
gtk_signal_connect(GTK_OBJECT(moz_container), "size_allocate",
43
GTK_SIGNAL_FUNC(size_allocate_handler), NULL);
45
gtk_container_add(GTK_CONTAINER(toplevel_window),
48
gtk_widget_realize(moz_container);
50
drawingarea1 = moz_drawingarea_new (NULL, MOZ_CONTAINER(moz_container));
51
moz_drawingarea_set_visibility (drawingarea1, TRUE);
52
moz_drawingarea_move(drawingarea1, 10, 10);
54
button = gtk_button_new_with_label("foo");
55
scrollbar = gtk_vscrollbar_new(NULL);
57
gtk_widget_set_parent_window(button, drawingarea1->inner_window);
58
gtk_widget_set_parent_window(scrollbar, drawingarea1->inner_window);
60
moz_container_put(MOZ_CONTAINER(moz_container), button, 0, 0);
61
moz_container_put(MOZ_CONTAINER(moz_container), scrollbar, 0, 50);
63
gtk_widget_show(button);
64
gtk_widget_show(scrollbar);
65
gtk_widget_show(toplevel_window);
66
gtk_widget_show(moz_container);
74
expose_handler (GtkWidget *widget, GdkEventExpose *event)
76
printf("expose %p %p %d %d %d %d\n",
87
size_allocate_handler (GtkWidget *widget, GtkAllocation *allocation)
89
printf("size_allocate_handler %p %d %d %d %d\n", widget,
90
allocation->x, allocation->y, allocation->width, allocation->height);
91
moz_drawingarea_resize(drawingarea1, allocation->width, allocation->height);