/*******************************************************************************
- **3456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789
+ **3456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789
** 10 20 30 40 50 60 70 80
**
** library for GtkXPaned-widget, a 2x2 grid-like variation of GtkPaned of gtk+
{
CHILD_PROP_0,
CHILD_PROP_RESIZE,
- CHILD_PROP_SHRINK
+ CHILD_PROP_SHRINK,
+ CHILD_PROP_LEFT_ATTACH,
+ CHILD_PROP_TOP_ATTACH
};
enum WidgetSignals
G_MAXINT,
G_PARAM_READABLE));
+
+ gtk_container_class_install_child_property (container_class,
+ CHILD_PROP_LEFT_ATTACH,
+ g_param_spec_int ("left-attach",
+ "Left Attach",
+ "The column number to which the left side of the widget should be attached",
+ 0, 1,
+ 0,
+ G_PARAM_READWRITE));
+
+
+
+ gtk_container_class_install_child_property (container_class,
+ CHILD_PROP_TOP_ATTACH,
+ g_param_spec_int ("top-attach",
+ "Top Attach",
+ "The row number to which the top side of the widget should be attached",
+ 0, 1,
+ 0,
+ G_PARAM_READWRITE));
+
+
+
/**
* GtkPaned:resize:
*
- * The "resize" child property determines whether the child expands and
+ * The "resize" child property determines whether the child expands and
* shrinks along with the paned widget.
- *
- * Since: 2.4
+ *
+ * Since: 2.4
*/
gtk_container_class_install_child_property (container_class,
CHILD_PROP_RESIZE,
/**
* GtkPaned:shrink:
*
- * The "shrink" child property determines whether the child can be made
+ * The "shrink" child property determines whether the child can be made
* smaller than its requisition.
- *
- * Since: 2.4
+ *
+ * Since: 2.4
*/
gtk_container_class_install_child_property (container_class,
CHILD_PROP_SHRINK,
GtkRequisition bottom_right_child_requisition;
gint handle_size;
+ g_print ("Allocate %p %p %p %p\n",
+ xpaned->top_left_child,
+ xpaned->top_right_child,
+ xpaned->bottom_left_child,
+ xpaned->bottom_right_child);
+
/* determine size of handle(s) */
gtk_widget_style_get (widget, "handle-size", &handle_size, NULL);
const GValue * value, GParamSpec * pspec)
{
GtkXPaned *xpaned = GTK_XPANED (container);
- gboolean old_value = FALSE;
- gboolean new_value = FALSE;
g_assert (child == xpaned->top_left_child ||
child == xpaned->top_right_child ||
child == xpaned->bottom_left_child ||
child == xpaned->bottom_right_child);
- new_value = g_value_get_boolean (value);
-
+ gint attach = g_value_get_int (value);
switch (property_id)
{
+ case CHILD_PROP_LEFT_ATTACH:
+ g_object_ref (child);
+ gtk_widget_unparent (child);
+ if (attach == 0)
+ {
+ if (child == xpaned->top_right_child)
+ xpaned->top_left_child = child;
+ else if (child == xpaned->bottom_right_child)
+ xpaned->bottom_left_child = child;
+ }
+ else
+ {
+ if (child == xpaned->top_left_child)
+ xpaned->top_right_child = child;
+ else if (child == xpaned->bottom_left_child)
+ xpaned->bottom_right_child = child;
+ }
+ gtk_widget_set_parent (child, GTK_WIDGET (xpaned));
+ g_object_unref (child);
+ break;
+ case CHILD_PROP_TOP_ATTACH:
+ g_object_ref (child);
+ gtk_widget_unparent (child);
+ if (attach == 0)
+ {
+ if (child == xpaned->bottom_right_child)
+ xpaned->top_right_child = child;
+ else if (child == xpaned->bottom_left_child)
+ xpaned->top_left_child = child;
+ }
+ else
+ {
+ if (child == xpaned->top_left_child)
+ xpaned->bottom_left_child = child;
+ else if (child == xpaned->top_right_child)
+ xpaned->bottom_right_child = child;
+ }
+ gtk_widget_set_parent (child, GTK_WIDGET (xpaned));
+ g_object_unref (child);
+ break;
case CHILD_PROP_RESIZE:
- if (child == xpaned->top_left_child)
- {
- old_value = xpaned->top_left_child_resize;
- xpaned->top_left_child_resize = new_value;
- }
- else if (child == xpaned->top_right_child)
- {
- old_value = xpaned->top_right_child_resize;
- xpaned->top_right_child_resize = new_value;
- }
- else if (child == xpaned->bottom_left_child)
- {
- old_value = xpaned->bottom_left_child_resize;
- xpaned->bottom_left_child_resize = new_value;
- }
- else if (child == xpaned->bottom_right_child)
- {
- old_value = xpaned->bottom_right_child_resize;
- xpaned->bottom_right_child_resize = new_value;
- }
+ {
+ gboolean new_value = TRUE;
+
+ if (child == xpaned->top_left_child)
+ {
+ xpaned->top_left_child_resize = new_value;
+ }
+ else if (child == xpaned->top_right_child)
+ {
+ xpaned->top_right_child_resize = new_value;
+ }
+ else if (child == xpaned->bottom_left_child)
+ {
+ xpaned->bottom_left_child_resize = new_value;
+ }
+ else if (child == xpaned->bottom_right_child)
+ {
+ xpaned->bottom_right_child_resize = new_value;
+ }
+ }
break;
-
+
case CHILD_PROP_SHRINK:
- if (child == xpaned->top_left_child)
- {
- old_value = xpaned->top_left_child_shrink;
- xpaned->top_left_child_shrink = new_value;
- }
- else if (child == xpaned->top_right_child)
- {
- old_value = xpaned->top_right_child_shrink;
- xpaned->top_right_child_shrink = new_value;
- }
- else if (child == xpaned->bottom_left_child)
- {
- old_value = xpaned->bottom_left_child_shrink;
- xpaned->bottom_left_child_shrink = new_value;
- }
- else if (child == xpaned->bottom_right_child)
- {
- old_value = xpaned->bottom_right_child_shrink;
- xpaned->bottom_right_child_shrink = new_value;
- }
+ {
+ gboolean new_value = FALSE;
+
+ if (child == xpaned->top_left_child)
+ {
+ xpaned->top_left_child_shrink = new_value;
+ }
+ else if (child == xpaned->top_right_child)
+ {
+ xpaned->top_right_child_shrink = new_value;
+ }
+ else if (child == xpaned->bottom_left_child)
+ {
+ xpaned->bottom_left_child_shrink = new_value;
+ }
+ else if (child == xpaned->bottom_right_child)
+ {
+ xpaned->bottom_right_child_shrink = new_value;
+ }
+ }
break;
default:
GTK_CONTAINER_WARN_INVALID_CHILD_PROPERTY_ID (container,
property_id, pspec);
- old_value = -1; /* quiet gcc */
break;
}
- if (old_value != new_value)
- gtk_widget_queue_resize (GTK_WIDGET (container));
+ gtk_widget_queue_resize (GTK_WIDGET (container));
+ gtk_widget_queue_draw (GTK_WIDGET (container));
}
static void
switch (property_id)
{
+ case CHILD_PROP_TOP_ATTACH:
+ if (child == xpaned->top_left_child)
+ g_value_set_int (value, 0);
+ if (child == xpaned->top_right_child)
+ g_value_set_int (value, 0);
+ if (child == xpaned->bottom_left_child)
+ g_value_set_int (value, 1);
+ if (child == xpaned->bottom_right_child)
+ g_value_set_int (value, 1);
+ break;
+ case CHILD_PROP_LEFT_ATTACH:
+ if (child == xpaned->top_left_child)
+ g_value_set_int (value, 0);
+ if (child == xpaned->bottom_left_child)
+ g_value_set_int (value, 0);
+ if (child == xpaned->top_right_child)
+ g_value_set_int (value, 1);
+ if (child == xpaned->bottom_right_child)
+ g_value_set_int (value, 1);
+ break;
case CHILD_PROP_RESIZE:
if (child == xpaned->top_left_child)
g_value_set_boolean (value, xpaned->top_left_child_resize);
/**
* gtk_xpaned_get_position_x:
* @paned: a #GtkXPaned widget
- *
+ *
* Obtains the x-position of the divider.
- *
+ *
* Return value: x-position of the divider
**/
gint
/**
* gtk_xpaned_get_position_y:
* @paned: a #GtkXPaned widget
- *
+ *
* Obtains the y-position of the divider.
- *
+ *
* Return value: y-position of the divider
**/
gint
* @paned: a #GtkXPaned widget
* @xposition: pixel x-position of divider, a negative values
* of a component mean that the position is unset.
- *
+ *
* Sets the x-position of the divider between the four panes.
**/
void
* @paned: a #GtkXPaned widget
* @yposition: pixel y-position of divider, a negative values
* of a component mean that the position is unset.
- *
+ *
* Sets the y-position of the divider between the four panes.
**/
void
/**
* gtk_xpaned_get_top_left_child:
* @xpaned: a #GtkXPaned widget
- *
+ *
* Obtains the top-left child of the xpaned widget.
- *
+ *
* Return value: top-left child, or %NULL if it is not set.
*
* Since: 2.4
/**
* gtk_xpaned_get_top_right_child:
* @xpaned: a #GtkXPaned widget
- *
+ *
* Obtains the top-right child of the xpaned widget.
- *
+ *
* Return value: top-right child, or %NULL if it is not set.
*
* Since: 2.4
/**
* gtk_xpaned_get_bottom_left_child:
* @xpaned: a #GtkXPaned widget
- *
+ *
* Obtains the bottom-left child of the xpaned widget.
- *
+ *
* Return value: bottom-left child, or %NULL if it is not set.
*
* Since: 2.4
/**
* gtk_xpaned_get_bottom_right_child:
* @xpaned: a #GtkXPaned widget
- *
+ *
* Obtains the bottom-right child of the xpaned widget.
- *
+ *
* Return value: bottom-right child, or %NULL if it is not set.
*
* Since: 2.4