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,2009 by Charles W. Warren.   All Rights Reserved.          *
00007 *********************************************************************************
00008 * This library is free software; you can redistribute it and/or modify          *
00009 * it under the terms of the GNU Lesser General Public License as published by   *
00010 * the Free Software Foundation; either version 3 of the License, or             *
00011 * (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                 *
00016 * GNU Lesser General Public License for more details.                           *
00017 *                                                                               *
00018 * You should have received a copy of the GNU Lesser General Public License      *
00019 * along with this program.  If not, see <http://www.gnu.org/licenses/>          *
00020 *********************************************************************************
00021 * $Id: FXShutter.h,v 1.37 2009/01/06 13:07:27 fox Exp $                         *
00022 ********************************************************************************/
00023 #ifndef FXSHUTTER_H
00024 #define FXSHUTTER_H
00025 
00026 #ifndef FXVERTICALFRAME_H
00027 #include "FXVerticalFrame.h"
00028 #endif
00029 
00030 namespace FX {
00031 
00032 
00033 class FXShutter;
00034 class FXButton;
00035 class FXScrollWindow;
00036 class FXShutterItem;
00037 
00038 
00039 /**
00040 * A Shutter Item is a panel which is embedded inside a Shutter Widget.
00041 * It can contain other user interface widgets which can be added under
00042 * the content widget.  The content widget is itself embedded in a scroll
00043 * window to allow unlimited room for all the contents.
00044 */
00045 class FXAPI FXShutterItem : public FXVerticalFrame {
00046   FXDECLARE(FXShutterItem)
00047 protected:
00048   FXButton         *button;
00049   FXScrollWindow   *scrollWindow;
00050   FXVerticalFrame  *content;
00051 protected:
00052   FXShutterItem();
00053 private:
00054   FXShutterItem(const FXShutterItem&);
00055   FXShutterItem &operator=(const FXShutterItem&);
00056 public:
00057   long onFocusUp(FXObject*,FXSelector,void*);
00058   long onFocusDown(FXObject*,FXSelector,void*);
00059   long onCmdButton(FXObject*,FXSelector,void*);
00060 public:
00061   enum{
00062     ID_SHUTTERITEM_BUTTON=FXVerticalFrame::ID_LAST,
00063     ID_LAST
00064     };
00065 public:
00066 
00067   /// Constructor
00068   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);
00069 
00070   /// Return a pointer to the scroll window
00071   FXScrollWindow* getScrollWindow() const { return scrollWindow; }
00072 
00073   /// Return a pointer to the button for this item
00074   FXButton* getButton() const { return button; }
00075 
00076   /// Return a pointer to the contents for this item
00077   FXVerticalFrame* getContent() const { return content; }
00078 
00079   /// Set the status line help text for this item
00080   void setHelpText(const FXString& text);
00081 
00082   /// Get the status line help text for this item
00083   FXString getHelpText() const;
00084 
00085   /// Set the tool tip message for this item
00086   void setTipText(const FXString&  text);
00087 
00088   /// Get the tool tip message for this item
00089   FXString getTipText() const;
00090 
00091   /// Save to stream
00092   virtual void save(FXStream& store) const;
00093 
00094   /// Load from stream
00095   virtual void load(FXStream& store);
00096 
00097   /// Destructor
00098   virtual ~FXShutterItem();
00099   };
00100 
00101 
00102 /**
00103 * The Shutter widget provides a set of foldable sub panels.  Each subpanel
00104 * consists of a Shutter Item which contains a button and some contents.
00105 * A sub panel can be unfolded by pressing on that panel's button.
00106 */
00107 class FXAPI FXShutter : public FXVerticalFrame {
00108   FXDECLARE(FXShutter)
00109 protected:
00110   FXint   current;              // Item currently open
00111   FXint   closing;              // Item closing down
00112   FXint   closingHeight;        // Height of closing item
00113   FXint   heightIncrement;      // Height delta
00114 protected:
00115   FXShutter();
00116 private:
00117   FXShutter(const FXShutter&);
00118   FXShutter &operator=(const FXShutter&);
00119 public:
00120   long onFocusUp(FXObject*,FXSelector,void*);
00121   long onFocusDown(FXObject*,FXSelector,void*);
00122   long onTimeout(FXObject*,FXSelector,void*);
00123   long onOpenItem(FXObject*,FXSelector,void*);
00124   long onCmdSetValue(FXObject*,FXSelector,void*);
00125   long onCmdSetIntValue(FXObject*,FXSelector,void*);
00126   long onCmdGetIntValue(FXObject*,FXSelector,void*);
00127   long onCmdOpen(FXObject*,FXSelector,void*);
00128   long onUpdOpen(FXObject*,FXSelector,void*);
00129 public:
00130   enum{
00131     ID_SHUTTER_TIMEOUT=FXVerticalFrame::ID_LAST,
00132     ID_OPEN_SHUTTERITEM,
00133     ID_OPEN_FIRST,
00134     ID_OPEN_SECOND,
00135     ID_OPEN_THIRD,
00136     ID_OPEN_FOURTH,
00137     ID_OPEN_FIFTH,
00138     ID_OPEN_SIXTH,
00139     ID_OPEN_SEVENTH,
00140     ID_OPEN_EIGHTH,
00141     ID_OPEN_NINETH,
00142     ID_OPEN_TENTH,
00143     ID_OPEN_LAST=ID_OPEN_FIRST+100,
00144     ID_LAST
00145     };
00146 public:
00147 
00148   /// Constructor
00149   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);
00150 
00151   /// Perform layout
00152   virtual void layout();
00153 
00154   /// Set the currently displayed item (panel = 0, 1, 2, ..., npanels-1)
00155   virtual void setCurrent(FXint panel,FXbool notify=false);
00156 
00157   /// Return the index of the currently displayed item
00158   FXint getCurrent() const { return current; }
00159 
00160   /// Save to stream
00161   virtual void save(FXStream& store) const;
00162 
00163   /// Load from stream
00164   virtual void load(FXStream& store);
00165 
00166   /// Destructor
00167   virtual ~FXShutter();
00168   };
00169 
00170 }
00171 
00172 #endif

Copyright © 1997-2009 Jeroen van der Zijp