FXScrollArea.h

Go to the documentation of this file.
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,2006 by Jeroen van der Zijp.   All Rights Reserved.        *
00007 *********************************************************************************
00008 * This library is free software; you can redistribute it and/or                 *
00009 * modify it under the terms of the GNU Lesser General Public                    *
00010 * License as published by the Free Software Foundation; either                  *
00011 * version 2.1 of the License, or (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 GNU             *
00016 * Lesser General Public License for more details.                               *
00017 *                                                                               *
00018 * You should have received a copy of the GNU Lesser General Public              *
00019 * License along with this library; if not, write to the Free Software           *
00020 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA.    *
00021 *********************************************************************************
00022 * $Id: FXScrollArea.h,v 1.29 2006/01/22 17:58:09 fox Exp $                      *
00023 ********************************************************************************/
00024 #ifndef FXSCROLLAREA_H
00025 #define FXSCROLLAREA_H
00026 
00027 #ifndef FXCOMPOSITE_H
00028 #include "FXComposite.h"
00029 #endif
00030 
00031 namespace FX {
00032 
00033 
00035 enum {
00036   SCROLLERS_NORMAL     = 0,                                 
00037   HSCROLLER_ALWAYS     = 0x00008000,                        
00038   HSCROLLER_NEVER      = 0x00010000,                        
00039   VSCROLLER_ALWAYS     = 0x00020000,                        
00040   VSCROLLER_NEVER      = 0x00040000,                        
00041   HSCROLLING_ON        = 0,                                 
00042   HSCROLLING_OFF       = HSCROLLER_NEVER|HSCROLLER_ALWAYS,  
00043   VSCROLLING_ON        = 0,                                 
00044   VSCROLLING_OFF       = VSCROLLER_NEVER|VSCROLLER_ALWAYS,  
00045   SCROLLERS_TRACK      = 0,                                 
00046   SCROLLERS_DONT_TRACK = 0x00080000                         
00047   };
00048 
00049 
00050 class FXScrollBar;
00051 class FXScrollCorner;
00052 
00053 
00068 class FXAPI FXScrollArea : public FXComposite {
00069   FXDECLARE(FXScrollArea)
00070 protected:
00071   FXScrollBar    *horizontal;   // Horizontal scroll bar
00072   FXScrollBar    *vertical;     // Vertical scroll bar
00073   FXScrollCorner *corner;       // Scroll corner
00074   FXint           viewport_w;   // Viewport width
00075   FXint           viewport_h;   // Viewport height
00076   FXint           pos_x;        // X scroll position (pos_x<=0)
00077   FXint           pos_y;        // Y scroll position (pos_y<=0)
00078 protected:
00079   FXScrollArea();
00080   FXbool startAutoScroll(FXEvent *event,FXbool onlywheninside=FALSE);
00081   void stopAutoScroll();
00082   FXScrollArea(FXComposite* p,FXuint opts,FXint x,FXint y,FXint w,FXint h);
00083   virtual void moveContents(FXint x,FXint y);
00084 private:
00085   FXScrollArea(const FXScrollArea&);
00086   FXScrollArea &operator=(const FXScrollArea&);
00087 public:
00088   long onHMouseWheel(FXObject*,FXSelector,void*);
00089   long onVMouseWheel(FXObject*,FXSelector,void*);
00090   long onHScrollerChanged(FXObject*,FXSelector,void*);
00091   long onVScrollerChanged(FXObject*,FXSelector,void*);
00092   long onHScrollerDragged(FXObject*,FXSelector,void*);
00093   long onVScrollerDragged(FXObject*,FXSelector,void*);
00094   long onAutoScroll(FXObject*,FXSelector,void*);
00095 public:
00096 
00098   virtual FXint getDefaultWidth();
00099 
00101   virtual FXint getDefaultHeight();
00102 
00104   virtual void layout();
00105 
00107   virtual FXint getViewportHeight();
00108 
00110   virtual FXint getViewportWidth();
00111 
00113   virtual FXint getContentWidth();
00114 
00116   virtual FXint getContentHeight();
00117 
00119   void setScrollStyle(FXuint style);
00120 
00122   FXuint getScrollStyle() const;
00123 
00125   FXbool isHorizontalScrollable() const;
00126 
00128   FXbool isVerticalScrollable() const;
00129 
00131   FXScrollBar* horizontalScrollBar() const { return horizontal; }
00132 
00134   FXScrollBar* verticalScrollBar() const { return vertical; }
00135 
00137   FXint getXPosition() const { return pos_x; }
00138 
00140   FXint getYPosition() const { return pos_y; }
00141 
00143   void setPosition(FXint x,FXint y);
00144 
00146   void getPosition(FXint& x,FXint& y) const { x=pos_x; y=pos_y; }
00147 
00149   virtual ~FXScrollArea();
00150   };
00151 
00152 }
00153 
00154 #endif

(C) 2002-2009 Niall Douglas. Some parts (C) to assorted authors.
Generated on Fri Nov 20 18:31:24 2009 for TnFOX by doxygen v1.4.7