Line data Source code
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_FLOATWIN_HXX
21 : #define INCLUDED_VCL_FLOATWIN_HXX
22 :
23 : #include <tools/solar.h>
24 : #include <vcl/dllapi.h>
25 : #include <vcl/syswin.hxx>
26 :
27 : class ToolBox;
28 :
29 :
30 : // - FloatingWindow-Types -
31 :
32 :
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)
51 : #define FLOATWIN_POPUPMODE_NOHORZPLACEMENT ((sal_uLong)0x00040000)
52 :
53 : #define FLOATWIN_POPUPMODEEND_CANCEL ((sal_uInt16)0x0001)
54 : #define FLOATWIN_POPUPMODEEND_TEAROFF ((sal_uInt16)0x0002)
55 : #define FLOATWIN_POPUPMODEEND_DONTCALLHDL ((sal_uInt16)0x0004)
56 : #define FLOATWIN_POPUPMODEEND_CLOSEALL ((sal_uInt16)0x0008)
57 :
58 : #define FLOATWIN_TITLE_NORMAL ((sal_uInt16)0x0001)
59 : #define FLOATWIN_TITLE_TEAROFF ((sal_uInt16)0x0002)
60 : #define FLOATWIN_TITLE_POPUP ((sal_uInt16)0x0004)
61 : #define FLOATWIN_TITLE_NONE ((sal_uInt16)0x0008)
62 :
63 :
64 : // - FloatingWindow -
65 :
66 :
67 : class VCL_DLLPUBLIC FloatingWindow : public SystemWindow
68 : {
69 : class ImplData;
70 : private:
71 : FloatingWindow* mpNextFloat;
72 : Window* mpFirstPopupModeWin;
73 : ImplData* mpImplData;
74 : Rectangle maFloatRect;
75 : sal_uLong mnPostId;
76 : sal_uLong mnPopupModeFlags;
77 : sal_uInt16 mnTitle;
78 : sal_uInt16 mnOldTitle;
79 : bool mbInPopupMode;
80 : bool mbPopupMode;
81 : bool mbPopupModeCanceled;
82 : bool mbPopupModeTearOff;
83 : bool mbMouseDown;
84 : bool mbOldSaveBackMode;
85 : bool mbGrabFocus; // act as key input window, although focus is not set
86 : bool mbInCleanUp;
87 : Link maPopupModeEndHdl;
88 :
89 : SAL_DLLPRIVATE void ImplCallPopupModeEnd();
90 : DECL_DLLPRIVATE_LINK( ImplEndPopupModeHdl, void* );
91 :
92 : // Copy assignment is forbidden and not implemented.
93 : SAL_DLLPRIVATE FloatingWindow (const FloatingWindow &);
94 : SAL_DLLPRIVATE FloatingWindow & operator= (const FloatingWindow &);
95 :
96 : protected:
97 : using Window::ImplInit;
98 : SAL_DLLPRIVATE void ImplInit( Window* pParent, WinBits nStyle );
99 : SAL_DLLPRIVATE void ImplInitSettings();
100 : SAL_DLLPRIVATE void ImplLoadRes( const ResId& rResId );
101 :
102 : public:
103 : #define IMPL_FLOATWIN_HITTEST_OUTSIDE ((sal_uInt16)0x0001)
104 : #define IMPL_FLOATWIN_HITTEST_WINDOW ((sal_uInt16)0x0002)
105 : #define IMPL_FLOATWIN_HITTEST_RECT ((sal_uInt16)0x0004)
106 : SAL_DLLPRIVATE FloatingWindow* ImplFloatHitTest( Window* pReference, const Point& rPos, sal_uInt16& rHitTest );
107 : SAL_DLLPRIVATE FloatingWindow* ImplFindLastLevelFloat();
108 : SAL_DLLPRIVATE bool ImplIsFloatPopupModeWindow( const Window* pWindow );
109 0 : SAL_DLLPRIVATE void ImplSetMouseDown() { mbMouseDown = true; }
110 0 : SAL_DLLPRIVATE bool ImplIsMouseDown() const { return mbMouseDown; }
111 : SAL_DLLPRIVATE static Point ImplCalcPos( Window* pWindow,
112 : const Rectangle& rRect, sal_uLong nFlags,
113 : sal_uInt16& rArrangeIndex );
114 : SAL_DLLPRIVATE void ImplEndPopupMode( sal_uInt16 nFlags = 0, sal_uLong nFocusId = 0 );
115 : SAL_DLLPRIVATE Rectangle& ImplGetItemEdgeClipRect();
116 0 : SAL_DLLPRIVATE bool ImplIsInPrivatePopupMode() const { return mbInPopupMode; }
117 :
118 : public:
119 : explicit FloatingWindow( Window* pParent, WinBits nStyle = WB_STDFLOATWIN );
120 : explicit FloatingWindow( Window* pParent, const ResId& );
121 : virtual ~FloatingWindow();
122 :
123 : virtual bool Notify( NotifyEvent& rNEvt ) SAL_OVERRIDE;
124 : virtual void StateChanged( StateChangedType nType ) SAL_OVERRIDE;
125 : virtual void DataChanged( const DataChangedEvent& rDCEvt ) SAL_OVERRIDE;
126 :
127 : virtual void PopupModeEnd();
128 :
129 : void SetTitleType( sal_uInt16 nTitle );
130 0 : sal_uInt16 GetTitleType() const { return mnTitle; }
131 :
132 : void StartPopupMode( const Rectangle& rRect, sal_uLong nFlags = 0 );
133 : void StartPopupMode( ToolBox* pBox, sal_uLong nFlags = 0 );
134 : void EndPopupMode( sal_uInt16 nFlags = 0 );
135 : void AddPopupModeWindow( Window* pWindow );
136 0 : sal_uLong GetPopupModeFlags() const { return mnPopupModeFlags; }
137 0 : void SetPopupModeFlags( sal_uLong nFlags ) { mnPopupModeFlags = nFlags; }
138 0 : bool IsInPopupMode() const { return mbPopupMode; }
139 0 : bool IsInCleanUp() const { return mbInCleanUp; }
140 0 : bool IsPopupModeCanceled() const { return mbPopupModeCanceled; }
141 0 : bool IsPopupModeTearOff() const { return mbPopupModeTearOff; }
142 :
143 0 : void SetPopupModeEndHdl( const Link& rLink ) { maPopupModeEndHdl = rLink; }
144 : const Link& GetPopupModeEndHdl() const { return maPopupModeEndHdl; }
145 :
146 0 : bool GrabsFocus() const { return mbGrabFocus; }
147 :
148 : static Point CalcFloatingPosition( Window* pWindow, const Rectangle& rRect, sal_uLong nFlags, sal_uInt16& rArrangeIndex );
149 : };
150 :
151 : #endif // INCLUDED_VCL_FLOATWIN_HXX
152 :
153 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|