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

FXTabBar.h

00001 /********************************************************************************
00002 *                                                                               *
00003 *                           T a b  B a r   W i d g e t                          *
00004 *                                                                               *
00005 *********************************************************************************
00006 * Copyright (C) 1997,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: FXTabBar.h,v 1.8 2004/02/08 17:17:34 fox Exp $                           *
00023 ********************************************************************************/
00024 #ifndef FXTABBAR_H
00025 #define FXTABBAR_H
00026 
00027 #ifndef FXPACKER_H
00028 #include "FXPacker.h"
00029 #endif
00030 
00031 namespace FX {
00032 
00033 
00034 // Tab Book options
00035 enum {
00036   TABBOOK_TOPTABS    = 0,                                   // Tabs on top (default)
00037   TABBOOK_BOTTOMTABS = 0x00020000,                          // Tabs on bottom
00038   TABBOOK_SIDEWAYS   = 0x00040000,                          // Tabs on left
00039   TABBOOK_LEFTTABS   = TABBOOK_SIDEWAYS|TABBOOK_TOPTABS,    // Tabs on left
00040   TABBOOK_RIGHTTABS  = TABBOOK_SIDEWAYS|TABBOOK_BOTTOMTABS, // Tabs on right
00041   TABBOOK_NORMAL     = TABBOOK_TOPTABS
00042   };
00043 
00044 
00045 
00046 /**
00047 * The tab bar layout manager arranges tab items side by side,
00048 * and raises the active tab item above the neighboring tab items.
00049 * In a the horizontal arrangement, the tab bar can have the tab
00050 * items on the top or on the bottom.  In the vertical arrangement,
00051 * the tabs can be on the left or on the right.
00052 */
00053 class FXAPI FXTabBar : public FXPacker {
00054   FXDECLARE(FXTabBar)
00055 protected:
00056   FXint current;
00057 protected:
00058   FXTabBar(){}
00059 private:
00060   FXTabBar(const FXTabBar&);
00061   FXTabBar& operator=(const FXTabBar&);
00062 public:
00063   long onPaint(FXObject*,FXSelector,void*);
00064   long onFocusNext(FXObject*,FXSelector,void*);
00065   long onFocusPrev(FXObject*,FXSelector,void*);
00066   long onFocusUp(FXObject*,FXSelector,void*);
00067   long onFocusDown(FXObject*,FXSelector,void*);
00068   long onFocusLeft(FXObject*,FXSelector,void*);
00069   long onFocusRight(FXObject*,FXSelector,void*);
00070   long onCmdOpenItem(FXObject*,FXSelector,void*);
00071   long onCmdSetValue(FXObject*,FXSelector,void*);
00072   long onCmdSetIntValue(FXObject*,FXSelector,void*);
00073   long onCmdGetIntValue(FXObject*,FXSelector,void*);
00074   long onCmdOpen(FXObject*,FXSelector,void*);
00075   long onUpdOpen(FXObject*,FXSelector,void*);
00076 public:
00077   enum {
00078     ID_OPEN_ITEM=FXPacker::ID_LAST,   /// Sent from one of the FXTabItems
00079     ID_OPEN_FIRST,                    /// Switch to panel ID_OPEN_FIRST+i
00080     ID_OPEN_SECOND,
00081     ID_OPEN_THIRD,
00082     ID_OPEN_FOURTH,
00083     ID_OPEN_FIFTH,
00084     ID_OPEN_SIXTH,
00085     ID_OPEN_SEVENTH,
00086     ID_OPEN_EIGHTH,
00087     ID_OPEN_NINETH,
00088     ID_OPEN_TENTH,
00089     ID_OPEN_LAST=ID_OPEN_FIRST+100,
00090     ID_LAST
00091     };
00092 public:
00093 
00094   /// Construct a tab bar
00095   FXTabBar(FXComposite* p,FXObject* tgt=NULL,FXSelector sel=0,FXuint opts=TABBOOK_NORMAL,FXint x=0,FXint y=0,FXint w=0,FXint h=0,FXint pl=DEFAULT_SPACING,FXint pr=DEFAULT_SPACING,FXint pt=DEFAULT_SPACING,FXint pb=DEFAULT_SPACING);
00096 
00097   /// Return default width
00098   virtual FXint getDefaultWidth();
00099 
00100   /// Return default height
00101   virtual FXint getDefaultHeight();
00102 
00103   /// Perform layout
00104   virtual void layout();
00105 
00106   /**
00107   * Change currently active tab item;
00108   * this raises the active tab item slightly above the neighboring
00109   * tab items.
00110   */
00111   virtual void setCurrent(FXint panel,FXbool notify=FALSE);
00112 
00113   /// Return the currently active tab item
00114   FXint getCurrent() const { return current; }
00115 
00116   /// Return tab bar style
00117   FXuint getTabStyle() const;
00118 
00119   /// Change tab tab style
00120   void setTabStyle(FXuint style);
00121 
00122   /// Save to stream
00123   virtual void save(FXStream& store) const;
00124 
00125   /// Load from stream
00126   virtual void load(FXStream& store);
00127   };
00128 
00129 }
00130 
00131 #endif

Copyright © 1997-2004 Jeroen van der Zijp