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