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,2004 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.5 2004/02/08 17:17:34 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   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 public:
00080   enum {
00081     ID_COLLAPSE=FXFrame::ID_LAST,
00082     ID_UNCOLLAPSE,
00083     ID_LAST
00084     };
00085 public:
00086 
00087   /// Construct toolbar tab
00088   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);
00089 
00090   /// Toolbar tab can receive focus
00091   virtual FXbool canFocus() const;
00092 
00093   /// Return default width
00094   virtual FXint getDefaultWidth();
00095 
00096   /// Return default height
00097   virtual FXint getDefaultHeight();
00098 
00099   /// Enable the toolbar tab
00100   virtual void enable();
00101 
00102   /// Disable the toolbar tab
00103   virtual void disable();
00104 
00105   /// Collapse or uncollapse the toolbar
00106   void collapse(FXbool c=TRUE);
00107 
00108   /// Return true if the toolbar is collapsed
00109   FXbool isCollapsed() const { return collapsed; }
00110 
00111   /// Change the tab style
00112   void setTabStyle(FXuint style);
00113 
00114   /// Get current tab style
00115   FXuint getTabStyle() const;
00116 
00117   /// Get the active color
00118   FXColor getActiveColor() const { return activeColor; }
00119 
00120   /// Set the active color
00121   void setActiveColor(FXColor clr);
00122 
00123   /// Save to a stream
00124   virtual void save(FXStream& store) const;
00125 
00126   /// Load from a stream
00127   virtual void load(FXStream& store);
00128   };
00129 
00130 }
00131 
00132 #endif

Copyright © 1997-2004 Jeroen van der Zijp