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

FXToolbarTab.h

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,2002 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.16 2002/01/18 22:42:55 jeroen Exp $                   *
00023 ********************************************************************************/
00024 #ifndef FXTOOLBARTAB_H
00025 #define FXTOOLBARTAB_H
00026 
00027 #ifndef FXFRAME_H
00028 #include "FXFrame.h"
00029 #endif
00030 
00031 
00032 
00033 /// Toolbar 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   FXbool  collapsed;                      // Is collapsed flat
00052   FXbool  down;                           // Button down
00053 protected:
00054   FXToolbarTab();
00055   void drawUpArrow(FXDCWindow& dc);
00056   void drawDownArrow(FXDCWindow& dc);
00057   void drawRightArrow(FXDCWindow& dc);
00058   void drawLeftArrow(FXDCWindow& dc);
00059   void drawHSpeckles(FXDCWindow& dc,FXint x,FXint w);
00060   void drawVSpeckles(FXDCWindow& dc,FXint y,FXint h);
00061 private:
00062   FXToolbarTab(const FXToolbarTab&);
00063   FXToolbarTab& operator=(const FXToolbarTab&);
00064 public:
00065   long onPaint(FXObject*,FXSelector,void*);
00066   long onUpdate(FXObject*,FXSelector,void*);
00067   long onEnter(FXObject*,FXSelector,void*);
00068   long onLeave(FXObject*,FXSelector,void*);
00069   long onUngrabbed(FXObject*,FXSelector,void*);
00070   long onLeftBtnPress(FXObject*,FXSelector,void*);
00071   long onLeftBtnRelease(FXObject*,FXSelector,void*);
00072   long onKeyPress(FXObject*,FXSelector,void*);
00073   long onKeyRelease(FXObject*,FXSelector,void*);
00074   long onCmdCollapse(FXObject*,FXSelector,void*);
00075   long onUpdCollapse(FXObject*,FXSelector,void*);
00076   long onCmdUncollapse(FXObject*,FXSelector,void*);
00077   long onUpdUncollapse(FXObject*,FXSelector,void*);
00078 public:
00079   enum {
00080     ID_COLLAPSE=FXFrame::ID_LAST,
00081     ID_UNCOLLAPSE,
00082     ID_LAST
00083     };
00084 public:
00085 
00086   /// Construct toolbar tab
00087   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);
00088 
00089   /// Toolbar tab can receive focus
00090   virtual FXbool canFocus() const;
00091 
00092   /// Return default width
00093   virtual FXint getDefaultWidth();
00094 
00095   /// Return default height
00096   virtual FXint getDefaultHeight();
00097 
00098   /// Enable the toolbar tab
00099   virtual void enable();
00100 
00101   /// Disable the toolbar tab
00102   virtual void disable();
00103 
00104   /// Collapse or uncollapse the toolbar
00105   void collapse(FXbool c=TRUE);
00106 
00107   /// Return true if the toolbar is collapsed
00108   FXbool isCollapsed() const { return collapsed; }
00109 
00110   /// Change the tab style
00111   void setTabStyle(FXuint style);
00112 
00113   /// Get current tab style
00114   FXuint getTabStyle() const;
00115 
00116   /// Get the active color
00117   FXColor getActiveColor() const { return activeColor; }
00118 
00119   /// Set the active color
00120   void setActiveColor(FXColor clr);
00121 
00122   /// Save to a stream
00123   virtual void save(FXStream& store) const;
00124 
00125   /// Load from a stream
00126   virtual void load(FXStream& store);
00127   };
00128 
00129 
00130 #endif