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.10 2002/03/12 07:11:30 fox Exp $                        *
00023 ********************************************************************************/
00024 #ifndef FXIMAGEVIEW_H
00025 #define FXIMAGEVIEW_H
00026 
00027 #ifndef FXSCROLLAREA_H
00028 #include "FXScrollArea.h"
00029 #endif
00030 
00031 namespace FX {
00032 
00033 
00034 class FXImage;
00035 
00036 
00037 /**
00038 * The Image View widget display a scrollable view of an image.
00039 */
00040 class FXAPI FXImageView : public FXScrollArea {
00041   FXDECLARE(FXImageView)
00042 protected:
00043   FXImage *image;         // Image to view
00044   FXint    grabx;         // Grab point x
00045   FXint    graby;         // Grab point y
00046 protected:
00047   FXImageView();
00048   virtual void layout();
00049 private:
00050   FXImageView(const FXImageView&);
00051   FXImageView &operator=(const FXImageView&);
00052 public:
00053   long onPaint(FXObject*,FXSelector,void*);
00054   long onMotion(FXObject*,FXSelector,void*);
00055   long onRightBtnPress(FXObject*,FXSelector,void*);
00056   long onRightBtnRelease(FXObject*,FXSelector,void*);
00057 public:
00058   enum {
00059     ID_XYZ=FXScrollArea::ID_LAST,
00060     ID_LAST
00061     };
00062 public:
00063 
00064   /// Construct a scroll window
00065   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);
00066 
00067   /// Create server-side resources
00068   virtual void create();
00069 
00070   /// Detach server-side resources
00071   virtual void detach();
00072 
00073   /// Image view widget can receive focus
00074   virtual FXbool canFocus() const;
00075 
00076   /// Return the width of the contents
00077   virtual FXint getContentWidth();
00078 
00079   /// Return the height of the contents
00080   virtual FXint getContentHeight();
00081 
00082   /// Change image
00083   void setImage(FXImage* img);
00084 
00085   /// Return image
00086   FXImage* getImage() const { return image; }
00087 
00088   /// Save list to a stream
00089   virtual void save(FXStream& store) const;
00090 
00091   /// Load list from a stream
00092   virtual void load(FXStream& store);
00093 
00094   /// Destroy
00095   virtual ~FXImageView();
00096   };
00097 
00098 }
00099 
00100 #endif