** 10 20 30 40 50 60 70 80
**
** library for GtkXPaned-widget, a 2x2 grid-like variation of GtkPaned of gtk+
+** Copyright (C) 2012 Free Software Foundation, Inc.
** Copyright (C) 2005-2006 Mirco "MacSlow" Müller <macslow@bangang.de>
**
** This library is free software; you can redistribute it and/or
**
*******************************************************************************/
+#include <config.h>
#include "gtkxpaned.h"
+
+#include <gtk/gtk.h>
#include <ui/gui/psppire-marshal.h>
-#include <gtk/gtkbindings.h>
-#include <gtk/gtksignal.h>
#include <gdk/gdkkeysyms.h>
-#include <gtk/gtkwindow.h>
-#include <gtk/gtkmain.h>
+
enum WidgetProperties
{
requisition->width = 0;
requisition->height = 0;
- if (xpaned->top_left_child && GTK_WIDGET_VISIBLE (xpaned->top_left_child))
+ if (xpaned->top_left_child && gtk_widget_get_visible (xpaned->top_left_child))
{
gtk_widget_size_request (xpaned->top_left_child, &child_requisition);
requisition->height = child_requisition.height;
}
- if (xpaned->top_right_child && GTK_WIDGET_VISIBLE (xpaned->top_right_child))
+ if (xpaned->top_right_child && gtk_widget_get_visible (xpaned->top_right_child))
{
gtk_widget_size_request (xpaned->top_right_child, &child_requisition);
requisition->height = MAX (requisition->height, child_requisition.height);
}
- if (xpaned->bottom_left_child && GTK_WIDGET_VISIBLE (xpaned->bottom_left_child))
+ if (xpaned->bottom_left_child && gtk_widget_get_visible (xpaned->bottom_left_child))
{
gtk_widget_size_request (xpaned->bottom_left_child, &child_requisition);
requisition->height += child_requisition.height;
}
- if (xpaned->bottom_right_child && GTK_WIDGET_VISIBLE (xpaned->bottom_right_child))
+ if (xpaned->bottom_right_child && gtk_widget_get_visible (xpaned->bottom_right_child))
{
gtk_widget_size_request (xpaned->bottom_right_child, &child_requisition);
- requisition->width = MAX (requisition->width, child_requisition.width);
- requisition->height = MAX (requisition->height, child_requisition.height);
+ requisition->width = child_requisition.width;
+ requisition->height = child_requisition.height;
}
/* add 2 times the set border-width to the GtkXPaneds requisition */
requisition->height += GTK_CONTAINER (xpaned)->border_width * 2;
/* also add the handle "thickness" to GtkXPaneds width- and height-requisitions */
- if (xpaned->top_left_child && GTK_WIDGET_VISIBLE (xpaned->top_left_child) &&
- xpaned->top_right_child && GTK_WIDGET_VISIBLE (xpaned->top_right_child) &&
- xpaned->bottom_left_child && GTK_WIDGET_VISIBLE (xpaned->bottom_left_child) &&
- xpaned->bottom_right_child && GTK_WIDGET_VISIBLE (xpaned->bottom_right_child))
+ if (xpaned->top_left_child && gtk_widget_get_visible (xpaned->top_left_child) &&
+ xpaned->top_right_child && gtk_widget_get_visible (xpaned->top_right_child) &&
+ xpaned->bottom_left_child && gtk_widget_get_visible (xpaned->bottom_left_child) &&
+ xpaned->bottom_right_child && gtk_widget_get_visible (xpaned->bottom_right_child))
{
gint handle_size;
widget->allocation = *allocation;
- if (xpaned->top_left_child && GTK_WIDGET_VISIBLE (xpaned->top_left_child) &&
- xpaned->top_right_child && GTK_WIDGET_VISIBLE (xpaned->top_right_child) &&
- xpaned->bottom_left_child && GTK_WIDGET_VISIBLE (xpaned->bottom_left_child) &&
- xpaned->bottom_right_child && GTK_WIDGET_VISIBLE (xpaned->bottom_right_child))
+ if (xpaned->top_left_child && gtk_widget_get_visible (xpaned->top_left_child) &&
+ xpaned->top_right_child && gtk_widget_get_visible (xpaned->top_right_child) &&
+ xpaned->bottom_left_child && gtk_widget_get_visible (xpaned->bottom_left_child) &&
+ xpaned->bottom_right_child && gtk_widget_get_visible (xpaned->bottom_right_child))
{
/* what sizes do the children want to be at least at */
gtk_widget_get_child_requisition (xpaned->top_left_child,
bottom_right_child_allocation.width = xpaned->handle_pos_east.width;
bottom_right_child_allocation.height = xpaned->handle_pos_south.height;
- if (GTK_WIDGET_REALIZED (widget))
+ if (gtk_widget_get_realized (widget))
{
- if (GTK_WIDGET_MAPPED (widget))
+ if (gtk_widget_get_mapped (widget))
{
gdk_window_show (xpaned->handle_east);
gdk_window_show (xpaned->handle_west);
/* Now allocate the childen, making sure, when resizing not to
* overlap the windows
*/
- if (GTK_WIDGET_MAPPED (widget))
+ if (gtk_widget_get_mapped (widget))
{
gtk_widget_size_allocate (xpaned->top_right_child, &top_right_child_allocation);
gtk_widget_size_allocate (xpaned->top_left_child, &top_left_child_allocation);
widget->style = gtk_style_attach (widget->style, widget->window);
- if (xpaned->top_left_child && GTK_WIDGET_VISIBLE (xpaned->top_left_child) &&
- xpaned->top_right_child && GTK_WIDGET_VISIBLE (xpaned->top_right_child) &&
- xpaned->bottom_left_child && GTK_WIDGET_VISIBLE (xpaned->bottom_left_child) &&
- xpaned->bottom_right_child && GTK_WIDGET_VISIBLE (xpaned->bottom_right_child))
+ if (xpaned->top_left_child && gtk_widget_get_visible (xpaned->top_left_child) &&
+ xpaned->top_right_child && gtk_widget_get_visible (xpaned->top_right_child) &&
+ xpaned->bottom_left_child && gtk_widget_get_visible (xpaned->bottom_left_child) &&
+ xpaned->bottom_right_child && gtk_widget_get_visible (xpaned->bottom_right_child))
{
gdk_window_show (xpaned->handle_east);
gdk_window_show (xpaned->handle_west);
/* I want the handle-"thickness" to be at least 3 */
g_assert (handle_size >= 3);
- if (GTK_WIDGET_VISIBLE (widget) && GTK_WIDGET_MAPPED (widget) &&
- xpaned->top_left_child && GTK_WIDGET_VISIBLE (xpaned->top_left_child) &&
- xpaned->top_right_child && GTK_WIDGET_VISIBLE (xpaned->top_right_child) &&
- xpaned->bottom_left_child && GTK_WIDGET_VISIBLE (xpaned->bottom_left_child) &&
- xpaned->bottom_right_child && GTK_WIDGET_VISIBLE (xpaned->bottom_right_child))
+ if (gtk_widget_get_visible (widget) && gtk_widget_get_mapped (widget) &&
+ xpaned->top_left_child && gtk_widget_get_visible (xpaned->top_left_child) &&
+ xpaned->top_right_child && gtk_widget_get_visible (xpaned->top_right_child) &&
+ xpaned->bottom_left_child && gtk_widget_get_visible (xpaned->bottom_left_child) &&
+ xpaned->bottom_right_child && gtk_widget_get_visible (xpaned->bottom_right_child))
{
GtkStateType state;
else if (xpaned->handle_prelit)
state = GTK_STATE_PRELIGHT;
else
- state = GTK_WIDGET_STATE (widget);
+ state = gtk_widget_get_state (widget);
horizontalClipArea.x = xpaned->handle_pos_west.x;
horizontalClipArea.y = xpaned->handle_pos_west.y;
gboolean was_visible;
xpaned = GTK_XPANED (container);
- was_visible = GTK_WIDGET_VISIBLE (widget);
+ was_visible = gtk_widget_get_visible (widget);
if (xpaned->top_left_child == widget)
{
xpaned->top_left_child = NULL;
- if (was_visible && GTK_WIDGET_VISIBLE (container))
+ if (was_visible && gtk_widget_get_visible (GTK_WIDGET (container)))
gtk_widget_queue_resize (GTK_WIDGET (container));
}
else if (xpaned->top_right_child == widget)
xpaned->top_right_child = NULL;
- if (was_visible && GTK_WIDGET_VISIBLE (container))
+ if (was_visible && gtk_widget_get_visible (GTK_WIDGET (container)))
gtk_widget_queue_resize (GTK_WIDGET (container));
}
else if (xpaned->bottom_left_child == widget)
xpaned->bottom_left_child = NULL;
- if (was_visible && GTK_WIDGET_VISIBLE (container))
+ if (was_visible && gtk_widget_get_visible (GTK_WIDGET (container)))
gtk_widget_queue_resize (GTK_WIDGET (container));
}
else if (xpaned->bottom_right_child == widget)
xpaned->bottom_right_child = NULL;
- if (was_visible && GTK_WIDGET_VISIBLE (container))
+ if (was_visible && gtk_widget_get_visible (GTK_WIDGET (container)))
gtk_widget_queue_resize (GTK_WIDGET (container));
}
else
GdkPoint old_max_position;
gint handle_size;
gint border_width = GTK_CONTAINER (xpaned)->border_width;
- float fX;
- float fY;
g_return_if_fail (GTK_IS_XPANED (xpaned));
old_max_position.x = xpaned->max_position.x;
old_max_position.y = xpaned->max_position.y;
- fX = 100.0f * (float) old_position.x / (float) allocation->width;
- fY = 100.0f * (float) old_position.y / (float) allocation->height;
-
xpaned->min_position.x = xpaned->top_left_child_shrink ? 0 : top_left_child_req->width;
xpaned->min_position.y = xpaned->top_left_child_shrink ? 0 : top_left_child_req->height;
xpaned->top_left_child_size.width = top_left_child_req->width;
xpaned->top_left_child_size.height = top_left_child_req->height;
}
- else if (top_left_child_req->width + top_right_child_req->width != 0)
- {
- xpaned->top_left_child_size.width = allocation->width * ((gdouble)top_left_child_req->width / (top_left_child_req->width + top_right_child_req->width)) + 0.5;
- }
- else if (top_left_child_req->height + top_right_child_req->height != 0)
- {
- xpaned->top_left_child_size.height = allocation->height * ((gdouble)top_left_child_req->height / (top_left_child_req->height + top_right_child_req->height)) + 0.5;
- }
else
{
xpaned->top_left_child_size.width = allocation->width * 0.5 + 0.5;
xpaned->last_allocation.width = allocation->width;
xpaned->last_allocation.height = allocation->height;
-
- fX = 100.0f * (float) old_position.x / (float) allocation->width;
- fY = 100.0f * (float) old_position.y / (float) allocation->height;
}
static void gtk_xpaned_set_saved_focus (GtkXPaned* xpaned, GtkWidget* widget)
GtkWidget* toplevel;
toplevel = gtk_widget_get_toplevel (GTK_WIDGET (xpaned));
- if (GTK_WIDGET_TOPLEVEL (toplevel))
+ if (gtk_widget_is_toplevel (toplevel))
return GTK_WINDOW (toplevel)->focus_widget;
return NULL;
if (gtk_widget_is_focus (GTK_WIDGET (xpaned)))
{
if (xpaned->priv->saved_focus &&
- GTK_WIDGET_SENSITIVE (xpaned->priv->saved_focus))
+ gtk_widget_get_sensitive (xpaned->priv->saved_focus))
{
gtk_widget_grab_focus (xpaned->priv->saved_focus);
}