-static void add_tab_bindings (GtkBindingSet* binding_set,
- GdkModifierType modifiers)
-{
- gtk_binding_entry_add_signal (binding_set,
- GDK_Tab,
- modifiers,
- "toggle_handle_focus",
- 0);
-
- gtk_binding_entry_add_signal (binding_set,
- GDK_KP_Tab,
- modifiers,
- "toggle_handle_focus",
- 0);
-}
-
-static void add_move_binding (GtkBindingSet* binding_set,
- guint keyval,
- GdkModifierType mask,
- GtkScrollType scroll)
-{
- gtk_binding_entry_add_signal (binding_set,
- keyval,
- mask,
- "move_handle",
- 1,
- GTK_TYPE_SCROLL_TYPE,
- scroll);
-}
-
-static void gtk_xpaned_class_init (GtkXPanedClass* class)
-{
- GObjectClass* object_class;
- GtkWidgetClass* widget_class;
- GtkContainerClass* container_class;
- GtkXPanedClass* xpaned_class;
- GtkBindingSet* binding_set;
-
- object_class = (GObjectClass *) class;
- widget_class = (GtkWidgetClass *) class;
- container_class = (GtkContainerClass *) class;
- xpaned_class = (GtkXPanedClass *) class;
-
- parent_class = g_type_class_peek_parent (class);
-
- object_class->set_property = gtk_xpaned_set_property;
- object_class->get_property = gtk_xpaned_get_property;
- object_class->finalize = gtk_xpaned_finalize;
-
- widget_class->realize = gtk_xpaned_realize;
- widget_class->unrealize = gtk_xpaned_unrealize;
- widget_class->map = gtk_xpaned_map;
- widget_class->unmap = gtk_xpaned_unmap;
- widget_class->expose_event = gtk_xpaned_expose;
- widget_class->focus = gtk_xpaned_focus;
- widget_class->enter_notify_event = gtk_xpaned_enter;
- widget_class->leave_notify_event = gtk_xpaned_leave;
- widget_class->button_press_event = gtk_xpaned_button_press;
- widget_class->button_release_event = gtk_xpaned_button_release;
- widget_class->motion_notify_event = gtk_xpaned_motion;
- widget_class->size_request = gtk_xpaned_size_request;
- widget_class->size_allocate = gtk_xpaned_size_allocate;
-
- container_class->add = gtk_xpaned_add;
- container_class->remove = gtk_xpaned_remove;
- container_class->forall = gtk_xpaned_forall;
- container_class->child_type = gtk_xpaned_child_type;
- container_class->set_focus_child = gtk_xpaned_set_focus_child;
- container_class->set_child_property = gtk_xpaned_set_child_property;
- container_class->get_child_property = gtk_xpaned_get_child_property;
-
- xpaned_class->cycle_child_focus = gtk_xpaned_cycle_child_focus;
- xpaned_class->toggle_handle_focus = gtk_xpaned_toggle_handle_focus;
- xpaned_class->move_handle = gtk_xpaned_move_handle;
- xpaned_class->cycle_handle_focus = gtk_xpaned_cycle_handle_focus;
- xpaned_class->accept_position = gtk_xpaned_accept_position;
- xpaned_class->cancel_position = gtk_xpaned_cancel_position;
-
- g_object_class_install_property (object_class,
- PROP_X_POSITION,
- g_param_spec_int ("x-position",
- ("x-Position"),
- ("x-Position of paned separator in pixels (0 means all the way to the left)"),
- 0,
- G_MAXINT,
- 0,
- G_PARAM_READABLE | G_PARAM_WRITABLE));
-
- g_object_class_install_property (object_class,
- PROP_Y_POSITION,
- g_param_spec_int ("y-position",
- "y-Position",
- "y-Position of paned separator in pixels (0 means all the way to the top)",
- 0,
- G_MAXINT,
- 0,
- G_PARAM_READABLE | G_PARAM_WRITABLE));
-
- g_object_class_install_property (object_class,
- PROP_POSITION_SET,
- g_param_spec_boolean ("position-set",
- "Position Set",
- "TRUE if the Position property should be used",
- FALSE,
- G_PARAM_READABLE | G_PARAM_WRITABLE));
-
- gtk_widget_class_install_style_property (widget_class,
- g_param_spec_int ("handle-size",
- "Handle Size",
- "Width of handle",
- 0,
- G_MAXINT,
- 3,
- G_PARAM_READABLE));
- /**
- * GtkXPaned:min-x-position:
- *
- * The smallest possible value for the x-position property. This property is derived from the
- * size and shrinkability of the widget's children.
- *
- * Since: 2.4
- */
- g_object_class_install_property (object_class,
- PROP_MIN_X_POSITION,
- g_param_spec_int ("min-x-position",
- "Minimal x-Position",
- "Smallest possible value for the \"x-position\" property",
- 0,
- G_MAXINT,
- 0,
- G_PARAM_READABLE));
-
- /**
- * GtkXPaned:min-y-position:
- *
- * The smallest possible value for the y-position property. This property is derived from the
- * size and shrinkability of the widget's children.
- *
- * Since: 2.4
- */
- g_object_class_install_property (object_class,
- PROP_MIN_Y_POSITION,
- g_param_spec_int ("min-y-position",
- "Minimal y-Position",
- "Smallest possible value for the \"y-position\" property",
- 0,
- G_MAXINT,
- 0,
- G_PARAM_READABLE));
-
- /**
- * GtkPaned:max-x-position:
- *
- * The largest possible value for the x-position property. This property is derived from the
- * size and shrinkability of the widget's children.
- *
- * Since: 2.4
- */
- g_object_class_install_property (object_class,
- PROP_MAX_X_POSITION,
- g_param_spec_int ("max-x-position",
- "Maximal x-Position",
- "Largest possible value for the \"x-position\" property",
- 0,
- G_MAXINT,
- G_MAXINT,
- G_PARAM_READABLE));
-
- /**
- * GtkPaned:max-y-position:
- *
- * The largest possible value for the y-position property. This property is derived from the
- * size and shrinkability of the widget's children.
- *
- * Since: 2.4
- */
- g_object_class_install_property (object_class,
- PROP_MAX_Y_POSITION,
- g_param_spec_int ("max-y-position",
- "Maximal y-Position",
- "Largest possible value for the \"y-position\" property",
- 0,
- G_MAXINT,
- G_MAXINT,
- G_PARAM_READABLE));
-
- /**
- * GtkPaned:resize:
- *
- * The "resize" child property determines whether the child expands and
- * shrinks along with the paned widget.
- *
- * Since: 2.4
- */
- gtk_container_class_install_child_property (container_class,
- CHILD_PROP_RESIZE,
- g_param_spec_boolean ("resize",
- "Resize",
- "If TRUE, the child expands and shrinks along with the paned widget",
- TRUE,
- G_PARAM_READWRITE));
-
- /**
- * GtkPaned:shrink:
- *
- * The "shrink" child property determines whether the child can be made
- * smaller than its requisition.
- *
- * Since: 2.4
- */
- gtk_container_class_install_child_property (container_class,
- CHILD_PROP_SHRINK,
- g_param_spec_boolean ("shrink",
- "Shrink",
- "If TRUE, the child can be made smaller than its requisition",
- TRUE,
- G_PARAM_READWRITE));
-
- signals [CYCLE_CHILD_FOCUS] = g_signal_new ("cycle-child-focus",
- G_TYPE_FROM_CLASS (object_class),
- G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION,
- G_STRUCT_OFFSET (GtkXPanedClass, cycle_child_focus),
- NULL, NULL,
- psppire_marshal_BOOLEAN__BOOLEAN,
- G_TYPE_BOOLEAN, 1,
- G_TYPE_BOOLEAN);
-
- signals [TOGGLE_HANDLE_FOCUS] = g_signal_new ("toggle-handle-focus",
- G_TYPE_FROM_CLASS (object_class),
- G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION,
- G_STRUCT_OFFSET (GtkXPanedClass, toggle_handle_focus),
- NULL, NULL,
- psppire_marshal_BOOLEAN__VOID,
- G_TYPE_BOOLEAN, 0);
-
- signals[MOVE_HANDLE] = g_signal_new ("move-handle",
- G_TYPE_FROM_CLASS (object_class),
- G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION,
- G_STRUCT_OFFSET (GtkXPanedClass, move_handle),
- NULL, NULL,
- psppire_marshal_BOOLEAN__ENUM,
- G_TYPE_BOOLEAN, 1,
- GTK_TYPE_SCROLL_TYPE);
-
- signals [CYCLE_HANDLE_FOCUS] = g_signal_new ("cycle-handle-focus",
- G_TYPE_FROM_CLASS (object_class),
- G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION,
- G_STRUCT_OFFSET (GtkXPanedClass, cycle_handle_focus),
- NULL, NULL,
- psppire_marshal_BOOLEAN__BOOLEAN,
- G_TYPE_BOOLEAN, 1,
- G_TYPE_BOOLEAN);
-
- signals [ACCEPT_POSITION] = g_signal_new ("accept-position",
- G_TYPE_FROM_CLASS (object_class),
- G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION,
- G_STRUCT_OFFSET (GtkXPanedClass, accept_position),
- NULL, NULL,
- psppire_marshal_BOOLEAN__VOID,
- G_TYPE_BOOLEAN, 0);
-
- signals [CANCEL_POSITION] = g_signal_new ("cancel-position",
- G_TYPE_FROM_CLASS (object_class),
- G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION,
- G_STRUCT_OFFSET (GtkXPanedClass, cancel_position),
- NULL, NULL,
- psppire_marshal_BOOLEAN__VOID,
- G_TYPE_BOOLEAN, 0);
-
- binding_set = gtk_binding_set_by_class (class);
-
- /* F6 and friends */
- gtk_binding_entry_add_signal (binding_set,
- GDK_F6, 0,
- "cycle-child-focus", 1,
- G_TYPE_BOOLEAN, FALSE);
-
- gtk_binding_entry_add_signal (binding_set,
- GDK_F6, GDK_SHIFT_MASK,
- "cycle-child-focus", 1,
- G_TYPE_BOOLEAN, TRUE);
-
- /* F8 and friends */
- gtk_binding_entry_add_signal (binding_set,
- GDK_F8, 0,
- "cycle-handle-focus", 1,
- G_TYPE_BOOLEAN, FALSE);
-
- gtk_binding_entry_add_signal (binding_set,
- GDK_F8, GDK_SHIFT_MASK,
- "cycle-handle-focus", 1,
- G_TYPE_BOOLEAN, TRUE);
-
- add_tab_bindings (binding_set, 0);
- add_tab_bindings (binding_set, GDK_CONTROL_MASK);
- add_tab_bindings (binding_set, GDK_SHIFT_MASK);
- add_tab_bindings (binding_set, GDK_CONTROL_MASK | GDK_SHIFT_MASK);
-
- /* accept and cancel positions */
- gtk_binding_entry_add_signal (binding_set,
- GDK_Escape, 0,
- "cancel-position", 0);
-
- gtk_binding_entry_add_signal (binding_set,
- GDK_Return, 0,
- "accept-position", 0);
-
- gtk_binding_entry_add_signal (binding_set,
- GDK_KP_Enter, 0,
- "accept-position", 0);
-
- gtk_binding_entry_add_signal (binding_set,
- GDK_space, 0,
- "accept-position", 0);
-
- gtk_binding_entry_add_signal (binding_set,
- GDK_KP_Space, 0,
- "accept-position", 0);
-
- /* move handle */
- add_move_binding (binding_set, GDK_Left, 0, GTK_SCROLL_STEP_LEFT);
- add_move_binding (binding_set, GDK_KP_Left, 0, GTK_SCROLL_STEP_LEFT);
- add_move_binding (binding_set, GDK_Left, GDK_CONTROL_MASK, GTK_SCROLL_PAGE_LEFT);
- add_move_binding (binding_set, GDK_KP_Left, GDK_CONTROL_MASK, GTK_SCROLL_PAGE_LEFT);
-
- add_move_binding (binding_set, GDK_Right, 0, GTK_SCROLL_STEP_RIGHT);
- add_move_binding (binding_set, GDK_Right, GDK_CONTROL_MASK, GTK_SCROLL_PAGE_RIGHT);
- add_move_binding (binding_set, GDK_KP_Right, 0, GTK_SCROLL_STEP_RIGHT);
- add_move_binding (binding_set, GDK_KP_Right, GDK_CONTROL_MASK, GTK_SCROLL_PAGE_RIGHT);
-
- add_move_binding (binding_set, GDK_Up, 0, GTK_SCROLL_STEP_UP);
- add_move_binding (binding_set, GDK_Up, GDK_CONTROL_MASK, GTK_SCROLL_PAGE_UP);
- add_move_binding (binding_set, GDK_KP_Up, 0, GTK_SCROLL_STEP_UP);
- add_move_binding (binding_set, GDK_KP_Up, GDK_CONTROL_MASK, GTK_SCROLL_PAGE_UP);
- add_move_binding (binding_set, GDK_Page_Up, 0, GTK_SCROLL_PAGE_UP);
- add_move_binding (binding_set, GDK_KP_Page_Up, 0, GTK_SCROLL_PAGE_UP);
-
- add_move_binding (binding_set, GDK_Down, 0, GTK_SCROLL_STEP_DOWN);
- add_move_binding (binding_set, GDK_Down, GDK_CONTROL_MASK, GTK_SCROLL_PAGE_DOWN);
- add_move_binding (binding_set, GDK_KP_Down, 0, GTK_SCROLL_STEP_DOWN);
- add_move_binding (binding_set, GDK_KP_Down, GDK_CONTROL_MASK, GTK_SCROLL_PAGE_DOWN);
- add_move_binding (binding_set, GDK_Page_Down, 0, GTK_SCROLL_PAGE_RIGHT);
- add_move_binding (binding_set, GDK_KP_Page_Down, 0, GTK_SCROLL_PAGE_RIGHT);
-
- add_move_binding (binding_set, GDK_Home, 0, GTK_SCROLL_START);
- add_move_binding (binding_set, GDK_KP_Home, 0, GTK_SCROLL_START);
- add_move_binding (binding_set, GDK_End, 0, GTK_SCROLL_END);
- add_move_binding (binding_set, GDK_KP_End, 0, GTK_SCROLL_END);
-}
-
-static GType gtk_xpaned_child_type (GtkContainer* container)
-{
- if (!GTK_XPANED (container)->top_left_child ||
- !GTK_XPANED (container)->top_right_child ||
- !GTK_XPANED (container)->bottom_left_child ||
- !GTK_XPANED (container)->bottom_right_child)
- return GTK_TYPE_WIDGET;
- else
- return G_TYPE_NONE;
-}
-
-static void gtk_xpaned_init (GtkXPaned* xpaned)
-{
- GTK_WIDGET_SET_FLAGS (xpaned, GTK_NO_WINDOW | GTK_CAN_FOCUS);
-
- xpaned->top_left_child = NULL;
- xpaned->top_right_child = NULL;
- xpaned->bottom_left_child = NULL;
- xpaned->bottom_right_child = NULL;
- xpaned->handle_east = NULL;
- xpaned->handle_west = NULL;
- xpaned->handle_north = NULL;
- xpaned->handle_south = NULL;
- xpaned->handle_middle = NULL;
- xpaned->xor_gc = NULL;
- xpaned->cursor_type_east = GDK_SB_V_DOUBLE_ARROW;
- xpaned->cursor_type_west = GDK_SB_V_DOUBLE_ARROW;
- xpaned->cursor_type_north = GDK_SB_H_DOUBLE_ARROW;
- xpaned->cursor_type_south = GDK_SB_H_DOUBLE_ARROW;
- xpaned->cursor_type_middle = GDK_FLEUR;
-
- xpaned->handle_pos_east.width = 5;
- xpaned->handle_pos_east.height = 5;
- xpaned->handle_pos_west.width = 5;
- xpaned->handle_pos_west.height = 5;
- xpaned->handle_pos_north.width = 5;
- xpaned->handle_pos_north.height = 5;
- xpaned->handle_pos_south.width = 5;
- xpaned->handle_pos_south.height = 5;
- xpaned->handle_pos_middle.width = 5;
- xpaned->handle_pos_middle.height = 5;
-
- xpaned->position_set = FALSE;
- xpaned->last_allocation.width = -1;
- xpaned->last_allocation.height = -1;
- xpaned->in_drag_vert = FALSE;
- xpaned->in_drag_horiz = FALSE;
- xpaned->in_drag_vert_and_horiz = FALSE;
-
- xpaned->maximized[GTK_XPANED_TOP_LEFT] = FALSE;
- xpaned->maximized[GTK_XPANED_TOP_RIGHT] = FALSE;
- xpaned->maximized[GTK_XPANED_BOTTOM_LEFT] = FALSE;
- xpaned->maximized[GTK_XPANED_BOTTOM_RIGHT] = FALSE;
-
- xpaned->priv = g_new0 (GtkXPanedPrivate, 1);
- xpaned->last_top_left_child_focus = NULL;
- xpaned->last_top_right_child_focus = NULL;
- xpaned->last_bottom_left_child_focus = NULL;
- xpaned->last_bottom_right_child_focus = NULL;
- xpaned->in_recursion = FALSE;
- xpaned->handle_prelit = FALSE;
- xpaned->original_position.x = -1;
- xpaned->original_position.y = -1;
- xpaned->unmaximized_position.x = -1;
- xpaned->unmaximized_position.y = -1;
-
- xpaned->handle_pos_east.x = -1;
- xpaned->handle_pos_east.y = -1;
- xpaned->handle_pos_west.x = -1;
- xpaned->handle_pos_west.y = -1;
- xpaned->handle_pos_north.x = -1;
- xpaned->handle_pos_north.y = -1;
- xpaned->handle_pos_south.x = -1;
- xpaned->handle_pos_south.y = -1;
- xpaned->handle_pos_middle.x = -1;
- xpaned->handle_pos_middle.y = -1;
-
- xpaned->drag_pos.x = -1;
- xpaned->drag_pos.y = -1;
-}
-
-static void gtk_xpaned_size_request (GtkWidget* widget,
- GtkRequisition* requisition)
-{
- GtkXPaned* xpaned = GTK_XPANED (widget);
- GtkRequisition child_requisition;
-
- requisition->width = 0;
- requisition->height = 0;
-
- if (xpaned->top_left_child && gtk_widget_get_visible (xpaned->top_left_child))
- {
- gtk_widget_size_request (xpaned->top_left_child, &child_requisition);
-
- requisition->width = child_requisition.width;
- requisition->height = child_requisition.height;
- }
-
- if (xpaned->top_right_child && gtk_widget_get_visible (xpaned->top_right_child))
- {
- gtk_widget_size_request (xpaned->top_right_child, &child_requisition);
-
- requisition->width += child_requisition.width;
- requisition->height = MAX (requisition->height, child_requisition.height);
- }
-
- if (xpaned->bottom_left_child && gtk_widget_get_visible (xpaned->bottom_left_child))
- {
- gtk_widget_size_request (xpaned->bottom_left_child, &child_requisition);
-
- requisition->width = MAX (requisition->width, child_requisition.width);
- requisition->height += child_requisition.height;
- }
-
- 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 = child_requisition.width;
- requisition->height = child_requisition.height;
- }
-
- /* add 2 times the set border-width to the GtkXPaneds requisition */
- requisition->width += GTK_CONTAINER (xpaned)->border_width * 2;
- 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_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;
-
- gtk_widget_style_get (widget, "handle-size", &handle_size, NULL);
- requisition->width += handle_size;
- requisition->height += handle_size;
- }
+static void
+add_tab_bindings (GtkBindingSet * binding_set, GdkModifierType modifiers)
+{
+ gtk_binding_entry_add_signal (binding_set,
+ GDK_Tab, modifiers, "toggle_handle_focus", 0);
+
+ gtk_binding_entry_add_signal (binding_set,
+ GDK_KP_Tab,
+ modifiers, "toggle_handle_focus", 0);
+}
+
+static void
+add_move_binding (GtkBindingSet * binding_set,
+ guint keyval, GdkModifierType mask, GtkScrollType scroll)
+{
+ gtk_binding_entry_add_signal (binding_set,
+ keyval,
+ mask,
+ "move_handle",
+ 1, GTK_TYPE_SCROLL_TYPE, scroll);
+}
+
+static void
+gtk_xpaned_class_init (GtkXPanedClass * class)
+{
+ GObjectClass *object_class;
+ GtkWidgetClass *widget_class;
+ GtkContainerClass *container_class;
+ GtkXPanedClass *xpaned_class;
+ GtkBindingSet *binding_set;
+
+ object_class = (GObjectClass *) class;
+ widget_class = (GtkWidgetClass *) class;
+ container_class = (GtkContainerClass *) class;
+ xpaned_class = (GtkXPanedClass *) class;
+
+ parent_class = g_type_class_peek_parent (class);
+
+ object_class->set_property = gtk_xpaned_set_property;
+ object_class->get_property = gtk_xpaned_get_property;
+ object_class->finalize = gtk_xpaned_finalize;
+
+ widget_class->realize = gtk_xpaned_realize;
+ widget_class->unrealize = gtk_xpaned_unrealize;
+ widget_class->map = gtk_xpaned_map;
+ widget_class->unmap = gtk_xpaned_unmap;
+ widget_class->draw = gtk_xpaned_draw;
+ widget_class->focus = gtk_xpaned_focus;
+ widget_class->enter_notify_event = gtk_xpaned_enter;
+ widget_class->leave_notify_event = gtk_xpaned_leave;
+ widget_class->button_press_event = gtk_xpaned_button_press;
+ widget_class->button_release_event = gtk_xpaned_button_release;
+ widget_class->motion_notify_event = gtk_xpaned_motion;
+ widget_class->get_preferred_width = gtk_xpaned_get_preferred_width;
+ widget_class->get_preferred_height = gtk_xpaned_get_preferred_height;
+
+ widget_class->size_allocate = gtk_xpaned_size_allocate;
+
+ container_class->add = gtk_xpaned_add;
+ container_class->remove = gtk_xpaned_remove;
+ container_class->forall = gtk_xpaned_forall;
+ container_class->child_type = gtk_xpaned_child_type;
+ container_class->set_focus_child = gtk_xpaned_set_focus_child;
+ container_class->set_child_property = gtk_xpaned_set_child_property;
+ container_class->get_child_property = gtk_xpaned_get_child_property;
+
+ xpaned_class->cycle_child_focus = gtk_xpaned_cycle_child_focus;
+ xpaned_class->toggle_handle_focus = gtk_xpaned_toggle_handle_focus;
+ xpaned_class->move_handle = gtk_xpaned_move_handle;
+ xpaned_class->cycle_handle_focus = gtk_xpaned_cycle_handle_focus;
+ xpaned_class->accept_position = gtk_xpaned_accept_position;
+ xpaned_class->cancel_position = gtk_xpaned_cancel_position;
+
+ g_object_class_install_property (object_class,
+ PROP_X_POSITION,
+ g_param_spec_int ("x-position",
+ ("x-Position"),
+ ("x-Position of paned separator in pixels (0 means all the way to the left)"),
+ 0,
+ G_MAXINT,
+ 0,
+ G_PARAM_READABLE |
+ G_PARAM_WRITABLE));
+
+ g_object_class_install_property (object_class,
+ PROP_Y_POSITION,
+ g_param_spec_int ("y-position",
+ "y-Position",
+ "y-Position of paned separator in pixels (0 means all the way to the top)",
+ 0,
+ G_MAXINT,
+ 0,
+ G_PARAM_READABLE |
+ G_PARAM_WRITABLE));
+
+ g_object_class_install_property (object_class,
+ PROP_POSITION_SET,
+ g_param_spec_boolean ("position-set",
+ "Position Set",
+ "TRUE if the Position property should be used",
+ FALSE,
+ G_PARAM_READABLE |
+ G_PARAM_WRITABLE));
+
+ gtk_widget_class_install_style_property (widget_class,
+ g_param_spec_int ("handle-size",
+ "Handle Size",
+ "Width of handle",
+ 0,
+ G_MAXINT,
+ 3,
+ G_PARAM_READABLE));
+ /**
+ * GtkXPaned:min-x-position:
+ *
+ * The smallest possible value for the x-position property. This property is derived from the
+ * size and shrinkability of the widget's children.
+ *
+ * Since: 2.4
+ */
+ g_object_class_install_property (object_class,
+ PROP_MIN_X_POSITION,
+ g_param_spec_int ("min-x-position",
+ "Minimal x-Position",
+ "Smallest possible value for the \"x-position\" property",
+ 0,
+ G_MAXINT,
+ 0, G_PARAM_READABLE));
+
+ /**
+ * GtkXPaned:min-y-position:
+ *
+ * The smallest possible value for the y-position property. This property is derived from the
+ * size and shrinkability of the widget's children.
+ *
+ * Since: 2.4
+ */
+ g_object_class_install_property (object_class,
+ PROP_MIN_Y_POSITION,
+ g_param_spec_int ("min-y-position",
+ "Minimal y-Position",
+ "Smallest possible value for the \"y-position\" property",
+ 0,
+ G_MAXINT,
+ 0, G_PARAM_READABLE));
+
+ /**
+ * GtkPaned:max-x-position:
+ *
+ * The largest possible value for the x-position property. This property is derived from the
+ * size and shrinkability of the widget's children.
+ *
+ * Since: 2.4
+ */
+ g_object_class_install_property (object_class,
+ PROP_MAX_X_POSITION,
+ g_param_spec_int ("max-x-position",
+ "Maximal x-Position",
+ "Largest possible value for the \"x-position\" property",
+ 0,
+ G_MAXINT,
+ G_MAXINT,
+ G_PARAM_READABLE));
+
+ /**
+ * GtkPaned:max-y-position:
+ *
+ * The largest possible value for the y-position property. This property is derived from the
+ * size and shrinkability of the widget's children.
+ *
+ * Since: 2.4
+ */
+ g_object_class_install_property (object_class,
+ PROP_MAX_Y_POSITION,
+ g_param_spec_int ("max-y-position",
+ "Maximal y-Position",
+ "Largest possible value for the \"y-position\" property",
+ 0,
+ G_MAXINT,
+ G_MAXINT,
+ G_PARAM_READABLE));
+
+ /**
+ * GtkPaned:resize:
+ *
+ * The "resize" child property determines whether the child expands and
+ * shrinks along with the paned widget.
+ *
+ * Since: 2.4
+ */
+ gtk_container_class_install_child_property (container_class,
+ CHILD_PROP_RESIZE,
+ g_param_spec_boolean ("resize",
+ "Resize",
+ "If TRUE, the child expands and shrinks along with the paned widget",
+ TRUE,
+ G_PARAM_READWRITE));
+
+ /**
+ * GtkPaned:shrink:
+ *
+ * The "shrink" child property determines whether the child can be made
+ * smaller than its requisition.
+ *
+ * Since: 2.4
+ */
+ gtk_container_class_install_child_property (container_class,
+ CHILD_PROP_SHRINK,
+ g_param_spec_boolean ("shrink",
+ "Shrink",
+ "If TRUE, the child can be made smaller than its requisition",
+ TRUE,
+ G_PARAM_READWRITE));
+
+ signals[CYCLE_CHILD_FOCUS] = g_signal_new ("cycle-child-focus",
+ G_TYPE_FROM_CLASS (object_class),
+ G_SIGNAL_RUN_LAST |
+ G_SIGNAL_ACTION,
+ G_STRUCT_OFFSET (GtkXPanedClass,
+ cycle_child_focus),
+ NULL, NULL,
+ psppire_marshal_BOOLEAN__BOOLEAN,
+ G_TYPE_BOOLEAN, 1,
+ G_TYPE_BOOLEAN);
+
+ signals[TOGGLE_HANDLE_FOCUS] = g_signal_new ("toggle-handle-focus",
+ G_TYPE_FROM_CLASS
+ (object_class),
+ G_SIGNAL_RUN_LAST |
+ G_SIGNAL_ACTION,
+ G_STRUCT_OFFSET
+ (GtkXPanedClass,
+ toggle_handle_focus), NULL,
+ NULL,
+ psppire_marshal_BOOLEAN__VOID,
+ G_TYPE_BOOLEAN, 0);
+
+ signals[MOVE_HANDLE] = g_signal_new ("move-handle",
+ G_TYPE_FROM_CLASS (object_class),
+ G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION,
+ G_STRUCT_OFFSET (GtkXPanedClass,
+ move_handle), NULL,
+ NULL, psppire_marshal_BOOLEAN__ENUM,
+ G_TYPE_BOOLEAN, 1,
+ GTK_TYPE_SCROLL_TYPE);
+
+ signals[CYCLE_HANDLE_FOCUS] = g_signal_new ("cycle-handle-focus",
+ G_TYPE_FROM_CLASS
+ (object_class),
+ G_SIGNAL_RUN_LAST |
+ G_SIGNAL_ACTION,
+ G_STRUCT_OFFSET (GtkXPanedClass,
+ cycle_handle_focus),
+ NULL, NULL,
+ psppire_marshal_BOOLEAN__BOOLEAN,
+ G_TYPE_BOOLEAN, 1,
+ G_TYPE_BOOLEAN);
+
+ signals[ACCEPT_POSITION] = g_signal_new ("accept-position",
+ G_TYPE_FROM_CLASS (object_class),
+ G_SIGNAL_RUN_LAST |
+ G_SIGNAL_ACTION,
+ G_STRUCT_OFFSET (GtkXPanedClass,
+ accept_position),
+ NULL, NULL,
+ psppire_marshal_BOOLEAN__VOID,
+ G_TYPE_BOOLEAN, 0);
+
+ signals[CANCEL_POSITION] = g_signal_new ("cancel-position",
+ G_TYPE_FROM_CLASS (object_class),
+ G_SIGNAL_RUN_LAST |
+ G_SIGNAL_ACTION,
+ G_STRUCT_OFFSET (GtkXPanedClass,
+ cancel_position),
+ NULL, NULL,
+ psppire_marshal_BOOLEAN__VOID,
+ G_TYPE_BOOLEAN, 0);
+
+ binding_set = gtk_binding_set_by_class (class);
+
+ /* F6 and friends */
+ gtk_binding_entry_add_signal (binding_set,
+ GDK_F6, 0,
+ "cycle-child-focus", 1,
+ G_TYPE_BOOLEAN, FALSE);
+
+ gtk_binding_entry_add_signal (binding_set,
+ GDK_F6, GDK_SHIFT_MASK,
+ "cycle-child-focus", 1, G_TYPE_BOOLEAN, TRUE);
+
+ /* F8 and friends */
+ gtk_binding_entry_add_signal (binding_set,
+ GDK_F8, 0,
+ "cycle-handle-focus", 1,
+ G_TYPE_BOOLEAN, FALSE);
+
+ gtk_binding_entry_add_signal (binding_set,
+ GDK_F8, GDK_SHIFT_MASK,
+ "cycle-handle-focus", 1,
+ G_TYPE_BOOLEAN, TRUE);
+
+ add_tab_bindings (binding_set, 0);
+ add_tab_bindings (binding_set, GDK_CONTROL_MASK);
+ add_tab_bindings (binding_set, GDK_SHIFT_MASK);
+ add_tab_bindings (binding_set, GDK_CONTROL_MASK | GDK_SHIFT_MASK);
+
+ /* accept and cancel positions */
+ gtk_binding_entry_add_signal (binding_set,
+ GDK_Escape, 0, "cancel-position", 0);
+
+ gtk_binding_entry_add_signal (binding_set,
+ GDK_Return, 0, "accept-position", 0);
+
+ gtk_binding_entry_add_signal (binding_set,
+ GDK_KP_Enter, 0, "accept-position", 0);
+
+ gtk_binding_entry_add_signal (binding_set,
+ GDK_space, 0, "accept-position", 0);
+
+ gtk_binding_entry_add_signal (binding_set,
+ GDK_KP_Space, 0, "accept-position", 0);
+
+ /* move handle */
+ add_move_binding (binding_set, GDK_Left, 0, GTK_SCROLL_STEP_LEFT);
+ add_move_binding (binding_set, GDK_KP_Left, 0, GTK_SCROLL_STEP_LEFT);
+ add_move_binding (binding_set, GDK_Left, GDK_CONTROL_MASK,
+ GTK_SCROLL_PAGE_LEFT);
+ add_move_binding (binding_set, GDK_KP_Left, GDK_CONTROL_MASK,
+ GTK_SCROLL_PAGE_LEFT);
+
+ add_move_binding (binding_set, GDK_Right, 0, GTK_SCROLL_STEP_RIGHT);
+ add_move_binding (binding_set, GDK_Right, GDK_CONTROL_MASK,
+ GTK_SCROLL_PAGE_RIGHT);
+ add_move_binding (binding_set, GDK_KP_Right, 0, GTK_SCROLL_STEP_RIGHT);
+ add_move_binding (binding_set, GDK_KP_Right, GDK_CONTROL_MASK,
+ GTK_SCROLL_PAGE_RIGHT);
+
+ add_move_binding (binding_set, GDK_Up, 0, GTK_SCROLL_STEP_UP);
+ add_move_binding (binding_set, GDK_Up, GDK_CONTROL_MASK,
+ GTK_SCROLL_PAGE_UP);
+ add_move_binding (binding_set, GDK_KP_Up, 0, GTK_SCROLL_STEP_UP);
+ add_move_binding (binding_set, GDK_KP_Up, GDK_CONTROL_MASK,
+ GTK_SCROLL_PAGE_UP);
+ add_move_binding (binding_set, GDK_Page_Up, 0, GTK_SCROLL_PAGE_UP);
+ add_move_binding (binding_set, GDK_KP_Page_Up, 0, GTK_SCROLL_PAGE_UP);
+
+ add_move_binding (binding_set, GDK_Down, 0, GTK_SCROLL_STEP_DOWN);
+ add_move_binding (binding_set, GDK_Down, GDK_CONTROL_MASK,
+ GTK_SCROLL_PAGE_DOWN);
+ add_move_binding (binding_set, GDK_KP_Down, 0, GTK_SCROLL_STEP_DOWN);
+ add_move_binding (binding_set, GDK_KP_Down, GDK_CONTROL_MASK,
+ GTK_SCROLL_PAGE_DOWN);
+ add_move_binding (binding_set, GDK_Page_Down, 0, GTK_SCROLL_PAGE_RIGHT);
+ add_move_binding (binding_set, GDK_KP_Page_Down, 0, GTK_SCROLL_PAGE_RIGHT);
+
+ add_move_binding (binding_set, GDK_Home, 0, GTK_SCROLL_START);
+ add_move_binding (binding_set, GDK_KP_Home, 0, GTK_SCROLL_START);
+ add_move_binding (binding_set, GDK_End, 0, GTK_SCROLL_END);
+ add_move_binding (binding_set, GDK_KP_End, 0, GTK_SCROLL_END);
+}
+
+static GType
+gtk_xpaned_child_type (GtkContainer * container)
+{
+ if (!GTK_XPANED (container)->top_left_child ||
+ !GTK_XPANED (container)->top_right_child ||
+ !GTK_XPANED (container)->bottom_left_child ||
+ !GTK_XPANED (container)->bottom_right_child)
+ return GTK_TYPE_WIDGET;
+ else
+ return G_TYPE_NONE;
+}
+
+static void
+gtk_xpaned_init (GtkXPaned * xpaned)
+{
+ gtk_widget_set_can_focus (GTK_WIDGET (xpaned), TRUE);
+ gtk_widget_set_has_window (GTK_WIDGET (xpaned), FALSE);
+
+ xpaned->top_left_child = NULL;
+ xpaned->top_right_child = NULL;
+ xpaned->bottom_left_child = NULL;
+ xpaned->bottom_right_child = NULL;
+ xpaned->handle_east = NULL;
+ xpaned->handle_west = NULL;
+ xpaned->handle_north = NULL;
+ xpaned->handle_south = NULL;
+ xpaned->handle_middle = NULL;
+ xpaned->cursor_type_east = GDK_SB_V_DOUBLE_ARROW;
+ xpaned->cursor_type_west = GDK_SB_V_DOUBLE_ARROW;
+ xpaned->cursor_type_north = GDK_SB_H_DOUBLE_ARROW;
+ xpaned->cursor_type_south = GDK_SB_H_DOUBLE_ARROW;
+ xpaned->cursor_type_middle = GDK_FLEUR;
+
+ xpaned->handle_pos_east.width = 5;
+ xpaned->handle_pos_east.height = 5;
+ xpaned->handle_pos_west.width = 5;
+ xpaned->handle_pos_west.height = 5;
+ xpaned->handle_pos_north.width = 5;
+ xpaned->handle_pos_north.height = 5;
+ xpaned->handle_pos_south.width = 5;
+ xpaned->handle_pos_south.height = 5;
+ xpaned->handle_pos_middle.width = 5;
+ xpaned->handle_pos_middle.height = 5;
+
+ xpaned->position_set = FALSE;
+ xpaned->last_allocation.width = -1;
+ xpaned->last_allocation.height = -1;
+ xpaned->in_drag_vert = FALSE;
+ xpaned->in_drag_horiz = FALSE;
+ xpaned->in_drag_vert_and_horiz = FALSE;
+
+ xpaned->maximized[GTK_XPANED_TOP_LEFT] = FALSE;
+ xpaned->maximized[GTK_XPANED_TOP_RIGHT] = FALSE;
+ xpaned->maximized[GTK_XPANED_BOTTOM_LEFT] = FALSE;
+ xpaned->maximized[GTK_XPANED_BOTTOM_RIGHT] = FALSE;
+
+ xpaned->priv = g_new0 (GtkXPanedPrivate, 1);
+ xpaned->last_top_left_child_focus = NULL;
+ xpaned->last_top_right_child_focus = NULL;
+ xpaned->last_bottom_left_child_focus = NULL;
+ xpaned->last_bottom_right_child_focus = NULL;
+ xpaned->in_recursion = FALSE;
+ xpaned->handle_prelit = FALSE;
+ xpaned->original_position.x = -1;
+ xpaned->original_position.y = -1;
+ xpaned->unmaximized_position.x = -1;
+ xpaned->unmaximized_position.y = -1;
+
+ xpaned->handle_pos_east.x = -1;
+ xpaned->handle_pos_east.y = -1;
+ xpaned->handle_pos_west.x = -1;
+ xpaned->handle_pos_west.y = -1;
+ xpaned->handle_pos_north.x = -1;
+ xpaned->handle_pos_north.y = -1;
+ xpaned->handle_pos_south.x = -1;
+ xpaned->handle_pos_south.y = -1;
+ xpaned->handle_pos_middle.x = -1;
+ xpaned->handle_pos_middle.y = -1;
+
+ xpaned->drag_pos.x = -1;
+ xpaned->drag_pos.y = -1;
+}
+
+static void
+gtk_xpaned_size_request (GtkWidget * widget, GtkRequisition * requisition)
+{
+ GtkXPaned *xpaned = GTK_XPANED (widget);
+ GtkRequisition child_requisition;
+
+ requisition->width = 0;
+ requisition->height = 0;
+
+ if (xpaned->top_left_child
+ && gtk_widget_get_visible (xpaned->top_left_child))
+ {
+ gtk_widget_size_request (xpaned->top_left_child, &child_requisition);
+
+ requisition->width = child_requisition.width;
+ requisition->height = child_requisition.height;
+ }
+
+ if (xpaned->top_right_child
+ && gtk_widget_get_visible (xpaned->top_right_child))
+ {
+ gtk_widget_size_request (xpaned->top_right_child, &child_requisition);
+
+ requisition->width += child_requisition.width;
+ requisition->height =
+ MAX (requisition->height, child_requisition.height);
+ }
+
+ if (xpaned->bottom_left_child
+ && gtk_widget_get_visible (xpaned->bottom_left_child))
+ {
+ gtk_widget_size_request (xpaned->bottom_left_child, &child_requisition);
+
+ requisition->width = MAX (requisition->width, child_requisition.width);
+ requisition->height += child_requisition.height;
+ }
+
+ 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 = child_requisition.width;
+ requisition->height = child_requisition.height;
+ }
+
+ /* add 2 times the set border-width to the GtkXPaneds requisition */
+ requisition->width += gtk_container_get_border_width (GTK_CONTAINER (xpaned)) * 2;
+ requisition->height += gtk_container_get_border_width (GTK_CONTAINER (xpaned)) * 2;
+
+ /* also add the handle "thickness" to GtkXPaneds width- and height-requisitions */
+ 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;
+
+ gtk_widget_style_get (widget, "handle-size", &handle_size, NULL);
+ requisition->width += handle_size;
+ requisition->height += handle_size;
+ }