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

/home/jeroen/FOX/fox/fox-1.7.33/include/FXScrollArea.h
00001 /********************************************************************************
00002 *                                                                               *
00003 *                       S c r o l l A r e a   W i d g e t                       *
00004 *                                                                               *
00005 *********************************************************************************
00006 * Copyright (C) 1997,2012 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 #ifndef FXSCROLLAREA_H
00022 #define FXSCROLLAREA_H
00023 
00024 #ifndef FXCOMPOSITE_H
00025 #include "FXComposite.h"
00026 #endif
00027 
00028 namespace FX {
00029 
00030 
00032 enum {
00033   SCROLLERS_NORMAL     = 0,                                 
00034   HSCROLLER_ALWAYS     = 0x00008000,                        
00035   HSCROLLER_NEVER      = 0x00010000,                        
00036   VSCROLLER_ALWAYS     = 0x00020000,                        
00037   VSCROLLER_NEVER      = 0x00040000,                        
00038   HSCROLLING_ON        = 0,                                 
00039   HSCROLLING_OFF       = HSCROLLER_NEVER|HSCROLLER_ALWAYS,  
00040   VSCROLLING_ON        = 0,                                 
00041   VSCROLLING_OFF       = VSCROLLER_NEVER|VSCROLLER_ALWAYS,  
00042   SCROLLERS_TRACK      = 0,                                 
00043   SCROLLERS_DONT_TRACK = 0x00080000                         
00044   };
00045 
00046 
00047 class FXScrollBar;
00048 class FXScrollCorner;
00049 
00050 
00065 class FXAPI FXScrollArea : public FXComposite {
00066   FXDECLARE(FXScrollArea)
00067 protected:
00068   FXScrollBar    *horizontal;   // Horizontal scroll bar
00069   FXScrollBar    *vertical;     // Vertical scroll bar
00070   FXScrollCorner *corner;       // Scroll corner
00071   FXint           pos_x;        // X scroll position (pos_x<=0)
00072   FXint           pos_y;        // Y scroll position (pos_y<=0)
00073 protected:
00074   FXScrollArea();
00075   FXScrollArea(FXComposite* p,FXuint opts,FXint x,FXint y,FXint w,FXint h);
00076   virtual void moveContents(FXint x,FXint y);
00077   FXbool startAutoScroll(FXEvent *event,FXbool onlywheninside=false);
00078   void stopAutoScroll();
00079   void placeScrollBars(FXint vw,FXint vh);
00080 private:
00081   FXScrollArea(const FXScrollArea&);
00082   FXScrollArea &operator=(const FXScrollArea&);
00083 public:
00084   long onHMouseWheel(FXObject*,FXSelector,void*);
00085   long onVMouseWheel(FXObject*,FXSelector,void*);
00086   long onHScrollerChanged(FXObject*,FXSelector,void*);
00087   long onVScrollerChanged(FXObject*,FXSelector,void*);
00088   long onHScrollerDragged(FXObject*,FXSelector,void*);
00089   long onVScrollerDragged(FXObject*,FXSelector,void*);
00090   long onAutoScroll(FXObject*,FXSelector,void*);
00091 public:
00092   enum {
00093     ID_AUTOSCROLL=FXComposite::ID_LAST,
00094     ID_VSCROLLED,
00095     ID_HSCROLLED,
00096     ID_LAST
00097     };
00098 public:
00099 
00101   virtual FXint getDefaultWidth();
00102 
00104   virtual FXint getDefaultHeight();
00105 
00107   virtual void layout();
00108 
00110   FXint getContentX() const { return pos_x; }
00111 
00113   FXint getContentY() const { return pos_y; }
00114 
00116   virtual FXint getContentWidth();
00117 
00119   virtual FXint getContentHeight();
00120 
00122   virtual FXint getVisibleX() const;
00123 
00125   virtual FXint getVisibleY() const;
00126 
00128   virtual FXint getVisibleWidth() const;
00129 
00131   virtual FXint getVisibleHeight() const;
00132 
00134   FXbool isHorizontalScrollable() const;
00135 
00137   FXbool isVerticalScrollable() const;
00138 
00140   void setScrollStyle(FXuint style);
00141 
00143   FXuint getScrollStyle() const;
00144 
00146   FXScrollBar* horizontalScrollBar() const { return horizontal; }
00147 
00149   FXScrollBar* verticalScrollBar() const { return vertical; }
00150 
00152   void setPosition(FXint x,FXint y);
00153 
00155   void getPosition(FXint& x,FXint& y) const { x=pos_x; y=pos_y; }
00156 
00158   virtual void save(FXStream& store) const;
00159 
00161   virtual void load(FXStream& store);
00162 
00164   virtual ~FXScrollArea();
00165   };
00166 
00167 }
00168 
00169 #endif

Copyright © 1997-2011 Jeroen van der Zijp