/* ///////////////////////////////////////////////////////////////////////////
-// Name: win_gtk.c
+// Name: src/gtk/win_gtk.c
// Purpose: Native GTK+ widget for wxWidgets, based on GtkLayout and
// GtkFixed. It makes use of the gravity window property and
// therefore does not work with GTK 1.0.
#define XCheckIfEvent XCHECKIFEVENT
#endif
-#include "wx/setup.h"
+#include "wx/platform.h"
#include "wx/gtk/win_gtk.h"
-#include "gtk/gtksignal.h"
-#include "gtk/gtkprivate.h"
-#include "gdk/gdkx.h"
#ifdef __cplusplus
extern "C" {
pizza->xoffset = 0;
pizza->yoffset = 0;
- pizza->configure_serial = 0;
pizza->scroll_x = 0;
pizza->scroll_y = 0;
- pizza->visibility = GDK_VISIBILITY_PARTIAL;
- pizza->clear_on_draw = TRUE;
- pizza->use_filter = TRUE;
pizza->external_expose = FALSE;
}
{
GtkPizza *pizza;
- pizza = gtk_type_new (gtk_pizza_get_type ());
+ pizza = g_object_new (gtk_pizza_get_type (), NULL);
return GTK_WIDGET (pizza);
}
g_return_if_fail (pizza != NULL);
g_return_if_fail (GTK_IS_PIZZA (pizza));
- if ((GtkMyShadowType) pizza->shadow_type != type)
+ if (pizza->shadow_type != type)
{
pizza->shadow_type = type;
}
}
-void
-gtk_pizza_set_clear (GtkPizza *pizza,
- gboolean clear)
-{
- g_return_if_fail (pizza != NULL);
- g_return_if_fail (GTK_IS_PIZZA (pizza));
-
- pizza->clear_on_draw = clear;
-}
-
-void
-gtk_pizza_set_filter (GtkPizza *pizza,
- gboolean use)
-{
- g_return_if_fail (pizza != NULL);
- g_return_if_fail (GTK_IS_PIZZA (pizza));
-
- pizza->use_filter = use;
-}
-
void
gtk_pizza_set_external (GtkPizza *pizza,
gboolean expose)
gtk_widget_set_parent (widget, GTK_WIDGET (pizza));
- gtk_widget_set_usize (widget, width, height);
-}
-
-void
-gtk_pizza_move (GtkPizza *pizza,
- GtkWidget *widget,
- gint x,
- gint y)
-{
- GtkPizzaChild *child;
- GList *children;
-
- g_return_if_fail (pizza != NULL);
- g_return_if_fail (GTK_IS_PIZZA (pizza));
- g_return_if_fail (widget != NULL);
-
- children = pizza->children;
- while (children)
- {
- child = children->data;
- children = children->next;
-
- if (child->widget == widget)
- {
- if ((child->x == x) && (child->y == y))
- break;
-
- child->x = x;
- child->y = y;
-
- if (GTK_WIDGET_VISIBLE (widget) && GTK_WIDGET_VISIBLE (pizza))
- gtk_widget_queue_resize (widget);
- break;
- }
- }
-}
-
-void
-gtk_pizza_resize (GtkPizza *pizza,
- GtkWidget *widget,
- gint width,
- gint height)
-{
- GtkPizzaChild *child;
- GList *children;
-
- g_return_if_fail (pizza != NULL);
- g_return_if_fail (GTK_IS_PIZZA (pizza));
- g_return_if_fail (widget != NULL);
-
- children = pizza->children;
- while (children)
- {
- child = children->data;
- children = children->next;
-
- if (child->widget == widget)
- {
- if ((child->width == width) && (child->height == height))
- break;
-
- child->width = width;
- child->height = height;
-
- gtk_widget_set_usize (widget, width, height);
-
- if (GTK_WIDGET_VISIBLE (widget) && GTK_WIDGET_VISIBLE (pizza))
- gtk_widget_queue_resize (widget);
- break;
- }
- }
+ gtk_widget_set_size_request (widget, width, height);
}
void
g_return_if_fail (GTK_IS_PIZZA (pizza));
g_return_if_fail (widget != NULL);
+#ifndef WX_WARN_ILLEGAL_SETSIZE
+ /* this really shouldn't happen -- but it does, a lot, right now and we
+ can't pass negative values to gtk_widget_set_size_request() without getting
+ a warning printed out, so filter them out here */
+ if ( width < 0 )
+ width = 0;
+ if ( height < 0 )
+ height = 0;
+#endif
+
children = pizza->children;
while (children)
{
child->width = width;
child->height = height;
- gtk_widget_set_usize (widget, width, height);
+ gtk_widget_set_size_request (widget, width, height);
if (GTK_WIDGET_VISIBLE (widget) && GTK_WIDGET_VISIBLE (pizza))
gtk_widget_queue_resize (widget);
}
}
-gint
-gtk_pizza_child_resized (GtkPizza *pizza,
- GtkWidget *widget)
-{
- GtkPizzaChild *child;
- GList *children;
-
- g_return_val_if_fail (pizza != NULL, FALSE);
- g_return_val_if_fail (GTK_IS_PIZZA (pizza), FALSE);
- g_return_val_if_fail (widget != NULL, FALSE);
-
- children = pizza->children;
- while (children)
- {
- child = children->data;
- children = children->next;
-
- if (child->widget == widget)
- {
- return ((child->width == widget->allocation.width) &&
- (child->height == widget->allocation.height));
- }
- }
-
- return FALSE;
-}
-
static void
gtk_pizza_map (GtkWidget *widget)
{
children = children->next;
if ( GTK_WIDGET_VISIBLE (child->widget) &&
- !GTK_WIDGET_MAPPED (child->widget) &&
- TRUE)
+ !GTK_WIDGET_MAPPED (child->widget) )
{
gtk_widget_map (child->widget);
}
}
}
-
-/* This is the main routine to do the scrolling. Scrolling is
- * done by "Guffaw" scrolling, as in the Mozilla XFE, with
- * a few modifications.
- *
- * The main improvement is that we keep track of whether we
- * are obscured or not. If not, we ignore the generated expose
- * events and instead do the exposes ourself, without having
- * to wait for a roundtrip to the server. This also provides
- * a limited form of expose-event compression, since we do
- * the affected area as one big chunk.
- */
-
void
gtk_pizza_scroll (GtkPizza *pizza, gint dx, gint dy)
{
#ifdef __cplusplus
}
#endif /* __cplusplus */
-