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

Copyright © 1997-2009 Jeroen van der Zijp