Commit 8e855793 authored by Jeroen Zwartepoorte's avatar Jeroen Zwartepoorte Committed by Jeroen Zwartepoorte

Improved GdlDock look (looks more like the Gimp's docking widget now).

2004-02-08  Jeroen Zwartepoorte  <jeroen@xs4all.nl>

	* configure.in:
	* gdl/Makefile.am:
	* gdl/gdl-dock-bar.c:
	* gdl/gdl-dock-bar.h:
	* gdl/gdl-dock-item-grip.c: (gdl_dock_item_grip_get_title_area),
	(gdl_dock_item_grip_expose), (gdl_dock_item_grip_item_notify),
	(gdl_dock_item_grip_destroy), (gdl_dock_item_grip_set_property),
	(gdl_dock_item_grip_close_clicked),
	(gdl_dock_item_grip_iconify_clicked),
	(gdl_dock_item_grip_instance_init), (gdl_dock_item_grip_realize),
	(gdl_dock_item_grip_unrealize), (gdl_dock_item_grip_map),
	(gdl_dock_item_grip_unmap), (gdl_dock_item_grip_size_request),
	(gdl_dock_item_grip_size_allocate), (gdl_dock_item_grip_add),
	(gdl_dock_item_grip_remove), (gdl_dock_item_grip_forall),
	(gdl_dock_item_grip_child_type), (gdl_dock_item_grip_class_init),
	(gdl_dock_item_grip_new):
	* gdl/gdl-dock-item-grip.h:
	* gdl/gdl-dock-item.c: (gdl_dock_item_class_init),
	(gdl_dock_item_instance_init), (gdl_dock_item_set_property),
	(gdl_dock_item_get_property), (gdl_dock_item_size_request),
	(gdl_dock_item_size_allocate), (gdl_dock_item_button_changed),
	(gdl_dock_item_motion), (gdl_dock_item_tab_button),
	(gdl_dock_item_showhide_grip), (gdl_dock_item_new),
	(gdl_dock_item_new_with_stock), (gdl_dock_item_iconify_item):
	* gdl/gdl-dock-item.h:
	* gdl/gdl-dock-notebook.c: (gdl_dock_notebook_class_init),
	(gdl_dock_notebook_instance_init), (gdl_dock_notebook_dock):
	* gdl/gdl-dock-object.c: (gdl_dock_object_class_init),
	(gdl_dock_object_set_property), (gdl_dock_object_get_property):
	* gdl/gdl-dock-object.h:
	* gdl/gdl-dock.c: (gdl_dock_size_request),
	(gdl_dock_size_allocate), (gdl_dock_xor_rect):
	* gdl/gdl-dock.h:
	* gdl/gdl-stock.c: (icon_set_from_file), (add_icon),
	(gdl_stock_init):
	* gdl/gdl-stock.h:
	* gdl/stock-close-12.png:
	* gdl/stock-menu-left-12.png:
	* gdl/stock-menu-right-12.png:
	* gdl/test-dock.c: (main):

	Improved GdlDock look (looks more like the Gimp's docking widget now).
	GdlDockItems can also have a stock_id now. Added a new GdlDockBar widget
	which displays iconified dockitems.
parent 557b0d5f
2004-02-08 Jeroen Zwartepoorte <jeroen@xs4all.nl>
* configure.in:
* gdl/Makefile.am:
* gdl/gdl-dock-bar.c:
* gdl/gdl-dock-bar.h:
* gdl/gdl-dock-item-grip.c: (gdl_dock_item_grip_get_title_area),
(gdl_dock_item_grip_expose), (gdl_dock_item_grip_item_notify),
(gdl_dock_item_grip_destroy), (gdl_dock_item_grip_set_property),
(gdl_dock_item_grip_close_clicked),
(gdl_dock_item_grip_iconify_clicked),
(gdl_dock_item_grip_instance_init), (gdl_dock_item_grip_realize),
(gdl_dock_item_grip_unrealize), (gdl_dock_item_grip_map),
(gdl_dock_item_grip_unmap), (gdl_dock_item_grip_size_request),
(gdl_dock_item_grip_size_allocate), (gdl_dock_item_grip_add),
(gdl_dock_item_grip_remove), (gdl_dock_item_grip_forall),
(gdl_dock_item_grip_child_type), (gdl_dock_item_grip_class_init),
(gdl_dock_item_grip_new):
* gdl/gdl-dock-item-grip.h:
* gdl/gdl-dock-item.c: (gdl_dock_item_class_init),
(gdl_dock_item_instance_init), (gdl_dock_item_set_property),
(gdl_dock_item_get_property), (gdl_dock_item_size_request),
(gdl_dock_item_size_allocate), (gdl_dock_item_button_changed),
(gdl_dock_item_motion), (gdl_dock_item_tab_button),
(gdl_dock_item_showhide_grip), (gdl_dock_item_new),
(gdl_dock_item_new_with_stock), (gdl_dock_item_iconify_item):
* gdl/gdl-dock-item.h:
* gdl/gdl-dock-notebook.c: (gdl_dock_notebook_class_init),
(gdl_dock_notebook_instance_init), (gdl_dock_notebook_dock):
* gdl/gdl-dock-object.c: (gdl_dock_object_class_init),
(gdl_dock_object_set_property), (gdl_dock_object_get_property):
* gdl/gdl-dock-object.h:
* gdl/gdl-dock.c: (gdl_dock_size_request),
(gdl_dock_size_allocate), (gdl_dock_xor_rect):
* gdl/gdl-dock.h:
* gdl/gdl-stock.c: (icon_set_from_file), (add_icon),
(gdl_stock_init):
* gdl/gdl-stock.h:
* gdl/stock-close-12.png:
* gdl/stock-menu-left-12.png:
* gdl/stock-menu-right-12.png:
* gdl/test-dock.c: (main):
Improved GdlDock look (looks more like the Gimp's docking widget now).
GdlDockItems can also have a stock_id now. Added a new GdlDockBar widget
which displays iconified dockitems.
2004-02-05 Gustavo Giráldez <gustavo.giraldez@gmx.net>
Changes to make GdlDock self contained and only requiring Gtk+,
......
......@@ -305,6 +305,17 @@ AC_DEFINE_UNQUOTED(GETTEXT_PACKAGE, "$GETTEXT_PACKAGE", [Package name for gettex
AM_GLIB_GNU_GETTEXT
AM_GLIB_DEFINE_LOCALEDIR(GNOMELOCALEDIR)
dnl Set PREFIX
if test "x${prefix}" = "xNONE"; then
packageprefix=${ac_default_prefix}
else
packageprefix=${prefix}
fi
# images directory
gdl_images_dir="${packageprefix}/share/gdl/images"
AC_SUBST(gdl_images_dir)
AC_OUTPUT([
Makefile
gdl/Makefile
......
INCLUDES = \
-DG_LOG_DOMAIN=\"Gdl\" \
-DGDL_GLADEDIR=\""$(gladedir)"\" \
-DGDL_IMAGESDIR=\""$(gdl_images_dir)"\" \
-I$(includedir) -I$(top_srcdir) \
$(WARN_CFLAGS) $(DEPRECATED_FLAGS) \
$(GDL_DEPENDENCIES_CFLAGS) $(XML_CFLAGS)
......@@ -53,8 +54,10 @@ libgdl_headers = \
gdl-dock-tablabel.h \
gdl-dock-layout.h \
gdl-dock-placeholder.h \
gdl-dock-bar.h \
gdl-icons.h \
gdl-recent.h
gdl-recent.h \
gdl-stock.h
libgdl_1_la_SOURCES = \
$(CORBA_GENERATED) \
......@@ -73,8 +76,10 @@ libgdl_1_la_SOURCES = \
gdl-dock-tablabel.c \
gdl-dock-layout.c \
gdl-dock-placeholder.c \
gdl-dock-bar.c \
gdl-icons.c \
gdl-recent.c \
gdl-stock.c \
libgdltypebuiltins.h \
libgdltypebuiltins.c \
libgdlmarshal.h \
......@@ -98,6 +103,12 @@ libgdlinclude_HEADERS = \
gladedir = $(datadir)/gdl/glade
glade_DATA = layout.glade
imagedir = $(gdl_images_dir)
image_DATA = \
stock-close-12.png \
stock-menu-left-12.png \
stock-menu-right-12.png
EXTRA_DIST = libgdlmarshal.list \
tree-expand.xpm \
tree-contract.xpm \
......
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*-
*
* This file is part of the GNOME Devtools Libraries.
*
* Copyright (C) 2003 Jeroen Zwartepoorte <jeroen@xs4all.nl>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#include "gdl-i18n.h"
#include <stdlib.h>
#include <string.h>
#include "gdl-tools.h"
#include "gdl-dock.h"
#include "gdl-dock-master.h"
#include "gdl-dock-bar.h"
enum {
PROP_0,
PROP_MASTER,
};
/* ----- Private prototypes ----- */
static void gdl_dock_bar_class_init (GdlDockBarClass *klass);
static void gdl_dock_bar_instance_init (GdlDockBar *dockbar);
static void gdl_dock_bar_get_property (GObject *object,
guint prop_id,
GValue *value,
GParamSpec *pspec);
static void gdl_dock_bar_set_property (GObject *object,
guint prop_id,
const GValue *value,
GParamSpec *pspec);
static void gdl_dock_bar_destroy (GtkObject *object);
static void gdl_dock_bar_attach (GdlDockBar *dockbar,
GdlDockMaster *master);
/* ----- Class variables and definitions ----- */
struct _GdlDockBarPrivate {
GdlDockMaster *master;
GSList *items;
GtkTooltips *tooltips;
};
/* ----- Private functions ----- */
GDL_CLASS_BOILERPLATE (GdlDockBar, gdl_dock_bar, GtkVBox, GTK_TYPE_VBOX);
static void
gdl_dock_bar_class_init (GdlDockBarClass *klass)
{
GObjectClass *g_object_class;
GtkObjectClass *gtk_object_class;
g_object_class = G_OBJECT_CLASS (klass);
gtk_object_class = GTK_OBJECT_CLASS (klass);
g_object_class->get_property = gdl_dock_bar_get_property;
g_object_class->set_property = gdl_dock_bar_set_property;
gtk_object_class->destroy = gdl_dock_bar_destroy;
g_object_class_install_property (
g_object_class, PROP_MASTER,
g_param_spec_object ("master", _("Master"),
_("GdlDockMaster object which the dockbar widget "
"is attached to"),
GDL_TYPE_DOCK_MASTER,
G_PARAM_READWRITE));
}
static void
gdl_dock_bar_instance_init (GdlDockBar *dockbar)
{
dockbar->_priv = g_new0 (GdlDockBarPrivate, 1);
dockbar->_priv->master = NULL;
dockbar->_priv->items = NULL;
dockbar->_priv->tooltips = gtk_tooltips_new ();
}
static void
gdl_dock_bar_get_property (GObject *object,
guint prop_id,
GValue *value,
GParamSpec *pspec)
{
GdlDockBar *dockbar = GDL_DOCK_BAR (object);
switch (prop_id) {
case PROP_MASTER:
g_value_set_object (value, dockbar->_priv->master);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
};
}
static void
gdl_dock_bar_set_property (GObject *object,
guint prop_id,
const GValue *value,
GParamSpec *pspec)
{
GdlDockBar *dockbar = GDL_DOCK_BAR (object);
switch (prop_id) {
case PROP_MASTER:
gdl_dock_bar_attach (dockbar, g_value_get_object (value));
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
};
}
static void
gdl_dock_bar_destroy (GtkObject *object)
{
GdlDockBar *dockbar = GDL_DOCK_BAR (object);
if (dockbar->_priv) {
GdlDockBarPrivate *priv = dockbar->_priv;
if (priv->master) {
g_signal_handlers_disconnect_matched (priv->master,
G_SIGNAL_MATCH_DATA,
0, 0, NULL, NULL, dockbar);
g_object_unref (priv->master);
priv->master = NULL;
}
if (priv->tooltips) {
gtk_object_destroy (GTK_OBJECT (priv->tooltips));
priv->tooltips = NULL;
}
dockbar->_priv = NULL;
g_free (priv);
}
GDL_CALL_PARENT (GTK_OBJECT_CLASS, destroy, (object));
}
static void
gdl_dock_bar_remove_item (GdlDockBar *dockbar,
GdlDockItem *item)
{
GdlDockBarPrivate *priv;
GtkWidget *button;
g_return_if_fail (GDL_IS_DOCK_BAR (dockbar));
g_return_if_fail (GDL_IS_DOCK_ITEM (item));
priv = dockbar->_priv;
if (g_slist_index (priv->items, item) == -1) {
g_warning ("Item has not been added to the dockbar");
return;
}
priv->items = g_slist_remove (priv->items, item);
button = g_object_get_data (G_OBJECT (item), "GdlDockBarButton");
g_assert (button != NULL);
gtk_container_remove (GTK_CONTAINER (dockbar), button);
g_object_set_data (G_OBJECT (item), "GdlDockBarButton", NULL);
}
static void
gdl_dock_bar_item_clicked (GtkWidget *button,
GdlDockItem *item)
{
GdlDockBar *dockbar;
GdlDockObject *controller;
g_return_if_fail (item != NULL);
dockbar = g_object_get_data (G_OBJECT (item), "GdlDockBar");
g_assert (dockbar != NULL);
g_object_set_data (G_OBJECT (item), "GdlDockBar", NULL);
controller = gdl_dock_master_get_controller (GDL_DOCK_OBJECT_GET_MASTER (item));
GDL_DOCK_OBJECT_UNSET_FLAGS (item, GDL_DOCK_ICONIFIED);
gdl_dock_item_show_item (item);
gdl_dock_bar_remove_item (dockbar, item);
gtk_widget_queue_resize (GTK_WIDGET (controller));
}
static void
gdl_dock_bar_add_item (GdlDockBar *dockbar,
GdlDockItem *item)
{
GdlDockBarPrivate *priv;
GtkWidget *button;
gchar *stock_id;
gchar *name;
GtkWidget *image;
g_return_if_fail (GDL_IS_DOCK_BAR (dockbar));
g_return_if_fail (GDL_IS_DOCK_ITEM (item));
priv = dockbar->_priv;
if (g_slist_index (priv->items, item) != -1) {
g_warning ("Item has already been added to the dockbar");
return;
}
priv->items = g_slist_append (priv->items, item);
/* Create a button for the item. */
button = gtk_button_new ();
gtk_button_set_relief (GTK_BUTTON (button), GTK_RELIEF_NONE);
g_object_get (item, "stock_id", &stock_id, "long_name", &name, NULL);
if (stock_id) {
image = gtk_image_new_from_stock (stock_id,
GTK_ICON_SIZE_SMALL_TOOLBAR);
g_free (stock_id);
} else {
image = gtk_image_new_from_stock (GTK_STOCK_NEW,
GTK_ICON_SIZE_SMALL_TOOLBAR);
}
gtk_container_add (GTK_CONTAINER (button), image);
gtk_box_pack_start (GTK_BOX (dockbar), button, FALSE, FALSE, 0);
gtk_tooltips_set_tip (priv->tooltips, button, name, name);
g_object_set_data (G_OBJECT (item), "GdlDockBar", dockbar);
g_object_set_data (G_OBJECT (item), "GdlDockBarButton", button);
g_signal_connect (G_OBJECT (button), "clicked",
G_CALLBACK (gdl_dock_bar_item_clicked), item);
gtk_widget_show_all (button);
}
static void
build_list (GdlDockObject *object, GList **list)
{
/* add only items, not toplevels */
if (GDL_IS_DOCK_ITEM (object))
*list = g_list_prepend (*list, object);
}
static void
update_dock_items (GdlDockBar *dockbar)
{
GdlDockMaster *master;
GList *items, *l;
g_return_if_fail (dockbar != NULL);
if (!dockbar->_priv->master)
return;
master = dockbar->_priv->master;
/* build items list */
items = NULL;
gdl_dock_master_foreach (master, (GFunc) build_list, &items);
for (l = items; l != NULL; l = l->next) {
GdlDockItem *item = GDL_DOCK_ITEM (l->data);
if (GDL_DOCK_ITEM_ICONIFIED (item))
gdl_dock_bar_add_item (dockbar, item);
}
g_list_free (items);
}
static void
gdl_dock_bar_layout_changed_cb (GdlDockMaster *master,
GdlDockBar *dockbar)
{
update_dock_items (dockbar);
}
static void
gdl_dock_bar_attach (GdlDockBar *dockbar,
GdlDockMaster *master)
{
g_return_if_fail (dockbar != NULL);
g_return_if_fail (master == NULL || GDL_IS_DOCK_MASTER (master));
if (dockbar->_priv->master) {
g_signal_handlers_disconnect_matched (dockbar->_priv->master,
G_SIGNAL_MATCH_DATA,
0, 0, NULL, NULL, dockbar);
g_object_unref (dockbar->_priv->master);
}
dockbar->_priv->master = master;
if (dockbar->_priv->master) {
g_object_ref (dockbar->_priv->master);
g_signal_connect (dockbar->_priv->master, "layout_changed",
G_CALLBACK (gdl_dock_bar_layout_changed_cb),
dockbar);
}
update_dock_items (dockbar);
}
GtkWidget *
gdl_dock_bar_new (GdlDock *dock)
{
GdlDockMaster *master = NULL;
/* get the master of the given dock */
if (dock)
master = GDL_DOCK_OBJECT_GET_MASTER (dock);
return g_object_new (GDL_TYPE_DOCK_BAR,
"master", master, NULL);
}
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*-
*
* This file is part of the GNOME Devtools Libraries.
*
* Copyright (C) 2003 Jeroen Zwartepoorte <jeroen@xs4all.nl>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
#ifndef __GDL_DOCK_BAR_H__
#define __GDL_DOCK_BAR_H__
#include <gtk/gtkvbox.h>
G_BEGIN_DECLS
/* standard macros */
#define GDL_TYPE_DOCK_BAR (gdl_dock_bar_get_type ())
#define GDL_DOCK_BAR(obj) (GTK_CHECK_CAST ((obj), GDL_TYPE_DOCK_BAR, GdlDockBar))
#define GDL_DOCK_BAR_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), GDL_TYPE_DOCK_BAR, GdlDockBarClass))
#define GDL_IS_DOCK_BAR(obj) (GTK_CHECK_TYPE ((obj), GDL_TYPE_DOCK_BAR))
#define GDL_IS_DOCK_BAR_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((klass), GDL_TYPE_DOCK_BAR))
#define GDL_DOCK_BAR_GET_CLASS(obj) (GTK_CHECK_GET_CLASS ((obj), GTK_TYPE_DOCK_BAR, GdlDockBarClass))
/* data types & structures */
typedef struct _GdlDockBar GdlDockBar;
typedef struct _GdlDockBarClass GdlDockBarClass;
typedef struct _GdlDockBarPrivate GdlDockBarPrivate;
struct _GdlDockBar {
GtkVBox parent;
GdlDock *dock;
GdlDockBarPrivate *_priv;
};
struct _GdlDockBarClass {
GtkVBoxClass parent_class;
};
GType gdl_dock_bar_get_type (void);
GtkWidget *gdl_dock_bar_new (GdlDock *dock);
G_END_DECLS
#endif /* __GDL_DOCK_BAR_H__ */
This diff is collapsed.
......@@ -30,17 +30,25 @@ G_BEGIN_DECLS
#define GDL_DOCK_ITEM_GRIP_GET_CLASS(obj) \
(GTK_CHECK_GET_CLASS ((obj), GDL_TYPE_DOCK_ITEM_GRIP, GdlDockItemGripClass))
typedef struct {
GtkWidget parent;
typedef struct _GdlDockItemGrip GdlDockItemGrip;
typedef struct _GdlDockItemGripClass GdlDockItemGripClass;
typedef struct _GdlDockItemGripPrivate GdlDockItemGripPrivate;
struct _GdlDockItemGrip {
GtkContainer parent;
GdlDockItem *item;
} GdlDockItemGrip;
GdkWindow *title_window;
GdlDockItemGripPrivate *_priv;
};
typedef struct {
GtkWidgetClass parent_class;
struct _GdlDockItemGripClass {
GtkContainerClass parent_class;
void (*activate) (GdlDockItemGrip *grip);
} GdlDockItemGripClass;
};
GType gdl_dock_item_grip_get_type (void);
GtkWidget *gdl_dock_item_grip_new (GdlDockItem *item);
......
......@@ -142,7 +142,6 @@ enum {
PROP_ORIENTATION,
PROP_RESIZE,
PROP_BEHAVIOR,
PROP_GRIP_SIZE,
PROP_LOCKED,
PROP_PREFERRED_WIDTH,
PROP_PREFERRED_HEIGHT
......@@ -157,7 +156,6 @@ enum {
static guint gdl_dock_item_signals [LAST_SIGNAL] = { 0 };
#define DEFAULT_GRIP_SIZE 10
#define GDL_DOCK_ITEM_NOT_LOCKED(item) !((item)->behavior & GDL_DOCK_ITEM_BEH_LOCKED)
#define GDL_DOCK_ITEM_GRIP_SHOWN(item) \
(GDL_DOCK_ITEM_HAS_GRIP (item) && \
......@@ -241,7 +239,7 @@ gdl_dock_item_class_init (GdlDockItemClass *klass)
g_param_spec_enum ("orientation", _("Orientation"),
_("Orientation of the docking item"),
GTK_TYPE_ORIENTATION,
GTK_ORIENTATION_HORIZONTAL,
GTK_ORIENTATION_VERTICAL,
G_PARAM_READWRITE | G_PARAM_CONSTRUCT |
GDL_DOCK_PARAM_EXPORT));
......@@ -269,13 +267,6 @@ gdl_dock_item_class_init (GdlDockItemClass *klass)
GDL_DOCK_ITEM_BEH_NORMAL,
G_PARAM_READWRITE));
g_object_class_install_property (
g_object_class, PROP_GRIP_SIZE,
g_param_spec_uint ("grip_size", _("Grip size"),
_("Size in pixels of the grip to drag the dock item"),
0, 100, DEFAULT_GRIP_SIZE,
G_PARAM_READWRITE));
g_object_class_install_property (
g_object_class, PROP_LOCKED,
g_param_spec_boolean ("locked", _("Locked"),
......@@ -351,7 +342,7 @@ gdl_dock_item_instance_init (GdlDockItem *item)
item->child = NULL;
item->orientation = GTK_ORIENTATION_HORIZONTAL;
item->orientation = GTK_ORIENTATION_VERTICAL;
item->behavior = GDL_DOCK_ITEM_BEH_NORMAL;
item->resize = TRUE;
......@@ -362,7 +353,6 @@ gdl_dock_item_instance_init (GdlDockItem *item)
item->_priv->menu = NULL;
item->_priv->preferred_width = item->_priv->preferred_height = -1;
item->_priv->grip_size = DEFAULT_GRIP_SIZE;
item->_priv->tab_label = NULL;
item->_priv->ph = NULL;
......@@ -429,11 +419,6 @@ gdl_dock_item_set_property (GObject *g_object,
break;
}
case PROP_GRIP_SIZE:
item->_priv->grip_size = g_value_get_uint (value);
if (GDL_DOCK_ITEM_GRIP_SHOWN (item))
gtk_widget_queue_resize (GTK_WIDGET (item));
break;
case PROP_LOCKED:
{
GdlDockItemBehavior old_beh = item->behavior;
......@@ -483,9 +468,6 @@ gdl_dock_item_get_property (GObject *g_object,
case PROP_BEHAVIOR:
g_value_set_flags (value, item->behavior);
break;
case PROP_GRIP_SIZE:
g_value_set_uint (value, item->_priv->grip_size);
break;
case PROP_LOCKED:
g_value_set_boolean (value, !GDL_DOCK_ITEM_NOT_LOCKED (item));
break;
......@@ -629,6 +611,7 @@ gdl_dock_item_size_request (GtkWidget *widget,
GtkRequisition *requisition)
{
GtkRequisition child_requisition;
GtkRequisition grip_requisition;
GdlDockItem *item;
g_return_if_fail (GDL_IS_DOCK_ITEM (widget));
......@@ -646,16 +629,26 @@ gdl_dock_item_size_request (GtkWidget *widget,
}
if (item->orientation == GTK_ORIENTATION_HORIZONTAL) {
requisition->width =
GDL_DOCK_ITEM_GRIP_SHOWN (item) ? item->_priv->grip_size : 0;
if (GDL_DOCK_ITEM_GRIP_SHOWN (item)) {
gtk_widget_size_request (item->_priv->grip, &grip_requisition);
requisition->width = grip_requisition.width;
} else {
requisition->width = 0;
}
if (item->child) {
requisition->width += child_requisition.width;
requisition->height = child_requisition.height;
} else
requisition->height = 0;
} else {
requisition->height =
GDL_DOCK_ITEM_GRIP_SHOWN (item) ? item->_priv->grip_size : 0;
if (GDL_DOCK_ITEM_GRIP_SHOWN (item)) {
gtk_widget_size_request (item->_priv->grip, &grip_requisition);
requisition->height = grip_requisition.height;
} else {
requisition->height = 0;
}
if (item->child) {
requisition->width = child_requisition.width;
requisition->height += child_requisition.height;
......@@ -702,21 +695,24 @@ gdl_dock_item_size_allocate (GtkWidget *widget,
if (GDL_DOCK_ITEM_GRIP_SHOWN (item)) {
GtkAllocation grip_alloc = *allocation;
GtkRequisition grip_req;
gtk_widget_size_request (item->_priv->grip, &grip_req);
grip_alloc.x = grip_alloc.y = 0;
if (item->orientation == GTK_ORIENTATION_HORIZONTAL) {
child_allocation.x += item->_priv->grip_size;
child_allocation.width -= item->_priv->grip_size;
grip_alloc.width = item->_priv->grip_size;
child_allocation.x += grip_req.width;
child_allocation.width -= grip_req.width;
grip_alloc.width = grip_req.width;
} else {
child_allocation.y += item->_priv->grip_size;
child_allocation.height -= item->_priv->grip_size;
grip_alloc.height = item->_priv->grip_size;
child_allocation.y += grip_req.height;
child_allocation.height -= grip_req.height;
grip_alloc.height = grip_req.height;
}
if (item->_priv->grip)
gtk_widget_size_allocate (item->_priv->grip, &grip_alloc);
};
}
gtk_widget_size_allocate (item->child, &child_allocation);
}
}
......@@ -858,6 +854,9 @@ gdl_dock_item_expose (GtkWidget *widget,
return FALSE;
}
#define EVENT_IN_GRIP_EVENT_WINDOW(ev,gr) \
((gr) != NULL && (ev)->window == GDL_DOCK_ITEM_GRIP (gr)->title_window)