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 <tools/solar.h>
24 #include <vcl/dllapi.h>
25 #include <vcl/window.hxx>
27 #define SPLITTER_DEFAULTSTEPSIZE 0xFFFF
33 class VCL_DLLPUBLIC Splitter
: public Window
44 sal_Bool mbKbdSplitting
;
46 long mnKeyboardStepSize
;
51 SAL_DLLPRIVATE
void ImplInitSplitterData();
52 SAL_DLLPRIVATE
void ImplDrawSplitter();
53 SAL_DLLPRIVATE
void ImplSplitMousePos( Point
& rPos
);
54 SAL_DLLPRIVATE
void ImplStartKbdSplitting();
55 SAL_DLLPRIVATE
void ImplKbdTracking( KeyCode aKeyCode
);
56 SAL_DLLPRIVATE sal_Bool
ImplSplitterActive();
57 SAL_DLLPRIVATE Splitter
* ImplFindSibling();
58 SAL_DLLPRIVATE
void ImplRestoreSplitter();
59 SAL_DLLPRIVATE
void ImplInitHorVer(bool bNew
);
61 // Copy assignment is forbidden and not implemented.
62 SAL_DLLPRIVATE
Splitter (const Splitter
&);
63 SAL_DLLPRIVATE Splitter
& operator= (const Splitter
&);
66 using Window::ImplInit
;
67 SAL_DLLPRIVATE
void ImplInit( Window
* pParent
, WinBits nWinStyle
);
70 explicit Splitter( Window
* pParent
, WinBits nStyle
= WB_VSCROLL
);
71 explicit Splitter( Window
* pParent
, const ResId
& );
74 virtual void StartSplit();
75 virtual void EndSplit();
77 virtual void Splitting( Point
& rSplitPos
);
79 virtual void MouseButtonDown( const MouseEvent
& rMEvt
);
80 virtual void Tracking( const TrackingEvent
& rTEvt
);
82 virtual long Notify( NotifyEvent
& rNEvt
);
84 virtual void GetFocus();
85 virtual void LoseFocus();
86 virtual void KeyInput( const KeyEvent
& rKEvt
);
87 virtual void Paint( const Rectangle
& rPaintRect
);
89 virtual void DataChanged( const DataChangedEvent
& rDCEvt
);
93 void SetDragRectPixel( const Rectangle
& rDragRect
,
94 Window
* pRefWin
= NULL
);
95 const Rectangle
& GetDragRectPixel() const { return maDragRect
; }
96 Window
* GetDragWindow() const { return mpRefWin
; }
98 virtual void SetSplitPosPixel( long nPos
);
99 long GetSplitPosPixel() const { return mnSplitPos
; }
101 sal_Bool
IsHorizontal() const { return mbHorzSplit
; }
102 void SetHorizontal(bool bNew
);
104 // set the stepsize of the splitter for cursor movement
105 // the default is 10% of the reference window's width/height
106 void SetKeyboardStepSize( long nStepSize
);
108 void SetStartSplitHdl( const Link
& rLink
) { maStartSplitHdl
= rLink
; }
109 const Link
& GetStartSplitHdl() const { return maStartSplitHdl
; }
110 void SetSplitHdl( const Link
& rLink
) { maSplitHdl
= rLink
; }
111 void SetEndSplitHdl( const Link
& rLink
) { maEndSplitHdl
= rLink
; }
112 const Link
& GetEndSplitHdl() const { return maEndSplitHdl
; }
113 const Link
& GetSplitHdl() const { return maSplitHdl
; }
116 #endif // _SV_SPLIT_HXX
118 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */