Branch libreoffice-5-0-4
[LibreOffice.git] / include / svtools / scrwin.hxx
blob2396725af54c7a260bd2956105864eacaf8c3651
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
20 #ifndef INCLUDED_SVTOOLS_SCRWIN_HXX
21 #define INCLUDED_SVTOOLS_SCRWIN_HXX
23 #include <svtools/svtdllapi.h>
24 #include <vcl/scrbar.hxx>
25 #include <o3tl/typed_flags_set.hxx>
26 #include <vcl/vclptr.hxx>
28 class DataChangedEvent;
31 // - ScrollableWindow-Type -
34 enum class ScrollableWindowFlags
36 THUMBDRAGGING = 1,
37 VCENTER = 2,
38 HCENTER = 4,
39 DEFAULT = THUMBDRAGGING | VCENTER | HCENTER,
41 namespace o3tl
43 template<> struct typed_flags<ScrollableWindowFlags> : is_typed_flags<ScrollableWindowFlags, 0x07> {};
47 // - ScrollableWindow -
50 class SVT_DLLPUBLIC ScrollableWindow: public vcl::Window
52 private:
53 Point aPixOffset; // offset to virtual window (pixel)
54 Size aTotPixSz; // total size of virtual window (pixel)
55 long nLinePixH; // size of a line/column (pixel)
56 long nColumnPixW;
58 VclPtr<ScrollBar> aVScroll; // the scrollbars
59 VclPtr<ScrollBar> aHScroll;
60 VclPtr<ScrollBarBox> aCornerWin; // window in the bottom right corner
61 bool bScrolling:1, // user controlled scrolling
62 bHandleDragging:1, // scroll window while dragging
63 bHCenter:1,
64 bVCenter:1;
66 SVT_DLLPRIVATE void ImpInitialize( ScrollableWindowFlags nFlags );
67 DECL_DLLPRIVATE_LINK( ScrollHdl, ScrollBar * );
68 DECL_DLLPRIVATE_LINK( EndScrollHdl, ScrollBar * );
70 public:
71 ScrollableWindow( vcl::Window* pParent, WinBits nBits = 0,
72 ScrollableWindowFlags = ScrollableWindowFlags::DEFAULT );
73 virtual ~ScrollableWindow();
74 virtual void dispose() SAL_OVERRIDE;
76 virtual void Resize() SAL_OVERRIDE;
77 virtual void Command( const CommandEvent& rCEvt ) SAL_OVERRIDE;
78 virtual void DataChanged( const DataChangedEvent& rDEvt ) SAL_OVERRIDE;
80 using OutputDevice::SetMapMode;
81 virtual void SetMapMode( const MapMode& rNewMapMode ) SAL_OVERRIDE;
82 MapMode GetMapMode() const;
84 void SetTotalSize( const Size& rNewSize );
85 Size GetTotalSize() { return PixelToLogic( aTotPixSz ); }
87 using Window::Scroll;
88 virtual void Scroll( long nDeltaX, long nDeltaY, sal_uInt16 nFlags = 0 ) SAL_OVERRIDE;
90 private:
91 SVT_DLLPRIVATE Size GetOutputSizePixel() const;
94 #endif
96 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */