Photon microGUI widgets library 0.6.0
ImageArea.h
1#ifndef PHWIDGETS_IMAGE_AREA_H
2#define PHWIDGETS_IMAGE_AREA_H
3
4#include <photon/PtImageArea.h>
5
6#include "./Container.h"
7#include "./Drawing/Image.h"
8
9namespace PhWidgets
10{
17
29 class ImageArea:
30 public Container
31 {
32 public:
33
35 struct ThisArgs
36 {
38 struct ArgLong
39 {
41
51 {
52 grid_threshold = Pt_ARG_IMAGEAREA_GRID_THRESHOLD,
54 zoom = Pt_ARG_IMAGEAREA_ZOOM
55 };
56 };
57
59 struct ArgColor
60 {
62
72 {
73 grid_color = Pt_ARG_IMAGEAREA_GRID_COLOR
74 };
75 };
76
78 struct ArgShort
79 {
81
91 {
92 top = Pt_ARG_IMAGEAREA_TOP,
93 left = Pt_ARG_IMAGEAREA_LEFT
94 };
95
97 {
98 imagearea_flags = Pt_ARG_IMAGEAREA_FLAGS
99 };
100 };
101
104 {
106
116 {
117 imagearea_image = Pt_ARG_IMAGEAREA_IMAGE
119 };
120 };
121
123 struct ArgRect
124 {
126
136 {
137 selection = Pt_ARG_IMAGEAREA_SELECTION
138 };
139 };
140
141 };
142
145 {
147 struct Callback
148 {
150
159 {
160 drag = Pt_CB_IMAGEAREA_DRAG,
161 movement = Pt_CB_IMAGEAREA_MOVEMENT,
162 scrolled = Pt_CB_IMAGEAREA_SCROLLED,
163 selection = Pt_CB_IMAGEAREA_SELECTION
164 };
165 };
166 };
167
170 {
172
180 {
181 Autoscale = Pt_IMAGEAREA_AUTOSCALE,
182 EnableSelection = Pt_IMAGEAREA_ENABLE_SELECTION,
183 EditableSelection = Pt_IMAGEAREA_EDITABLE_SELECTION
184 };
185 };
186
188 struct ArgLong:
189 public ArgumentsEx<Container::ArgLong>,
190 public ThisArgs::ArgLong
191 {
193 };
194
196 struct ArgColor:
197 public ArgumentsEx<Container::ArgColor>,
198 public ThisArgs::ArgColor
199 {
201 };
202
204 struct ArgShort:
205 public ThisArgs::ArgShort
206 { };
207
209 struct ArgPImage:
211 { };
212
214 struct ArgRect:
215 public ArgumentsEx<Container::ArgRect>,
216 public ThisArgs::ArgRect
217 {
219 };
220
222 struct Callback:
223 public ArgumentsEx<Container::Callback>,
225 {
227 };
228
230 struct Arguments:
231 public ArgLong,
232 public ArgColor,
233 public ArgShort,
234 public ArgPImage,
235 public ArgRect,
237 { };
238
240 struct Callbacks:
241 public Callback,
243 { };
244
246 struct Flags:
247 public ThisFlags,
248 public Container::Flags
249 { };
250
251 protected:
252 typedef ResourceFrom<Container::WidgetResourcesSingleton>::
253 Define::Scalar<ThisArgs::ArgLong::eArgLong, long>::
254 Define::Color<ThisArgs::ArgColor::eArgColor>::
255 Define::Scalar<ThisArgs::ArgShort::eArgShort, short>::
256 Define::Image<ArgPImage::eArgPImage>::
257 Define::Struct<ThisArgs::ArgRect::eArgRect, PhRect_t>::
258 Define::Flag<ThisArgs::ArgShort::eArgShortFlag, short>::
259
260 Define::Link<ThisCallbacks::Callback::eCallback, PtCallback_t*>::
261
262 resource_type WidgetResourcesSingleton;
263
264 virtual void check();
265
266 //for properties:
267
268 void setAutoScale(bool);
269 bool getAutoScale() const;
270
271 Drawing::Image getImage() const;
272 void setImage(Drawing::Image);
273
274 public:
276
280 explicit ImageArea(int abn);
281
283
287 explicit ImageArea(PtWidget_t *wdg);
288
290
294 ImageArea(const ImageArea &other);
295
297
302
304
308 WidgetResourcesSingleton resource;
309
312
313
315
325 property<bool>::bind<ImageArea, &ImageArea::getAutoScale, &ImageArea::setAutoScale> AutoScale;
326
328
340
342
356
358
395 property<Drawing::Image>::bind<ImageArea, &ImageArea::getImage, &ImageArea::setImage> Image;
396
398
409
411
413
419 };
420} // namespace PhWidgets
421
422cppbitmasks::bitmask<unsigned short, PhWidgets::ImageArea::Flags::eImageAreaFlags> operator|(const PhWidgets::ImageArea::Flags::eImageAreaFlags &flag1, const PhWidgets::ImageArea::Flags::eImageAreaFlags &flag2);
423cppbitmasks::bitmask<unsigned short, PhWidgets::ImageArea::Flags::eImageAreaFlags> operator&(const PhWidgets::ImageArea::Flags::eImageAreaFlags &flag1, const PhWidgets::ImageArea::Flags::eImageAreaFlags &flag2);
424cppbitmasks::bitmask<unsigned short, PhWidgets::ImageArea::Flags::eImageAreaFlags> operator^(const PhWidgets::ImageArea::Flags::eImageAreaFlags &flag1, const PhWidgets::ImageArea::Flags::eImageAreaFlags &flag2);
425
426
427#endif // PHWIDGETS_IMAGE_AREA_H
Layout and geometry management for all container widgets.
Definition: Container.h:24
An abstract base class that provides functionality for the Drawing::Bitmap class.
Definition: Image.h:185
Represents an image area widget for displaying an image.
Definition: ImageArea.h:31
ImageArea & operator=(const ImageArea &other)
Assigns value in ImageArea.
WidgetResourcesSingleton resource
Resources of the ImageArea.
Definition: ImageArea.h:308
property< bool >::bind< ImageArea, &ImageArea::getAutoScale, &ImageArea::setAutoScale > AutoScale
Determines whether or not to use automatically scale the image to fit the size of the widget.
Definition: ImageArea.h:325
phproperty< long >::bind< ImageArea, ArgLong::eArgLong, Arguments::zoom > ZoomingFactor
Gets or sets the zooming factor.
Definition: ImageArea.h:408
ImageArea(PtWidget_t *wdg)
(constructor)
phproperty< Drawing::Color >::bind< ImageArea, ArgColor::eArgColor, Arguments::grid_color > GridColor
Gets or sets the color of the grid, if displayed.
Definition: ImageArea.h:339
phproperty< long >::bind< ImageArea, ArgLong::eArgLong, Arguments::grid_threshold > GridThreshold
Gets or sets the grid threshold.
Definition: ImageArea.h:355
ImageArea(int abn)
(constructor)
ImageArea(const ImageArea &other)
(copy constructor)
property< Drawing::Image >::bind< ImageArea, &ImageArea::getImage, &ImageArea::setImage > Image
Gets or sets the image that is displayed by ImageArea.
Definition: ImageArea.h:395
An event, which raise a notification to registered subscribers (event handlers) that something of int...
Definition: Widget.h:132
The main namespace for all widgets.
Definition: Basic.h:11
Contains flags for all Basic resources.
Definition: Basic.h:269
Contains resource IDs for all Container arguments.
Definition: Container.h:303
Contains resource IDs for all Container callbacks.
Definition: Container.h:309
Contains resource IDs for arguments of type PgColor_t.
Definition: ImageArea.h:199
Contains resource IDs for arguments of type long.
Definition: ImageArea.h:191
Contains resource IDs for arguments of type PhImage_t.
Definition: ImageArea.h:211
Contains resource IDs for arguments of type PhRect_t.
Definition: ImageArea.h:217
Contains resource IDs for arguments of type short.
Definition: ImageArea.h:206
Contains resource IDs for all ImageArea arguments.
Definition: ImageArea.h:237
Contains resource IDs for callbacks of type PtCallback_t.
Definition: ImageArea.h:225
Contains resource IDs for all ImageArea callbacks.
Definition: ImageArea.h:243
Contains flags for all ImageArea resources.
Definition: ImageArea.h:249
Contains resource IDs for ImageArea arguments of type PgColor_t.
Definition: ImageArea.h:60
eArgColor
Resource IDs for ImageArea arguments of type PgColor_t.
Definition: ImageArea.h:72
@ grid_color
The color of the grid, if displayed.
Definition: ImageArea.h:73
Contains resource IDs for ImageArea arguments of type long.
Definition: ImageArea.h:39
eArgLong
Resource IDs for ImageArea arguments of type long.
Definition: ImageArea.h:51
@ grid_threshold
Definition: ImageArea.h:52
@ zoom
The zooming factor, expressed as a fixed-point 16.16 number.
Definition: ImageArea.h:54
Contains resource IDs for ImageArea arguments of type PhImage_t.
Definition: ImageArea.h:104
eArgPImage
Resource IDs for ImageArea arguments of type PhImage_t.
Definition: ImageArea.h:116
@ imagearea_image
Definition: ImageArea.h:117
Contains resource IDs for ImageArea arguments of type PhRect_t.
Definition: ImageArea.h:124
eArgRect
Resource IDs for ImageArea arguments of type PhRect_t.
Definition: ImageArea.h:136
@ selection
A PhRect_t structure that contains the selected area of the image, in image coordinates (pixels).
Definition: ImageArea.h:137
Contains resource IDs for ImageArea arguments of type short.
Definition: ImageArea.h:79
eArgShortFlag
Definition: ImageArea.h:97
@ imagearea_flags
Flags that control the behavior of the image area.
Definition: ImageArea.h:98
eArgShort
Resource IDs for ImageArea arguments of type short.
Definition: ImageArea.h:91
@ left
The coordinate, in image pixels, of the left side of the image viewport. This only applies when the i...
Definition: ImageArea.h:93
@ top
The coordinate, in image pixels, of the top side of the image viewport. This only applies when the im...
Definition: ImageArea.h:92
Contains resource IDs for ImageArea arguments.
Definition: ImageArea.h:36
Contains resource IDs for ImageArea callbacks of type PtCallback_t.
Definition: ImageArea.h:148
eCallback
Resource IDs for ImageArea arguments of type PtCallback_t.
Definition: ImageArea.h:159
@ movement
A list of PtCallback_t structures that define the callbacks that are invoked when the mouse cursor is...
Definition: ImageArea.h:161
@ scrolled
A list of PtCallback_t structures that define the callbacks that are invoked when the image area is s...
Definition: ImageArea.h:162
@ drag
A list of PtCallback_t structures that define the callbacks invoked when the image area is dragged.
Definition: ImageArea.h:160
@ selection
A list of PtCallback_t structures that define the callbacks invoked when the image area is selected.
Definition: ImageArea.h:163
Contains resource IDs for ImageArea callbacks.
Definition: ImageArea.h:145
Contains flags for ImageArea resources.
Definition: ImageArea.h:170
eImageAreaFlags
ImageAreas flags for ImageArea resource ImageArea::Arguments::imagearea_flags.
Definition: ImageArea.h:180
@ EnableSelection
Allow the user to select part of the image.
Definition: ImageArea.h:182
@ Autoscale
Automatically scale the image to fit the size of the widget.
Definition: ImageArea.h:181
@ EditableSelection
Allow the user to modify a selection.
Definition: ImageArea.h:183