xref: /aoo41x/main/vcl/inc/vcl/cursor.hxx (revision cdf0e10c)
1 /*************************************************************************
2  *
3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4  *
5  * Copyright 2000, 2010 Oracle and/or its affiliates.
6  *
7  * OpenOffice.org - a multi-platform office productivity suite
8  *
9  * This file is part of OpenOffice.org.
10  *
11  * OpenOffice.org is free software: you can redistribute it and/or modify
12  * it under the terms of the GNU Lesser General Public License version 3
13  * only, as published by the Free Software Foundation.
14  *
15  * OpenOffice.org is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18  * GNU Lesser General Public License version 3 for more details
19  * (a copy is included in the LICENSE file that accompanied this code).
20  *
21  * You should have received a copy of the GNU Lesser General Public License
22  * version 3 along with OpenOffice.org.  If not, see
23  * <http://www.openoffice.org/license.html>
24  * for a copy of the LGPLv3 License.
25  *
26  ************************************************************************/
27 
28 #ifndef _SV_CURSOR_HXX
29 #define _SV_CURSOR_HXX
30 
31 #include <tools/gen.hxx>
32 #include <tools/link.hxx>
33 #include <vcl/sv.h>
34 #include <vcl/dllapi.h>
35 
36 class AutoTimer;
37 struct ImplCursorData;
38 class Window;
39 
40 // -----------------
41 // - Cursor-Styles -
42 // -----------------
43 
44 #define CURSOR_SHADOW					((sal_uInt16)0x0001)
45 #define CURSOR_DIRECTION_NONE           ((unsigned char)0x00)
46 #define CURSOR_DIRECTION_LTR            ((unsigned char)0x01)
47 #define CURSOR_DIRECTION_RTL            ((unsigned char)0x02)
48 
49 // ----------
50 // - Cursor -
51 // ----------
52 
53 class VCL_DLLPUBLIC Cursor
54 {
55 private:
56 	ImplCursorData* mpData; 			// Interne Daten
57 	Window* 		mpWindow;			// Window (only for shadow cursor)
58 	long			mnSlant;			// Schraegstellung
59 	long			mnOffsetY;			// Offset fuer Rotation
60 	Size			maSize; 			// Groesse
61 	Point			maPos;				// Position
62 	short			mnOrientation;		// Rotation
63 	sal_uInt16			mnStyle;			// Style
64 	sal_Bool			mbVisible;			// Ist Cursor sichtbar
65 	unsigned char	mnDirection;		// indicates direction
66 
67 public:
68 	SAL_DLLPRIVATE void			ImplDraw();
69 	SAL_DLLPRIVATE void			ImplRestore();
70 	DECL_DLLPRIVATE_LINK(       ImplTimerHdl, AutoTimer* );
71 	SAL_DLLPRIVATE void			ImplShow( bool bDrawDirect = true, bool bRestore = false );
72 	SAL_DLLPRIVATE bool			ImplHide( bool bStopTimer );
73 	SAL_DLLPRIVATE void			ImplNew();
74 
75 public:
76 					Cursor();
77 					Cursor( const Cursor& rCursor );
78 					~Cursor();
79 
80 	void			SetStyle( sal_uInt16 nStyle );
81 	sal_uInt16			GetStyle() const { return mnStyle; }
82 
83 	void			Show();
84 	void			Hide();
85 	sal_Bool			IsVisible() const { return mbVisible; }
86 
87 	void			SetWindow( Window* pWindow );
88 	Window* 		GetWindow() const { return mpWindow; }
89 
90 	void			SetPos( const Point& rNewPos );
91 	const Point&	GetPos() const { return maPos; }
92 	void			SetOffsetY( long mnOffsetY = 0 );
93 	long			GetOffsetY() const { return mnOffsetY; }
94 
95 	void			SetSize( const Size& rNewSize );
96 	const Size& 	GetSize() const { return maSize; }
97 	void			SetWidth( long nNewWidth );
98 	long			GetWidth() const { return maSize.Width(); }
99 	void			SetHeight( long nNewHeight );
100 	long			GetHeight() const { return maSize.Height(); }
101 
102 	void			SetSlant( long nSlant = 0 );
103 	long			GetSlant() const { return mnSlant; }
104 
105 	void			SetOrientation( short nOrientation = 0 );
106 	short			GetOrientation() const { return mnOrientation; }
107 
108 	void			SetDirection( unsigned char nDirection = 0 );
109 	unsigned char	GetDirection() const { return mnDirection; }
110 
111 	Cursor& 		operator=( const Cursor& rCursor );
112 	sal_Bool			operator==( const Cursor& rCursor ) const;
113 	sal_Bool			operator!=( const Cursor& rCursor ) const
114 						{ return !(Cursor::operator==( rCursor )); }
115 };
116 
117 #endif	// _SV_CURSOR_HXX
118