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,2005 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.14 2005/01/16 16:06:06 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 /// Image alignment styles 00038 enum { 00039 IMAGEVIEW_NORMAL = 0, /// Normal mode is centered 00040 IMAGEVIEW_CENTER_X = 0, /// Centered horizontally 00041 IMAGEVIEW_LEFT = 0x00100000, /// Left-aligned 00042 IMAGEVIEW_RIGHT = 0x00200000, /// Right-aligned 00043 IMAGEVIEW_CENTER_Y = 0, /// Centered vertically 00044 IMAGEVIEW_TOP = 0x00400000, /// Top-aligned 00045 IMAGEVIEW_BOTTOM = 0x00800000 /// Bottom-aligned 00046 }; 00047 00048 00049 /** 00050 * The Image View widget display a scrollable view of an image. 00051 */ 00052 class FXAPI FXImageView : public FXScrollArea { 00053 FXDECLARE(FXImageView) 00054 protected: 00055 FXImage *image; // Image to view 00056 FXint grabx; // Grab point x 00057 FXint graby; // Grab point y 00058 protected: 00059 FXImageView(); 00060 private: 00061 FXImageView(const FXImageView&); 00062 FXImageView &operator=(const FXImageView&); 00063 public: 00064 long onPaint(FXObject*,FXSelector,void*); 00065 long onMotion(FXObject*,FXSelector,void*); 00066 long onRightBtnPress(FXObject*,FXSelector,void*); 00067 long onRightBtnRelease(FXObject*,FXSelector,void*); 00068 public: 00069 enum { 00070 ID_XYZ=FXScrollArea::ID_LAST, 00071 ID_LAST 00072 }; 00073 public: 00074 00075 /// Construct a scroll window 00076 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); 00077 00078 /// Create server-side resources 00079 virtual void create(); 00080 00081 /// Detach server-side resources 00082 virtual void detach(); 00083 00084 /// Perform layout 00085 virtual void layout(); 00086 00087 /// Image view widget can receive focus 00088 virtual FXbool canFocus() const; 00089 00090 /// Return the width of the contents 00091 virtual FXint getContentWidth(); 00092 00093 /// Return the height of the contents 00094 virtual FXint getContentHeight(); 00095 00096 /// Change image 00097 void setImage(FXImage* img); 00098 00099 /// Return image 00100 FXImage* getImage() const { return image; } 00101 00102 /// Set the current alignment. 00103 void setAlignment(FXuint mode); 00104 00105 /// Get the current alignment. 00106 FXuint getAlignment() const; 00107 00108 /// Save list to a stream 00109 virtual void save(FXStream& store) const; 00110 00111 /// Load list from a stream 00112 virtual void load(FXStream& store); 00113 00114 /// Destroy 00115 virtual ~FXImageView(); 00116 }; 00117 00118 } 00119 00120 #endif

Copyright © 1997-2005 Jeroen van der Zijp