1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
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_SPLITWIN_HXX
21 #define _SV_SPLITWIN_HXX
23 #include <tools/solar.h>
24 #include <vcl/dllapi.h>
25 #include <vcl/dockwin.hxx>
30 // -----------------------
31 // - SplitWindowItemBits -
32 // -----------------------
34 typedef sal_uInt16 SplitWindowItemBits
;
36 // -------------------------------
37 // - Bits fuer SplitWindow-Items -
38 // -------------------------------
40 #define SWIB_FIXED ((SplitWindowItemBits)0x0001)
41 #define SWIB_RELATIVESIZE ((SplitWindowItemBits)0x0002)
42 #define SWIB_PERCENTSIZE ((SplitWindowItemBits)0x0004)
43 #define SWIB_COLSET ((SplitWindowItemBits)0x0008)
44 #define SWIB_INVISIBLE ((SplitWindowItemBits)0x0010)
46 // ---------------------
47 // - SplitWindow-Types -
48 // ---------------------
50 #define SPLITWINDOW_APPEND ((sal_uInt16)0xFFFF)
51 #define SPLITWINDOW_ITEM_NOTFOUND ((sal_uInt16)0xFFFF)
57 class VCL_DLLPUBLIC SplitWindow
: public DockingWindow
60 ImplSplitSet
* mpMainSet
;
61 ImplSplitSet
* mpBaseSet
;
62 ImplSplitSet
* mpSplitSet
;
77 sal_uInt16 mnSplitTest
;
78 sal_uInt16 mnSplitPos
;
79 sal_uInt16 mnMouseModifier
;
80 sal_Bool mbDragFull
:1,
100 Link maStartSplitHdl
;
102 Link maSplitResizeHdl
;
107 using Window::ImplInit
;
108 SAL_DLLPRIVATE
void ImplInit( Window
* pParent
, WinBits nStyle
);
109 SAL_DLLPRIVATE
void ImplInitSettings();
110 SAL_DLLPRIVATE
void ImplCalcLayout();
111 SAL_DLLPRIVATE
void ImplUpdate();
112 SAL_DLLPRIVATE
void ImplSetWindowSize( long nDelta
);
113 SAL_DLLPRIVATE
void ImplSplitMousePos( Point
& rMousePos
);
114 SAL_DLLPRIVATE
void ImplGetButtonRect( Rectangle
& rRect
, long nEx
, sal_Bool bTest
) const;
115 SAL_DLLPRIVATE
void ImplGetAutoHideRect( Rectangle
& rRect
, sal_Bool bTest
= sal_False
) const;
116 SAL_DLLPRIVATE
void ImplGetFadeInRect( Rectangle
& rRect
, sal_Bool bTest
= sal_False
) const;
117 SAL_DLLPRIVATE
void ImplGetFadeOutRect( Rectangle
& rRect
, sal_Bool bTest
= sal_False
) const;
118 SAL_DLLPRIVATE
void ImplDrawButtonRect( const Rectangle
& rRect
, long nSize
);
119 SAL_DLLPRIVATE
void ImplDrawAutoHide( sal_Bool bInPaint
);
120 SAL_DLLPRIVATE
void ImplDrawFadeIn( sal_Bool bInPaint
);
121 SAL_DLLPRIVATE
void ImplDrawFadeOut( sal_Bool bInPaint
);
122 SAL_DLLPRIVATE
void ImplNewAlign();
123 SAL_DLLPRIVATE
void ImplDrawGrip( const Rectangle
& rRect
, sal_Bool bHorz
, sal_Bool bLeft
);
124 SAL_DLLPRIVATE
void ImplDrawFadeArrow( const Point
& rPt
, sal_Bool bHorz
, sal_Bool bLeft
);
125 SAL_DLLPRIVATE
void ImplStartSplit( const MouseEvent
& rMEvt
);
127 static SAL_DLLPRIVATE
void ImplDrawBorder( SplitWindow
* pWin
);
128 static SAL_DLLPRIVATE
void ImplDrawBorderLine( SplitWindow
* pWin
);
129 static SAL_DLLPRIVATE
void ImplCalcSet2( SplitWindow
* pWindow
, ImplSplitSet
* pSet
, sal_Bool bHide
,
130 sal_Bool bRows
, sal_Bool bDown
= sal_True
);
131 static SAL_DLLPRIVATE
void ImplDrawBack( SplitWindow
* pWindow
, ImplSplitSet
* pSet
);
132 static SAL_DLLPRIVATE
void ImplDrawBack( SplitWindow
* pWindow
, const Rectangle
& rRect
,
133 const Wallpaper
* pWall
, const Bitmap
* pBitmap
);
134 static SAL_DLLPRIVATE sal_uInt16
ImplTestSplit( ImplSplitSet
* pSet
, const Point
& rPos
,
135 long& rMouseOff
, ImplSplitSet
** ppFoundSet
, sal_uInt16
& rFoundPos
,
136 sal_Bool bRows
, sal_Bool bDown
= sal_True
);
137 static SAL_DLLPRIVATE sal_uInt16
ImplTestSplit( SplitWindow
* pWindow
, const Point
& rPos
,
138 long& rMouseOff
, ImplSplitSet
** ppFoundSet
, sal_uInt16
& rFoundPos
);
139 static SAL_DLLPRIVATE
void ImplDrawSplitTracking( SplitWindow
* pThis
, const Point
& rPos
);
141 // Copy assignment is forbidden and not implemented.
142 SAL_DLLPRIVATE
SplitWindow (const SplitWindow
&);
143 SAL_DLLPRIVATE SplitWindow
& operator= (const SplitWindow
&);
145 SplitWindow( Window
* pParent
, WinBits nStyle
= 0 );
148 virtual void StartSplit();
149 virtual void Split();
150 virtual void SplitResize();
151 virtual void AutoHide();
152 virtual void FadeIn();
153 virtual void FadeOut();
155 virtual void MouseButtonDown( const MouseEvent
& rMEvt
);
156 virtual void MouseMove( const MouseEvent
& rMEvt
);
157 virtual void Tracking( const TrackingEvent
& rTEvt
);
158 virtual void Paint( const Rectangle
& rRect
);
160 virtual void Resize();
161 virtual void RequestHelp( const HelpEvent
& rHEvt
);
162 virtual void StateChanged( StateChangedType nType
);
163 virtual void DataChanged( const DataChangedEvent
& rDCEvt
);
164 virtual long PreNotify( NotifyEvent
& rNEvt
);
166 void InsertItem( sal_uInt16 nId
, Window
* pWindow
, long nSize
,
167 sal_uInt16 nPos
= SPLITWINDOW_APPEND
, sal_uInt16 nSetId
= 0,
168 SplitWindowItemBits nBits
= 0 );
169 void InsertItem( sal_uInt16 nId
, long nSize
,
170 sal_uInt16 nPos
= SPLITWINDOW_APPEND
, sal_uInt16 nSetId
= 0,
171 SplitWindowItemBits nBits
= 0 );
172 void RemoveItem( sal_uInt16 nId
, sal_Bool bHide
= sal_True
);
175 void SplitItem( sal_uInt16 nId
, long nNewSize
,
176 sal_Bool bPropSmall
= sal_False
,
177 sal_Bool bPropGreat
= sal_False
);
178 void SetItemSize( sal_uInt16 nId
, long nNewSize
);
179 long GetItemSize( sal_uInt16 nId
) const;
180 /** Set a range that limits the (variable part of the) size with an
181 upper and a lower bound (both are valid values themselves.)
183 Id of the item for which the size limits are set.
185 Values of -1 define missing bounds, thus setting a range (-1,-1)
186 (the default) removes the size limitiation.
188 void SetItemSizeRange (sal_uInt16 nId
, const Range aRange
);
189 /** Return the current size limits for the specified item.
191 long GetItemSize( sal_uInt16 nId
, SplitWindowItemBits nBits
) const;
192 sal_uInt16
GetSet( sal_uInt16 nId
) const;
193 sal_uInt16
GetItemId( Window
* pWindow
) const;
194 sal_uInt16
GetItemId( const Point
& rPos
) const;
195 sal_uInt16
GetItemPos( sal_uInt16 nId
, sal_uInt16 nSetId
= 0 ) const;
196 sal_uInt16
GetItemId( sal_uInt16 nPos
, sal_uInt16 nSetId
= 0 ) const;
197 sal_uInt16
GetItemCount( sal_uInt16 nSetId
= 0 ) const;
198 sal_Bool
IsItemValid( sal_uInt16 nId
) const;
200 sal_Bool
IsNoAlign() const { return mbNoAlign
; }
201 void SetAlign( WindowAlign eNewAlign
= WINDOWALIGN_TOP
);
202 WindowAlign
GetAlign() const { return meAlign
; }
203 sal_Bool
IsHorizontal() const { return mbHorz
; }
205 sal_Bool
IsSplitting() const { return IsTracking(); }
207 void SetMaxSizePixel( long nNewMaxSize
) { mnMaxSize
= nNewMaxSize
; }
208 long GetMaxSizePixel() const { return mnMaxSize
; }
210 Size
CalcLayoutSizePixel( const Size
& aNewSize
);
212 void ShowAutoHideButton( sal_Bool bShow
= sal_True
);
213 sal_Bool
IsAutoHideButtonVisible() const { return mbAutoHide
; }
214 void ShowFadeInHideButton( sal_Bool bShow
= sal_True
);
215 void ShowFadeInButton( sal_Bool bShow
= sal_True
) { ShowFadeInHideButton( bShow
); }
216 sal_Bool
IsFadeInButtonVisible() const { return mbFadeIn
; }
217 void ShowFadeOutButton( sal_Bool bShow
= sal_True
);
218 sal_Bool
IsFadeOutButtonVisible() const { return mbFadeOut
; }
219 long GetFadeInSize() const;
220 sal_Bool
IsFadeNoButtonMode() const { return mbFadeNoButtonMode
; }
222 void SetAutoHideState( sal_Bool bAutoHide
);
223 sal_Bool
GetAutoHideState() const { return mbAutoHideIn
; }
225 void SetStartSplitHdl( const Link
& rLink
) { maStartSplitHdl
= rLink
; }
226 const Link
& GetStartSplitHdl() const { return maStartSplitHdl
; }
227 void SetSplitHdl( const Link
& rLink
) { maSplitHdl
= rLink
; }
228 const Link
& GetSplitHdl() const { return maSplitHdl
; }
229 void SetSplitResizeHdl( const Link
& rLink
) { maSplitResizeHdl
= rLink
; }
230 const Link
& GetSplitResizeHdl() const { return maSplitResizeHdl
; }
231 void SetAutoHideHdl( const Link
& rLink
) { maAutoHideHdl
= rLink
; }
232 const Link
& GetAutoHideHdl() const { return maAutoHideHdl
; }
233 void SetFadeInHdl( const Link
& rLink
) { maFadeInHdl
= rLink
; }
234 const Link
& GetFadeInHdl() const { return maFadeInHdl
; }
235 void SetFadeOutHdl( const Link
& rLink
) { maFadeOutHdl
= rLink
; }
236 const Link
& GetFadeOutHdl() const { return maFadeOutHdl
; }
239 #endif // _SV_SPLITWIN_HXX
241 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */