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

Copyright © 1997-2009 Jeroen van der Zijp