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 INCLUDED_VCL_INC_BRDWIN_HXX
21 #define INCLUDED_VCL_INC_BRDWIN_HXX
23 #include <vcl/window.hxx>
25 class ImplBorderWindowView
;
27 #define BORDERWINDOW_STYLE_OVERLAP ((sal_uInt16)0x0001)
28 #define BORDERWINDOW_STYLE_BORDER ((sal_uInt16)0x0002)
29 #define BORDERWINDOW_STYLE_FLOAT ((sal_uInt16)0x0004)
30 #define BORDERWINDOW_STYLE_FRAME ((sal_uInt16)0x0008)
31 #define BORDERWINDOW_STYLE_APP ((sal_uInt16)0x0010)
33 #define BORDERWINDOW_HITTEST_TITLE ((sal_uInt16)0x0001)
34 #define BORDERWINDOW_HITTEST_LEFT ((sal_uInt16)0x0002)
35 #define BORDERWINDOW_HITTEST_MENU ((sal_uInt16)0x0004)
36 #define BORDERWINDOW_HITTEST_TOP ((sal_uInt16)0x0008)
37 #define BORDERWINDOW_HITTEST_RIGHT ((sal_uInt16)0x0010)
38 #define BORDERWINDOW_HITTEST_BOTTOM ((sal_uInt16)0x0020)
39 #define BORDERWINDOW_HITTEST_TOPLEFT ((sal_uInt16)0x0040)
40 #define BORDERWINDOW_HITTEST_TOPRIGHT ((sal_uInt16)0x0080)
41 #define BORDERWINDOW_HITTEST_BOTTOMLEFT ((sal_uInt16)0x0100)
42 #define BORDERWINDOW_HITTEST_BOTTOMRIGHT ((sal_uInt16)0x0200)
43 #define BORDERWINDOW_HITTEST_CLOSE ((sal_uInt16)0x0400)
44 #define BORDERWINDOW_HITTEST_ROLL ((sal_uInt16)0x0800)
45 #define BORDERWINDOW_HITTEST_DOCK ((sal_uInt16)0x1000)
46 #define BORDERWINDOW_HITTEST_HIDE ((sal_uInt16)0x2000)
47 #define BORDERWINDOW_HITTEST_HELP ((sal_uInt16)0x4000)
48 #define BORDERWINDOW_HITTEST_PIN ((sal_uInt16)0x8000)
50 #define BORDERWINDOW_DRAW_TITLE ((sal_uInt16)0x0001)
51 #define BORDERWINDOW_DRAW_BORDER ((sal_uInt16)0x0002)
52 #define BORDERWINDOW_DRAW_FRAME ((sal_uInt16)0x0004)
53 #define BORDERWINDOW_DRAW_CLOSE ((sal_uInt16)0x0008)
54 #define BORDERWINDOW_DRAW_ROLL ((sal_uInt16)0x0010)
55 #define BORDERWINDOW_DRAW_DOCK ((sal_uInt16)0x0020)
56 #define BORDERWINDOW_DRAW_HIDE ((sal_uInt16)0x0040)
57 #define BORDERWINDOW_DRAW_HELP ((sal_uInt16)0x0080)
58 #define BORDERWINDOW_DRAW_PIN ((sal_uInt16)0x0100)
59 #define BORDERWINDOW_DRAW_MENU ((sal_uInt16)0x0200)
60 #define BORDERWINDOW_DRAW_ALL (BORDERWINDOW_DRAW_TITLE | \
61 BORDERWINDOW_DRAW_BORDER | \
62 BORDERWINDOW_DRAW_FRAME | \
63 BORDERWINDOW_DRAW_CLOSE | \
64 BORDERWINDOW_DRAW_ROLL | \
65 BORDERWINDOW_DRAW_DOCK | \
66 BORDERWINDOW_DRAW_HIDE | \
67 BORDERWINDOW_DRAW_HELP | \
68 BORDERWINDOW_DRAW_PIN | \
69 BORDERWINDOW_DRAW_MENU)
71 #define BORDERWINDOW_TITLE_NORMAL ((sal_uInt16)0x0001)
72 #define BORDERWINDOW_TITLE_SMALL ((sal_uInt16)0x0002)
73 #define BORDERWINDOW_TITLE_TEAROFF ((sal_uInt16)0x0004)
74 #define BORDERWINDOW_TITLE_POPUP ((sal_uInt16)0x0008)
75 #define BORDERWINDOW_TITLE_NONE ((sal_uInt16)0x0010)
77 class ImplBorderWindow
: public Window
80 friend class ImplBorderWindowView
;
81 friend class ImplSmallBorderWindowView
;
82 friend class ImplStdBorderWindowView
;
85 ImplBorderWindowView
* mpBorderView
;
86 Window
* mpMenuBarWindow
;
93 sal_uInt16 mnTitleType
;
94 sal_uInt16 mnBorderStyle
;
96 bool mbSmallOutBorder
;
104 bool mbDisplayActive
;
106 using Window::ImplInit
;
107 void ImplInit( Window
* pParent
,
108 WinBits nStyle
, sal_uInt16 nTypeStyle
,
109 SystemParentData
* pParentData
);
110 void ImplInit( Window
* pParent
,
111 WinBits nStyle
, sal_uInt16 nTypeStyle
,
112 const ::com::sun::star::uno::Any
& );
114 // Copy assignment is forbidden and not implemented.
115 ImplBorderWindow (const ImplBorderWindow
&);
116 ImplBorderWindow
& operator= (const ImplBorderWindow
&);
119 ImplBorderWindow( Window
* pParent
,
120 SystemParentData
* pParentData
,
122 sal_uInt16 nTypeStyle
= 0 );
123 ImplBorderWindow( Window
* pParent
, WinBits nStyle
= 0,
124 sal_uInt16 nTypeStyle
= 0 );
125 virtual ~ImplBorderWindow();
127 virtual void MouseMove( const MouseEvent
& rMEvt
) SAL_OVERRIDE
;
128 virtual void MouseButtonDown( const MouseEvent
& rMEvt
) SAL_OVERRIDE
;
129 virtual void Tracking( const TrackingEvent
& rTEvt
) SAL_OVERRIDE
;
130 virtual void Paint( const Rectangle
& rRect
) SAL_OVERRIDE
;
131 virtual void Activate() SAL_OVERRIDE
;
132 virtual void Deactivate() SAL_OVERRIDE
;
133 virtual void Resize() SAL_OVERRIDE
;
134 virtual void RequestHelp( const HelpEvent
& rHEvt
) SAL_OVERRIDE
;
135 virtual void StateChanged( StateChangedType nType
) SAL_OVERRIDE
;
136 virtual void DataChanged( const DataChangedEvent
& rDCEvt
) SAL_OVERRIDE
;
139 void UpdateView( bool bNewView
, const Size
& rNewOutSize
);
140 void InvalidateBorder();
143 void Draw( const Rectangle
& rRect
, OutputDevice
* pDev
, const Point
& rPos
);
145 void SetDisplayActive( bool bActive
);
146 bool IsDisplayActive() const { return mbDisplayActive
; }
147 void SetTitleType( sal_uInt16 nTitleType
, const Size
& rSize
);
148 void SetBorderStyle( sal_uInt16 nStyle
);
149 sal_uInt16
GetBorderStyle() const { return mnBorderStyle
; }
150 void SetPin( bool bPin
);
151 void SetRollUp( bool bRollUp
, const Size
& rSize
);
153 void SetDockButton( bool bDockButton
);
154 void SetHideButton( bool bHideButton
);
155 void SetMenuButton( bool bMenuButton
);
157 void UpdateMenuHeight();
158 void SetMenuBarWindow( Window
* pWindow
);
159 void SetMenuBarMode( bool bHide
);
161 void SetMinOutputSize( long nWidth
, long nHeight
)
162 { mnMinWidth
= nWidth
; mnMinHeight
= nHeight
; }
163 void SetMaxOutputSize( long nWidth
, long nHeight
)
164 { mnMaxWidth
= nWidth
; mnMaxHeight
= nHeight
; }
166 void GetBorder( sal_Int32
& rLeftBorder
, sal_Int32
& rTopBorder
,
167 sal_Int32
& rRightBorder
, sal_Int32
& rBottomBorder
) const;
168 long CalcTitleWidth() const;
170 Rectangle
GetMenuRect() const;
172 virtual Size
GetOptimalSize() const SAL_OVERRIDE
;
175 struct ImplBorderFrameData
177 ImplBorderWindow
* mpBorderWindow
;
178 OutputDevice
* mpOutDev
;
179 Rectangle maTitleRect
;
181 Rectangle maCloseRect
;
182 Rectangle maRollRect
;
183 Rectangle maDockRect
;
184 Rectangle maMenuRect
;
185 Rectangle maHideRect
;
186 Rectangle maHelpRect
;
194 sal_Int32 mnLeftBorder
;
195 sal_Int32 mnTopBorder
;
196 sal_Int32 mnRightBorder
;
197 sal_Int32 mnBottomBorder
;
202 sal_uInt16 mnHitTest
;
203 sal_uInt16 mnPinState
;
204 sal_uInt16 mnCloseState
;
205 sal_uInt16 mnRollState
;
206 sal_uInt16 mnDockState
;
207 sal_uInt16 mnMenuState
;
208 sal_uInt16 mnHideState
;
209 sal_uInt16 mnHelpState
;
210 sal_uInt16 mnTitleType
;
216 class ImplBorderWindowView
219 virtual ~ImplBorderWindowView();
221 virtual bool MouseMove( const MouseEvent
& rMEvt
);
222 virtual bool MouseButtonDown( const MouseEvent
& rMEvt
);
223 virtual bool Tracking( const TrackingEvent
& rTEvt
);
224 virtual OUString
RequestHelp( const Point
& rPos
, Rectangle
& rHelpRect
);
226 virtual void Init( OutputDevice
* pDev
, long nWidth
, long nHeight
) = 0;
227 virtual void GetBorder( sal_Int32
& rLeftBorder
, sal_Int32
& rTopBorder
,
228 sal_Int32
& rRightBorder
, sal_Int32
& rBottomBorder
) const = 0;
229 virtual long CalcTitleWidth() const = 0;
230 virtual void DrawWindow( sal_uInt16 nDrawFlags
, OutputDevice
* pOutDev
= NULL
, const Point
* pOffset
= NULL
) = 0;
231 virtual Rectangle
GetMenuRect() const;
233 void ImplInitTitle( ImplBorderFrameData
* pData
);
234 sal_uInt16
ImplHitTest( ImplBorderFrameData
* pData
, const Point
& rPos
);
235 bool ImplMouseMove( ImplBorderFrameData
* pData
, const MouseEvent
& rMEvt
);
236 bool ImplMouseButtonDown( ImplBorderFrameData
* pData
, const MouseEvent
& rMEvt
);
237 bool ImplTracking( ImplBorderFrameData
* pData
, const TrackingEvent
& rTEvt
);
238 OUString
ImplRequestHelp( ImplBorderFrameData
* pData
, const Point
& rPos
, Rectangle
& rHelpRect
);
239 long ImplCalcTitleWidth( const ImplBorderFrameData
* pData
) const;
242 class ImplNoBorderWindowView
: public ImplBorderWindowView
245 ImplNoBorderWindowView( ImplBorderWindow
* pBorderWindow
);
247 virtual void Init( OutputDevice
* pDev
, long nWidth
, long nHeight
) SAL_OVERRIDE
;
248 virtual void GetBorder( sal_Int32
& rLeftBorder
, sal_Int32
& rTopBorder
,
249 sal_Int32
& rRightBorder
, sal_Int32
& rBottomBorder
) const SAL_OVERRIDE
;
250 virtual long CalcTitleWidth() const SAL_OVERRIDE
;
251 virtual void DrawWindow( sal_uInt16 nDrawFlags
, OutputDevice
* pOutDev
, const Point
* pOffset
) SAL_OVERRIDE
;
254 class ImplSmallBorderWindowView
: public ImplBorderWindowView
256 ImplBorderWindow
* mpBorderWindow
;
257 OutputDevice
* mpOutDev
;
260 sal_Int32 mnLeftBorder
;
261 sal_Int32 mnTopBorder
;
262 sal_Int32 mnRightBorder
;
263 sal_Int32 mnBottomBorder
;
267 ImplSmallBorderWindowView( ImplBorderWindow
* pBorderWindow
);
269 virtual void Init( OutputDevice
* pOutDev
, long nWidth
, long nHeight
) SAL_OVERRIDE
;
270 virtual void GetBorder( sal_Int32
& rLeftBorder
, sal_Int32
& rTopBorder
,
271 sal_Int32
& rRightBorder
, sal_Int32
& rBottomBorder
) const SAL_OVERRIDE
;
272 virtual long CalcTitleWidth() const SAL_OVERRIDE
;
273 virtual void DrawWindow( sal_uInt16 nDrawFlags
, OutputDevice
* pOutDev
, const Point
* pOffset
) SAL_OVERRIDE
;
276 class ImplStdBorderWindowView
: public ImplBorderWindowView
278 ImplBorderFrameData maFrameData
;
279 VirtualDevice
* mpATitleVirDev
;
280 VirtualDevice
* mpDTitleVirDev
;
283 ImplStdBorderWindowView( ImplBorderWindow
* pBorderWindow
);
284 virtual ~ImplStdBorderWindowView();
286 virtual bool MouseMove( const MouseEvent
& rMEvt
) SAL_OVERRIDE
;
287 virtual bool MouseButtonDown( const MouseEvent
& rMEvt
) SAL_OVERRIDE
;
288 virtual bool Tracking( const TrackingEvent
& rTEvt
) SAL_OVERRIDE
;
289 virtual OUString
RequestHelp( const Point
& rPos
, Rectangle
& rHelpRect
) SAL_OVERRIDE
;
290 virtual Rectangle
GetMenuRect() const SAL_OVERRIDE
;
292 virtual void Init( OutputDevice
* pDev
, long nWidth
, long nHeight
) SAL_OVERRIDE
;
293 virtual void GetBorder( sal_Int32
& rLeftBorder
, sal_Int32
& rTopBorder
,
294 sal_Int32
& rRightBorder
, sal_Int32
& rBottomBorder
) const SAL_OVERRIDE
;
295 virtual long CalcTitleWidth() const SAL_OVERRIDE
;
296 virtual void DrawWindow( sal_uInt16 nDrawFlags
, OutputDevice
* pOutDev
, const Point
* pOffset
) SAL_OVERRIDE
;
299 #endif // INCLUDED_VCL_INC_BRDWIN_HXX
301 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */