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 :
27 : struct ImplCursorData;
28 : namespace vcl { class Window; }
29 :
30 : // Cursor styles
31 : #define CURSOR_SHADOW ((sal_uInt16)0x0001)
32 : #define CURSOR_DIRECTION_NONE ((unsigned char)0x00)
33 : #define CURSOR_DIRECTION_LTR ((unsigned char)0x01)
34 : #define CURSOR_DIRECTION_RTL ((unsigned char)0x02)
35 :
36 : namespace vcl
37 : {
38 :
39 : class VCL_DLLPUBLIC Cursor
40 : {
41 : private:
42 : ImplCursorData* mpData;
43 : vcl::Window* mpWindow; // only for shadow cursor
44 : long mnSlant;
45 : Size maSize;
46 : Point maPos;
47 : short mnOrientation;
48 : sal_uInt16 mnStyle;
49 : bool mbVisible;
50 : unsigned char mnDirection;
51 :
52 : public:
53 : SAL_DLLPRIVATE void ImplDraw();
54 : SAL_DLLPRIVATE void ImplRestore();
55 : DECL_DLLPRIVATE_LINK( ImplTimerHdl, void* );
56 : SAL_DLLPRIVATE void ImplShow( bool bDrawDirect = true );
57 : SAL_DLLPRIVATE void ImplHide( bool bStopTimer );
58 : SAL_DLLPRIVATE void ImplResume( bool bRestore = false );
59 : SAL_DLLPRIVATE bool ImplSuspend();
60 : SAL_DLLPRIVATE void ImplNew();
61 :
62 : public:
63 : Cursor();
64 : Cursor( const Cursor& rCursor );
65 : ~Cursor();
66 :
67 : void SetStyle( sal_uInt16 nStyle );
68 87031 : sal_uInt16 GetStyle() const { return mnStyle; }
69 :
70 : void Show();
71 : void Hide();
72 118076 : bool IsVisible() const { return mbVisible; }
73 :
74 : void SetWindow( vcl::Window* pWindow );
75 : vcl::Window* GetWindow() const { return mpWindow; }
76 :
77 : void SetPos( const Point& rNewPos );
78 44 : const Point& GetPos() const { return maPos; }
79 :
80 : void SetSize( const Size& rNewSize );
81 0 : const Size& GetSize() const { return maSize; }
82 : void SetWidth( long nNewWidth );
83 0 : long GetWidth() const { return maSize.Width(); }
84 0 : long GetHeight() const { return maSize.Height(); }
85 :
86 : long GetSlant() const { return mnSlant; }
87 :
88 : void SetOrientation( short nOrientation = 0 );
89 : short GetOrientation() const { return mnOrientation; }
90 :
91 : void SetDirection( unsigned char nDirection = 0 );
92 : unsigned char GetDirection() const { return mnDirection; }
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 : private:
100 : void ImplDoShow( bool bDrawDirect, bool bRestore );
101 : bool ImplDoHide( bool bStop );
102 : };
103 :
104 : } // namespace vcl
105 :
106 : #endif // INCLUDED_VCL_CURSOR_HXX
107 :
108 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|