From: <kr_...@us...> - 2003-10-01 21:47:22
|
Update of /cvsroot/htoolkit/port/src/cbits/GTK In directory sc8-pr-cvs1:/tmp/cvs-serv20621 Modified Files: Button.c CheckBox.c EditBox.c GroupBox.c Internals.h Label.c ListBox.c Notebook.c PopUp.c ProgressBar.c RadioBox.c Slider.c Window.c Added Files: LayoutContainer.c LayoutContainer.h Log Message: Added PortLayout widget. The new widget is used insted of GtkFixed in the implementations of all containers in Port. The widget can be placed directly in the GtkScrolledWindow without need of GtkViewport. This makes the implementations of containers simple and more efficient. The PortLayout calls handleContainerReLayout in responce of "size_allocate" event. The new scheme of "size_allocate" handling is more simple and more accurate. --- NEW FILE: LayoutContainer.c --- #include "LayoutContainer.h" #include "Handlers_stub.h" enum { PROP_0, PROP_HADJUSTMENT, PROP_VADJUSTMENT, PROP_WIDTH, PROP_HEIGHT }; static void port_layout_class_init (PortLayoutClass *class); static void port_layout_get_property (GObject *object, guint prop_id, GValue *value, GParamSpec *pspec); static void port_layout_set_property (GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec); static GObject *port_layout_constructor (GType type, guint n_properties, GObjectConstructParam *properties); static void port_layout_init (PortLayout *layout); static void port_layout_finalize (GObject *object); static void port_layout_realize (GtkWidget *widget); static void port_layout_unrealize (GtkWidget *widget); static void port_layout_map (GtkWidget *widget); static void port_layout_size_request (GtkWidget *widget, GtkRequisition *requisition); static void port_layout_size_allocate (GtkWidget *widget, GtkAllocation *allocation); static gint port_layout_expose (GtkWidget *widget, GdkEventExpose *event); static void port_layout_remove (GtkContainer *container, GtkWidget *widget); static void port_layout_forall (GtkContainer *container, gboolean include_internals, GtkCallback callback, gpointer callback_data); static void port_layout_set_adjustments (PortLayout *layout, GtkAdjustment *hadj, GtkAdjustment *vadj); static void port_layout_adjustment_changed (GtkAdjustment *adjustment, PortLayout *layout); static void port_layout_style_set(GtkWidget *widget, GtkStyle *old_style); static void port_layout_set_adjustment_upper (GtkAdjustment *adj, gdouble upper, gboolean always_emit_changed); static GtkWidgetClass *parent_class = NULL; GtkWidget* port_layout_new (GtkAdjustment *hadjustment, GtkAdjustment *vadjustment) { GtkLayout *layout; layout = g_object_new (PORT_TYPE_LAYOUT, "hadjustment", hadjustment, "vadjustment", vadjustment, NULL); return GTK_WIDGET (layout); } GtkAdjustment* port_layout_get_hadjustment (PortLayout *layout) { g_return_val_if_fail (PORT_IS_LAYOUT (layout), NULL); return layout->hadjustment; } GtkAdjustment* port_layout_get_vadjustment (PortLayout *layout) { g_return_val_if_fail (PORT_IS_LAYOUT (layout), NULL); return layout->vadjustment; } static GtkAdjustment *new_default_adjustment (void) { return GTK_ADJUSTMENT(gtk_adjustment_new (0.0, 0.0, 0.0, 0.0, 0.0, 0.0)); } static void port_layout_set_adjustments (PortLayout *layout, GtkAdjustment *hadj, GtkAdjustment *vadj) { gboolean need_adjust = FALSE; g_return_if_fail (PORT_IS_LAYOUT (layout)); if (hadj) g_return_if_fail (GTK_IS_ADJUSTMENT (hadj)); else if (layout->hadjustment) hadj = new_default_adjustment (); if (vadj) g_return_if_fail (GTK_IS_ADJUSTMENT (vadj)); else if (layout->vadjustment) vadj = new_default_adjustment (); if (layout->hadjustment && (layout->hadjustment != hadj)) { g_signal_handlers_disconnect_by_func (layout->hadjustment, port_layout_adjustment_changed, layout); g_object_unref (layout->hadjustment); } if (layout->vadjustment && (layout->vadjustment != vadj)) { g_signal_handlers_disconnect_by_func (layout->vadjustment, port_layout_adjustment_changed, layout); g_object_unref (layout->vadjustment); } if (layout->hadjustment != hadj) { layout->hadjustment = hadj; g_object_ref (layout->hadjustment); gtk_object_sink (GTK_OBJECT (layout->hadjustment)); port_layout_set_adjustment_upper (layout->hadjustment, layout->width, FALSE); g_signal_connect (layout->hadjustment, "value_changed", G_CALLBACK (port_layout_adjustment_changed), layout); need_adjust = TRUE; } if (layout->vadjustment != vadj) { layout->vadjustment = vadj; g_object_ref (layout->vadjustment); gtk_object_sink (GTK_OBJECT (layout->vadjustment)); port_layout_set_adjustment_upper (layout->vadjustment, layout->height, FALSE); g_signal_connect (layout->vadjustment, "value_changed", G_CALLBACK (port_layout_adjustment_changed), layout); need_adjust = TRUE; } /* vadj or hadj can be NULL while constructing; don't emit a signal then */ if (need_adjust && vadj && hadj) port_layout_adjustment_changed (NULL, layout); } static void port_layout_finalize (GObject *object) { PortLayout *layout = PORT_LAYOUT (object); g_object_unref (layout->hadjustment); g_object_unref (layout->vadjustment); G_OBJECT_CLASS (parent_class)->finalize (object); } void port_layout_set_hadjustment(PortLayout *layout, GtkAdjustment *adjustment) { g_return_if_fail (PORT_IS_LAYOUT (layout)); port_layout_set_adjustments (layout, adjustment, layout->vadjustment); g_object_notify (G_OBJECT (layout), "hadjustment"); } void port_layout_set_vadjustment (PortLayout *layout, GtkAdjustment *adjustment) { g_return_if_fail (PORT_IS_LAYOUT (layout)); port_layout_set_adjustments (layout, layout->hadjustment, adjustment); g_object_notify (G_OBJECT (layout), "vadjustment"); } void port_layout_put (PortLayout *layout, GtkWidget *child_widget) { g_return_if_fail (PORT_IS_LAYOUT (layout)); g_return_if_fail (GTK_IS_WIDGET (child_widget)); layout->children = g_list_append (layout->children, child_widget); if (GTK_WIDGET_REALIZED (layout)) gtk_widget_set_parent_window (child_widget, layout->bin_window); gtk_widget_set_parent (child_widget, GTK_WIDGET (layout)); } static void port_layout_set_adjustment_upper (GtkAdjustment *adj, gdouble upper, gboolean always_emit_changed) { gboolean changed = FALSE; gboolean value_changed = FALSE; gdouble min = MAX (0., upper - adj->page_size); if (upper != adj->upper) { adj->upper = upper; changed = TRUE; } if (adj->value > min) { adj->value = min; value_changed = TRUE; } if (changed || always_emit_changed) gtk_adjustment_changed (adj); if (value_changed) gtk_adjustment_value_changed (adj); } void port_layout_set_domain(PortLayout *layout, guint width, guint height) { GtkWidget *widget; g_return_if_fail (PORT_IS_LAYOUT (layout)); widget = GTK_WIDGET (layout); g_object_freeze_notify (G_OBJECT (layout)); if (width != layout->width) { layout->width = width; g_object_notify (G_OBJECT (layout), "width"); } if (height != layout->height) { layout->height = height; g_object_notify (G_OBJECT (layout), "height"); } g_object_thaw_notify (G_OBJECT (layout)); if (layout->hadjustment) port_layout_set_adjustment_upper (layout->hadjustment, layout->width, FALSE); if (layout->vadjustment) port_layout_set_adjustment_upper (layout->vadjustment, layout->height, FALSE); if (GTK_WIDGET_REALIZED (layout)) { width = MAX (width, widget->allocation.width); height = MAX (height, widget->allocation.height); gdk_window_resize (layout->bin_window, width, height); } } void port_layout_get_domain(PortLayout *layout, guint *width, guint *height) { g_return_if_fail (PORT_IS_LAYOUT (layout)); if (width) *width = layout->width; if (height) *height = layout->height; } /* Basic Object handling procedures */ GType port_layout_get_type (void) { static GType layout_type = 0; if (!layout_type) { static const GTypeInfo layout_info = { sizeof (PortLayoutClass), NULL, /* base_init */ NULL, /* base_finalize */ (GClassInitFunc) port_layout_class_init, NULL, /* class_finalize */ NULL, /* class_data */ sizeof (PortLayout), 0, /* n_preallocs */ (GInstanceInitFunc) port_layout_init, }; layout_type = g_type_register_static (GTK_TYPE_CONTAINER, "PortLayout", &layout_info, 0); } return layout_type; } void _gtk_marshal_VOID__OBJECT_OBJECT (GClosure *closure, GValue *return_value, guint n_param_values, const GValue *param_values, gpointer invocation_hint, gpointer marshal_data) { typedef void (*GMarshalFunc_VOID__OBJECT_OBJECT) (gpointer data1, gpointer arg_1, gpointer arg_2, gpointer data2); register GMarshalFunc_VOID__OBJECT_OBJECT callback; register GCClosure *cc = (GCClosure*) closure; register gpointer data1, data2; g_return_if_fail (n_param_values == 3); if (G_CCLOSURE_SWAP_DATA (closure)) { data1 = closure->data; data2 = g_value_peek_pointer (param_values + 0); } else { data1 = g_value_peek_pointer (param_values + 0); data2 = closure->data; } callback = (GMarshalFunc_VOID__OBJECT_OBJECT) (marshal_data ? marshal_data : cc->callback); callback (data1, g_value_get_object (param_values + 1), g_value_get_object (param_values + 2), data2); } static void port_layout_class_init (PortLayoutClass *class) { GObjectClass *gobject_class; GtkWidgetClass *widget_class; GtkContainerClass *container_class; gobject_class = (GObjectClass*) class; widget_class = (GtkWidgetClass*) class; container_class = (GtkContainerClass*) class; parent_class = g_type_class_peek_parent (class); gobject_class->set_property = port_layout_set_property; gobject_class->get_property = port_layout_get_property; gobject_class->finalize = port_layout_finalize; gobject_class->constructor = port_layout_constructor; g_object_class_install_property (gobject_class, PROP_HADJUSTMENT, g_param_spec_object ("hadjustment", _("Horizontal adjustment"), _("The GtkAdjustment for the horizontal position"), GTK_TYPE_ADJUSTMENT, G_PARAM_READWRITE)); g_object_class_install_property (gobject_class, PROP_VADJUSTMENT, g_param_spec_object ("vadjustment", _("Vertical adjustment"), _("The GtkAdjustment for the vertical position"), GTK_TYPE_ADJUSTMENT, G_PARAM_READWRITE)); g_object_class_install_property (gobject_class, PROP_WIDTH, g_param_spec_uint ("width", _("Width"), _("The width of the layout"), 0, G_MAXINT, 100, G_PARAM_READWRITE)); g_object_class_install_property (gobject_class, PROP_HEIGHT, g_param_spec_uint ("height", _("Height"), _("The height of the layout"), 0, G_MAXINT, 100, G_PARAM_READWRITE)); widget_class->realize = port_layout_realize; widget_class->unrealize = port_layout_unrealize; widget_class->map = port_layout_map; widget_class->size_request = port_layout_size_request; widget_class->size_allocate = port_layout_size_allocate; widget_class->expose_event = port_layout_expose; widget_class->style_set = port_layout_style_set; container_class->remove = port_layout_remove; container_class->forall = port_layout_forall; class->set_scroll_adjustments = port_layout_set_adjustments; widget_class->set_scroll_adjustments_signal = g_signal_new ("set_scroll_adjustments", G_OBJECT_CLASS_TYPE (gobject_class), G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION, G_STRUCT_OFFSET (PortLayoutClass, set_scroll_adjustments), NULL, NULL, _gtk_marshal_VOID__OBJECT_OBJECT, G_TYPE_NONE, 2, GTK_TYPE_ADJUSTMENT, GTK_TYPE_ADJUSTMENT); } static void port_layout_get_property (GObject *object, guint prop_id, GValue *value, GParamSpec *pspec) { PortLayout *layout = PORT_LAYOUT (object); switch (prop_id) { case PROP_HADJUSTMENT: g_value_set_object (value, layout->hadjustment); break; case PROP_VADJUSTMENT: g_value_set_object (value, layout->vadjustment); break; case PROP_WIDTH: g_value_set_uint (value, layout->width); break; case PROP_HEIGHT: g_value_set_uint (value, layout->height); break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); break; } } static void port_layout_set_property (GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec) { PortLayout *layout = PORT_LAYOUT (object); switch (prop_id) { case PROP_HADJUSTMENT: port_layout_set_hadjustment (layout, (GtkAdjustment*) g_value_get_object (value)); break; case PROP_VADJUSTMENT: port_layout_set_vadjustment (layout, (GtkAdjustment*) g_value_get_object (value)); break; case PROP_WIDTH: port_layout_set_domain (layout, g_value_get_uint (value), layout->height); break; case PROP_HEIGHT: port_layout_set_domain (layout, layout->width, g_value_get_uint (value)); break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); break; } } static void port_layout_init (PortLayout *layout) { layout->children = NULL; layout->width = 100; layout->height = 100; layout->hadjustment = NULL; layout->vadjustment = NULL; layout->bin_window = NULL; layout->scroll_x = 0; layout->scroll_y = 0; layout->visibility = GDK_VISIBILITY_PARTIAL; } static GObject *port_layout_constructor (GType type, guint n_properties, GObjectConstructParam *properties) { PortLayout *layout; GObject *object; GtkAdjustment *hadj, *vadj; object = G_OBJECT_CLASS (parent_class)->constructor (type, n_properties, properties); layout = PORT_LAYOUT (object); hadj = layout->hadjustment ? layout->hadjustment : new_default_adjustment (); vadj = layout->vadjustment ? layout->vadjustment : new_default_adjustment (); if (!layout->hadjustment || !layout->vadjustment) port_layout_set_adjustments (layout, hadj, vadj); return object; } static void port_layout_realize (GtkWidget *widget) { GList *tmp_list; PortLayout *layout; GdkWindowAttr attributes; gint attributes_mask; g_return_if_fail (PORT_IS_LAYOUT (widget)); layout = PORT_LAYOUT (widget); GTK_WIDGET_SET_FLAGS (layout, GTK_REALIZED); attributes.window_type = GDK_WINDOW_CHILD; attributes.x = widget->allocation.x; attributes.y = widget->allocation.y; attributes.width = widget->allocation.width; attributes.height = widget->allocation.height; attributes.wclass = GDK_INPUT_OUTPUT; attributes.visual = gtk_widget_get_visual (widget); attributes.colormap = gtk_widget_get_colormap (widget); attributes.event_mask = GDK_VISIBILITY_NOTIFY_MASK; attributes_mask = GDK_WA_X | GDK_WA_Y | GDK_WA_VISUAL | GDK_WA_COLORMAP; widget->window = gdk_window_new (gtk_widget_get_parent_window (widget), &attributes, attributes_mask); gdk_window_set_user_data (widget->window, widget); attributes.x = - layout->hadjustment->value, attributes.y = - layout->vadjustment->value; attributes.width = MAX (layout->width, widget->allocation.width); attributes.height = MAX (layout->height, widget->allocation.height); attributes.event_mask = GDK_EXPOSURE_MASK | GDK_SCROLL_MASK | GDK_BUTTON_RELEASE_MASK | GDK_POINTER_MOTION_MASK | GDK_ENTER_NOTIFY_MASK | GDK_LEAVE_NOTIFY_MASK | gtk_widget_get_events (widget); layout->bin_window = gdk_window_new (widget->window, &attributes, attributes_mask); gdk_window_set_user_data (layout->bin_window, widget); widget->style = gtk_style_attach (widget->style, widget->window); gtk_style_set_background (widget->style, widget->window, GTK_STATE_NORMAL); gtk_style_set_background (widget->style, layout->bin_window, GTK_STATE_NORMAL); tmp_list = layout->children; while (tmp_list) { GtkWidget *child_widget = tmp_list->data; tmp_list = tmp_list->next; gtk_widget_set_parent_window (child_widget, layout->bin_window); } } static void port_layout_style_set (GtkWidget *widget, GtkStyle *old_style) { if (GTK_WIDGET_CLASS (parent_class)->style_set) (* GTK_WIDGET_CLASS (parent_class)->style_set) (widget, old_style); if (GTK_WIDGET_REALIZED (widget)) { gtk_style_set_background (widget->style, PORT_LAYOUT (widget)->bin_window, GTK_STATE_NORMAL); } } static void port_layout_map (GtkWidget *widget) { GList *tmp_list; PortLayout *layout; g_return_if_fail (PORT_IS_LAYOUT (widget)); layout = PORT_LAYOUT (widget); GTK_WIDGET_SET_FLAGS (widget, GTK_MAPPED); tmp_list = layout->children; while (tmp_list) { GtkWidget *child_widget = tmp_list->data; tmp_list = tmp_list->next; if (GTK_WIDGET_VISIBLE (child_widget)) { if (!GTK_WIDGET_MAPPED (child_widget)) gtk_widget_map (child_widget); } } gdk_window_show (layout->bin_window); gdk_window_show (widget->window); } static void port_layout_unrealize (GtkWidget *widget) { PortLayout *layout; g_return_if_fail (PORT_IS_LAYOUT (widget)); layout = PORT_LAYOUT (widget); gdk_window_set_user_data (layout->bin_window, NULL); gdk_window_destroy (layout->bin_window); layout->bin_window = NULL; if (GTK_WIDGET_CLASS (parent_class)->unrealize) (* GTK_WIDGET_CLASS (parent_class)->unrealize) (widget); } static void port_layout_size_request (GtkWidget *widget, GtkRequisition *requisition) { GList *tmp_list; GtkLayout *layout; g_return_if_fail (PORT_IS_LAYOUT (widget)); layout = PORT_LAYOUT (widget); requisition->width = 0; requisition->height = 0; tmp_list = layout->children; while (tmp_list) { GtkWidget *child_widget = tmp_list->data; GtkRequisition child_requisition; tmp_list = tmp_list->next; gtk_widget_size_request(child_widget, &child_requisition); } } static void port_layout_size_allocate (GtkWidget *widget, GtkAllocation *allocation) { PortLayout *layout; g_return_if_fail (PORT_IS_LAYOUT (widget)); layout = PORT_LAYOUT(widget); widget->allocation = *allocation; if (GTK_WIDGET_REALIZED (widget)) { gdk_window_move_resize (widget->window, allocation->x, allocation->y, allocation->width, allocation->height); gdk_window_resize (layout->bin_window, MAX (layout->width, allocation->width), MAX (layout->height, allocation->height)); } layout->hadjustment->page_size = allocation->width; layout->hadjustment->page_increment = allocation->width * 0.9; layout->hadjustment->lower = 0; /* set_adjustment_upper() emits ::changed */ port_layout_set_adjustment_upper (layout->hadjustment, MAX (allocation->width, layout->width), TRUE); layout->vadjustment->page_size = allocation->height; layout->vadjustment->page_increment = allocation->height * 0.9; layout->vadjustment->lower = 0; layout->vadjustment->upper = MAX (allocation->height, layout->height); port_layout_set_adjustment_upper (layout->vadjustment, MAX (allocation->height, layout->height), TRUE); handleWindowResize(gtk_widget_get_parent(widget),allocation->width,allocation->height); handleContainerReLayout(gtk_widget_get_parent(widget)); } static gint port_layout_expose (GtkWidget *widget, GdkEventExpose *event) { PortLayout *layout; g_return_val_if_fail (PORT_IS_LAYOUT (widget), FALSE); layout = PORT_LAYOUT (widget); if (event->window != layout->bin_window) return FALSE; (* GTK_WIDGET_CLASS (parent_class)->expose_event) (widget, event); return FALSE; } static void port_layout_remove (GtkContainer *container, GtkWidget *widget) { PortLayout *layout; g_return_val_if_fail (PORT_IS_LAYOUT (container), FALSE); layout = PORT_LAYOUT (container); layout->children = g_list_remove(layout->children, widget); gtk_widget_unparent (widget); } static void port_layout_forall (GtkContainer *container, gboolean include_internals, GtkCallback callback, gpointer callback_data) { GtkWidget *widget; GList *tmp_list; g_return_if_fail (PORT_IS_LAYOUT (container)); g_return_if_fail (callback != NULL); tmp_list = PORT_LAYOUT (container)->children; while (tmp_list) { widget = tmp_list->data; tmp_list = tmp_list->next; (* callback) (widget, callback_data); } } /* Callbacks */ static void port_layout_adjustment_changed (GtkAdjustment *adjustment, PortLayout *layout) { GtkWidget *widget; widget = GTK_WIDGET (layout); if (GTK_WIDGET_REALIZED (layout)) { gdk_window_move (layout->bin_window, - layout->hadjustment->value, - layout->vadjustment->value); gdk_window_process_updates (layout->bin_window, TRUE); } } --- NEW FILE: LayoutContainer.h --- #ifndef __PORT_LAYOUT_H #define __PORT_LAYOUT_H #include "Types.h" #define PORT_TYPE_LAYOUT (port_layout_get_type ()) #define PORT_LAYOUT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), PORT_TYPE_LAYOUT, PortLayout)) #define PORT_LAYOUT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), PORT_TYPE_LAYOUT, PortLayoutClass)) #define PORT_IS_LAYOUT(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), PORT_TYPE_LAYOUT)) #define PORT_IS_LAYOUT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), PORT_TYPE_LAYOUT)) #define PORT_LAYOUT_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), PORT_TYPE_LAYOUT, PortLayoutClass)) typedef struct _PortLayout PortLayout; typedef struct _PortLayoutClass PortLayoutClass; struct _PortLayout { GtkContainer container; GList *children; guint width; guint height; GtkAdjustment *hadjustment; GtkAdjustment *vadjustment; /*< public >*/ GdkWindow *bin_window; /*< private >*/ GdkVisibilityState visibility; gint scroll_x; gint scroll_y; }; struct _PortLayoutClass { GtkContainerClass parent_class; void (*set_scroll_adjustments) (GtkLayout *layout, GtkAdjustment *hadjustment, GtkAdjustment *vadjustment); }; GType port_layout_get_type (void) G_GNUC_CONST; GtkWidget* port_layout_new (GtkAdjustment *hadjustment, GtkAdjustment *vadjustment); void port_layout_put (PortLayout *layout, GtkWidget *child_widget); void port_layout_set_domain (PortLayout *layout, guint width, guint height); void port_layout_get_domain (PortLayout *layout, guint *width, guint *height); GtkAdjustment* port_layout_get_hadjustment (PortLayout *layout); GtkAdjustment* port_layout_get_vadjustment (PortLayout *layout); void port_layout_set_hadjustment (PortLayout *layout, GtkAdjustment *adjustment); void port_layout_set_vadjustment (PortLayout *layout, GtkAdjustment *adjustment); #endif /* __PORT_LAYOUT_H */ Index: Button.c =================================================================== RCS file: /cvsroot/htoolkit/port/src/cbits/GTK/Button.c,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** Button.c 24 Aug 2003 21:07:48 -0000 1.8 --- Button.c 1 Oct 2003 21:47:15 -0000 1.9 *************** *** 12,16 **** GTK_SIGNAL_FUNC(handleControlCommand), NULL); ! gtk_fixed_put(GTK_FIXED(GTK_BIN(GTK_BIN(window)->child)->child), button, 0, 0); gtk_widget_show(button); --- 12,16 ---- GTK_SIGNAL_FUNC(handleControlCommand), NULL); ! port_layout_put(PORT_LAYOUT(GTK_BIN(window)->child), button); gtk_widget_show(button); *************** *** 20,30 **** void osGetButtonReqSize(WindowHandle button, int *res) { - int w,h; GtkRequisition requisition; - gtk_widget_get_size_request(button, &w,&h); - gtk_widget_set_size_request(button, -1,-1); gtk_widget_size_request(button, &requisition); - gtk_widget_set_size_request(button, w, h); res[0] = requisition.width; --- 20,26 ---- Index: CheckBox.c =================================================================== RCS file: /cvsroot/htoolkit/port/src/cbits/GTK/CheckBox.c,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** CheckBox.c 24 Aug 2003 21:07:48 -0000 1.7 --- CheckBox.c 1 Oct 2003 21:47:15 -0000 1.8 *************** *** 8,12 **** check_btn = gtk_check_button_new_with_mnemonic(""); ! gtk_fixed_put(GTK_FIXED(GTK_BIN(GTK_BIN(window)->child)->child), check_btn, 0, 0); gtk_signal_connect (GTK_OBJECT (check_btn), "toggled", GTK_SIGNAL_FUNC(handleControlCommand), --- 8,12 ---- check_btn = gtk_check_button_new_with_mnemonic(""); ! port_layout_put(PORT_LAYOUT(GTK_BIN(window)->child), check_btn); gtk_signal_connect (GTK_OBJECT (check_btn), "toggled", GTK_SIGNAL_FUNC(handleControlCommand), *************** *** 19,29 **** void osGetCheckBoxReqSize(WindowHandle checkbox, int *res) { - int w,h; GtkRequisition requisition; - gtk_widget_get_size_request(checkbox, &w,&h); - gtk_widget_set_size_request(checkbox, -1,-1); gtk_widget_size_request(checkbox, &requisition); - gtk_widget_set_size_request(checkbox, w, h); res[0] = requisition.width; --- 19,25 ---- Index: EditBox.c =================================================================== RCS file: /cvsroot/htoolkit/port/src/cbits/GTK/EditBox.c,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** EditBox.c 24 Aug 2003 21:07:48 -0000 1.9 --- EditBox.c 1 Oct 2003 21:47:15 -0000 1.10 *************** *** 8,12 **** entry = gtk_entry_new(); ! gtk_fixed_put(GTK_FIXED(GTK_BIN(GTK_BIN(window)->child)->child), entry, 0, 0); gtk_widget_show(entry); return entry; --- 8,12 ---- entry = gtk_entry_new(); ! port_layout_put(PORT_LAYOUT(GTK_BIN(window)->child), entry); gtk_widget_show(entry); return entry; *************** *** 15,25 **** void osGetEditReqSize(WindowHandle edit, int *res) { - int w,h; GtkRequisition requisition; - gtk_widget_get_size_request(edit, &w,&h); - gtk_widget_set_size_request(edit, -1,-1); gtk_widget_size_request(edit, &requisition); - gtk_widget_set_size_request(edit, w, h); res[0] = requisition.width; --- 15,21 ---- Index: GroupBox.c =================================================================== RCS file: /cvsroot/htoolkit/port/src/cbits/GTK/GroupBox.c,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** GroupBox.c 3 Sep 2003 17:05:28 -0000 1.1 --- GroupBox.c 1 Oct 2003 21:47:15 -0000 1.2 *************** *** 2,23 **** #include "Internals.h" #include "Handlers_stub.h" ! static void groupbox_size_allocate_handler(GtkWidget *widget, GtkAllocation *allocation, gpointer user_data) ! { ! handleContainerReLayout(widget); ! }; ! ! WindowHandle osCreateGroupBox(WindowHandle form) { ! GtkWidget *page, *groupbox; ! groupbox = gtk_frame_new(""); ! gtk_fixed_put(GTK_FIXED(GTK_BIN(GTK_BIN(form)->child)->child), groupbox, 0, 0); ! page = gtk_viewport_new(NULL,NULL); ! gtk_container_add(GTK_CONTAINER(groupbox), page); ! gtk_container_add(GTK_CONTAINER(page), gtk_fixed_new()); ! gtk_signal_connect (GTK_OBJECT(groupbox), "size-allocate", ! GTK_SIGNAL_FUNC(groupbox_size_allocate_handler), ! NULL); gtk_widget_show_all(groupbox); --- 2,14 ---- #include "Internals.h" #include "Handlers_stub.h" + #include "Window.h" ! WindowHandle osCreateGroupBox(WindowHandle window) { ! GtkWidget *groupbox; ! groupbox = gtk_frame_new("kkkk"); ! gtk_container_add(GTK_CONTAINER(groupbox), port_layout_new(NULL,NULL)); ! port_layout_put(PORT_LAYOUT(GTK_BIN(window)->child), groupbox); gtk_widget_show_all(groupbox); Index: Internals.h =================================================================== RCS file: /cvsroot/htoolkit/port/src/cbits/GTK/Internals.h,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** Internals.h 5 Jul 2003 11:01:16 -0000 1.4 --- Internals.h 1 Oct 2003 21:47:15 -0000 1.5 *************** *** 3,6 **** --- 3,7 ---- #include <config.h> + #include "LayoutContainer.h" extern BOOL gInKey; Index: Label.c =================================================================== RCS file: /cvsroot/htoolkit/port/src/cbits/GTK/Label.c,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** Label.c 24 Aug 2003 21:07:48 -0000 1.7 --- Label.c 1 Oct 2003 21:47:15 -0000 1.8 *************** *** 1,4 **** ! #include <Types.h> ! #include <Label.h> #include "Internals.h" #include "Handlers_stub.h" --- 1,3 ---- ! #include "Label.h" #include "Internals.h" #include "Handlers_stub.h" *************** *** 11,15 **** text = gtk_label_new(""); gtk_label_set_line_wrap(GTK_LABEL(text), gtk_false()); ! gtk_fixed_put(GTK_FIXED(GTK_BIN(GTK_BIN(window)->child)->child), text, 0, 0); gtk_widget_show(text); return text; --- 10,14 ---- text = gtk_label_new(""); gtk_label_set_line_wrap(GTK_LABEL(text), gtk_false()); ! port_layout_put(PORT_LAYOUT(GTK_BIN(window)->child), text); gtk_widget_show(text); return text; *************** *** 18,28 **** void osGetLabelReqSize(WindowHandle label, int *res) { - int w,h; GtkRequisition requisition; - gtk_widget_get_size_request(label, &w,&h); - gtk_widget_set_size_request(label, -1,-1); gtk_widget_size_request(label, &requisition); - gtk_widget_set_size_request(label, w, h); res[0] = requisition.width; --- 17,23 ---- Index: ListBox.c =================================================================== RCS file: /cvsroot/htoolkit/port/src/cbits/GTK/ListBox.c,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** ListBox.c 12 Jul 2003 08:41:38 -0000 1.8 --- ListBox.c 1 Oct 2003 21:47:15 -0000 1.9 *************** *** 46,50 **** sw); ! gtk_fixed_put(GTK_FIXED(GTK_BIN(GTK_BIN(window)->child)->child), sw, 0, 0); gtk_widget_show_all(sw); return sw; --- 46,50 ---- sw); ! port_layout_put(PORT_LAYOUT(GTK_BIN(window)->child), sw); gtk_widget_show_all(sw); return sw; Index: Notebook.c =================================================================== RCS file: /cvsroot/htoolkit/port/src/cbits/GTK/Notebook.c,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** Notebook.c 31 Aug 2003 13:22:32 -0000 1.4 --- Notebook.c 1 Oct 2003 21:47:15 -0000 1.5 *************** *** 23,27 **** gtk_notebook_set_scrollable(GTK_NOTEBOOK(notebook), gtk_true()); gtk_notebook_popup_enable(GTK_NOTEBOOK(notebook)); ! gtk_fixed_put(GTK_FIXED(GTK_BIN(GTK_BIN(window)->child)->child), notebook, 0, 0); gtk_widget_show(notebook); --- 23,27 ---- gtk_notebook_set_scrollable(GTK_NOTEBOOK(notebook), gtk_true()); gtk_notebook_popup_enable(GTK_NOTEBOOK(notebook)); ! port_layout_put(PORT_LAYOUT(GTK_BIN(window)->child), notebook); gtk_widget_show(notebook); *************** *** 95,103 **** }; - static void notebook_page_size_allocate_handler(GtkWidget *widget, GtkAllocation *allocation, gpointer user_data) - { - handleContainerReLayout(widget); - }; - WindowHandle osInsertNotebookPage(WindowHandle notebook, int pos) { --- 95,98 ---- *************** *** 106,113 **** gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW(page), GTK_POLICY_NEVER, GTK_POLICY_NEVER); ! gtk_scrolled_window_add_with_viewport(GTK_SCROLLED_WINDOW(page), gtk_fixed_new()); ! gtk_signal_connect (GTK_OBJECT(page), "size-allocate", ! GTK_SIGNAL_FUNC(notebook_page_size_allocate_handler), ! NULL); gtk_widget_show_all(page); --- 101,105 ---- gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW(page), GTK_POLICY_NEVER, GTK_POLICY_NEVER); ! gtk_container_add(GTK_CONTAINER(page), port_layout_new(NULL,NULL)); gtk_widget_show_all(page); Index: PopUp.c =================================================================== RCS file: /cvsroot/htoolkit/port/src/cbits/GTK/PopUp.c,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** PopUp.c 9 Jul 2003 17:17:00 -0000 1.6 --- PopUp.c 1 Oct 2003 21:47:15 -0000 1.7 *************** *** 19,23 **** GTK_SIGNAL_FUNC(handleLBoxClick), popup); ! gtk_fixed_put(GTK_FIXED(GTK_BIN(GTK_BIN(window)->child)->child), popup, 0, 0); gtk_widget_show(popup); return popup; --- 19,23 ---- GTK_SIGNAL_FUNC(handleLBoxClick), popup); ! port_layout_put(PORT_LAYOUT(GTK_BIN(window)->child), popup); gtk_widget_show(popup); return popup; Index: ProgressBar.c =================================================================== RCS file: /cvsroot/htoolkit/port/src/cbits/GTK/ProgressBar.c,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** ProgressBar.c 29 Mar 2003 08:12:18 -0000 1.2 --- ProgressBar.c 1 Oct 2003 21:47:15 -0000 1.3 *************** *** 11,15 **** gtk_progress_bar_set_bar_style(GTK_PROGRESS_BAR(bar), bSmooth ? GTK_PROGRESS_CONTINUOUS : GTK_PROGRESS_DISCRETE); ! gtk_fixed_put(GTK_FIXED(GTK_BIN(GTK_BIN(window)->child)->child), bar, 0, 0); gtk_widget_show(bar); --- 11,15 ---- gtk_progress_bar_set_bar_style(GTK_PROGRESS_BAR(bar), bSmooth ? GTK_PROGRESS_CONTINUOUS : GTK_PROGRESS_DISCRETE); ! port_layout_put(PORT_LAYOUT(GTK_BIN(window)->child), bar); gtk_widget_show(bar); *************** *** 25,29 **** gtk_progress_bar_set_bar_style(GTK_PROGRESS_BAR(bar), bSmooth ? GTK_PROGRESS_CONTINUOUS : GTK_PROGRESS_DISCRETE); ! gtk_fixed_put(GTK_FIXED(GTK_BIN(GTK_BIN(window)->child)->child), bar, 0, 0); gtk_widget_show(bar); --- 25,29 ---- gtk_progress_bar_set_bar_style(GTK_PROGRESS_BAR(bar), bSmooth ? GTK_PROGRESS_CONTINUOUS : GTK_PROGRESS_DISCRETE); ! port_layout_put(PORT_LAYOUT(GTK_BIN(window)->child), bar); gtk_widget_show(bar); *************** *** 33,43 **** void osGetProgressBarReqSize(WindowHandle bar, int *res) { - int w,h; GtkRequisition requisition; - gtk_widget_get_size_request(bar, &w,&h); - gtk_widget_set_size_request(bar, -1,-1); gtk_widget_size_request(bar, &requisition); - gtk_widget_set_size_request(bar, w, h); res[0] = requisition.width; --- 33,39 ---- Index: RadioBox.c =================================================================== RCS file: /cvsroot/htoolkit/port/src/cbits/GTK/RadioBox.c,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** RadioBox.c 26 Aug 2003 20:00:55 -0000 1.8 --- RadioBox.c 1 Oct 2003 21:47:15 -0000 1.9 *************** *** 10,14 **** GTK_TOGGLE_BUTTON (radio_btn)->active = FALSE; ! gtk_fixed_put(GTK_FIXED(GTK_BIN(GTK_BIN(window)->child)->child), radio_btn, 0, 0); gtk_signal_connect (GTK_OBJECT (radio_btn), "toggled", GTK_SIGNAL_FUNC(handleControlCommand), --- 10,14 ---- GTK_TOGGLE_BUTTON (radio_btn)->active = FALSE; ! port_layout_put(PORT_LAYOUT(GTK_BIN(window)->child), radio_btn); gtk_signal_connect (GTK_OBJECT (radio_btn), "toggled", GTK_SIGNAL_FUNC(handleControlCommand), *************** *** 21,31 **** void osGetRadioBoxReqSize(WindowHandle radio, int *res) { - int w,h; GtkRequisition requisition; - gtk_widget_get_size_request(radio, &w,&h); - gtk_widget_set_size_request(radio, -1,-1); gtk_widget_size_request(radio, &requisition); - gtk_widget_set_size_request(radio, w, h); res[0] = requisition.width; --- 21,27 ---- Index: Slider.c =================================================================== RCS file: /cvsroot/htoolkit/port/src/cbits/GTK/Slider.c,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** Slider.c 29 Mar 2003 08:12:18 -0000 1.2 --- Slider.c 1 Oct 2003 21:47:15 -0000 1.3 *************** *** 16,21 **** GTK_SIGNAL_FUNC(slider_adjustment_value_changed_handler), slider); - gtk_fixed_put(GTK_FIXED(GTK_BIN(GTK_BIN(window)->child)->child), slider, 0, 0); gtk_widget_show(slider); --- 16,21 ---- GTK_SIGNAL_FUNC(slider_adjustment_value_changed_handler), slider); + port_layout_put(PORT_LAYOUT(GTK_BIN(window)->child), slider); gtk_widget_show(slider); *************** *** 31,36 **** GTK_SIGNAL_FUNC(slider_adjustment_value_changed_handler), slider); ! ! gtk_fixed_put(GTK_FIXED(GTK_BIN(GTK_BIN(window)->child)->child), slider, 0, 0); gtk_widget_show(slider); --- 31,35 ---- GTK_SIGNAL_FUNC(slider_adjustment_value_changed_handler), slider); ! port_layout_put(PORT_LAYOUT(GTK_BIN(window)->child), slider); gtk_widget_show(slider); *************** *** 40,50 **** void osGetSliderReqSize(WindowHandle slider, int *res) { - int w,h; GtkRequisition requisition; - gtk_widget_get_size_request(slider, &w,&h); - gtk_widget_set_size_request(slider, -1,-1); gtk_widget_size_request(slider, &requisition); - gtk_widget_set_size_request(slider, w, h); res[0] = requisition.width; --- 39,45 ---- Index: Window.c =================================================================== RCS file: /cvsroot/htoolkit/port/src/cbits/GTK/Window.c,v retrieving revision 1.28 retrieving revision 1.29 diff -C2 -d -r1.28 -r1.29 *** Window.c 25 Aug 2003 17:35:50 -0000 1.28 --- Window.c 1 Oct 2003 21:47:15 -0000 1.29 *************** *** 11,30 **** static void getWindowClipRect(GtkWidget *window, GdkRegion *region) { ! GtkFixed *fixed = GTK_FIXED(GTK_BIN(GTK_BIN(window)->child)->child); ! GList *childrens = gtk_container_get_children(GTK_CONTAINER(fixed)); while (childrens) { - GValue v; - GtkRequisition requisition; - GtkWidget *widget = (GtkWidget *) childrens->data; GdkRectangle rectangle; ! v.g_type = G_TYPE_INT; gtk_container_child_get_property(GTK_CONTAINER(fixed), widget, "x", &v); rectangle.x = v.data[0].v_int; ! v.g_type = G_TYPE_INT; gtk_container_child_get_property(GTK_CONTAINER(fixed), widget, "y", &v); rectangle.y = v.data[0].v_int; ! gtk_widget_size_request (widget, &requisition); ! rectangle.width = requisition.width; ! rectangle.height = requisition.height; ! gdk_region_subtract(region, gdk_region_rectangle (&rectangle)); --- 11,25 ---- static void getWindowClipRect(GtkWidget *window, GdkRegion *region) { ! GList *childrens = gtk_container_get_children(GTK_CONTAINER(GTK_BIN(window)->child)); while (childrens) { GdkRectangle rectangle; + GtkWidget *widget = (GtkWidget *) childrens->data; ! rectangle.x = widget->allocation.x; ! rectangle.y = widget->allocation.y; ! rectangle.width = widget->allocation.width; ! rectangle.height = widget->allocation.height; gdk_region_subtract(region, gdk_region_rectangle (&rectangle)); *************** *** 47,55 **** CanvasHandle canvas; GtkWidget *window = (GtkWidget *) user_data; ! GtkWidget *fixed = GTK_BIN(GTK_BIN(window)->child)->child; GdkGC *gc; gc = gdk_gc_new(event->window); ! gdk_gc_set_foreground(gc, &(gtk_widget_get_style(fixed)->bg[GTK_STATE_NORMAL])); gdk_gc_set_clip_region(gc, event->region); --- 42,50 ---- CanvasHandle canvas; GtkWidget *window = (GtkWidget *) user_data; ! GtkWidget *layout = GTK_BIN(window)->child; GdkGC *gc; gc = gdk_gc_new(event->window); ! gdk_gc_set_foreground(gc, &(gtk_widget_get_style(layout)->bg[GTK_STATE_NORMAL])); gdk_gc_set_clip_region(gc, event->region); *************** *** 188,208 **** } - static void window_size_allocate_handler (GtkWidget *widget, GtkAllocation *allocation, gpointer user_data) - { - static GtkWidget *last_widget = NULL; - static GtkAllocation last_allocation = {0,0}; - if (last_widget != widget || last_allocation.width != allocation->width || last_allocation.height != allocation->height) - { - last_allocation = *allocation; - last_widget = widget; - - handleWindowResize(widget,allocation->width-4,allocation->height-4); - handleContainerReLayout(widget); - } - }; - static WindowHandle create_generic_window() { ! GtkWidget *fixed, *sw, *viewport; /* Create a Scrolled Window */ --- 183,189 ---- } static WindowHandle create_generic_window() { ! GtkWidget *layout, *sw; /* Create a Scrolled Window */ *************** *** 214,220 **** GTK_SIGNAL_FUNC(window_delete_handler), NULL); - gtk_signal_connect (GTK_OBJECT(sw), "size-allocate", - GTK_SIGNAL_FUNC(window_size_allocate_handler), - NULL); gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (sw), --- 195,198 ---- *************** *** 224,254 **** /* Create a Fixed Container */ ! fixed = gtk_fixed_new(); ! gtk_scrolled_window_add_with_viewport(GTK_SCROLLED_WINDOW(sw), fixed); ! ! viewport = GTK_BIN(sw)->child; ! gtk_widget_show(fixed); /* Signals */ ! gtk_signal_connect (GTK_OBJECT(fixed), "expose-event", GTK_SIGNAL_FUNC(window_expose_handler), sw); ! gtk_signal_connect (GTK_OBJECT(viewport), "button-press-event", GTK_SIGNAL_FUNC(window_button_press_handler), sw); ! gtk_signal_connect (GTK_OBJECT(viewport), "button-release-event", GTK_SIGNAL_FUNC(window_button_release_handler), sw); ! gtk_signal_connect (GTK_OBJECT(viewport), "motion_notify_event", GTK_SIGNAL_FUNC(window_motion_notify_handler), sw); ! gtk_signal_connect (GTK_OBJECT (gtk_viewport_get_hadjustment (GTK_VIEWPORT(viewport))), "value-changed", GTK_SIGNAL_FUNC(frame_adjustment_value_changed_handler), sw); ! gtk_signal_connect (GTK_OBJECT (gtk_viewport_get_vadjustment (GTK_VIEWPORT(viewport))), "value-changed", GTK_SIGNAL_FUNC(frame_adjustment_value_changed_handler), sw); ! return sw; } --- 202,230 ---- /* Create a Fixed Container */ ! layout = port_layout_new(NULL,NULL); ! gtk_container_add(GTK_CONTAINER(sw), layout); ! gtk_widget_show(layout); /* Signals */ ! gtk_signal_connect (GTK_OBJECT(layout), "expose-event", GTK_SIGNAL_FUNC(window_expose_handler), sw); ! gtk_signal_connect (GTK_OBJECT(layout), "button-press-event", GTK_SIGNAL_FUNC(window_button_press_handler), sw); ! gtk_signal_connect (GTK_OBJECT(layout), "button-release-event", GTK_SIGNAL_FUNC(window_button_release_handler), sw); ! gtk_signal_connect (GTK_OBJECT(layout), "motion_notify_event", GTK_SIGNAL_FUNC(window_motion_notify_handler), sw); ! gtk_signal_connect (GTK_OBJECT (port_layout_get_hadjustment (PORT_LAYOUT(layout))), "value-changed", GTK_SIGNAL_FUNC(frame_adjustment_value_changed_handler), sw); ! gtk_signal_connect (GTK_OBJECT (port_layout_get_vadjustment (PORT_LAYOUT(layout))), "value-changed", GTK_SIGNAL_FUNC(frame_adjustment_value_changed_handler), sw); ! return sw; } *************** *** 256,260 **** WindowHandle osCreateWindow() { ! GtkWidget *sw, *viewport; if (gDocumentInterface == 1 && gClientWidget != NULL) --- 232,236 ---- WindowHandle osCreateWindow() { ! GtkWidget *sw, *layout; if (gDocumentInterface == 1 && gClientWidget != NULL) *************** *** 262,266 **** sw = create_generic_window(); ! viewport = GTK_BIN(sw)->child; if (gDocumentInterface == 2) --- 238,242 ---- sw = create_generic_window(); ! layout = GTK_BIN(sw)->child; if (gDocumentInterface == 2) *************** *** 272,282 **** } - gtk_widget_realize(viewport); - gdk_window_set_events(viewport->window, gdk_window_get_events(viewport->window) - | GDK_BUTTON_RELEASE_MASK - | GDK_POINTER_MOTION_MASK - | GDK_ENTER_NOTIFY_MASK - | GDK_LEAVE_NOTIFY_MASK); - return sw; } --- 248,251 ---- *************** *** 367,371 **** WindowHandle osCreateDialog(WindowHandle parent) { ! GtkWidget *sw, *viewport, *frame; if (parent == NULL) --- 336,340 ---- WindowHandle osCreateDialog(WindowHandle parent) { ! GtkWidget *sw, *frame; if (parent == NULL) *************** *** 393,403 **** sw = create_generic_window(); - viewport = GTK_BIN(sw)->child; - gtk_container_add(GTK_CONTAINER(frame), sw); - gtk_widget_realize(viewport); - gdk_window_set_events(viewport->window, - gdk_window_get_events(viewport->window) | GDK_BUTTON_RELEASE_MASK | GDK_POINTER_MOTION_MASK | GDK_ENTER_NOTIFY_MASK | GDK_LEAVE_NOTIFY_MASK); return sw; } --- 362,367 ---- *************** *** 405,420 **** WindowHandle osCreateCompoundControl(WindowHandle form) { ! GtkWidget *sw, *viewport; sw = create_generic_window(); ! gtk_fixed_put(GTK_FIXED(GTK_BIN(GTK_BIN(form)->child)->child), sw, 0, 0); - viewport = GTK_BIN(sw)->child; - gtk_widget_realize(viewport); - gdk_window_set_events(viewport->window, gdk_window_get_events(viewport->window) - | GDK_BUTTON_RELEASE_MASK - | GDK_POINTER_MOTION_MASK - | GDK_ENTER_NOTIFY_MASK - | GDK_LEAVE_NOTIFY_MASK); gtk_widget_show_all(sw); --- 369,377 ---- WindowHandle osCreateCompoundControl(WindowHandle form) { ! GtkWidget *sw; sw = create_generic_window(); ! port_layout_put(PORT_LAYOUT(GTK_BIN(form)->child), sw); gtk_widget_show_all(sw); *************** *** 433,438 **** GdkColor fcolor; ! GtkWidget *fixed = GTK_BIN(GTK_BIN(window)->child)->child; ! GList *childrens = gtk_container_get_children(GTK_CONTAINER(fixed)); bcolor.pixel = 0; --- 390,395 ---- GdkColor fcolor; ! GtkWidget *layout = GTK_BIN(window)->child; ! GList *childrens = gtk_container_get_children(GTK_CONTAINER(layout)); bcolor.pixel = 0; *************** *** 446,450 **** fcolor.blue = ((foreColor >> 16) & 0xFF)*257; ! gtk_widget_modify_bg(fixed, GTK_STATE_NORMAL, &bcolor); while (childrens) --- 403,407 ---- fcolor.blue = ((foreColor >> 16) & 0xFF)*257; ! gtk_widget_modify_bg(layout, GTK_STATE_NORMAL, &bcolor); while (childrens) *************** *** 631,645 **** void osSetWindowDomainSize(WindowHandle window, int cx, int cy) { ! GtkAdjustment *adjustment; ! ! gtk_widget_set_size_request(GTK_BIN(GTK_BIN(window)->child)->child,cx,cy); ! ! adjustment = gtk_scrolled_window_get_hadjustment (GTK_SCROLLED_WINDOW(window)); ! adjustment->upper = cx; ! gtk_adjustment_changed(adjustment); ! ! adjustment = gtk_scrolled_window_get_vadjustment (GTK_SCROLLED_WINDOW(window)); ! adjustment->upper = cy; ! gtk_adjustment_changed(adjustment); } --- 588,592 ---- void osSetWindowDomainSize(WindowHandle window, int cx, int cy) { ! port_layout_set_domain(PORT_LAYOUT(GTK_BIN(window)->child), cx, cy); } *************** *** 783,803 **** void osMoveResizeControl(WindowHandle ctrl, int x, int y, int w, int h) { ! GtkWidget *fixed = gtk_widget_get_parent(ctrl); ! gtk_fixed_move(GTK_FIXED(fixed), ctrl, x, y); ! gtk_widget_set_size_request(ctrl, w, h); } void osGetControlRect(WindowHandle ctrl, int *res) { ! GValue v; ! GtkRequisition requisition; ! GtkContainer *container = GTK_CONTAINER(gtk_widget_get_parent(ctrl)); ! ! v.g_type = G_TYPE_INT; gtk_container_child_get_property(container, ctrl, "x", &v); res[0] = v.data[0].v_int; ! v.g_type = G_TYPE_INT; gtk_container_child_get_property(container, ctrl, "y", &v); res[1] = v.data[0].v_int; ! gtk_widget_size_request (ctrl, &requisition); ! res[2] = requisition.width; ! res[3] = requisition.height; } --- 730,748 ---- void osMoveResizeControl(WindowHandle ctrl, int x, int y, int w, int h) { ! GtkAllocation child_allocation; ! child_allocation.x = x; ! child_allocation.y = y; ! child_allocation.width = w; ! child_allocation.height = h; ! gtk_widget_size_allocate (ctrl, &child_allocation); } void osGetControlRect(WindowHandle ctrl, int *res) { ! res[0] = ctrl->allocation.x; ! res[1] = ctrl->allocation.y; ! res[2] = ctrl->allocation.width; ! res[3] = ctrl->allocation.height; } |