FXDockBar.h

Go to the documentation of this file.
00001 /********************************************************************************
00002 *                                                                               *
00003 *                        D o c k B a r   W i d g e t                            *
00004 *                                                                               *
00005 *********************************************************************************
00006 * Copyright (C) 2004,2006 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: FXDockBar.h,v 1.24 2006/01/22 17:58:00 fox Exp $                         *
00023 ********************************************************************************/
00024 #ifndef FXDOCKBAR_H
00025 #define FXDOCKBAR_H
00026 
00027 #ifndef FXPACKER_H
00028 #include "FXPacker.h"
00029 #endif
00030 
00031 namespace FX {
00032 
00033 class FXDockSite;
00034 
00035 
00044 class FXAPI FXDockBar : public FXPacker {
00045   FXDECLARE(FXDockBar)
00046 protected:
00047   FXComposite *drydock;         // Parent when docked
00048   FXComposite *wetdock;         // Parent when floating
00049   FXint        gripx;           // Grip offset x
00050   FXint        gripy;           // Grip offset y
00051   FXuchar      allowed;         // Where we're allowed to dock
00052 protected:
00053   FXDockBar();
00054 private:
00055   FXDockBar(const FXDockBar&);
00056   FXDockBar &operator=(const FXDockBar&);
00057 public:
00058   long onCmdUndock(FXObject*,FXSelector,void*);
00059   long onUpdUndock(FXObject*,FXSelector,void*);
00060   long onCmdDockTop(FXObject*,FXSelector,void*);
00061   long onUpdDockTop(FXObject*,FXSelector,void*);
00062   long onCmdDockBottom(FXObject*,FXSelector,void*);
00063   long onUpdDockBottom(FXObject*,FXSelector,void*);
00064   long onCmdDockLeft(FXObject*,FXSelector,void*);
00065   long onUpdDockLeft(FXObject*,FXSelector,void*);
00066   long onCmdDockRight(FXObject*,FXSelector,void*);
00067   long onUpdDockRight(FXObject*,FXSelector,void*);
00068   long onUpdDockFlip(FXObject*,FXSelector,void*);
00069   long onBeginDragGrip(FXObject*,FXSelector,void*);
00070   long onEndDragGrip(FXObject*,FXSelector,void*);
00071   long onDraggedGrip(FXObject*,FXSelector,void*);
00072   long onPopupMenu(FXObject*,FXSelector,void*);
00073   long onDockTimer(FXObject*,FXSelector,void*);
00074 public:
00075   enum {
00076     ID_DOCK_FLOAT=FXPacker::ID_LAST,    
00077     ID_DOCK_TOP,                        
00078     ID_DOCK_BOTTOM,                     
00079     ID_DOCK_LEFT,                       
00080     ID_DOCK_RIGHT,                      
00081     ID_DOCK_FLIP,                       
00082     ID_TOOLBARGRIP,                     
00083     ID_TIMER,
00084     ID_LAST
00085     };
00086 public:
00087   enum {
00088     ALLOW_NOWHERE=0,                                    
00089     ALLOW_TOP=1,                                        
00090     ALLOW_BOTTOM=2,                                     
00091     ALLOW_LEFT=4,                                       
00092     ALLOW_RIGHT=8,                                      
00093     ALLOW_HORIZONTAL=ALLOW_TOP|ALLOW_BOTTOM,            
00094     ALLOW_VERTICAL=ALLOW_LEFT|ALLOW_RIGHT,              
00095     ALLOW_EVERYWHERE=ALLOW_HORIZONTAL|ALLOW_VERTICAL    
00096     };
00097 public:
00098 
00108   FXDockBar(FXComposite* p,FXComposite* q,FXuint opts=LAYOUT_TOP|LAYOUT_LEFT|LAYOUT_FILL_X,FXint x=0,FXint y=0,FXint w=0,FXint h=0,FXint pl=3,FXint pr=3,FXint pt=2,FXint pb=2,FXint hs=DEFAULT_SPACING,FXint vs=DEFAULT_SPACING);
00109 
00114   FXDockBar(FXComposite* p,FXuint opts,FXint x=0,FXint y=0,FXint w=0,FXint h=0,FXint pl=2,FXint pr=3,FXint pt=3,FXint pb=2,FXint hs=DEFAULT_SPACING,FXint vs=DEFAULT_SPACING);
00115 
00117   FXbool isDocked() const;
00118 
00122   FXbool insideDock(FXDockSite* docksite,FXint barx,FXint bary);
00123 
00128   void setDryDock(FXComposite* dry);
00129 
00134   void setWetDock(FXComposite* wet);
00135 
00137   FXComposite* getDryDock() const { return drydock; }
00138 
00140   FXComposite* getWetDock() const { return wetdock; }
00141 
00143   FXDockSite* findDockAtSide(FXuint side=LAYOUT_SIDE_TOP);
00144 
00146   FXDockSite* findDockNear(FXint rootx,FXint rooty);
00147 
00153   virtual void dock(FXDockSite* docksite,FXWindow* before=NULL,FXbool notify=FALSE);
00154 
00159   virtual void dock(FXDockSite* docksite,FXint localx,FXint localy,FXbool notify);
00160 
00166   virtual void undock(FXint rootx,FXint rooty,FXbool notify=FALSE);
00167 
00172   void allowedSides(FXuchar allow){ allowed=allow; }
00173 
00177   FXuchar allowedSides() const { return allowed; }
00178 
00180   virtual void save(FXStream& store) const;
00181 
00183   virtual void load(FXStream& store);
00184 
00186   virtual ~FXDockBar();
00187   };
00188 
00189 }
00190 
00191 #endif

(C) 2002-2009 Niall Douglas. Some parts (C) to assorted authors.
Generated on Fri Nov 20 18:31:20 2009 for TnFOX by doxygen v1.4.7