1 /********************************************************************************
2 *                                                                               *
3 *                       T o o l B a r G r i p   W i d g e t                     *
4 *                                                                               *
5 *********************************************************************************
6 * Copyright (C) 2000,2006 by Jeroen van der Zijp.   All Rights Reserved.        *
7 *********************************************************************************
8 * This library is free software; you can redistribute it and/or                 *
9 * modify it under the terms of the GNU Lesser General Public                    *
10 * License as published by the Free Software Foundation; either                  *
11 * version 2.1 of the License, or (at your option) any later version.            *
12 *                                                                               *
13 * This library is distributed in the hope that it will be useful,               *
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of                *
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU             *
16 * Lesser General Public License for more details.                               *
17 *                                                                               *
18 * You should have received a copy of the GNU Lesser General Public              *
19 * License along with this library; if not, write to the Free Software           *
20 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA.    *
21 *********************************************************************************
22 * $Id: FXToolBarGrip.h 3297 2015-12-14 20:30:04Z arthurcnorman $                     *
23 ********************************************************************************/
24 #ifndef FXTOOLBARGRIP_H
25 #define FXTOOLBARGRIP_H
26 
27 #ifndef FXDOCKHANDLER_H
28 #include "FXDockHandler.h"
29 #endif
30 
31 namespace FX {
32 
33 
34 /// Tool Bar Grip styles
35 enum {
36   TOOLBARGRIP_SINGLE     = 0,             /// Single bar mode for movable toolbars
37   TOOLBARGRIP_DOUBLE     = 0x00008000     /// Double bar mode for dockable toolbars
38   };
39 
40 
41 /**
42 * A toolbar grip is used to move its container, a dock bar.
43 * The grip draws either a single or double bar; it is customary
44 * to use the single bar grip for toolbar-rearrangements only,
45 * and use the double-bar when the toolbar needs to be floated
46 * or docked.
47 * The toolbar grip is automatically oriented properly by the
48 * the toolbar widget, similar to the FXSeparator widget.
49 * Holding the Control Key while dragging the grip will prevent
50 * the toolbar from docking when it is near a dock site.
51 */
52 class FXAPI FXToolBarGrip : public FXDockHandler {
53   FXDECLARE(FXToolBarGrip)
54 protected:
55   FXColor activeColor;  // Color when active
56 protected:
57   FXToolBarGrip();
58 private:
59   FXToolBarGrip(const FXToolBarGrip&);
60   FXToolBarGrip& operator=(const FXToolBarGrip&);
61 public:
62   long onPaint(FXObject*,FXSelector,void*);
63   long onEnter(FXObject*,FXSelector,void*);
64   long onLeave(FXObject*,FXSelector,void*);
65 public:
66 
67   /// Construct toolbar grip
68   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);
69 
70   /// Return default width
71   virtual FXint getDefaultWidth();
72 
73   /// Return default height
74   virtual FXint getDefaultHeight();
75 
76   /// The grip can not receive the focus
77   virtual bool canFocus() const;
78 
79   /// Change toolbar grip to double
80   void setDoubleBar(FXbool dbl=TRUE);
81 
82   /// Return TRUE if toolbar grip is displayed as a double bar
83   FXbool isDoubleBar() const;
84 
85   /// Set the active color
86   void setActiveColor(FXColor clr);
87 
88   /// Get the active color
getActiveColor()89   FXColor getActiveColor() const { return activeColor; }
90 
91   /// Save to stream
92   virtual void save(FXStream& store) const;
93 
94   /// Load from stream
95   virtual void load(FXStream& store);
96   };
97 
98 }
99 
100 #endif
101