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

FXImageView.h
Go to the documentation of this file.
1 /********************************************************************************
2 * *
3 * I m a g e V i e w W i d g e t *
4 * *
5 *********************************************************************************
6 * Copyright (C) 2000,2006 by Jeroen van der Zijp. All Rights Reserved. *
7 *********************************************************************************
8 * This library is free software; you can redistribute it and/or *
9 * modify it under the terms of the GNU Lesser General Public *
10 * License as published by the Free Software Foundation; either *
11 * version 2.1 of the License, or (at your option) any later version. *
12 * *
13 * This library is distributed in the hope that it will be useful, *
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
16 * Lesser General Public License for more details. *
17 * *
18 * You should have received a copy of the GNU Lesser General Public *
19 * License along with this library; if not, write to the Free Software *
20 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. *
21 *********************************************************************************
22 * $Id: FXImageView.h,v 1.16 2006/01/22 17:58:05 fox Exp $ *
23 ********************************************************************************/
24 #ifndef FXIMAGEVIEW_H
25 #define FXIMAGEVIEW_H
26 
27 #ifndef FXSCROLLAREA_H
28 #include "FXScrollArea.h"
29 #endif
30 
31 namespace FX {
32 
33 
34 class FXImage;
35 
36 
37 /// Image alignment styles
38 enum {
39  IMAGEVIEW_NORMAL = 0, /// Normal mode is centered
40  IMAGEVIEW_CENTER_X = 0, /// Centered horizontally
41  IMAGEVIEW_LEFT = 0x00100000, /// Left-aligned
42  IMAGEVIEW_RIGHT = 0x00200000, /// Right-aligned
43  IMAGEVIEW_CENTER_Y = 0, /// Centered vertically
44  IMAGEVIEW_TOP = 0x00400000, /// Top-aligned
45  IMAGEVIEW_BOTTOM = 0x00800000 /// Bottom-aligned
46  };
47 
48 
49 /**
50 * The Image View widget display a scrollable view of an image.
51 */
52 class FXAPI FXImageView : public FXScrollArea {
54 protected:
55  FXImage *image; // Image to view
56  FXint grabx; // Grab point x
57  FXint graby; // Grab point y
58 protected:
60 private:
61  FXImageView(const FXImageView&);
62  FXImageView &operator=(const FXImageView&);
63 public:
64  long onPaint(FXObject*,FXSelector,void*);
65  long onMotion(FXObject*,FXSelector,void*);
66  long onRightBtnPress(FXObject*,FXSelector,void*);
67  long onRightBtnRelease(FXObject*,FXSelector,void*);
68 public:
69  enum {
70  ID_XYZ=FXScrollArea::ID_LAST,
71  ID_LAST
72  };
73 public:
74 
75  /// Construct a scroll window
76  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);
77 
78  /// Create server-side resources
79  virtual void create();
80 
81  /// Detach server-side resources
82  virtual void detach();
83 
84  /// Perform layout
85  virtual void layout();
86 
87  /// Image view widget can receive focus
88  virtual bool canFocus() const;
89 
90  /// Return the width of the contents
91  virtual FXint getContentWidth();
92 
93  /// Return the height of the contents
94  virtual FXint getContentHeight();
95 
96  /// Change image
97  void setImage(FXImage* img);
98 
99  /// Return image
100  FXImage* getImage() const { return image; }
101 
102  /// Set the current alignment.
103  void setAlignment(FXuint mode);
104 
105  /// Get the current alignment.
106  FXuint getAlignment() const;
107 
108  /// Save list to a stream
109  virtual void save(FXStream& store) const;
110 
111  /// Load list from a stream
112  virtual void load(FXStream& store);
113 
114  /// Destroy
115  virtual ~FXImageView();
116  };
117 
118 }
119 
120 #endif
Right-aligned.
Definition: FXImageView.h:45
Normal mode is centered.
Definition: FXImageView.h:42
Definition: FXWindow.h:241
unsigned int FXuint
Definition: fxdefs.h:396
FXuint FXSelector
Association key.
Definition: FXObject.h:53
#define FXAPI
Definition: fxdefs.h:122
Base composite.
Definition: FXComposite.h:35
Bottom-aligned.
Definition: FXImageView.h:48
#define NULL
Definition: fxdefs.h:41
A stream is a way to serialize data and objects into a byte stream.
Definition: FXStream.h:99
Top-aligned.
Definition: FXImageView.h:47
Centered vertically.
Definition: FXImageView.h:46
int FXint
Definition: fxdefs.h:397
The scroll area widget manages a content area and a viewport area through which the content is viewed...
Definition: FXScrollArea.h:75
Object is the base class for all objects in FOX; in order to receive messages from the user interface...
Definition: FXObject.h:166
An Image is a rectangular array of pixels.
Definition: FXImage.h:67
#define FXDECLARE(classname)
Macro to set up class declaration.
Definition: FXObject.h:92
Left-aligned.
Definition: FXImageView.h:44
Centered horizontally.
Definition: FXImageView.h:43
The Image View widget display a scrollable view of an image.
Definition: FXImageView.h:59

Copyright © 1997-2005 Jeroen van der Zijp