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