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

FXScrollPane.h

Go to the documentation of this file.
00001 /********************************************************************************
00002 *                                                                               *
00003 *               S c r o l l i n g   M e n u   P a n e   W i d g e t             *
00004 *                                                                               *
00005 *********************************************************************************
00006 * Copyright (C) 1997,2006 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: FXScrollPane.h,v 1.10 2006/01/22 17:58:09 fox Exp $                       *
00023 ********************************************************************************/
00024 #ifndef FXSCROLLPANE_H
00025 #define FXSCROLLPANE_H
00026 
00027 #ifndef FXMENUPANE_H
00028 #include "FXMenuPane.h"
00029 #endif
00030 
00031 namespace FX {
00032 
00033 class FXArrowButton;
00034 
00035 /**
00036 * A Scroll Pane is a menu pane which provides scrolling of menu entries.
00037 * It is useful when menus are populated programmatically and it is not
00038 * known in advance how many entries will be added.
00039 */
00040 class FXAPI FXScrollPane : public FXMenuPane {
00041   FXDECLARE(FXScrollPane)
00042 protected:
00043   FXArrowButton *dn;            // Button to scroll down
00044   FXArrowButton *up;            // Button to scroll up
00045   FXint          visible;       // Visible entries
00046   FXint          top;           // Top visible entry
00047 protected:
00048   FXScrollPane();
00049 private:
00050   FXScrollPane(const FXScrollPane&);
00051   FXScrollPane &operator=(const FXScrollPane&);
00052 public:
00053   long onCmdIncrement(FXObject*,FXSelector,void*);
00054   long onCmdDecrement(FXObject*,FXSelector,void*);
00055 public:
00056   enum {
00057     ID_SCROLL_DN=FXMenuPane::ID_LAST,
00058     ID_SCROLL_UP,
00059     ID_LAST
00060     };
00061 public:
00062 
00063   /// Construct menu pane
00064   FXScrollPane(FXWindow* owner,FXint nvis,FXuint opts=0);
00065 
00066   /// Return the default width of this window
00067   virtual FXint getDefaultWidth();
00068 
00069   /// Return the default height of this window
00070   virtual FXint getDefaultHeight();
00071 
00072   /// Show this window
00073   virtual void show();
00074 
00075   /// Perform layout
00076   virtual void layout();
00077 
00078   /// Return number of visible items
00079   FXint getNumVisible() const { return visible; }
00080 
00081   /// Change the number of visible items
00082   void setNumVisible(FXint nvis);
00083 
00084   /// Get index of top most menu item
00085   FXint getTopItem() const { return top; }
00086 
00087   /// Scroll item to top
00088   void setTopItem(FXint t);
00089 
00090   /// Destroy
00091   virtual ~FXScrollPane();
00092   };
00093 
00094 }
00095 
00096 #endif

Copyright © 1997-2005 Jeroen van der Zijp