diff options
| author | Alex Valavanis <valavanisalex@gmail.com> | 2011-12-23 13:12:28 +0000 |
|---|---|---|
| committer | Alex Valavanis <valavanisalex@gmail.com> | 2011-12-23 13:12:28 +0000 |
| commit | 20849c6e4c30a52b90f8a1aea9ee9054a84536eb (patch) | |
| tree | 00e14fbaf92874ca1aa14b1b2fe33001e8098c7a /src | |
| parent | GDL: Rebase on upstream commit 871CA (2010-06-26) (diff) | |
| download | inkscape-20849c6e4c30a52b90f8a1aea9ee9054a84536eb.tar.gz inkscape-20849c6e4c30a52b90f8a1aea9ee9054a84536eb.zip | |
GDL: Rebase on upstream commit 2648F (2010-10-26)
(bzr r10795)
Diffstat (limited to 'src')
| -rw-r--r-- | src/libgdl/gdl-dock-bar.c | 257 | ||||
| -rw-r--r-- | src/libgdl/gdl-dock-item-button-image.c | 2 | ||||
| -rw-r--r-- | src/libgdl/gdl-dock-item-grip.c | 9 | ||||
| -rw-r--r-- | src/libgdl/gdl-dock-item.h | 35 | ||||
| -rw-r--r-- | src/libgdl/gdl-dock-notebook.c | 2 |
5 files changed, 202 insertions, 103 deletions
diff --git a/src/libgdl/gdl-dock-bar.c b/src/libgdl/gdl-dock-bar.c index 84a901308..f742a2d73 100644 --- a/src/libgdl/gdl-dock-bar.c +++ b/src/libgdl/gdl-dock-bar.c @@ -464,9 +464,8 @@ static void gdl_dock_bar_size_vrequest (GtkWidget *widget, GtkRequisition *requisition ) { GtkBox *box; - GtkBoxChild *child; GtkRequisition child_requisition; - GList *children; + GList *child; gint nvis_children; gint height; guint border_width; @@ -476,24 +475,34 @@ static void gdl_dock_bar_size_vrequest (GtkWidget *widget, requisition->height = 0; nvis_children = 0; - children = gtk_container_get_children (GTK_CONTAINER (box)); - while (children) + + for (child = gtk_container_get_children (GTK_CONTAINER (box)); + child != NULL; child = g_list_next (child)) { - child = children->data; - children = children->next; - - if (gtk_widget_get_visible (child->widget)) + if (gtk_widget_get_visible (GTK_WIDGET (child->data))) { - gtk_widget_size_request (child->widget, &child_requisition); - + guint padding; + gboolean expand; + gboolean fill; + GtkPackType pack_type; + + gtk_widget_size_request (GTK_WIDGET (child->data), &child_requisition); + + gtk_box_query_child_packing (box, + child->data, + &expand, + &fill, + &padding, + &pack_type); + if (gtk_box_get_homogeneous (box)) { - height = child_requisition.height + child->padding * 2; + height = child_requisition.height + padding * 2; requisition->height = MAX (requisition->height, height); } else { - requisition->height += child_requisition.height + child->padding * 2; + requisition->height += child_requisition.height + padding * 2; } requisition->width = MAX (requisition->width, child_requisition.width); @@ -519,8 +528,7 @@ static void gdl_dock_bar_size_vallocate (GtkWidget *widget, GtkAllocation *allocation) { GtkBox *box; - GtkBoxChild *child; - GList *children; + GList *child; GtkAllocation child_allocation; gint nvis_children; gint nexpand_children; @@ -538,17 +546,25 @@ static void gdl_dock_bar_size_vallocate (GtkWidget *widget, nvis_children = 0; nexpand_children = 0; - children = gtk_container_get_children (GTK_CONTAINER (box)); - while (children) + for (child = gtk_container_get_children (GTK_CONTAINER (box)); + child != NULL; child = g_list_next (child)) { - child = children->data; - children = children->next; - - if (gtk_widget_get_visible (child->widget)) + guint padding; + gboolean expand; + gboolean fill; + GtkPackType pack_type; + + gtk_box_query_child_packing (box, + child->data, + &expand, + &fill, + &padding, + &pack_type); + if (gtk_widget_get_visible (GTK_WIDGET(child->data))) { nvis_children += 1; - if (child->expand) + if (expand) nexpand_children += 1; } } @@ -579,13 +595,22 @@ static void gdl_dock_bar_size_vallocate (GtkWidget *widget, child_allocation.x = allocation->x + border_width; child_allocation.width = MAX (1, (gint) allocation->width - (gint) border_width * 2); - children = gtk_container_get_children (GTK_CONTAINER (box)); - while (children) + for (child = gtk_container_get_children (GTK_CONTAINER (box)); + child != NULL; child = g_list_next (child)) { - child = children->data; - children = children->next; - - if ((child->pack == GTK_PACK_START) && gtk_widget_get_visible (child->widget)) + guint padding; + gboolean expand; + gboolean fill; + GtkPackType pack_type; + + gtk_box_query_child_packing (box, + child->data, + &expand, + &fill, + &padding, + &pack_type); + + if ((pack_type == GTK_PACK_START) && gtk_widget_get_visible (GTK_WIDGET (child->data))) { if (gtk_box_get_homogeneous (box)) { @@ -601,10 +626,10 @@ static void gdl_dock_bar_size_vallocate (GtkWidget *widget, { GtkRequisition child_requisition; - gtk_widget_get_child_requisition (child->widget, &child_requisition); - child_height = child_requisition.height + child->padding * 2; + gtk_widget_get_child_requisition (GTK_WIDGET (child->data), &child_requisition); + child_height = child_requisition.height + padding * 2; - if (child->expand) + if (expand) { if (nexpand_children == 1) child_height += height; @@ -616,21 +641,21 @@ static void gdl_dock_bar_size_vallocate (GtkWidget *widget, } } - if (child->fill) + if (fill) { - child_allocation.height = MAX (1, child_height - (gint)child->padding * 2); - child_allocation.y = y + child->padding; + child_allocation.height = MAX (1, child_height - padding * 2); + child_allocation.y = y + padding; } else { GtkRequisition child_requisition; - gtk_widget_get_child_requisition (child->widget, &child_requisition); + gtk_widget_get_child_requisition (GTK_WIDGET (child->data), &child_requisition); child_allocation.height = child_requisition.height; child_allocation.y = y + (child_height - child_allocation.height) / 2; } - gtk_widget_size_allocate (child->widget, &child_allocation); + gtk_widget_size_allocate (GTK_WIDGET (child->data), &child_allocation); y += child_height + gtk_box_get_spacing (box); } @@ -638,16 +663,25 @@ static void gdl_dock_bar_size_vallocate (GtkWidget *widget, y = allocation->y + allocation->height - border_width; - children = gtk_container_get_children (GTK_CONTAINER (box)); - while (children) + for (child = gtk_container_get_children (GTK_CONTAINER (box)); + child != NULL; child = g_list_next (child)) { - child = children->data; - children = children->next; - - if ((child->pack == GTK_PACK_END) && gtk_widget_get_visible (child->widget)) + guint padding; + gboolean expand; + gboolean fill; + GtkPackType pack_type; + + gtk_box_query_child_packing (box, + child->data, + &expand, + &fill, + &padding, + &pack_type); + + if ((pack_type == GTK_PACK_END) && gtk_widget_get_visible (GTK_WIDGET (child->data))) { GtkRequisition child_requisition; - gtk_widget_get_child_requisition (child->widget, &child_requisition); + gtk_widget_get_child_requisition (GTK_WIDGET (child->data), &child_requisition); if (gtk_box_get_homogeneous (box)) { @@ -661,9 +695,9 @@ static void gdl_dock_bar_size_vallocate (GtkWidget *widget, } else { - child_height = child_requisition.height + child->padding * 2; + child_height = child_requisition.height + padding * 2; - if (child->expand) + if (expand) { if (nexpand_children == 1) child_height += height; @@ -675,10 +709,10 @@ static void gdl_dock_bar_size_vallocate (GtkWidget *widget, } } - if (child->fill) + if (fill) { - child_allocation.height = MAX (1, child_height - (gint)child->padding * 2); - child_allocation.y = y + child->padding - child_height; + child_allocation.height = MAX (1, child_height - padding * 2); + child_allocation.y = y + padding - child_height; } else { @@ -686,7 +720,7 @@ static void gdl_dock_bar_size_vallocate (GtkWidget *widget, child_allocation.y = y + (child_height - child_allocation.height) / 2 - child_height; } - gtk_widget_size_allocate (child->widget, &child_allocation); + gtk_widget_size_allocate (GTK_WIDGET (child->data), &child_allocation); y -= (child_height + gtk_box_get_spacing (box)); } @@ -698,8 +732,7 @@ static void gdl_dock_bar_size_hrequest (GtkWidget *widget, GtkRequisition *requisition ) { GtkBox *box; - GtkBoxChild *child; - GList *children; + GList *child; gint nvis_children; gint width; guint border_width; @@ -709,26 +742,36 @@ static void gdl_dock_bar_size_hrequest (GtkWidget *widget, requisition->height = 0; nvis_children = 0; - children = gtk_container_get_children (GTK_CONTAINER (box)); - while (children) + for (child = gtk_container_get_children (GTK_CONTAINER (box)); + child != NULL; child = g_list_next (child)) { - child = children->data; - children = children->next; + guint padding; + gboolean expand; + gboolean fill; + GtkPackType pack_type; + + gtk_box_query_child_packing (box, + child->data, + &expand, + &fill, + &padding, + &pack_type); + - if (gtk_widget_get_visible (child->widget)) + if (gtk_widget_get_visible (GTK_WIDGET (child->data))) { GtkRequisition child_requisition; - gtk_widget_size_request (child->widget, &child_requisition); + gtk_widget_size_request (GTK_WIDGET (child->data), &child_requisition); if (gtk_box_get_homogeneous (box)) { - width = child_requisition.width + child->padding * 2; + width = child_requisition.width + padding * 2; requisition->width = MAX (requisition->width, width); } else { - requisition->width += child_requisition.width + child->padding * 2; + requisition->width += child_requisition.width + padding * 2; } requisition->height = MAX (requisition->height, child_requisition.height); @@ -753,8 +796,7 @@ static void gdl_dock_bar_size_hallocate (GtkWidget *widget, GtkAllocation *allocation) { GtkBox *box; - GtkBoxChild *child; - GList *children; + GList *child; GtkAllocation child_allocation; gint nvis_children; gint nexpand_children; @@ -774,17 +816,26 @@ static void gdl_dock_bar_size_hallocate (GtkWidget *widget, nvis_children = 0; nexpand_children = 0; - children = gtk_container_get_children (GTK_CONTAINER (box)); - while (children) + for (child = gtk_container_get_children (GTK_CONTAINER (box)); + child != NULL; child = g_list_next (child)) { - child = children->data; - children = children->next; - - if (gtk_widget_get_visible (child->widget)) + guint padding; + gboolean expand; + gboolean fill; + GtkPackType pack_type; + + gtk_box_query_child_packing (box, + child->data, + &expand, + &fill, + &padding, + &pack_type); + + if (gtk_widget_get_visible (GTK_WIDGET (child->data))) { nvis_children += 1; - if (child->expand) + if (expand) nexpand_children += 1; } } @@ -815,13 +866,22 @@ static void gdl_dock_bar_size_hallocate (GtkWidget *widget, child_allocation.y = allocation->y + border_width; child_allocation.height = MAX (1, (gint) allocation->height - (gint) border_width * 2); - children = gtk_container_get_children (GTK_CONTAINER (box)); - while (children) + for (child = gtk_container_get_children (GTK_CONTAINER (box)); + child != NULL; child = g_list_next (child)) { - child = children->data; - children = children->next; - - if ((child->pack == GTK_PACK_START) && gtk_widget_get_visible (child->widget)) + guint padding; + gboolean expand; + gboolean fill; + GtkPackType pack_type; + + gtk_box_query_child_packing (box, + child->data, + &expand, + &fill, + &padding, + &pack_type); + + if ((pack_type == GTK_PACK_START) && gtk_widget_get_visible (GTK_WIDGET (child->data))) { if (gtk_box_get_homogeneous (box)) { @@ -837,11 +897,11 @@ static void gdl_dock_bar_size_hallocate (GtkWidget *widget, { GtkRequisition child_requisition; - gtk_widget_get_child_requisition (child->widget, &child_requisition); + gtk_widget_get_child_requisition (GTK_WIDGET (child->data), &child_requisition); - child_width = child_requisition.width + child->padding * 2; + child_width = child_requisition.width + padding * 2; - if (child->expand) + if (expand) { if (nexpand_children == 1) child_width += width; @@ -853,16 +913,16 @@ static void gdl_dock_bar_size_hallocate (GtkWidget *widget, } } - if (child->fill) + if (fill) { - child_allocation.width = MAX (1, (gint) child_width - (gint) child->padding * 2); - child_allocation.x = x + child->padding; + child_allocation.width = MAX (1, child_width - padding * 2); + child_allocation.x = x + padding; } else { GtkRequisition child_requisition; - gtk_widget_get_child_requisition (child->widget, &child_requisition); + gtk_widget_get_child_requisition (GTK_WIDGET (child->data), &child_requisition); child_allocation.width = child_requisition.width; child_allocation.x = x + (child_width - child_allocation.width) / 2; } @@ -870,7 +930,7 @@ static void gdl_dock_bar_size_hallocate (GtkWidget *widget, if (direction == GTK_TEXT_DIR_RTL) child_allocation.x = allocation->x + allocation->width - (child_allocation.x - allocation->x) - child_allocation.width; - gtk_widget_size_allocate (child->widget, &child_allocation); + gtk_widget_size_allocate (GTK_WIDGET (child->data), &child_allocation); x += child_width + gtk_box_get_spacing (box); } @@ -878,16 +938,25 @@ static void gdl_dock_bar_size_hallocate (GtkWidget *widget, x = allocation->x + allocation->width - border_width; - children = gtk_container_get_children (GTK_CONTAINER (box)); - while (children) + for (child = gtk_container_get_children (GTK_CONTAINER (box)); + child != NULL; child = g_list_next (child)) { - child = children->data; - children = children->next; - - if ((child->pack == GTK_PACK_END) && gtk_widget_get_visible (child->widget)) + guint padding; + gboolean expand; + gboolean fill; + GtkPackType pack_type; + + gtk_box_query_child_packing (box, + child->data, + &expand, + &fill, + &padding, + &pack_type); + + if ((pack_type == GTK_PACK_END) && gtk_widget_get_visible (GTK_WIDGET (child->data))) { GtkRequisition child_requisition; - gtk_widget_get_child_requisition (child->widget, &child_requisition); + gtk_widget_get_child_requisition (GTK_WIDGET (child->data), &child_requisition); if (gtk_box_get_homogeneous (box)) { @@ -901,9 +970,9 @@ static void gdl_dock_bar_size_hallocate (GtkWidget *widget, } else { - child_width = child_requisition.width + child->padding * 2; + child_width = child_requisition.width + padding * 2; - if (child->expand) + if (expand) { if (nexpand_children == 1) child_width += width; @@ -915,10 +984,10 @@ static void gdl_dock_bar_size_hallocate (GtkWidget *widget, } } - if (child->fill) + if (fill) { - child_allocation.width = MAX (1, (gint)child_width - (gint)child->padding * 2); - child_allocation.x = x + child->padding - child_width; + child_allocation.width = MAX (1, child_width - padding * 2); + child_allocation.x = x + padding - child_width; } else { @@ -929,7 +998,7 @@ static void gdl_dock_bar_size_hallocate (GtkWidget *widget, if (direction == GTK_TEXT_DIR_RTL) child_allocation.x = allocation->x + allocation->width - (child_allocation.x - allocation->x) - child_allocation.width; - gtk_widget_size_allocate (child->widget, &child_allocation); + gtk_widget_size_allocate (GTK_WIDGET (child->data), &child_allocation); x -= (child_width + gtk_box_get_spacing (box)); } diff --git a/src/libgdl/gdl-dock-item-button-image.c b/src/libgdl/gdl-dock-item-button-image.c index da0cba274..31613a898 100644 --- a/src/libgdl/gdl-dock-item-button-image.c +++ b/src/libgdl/gdl-dock-item-button-image.c @@ -149,7 +149,7 @@ gdl_dock_item_button_image_class_init ( /** * gdl_dock_item_button_image_new: - * @param image_type: Specifies what type of image the widget should + * @image_type: Specifies what type of image the widget should * display * * Creates a new GDL dock button image object. diff --git a/src/libgdl/gdl-dock-item-grip.c b/src/libgdl/gdl-dock-item-grip.c index f0a90459c..b7c3d0f5b 100644 --- a/src/libgdl/gdl-dock-item-grip.c +++ b/src/libgdl/gdl-dock-item-grip.c @@ -280,10 +280,11 @@ gdl_dock_item_grip_fix_iconify_button (GdlDockItemGrip *grip) GdkModifierType modifiers; gint x = 0, y = 0; + gboolean ev_ret; g_return_if_fail (gtk_widget_get_realized (iconify_button)); - window = gtk_button_get_event_window (GTK_BUTTON (iconify_button)); + window = gtk_widget_get_parent_window (iconify_button); event = gdk_event_new (GDK_LEAVE_NOTIFY); g_assert (GDK_IS_WINDOW (window)); @@ -301,7 +302,9 @@ gdl_dock_item_grip_fix_iconify_button (GdlDockItemGrip *grip) event->crossing.focus = FALSE; event->crossing.state = modifiers; - gtk_widget_event (iconify_button, event); + //GTK_BUTTON (iconify_button)->in_button = FALSE; + g_signal_emit_by_name (iconify_button, "leave-notify-event", + event, &ev_ret, 0); gdk_event_free (event); } @@ -774,7 +777,7 @@ gdl_dock_item_grip_set_label (GdlDockItemGrip *grip, } /** * gdl_dock_item_grip_hide_handle: - * @item: The dock item grip to hide the handle of. + * @grip: The dock item grip to hide the handle of. * * This function hides the dock item's grip widget handle hatching. **/ diff --git a/src/libgdl/gdl-dock-item.h b/src/libgdl/gdl-dock-item.h index d97fdf6fd..b9378f783 100644 --- a/src/libgdl/gdl-dock-item.h +++ b/src/libgdl/gdl-dock-item.h @@ -42,7 +42,26 @@ G_BEGIN_DECLS #define GDL_IS_DOCK_ITEM_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GDL_TYPE_DOCK_ITEM)) #define GDL_DOCK_ITEM_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GTK_TYPE_DOCK_ITEM, GdlDockItemClass)) -/* data types & structures */ +/** + * GdlDockItemBehavior: + * @GDL_DOCK_ITEM_BEH_NORMAL: Normal dock item + * @GDL_DOCK_ITEM_BEH_NEVER_FLOATING: item cannot be undocked + * @GDL_DOCK_ITEM_BEH_NEVER_VERTICAL: item cannot be docked vertically + * @GDL_DOCK_ITEM_BEH_NEVER_HORIZONTAL: item cannot be docked horizontally + * @GDL_DOCK_ITEM_BEH_LOCKED: item is locked, it cannot be moved around + * @GDL_DOCK_ITEM_BEH_CANT_DOCK_TOP: item cannot be docked at top + * @GDL_DOCK_ITEM_BEH_CANT_DOCK_BOTTOM: item cannot be docked at bottom + * @GDL_DOCK_ITEM_BEH_CANT_DOCK_LEFT: item cannot be docked left + * @GDL_DOCK_ITEM_BEH_CANT_DOCK_RIGHT: item cannot be docked right + * @GDL_DOCK_ITEM_BEH_CANT_DOCK_CENTER: item cannot be docked at center + * @GDL_DOCK_ITEM_BEH_CANT_CLOSE: item cannot be closed + * @GDL_DOCK_ITEM_BEH_CANT_ICONIFY: item cannot be iconified + * @GDL_DOCK_ITEM_BEH_NO_GRIP: item doesn't have a grip + * + * Described the behaviour of a doc item. The item can have multiple flags set. + * + **/ + typedef enum { GDL_DOCK_ITEM_BEH_NORMAL = 0, GDL_DOCK_ITEM_BEH_NEVER_FLOATING = 1 << 0, @@ -59,12 +78,21 @@ typedef enum { GDL_DOCK_ITEM_BEH_NO_GRIP = 1 << 11 } GdlDockItemBehavior; + +/** + * GdlDockItemFlags: + * @GDL_DOCK_IN_DRAG: item is in a drag operation + * @GDL_DOCK_IN_PREDRAG: item is in a predrag operation + * @GDL_DOCK_ICONIFIED: item is iconified + * @GDL_DOCK_USER_ACTION: indicates the user has started an action on the dock item + * + * Status flag of a GdlDockItem. Don't use unless you derive a widget from GdlDockItem + * + **/ typedef enum { GDL_DOCK_IN_DRAG = 1 << GDL_DOCK_OBJECT_FLAGS_SHIFT, GDL_DOCK_IN_PREDRAG = 1 << (GDL_DOCK_OBJECT_FLAGS_SHIFT + 1), GDL_DOCK_ICONIFIED = 1 << (GDL_DOCK_OBJECT_FLAGS_SHIFT + 2), - /* for general use: indicates the user has started an action on - the dock item */ GDL_DOCK_USER_ACTION = 1 << (GDL_DOCK_OBJECT_FLAGS_SHIFT + 3) } GdlDockItemFlags; @@ -105,7 +133,6 @@ struct _GdlDockItemClass { GtkOrientation orientation); }; -/* additional macros */ #define GDL_DOCK_ITEM_FLAGS(item) (GDL_DOCK_OBJECT (item)->flags) #define GDL_DOCK_ITEM_IN_DRAG(item) \ ((GDL_DOCK_ITEM_FLAGS (item) & GDL_DOCK_IN_DRAG) != 0) diff --git a/src/libgdl/gdl-dock-notebook.c b/src/libgdl/gdl-dock-notebook.c index 6b6b4f755..a14b9e09c 100644 --- a/src/libgdl/gdl-dock-notebook.c +++ b/src/libgdl/gdl-dock-notebook.c @@ -293,7 +293,7 @@ gdl_dock_notebook_switch_page_cb (GtkNotebook *nb, "layout-changed"); /* Signal that a new dock item has been selected */ - item = GDL_DOCK_ITEM (gtk_notebook_get_nth_page (nb, page_num)); + item = GDL_DOCK_ITEM (page); gdl_dock_item_notify_selected (item); } |
