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

FXImageView.h
1 /********************************************************************************
2 * *
3 * I m a g e V i e w W i d g e t *
4 * *
5 *********************************************************************************
6 * Copyright (C) 2000,2024 by Jeroen van der Zijp. All Rights Reserved. *
7 *********************************************************************************
8 * This library is free software; you can redistribute it and/or modify *
9 * it under the terms of the GNU Lesser General Public License as published by *
10 * the Free Software Foundation; either version 3 of the License, or *
11 * (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 *
16 * GNU Lesser General Public License for more details. *
17 * *
18 * You should have received a copy of the GNU Lesser General Public License *
19 * along with this program. If not, see <http://www.gnu.org/licenses/> *
20 ********************************************************************************/
21 #ifndef FXIMAGEVIEW_H
22 #define FXIMAGEVIEW_H
23 
24 #ifndef FXSCROLLAREA_H
25 #include "FXScrollArea.h"
26 #endif
27 
28 namespace FX {
29 
30 
31 class FXImage;
32 
33 
35 enum {
36  IMAGEVIEW_NORMAL = 0,
37  IMAGEVIEW_CENTER_X = 0,
38  IMAGEVIEW_LEFT = 0x00100000,
39  IMAGEVIEW_RIGHT = 0x00200000,
40  IMAGEVIEW_CENTER_Y = 0,
41  IMAGEVIEW_TOP = 0x00400000,
42  IMAGEVIEW_BOTTOM = 0x00800000
43  };
44 
45 
49 class FXAPI FXImageView : public FXScrollArea {
50  FXDECLARE(FXImageView)
51 protected:
52  FXImage *image; // Image to view
53  FXint grabx; // Grab point x
54  FXint graby; // Grab point y
55 protected:
56  FXImageView();
57 private:
58  FXImageView(const FXImageView&);
59  FXImageView &operator=(const FXImageView&);
60 public:
61  long onPaint(FXObject*,FXSelector,void*);
62  long onMotion(FXObject*,FXSelector,void*);
63  long onRightBtnPress(FXObject*,FXSelector,void*);
64  long onRightBtnRelease(FXObject*,FXSelector,void*);
65 public:
66  enum {
67  ID_XYZ=FXScrollArea::ID_LAST,
68  ID_LAST
69  };
70 public:
71 
73  FXImageView(FXComposite* p,FXImage* img=nullptr,FXObject* tgt=nullptr,FXSelector sel=0,FXuint opts=0,FXint x=0,FXint y=0,FXint w=0,FXint h=0);
74 
76  virtual void create();
77 
79  virtual void detach();
80 
82  virtual void layout();
83 
85  virtual FXbool canFocus() const;
86 
88  virtual FXint getContentWidth();
89 
91  virtual FXint getContentHeight();
92 
94  void setImage(FXImage* img);
95 
97  FXImage* getImage() const { return image; }
98 
100  void setAlignment(FXuint mode);
101 
103  FXuint getAlignment() const;
104 
106  virtual void save(FXStream& store) const;
107 
109  virtual void load(FXStream& store);
110 
112  virtual ~FXImageView();
113  };
114 
115 }
116 
117 #endif
FXImage * getImage() const
Return image.
Definition: FXImageView.h:97
Base composite.
Definition: FXComposite.h:32
A stream is a way to serialize data and objects into a byte stream.
Definition: FXStream.h:81
Definition: FX4Splitter.h:28
The scroll area widget manages a content area and a viewport area through which the content is viewed...
Definition: FXScrollArea.h:69
Object is the base class for all objects in FOX; in order to receive messages from the user interface...
Definition: FXObject.h:134
An Image is a rectangular array of pixels.
Definition: FXImage.h:67
The Image View widget display a scrollable view of an image.
Definition: FXImageView.h:49

Copyright © 1997-2022 Jeroen van der Zijp