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

FXToolBarShell.h

Go to the documentation of this file.
00001 /********************************************************************************
00002 *                                                                               *
00003 *                    T o o l   B a r   S h e l l   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: FXToolBarShell.h,v 1.18 2009/01/06 13:07:28 fox Exp $                    *
00022 ********************************************************************************/
00023 #ifndef FXTOOLBARSHELL_H
00024 #define FXTOOLBARSHELL_H
00025 
00026 #ifndef FXTOPWINDOW_H
00027 #include "FXTopWindow.h"
00028 #endif
00029 
00030 namespace FX {
00031 
00032 
00033 /**
00034 * A Toolbar shell is a widget floating around over the Main Window.
00035 * It typically contains an undocked tool bar.  The Toolbar shell can
00036 * be resized horizontally by grabbing its sides if the widget contained
00037 * in the Toolbar shell has the LAYOUT_FIX_WIDTH option.  Likewise, it
00038 * can be resized vertically if the LAYOUT_FIX_HEIGHT option is passed
00039 * to the widget contained in the Toolbar shell.  If both LAYOUT_FIX_WIDTH
00040 * and LAYOUT_FIX_HEIGHT are passed to the contained widget, Toolbar shell
00041 * can also be resized by grabbing the corners.
00042 * Normally, the Toolbar shell tries to accomodate changes in its contained
00043 * widget by shrink-wrapping around it, i.e. if the contained widget changes,
00044 * the Toolbar shell will change to fit narrowly around it.
00045 */
00046 class FXAPI FXToolBarShell : public FXTopWindow {
00047   FXDECLARE(FXToolBarShell)
00048 protected:
00049   FXColor   baseColor;          // Base color
00050   FXColor   hiliteColor;        // Highlight color
00051   FXColor   shadowColor;        // Shadow color
00052   FXColor   borderColor;        // Border color
00053   FXint     border;             // Border width
00054   FXint     gripx;              // Grip offset x
00055   FXint     gripy;              // Grip offset y
00056   FXint     xopp;               // Opposite x
00057   FXint     yopp;               // Opposite y
00058   FXuchar   mode;               // Dragging mode
00059 protected:
00060   static const FXDefaultCursor cursorType[16];
00061 private:
00062   FXToolBarShell(const FXToolBarShell&);
00063   FXToolBarShell &operator=(const FXToolBarShell&);
00064 protected:
00065   FXToolBarShell();
00066   FXuchar where(FXint x,FXint y) const;
00067   void drawBorderRectangle(FXDCWindow& dc,FXint x,FXint y,FXint w,FXint h);
00068   void drawRaisedRectangle(FXDCWindow& dc,FXint x,FXint y,FXint w,FXint h);
00069   void drawSunkenRectangle(FXDCWindow& dc,FXint x,FXint y,FXint w,FXint h);
00070   void drawRidgeRectangle(FXDCWindow& dc,FXint x,FXint y,FXint w,FXint h);
00071   void drawGrooveRectangle(FXDCWindow& dc,FXint x,FXint y,FXint w,FXint h);
00072   void drawDoubleRaisedRectangle(FXDCWindow& dc,FXint x,FXint y,FXint w,FXint h);
00073   void drawDoubleSunkenRectangle(FXDCWindow& dc,FXint x,FXint y,FXint w,FXint h);
00074   void drawFrame(FXDCWindow& dc,FXint x,FXint y,FXint w,FXint h);
00075 protected:
00076   enum {
00077     DRAG_NONE        = 0,
00078     DRAG_TOP         = 1,
00079     DRAG_BOTTOM      = 2,
00080     DRAG_LEFT        = 4,
00081     DRAG_RIGHT       = 8,
00082     DRAG_TOPLEFT     = (DRAG_TOP|DRAG_LEFT),
00083     DRAG_TOPRIGHT    = (DRAG_TOP|DRAG_RIGHT),
00084     DRAG_BOTTOMLEFT  = (DRAG_BOTTOM|DRAG_LEFT),
00085     DRAG_BOTTOMRIGHT = (DRAG_BOTTOM|DRAG_RIGHT),
00086     DRAG_WHOLE       = (DRAG_TOP|DRAG_BOTTOM|DRAG_LEFT|DRAG_RIGHT)
00087     };
00088 public:
00089   long onPaint(FXObject*,FXSelector,void*);
00090   long onEnter(FXObject*,FXSelector,void*);
00091   long onLeave(FXObject*,FXSelector,void*);
00092   long onMotion(FXObject*,FXSelector,void*);
00093   long onLeftBtnPress(FXObject*,FXSelector,void*);
00094   long onLeftBtnRelease(FXObject*,FXSelector,void*);
00095   long onLayout(FXObject*,FXSelector,void*);
00096 public:
00097 
00098   /// Construct a toolbar shell
00099   FXToolBarShell(FXWindow* owner,FXuint opts=FRAME_RAISED|FRAME_THICK,FXint x=0,FXint y=0,FXint w=0,FXint h=0,FXint hs=4,FXint vs=4);
00100 
00101   /// Create server-side resources
00102   virtual void create();
00103 
00104   /// Perform layout
00105   virtual void layout();
00106 
00107   /// Return the default width of this window
00108   virtual FXint getDefaultWidth();
00109 
00110   /// Return the default height of this window
00111   virtual FXint getDefaultHeight();
00112 
00113   /// Change frame style
00114   void setFrameStyle(FXuint style);
00115 
00116   /// Get current frame style
00117   FXuint getFrameStyle() const;
00118 
00119   /// Get border width
00120   FXint getBorderWidth() const { return border; }
00121 
00122   /// Change highlight color
00123   void setHiliteColor(FXColor clr);
00124 
00125   /// Get highlight color
00126   FXColor getHiliteColor() const { return hiliteColor; }
00127 
00128   /// Change shadow color
00129   void setShadowColor(FXColor clr);
00130 
00131   /// Get shadow color
00132   FXColor getShadowColor() const { return shadowColor; }
00133 
00134   /// Change border color
00135   void setBorderColor(FXColor clr);
00136 
00137   /// Get border color
00138   FXColor getBorderColor() const { return borderColor; }
00139 
00140   /// Change base gui color
00141   void setBaseColor(FXColor clr);
00142 
00143   /// Get base gui color
00144   FXColor getBaseColor() const { return baseColor; }
00145 
00146   /// Save to stream
00147   virtual void save(FXStream& store) const;
00148 
00149   /// Load from stream
00150   virtual void load(FXStream& store);
00151   };
00152 
00153 }
00154 
00155 #endif

Copyright © 1997-2009 Jeroen van der Zijp