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 _SCRWIN_HXX
21 : #define _SCRWIN_HXX
22 :
23 : #include <svtools/svtdllapi.h>
24 :
25 : #include <vcl/scrbar.hxx>
26 :
27 : class DataChangedEvent;
28 :
29 :
30 : // - ScrollableWindow-Type -
31 :
32 :
33 : typedef sal_uInt16 ScrollableWindowFlags;
34 :
35 : #define SCRWIN_THUMBDRAGGING 1
36 : #define SCRWIN_VCENTER 2
37 : #define SCRWIN_HCENTER 4
38 : #define SCRWIN_DEFAULT (SCRWIN_THUMBDRAGGING | SCRWIN_VCENTER | SCRWIN_HCENTER)
39 :
40 :
41 : // - ScrollableWindow -
42 :
43 :
44 0 : class SVT_DLLPUBLIC ScrollableWindow: public Window
45 : {
46 : private:
47 : Point aPixOffset; // offset to virtual window (pixel)
48 : Size aTotPixSz; // total size of virtual window (pixel)
49 : long nLinePixH; // size of a line/column (pixel)
50 : long nColumnPixW;
51 :
52 : ScrollBar aVScroll; // the scrollbars
53 : ScrollBar aHScroll;
54 : ScrollBarBox aCornerWin; // window in the bottom right corner
55 : bool bScrolling:1, // user controlled scrolling
56 : bHandleDragging:1, // scroll window while dragging
57 : bHCenter:1,
58 : bVCenter:1;
59 :
60 : SVT_DLLPRIVATE void ImpInitialize( ScrollableWindowFlags nFlags );
61 : DECL_DLLPRIVATE_LINK( ScrollHdl, ScrollBar * );
62 : DECL_DLLPRIVATE_LINK( EndScrollHdl, ScrollBar * );
63 :
64 : public:
65 : ScrollableWindow( Window* pParent, WinBits nBits = 0,
66 : ScrollableWindowFlags = SCRWIN_DEFAULT );
67 :
68 : virtual void Resize() SAL_OVERRIDE;
69 : virtual void Command( const CommandEvent& rCEvt ) SAL_OVERRIDE;
70 : virtual void DataChanged( const DataChangedEvent& rDEvt ) SAL_OVERRIDE;
71 :
72 : virtual void StartScroll();
73 : virtual void EndScroll( long nDeltaX, long nDeltaY );
74 :
75 : using OutputDevice::SetMapMode;
76 : virtual void SetMapMode( const MapMode& rNewMapMode ) SAL_OVERRIDE;
77 : virtual MapMode GetMapMode() const;
78 :
79 : void SetTotalSize( const Size& rNewSize );
80 0 : Size GetTotalSize() { return PixelToLogic( aTotPixSz ); }
81 :
82 : using Window::Scroll;
83 : virtual void Scroll( long nDeltaX, long nDeltaY, sal_uInt16 nFlags = 0 ) SAL_OVERRIDE;
84 :
85 : private:
86 : SVT_DLLPRIVATE Size GetOutputSizePixel() const;
87 : };
88 :
89 : #endif
90 :
91 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|