gdl-dock-item.c revision 921d0715c5c9b6eef562732565c348558c24a0b9
188N/A/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- 188N/A * Author: Gustavo Gir�ldez <gustavo.giraldez@gmx.net> 188N/A * Naba Kumar <naba@gnome.org> 188N/A * Copyright (C) 1998 Ettore Perazzoli 188N/A * Copyright (C) 1998 Elliot Lee 188N/A * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald 188N/A * This library is free software; you can redistribute it and/or 188N/A * modify it under the terms of the GNU Library General Public 188N/A * License as published by the Free Software Foundation; either 188N/A * version 2 of the License, or (at your option) any later version. 5680N/A * This library is distributed in the hope that it will be useful, 188N/A * but WITHOUT ANY WARRANTY; without even the implied warranty of 188N/A * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 5680N/A * Library General Public License for more details. 5680N/A * You should have received a copy of the GNU Library General Public 188N/A * License along with this library; if not, write to the 188N/A * Free Software Foundation, Inc., 59 Temple Place - Suite 330, 188N/A * Boston, MA 02111-1307, USA. 438N/A/* ----- Private prototypes ----- */ /* ----- Class variables and definitions ----- */ /* FIXME: implement the rest of the behaviors */ /* ----- Private functions ----- */ * GdlDockItem:orientation: * The orientation of the docking item. If the orientation is set to * #GTK_ORIENTATION_VERTICAL, the grip widget will be shown along * the top of the edge of item (if it is not hidden). If the * orientation is set to #GTK_ORIENTATION_HORIZONTAL, the grip * widget will be shown down the left edge of the item (even if the * widget text direction is set to RTL). _(
"Orientation of the docking item"),
/* --- end of registration */ _(
"If set, the dock item can be resized when " "docked in a GtkPanel widget"),
_(
"General behavior for the dock item (i.e. " "whether it can float, if it's locked, etc.)"),
_(
"If set, the dock item cannot be dragged around " "and it doesn't show a grip"),
_(
"Preferred width for the dock item"),
_(
"Preferred height for the dock item"),
* GdlDockItem::dock-drag-begin: * @item: The dock item which is being dragged. * Signals that the dock item has begun to be dragged. * GdlDockItem::dock-drag-motion: * @item: The dock item which is being dragged. * @x: The x-position that the dock item has been dragged to. * @y: The y-position that the dock item has been dragged to. * Signals that a dock item dragging motion event has occured. * GdlDockItem::dock-drag-end: * @item: The dock item which is no longer being dragged. * @cancel: This value is set to TRUE if the drag was cancelled by * the user. #cancel is set to FALSE if the drag was accepted. * Signals that the dock item dragging has ended. * Signals that this dock has been selected from a switcher. "style \"gdl-dock-item-default\" {\n" "style : gtk \"gdl-dock-item-default\"\n");
g_warning (_(
"You can't add a dock object (%p of type %s) inside a %s. " "Use a GdlDock or some other compound dock object."),
g_warning (_(
"Attempting to add a widget with type %s to a %s, " "but it can only contain one widget at a time; " "it already contains a widget of type %s"),
/* If our child is not visible, we still request its size, since we won't have any useful hint for our size otherwise. */ //gtk_widget_size_request (widget, requisition); /* Once size is allocated, preferred size is no longer necessary */ /* Allocation can't be negative */ /* Check if user clicked on the drag handle. */ /* Left mousebutton click on dockitem. */ /* Set in_drag flag, grab pointer and call begin drag operation. */ /* User dropped widget somewhere. */ /* we check the window since if the item was redocked it's been unrealized and maybe it's not realized again yet */ /* we get (x,y) in our allocation coordinates system */ /* Get item's allocation. */ /* Get coordinates relative to our window. */ /* Location is inside. */ /* this are for calculating the extra docking parameter */ /* Calculate location in terms of the available space (0-100%). */ /* Determine dock location. */ /* Reset rectangle coordinates to entire item. */ /* Calculate docking indicator rectangle size for new locations. Only do this when we're not over the item's current location. */ /* adjust returned coordinates so they are have the same /* Set possible target location and return TRUE. */ /* fill-in other dock information */ else /* No docking possible at this location. */ /* If preferred size is not set on the requestor (perhaps a new item), * then estimate and set it. The default value (either 0 or 1 pixels) is g_warning (_(
"Unsupported docking strategy %s in dock object of type %s"),
/* get a paned style dock object */ /* If the parent is already a DockNotebook, we don't need g_warning (_(
"Unsupported docking strategy %s in dock object of type %s"),
/* freeze the parent so it doesn't reduce automatically */ /* ref ourselves since we could be destroyed when detached */ /* freeze the new parent, so reduce won't get called before it's actually added to our parent */ /* bind the new parent to our master, so the following adds work */ /* add the new parent to the parent */ /* show automatic object */ /* use extra docking parameter */ /* If the parent is already a DockNotebook, we don't need /* Activate the page we just added */ /* Create popup menu and attach it to the dock item */ /* grab the pointer so we receive all mouse events */ /* grab the keyboard & pointer */ /* Release pointer & keyboard. */ /* set dragoff_{x,y} as we the user clicked on the middle of the /*item->dragoff_x = item->_priv->grip_size / 2;*/ /*item->dragoff_x = GTK_WIDGET (data)->allocation.width / 2;*/ /* ----- Public interface ----- */ * @name: Unique name for identifying the dock object. * @long_name: Human readable name for the dock object. * @behavior: General behavior for the dock item (i.e. whether it can * float, if it's locked, etc.), as specified by * #GdlDockItemBehavior flags. * Creates a new dock item widget. * Returns: The newly created dock item grip widget. * gdl_dock_item_new_with_stock: * @name: Unique name for identifying the dock object. * @long_name: Human readable name for the dock object. * @stock_id: Stock icon for the dock object. * @behavior: General behavior for the dock item (i.e. whether it can * float, if it's locked, etc.), as specified by * #GdlDockItemBehavior flags. * Creates a new dock item grip widget with a given stock id. * Returns: The newly created dock item grip widget. /* convenient function (and to preserve source compat) */ * @item: The dock item that will be relocated to the dock position. * @target: (allow-none): The dock item that will be used as the point of reference. * @position: The position to dock #item, relative to #target. * @docking_param: This value is unused, and will be ignored. * Relocates a dock item to a new location relative to another dock item. /* FIXME: save previous docking position for later re-docking... does this make sense now? */ /* Create new floating dock for widget. */ * gdl_dock_item_set_orientation: * @item: The dock item which will get it's orientation set. * @orientation: The orientation to set the item to. If the orientation * is set to #GTK_ORIENTATION_VERTICAL, the grip widget will be shown * along the top of the edge of item (if it is not hidden). If the * orientation is set to #GTK_ORIENTATION_HORIZONTAL, the grip widget * will be shown down the left edge of the item (even if the widget * text direction is set to RTL). * This function sets the layout of the dock item. /* push the property down the hierarchy if our child supports it */ * gdl_dock_item_get_tablabel: * @item: The dock item from which to get the tab label widget. * Gets the current tab label widget. Note that this label widget is * only visible when the "switcher-style" property of the #GdlDockMaster * is set to #GDL_SWITCHER_STYLE_TABS * Returns: Returns the tab label widget. * gdl_dock_item_set_tablabel: * @item: The dock item which will get it's tab label widget set. * @tablabel: The widget that will become the tab label. * Replaces the current tab label widget with another widget. Note that * this label widget is only visible when the "switcher-style" property * of the #GdlDockMaster is set to #GDL_SWITCHER_STYLE_TABS /* disconnect and unref the previous tablabel */ /* connect to tablabel signal */ * gdl_dock_item_get_grip: * @item: The dock item from which to to get the grip of. * This function returns the dock item's grip label widget. * Returns: Returns the current label widget. * gdl_dock_item_hide_grip: * @item: The dock item to hide the grip of. * This function hides the dock item's grip widget. g_warning (
"Grips always show unless GDL_DOCK_ITEM_BEH_NO_GRIP is set\n" );
* gdl_dock_item_show_grip: * @item: The dock item to show the grip of. * This function shows the dock item's grip widget. * gdl_dock_item_notify_selected: * @item: the dock item to emit a selected signal on. * This function emits the selected signal. It is to be used by #GdlSwitcher * to let clients know that this item has been switched to. /* convenient function (and to preserve source compat) */ * @item: The item to bind. * @dock: The #GdlDock widget to bind it to. Note that this widget must * Binds this dock item to a new dock master. /* convenient function (and to preserve source compat) */ * @item: The item to unbind. * Unbinds this dock item from it's dock master. * gdl_dock_item_hide_item: * @item: The dock item to hide. * This function hides the dock item. When dock items are hidden they * are completely removed from the layout. * The dock item close button causes the panel to be hidden. /* if the object is manual, create a new placeholder to be able to restore the position later */ /* hide our children first, so they can also set placeholders */ /* detach the item recursively */ * gdl_dock_item_iconify_item: * @item: The dock item to iconify. * This function iconifies the dock item. When dock items are iconified * they are hidden, and appear only as icons in dock bars. * The dock item iconify button causes the panel to be iconified. * gdl_dock_item_show_item: * @item: The dock item to show. * This function shows the dock item. When dock items are shown, they * are displayed in their normal layout position. g_warning(
"Object %s has no default position and flag GDL_DOCK_ITEM_BEH_NEVER_FLOATING is set.\n",
g_warning(
"GdlDockItem %s is not bound. It cannot be shown.\n",
* @item: The dock item to lock. * This function locks the dock item. When locked the dock item cannot * be dragged around and it doesn't show a grip. * @item: The dock item to unlock. * This function unlocks the dock item. When unlocked the dock item can * be dragged around and can show a grip. * gdl_dock_item_set_default_position: * @reference: The GdlDockObject which is the default dock for @item * This method has only an effect when you add you dock_item with * GDL_DOCK_ITEM_BEH_NEVER_FLOATING. In this case you have to assign * gdl_dock_item_preferred_size: * @item: The dock item to get the preferred size of. * @req: A pointer to a #GtkRequisition into which the preferred size * Gets the preferred size of the dock item in pixels. "horizontal" :
"vertical");