gdl-dock-object.c revision 3a5a301950ddd3362739f96efbd17118ef09ea17
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*-
*
* gdl-dock-object.c - Abstract base class for all dock related objects
*
* This file is part of the GNOME Devtools Libraries.
*
* Copyright (C) 2002 Gustavo Gir�ldez <gustavo.giraldez@gmx.net>
*
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library 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
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 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-object.h"
#include "gdl-dock-master.h"
#include "libgdltypebuiltins.h"
#include "libgdlmarshal.h"
/* for later use by the registry */
#include "gdl-dock.h"
#include "gdl-dock-item.h"
#include "gdl-dock-paned.h"
#include "gdl-dock-notebook.h"
#include "gdl-dock-placeholder.h"
/* ----- Private prototypes ----- */
GParamSpec *pspec);
GParamSpec *pspec);
GValue *other_data);
/* ----- Private data types and variables ----- */
enum {
};
enum {
DOCK,
};
/* ----- Private interface ----- */
static void
{
_("Unique name for identifying the dock object"),
NULL,
_("Human readable name for the dock object"),
NULL,
_("Stock icon for the dock object"),
NULL,
_("Pixbuf icon for the dock object"),
_("Dock master this dock object is bound to"),
g_signal_new ("detach",
NULL,
NULL,
1,
g_signal_new ("dock",
NULL,
NULL,
3,
}
static void
{
object->freeze_count = 0;
}
static void
{
switch (prop_id) {
case PROP_NAME:
break;
case PROP_LONG_NAME:
break;
case PROP_STOCK_ID:
break;
case PROP_PIXBUF_ICON:
break;
case PROP_MASTER:
if (g_value_get_object (value))
else
break;
default:
break;
}
}
static void
{
switch (prop_id) {
case PROP_NAME:
break;
case PROP_LONG_NAME:
break;
case PROP_STOCK_ID:
break;
case PROP_PIXBUF_ICON:
break;
case PROP_MASTER:
break;
default:
break;
}
}
static void
{
}
static void
{
(void)user_data;
}
static void
{
if (gdl_dock_object_is_compound (object)) {
/* detach our dock object children if we have some, and even
if we are not attached, so they can get notification */
NULL);
}
if (GDL_DOCK_OBJECT_ATTACHED (object)) {
/* detach ourselves */
}
/* finally unbind us */
}
static void
{
if (GDL_DOCK_OBJECT_AUTOMATIC (object))
}
static void
{
}
}
static void
{
}
}
static void
{
/* detach children */
}
/* detach the object itself */
if (parent)
}
static void
{
if (!gdl_dock_object_is_compound (object))
return;
GList *l;
/* detach ourselves and then re-attach our children to our
current parent. if we are not currently attached, the
children are detached */
if (parent)
if (parent)
}
/* sink the widget, so any automatic floating widget is destroyed */
/* don't reenter */
if (parent)
}
}
static void
{
(void)requestor;
(void)position;
(void)other_data;
g_warning (_("Call to gdl_dock_object_dock in a dock object %p "
"(object type is %s) which hasn't implemented this method"),
}
static void
{
(void)child;
}
/* ----- Public interface ----- */
{
return klass->is_compound;
}
void
{
if (!GDL_DOCK_OBJECT_ATTACHED (object))
return;
/* freeze the object to avoid reducing while detaching children */
}
{
}
}
void
{
if (object->freeze_count == 0) {
destroyed if they are frozen */
}
object->freeze_count++;
}
void
{
object->freeze_count--;
if (object->freeze_count == 0) {
if (object->reduce_pending) {
}
}
}
void
{
if (GDL_DOCK_OBJECT_FROZEN (object)) {
return;
}
}
gint x,
gint y,
{
return GDL_CALL_VIRTUAL_WITH_DEFAULT (object,
FALSE);
}
void
{
return;
g_warning (_("Dock operation requested in a non-bound object %p. "
"The application might crash"), object);
if (!gdl_dock_object_is_bound (requestor))
g_warning (_("Cannot dock %p to %p because they belong to different masters"),
return;
}
/* first, see if we can optimize things by reordering */
if (position != GDL_DOCK_NONE) {
return;
}
/* freeze the object, since under some conditions it might be destroyed when
detaching the requestor */
/* detach the requestor before docking */
if (position != GDL_DOCK_NONE)
}
void
{
/* nothing to do here */
return;
g_warning (_("Attempt to bind to %p an already bound dock object %p "
return;
}
}
void
{
/* detach the object first */
if (GDL_DOCK_OBJECT_ATTACHED (object))
}
}
{
}
{
return GDL_CALL_VIRTUAL_WITH_DEFAULT (object,
FALSE);
}
void
{
if (parent)
/* chain the call to our parent */
}
/**
* gdl_dock_object_child_placement:
* @object: the dock object we are asking for child placement
* @child: the child of the @object we want the placement for
* @placement: where to return the placement information
*
* This function returns information about placement of a child dock
* object inside another dock object. The function returns %TRUE if
* @child is effectively a child of @object. @placement should
* normally be initially setup to %GDL_DOCK_NONE. If it's set to some
* other value, this function will not touch the stored value if the
* specified placement is "compatible" with the actual placement of
* the child.
*
* @placement can be %NULL, in which case the function simply tells if
* @child is attached to @object.
*
* Returns: %TRUE if @child is a child of @object.
*/
{
/* simple case */
if (!gdl_dock_object_is_compound (object))
return FALSE;
FALSE);
}
/* ----- dock param type functions start here ------ */
static void
{
}
static void
{
}
static void
{
}
static void
{
}
static void
{
case GDL_DOCK_NONE:
break;
case GDL_DOCK_TOP:
break;
case GDL_DOCK_BOTTOM:
break;
case GDL_DOCK_LEFT:
break;
case GDL_DOCK_RIGHT:
break;
case GDL_DOCK_CENTER:
break;
case GDL_DOCK_FLOATING:
break;
}
}
static void
{
}
static void
{
}
static void
{
}
static void
{
}
static void
{
else
}
gdl_dock_param_get_type (void)
{
if (our_type == 0) {
/* register known transform functions */
/* exporters */
g_value_register_transform_func (GDL_TYPE_DOCK_PLACEMENT, our_type, gdl_dock_param_export_placement);
/* importers */
g_value_register_transform_func (our_type, GDL_TYPE_DOCK_PLACEMENT, gdl_dock_param_import_placement);
}
return our_type;
}
/* -------------- nick <-> type conversion functions --------------- */
enum {
INDEX_NICK = 0,
};
static void
{
if (dock_register)
return;
/* FIXME: i don't know if GRelation is efficient */
/* add known types */
}
{
if (!dock_register)
}
}
{
if (!dock_register)
}
else {
/* try searching in the glib type system */
}
return type;
}
{
if (!dock_register)
}
return old_type;
}