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

FXToolBarGrip.h

Go to the documentation of this file.
00001 /********************************************************************************
00002 *                                                                               *
00003 *                    T o o l   B a r   G r i p   W i d g e t                    *
00004 *                                                                               *
00005 *********************************************************************************
00006 * Copyright (C) 2000,2009 by Jeroen van der Zijp.   All Rights Reserved.        *
00007 *********************************************************************************
00008 * This library is free software; you can redistribute it and/or modify          *
00009 * it under the terms of the GNU Lesser General Public License as published by   *
00010 * the Free Software Foundation; either version 3 of the License, or             *
00011 * (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                 *
00016 * GNU Lesser General Public License for more details.                           *
00017 *                                                                               *
00018 * You should have received a copy of the GNU Lesser General Public License      *
00019 * along with this program.  If not, see <http://www.gnu.org/licenses/>          *
00020 *********************************************************************************
00021 * $Id: FXToolBarGrip.h,v 1.28 2009/01/06 13:07:28 fox Exp $                     *
00022 ********************************************************************************/
00023 #ifndef FXTOOLBARGRIP_H
00024 #define FXTOOLBARGRIP_H
00025 
00026 #ifndef FXDOCKHANDLER_H
00027 #include "FXDockHandler.h"
00028 #endif
00029 
00030 namespace FX {
00031 
00032 
00033 /// Tool Bar Grip styles
00034 enum {
00035   TOOLBARGRIP_SINGLE     = 0,             /// Single bar mode for movable toolbars
00036   TOOLBARGRIP_DOUBLE     = 0x00008000     /// Double bar mode for dockable toolbars
00037   };
00038 
00039 
00040 /**
00041 * A toolbar grip is used to move its container, a dock bar.
00042 * The grip draws either a single or double bar; it is customary
00043 * to use the single bar grip for toolbar-rearrangements only,
00044 * and use the double-bar when the toolbar needs to be floated
00045 * or docked.
00046 * The toolbar grip is automatically oriented properly by the
00047 * the toolbar widget, similar to the FXSeparator widget.
00048 * Holding the Control Key while dragging the grip will prevent
00049 * the toolbar from docking when it is near a dock site.
00050 */
00051 class FXAPI FXToolBarGrip : public FXDockHandler {
00052   FXDECLARE(FXToolBarGrip)
00053 protected:
00054   FXColor activeColor;  // Color when active
00055 protected:
00056   FXToolBarGrip();
00057 private:
00058   FXToolBarGrip(const FXToolBarGrip&);
00059   FXToolBarGrip& operator=(const FXToolBarGrip&);
00060 public:
00061   long onPaint(FXObject*,FXSelector,void*);
00062   long onEnter(FXObject*,FXSelector,void*);
00063   long onLeave(FXObject*,FXSelector,void*);
00064 public:
00065 
00066   /// Construct toolbar grip
00067   FXToolBarGrip(FXComposite* p,FXObject* tgt=NULL,FXSelector sel=0,FXuint opts=TOOLBARGRIP_SINGLE,FXint x=0,FXint y=0,FXint w=0,FXint h=0,FXint pl=0,FXint pr=0,FXint pt=0,FXint pb=0);
00068 
00069   /// Return default width
00070   virtual FXint getDefaultWidth();
00071 
00072   /// Return default height
00073   virtual FXint getDefaultHeight();
00074 
00075   /// The grip can not receive the focus
00076   virtual FXbool canFocus() const;
00077 
00078   /// Change toolbar grip to double
00079   void setDoubleBar(FXbool dbl=true);
00080 
00081   /// Return true if toolbar grip is displayed as a double bar
00082   FXbool isDoubleBar() const;
00083 
00084   /// Set the active color
00085   void setActiveColor(FXColor clr);
00086 
00087   /// Get the active color
00088   FXColor getActiveColor() const { return activeColor; }
00089 
00090   /// Save to stream
00091   virtual void save(FXStream& store) const;
00092 
00093   /// Load from stream
00094   virtual void load(FXStream& store);
00095   };
00096 
00097 }
00098 
00099 #endif

Copyright © 1997-2009 Jeroen van der Zijp