LibreOffice Module vcl (master) 1
splitwin.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_SPLITWIN_HXX
21#define INCLUDED_VCL_SPLITWIN_HXX
22
23#include <vcl/dllapi.h>
24#include <vcl/dockwin.hxx>
26
27class ImplSplitSet;
28
30{
31 NONE = 0x0000,
32 Fixed = 0x0001,
33 RelativeSize = 0x0002,
34 PercentSize = 0x0004,
35 ColSet = 0x0008,
36};
37namespace o3tl
38{
39 template<> struct typed_flags<SplitWindowItemFlags> : is_typed_flags<SplitWindowItemFlags, 0x0f> {};
40}
41
42#define SPLITWINDOW_APPEND (sal_uInt16(0xFFFF))
43#define SPLITWINDOW_ITEM_NOTFOUND (sal_uInt16(0xFFFF))
44
45#define SPLITWIN_SPLITSIZE 4
46#define SPLITWIN_SPLITSIZEEXLN 7
47
49{
50private:
51 std::unique_ptr<ImplSplitSet> mpMainSet;
54 std::unique_ptr<tools::Long[]> mpLastSizes;
68 sal_uInt16 mnSplitTest;
69 sal_uInt16 mnSplitPos;
70 sal_uInt16 mnMouseModifier;
71 bool mbDragFull:1,
85
86 using Window::ImplInit;
87 SAL_DLLPRIVATE void ImplInit( vcl::Window* pParent, WinBits nStyle );
88 SAL_DLLPRIVATE void ImplInitSettings();
89 SAL_DLLPRIVATE void ImplCalcLayout();
90 SAL_DLLPRIVATE void ImplUpdate();
91 SAL_DLLPRIVATE void ImplSetWindowSize( tools::Long nDelta );
92 SAL_DLLPRIVATE void ImplSplitMousePos( Point& rMousePos );
93 SAL_DLLPRIVATE void ImplGetButtonRect( tools::Rectangle& rRect, bool bTest ) const;
94 SAL_DLLPRIVATE void ImplGetFadeInRect( tools::Rectangle& rRect, bool bTest = false ) const;
95 SAL_DLLPRIVATE void ImplGetFadeOutRect( tools::Rectangle& rRect ) const;
96 SAL_DLLPRIVATE void ImplDrawFadeIn(vcl::RenderContext& rRenderContext);
97 SAL_DLLPRIVATE void ImplDrawFadeOut(vcl::RenderContext& rRenderContext);
98 SAL_DLLPRIVATE void ImplNewAlign();
99 SAL_DLLPRIVATE void ImplDrawGrip(vcl::RenderContext& rRenderContext, const tools::Rectangle& rRect, bool bHorz, bool bLeft);
100 SAL_DLLPRIVATE void ImplStartSplit( const MouseEvent& rMEvt );
101
102 SAL_DLLPRIVATE void ImplDrawBorder(vcl::RenderContext& rRenderContext);
103 SAL_DLLPRIVATE void ImplDrawBorderLine(vcl::RenderContext& rRenderContext);
104 static SAL_DLLPRIVATE void ImplCalcSet2( SplitWindow* pWindow, ImplSplitSet* pSet, bool bHide,
105 bool bRows );
106 static SAL_DLLPRIVATE sal_uInt16 ImplTestSplit( ImplSplitSet* pSet, const Point& rPos,
107 tools::Long& rMouseOff, ImplSplitSet** ppFoundSet, sal_uInt16& rFoundPos,
108 bool bRows );
109 static SAL_DLLPRIVATE sal_uInt16 ImplTestSplit( const SplitWindow* pWindow, const Point& rPos,
110 tools::Long& rMouseOff, ImplSplitSet** ppFoundSet, sal_uInt16& rFoundPos );
111 SAL_DLLPRIVATE void ImplDrawSplitTracking(const Point& rPos);
112
113 SplitWindow (const SplitWindow &) = delete;
114 SplitWindow & operator= (const SplitWindow &) = delete;
115public:
116 SplitWindow( vcl::Window* pParent, WinBits nStyle = 0 );
117 virtual ~SplitWindow() override;
118 virtual void dispose() override;
119
120 virtual void StartSplit();
121 virtual void Split();
122 virtual void SplitResize();
123 virtual void FadeIn();
124 virtual void FadeOut();
125
126 virtual void MouseButtonDown( const MouseEvent& rMEvt ) override;
127 virtual void MouseMove( const MouseEvent& rMEvt ) override;
128 virtual void Tracking( const TrackingEvent& rTEvt ) override;
129 virtual void Paint( vcl::RenderContext& rRenderContext, const tools::Rectangle& rRect ) override;
130 virtual void Resize() override;
131 virtual void RequestHelp( const HelpEvent& rHEvt ) override;
132 virtual void StateChanged( StateChangedType nType ) override;
133 virtual void DataChanged( const DataChangedEvent& rDCEvt ) override;
134 virtual bool PreNotify( NotifyEvent& rNEvt ) override;
135
136 void InsertItem( sal_uInt16 nId, vcl::Window* pWindow, tools::Long nSize,
137 sal_uInt16 nPos, sal_uInt16 nIntoSetId,
138 SplitWindowItemFlags nBits );
139 void InsertItem( sal_uInt16 nId, tools::Long nSize,
140 sal_uInt16 nPos, sal_uInt16 nIntoSetId,
141 SplitWindowItemFlags nBits );
142 void RemoveItem( sal_uInt16 nId );
143
144 void SplitItem( sal_uInt16 nId, tools::Long nNewSize,
145 bool bPropSmall,
146 bool bPropGreat );
147 void SetItemSize( sal_uInt16 nId, tools::Long nNewSize );
148 tools::Long GetItemSize( sal_uInt16 nId ) const;
157 void SetItemSizeRange (sal_uInt16 nId, const Range& rRange);
160 tools::Long GetItemSize( sal_uInt16 nId, SplitWindowItemFlags nBits ) const;
161 sal_uInt16 GetSet( sal_uInt16 nId ) const;
162 sal_uInt16 GetItemId( vcl::Window* pWindow ) const;
163 sal_uInt16 GetItemId( const Point& rPos ) const;
164 sal_uInt16 GetItemPos( sal_uInt16 nId, sal_uInt16 nSetId = 0 ) const;
165 sal_uInt16 GetItemId( sal_uInt16 nPos ) const;
166 sal_uInt16 GetItemCount( sal_uInt16 nSetId = 0 ) const;
167 bool IsItemValid( sal_uInt16 nId ) const;
168
169 void SetAlign( WindowAlign eNewAlign );
170 WindowAlign GetAlign() const { return meAlign; }
171 bool IsHorizontal() const { return mbHorz; }
172
173 void SetMaxSizePixel( tools::Long nNewMaxSize ) { mnMaxSize = nNewMaxSize; }
174
175 Size CalcLayoutSizePixel( const Size& aNewSize );
176
177 void ShowFadeInHideButton();
178 void ShowFadeOutButton();
179 tools::Long GetFadeInSize() const;
180 bool IsFadeNoButtonMode() const { return mbFadeNoButtonMode; }
181
182 void SetSplitHdl( const Link<SplitWindow*,void>& rLink ) { maSplitHdl = rLink; }
183};
184
185#endif // INCLUDED_VCL_SPLITWIN_HXX
186
187/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
virtual void DataChanged(const DataChangedEvent &rDCEvt) override
Definition: dockwin.cxx:686
virtual void StateChanged(StateChangedType nType) override
Definition: dockwin.cxx:662
SAL_DLLPRIVATE void ImplInit(vcl::Window *pParent, WinBits nStyle)
Definition: dockwin.cxx:313
DockingWindow & operator=(const DockingWindow &)=delete
virtual void Tracking(const TrackingEvent &rTEvt) override
Definition: dockwin.cxx:410
SAL_DLLPRIVATE void ImplInitSettings()
Definition: dockwin.cxx:328
virtual void dispose() override
This is intended to be used to clear any locally held references to other Window-subclass objects.
Definition: dockwin.cxx:395
Some things multiple-inherit from VclAbstractDialog and OutputDevice, so we need to use virtual inher...
Definition: outdev.hxx:170
bool mbHorz
Definition: splitwin.hxx:72
WinBits mnWinStyle
Definition: splitwin.hxx:66
WindowAlign GetAlign() const
Definition: splitwin.hxx:170
bool mbFadeOutPressed
Definition: splitwin.hxx:82
bool mbFadeIn
Definition: splitwin.hxx:77
bool mbFadeOutDown
Definition: splitwin.hxx:80
tools::Long mnMSplitPos
Definition: splitwin.hxx:65
bool mbFadeNoButtonMode
Definition: splitwin.hxx:83
ImplSplitSet * mpBaseSet
Definition: splitwin.hxx:52
tools::Long mnLeftBorder
Definition: splitwin.hxx:58
bool mbBottomRight
Definition: splitwin.hxx:73
bool mbFadeOut
Definition: splitwin.hxx:78
tools::Long mnBottomBorder
Definition: splitwin.hxx:61
tools::Rectangle maDragRect
Definition: splitwin.hxx:55
tools::Long mnMouseOff
Definition: splitwin.hxx:63
tools::Long mnDY
Definition: splitwin.hxx:57
bool mbInvalidate
Definition: splitwin.hxx:76
void SetSplitHdl(const Link< SplitWindow *, void > &rLink)
Definition: splitwin.hxx:182
WindowAlign meAlign
Definition: splitwin.hxx:67
tools::Long mnMStartPos
Definition: splitwin.hxx:64
ImplSplitSet * mpSplitSet
Definition: splitwin.hxx:53
tools::Long mnMaxSize
Definition: splitwin.hxx:62
bool IsHorizontal() const
Definition: splitwin.hxx:171
tools::Long mnRightBorder
Definition: splitwin.hxx:60
std::unique_ptr< ImplSplitSet > mpMainSet
Definition: splitwin.hxx:51
tools::Long mnDX
Definition: splitwin.hxx:56
sal_uInt16 mnMouseModifier
Definition: splitwin.hxx:70
bool mbFadeInDown
Definition: splitwin.hxx:79
sal_uInt16 mnSplitTest
Definition: splitwin.hxx:68
bool mbFadeInPressed
Definition: splitwin.hxx:81
bool mbDragFull
Definition: splitwin.hxx:71
bool IsFadeNoButtonMode() const
Definition: splitwin.hxx:180
tools::Long mnTopBorder
Definition: splitwin.hxx:59
Link< SplitWindow *, void > maSplitHdl
Definition: splitwin.hxx:84
bool mbCalc
Definition: splitwin.hxx:74
sal_uInt16 mnSplitPos
Definition: splitwin.hxx:69
std::unique_ptr< tools::Long[]> mpLastSizes
Definition: splitwin.hxx:54
SplitWindow(const SplitWindow &)=delete
bool mbRecalc
Definition: splitwin.hxx:75
void SetMaxSizePixel(tools::Long nNewMaxSize)
Definition: splitwin.hxx:173
virtual void RequestHelp(const HelpEvent &rHEvt)
Definition: window.cxx:1869
virtual void Resize()
Definition: window.cxx:1835
virtual void MouseButtonDown(const MouseEvent &rMEvt)
Definition: mouse.cxx:420
virtual void Paint(vcl::RenderContext &rRenderContext, const tools::Rectangle &rRect)
Definition: paint.cxx:1020
virtual bool PreNotify(NotifyEvent &rNEvt)
Definition: event.cxx:52
virtual void MouseMove(const MouseEvent &rMEvt)
Definition: mouse.cxx:414
#define VCL_DLLPUBLIC
Definition: dllapi.h:29
NONE
long Long
SplitWindowItemFlags
Definition: splitwin.hxx:30
StateChangedType
Definition: window.hxx:291
sal_Int64 WinBits
Definition: wintypes.hxx:109
WindowAlign
Definition: wintypes.hxx:232