1 /********************************************************************************
2 *                                                                               *
3 *                     S c r o l l W i n d o w   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: FXScrollWindow.h,v 1.20 2005/01/16 16:06:06 fox Exp $                    *
23 ********************************************************************************/
24 #ifndef FXSCROLLWINDOW_H
25 #define FXSCROLLWINDOW_H
26 
27 #ifndef FXSCROLLAREA_H
28 #include "FXScrollArea.h"
29 #endif
30 
31 namespace FX {
32 
33 
34 /**
35 * The scroll window widget scrolls an arbitrary child window.
36 * Use the scroll window when parts of the user interface itself
37 * need to be scrolled, for example when applications need to run
38 * on small screens.  The scroll window observes some layout hints of
39 * its content-window; it observes LAYOUT_FIX_WIDTH, LAYOUT_FIX_HEIGHT
40 * at all times.  The hints LAYOUT_FILL_X, LAYOUT_LEFT, LAYOUT_RIGHT,
41 * LAYOUT_CENTER_X, as well as LAYOUT_FILL_Y, LAYOUT_TOP, LAYOUT_BOTTOM,
42 * LAYOUT_CENTER_Y are however only interpreted if the content size
43 * is smaller than the viewport size, because if the content size is
44 * larger than the viewport size, then content must be scrolled.
45 * Note that this means that the content window's position is not
46 * necessarily equal to the scroll position of the scroll window!
47 */
48 class FXAPI FXScrollWindow : public FXScrollArea {
FXDECLARE(FXScrollWindow)49   FXDECLARE(FXScrollWindow)
50 protected:
51   FXScrollWindow(){}
52   virtual void moveContents(FXint x,FXint y);
53 private:
54   FXScrollWindow(const FXScrollWindow&);
55   FXScrollWindow &operator=(const FXScrollWindow&);
56 public:
57   long onKeyPress(FXObject*,FXSelector,void*);
58   long onKeyRelease(FXObject*,FXSelector,void*);
59   long onFocusSelf(FXObject*,FXSelector,void*);
60 public:
61 
62   /// Construct a scroll window
63   FXScrollWindow(FXComposite* p,FXuint opts=0,FXint x=0,FXint y=0,FXint w=0,FXint h=0);
64 
65   /// Perform layout
66   virtual void layout();
67 
68   /// Return a pointer to the contents window
69   FXWindow* contentWindow() const;
70 
71   /// Return the width of the contents
72   virtual FXint getContentWidth();
73 
74   /// Return the height of the contents
75   virtual FXint getContentHeight();
76   };
77 
78 }
79 
80 #endif
81