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

FXScrollPane.h
Go to the documentation of this file.
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,2006 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.10 2006/01/22 17:58:09 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 {
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 onCmdIncrement(FXObject*,FXSelector,void*);
54  long onCmdDecrement(FXObject*,FXSelector,void*);
55 public:
56  enum {
57  ID_SCROLL_DN=FXMenuPane::ID_LAST,
58  ID_SCROLL_UP,
59  ID_LAST
60  };
61 public:
62 
63  /// Construct menu pane
64  FXScrollPane(FXWindow* owner,FXint nvis,FXuint opts=0);
65 
66  /// Return the default width of this window
67  virtual FXint getDefaultWidth();
68 
69  /// Return the default height of this window
70  virtual FXint getDefaultHeight();
71 
72  /// Show this window
73  virtual void show();
74 
75  /// Perform layout
76  virtual void layout();
77 
78  /// Return number of visible items
79  FXint getNumVisible() const { return visible; }
80 
81  /// Change the number of visible items
82  void setNumVisible(FXint nvis);
83 
84  /// Get index of top most menu item
85  FXint getTopItem() const { return top; }
86 
87  /// Scroll item to top
88  void setTopItem(FXint t);
89 
90  /// Destroy
91  virtual ~FXScrollPane();
92  };
93 
94 }
95 
96 #endif
Base class for all windows.
Definition: FXWindow.h:115
Definition: FXWindow.h:241
unsigned int FXuint
Definition: fxdefs.h:396
FXuint FXSelector
Association key.
Definition: FXObject.h:53
#define FXAPI
Definition: fxdefs.h:122
int FXint
Definition: fxdefs.h:397
Object is the base class for all objects in FOX; in order to receive messages from the user interface...
Definition: FXObject.h:166
A Scroll Pane is a menu pane which provides scrolling of menu entries.
Definition: FXScrollPane.h:40
Popup menu pane.
Definition: FXMenuPane.h:34
#define FXDECLARE(classname)
Macro to set up class declaration.
Definition: FXObject.h:92
Button with an arrow; the arrow can point in any direction.
Definition: FXArrowButton.h:65

Copyright © 1997-2005 Jeroen van der Zijp