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 INCLUDED_VCL_CURSOR_HXX
21 : #define INCLUDED_VCL_CURSOR_HXX
22 :
23 : #include <tools/gen.hxx>
24 : #include <tools/link.hxx>
25 : #include <vcl/dllapi.h>
26 : #include <vcl/vclptr.hxx>
27 :
28 : class Timer;
29 : struct ImplCursorData;
30 : namespace vcl { class Window; }
31 :
32 : // Cursor styles
33 : #define CURSOR_SHADOW ((sal_uInt16)0x0001)
34 :
35 : enum class CursorDirection
36 : {
37 : NONE, LTR, RTL
38 : };
39 :
40 : namespace vcl
41 : {
42 :
43 : class VCL_DLLPUBLIC Cursor
44 : {
45 : private:
46 : ImplCursorData* mpData;
47 : VclPtr<vcl::Window> mpWindow; // only for shadow cursor
48 : long mnSlant;
49 : Size maSize;
50 : Point maPos;
51 : short mnOrientation;
52 : sal_uInt16 mnStyle;
53 : bool mbVisible;
54 : CursorDirection mnDirection;
55 :
56 : public:
57 : SAL_DLLPRIVATE void ImplDraw();
58 : SAL_DLLPRIVATE void ImplRestore();
59 : DECL_DLLPRIVATE_LINK_TYPED( ImplTimerHdl, Timer*, void );
60 : SAL_DLLPRIVATE void ImplShow( bool bDrawDirect = true );
61 : SAL_DLLPRIVATE void ImplHide( bool bStopTimer );
62 : SAL_DLLPRIVATE void ImplResume( bool bRestore = false );
63 : SAL_DLLPRIVATE bool ImplSuspend();
64 : SAL_DLLPRIVATE void ImplNew();
65 :
66 : public:
67 : Cursor();
68 : Cursor( const Cursor& rCursor );
69 : ~Cursor();
70 :
71 : void SetStyle( sal_uInt16 nStyle );
72 53441 : sal_uInt16 GetStyle() const { return mnStyle; }
73 :
74 : void Show();
75 : void Hide();
76 65596 : bool IsVisible() const { return mbVisible; }
77 :
78 : void SetWindow( vcl::Window* pWindow );
79 : vcl::Window* GetWindow() const { return mpWindow; }
80 :
81 : void SetPos( const Point& rNewPos );
82 88 : const Point& GetPos() const { return maPos; }
83 :
84 : void SetSize( const Size& rNewSize );
85 3 : const Size& GetSize() const { return maSize; }
86 : void SetWidth( long nNewWidth );
87 57 : long GetWidth() const { return maSize.Width(); }
88 57 : long GetHeight() const { return maSize.Height(); }
89 :
90 : long GetSlant() const { return mnSlant; }
91 :
92 : void SetOrientation( short nOrientation = 0 );
93 : short GetOrientation() const { return mnOrientation; }
94 :
95 : void SetDirection( CursorDirection nDirection = CursorDirection::NONE );
96 : CursorDirection GetDirection() const { return mnDirection; }
97 :
98 : Cursor& operator=( const Cursor& rCursor );
99 : bool operator==( const Cursor& rCursor ) const;
100 : bool operator!=( const Cursor& rCursor ) const
101 : { return !(Cursor::operator==( rCursor )); }
102 :
103 : private:
104 : void ImplDoShow( bool bDrawDirect, bool bRestore );
105 : bool ImplDoHide( bool bStop );
106 : };
107 :
108 : } // namespace vcl
109 :
110 : #endif // INCLUDED_VCL_CURSOR_HXX
111 :
112 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|