Branch libreoffice-5-0-4
[LibreOffice.git] / include / vcl / cursor.hxx
blob3a1127e7893b3d73648c0fea87b77b881208dd5b
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 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();
66 public:
67 Cursor();
68 Cursor( const Cursor& rCursor );
69 ~Cursor();
71 void SetStyle( sal_uInt16 nStyle );
72 sal_uInt16 GetStyle() const { return mnStyle; }
74 void Show();
75 void Hide();
76 bool IsVisible() const { return mbVisible; }
78 void SetWindow( vcl::Window* pWindow );
79 vcl::Window* GetWindow() const { return mpWindow; }
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( long nNewWidth );
87 long GetWidth() const { return maSize.Width(); }
88 long GetHeight() const { return maSize.Height(); }
90 long GetSlant() const { return mnSlant; }
92 void SetOrientation( short nOrientation = 0 );
93 short GetOrientation() const { return mnOrientation; }
95 void SetDirection( CursorDirection nDirection = CursorDirection::NONE );
96 CursorDirection GetDirection() const { return mnDirection; }
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 )); }
103 private:
104 void ImplDoShow( bool bDrawDirect, bool bRestore );
105 bool ImplDoHide( bool bStop );
108 } // namespace vcl
110 #endif // INCLUDED_VCL_CURSOR_HXX
112 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */