Line data Source code
1 : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : /*
3 : * This file is part of the LibreOffice project.
4 : *
5 : * This Source Code Form is subject to the terms of the Mozilla Public
6 : * License, v. 2.0. If a copy of the MPL was not distributed with this
7 : * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 : *
9 : * This file incorporates work covered by the following license notice:
10 : *
11 : * Licensed to the Apache Software Foundation (ASF) under one or more
12 : * contributor license agreements. See the NOTICE file distributed
13 : * with this work for additional information regarding copyright
14 : * ownership. The ASF licenses this file to you under the Apache
15 : * License, Version 2.0 (the "License"); you may not use this file
16 : * except in compliance with the License. You may obtain a copy of
17 : * the License at http://www.apache.org/licenses/LICENSE-2.0 .
18 : */
19 :
20 : #ifndef _SV_CURSOR_HXX
21 : #define _SV_CURSOR_HXX
22 :
23 : #include <tools/gen.hxx>
24 : #include <tools/link.hxx>
25 : #include <tools/solar.h>
26 : #include <vcl/dllapi.h>
27 :
28 : class AutoTimer;
29 : struct ImplCursorData;
30 : class Window;
31 :
32 : // -----------------
33 : // - Cursor-Styles -
34 : // -----------------
35 :
36 : #define CURSOR_SHADOW ((sal_uInt16)0x0001)
37 : #define CURSOR_DIRECTION_NONE ((unsigned char)0x00)
38 : #define CURSOR_DIRECTION_LTR ((unsigned char)0x01)
39 : #define CURSOR_DIRECTION_RTL ((unsigned char)0x02)
40 :
41 : // ----------
42 : // - Cursor -
43 : // ----------
44 :
45 : class VCL_DLLPUBLIC Cursor
46 : {
47 : private:
48 : ImplCursorData* mpData; // Interne Daten
49 : Window* mpWindow; // Window (only for shadow cursor)
50 : long mnSlant; // Schraegstellung
51 : long mnOffsetY; // Offset fuer Rotation
52 : Size maSize; // Groesse
53 : Point maPos; // Position
54 : short mnOrientation; // Rotation
55 : sal_uInt16 mnStyle; // Style
56 : bool mbVisible; // Ist Cursor sichtbar
57 : unsigned char mnDirection; // indicates direction
58 :
59 : public:
60 : SAL_DLLPRIVATE void ImplDraw();
61 : SAL_DLLPRIVATE void ImplRestore();
62 : DECL_DLLPRIVATE_LINK( ImplTimerHdl, void* );
63 : SAL_DLLPRIVATE void ImplShow( bool bDrawDirect = true );
64 : SAL_DLLPRIVATE void ImplHide( bool bStopTimer );
65 : SAL_DLLPRIVATE void ImplResume( bool bRestore = false );
66 : SAL_DLLPRIVATE bool ImplSuspend();
67 : SAL_DLLPRIVATE void ImplNew();
68 :
69 : public:
70 : Cursor();
71 : Cursor( const Cursor& rCursor );
72 : ~Cursor();
73 :
74 : void SetStyle( sal_uInt16 nStyle );
75 1587 : sal_uInt16 GetStyle() const { return mnStyle; }
76 :
77 : void Show();
78 : void Hide();
79 2099 : bool IsVisible() const { return mbVisible; }
80 :
81 : void SetWindow( Window* pWindow );
82 : Window* GetWindow() const { return mpWindow; }
83 :
84 : void SetPos( const Point& rNewPos );
85 2 : const Point& GetPos() const { return maPos; }
86 6 : long GetOffsetY() const { return mnOffsetY; }
87 :
88 : void SetSize( const Size& rNewSize );
89 0 : const Size& GetSize() const { return maSize; }
90 : void SetWidth( long nNewWidth );
91 0 : long GetWidth() const { return maSize.Width(); }
92 0 : long GetHeight() const { return maSize.Height(); }
93 :
94 : long GetSlant() const { return mnSlant; }
95 :
96 : void SetOrientation( short nOrientation = 0 );
97 : short GetOrientation() const { return mnOrientation; }
98 :
99 : void SetDirection( unsigned char nDirection = 0 );
100 : unsigned char GetDirection() const { return mnDirection; }
101 :
102 : Cursor& operator=( const Cursor& rCursor );
103 : bool operator==( const Cursor& rCursor ) const;
104 : bool operator!=( const Cursor& rCursor ) const
105 : { return !(Cursor::operator==( rCursor )); }
106 :
107 : private:
108 : void ImplDoShow( bool bDrawDirect, bool bRestore );
109 : bool ImplDoHide( bool bStop );
110 : };
111 :
112 : #endif // _SV_CURSOR_HXX
113 :
114 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|