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

FXImageView.h

00001 /********************************************************************************
00002 *                                                                               *
00003 *                       I m a g e   V i e w   W i d g e t                       *
00004 *                                                                               *
00005 *********************************************************************************
00006 * Copyright (C) 2000,2002 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: FXImageView.h,v 1.8 2002/01/18 22:42:53 jeroen Exp $                     *
00023 ********************************************************************************/
00024 #ifndef FXIMAGEVIEW_H
00025 #define FXIMAGEVIEW_H
00026 
00027 #ifndef FXSCROLLAREA_H
00028 #include "FXScrollArea.h"
00029 #endif
00030 
00031 
00032 
00033 class FXImage;
00034 
00035 
00036 /**
00037 * The Image View widget display a scrollable view of an image.
00038 */
00039 class FXAPI FXImageView : public FXScrollArea {
00040   FXDECLARE(FXImageView)
00041 protected:
00042   FXImage *image;         // Image to view
00043   FXint    grabx;         // Grab point x
00044   FXint    graby;         // Grab point y
00045 protected:
00046   FXImageView();
00047   virtual void layout();
00048 private:
00049   FXImageView(const FXImageView&);
00050   FXImageView &operator=(const FXImageView&);
00051 public:
00052   long onPaint(FXObject*,FXSelector,void*);
00053   long onMotion(FXObject*,FXSelector,void*);
00054   long onRightBtnPress(FXObject*,FXSelector,void*);
00055   long onRightBtnRelease(FXObject*,FXSelector,void*);
00056 public:
00057   enum {
00058     ID_XYZ=FXScrollArea::ID_LAST,
00059     ID_LAST
00060     };
00061 public:
00062 
00063   /// Construct a scroll window
00064   FXImageView(FXComposite* p,FXImage* img=NULL,FXObject* tgt=NULL,FXSelector sel=0,FXuint opts=0,FXint x=0,FXint y=0,FXint w=0,FXint h=0);
00065 
00066   /// Create server-side resources
00067   virtual void create();
00068 
00069   /// Detach server-side resources
00070   virtual void detach();
00071 
00072   /// Image view widget can receive focus
00073   virtual FXbool canFocus() 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   /// Change image
00082   void setImage(FXImage* img);
00083 
00084   /// Return image
00085   FXImage* getImage() const { return image; }
00086 
00087   /// Save list to a stream
00088   virtual void save(FXStream& store) const;
00089 
00090   /// Load list from a stream
00091   virtual void load(FXStream& store);
00092 
00093   /// Destroy
00094   virtual ~FXImageView();
00095   };
00096 
00097 
00098 #endif