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

FXBitmapView.h
1 /********************************************************************************
2 * *
3 * B i t m a p V i e w W i d g e t *
4 * *
5 *********************************************************************************
6 * Copyright (C) 2000,2022 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 FXBITMAPVIEW_H
22 #define FXBITMAPVIEW_H
23 
24 #ifndef FXSCROLLAREA_H
25 #include "FXScrollArea.h"
26 #endif
27 
28 namespace FX {
29 
30 
31 class FXBitmap;
32 
34 enum {
35  BITMAPVIEW_NORMAL = 0,
36  BITMAPVIEW_CENTER_X = 0,
37  BITMAPVIEW_LEFT = 0x00100000,
38  BITMAPVIEW_RIGHT = 0x00200000,
39  BITMAPVIEW_CENTER_Y = 0,
40  BITMAPVIEW_TOP = 0x00400000,
41  BITMAPVIEW_BOTTOM = 0x00800000
42  };
43 
50 class FXAPI FXBitmapView : public FXScrollArea {
51  FXDECLARE(FXBitmapView)
52 protected:
53  FXBitmap *bitmap; // Image to view
54  FXColor onColor; // Color for on pixels
55  FXColor offColor; // Color for off pixels
56  FXint grabx; // Grab point x
57  FXint graby; // Grab point y
58 protected:
59  FXBitmapView();
60 private:
61  FXBitmapView(const FXBitmapView&);
62  FXBitmapView &operator=(const FXBitmapView&);
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 
76  FXBitmapView(FXComposite* p,FXBitmap* bmp=nullptr,FXObject* tgt=nullptr,FXSelector sel=0,FXuint opts=0,FXint x=0,FXint y=0,FXint w=0,FXint h=0);
77 
79  virtual void create();
80 
82  virtual void detach();
83 
85  virtual void layout();
86 
88  virtual FXbool canFocus() const;
89 
91  virtual FXint getContentWidth();
92 
94  virtual FXint getContentHeight();
95 
97  void setBitmap(FXBitmap* bmp);
98 
100  FXBitmap* getBitmap() const { return bitmap; }
101 
103  void setOnColor(FXColor clr);
104 
106  FXColor getOnColor() const { return onColor; }
107 
109  void setOffColor(FXColor clr);
110 
112  FXColor getOffColor() const { return offColor; }
113 
115  void setAlignment(FXuint mode);
116 
118  FXuint getAlignment() const;
119 
121  virtual void save(FXStream& store) const;
122 
124  virtual void load(FXStream& store);
125 
127  virtual ~FXBitmapView();
128  };
129 
130 }
131 
132 #endif
FXColor getOffColor() const
Get off color.
Definition: FXBitmapView.h:112
A Bitmap is a rectangular array of pixels.
Definition: FXBitmap.h:55
Base composite.
Definition: FXComposite.h:32
The Bitmap View widget display a scrollable view of a monochrome bitmap image; the bitmap is not owne...
Definition: FXBitmapView.h:50
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
FXColor getOnColor() const
Get on color.
Definition: FXBitmapView.h:106
Object is the base class for all objects in FOX; in order to receive messages from the user interface...
Definition: FXObject.h:134
FXBitmap * getBitmap() const
Return image.
Definition: FXBitmapView.h:100

Copyright © 1997-2022 Jeroen van der Zijp