Version 4.3.0.0.beta1, tag libreoffice-4.3.0.0.beta1
[LibreOffice.git] / include / vcl / split.hxx
blob65cc90ec17e9fa250e4c9c7ed22b68052e8d3071
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_VCL_SPLIT_HXX
21 #define INCLUDED_VCL_SPLIT_HXX
23 #include <vcl/dllapi.h>
24 #include <vcl/window.hxx>
26 #define SPLITTER_DEFAULTSTEPSIZE 0xFFFF
28 class VCL_DLLPUBLIC Splitter : public Window
30 private:
31 Window* mpRefWin;
32 long mnSplitPos;
33 long mnLastSplitPos;
34 long mnStartSplitPos;
35 Point maDragPos;
36 Rectangle maDragRect;
37 bool mbHorzSplit;
38 bool mbDragFull;
39 bool mbKbdSplitting;
40 long mbInKeyEvent;
41 long mnKeyboardStepSize;
42 Link maStartSplitHdl;
43 Link maSplitHdl;
44 Link maEndSplitHdl;
46 SAL_DLLPRIVATE void ImplInitSplitterData();
47 SAL_DLLPRIVATE void ImplDrawSplitter();
48 SAL_DLLPRIVATE void ImplSplitMousePos( Point& rPos );
49 SAL_DLLPRIVATE void ImplStartKbdSplitting();
50 SAL_DLLPRIVATE void ImplKbdTracking( KeyCode aKeyCode );
51 SAL_DLLPRIVATE bool ImplSplitterActive();
52 SAL_DLLPRIVATE Splitter* ImplFindSibling();
53 SAL_DLLPRIVATE void ImplRestoreSplitter();
54 SAL_DLLPRIVATE void ImplInitHorVer(bool bNew);
56 // Copy assignment is forbidden and not implemented.
57 SAL_DLLPRIVATE Splitter (const Splitter &);
58 SAL_DLLPRIVATE Splitter& operator= (const Splitter &);
60 protected:
61 using Window::ImplInit;
62 SAL_DLLPRIVATE void ImplInit( Window* pParent, WinBits nWinStyle );
64 public:
65 explicit Splitter( Window* pParent, WinBits nStyle = WB_VSCROLL );
66 explicit Splitter( Window* pParent, const ResId& );
67 virtual ~Splitter();
69 virtual void StartSplit();
70 virtual void EndSplit();
71 virtual void Split();
72 virtual void Splitting( Point& rSplitPos );
74 virtual void MouseButtonDown( const MouseEvent& rMEvt ) SAL_OVERRIDE;
75 virtual void Tracking( const TrackingEvent& rTEvt ) SAL_OVERRIDE;
77 virtual bool Notify( NotifyEvent& rNEvt ) SAL_OVERRIDE;
79 virtual void GetFocus() SAL_OVERRIDE;
80 virtual void LoseFocus() SAL_OVERRIDE;
81 virtual void KeyInput( const KeyEvent& rKEvt ) SAL_OVERRIDE;
82 virtual void Paint( const Rectangle& rPaintRect ) SAL_OVERRIDE;
84 virtual void DataChanged( const DataChangedEvent& rDCEvt ) SAL_OVERRIDE;
86 void StartDrag();
88 void SetDragRectPixel( const Rectangle& rDragRect,
89 Window* pRefWin = NULL );
90 const Rectangle& GetDragRectPixel() const { return maDragRect; }
91 Window* GetDragWindow() const { return mpRefWin; }
93 virtual void SetSplitPosPixel( long nPos );
94 long GetSplitPosPixel() const { return mnSplitPos; }
96 bool IsHorizontal() const { return mbHorzSplit; }
97 void SetHorizontal(bool bNew);
99 // set the stepsize of the splitter for cursor movement
100 // the default is 10% of the reference window's width/height
101 void SetKeyboardStepSize( long nStepSize );
103 void SetStartSplitHdl( const Link& rLink ) { maStartSplitHdl = rLink; }
104 const Link& GetStartSplitHdl() const { return maStartSplitHdl; }
105 void SetSplitHdl( const Link& rLink ) { maSplitHdl = rLink; }
106 void SetEndSplitHdl( const Link& rLink ) { maEndSplitHdl = rLink; }
107 const Link& GetEndSplitHdl() const { return maEndSplitHdl; }
108 const Link& GetSplitHdl() const { return maSplitHdl; }
111 #endif // INCLUDED_VCL_SPLIT_HXX
113 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */