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

FXShutter.h

00001 /********************************************************************************
00002 *                                                                               *
00003 *                 S h u t t e r   C o n t a i n e r   W i d g e t               *
00004 *                                                                               *
00005 *********************************************************************************
00006 * Copyright (C) 1998,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: FXShutter.h,v 1.18 2002/09/30 13:06:56 fox Exp $                         *
00023 ********************************************************************************/
00024 #ifndef FXSHUTTER_H
00025 #define FXSHUTTER_H
00026 
00027 #ifndef FXVERTICALFRAME_H
00028 #include "FXVerticalFrame.h"
00029 #endif
00030 
00031 namespace FX {
00032 
00033 
00034 struct FXTimer;
00035 class FXShutter;
00036 class FXButton;
00037 class FXScrollWindow;
00038 class FXShutterItem;
00039 
00040 
00041 /// Shutter Control
00042 class FXAPI FXShutterItem : public FXVerticalFrame {
00043   FXDECLARE(FXShutterItem)
00044   friend class FXShutter;
00045 protected:
00046   FXButton         *button;
00047   FXScrollWindow   *scrollWindow;
00048   FXVerticalFrame  *content;
00049 protected:
00050   FXShutterItem(){}
00051 private:
00052   FXShutterItem(const FXShutterItem&);
00053   FXShutterItem &operator=(const FXShutterItem&);
00054 public:
00055   long onFocusUp(FXObject*,FXSelector,void*);
00056   long onFocusDown(FXObject*,FXSelector,void*);
00057   long onCmdButton(FXObject*,FXSelector,void*);
00058 public:
00059   enum{
00060     ID_SHUTTERITEM_BUTTON=FXVerticalFrame::ID_LAST,
00061     ID_LAST
00062     };
00063 public:
00064   /// Constructor
00065   FXShutterItem(FXShutter *p,const FXString& text=NULL,FXIcon* icon=NULL,FXuint opts=0,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,FXint hs=DEFAULT_SPACING,FXint vs=DEFAULT_SPACING);
00066 
00067   /// Return a pointer to the button for this item
00068   FXButton* getButton() const { return button; }
00069 
00070   /// Return a pointer to the contents for this item
00071   FXVerticalFrame* getContent() const { return content; }
00072 
00073   /// Set the status line help text for this item
00074   void setHelpText(const FXString& text);
00075 
00076   /// Get the status line help text for this item
00077   const FXString& getHelpText() const;
00078 
00079   /// Set the tool tip message for this item
00080   void setTipText(const FXString&  text);
00081 
00082   /// Get the tool tip message for this item
00083   const FXString& getTipText() const;
00084 
00085   /// Destructor
00086   virtual ~FXShutterItem();
00087   };
00088 
00089 
00090 /// Shutter Control
00091 class FXAPI FXShutter : public FXVerticalFrame {
00092   FXDECLARE(FXShutter)
00093   friend class FXShutterItem;
00094 protected:
00095   FXint          current;               // Item currently open
00096   FXint          closing;               // Item closing down
00097   FXTimer       *timer;                 // Timer for animation
00098   FXint          heightIncrement;       // Height delta
00099   FXint          closingHeight;         // Closing items current height
00100   FXbool         closingHadScrollbar;   // Closing item had a scroll bar
00101 protected:
00102   FXShutter(){}
00103   virtual void layout();
00104 private:
00105   FXShutter(const FXShutter&);
00106   FXShutter &operator=(const FXShutter&);
00107 public:
00108   long onFocusUp(FXObject*,FXSelector,void*);
00109   long onFocusDown(FXObject*,FXSelector,void*);
00110   long onTimeout(FXObject*,FXSelector,void*);
00111   long onOpenItem(FXObject*,FXSelector,void*);
00112   long onCmdSetValue(FXObject*,FXSelector,void*);
00113   long onCmdSetIntValue(FXObject*,FXSelector,void*);
00114   long onCmdGetIntValue(FXObject*,FXSelector,void*);
00115   long onCmdOpen(FXObject*,FXSelector,void*);
00116   long onUpdOpen(FXObject*,FXSelector,void*);
00117 public:
00118   enum{
00119     ID_SHUTTER_TIMEOUT=FXVerticalFrame::ID_LAST,
00120     ID_OPEN_SHUTTERITEM,
00121     ID_OPEN_FIRST,
00122     ID_OPEN_LAST=ID_OPEN_FIRST+1000,
00123     ID_LAST
00124     };
00125 public:
00126   /// Constructor
00127   FXShutter(FXComposite *p,FXObject* tgt=NULL,FXSelector sel=0,FXuint opts=0,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,FXint hs=DEFAULT_SPACING,FXint vs=DEFAULT_SPACING);
00128 
00129   /// Set the currently displayed item (panel = 0, 1, 2, ..., npanels-1)
00130   virtual void setCurrent(FXint panel);
00131 
00132   /// Return the index of the currently displayed item
00133   FXint getCurrent() const { return current; }
00134 
00135   /// Destructor
00136   virtual ~FXShutter();
00137   };
00138 
00139 }
00140 
00141 #endif