LibreOffice Module vcl (master)  1
cursor.hxx
Go to the documentation of this file.
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 #include <rtl/ustring.hxx>
28 #include <memory>
29 
30 class Timer;
31 struct ImplCursorData;
32 class OutputDevice;
33 namespace vcl { class Window; }
34 
35 // Cursor styles
36 #define CURSOR_SHADOW (sal_uInt16(0x0001))
37 
38 enum class CursorDirection
39 {
40  NONE, LTR, RTL
41 };
42 
43 namespace vcl
44 {
45 
47 {
48 private:
49  std::unique_ptr<ImplCursorData> mpData;
50  VclPtr<vcl::Window> mpWindow; // only for shadow cursor
54  sal_uInt16 mnStyle;
55  bool mbVisible;
57 
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();
66 
67 public:
68  Cursor();
69  Cursor( const Cursor& rCursor );
70  ~Cursor();
71 
72  void SetStyle( sal_uInt16 nStyle );
73  sal_uInt16 GetStyle() const { return mnStyle; }
74 
75  void Show();
76  void Hide();
77  bool IsVisible() const { return mbVisible; }
78 
79  void SetWindow( vcl::Window* pWindow );
80 
81  void SetPos( const Point& rNewPos );
82  const Point& GetPos() const { return maPos; }
83 
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(); }
89 
90  void SetOrientation( short nOrientation = 0 );
91 
92  void SetDirection( CursorDirection nDirection = CursorDirection::NONE );
93 
94  Cursor& operator=( const Cursor& rCursor );
95  bool operator==( const Cursor& rCursor ) const;
96  bool operator!=( const Cursor& rCursor ) const
97  { return !(Cursor::operator==( rCursor )); }
98 
99  void DrawToDevice(OutputDevice& rRenderContext);
100 
101 private:
102  void LOKNotify( vcl::Window* pWindow, const OUString& rAction );
103  bool ImplPrepForDraw(const OutputDevice* pDevice, ImplCursorData& rData);
104  void ImplRestore();
105  void ImplDoShow( bool bDrawDirect, bool bRestore );
106  bool ImplDoHide( bool bStop );
107 };
108 
109 } // namespace vcl
110 
111 #endif // INCLUDED_VCL_CURSOR_HXX
112 
113 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
long Width() const
std::unique_ptr< ImplCursorData > mpData
Definition: cursor.hxx:49
sal_uInt16 mnStyle
Definition: cursor.hxx:54
long Height() const
#define VCL_DLLPUBLIC
Definition: dllapi.h:29
sal_uInt16 GetStyle() const
Definition: cursor.hxx:73
Point maPos
Definition: cursor.hxx:52
bool operator!=(const Cursor &rCursor) const
Definition: cursor.hxx:96
CursorDirection mnDirection
Definition: cursor.hxx:56
const Size & GetSize() const
Definition: cursor.hxx:85
short mnOrientation
Definition: cursor.hxx:53
const Point & GetPos() const
Definition: cursor.hxx:82
bool operator==(const ItalicMatrix &a, const ItalicMatrix &b)
Definition: vclenum.hxx:203
long GetWidth() const
Definition: cursor.hxx:87
bool operator==(const Cursor &rCursor) const
Definition: cursor.cxx:446
Size maSize
Definition: cursor.hxx:51
CursorDirection
Definition: cursor.hxx:38
Some things multiple-inherit from VclAbstractDialog and OutputDevice, so we need to use virtual inher...
Definition: outdev.hxx:304
bool mbVisible
Definition: cursor.hxx:55
VclPtr< vcl::Window > mpWindow
Definition: cursor.hxx:50
bool IsVisible() const
Definition: cursor.hxx:77
Definition: timer.hxx:26
long GetHeight() const
Definition: cursor.hxx:88