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

FXCursor.h
1 /********************************************************************************
2 * *
3 * C u r s o r - O b j e c t *
4 * *
5 *********************************************************************************
6 * Copyright (C) 1997,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 FXCURSOR_H
22 #define FXCURSOR_H
23 
24 #ifndef FXID_H
25 #include "FXId.h"
26 #endif
27 
28 namespace FX {
29 
30 
31 // Stock cursors
32 enum FXStockCursor {
33  CURSOR_ARROW=1,
34  CURSOR_RARROW,
35  CURSOR_IBEAM,
36  CURSOR_WATCH,
37  CURSOR_CROSS,
38  CURSOR_UPDOWN,
39  CURSOR_LEFTRIGHT,
40  CURSOR_MOVE
41  };
42 
43 
45 enum {
46  CURSOR_KEEP = 0x00000100,
47  CURSOR_OWNED = 0x00000200
48  };
49 
50 
52 class FXAPI FXCursor : public FXId {
53  FXDECLARE(FXCursor)
54 protected:
55  FXColor *data; // Source data
56  FXint width; // Width
57  FXint height; // Height
58  FXint hotx; // Hot spot x
59  FXint hoty; // Hot spot y
60  FXuint options; // Options
61 protected:
62  FXCursor();
63 private:
64  FXCursor(const FXCursor&);
65  FXCursor &operator=(const FXCursor&);
66 public:
67 
69  FXCursor(FXApp* a,FXStockCursor curid=CURSOR_ARROW);
70 
72  FXCursor(FXApp* a,const FXuchar* src,const FXuchar* msk,FXint w=32,FXint h=32,FXint hx=0,FXint hy=0);
73 
75  FXCursor(FXApp* a,const FXColor* pix,FXint w=32,FXint h=32,FXint hx=0,FXint hy=0);
76 
78  void setOptions(FXuint opts);
79 
81  FXuint getOptions() const { return options; }
82 
84  void setOwned(FXbool owned);
85 
87  FXbool isOwned() const;
88 
90  FXint getWidth() const { return width; }
91 
93  FXint getHeight() const { return height; }
94 
96  void setHotX(FXint x){ hotx=x; }
97 
99  FXint getHotX() const { return hotx; }
100 
102  void setHotY(FXint y){ hoty=y; }
103 
105  FXint getHotY() const { return hoty; }
106 
108  FXbool isColor() const;
109 
111  virtual void create();
112 
114  virtual void detach();
115 
117  virtual void destroy();
118 
120  virtual void release();
121 
123  virtual FXbool savePixels(FXStream& store) const;
124 
126  virtual FXbool loadPixels(FXStream& store);
127 
129  virtual void save(FXStream& store) const;
130 
132  virtual void load(FXStream& store);
133 
135  virtual ~FXCursor();
136  };
137 
138 }
139 
140 #endif
FXint getHotX() const
Get hotspot x; returns 0 for stock cursors.
Definition: FXCursor.h:99
FXint getHotY() const
Get hotspot y; returns 0 for stock cursors.
Definition: FXCursor.h:105
The Application object is the central point of a FOX user-interface.
Definition: FXApp.h:134
A stream is a way to serialize data and objects into a byte stream.
Definition: FXStream.h:81
Encapsulates server side resource.
Definition: FXId.h:34
Definition: FX4Splitter.h:28
void setHotY(FXint y)
Set hotspot y; returns 0 for stock cursors.
Definition: FXCursor.h:102
Cursor class.
Definition: FXCursor.h:52
FXint getWidth() const
Width of cursor; returns 0 for stock cursors.
Definition: FXCursor.h:90
void setHotX(FXint x)
Set hotspot x; returns 0 for stock cursors.
Definition: FXCursor.h:96
FXuint getOptions() const
To get to the option flags.
Definition: FXCursor.h:81
FXint getHeight() const
Height of cursor; returns 0 for stock cursors.
Definition: FXCursor.h:93

Copyright © 1997-2022 Jeroen van der Zijp