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 : sal_Bool bScrolling:1, // user controlled scrolling
56 : bHandleDragging:1, // scroll window while dragging
57 : bHCenter:1,
58 : bVCenter:1;
59 :
60 : #ifdef _SVT_SCRWIN_CXX
61 : SVT_DLLPRIVATE void ImpInitialize( ScrollableWindowFlags nFlags );
62 : DECL_DLLPRIVATE_LINK( ScrollHdl, ScrollBar * );
63 : DECL_DLLPRIVATE_LINK( EndScrollHdl, ScrollBar * );
64 : #endif
65 :
66 : public:
67 : ScrollableWindow( Window* pParent, WinBits nBits = 0,
68 : ScrollableWindowFlags = SCRWIN_DEFAULT );
69 :
70 : virtual void Resize();
71 : virtual void Command( const CommandEvent& rCEvt );
72 : virtual void DataChanged( const DataChangedEvent& rDEvt );
73 :
74 : virtual void StartScroll();
75 : virtual void EndScroll( long nDeltaX, long nDeltaY );
76 :
77 : using OutputDevice::SetMapMode;
78 : virtual void SetMapMode( const MapMode& rNewMapMode );
79 : virtual MapMode GetMapMode() const;
80 :
81 : void SetTotalSize( const Size& rNewSize );
82 13 : Size GetTotalSize() { return PixelToLogic( aTotPixSz ); }
83 :
84 : using Window::Scroll;
85 : virtual void Scroll( long nDeltaX, long nDeltaY, sal_uInt16 nFlags = 0 );
86 :
87 : private:
88 : SVT_DLLPRIVATE Size GetOutputSizePixel() const;
89 : };
90 :
91 : #endif
92 :
93 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|