1 /******************************************************************************** 2 * * 3 * S c r o l l i n g M e n u P a n e W i d g e t * 4 * * 5 ********************************************************************************* 6 * Copyright (C) 1997,2005 by Jeroen van der Zijp. All Rights Reserved. * 7 ********************************************************************************* 8 * This library is free software; you can redistribute it and/or * 9 * modify it under the terms of the GNU Lesser General Public * 10 * License as published by the Free Software Foundation; either * 11 * version 2.1 of the License, or (at your option) any later version. * 12 * * 13 * This library is distributed in the hope that it will be useful, * 14 * but WITHOUT ANY WARRANTY; without even the implied warranty of * 15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * 16 * Lesser General Public License for more details. * 17 * * 18 * You should have received a copy of the GNU Lesser General Public * 19 * License along with this library; if not, write to the Free Software * 20 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. * 21 ********************************************************************************* 22 * $Id: FXScrollPane.h,v 1.8 2005/01/16 16:06:06 fox Exp $ * 23 ********************************************************************************/ 24 #ifndef FXSCROLLPANE_H 25 #define FXSCROLLPANE_H 26 27 #ifndef FXMENUPANE_H 28 #include "FXMenuPane.h" 29 #endif 30 31 namespace FX { 32 33 class FXArrowButton; 34 35 /** 36 * A Scroll Pane is a menu pane which provides scrolling of menu entries. 37 * It is useful when menus are populated programmatically and it is not 38 * known in advance how many entries will be added. 39 */ 40 class FXAPI FXScrollPane : public FXMenuPane { 41 FXDECLARE(FXScrollPane) 42 protected: 43 FXArrowButton *dn; // Button to scroll down 44 FXArrowButton *up; // Button to scroll up 45 FXint visible; // Visible entries 46 FXint top; // Top visible entry 47 protected: 48 FXScrollPane(); 49 private: 50 FXScrollPane(const FXScrollPane&); 51 FXScrollPane &operator=(const FXScrollPane&); 52 public: 53 long onUpdIncrement(FXObject*,FXSelector,void*); 54 long onCmdIncrement(FXObject*,FXSelector,void*); 55 long onUpdDecrement(FXObject*,FXSelector,void*); 56 long onCmdDecrement(FXObject*,FXSelector,void*); 57 public: 58 enum { 59 ID_SCROLL_DN=FXMenuPane::ID_LAST, 60 ID_SCROLL_UP, 61 ID_LAST 62 }; 63 public: 64 65 /// Construct menu pane 66 FXScrollPane(FXWindow* owner,FXint nvis,FXuint opts=0); 67 68 /// Return the default width of this window 69 virtual FXint getDefaultWidth(); 70 71 /// Return the default height of this window 72 virtual FXint getDefaultHeight(); 73 74 /// Show this window 75 virtual void show(); 76 77 /// Perform layout 78 virtual void layout(); 79 80 /// Get index of top most menu item getTopItem()81 FXint getTopItem() const { return top; } 82 83 /// Scroll item to top 84 void setTopItem(FXint t); 85 86 /// Destroy 87 virtual ~FXScrollPane(); 88 }; 89 90 } 91 92 #endif 93