Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members

FXDockSite.h

00001 /******************************************************************************** 00002 * * 00003 * D o c k S i t e W i d g e t * 00004 * * 00005 ********************************************************************************* 00006 * Copyright (C) 2004,2005 by Jeroen van der Zijp. All Rights Reserved. * 00007 ********************************************************************************* 00008 * This library is free software; you can redistribute it and/or * 00009 * modify it under the terms of the GNU Lesser General Public * 00010 * License as published by the Free Software Foundation; either * 00011 * version 2.1 of the License, or (at your option) any later version. * 00012 * * 00013 * This library is distributed in the hope that it will be useful, * 00014 * but WITHOUT ANY WARRANTY; without even the implied warranty of * 00015 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * 00016 * Lesser General Public License for more details. * 00017 * * 00018 * You should have received a copy of the GNU Lesser General Public * 00019 * License along with this library; if not, write to the Free Software * 00020 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. * 00021 ********************************************************************************* 00022 * $Id: FXDockSite.h,v 1.22 2005/02/03 04:00:59 fox Exp $ * 00023 ********************************************************************************/ 00024 #ifndef FXDOCKSITE_H 00025 #define FXDOCKSITE_H 00026 00027 #ifndef FXPACKER_H 00028 #include "FXPacker.h" 00029 #endif 00030 00031 namespace FX { 00032 00033 00034 class FXDockBar; 00035 00036 /** 00037 * The dock site widget is a widget where dock bars can be docked. 00038 * Dock site widgets are typically embedded inside the main window, placed 00039 * against those sides where docking of toolbars is to be allowed. 00040 * Dock bars placed inside a dock site are laid out in horizontal or vertical bands 00041 * called galleys. A toolbar with the LAYOUT_DOCK_SAME hint is preferentially placed 00042 * on the same galley as its previous sibling. A dock bar with the LAYOUT_DOCK_NEXT is 00043 * always placed on the next galley. 00044 * Each galley will have at least one dock bar shown in it. Several dock bars 00045 * may be placed side-by-side inside one galley, unless there is insufficient 00046 * room. If there is insufficient room to place another dock bar, that dock bar 00047 * will be moved to the next galley, even though its LAYOUT_DOCK_NEXT option 00048 * is not set. This implies that when the main window is resized and more room 00049 * becomes available, it will jump back to its preferred galley. 00050 * Within a galley, dock bars will be placed from left to right, at the given 00051 * x and y coordinates, with the constraints that the dock bar will stay within 00052 * the galley, and do not overlap each other. It is possible to use LAYOUT_FILL_X 00053 * and/or LAYOUT_FILL_Y to stretch a toolbar to the available space on its galley. 00054 * The galleys are oriented horizontally if the dock site is placed inside 00055 * a top level window using LAYOUT_SIDE_TOP or LAYOUT_SIDE_BOTTOM, and 00056 * vertically oriented if placed with LAYOUT_SIDE_LEFT or LAYOUT_SIDE_RIGHT. 00057 */ 00058 class FXAPI FXDockSite : public FXPacker { 00059 FXDECLARE(FXDockSite) 00060 protected: 00061 FXDockSite(){} 00062 private: 00063 FXDockSite(const FXDockSite&); 00064 FXDockSite &operator=(const FXDockSite&); 00065 protected: 00066 void moveVerBar(FXWindow* bar,FXWindow *begin,FXWindow* end,FXint bx,FXint by); 00067 void moveHorBar(FXWindow* bar,FXWindow *begin,FXWindow* end,FXint bx,FXint by); 00068 FXint galleyWidth(FXWindow *begin,FXWindow*& end,FXint space,FXint& require,FXint& expand) const; 00069 FXint galleyHeight(FXWindow *begin,FXWindow*& end,FXint space,FXint& require,FXint& expand) const; 00070 public: 00071 00072 /** 00073 * Construct a toolbar dock layout manager. Passing LAYOUT_SIDE_TOP or LAYOUT_SIDE_BOTTOM 00074 * causes the toolbar dock to be oriented horizontally. Passing LAYOUT_SIDE_LEFT or 00075 * LAYOUT_SIDE_RIGHT causes it to be oriented vertically. 00076 */ 00077 FXDockSite(FXComposite *p,FXuint opts=0,FXint x=0,FXint y=0,FXint w=0,FXint h=0,FXint pl=0,FXint pr=0,FXint pt=0,FXint pb=0,FXint hs=0,FXint vs=0); 00078 00079 /** 00080 * Return default width. This is the width the toolbar 00081 * dock would have if no toolbars need to be moved to other 00082 * galleys than they would be logically placed. 00083 */ 00084 virtual FXint getDefaultWidth(); 00085 00086 /** 00087 * Return default height. This is the height the toolbar 00088 * dock would have if no toolbars need to be moved to other 00089 * galleys than they would be logically placed. 00090 */ 00091 virtual FXint getDefaultHeight(); 00092 00093 /** 00094 * For a vertically oriented dock site, this computes 00095 * the total width of all the galleys based on any "wrapping" 00096 * needed to fit the toolbars on a galley. 00097 */ 00098 virtual FXint getWidthForHeight(FXint h); 00099 00100 /** 00101 * For a horizontally oriented dock site, this computes 00102 * the total height of all the galleys based on any "wrapping" 00103 * needed to fit the toolbars on a galley. 00104 */ 00105 virtual FXint getHeightForWidth(FXint w); 00106 00107 /// Perform layout 00108 virtual void layout(); 00109 00110 /** 00111 * Move tool bar, changing its options to suite the new position. 00112 * Used by the toolbar dragging to rearrange the toolbars inside the 00113 * toolbar dock. 00114 * 00115 */ 00116 virtual void moveToolBar(FXDockBar* bar,FXint barx,FXint bary); 00117 00118 /** 00119 * The dock site is notified that the given bar has been added 00120 * logically before the given window, and is to placed on a new 00121 * galley all by itself. The default implementation adjusts 00122 * the layout options of the bars accordingly. 00123 */ 00124 virtual void dockToolBar(FXDockBar* bar,FXWindow* before); 00125 00126 /** 00127 * The dock site is informed that the given bar has been docked 00128 * at the given coordinates. The default implementation determines 00129 * where to insert the newly docked bar and adjusts the layout 00130 * options of the bars accordingly. 00131 */ 00132 virtual void dockToolBar(FXDockBar* bar,FXint barx,FXint bary); 00133 00134 /** 00135 * The dock site is informed that the given bar has been removed. 00136 * In the default implementation, the dock site fixes the layout 00137 * options of the remaining bars so they stay in the same place 00138 * if possible. 00139 */ 00140 virtual void undockToolBar(FXDockBar* bar); 00141 00142 }; 00143 00144 } 00145 00146 #endif

Copyright © 1997-2005 Jeroen van der Zijp