1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
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 .
23 #include "svtools/svtdllapi.h"
25 #include <vcl/scrbar.hxx>
27 class DataChangedEvent
;
29 // -------------------------
30 // - ScrollableWindow-Type -
31 // -------------------------
33 typedef sal_uInt16 ScrollableWindowFlags
;
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)
40 // --------------------
41 // - ScrollableWindow -
42 // --------------------
44 class SVT_DLLPUBLIC ScrollableWindow
: public Window
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)
52 ScrollBar aVScroll
; // the scrollbars
54 ScrollBarBox aCornerWin
; // window in the bottom right corner
55 sal_Bool bScrolling
:1, // user controlled scrolling
56 bHandleDragging
:1, // scroll window while dragging
60 SVT_DLLPRIVATE
void ImpInitialize( ScrollableWindowFlags nFlags
);
61 DECL_DLLPRIVATE_LINK( ScrollHdl
, ScrollBar
* );
62 DECL_DLLPRIVATE_LINK( EndScrollHdl
, ScrollBar
* );
65 ScrollableWindow( Window
* pParent
, WinBits nBits
= 0,
66 ScrollableWindowFlags
= SCRWIN_DEFAULT
);
68 virtual void Resize();
69 virtual void Command( const CommandEvent
& rCEvt
);
70 virtual void DataChanged( const DataChangedEvent
& rDEvt
);
72 virtual void StartScroll();
73 virtual void EndScroll( long nDeltaX
, long nDeltaY
);
75 using OutputDevice::SetMapMode
;
76 virtual void SetMapMode( const MapMode
& rNewMapMode
);
77 virtual MapMode
GetMapMode() const;
79 void SetTotalSize( const Size
& rNewSize
);
80 Size
GetTotalSize() { return PixelToLogic( aTotPixSz
); }
83 virtual void Scroll( long nDeltaX
, long nDeltaY
, sal_uInt16 nFlags
= 0 );
86 SVT_DLLPRIVATE Size
GetOutputSizePixel() const;
91 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */