Version 5.4.3.2, tag libreoffice-5.4.3.2
[LibreOffice.git] / include / vcl / cursor.hxx
blob59cac2799a9f4ca090e0dcb4aff77ce129bbf8b3
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>
28 class Timer;
29 struct ImplCursorData;
30 namespace vcl { class Window; }
32 // Cursor styles
33 #define CURSOR_SHADOW ((sal_uInt16)0x0001)
35 enum class CursorDirection
37 NONE, LTR, RTL
40 namespace vcl
43 class VCL_DLLPUBLIC Cursor
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;
56 public:
57 SAL_DLLPRIVATE void ImplDraw();
58 DECL_DLLPRIVATE_LINK( ImplTimerHdl, Timer*, void );
59 SAL_DLLPRIVATE void ImplShow();
60 SAL_DLLPRIVATE void ImplHide();
61 SAL_DLLPRIVATE void ImplResume( bool bRestore = false );
62 SAL_DLLPRIVATE bool ImplSuspend();
63 SAL_DLLPRIVATE void ImplNew();
65 public:
66 Cursor();
67 Cursor( const Cursor& rCursor );
68 ~Cursor();
70 void SetStyle( sal_uInt16 nStyle );
71 sal_uInt16 GetStyle() const { return mnStyle; }
73 void Show();
74 void Hide();
75 bool IsVisible() const { return mbVisible; }
77 void SetWindow( vcl::Window* pWindow );
79 void SetPos( const Point& rNewPos );
80 const Point& GetPos() const { return maPos; }
82 void SetSize( const Size& rNewSize );
83 const Size& GetSize() const { return maSize; }
84 void SetWidth( long nNewWidth );
85 long GetWidth() const { return maSize.Width(); }
86 long GetHeight() const { return maSize.Height(); }
88 void SetOrientation( short nOrientation = 0 );
90 void SetDirection( CursorDirection nDirection = CursorDirection::NONE );
92 Cursor& operator=( const Cursor& rCursor );
93 bool operator==( const Cursor& rCursor ) const;
94 bool operator!=( const Cursor& rCursor ) const
95 { return !(Cursor::operator==( rCursor )); }
97 private:
98 void ImplRestore();
99 void ImplDoShow( bool bDrawDirect, bool bRestore );
100 bool ImplDoHide( bool bStop );
103 } // namespace vcl
105 #endif // INCLUDED_VCL_CURSOR_HXX
107 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */