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

FXToolBarTab.h

Go to the documentation of this file.
00001 /********************************************************************************
00002 *                                                                               *
00003 *                       T o o l   B a r   T a b   W i d g e t                   *
00004 *                                                                               *
00005 *********************************************************************************
00006 * Copyright (C) 1999,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: FXToolBarTab.h,v 1.11 2006/01/22 17:58:11 fox Exp $                      *
00023 ********************************************************************************/
00024 #ifndef FXTOOLBARTAB_H
00025 #define FXTOOLBARTAB_H
00026 
00027 #ifndef FXFRAME_H
00028 #include "FXFrame.h"
00029 #endif
00030 
00031 namespace FX {
00032 
00033 
00034 /// Tool Bar Tab styles
00035 enum {
00036   TOOLBARTAB_HORIZONTAL = 0,              /// Default is for horizontal toolbar
00037   TOOLBARTAB_VERTICAL   = 0x00008000      /// For vertical toolbar
00038   };
00039 
00040 
00041 
00042 /**
00043 * A toolbar tab is used to collapse or uncollapse a sibling
00044 * widget.  The sibling affected is the widget immediately following
00045 * the toolbar tab or, if the toolbar tab is the last widget in the list,
00046 * the widget immediately preceding the toolbar tab.
00047 */
00048 class FXAPI FXToolBarTab : public FXFrame {
00049   FXDECLARE(FXToolBarTab)
00050 protected:
00051   FXColor  activeColor; // Color when active
00052   FXString tip;         // Tooltip
00053   FXbool   collapsed;   // Is collapsed flat
00054   FXbool   down;        // Button down
00055 protected:
00056   FXToolBarTab();
00057   void drawUpArrow(FXDCWindow& dc);
00058   void drawDownArrow(FXDCWindow& dc);
00059   void drawRightArrow(FXDCWindow& dc);
00060   void drawLeftArrow(FXDCWindow& dc);
00061   void drawHSpeckles(FXDCWindow& dc,FXint x,FXint w);
00062   void drawVSpeckles(FXDCWindow& dc,FXint y,FXint h);
00063 private:
00064   FXToolBarTab(const FXToolBarTab&);
00065   FXToolBarTab& operator=(const FXToolBarTab&);
00066 public:
00067   long onPaint(FXObject*,FXSelector,void*);
00068   long onUpdate(FXObject*,FXSelector,void*);
00069   long onEnter(FXObject*,FXSelector,void*);
00070   long onLeave(FXObject*,FXSelector,void*);
00071   long onUngrabbed(FXObject*,FXSelector,void*);
00072   long onLeftBtnPress(FXObject*,FXSelector,void*);
00073   long onLeftBtnRelease(FXObject*,FXSelector,void*);
00074   long onKeyPress(FXObject*,FXSelector,void*);
00075   long onKeyRelease(FXObject*,FXSelector,void*);
00076   long onCmdCollapse(FXObject*,FXSelector,void*);
00077   long onUpdCollapse(FXObject*,FXSelector,void*);
00078   long onCmdUncollapse(FXObject*,FXSelector,void*);
00079   long onUpdUncollapse(FXObject*,FXSelector,void*);
00080   long onCmdSetTip(FXObject*,FXSelector,void*);
00081   long onCmdGetTip(FXObject*,FXSelector,void*);
00082   long onQueryTip(FXObject*,FXSelector,void*);
00083 public:
00084   enum {
00085     ID_COLLAPSE=FXFrame::ID_LAST,
00086     ID_UNCOLLAPSE,
00087     ID_LAST
00088     };
00089 public:
00090 
00091   /// Construct toolbar tab
00092   FXToolBarTab(FXComposite* p,FXObject* tgt=NULL,FXSelector sel=0,FXuint opts=FRAME_RAISED,FXint x=0,FXint y=0,FXint w=0,FXint h=0);
00093 
00094   /// Toolbar tab can receive focus
00095   virtual bool canFocus() const;
00096 
00097   /// Return default width
00098   virtual FXint getDefaultWidth();
00099 
00100   /// Return default height
00101   virtual FXint getDefaultHeight();
00102 
00103   /// Enable the toolbar tab
00104   virtual void enable();
00105 
00106   /// Disable the toolbar tab
00107   virtual void disable();
00108 
00109   /// Collapse or uncollapse the toolbar
00110   void collapse(FXbool fold,FXbool notify=FALSE);
00111 
00112   /// Return true if the toolbar is collapsed
00113   FXbool isCollapsed() const { return collapsed; }
00114 
00115   /// Change the tab style
00116   void setTabStyle(FXuint style);
00117 
00118   /// Get current tab style
00119   FXuint getTabStyle() const;
00120 
00121   /// Get the active color
00122   FXColor getActiveColor() const { return activeColor; }
00123 
00124   /// Set the active color
00125   void setActiveColor(FXColor clr);
00126 
00127   /// Set the tool tip message for the toolbar tab
00128   void setTipText(const FXString& text){ tip=text; }
00129 
00130   /// Get the tool tip message for the toolbar tab
00131   const FXString& getTipText() const { return tip; }
00132 
00133   /// Save to a stream
00134   virtual void save(FXStream& store) const;
00135 
00136   /// Load from a stream
00137   virtual void load(FXStream& store);
00138   };
00139 
00140 }
00141 
00142 #endif

Copyright © 1997-2005 Jeroen van der Zijp