LibreOffice Module vcl (master) 1
split.hxx
Go to the documentation of this file.
1/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2/*
3 * This file is part of the LibreOffice project.
4 *
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/.
8 *
9 * This file incorporates work covered by the following license notice:
10 *
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 .
18 */
19
20#ifndef INCLUDED_VCL_SPLIT_HXX
21#define INCLUDED_VCL_SPLIT_HXX
22
23#include <vcl/dllapi.h>
24#include <vcl/keycod.hxx>
25#include <vcl/window.hxx>
26
27#define SPLITTER_DEFAULTSTEPSIZE 0xFFFF
28
30{
31private:
46
47 SAL_DLLPRIVATE void ImplDrawSplitter();
48 SAL_DLLPRIVATE void ImplSplitMousePos( Point& rPos );
49 SAL_DLLPRIVATE void ImplStartKbdSplitting();
50 SAL_DLLPRIVATE void ImplKbdTracking( vcl::KeyCode aKeyCode );
51 SAL_DLLPRIVATE bool ImplSplitterActive();
52 SAL_DLLPRIVATE Splitter* ImplFindSibling();
53 SAL_DLLPRIVATE void ImplRestoreSplitter();
54 SAL_DLLPRIVATE void ImplInitHorVer(bool bNew);
55
56 Splitter (const Splitter &) = delete;
57 Splitter& operator= (const Splitter &) = delete;
58
59protected:
60 using Window::ImplInit;
61 SAL_DLLPRIVATE void ImplInit( vcl::Window* pParent, WinBits nWinStyle );
62
63public:
64 explicit Splitter( vcl::Window* pParent, WinBits nStyle = WB_VSCROLL );
65 virtual ~Splitter() override;
66 virtual void dispose() override;
67
68 void StartSplit();
69 void EndSplit();
70 void Split();
71
72 virtual void MouseButtonDown( const MouseEvent& rMEvt ) override;
73 virtual void Tracking( const TrackingEvent& rTEvt ) override;
74
75 virtual void GetFocus() override;
76 virtual void LoseFocus() override;
77 virtual void KeyInput( const KeyEvent& rKEvt ) override;
78 virtual void Paint( vcl::RenderContext& rRenderContext, const tools::Rectangle& rPaintRect ) override;
79 virtual Size GetOptimalSize() const override;
80
81 virtual void DataChanged( const DataChangedEvent& rDCEvt ) override;
82
83 void StartDrag();
84
85 void SetDragRectPixel( const tools::Rectangle& rDragRect,
86 vcl::Window* pRefWin = nullptr );
87
88 void SetSplitPosPixel( tools::Long nPos );
89 tools::Long GetSplitPosPixel() const { return mnSplitPos; }
90
91 bool IsHorizontal() const { return mbHorzSplit; }
92 void SetHorizontal(bool bNew);
93
94 // set the stepsize of the splitter for cursor movement
95 // the default is 10% of the reference window's width/height
96 void SetKeyboardStepSize( tools::Long nStepSize );
97
98 void SetStartSplitHdl( const Link<Splitter*,void>& rLink ) { maStartSplitHdl = rLink; }
99 void SetSplitHdl( const Link<Splitter*,void>& rLink ) { maSplitHdl = rLink; }
100 void SetEndSplitHdl( const Link<Splitter*,void>& rLink ) { maEndSplitHdl = rLink; }
101};
102
103#endif // INCLUDED_VCL_SPLIT_HXX
104
105/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
Some things multiple-inherit from VclAbstractDialog and OutputDevice, so we need to use virtual inher...
Definition: outdev.hxx:171
bool mbKbdSplitting
Definition: split.hxx:40
tools::Long mnStartSplitPos
Definition: split.hxx:35
bool IsHorizontal() const
Definition: split.hxx:91
VclPtr< vcl::Window > mpRefWin
Definition: split.hxx:32
Splitter(const Splitter &)=delete
void SetSplitHdl(const Link< Splitter *, void > &rLink)
Definition: split.hxx:99
tools::Rectangle maDragRect
Definition: split.hxx:37
tools::Long mnSplitPos
Definition: split.hxx:33
tools::Long mnKeyboardStepSize
Definition: split.hxx:42
Point maDragPos
Definition: split.hxx:36
void SetEndSplitHdl(const Link< Splitter *, void > &rLink)
Definition: split.hxx:100
tools::Long GetSplitPosPixel() const
Definition: split.hxx:89
Link< Splitter *, void > maSplitHdl
Definition: split.hxx:44
bool mbHorzSplit
Definition: split.hxx:38
bool mbDragFull
Definition: split.hxx:39
Link< Splitter *, void > maEndSplitHdl
Definition: split.hxx:45
bool mbInKeyEvent
Definition: split.hxx:41
void SetStartSplitHdl(const Link< Splitter *, void > &rLink)
Definition: split.hxx:98
tools::Long mnLastSplitPos
Definition: split.hxx:34
Link< Splitter *, void > maStartSplitHdl
Definition: split.hxx:43
VclReferenceBase & operator=(const VclReferenceBase &)=delete
virtual void dispose() override
This is intended to be used to clear any locally held references to other Window-subclass objects.
Definition: window.cxx:140
virtual void GetFocus()
Definition: window.cxx:1845
virtual void Tracking(const TrackingEvent &rTEvt)
Definition: window.cxx:1936
virtual void MouseButtonDown(const MouseEvent &rMEvt)
Definition: mouse.cxx:420
virtual void KeyInput(const KeyEvent &rKEvt)
Definition: window.cxx:1809
virtual void Paint(vcl::RenderContext &rRenderContext, const tools::Rectangle &rRect)
Definition: paint.cxx:1020
virtual Size GetOptimalSize() const
Definition: window3.cxx:26
virtual void DataChanged(const DataChangedEvent &rDCEvt)
Definition: event.cxx:36
virtual void LoseFocus()
Definition: window.cxx:1859
SAL_DLLPRIVATE void ImplInit(vcl::Window *pParent, WinBits nStyle, SystemParentData *pSystemParentData)
Definition: window.cxx:942
#define VCL_DLLPUBLIC
Definition: dllapi.h:29
long Long
sal_Int64 WinBits
Definition: wintypes.hxx:109
WinBits const WB_VSCROLL
Definition: wintypes.hxx:178