workaround segfault in compiler on macos-clang-intel
[LibreOffice.git] / include / vcl / cursor.hxx
blob268c23c37c0cfc7a1d7a00e71c18bb11c53ecfc9
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
20 #ifndef INCLUDED_VCL_CURSOR_HXX
21 #define INCLUDED_VCL_CURSOR_HXX
23 #include <tools/gen.hxx>
24 #include <tools/link.hxx>
25 #include <vcl/dllapi.h>
26 #include <vcl/vclptr.hxx>
27 #include <rtl/ustring.hxx>
28 #include <memory>
30 class Timer;
31 struct ImplCursorData;
32 class OutputDevice;
33 namespace vcl { class Window; }
35 // Cursor styles
36 #define CURSOR_SHADOW (sal_uInt16(0x0001))
38 enum class CursorDirection
40 NONE, LTR, RTL
43 namespace vcl
46 class VCL_DLLPUBLIC Cursor
48 private:
49 std::unique_ptr<ImplCursorData> mpData;
50 VclPtr<vcl::Window> mpWindow; // only for shadow cursor
51 Size maSize;
52 Point maPos;
53 Degree10 mnOrientation;
54 sal_uInt16 mnStyle;
55 bool mbVisible;
56 CursorDirection mnDirection;
58 public:
59 SAL_DLLPRIVATE void ImplDraw();
60 DECL_DLLPRIVATE_LINK( ImplTimerHdl, Timer*, void );
61 SAL_DLLPRIVATE void ImplShow();
62 SAL_DLLPRIVATE void ImplHide();
63 SAL_DLLPRIVATE void ImplResume( bool bRestore = false );
64 SAL_DLLPRIVATE bool ImplSuspend();
65 SAL_DLLPRIVATE void ImplNew();
67 public:
68 Cursor();
69 SAL_DLLPRIVATE Cursor( const Cursor& rCursor );
70 ~Cursor();
72 void SetStyle( sal_uInt16 nStyle );
73 sal_uInt16 GetStyle() const { return mnStyle; }
75 void Show();
76 void Hide();
77 bool IsVisible() const { return mbVisible; }
79 void SetWindow( vcl::Window* pWindow );
81 void SetPos( const Point& rNewPos );
82 const Point& GetPos() const { return maPos; }
84 void SetSize( const Size& rNewSize );
85 const Size& GetSize() const { return maSize; }
86 void SetWidth( tools::Long nNewWidth );
87 tools::Long GetWidth() const { return maSize.Width(); }
88 tools::Long GetHeight() const { return maSize.Height(); }
90 void SetOrientation( Degree10 nOrientation = 0_deg10 );
92 void SetDirection( CursorDirection nDirection = CursorDirection::NONE );
94 SAL_DLLPRIVATE Cursor& operator=( const Cursor& rCursor );
95 SAL_DLLPRIVATE bool operator==( const Cursor& rCursor ) const;
96 bool operator!=( const Cursor& rCursor ) const
97 { return !(Cursor::operator==( rCursor )); }
99 void DrawToDevice(OutputDevice& rRenderContext);
101 private:
102 SAL_DLLPRIVATE void LOKNotify( vcl::Window* pWindow, const OUString& rAction );
103 SAL_DLLPRIVATE bool ImplPrepForDraw(const OutputDevice* pDevice, ImplCursorData& rData);
104 SAL_DLLPRIVATE void ImplRestore();
105 SAL_DLLPRIVATE void ImplDoShow( bool bDrawDirect, bool bRestore );
106 SAL_DLLPRIVATE bool ImplDoHide( bool bStop );
109 } // namespace vcl
111 #endif // INCLUDED_VCL_CURSOR_HXX
113 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */