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

FXShutter.h

Go to the documentation of this file.
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,2006 by Charles W. Warren.   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.26 2006/01/22 17:58:09 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 class FXShutter;
00035 class FXButton;
00036 class FXScrollWindow;
00037 class FXShutterItem;
00038 
00039 
00040 /**
00041 * A Shutter Item is a panel which is embedded inside a Shutter Widget.
00042 * It can contain other user interface widgets which can be added under
00043 * the content widget.  The content widget is itself embedded in a scroll
00044 * window to allow unlimited room for all the contents.
00045 */
00046 class FXAPI FXShutterItem : public FXVerticalFrame {
00047   FXDECLARE(FXShutterItem)
00048   friend class FXShutter;
00049 protected:
00050   FXButton         *button;
00051   FXScrollWindow   *scrollWindow;
00052   FXVerticalFrame  *content;
00053 protected:
00054   FXShutterItem(){}
00055 private:
00056   FXShutterItem(const FXShutterItem&);
00057   FXShutterItem &operator=(const FXShutterItem&);
00058 public:
00059   long onFocusUp(FXObject*,FXSelector,void*);
00060   long onFocusDown(FXObject*,FXSelector,void*);
00061   long onCmdButton(FXObject*,FXSelector,void*);
00062 public:
00063   enum{
00064     ID_SHUTTERITEM_BUTTON=FXVerticalFrame::ID_LAST,
00065     ID_LAST
00066     };
00067 public:
00068   /// Constructor
00069   FXShutterItem(FXShutter *p,const FXString& text=FXString::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);
00070 
00071   /// Return a pointer to the button for this item
00072   FXButton* getButton() const { return button; }
00073 
00074   /// Return a pointer to the contents for this item
00075   FXVerticalFrame* getContent() const { return content; }
00076 
00077   /// Set the status line help text for this item
00078   void setHelpText(const FXString& text);
00079 
00080   /// Get the status line help text for this item
00081   FXString getHelpText() const;
00082 
00083   /// Set the tool tip message for this item
00084   void setTipText(const FXString&  text);
00085 
00086   /// Get the tool tip message for this item
00087   FXString getTipText() const;
00088 
00089   /// Destructor
00090   virtual ~FXShutterItem();
00091   };
00092 
00093 
00094 /**
00095 * The Shutter widget provides a set of foldable sub panels.  Each subpanel
00096 * consists of a Shutter Item which contains a button and some contents.
00097 * A sub panel can be unfolded by pressing on that panel's button.
00098 */
00099 class FXAPI FXShutter : public FXVerticalFrame {
00100   FXDECLARE(FXShutter)
00101   friend class FXShutterItem;
00102 protected:
00103   FXint          current;               // Item currently open
00104   FXint          closing;               // Item closing down
00105   FXint          heightIncrement;       // Height delta
00106   FXint          closingHeight;         // Closing items current height
00107   FXbool         closingHadScrollbar;   // Closing item had a scroll bar
00108 protected:
00109   FXShutter(){}
00110 private:
00111   FXShutter(const FXShutter&);
00112   FXShutter &operator=(const FXShutter&);
00113 public:
00114   long onFocusUp(FXObject*,FXSelector,void*);
00115   long onFocusDown(FXObject*,FXSelector,void*);
00116   long onTimeout(FXObject*,FXSelector,void*);
00117   long onOpenItem(FXObject*,FXSelector,void*);
00118   long onCmdSetValue(FXObject*,FXSelector,void*);
00119   long onCmdSetIntValue(FXObject*,FXSelector,void*);
00120   long onCmdGetIntValue(FXObject*,FXSelector,void*);
00121   long onCmdOpen(FXObject*,FXSelector,void*);
00122   long onUpdOpen(FXObject*,FXSelector,void*);
00123 public:
00124   enum{
00125     ID_SHUTTER_TIMEOUT=FXVerticalFrame::ID_LAST,
00126     ID_OPEN_SHUTTERITEM,
00127     ID_OPEN_FIRST,
00128     ID_OPEN_LAST=ID_OPEN_FIRST+1000,
00129     ID_LAST
00130     };
00131 public:
00132 
00133   /// Constructor
00134   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);
00135 
00136   /// Perform layout
00137   virtual void layout();
00138 
00139   /// Set the currently displayed item (panel = 0, 1, 2, ..., npanels-1)
00140   virtual void setCurrent(FXint panel);
00141 
00142   /// Return the index of the currently displayed item
00143   FXint getCurrent() const { return current; }
00144 
00145   /// Destructor
00146   virtual ~FXShutter();
00147   };
00148 
00149 }
00150 
00151 #endif

Copyright © 1997-2005 Jeroen van der Zijp