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

FXScrollWindow.h

Go to the documentation of this file.
00001 /********************************************************************************
00002 *                                                                               *
00003 *                     S c r o l l W i n d o w   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: FXScrollWindow.h,v 1.26 2009/01/06 13:07:27 fox Exp $                    *
00022 ********************************************************************************/
00023 #ifndef FXSCROLLWINDOW_H
00024 #define FXSCROLLWINDOW_H
00025 
00026 #ifndef FXSCROLLAREA_H
00027 #include "FXScrollArea.h"
00028 #endif
00029 
00030 namespace FX {
00031 
00032 
00033 /**
00034 * The ScrollWindow widget manages one single child window and
00035 * scrolls it when the child is larger than the available area.
00036 * You can use ScrollWindow when parts of your user interface need to be
00037 * scrollable, for example when applications may need to run on small screens.
00038 * ScrollWindow normally contains only one single child window, which could
00039 * be a VerticalFrame or any other widget.  It will measure this widget using
00040 * getDefaultWidth() and getDefaultHeight() and place the scrollbars when needed,
00041 * based on options like  HSCROLLING_ALWAYS, etc., and the options of the child
00042 * window.
00043 * ScrollWindow observes some layout hints of its child window: LAYOUT_FIX_WIDTH,
00044 * LAYOUT_FIX_HEIGHT are observed at all times, while LAYOUT_FILL_X, LAYOUT_LEFT,
00045 * LAYOUT_RIGHT, LAYOUT_CENTER_X, as well as LAYOUT_FILL_Y, LAYOUT_TOP, LAYOUT_BOTTOM,
00046 * LAYOUT_CENTER_Y are only observed if the child window size is smaller than the
00047 * ScrollWindow's viewport size.  If the content size is larger than the viewport size,
00048 * the content must be scrolled normally.
00049 * Note that this means that the child window's position is not necessarily equal to
00050 * the scroll position of the scroll window!
00051 */
00052 class FXAPI FXScrollWindow : public FXScrollArea {
00053   FXDECLARE(FXScrollWindow)
00054 protected:
00055   FXScrollWindow(){}
00056   virtual void moveContents(FXint x,FXint y);
00057 private:
00058   FXScrollWindow(const FXScrollWindow&);
00059   FXScrollWindow &operator=(const FXScrollWindow&);
00060 public:
00061   long onKeyPress(FXObject*,FXSelector,void*);
00062   long onKeyRelease(FXObject*,FXSelector,void*);
00063   long onFocusSelf(FXObject*,FXSelector,void*);
00064 public:
00065 
00066   /// Construct a scroll window
00067   FXScrollWindow(FXComposite* p,FXuint opts=0,FXint x=0,FXint y=0,FXint w=0,FXint h=0);
00068 
00069   /// Perform layout
00070   virtual void layout();
00071 
00072   /// Return a pointer to the contents window
00073   FXWindow* contentWindow() const;
00074 
00075   /// Return the width of the contents
00076   virtual FXint getContentWidth();
00077 
00078   /// Return the height of the contents
00079   virtual FXint getContentHeight();
00080   };
00081 
00082 }
00083 
00084 #endif

Copyright © 1997-2009 Jeroen van der Zijp