Main Page Class Hierarchy Alphabetical List Compound List File List Compound Members
|
00001 /******************************************************************************** 00002 * * 00003 * C u r s o r - O b j e c t * 00004 * * 00005 ********************************************************************************* 00006 * Copyright (C) 1997,2005 by Jeroen van der Zijp. All Rights Reserved. * 00007 ********************************************************************************* 00008 * This library is free software; you can redistribute it and/or * 00009 * modify it under the terms of the GNU Lesser General Public * 00010 * License as published by the Free Software Foundation; either * 00011 * version 2.1 of the License, or (at your option) any later version. * 00012 * * 00013 * This library is distributed in the hope that it will be useful, * 00014 * but WITHOUT ANY WARRANTY; without even the implied warranty of * 00015 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * 00016 * Lesser General Public License for more details. * 00017 * * 00018 * You should have received a copy of the GNU Lesser General Public * 00019 * License along with this library; if not, write to the Free Software * 00020 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. * 00021 ********************************************************************************* 00022 * $Id: FXCursor.h,v 1.25 2005/01/16 16:06:06 fox Exp $ * 00023 ********************************************************************************/ 00024 #ifndef FXCURSOR_H 00025 #define FXCURSOR_H 00026 00027 #ifndef FXID_H 00028 #include "FXId.h" 00029 #endif 00030 00031 namespace FX { 00032 00033 00034 // Stock cursors 00035 enum FXStockCursor { 00036 CURSOR_ARROW=1, /// Default left pointing arrow 00037 CURSOR_RARROW, /// Right arrow 00038 CURSOR_IBEAM, /// Text I-Beam 00039 CURSOR_WATCH, /// Stopwatch or hourglass 00040 CURSOR_CROSS, /// Crosshair 00041 CURSOR_UPDOWN, /// Move up, down 00042 CURSOR_LEFTRIGHT, /// Move left, right 00043 CURSOR_MOVE /// Move up,down,left,right 00044 }; 00045 00046 00047 /// Cursor options 00048 enum { 00049 CURSOR_KEEP = 0x00000100, /// Keep pixel data in client 00050 CURSOR_OWNED = 0x00000200 /// Pixel data is owned by image 00051 }; 00052 00053 00054 /// Cursor class 00055 class FXAPI FXCursor : public FXId { 00056 FXDECLARE(FXCursor) 00057 protected: 00058 FXColor *data; // Source data 00059 FXint width; // Width 00060 FXint height; // Height 00061 FXint hotx; // Hot spot x 00062 FXint hoty; // Hot spot y 00063 FXuint options; // Options 00064 protected: 00065 FXCursor(); 00066 private: 00067 FXCursor(const FXCursor&); 00068 FXCursor &operator=(const FXCursor&); 00069 public: 00070 00071 /// Make stock cursor 00072 FXCursor(FXApp* a,FXStockCursor curid=CURSOR_ARROW); 00073 00074 /// Make cursor from source and mask; cursor size should at most 32x32 for portability! 00075 FXCursor(FXApp* a,const FXuchar* src,const FXuchar* msk,FXint w=32,FXint h=32,FXint hx=0,FXint hy=0); 00076 00077 /// Make cursor from FXColor pixels; cursor size should be at most 32x32 for portability! 00078 FXCursor(FXApp* a,const FXColor* pix,FXint w=32,FXint h=32,FXint hx=0,FXint hy=0); 00079 00080 /// Width of cursor; returns 0 for stock cursors 00081 FXint getWidth() const { return width; } 00082 00083 /// Height of cursor; returns 0 for stock cursors 00084 FXint getHeight() const { return height; } 00085 00086 /// Get hotspot x; returns 0 for stock cursors 00087 void setHotX(FXint x){ hotx=x; } 00088 00089 /// Get hotspot x; returns 0 for stock cursors 00090 FXint getHotX() const { return hotx; } 00091 00092 /// Get hotspot y; returns 0 for stock cursors 00093 void setHotY(FXint y){ hoty=y; } 00094 00095 /// Get hotspot y; returns 0 for stock cursors 00096 FXint getHotY() const { return hoty; } 00097 00098 /// Check if there is color in the cursor 00099 FXbool isColor() const; 00100 00101 /// Create cursor 00102 virtual void create(); 00103 00104 /// Detach cursor 00105 virtual void detach(); 00106 00107 /// Destroy cursor 00108 virtual void destroy(); 00109 00110 /// Release pixels buffer if it was owned 00111 virtual void release(); 00112 00113 /// Save pixel data only 00114 virtual FXbool savePixels(FXStream& store) const; 00115 00116 /// Load pixel data only 00117 virtual FXbool loadPixels(FXStream& store); 00118 00119 /// Save cursor to a stream 00120 virtual void save(FXStream& store) const; 00121 00122 /// Load cursor from a stream 00123 virtual void load(FXStream& store); 00124 00125 /// Destructor 00126 virtual ~FXCursor(); 00127 }; 00128 00129 } 00130 00131 #endif
Copyright © 1997-2005 Jeroen van der Zijp |