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