xref: /AOO41X/main/vcl/inc/vcl/cursor.hxx (revision 0d63794c5b3715d9f8da2f4b7b451b7426ee7897)
1 /**************************************************************
2  *
3  * Licensed to the Apache Software Foundation (ASF) under one
4  * or more contributor license agreements.  See the NOTICE file
5  * distributed with this work for additional information
6  * regarding copyright ownership.  The ASF licenses this file
7  * to you under the Apache License, Version 2.0 (the
8  * "License"); you may not use this file except in compliance
9  * with the License.  You may obtain a copy of the License at
10  *
11  *   http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing,
14  * software distributed under the License is distributed on an
15  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16  * KIND, either express or implied.  See the License for the
17  * specific language governing permissions and limitations
18  * under the License.
19  *
20  *************************************************************/
21 
22 
23 
24 #ifndef _SV_CURSOR_HXX
25 #define _SV_CURSOR_HXX
26 
27 #include <tools/gen.hxx>
28 #include <tools/link.hxx>
29 #include <vcl/sv.h>
30 #include <vcl/dllapi.h>
31 
32 class AutoTimer;
33 struct ImplCursorData;
34 class Window;
35 
36 // -----------------
37 // - Cursor-Styles -
38 // -----------------
39 
40 #define CURSOR_SHADOW                   ((sal_uInt16)0x0001)
41 #define CURSOR_DIRECTION_NONE           ((unsigned char)0x00)
42 #define CURSOR_DIRECTION_LTR            ((unsigned char)0x01)
43 #define CURSOR_DIRECTION_RTL            ((unsigned char)0x02)
44 
45 // ----------
46 // - Cursor -
47 // ----------
48 
49 class VCL_DLLPUBLIC Cursor
50 {
51 private:
52     ImplCursorData* mpData;             // Interne Daten
53     Window*         mpWindow;           // Window (only for shadow cursor)
54     long            mnSlant;            // Schraegstellung
55     long            mnOffsetY;          // Offset fuer Rotation
56     Size            maSize;             // Groesse
57     Point           maPos;              // Position
58     short           mnOrientation;      // Rotation
59     sal_uInt16          mnStyle;            // Style
60     sal_Bool            mbVisible;          // Ist Cursor sichtbar
61     unsigned char   mnDirection;        // indicates direction
62 
63 public:
64     SAL_DLLPRIVATE void         ImplDraw();
65     SAL_DLLPRIVATE void         ImplRestore();
66     DECL_DLLPRIVATE_LINK(       ImplTimerHdl, AutoTimer* );
67     SAL_DLLPRIVATE void         ImplShow( bool bDrawDirect = true, bool bRestore = false );
68     SAL_DLLPRIVATE bool         ImplHide( bool bStopTimer );
69     SAL_DLLPRIVATE void         ImplNew();
70 
71 public:
72                     Cursor();
73                     Cursor( const Cursor& rCursor );
74                     ~Cursor();
75 
76     void            SetStyle( sal_uInt16 nStyle );
GetStyle() const77     sal_uInt16          GetStyle() const { return mnStyle; }
78 
79     void            Show();
80     void            Hide();
IsVisible() const81     sal_Bool            IsVisible() const { return mbVisible; }
82 
83     void            SetWindow( Window* pWindow );
GetWindow() const84     Window*         GetWindow() const { return mpWindow; }
85 
86     void            SetPos( const Point& rNewPos );
GetPos() const87     const Point&    GetPos() const { return maPos; }
88     void            SetOffsetY( long mnOffsetY = 0 );
GetOffsetY() const89     long            GetOffsetY() const { return mnOffsetY; }
90 
91     void            SetSize( const Size& rNewSize );
GetSize() const92     const Size&     GetSize() const { return maSize; }
93     void            SetWidth( long nNewWidth );
GetWidth() const94     long            GetWidth() const { return maSize.Width(); }
95     void            SetHeight( long nNewHeight );
GetHeight() const96     long            GetHeight() const { return maSize.Height(); }
97 
98     void            SetSlant( long nSlant = 0 );
GetSlant() const99     long            GetSlant() const { return mnSlant; }
100 
101     void            SetOrientation( short nOrientation = 0 );
GetOrientation() const102     short           GetOrientation() const { return mnOrientation; }
103 
104     void            SetDirection( unsigned char nDirection = 0 );
GetDirection() const105     unsigned char   GetDirection() const { return mnDirection; }
106 
107     Cursor&         operator=( const Cursor& rCursor );
108     sal_Bool            operator==( const Cursor& rCursor ) const;
operator !=(const Cursor & rCursor) const109     sal_Bool            operator!=( const Cursor& rCursor ) const
110                         { return !(Cursor::operator==( rCursor )); }
111 };
112 
113 #endif  // _SV_CURSOR_HXX
114