update credits
[LibreOffice.git] / include / vcl / split.hxx
bloba279fd24181fed0f84a1e2ba3a1b1c54e1abfed0
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 _SV_SPLIT_HXX
21 #define _SV_SPLIT_HXX
23 #include <tools/solar.h>
24 #include <vcl/dllapi.h>
25 #include <vcl/window.hxx>
27 #define SPLITTER_DEFAULTSTEPSIZE 0xFFFF
29 // ------------
30 // - Splitter -
31 // ------------
33 class VCL_DLLPUBLIC Splitter : public Window
35 private:
36 Window* mpRefWin;
37 long mnSplitPos;
38 long mnLastSplitPos;
39 long mnStartSplitPos;
40 Point maDragPos;
41 Rectangle maDragRect;
42 sal_Bool mbHorzSplit;
43 sal_Bool mbDragFull;
44 sal_Bool mbKbdSplitting;
45 long mbInKeyEvent;
46 long mnKeyboardStepSize;
47 Link maStartSplitHdl;
48 Link maSplitHdl;
49 Link maEndSplitHdl;
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 &);
65 protected:
66 using Window::ImplInit;
67 SAL_DLLPRIVATE void ImplInit( Window* pParent, WinBits nWinStyle );
69 public:
70 explicit Splitter( Window* pParent, WinBits nStyle = WB_VSCROLL );
71 explicit Splitter( Window* pParent, const ResId& );
72 virtual ~Splitter();
74 virtual void StartSplit();
75 virtual void EndSplit();
76 virtual void Split();
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 );
91 void StartDrag();
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: */