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_FLOATWIN_HXX
21 #define _SV_FLOATWIN_HXX
23 #include <tools/solar.h>
24 #include <vcl/dllapi.h>
25 #include <vcl/syswin.hxx>
29 // ------------------------
30 // - FloatingWindow-Types -
31 // ------------------------
33 #define FLOATWIN_POPUPMODE_ALLOWTEAROFF ((sal_uLong)0x00000001)
34 #define FLOATWIN_POPUPMODE_ANIMATIONSLIDE ((sal_uLong)0x00000002)
35 #define FLOATWIN_POPUPMODE_NOAUTOARRANGE ((sal_uLong)0x00000004)
36 #define FLOATWIN_POPUPMODE_NOANIMATION ((sal_uLong)0x00000008)
37 #define FLOATWIN_POPUPMODE_DOWN ((sal_uLong)0x00000010)
38 #define FLOATWIN_POPUPMODE_UP ((sal_uLong)0x00000020)
39 #define FLOATWIN_POPUPMODE_LEFT ((sal_uLong)0x00000040)
40 #define FLOATWIN_POPUPMODE_RIGHT ((sal_uLong)0x00000080)
41 #define FLOATWIN_POPUPMODE_NOFOCUSCLOSE ((sal_uLong)0x00000100)
42 #define FLOATWIN_POPUPMODE_NOKEYCLOSE ((sal_uLong)0x00000200)
43 #define FLOATWIN_POPUPMODE_NOMOUSECLOSE ((sal_uLong)0x00000400)
44 #define FLOATWIN_POPUPMODE_NOMOUSERECTCLOSE ((sal_uLong)0x00000800)
45 #define FLOATWIN_POPUPMODE_ALLMOUSEBUTTONCLOSE ((sal_uLong)0x00001000)
46 #define FLOATWIN_POPUPMODE_NOAPPFOCUSCLOSE ((sal_uLong)0x00002000)
47 #define FLOATWIN_POPUPMODE_PATHMOUSECANCELCLICK ((sal_uLong)0x00004000)
48 #define FLOATWIN_POPUPMODE_NEWLEVEL ((sal_uLong)0x00008000)
49 #define FLOATWIN_POPUPMODE_NOMOUSEUPCLOSE ((sal_uLong)0x00010000)
50 #define FLOATWIN_POPUPMODE_GRABFOCUS ((sal_uLong)0x00020000)
52 #define FLOATWIN_POPUPMODEEND_CANCEL ((sal_uInt16)0x0001)
53 #define FLOATWIN_POPUPMODEEND_TEAROFF ((sal_uInt16)0x0002)
54 #define FLOATWIN_POPUPMODEEND_DONTCALLHDL ((sal_uInt16)0x0004)
55 #define FLOATWIN_POPUPMODEEND_CLOSEALL ((sal_uInt16)0x0008)
57 #define FLOATWIN_TITLE_NORMAL ((sal_uInt16)0x0001)
58 #define FLOATWIN_TITLE_TEAROFF ((sal_uInt16)0x0002)
59 #define FLOATWIN_TITLE_POPUP ((sal_uInt16)0x0004)
60 #define FLOATWIN_TITLE_NONE ((sal_uInt16)0x0008)
66 class VCL_DLLPUBLIC FloatingWindow
: public SystemWindow
70 FloatingWindow
* mpNextFloat
;
71 Window
* mpFirstPopupModeWin
;
73 Rectangle maFloatRect
;
75 sal_uLong mnPopupModeFlags
;
77 sal_uInt16 mnOldTitle
;
78 sal_Bool mbInPopupMode
;
80 sal_Bool mbPopupModeCanceled
;
81 sal_Bool mbPopupModeTearOff
;
83 sal_Bool mbOldSaveBackMode
;
84 sal_Bool mbGrabFocus
; // act as key input window, although focus is not set
86 Link maPopupModeEndHdl
;
88 SAL_DLLPRIVATE
void ImplCallPopupModeEnd();
89 DECL_DLLPRIVATE_LINK( ImplEndPopupModeHdl
, void* );
91 // Copy assignment is forbidden and not implemented.
92 SAL_DLLPRIVATE
FloatingWindow (const FloatingWindow
&);
93 SAL_DLLPRIVATE FloatingWindow
& operator= (const FloatingWindow
&);
96 using Window::ImplInit
;
97 SAL_DLLPRIVATE
void ImplInit( Window
* pParent
, WinBits nStyle
);
98 SAL_DLLPRIVATE
void ImplInitSettings();
99 SAL_DLLPRIVATE
void ImplLoadRes( const ResId
& rResId
);
102 #define IMPL_FLOATWIN_HITTEST_OUTSIDE ((sal_uInt16)0x0001)
103 #define IMPL_FLOATWIN_HITTEST_WINDOW ((sal_uInt16)0x0002)
104 #define IMPL_FLOATWIN_HITTEST_RECT ((sal_uInt16)0x0004)
105 SAL_DLLPRIVATE FloatingWindow
* ImplFloatHitTest( Window
* pReference
, const Point
& rPos
, sal_uInt16
& rHitTest
);
106 SAL_DLLPRIVATE FloatingWindow
* ImplFindLastLevelFloat();
107 SAL_DLLPRIVATE sal_Bool
ImplIsFloatPopupModeWindow( const Window
* pWindow
);
108 SAL_DLLPRIVATE
void ImplSetMouseDown() { mbMouseDown
= sal_True
; }
109 SAL_DLLPRIVATE sal_Bool
ImplIsMouseDown() const { return mbMouseDown
; }
110 SAL_DLLPRIVATE
static Point
ImplCalcPos( Window
* pWindow
,
111 const Rectangle
& rRect
, sal_uLong nFlags
,
112 sal_uInt16
& rArrangeIndex
);
113 SAL_DLLPRIVATE
void ImplEndPopupMode( sal_uInt16 nFlags
= 0, sal_uLong nFocusId
= 0 );
114 SAL_DLLPRIVATE Rectangle
& ImplGetItemEdgeClipRect();
115 SAL_DLLPRIVATE sal_Bool
ImplIsInPrivatePopupMode() const { return mbInPopupMode
; }
118 explicit FloatingWindow( Window
* pParent
, WinBits nStyle
= WB_STDFLOATWIN
);
119 explicit FloatingWindow( Window
* pParent
, const ResId
& );
120 virtual ~FloatingWindow();
122 virtual long Notify( NotifyEvent
& rNEvt
);
123 virtual void StateChanged( StateChangedType nType
);
124 virtual void DataChanged( const DataChangedEvent
& rDCEvt
);
126 virtual void PopupModeEnd();
128 void SetTitleType( sal_uInt16 nTitle
);
129 sal_uInt16
GetTitleType() const { return mnTitle
; }
131 void StartPopupMode( const Rectangle
& rRect
, sal_uLong nFlags
= 0 );
132 void StartPopupMode( ToolBox
* pBox
, sal_uLong nFlags
= 0 );
133 void EndPopupMode( sal_uInt16 nFlags
= 0 );
134 void AddPopupModeWindow( Window
* pWindow
);
135 sal_uLong
GetPopupModeFlags() const { return mnPopupModeFlags
; }
136 void SetPopupModeFlags( sal_uLong nFlags
) { mnPopupModeFlags
= nFlags
; }
137 sal_Bool
IsInPopupMode() const { return mbPopupMode
; }
138 sal_Bool
IsInCleanUp() const { return mbInCleanUp
; }
139 sal_Bool
IsPopupModeCanceled() const { return mbPopupModeCanceled
; }
140 sal_Bool
IsPopupModeTearOff() const { return mbPopupModeTearOff
; }
142 void SetPopupModeEndHdl( const Link
& rLink
) { maPopupModeEndHdl
= rLink
; }
143 const Link
& GetPopupModeEndHdl() const { return maPopupModeEndHdl
; }
145 sal_Bool
GrabsFocus() const { return mbGrabFocus
; }
147 static Point
CalcFloatingPosition( Window
* pWindow
, const Rectangle
& rRect
, sal_uLong nFlags
, sal_uInt16
& rArrangeIndex
);
150 #endif // _SV_FLOATWIN_HXX
152 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */