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