xref: /aoo41x/main/vcl/inc/vcl/floatwin.hxx (revision e1beba7d)
10d63794cSAndrew Rist /**************************************************************
2cdf0e10cSrcweir  *
30d63794cSAndrew Rist  * Licensed to the Apache Software Foundation (ASF) under one
40d63794cSAndrew Rist  * or more contributor license agreements.  See the NOTICE file
50d63794cSAndrew Rist  * distributed with this work for additional information
60d63794cSAndrew Rist  * regarding copyright ownership.  The ASF licenses this file
70d63794cSAndrew Rist  * to you under the Apache License, Version 2.0 (the
80d63794cSAndrew Rist  * "License"); you may not use this file except in compliance
90d63794cSAndrew Rist  * with the License.  You may obtain a copy of the License at
100d63794cSAndrew Rist  *
110d63794cSAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
120d63794cSAndrew Rist  *
130d63794cSAndrew Rist  * Unless required by applicable law or agreed to in writing,
140d63794cSAndrew Rist  * software distributed under the License is distributed on an
150d63794cSAndrew Rist  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
160d63794cSAndrew Rist  * KIND, either express or implied.  See the License for the
170d63794cSAndrew Rist  * specific language governing permissions and limitations
180d63794cSAndrew Rist  * under the License.
190d63794cSAndrew Rist  *
200d63794cSAndrew Rist  *************************************************************/
210d63794cSAndrew Rist 
220d63794cSAndrew Rist 
23cdf0e10cSrcweir 
24cdf0e10cSrcweir #ifndef _SV_FLOATWIN_HXX
25cdf0e10cSrcweir #define _SV_FLOATWIN_HXX
26cdf0e10cSrcweir 
27cdf0e10cSrcweir #include <vcl/sv.h>
28cdf0e10cSrcweir #include <vcl/dllapi.h>
29cdf0e10cSrcweir #include <vcl/syswin.hxx>
30cdf0e10cSrcweir 
31cdf0e10cSrcweir class ToolBox;
32cdf0e10cSrcweir class PopupModeEvent;
33cdf0e10cSrcweir 
34cdf0e10cSrcweir // ------------------------
35cdf0e10cSrcweir // - FloatingWindow-Types -
36cdf0e10cSrcweir // ------------------------
37cdf0e10cSrcweir 
38cdf0e10cSrcweir #define FLOATWIN_POPUPMODE_ALLOWTEAROFF 		((sal_uLong)0x00000001)
39cdf0e10cSrcweir #define FLOATWIN_POPUPMODE_ANIMATIONSLIDE		((sal_uLong)0x00000002)
40cdf0e10cSrcweir #define FLOATWIN_POPUPMODE_NOAUTOARRANGE		((sal_uLong)0x00000004)
41cdf0e10cSrcweir #define FLOATWIN_POPUPMODE_NOANIMATION			((sal_uLong)0x00000008)
42cdf0e10cSrcweir #define FLOATWIN_POPUPMODE_DOWN 				((sal_uLong)0x00000010)
43cdf0e10cSrcweir #define FLOATWIN_POPUPMODE_UP					((sal_uLong)0x00000020)
44cdf0e10cSrcweir #define FLOATWIN_POPUPMODE_LEFT 				((sal_uLong)0x00000040)
45cdf0e10cSrcweir #define FLOATWIN_POPUPMODE_RIGHT				((sal_uLong)0x00000080)
46cdf0e10cSrcweir #define FLOATWIN_POPUPMODE_NOFOCUSCLOSE 		((sal_uLong)0x00000100)
47cdf0e10cSrcweir #define FLOATWIN_POPUPMODE_NOKEYCLOSE			((sal_uLong)0x00000200)
48cdf0e10cSrcweir #define FLOATWIN_POPUPMODE_NOMOUSECLOSE 		((sal_uLong)0x00000400)
49cdf0e10cSrcweir #define FLOATWIN_POPUPMODE_NOMOUSERECTCLOSE 	((sal_uLong)0x00000800)
50cdf0e10cSrcweir #define FLOATWIN_POPUPMODE_ALLMOUSEBUTTONCLOSE	((sal_uLong)0x00001000)
51cdf0e10cSrcweir #define FLOATWIN_POPUPMODE_NOAPPFOCUSCLOSE		((sal_uLong)0x00002000)
52cdf0e10cSrcweir #define FLOATWIN_POPUPMODE_PATHMOUSECANCELCLICK ((sal_uLong)0x00004000)
53cdf0e10cSrcweir #define FLOATWIN_POPUPMODE_NEWLEVEL 			((sal_uLong)0x00008000)
54cdf0e10cSrcweir #define FLOATWIN_POPUPMODE_NOMOUSEUPCLOSE		((sal_uLong)0x00010000)
55cdf0e10cSrcweir #define FLOATWIN_POPUPMODE_GRABFOCUS        	((sal_uLong)0x00020000)
56cdf0e10cSrcweir 
57cdf0e10cSrcweir #define FLOATWIN_POPUPMODEEND_CANCEL			((sal_uInt16)0x0001)
58cdf0e10cSrcweir #define FLOATWIN_POPUPMODEEND_TEAROFF			((sal_uInt16)0x0002)
59cdf0e10cSrcweir #define FLOATWIN_POPUPMODEEND_DONTCALLHDL		((sal_uInt16)0x0004)
60cdf0e10cSrcweir #define FLOATWIN_POPUPMODEEND_CLOSEALL			((sal_uInt16)0x0008)
61cdf0e10cSrcweir 
62cdf0e10cSrcweir #define FLOATWIN_TITLE_NORMAL					((sal_uInt16)0x0001)
63cdf0e10cSrcweir #define FLOATWIN_TITLE_TEAROFF					((sal_uInt16)0x0002)
64cdf0e10cSrcweir #define FLOATWIN_TITLE_NONE 					((sal_uInt16)0x0004)
65cdf0e10cSrcweir 
66cdf0e10cSrcweir // ------------------
67cdf0e10cSrcweir // - FloatingWindow -
68cdf0e10cSrcweir // ------------------
69cdf0e10cSrcweir 
70cdf0e10cSrcweir class VCL_DLLPUBLIC FloatingWindow : public SystemWindow
71cdf0e10cSrcweir {
72cdf0e10cSrcweir     class   ImplData;
73cdf0e10cSrcweir private:
74cdf0e10cSrcweir 	FloatingWindow* mpNextFloat;
75cdf0e10cSrcweir 	Window* 		mpFirstPopupModeWin;
76cdf0e10cSrcweir     ImplData*       mpImplData;
77cdf0e10cSrcweir 	Rectangle		maFloatRect;
78cdf0e10cSrcweir 	sal_uLong			mnPostId;
79cdf0e10cSrcweir 	sal_uLong			mnPopupModeFlags;
80cdf0e10cSrcweir 	sal_uInt16			mnTitle;
81cdf0e10cSrcweir 	sal_uInt16			mnOldTitle;
82cdf0e10cSrcweir 	sal_Bool			mbInPopupMode;
83cdf0e10cSrcweir 	sal_Bool			mbPopupMode;
84cdf0e10cSrcweir 	sal_Bool			mbPopupModeCanceled;
85cdf0e10cSrcweir 	sal_Bool			mbPopupModeTearOff;
86cdf0e10cSrcweir 	sal_Bool			mbMouseDown;
87cdf0e10cSrcweir 	sal_Bool			mbOldSaveBackMode;
88cdf0e10cSrcweir 	sal_Bool			mbGrabFocus;    // act as key input window, although focus is not set
89cdf0e10cSrcweir 	sal_Bool			mbInCleanUp;
90cdf0e10cSrcweir 	Link			maPopupModeEndHdl;
91cdf0e10cSrcweir 
92cdf0e10cSrcweir //#if 0 // _SOLAR__PRIVATE
93cdf0e10cSrcweir 	SAL_DLLPRIVATE void    ImplCallPopupModeEnd();
94cdf0e10cSrcweir 	DECL_DLLPRIVATE_LINK(  ImplEndPopupModeHdl, void* );
95cdf0e10cSrcweir 
96cdf0e10cSrcweir     // Copy assignment is forbidden and not implemented.
97cdf0e10cSrcweir 	SAL_DLLPRIVATE         FloatingWindow (const FloatingWindow &);
98cdf0e10cSrcweir 	SAL_DLLPRIVATE         FloatingWindow & operator= (const FloatingWindow &);
99cdf0e10cSrcweir 
100cdf0e10cSrcweir protected:
101cdf0e10cSrcweir     using Window::ImplInit;
102cdf0e10cSrcweir 	SAL_DLLPRIVATE void    ImplInit( Window* pParent, WinBits nStyle );
103cdf0e10cSrcweir 	SAL_DLLPRIVATE void    ImplInitSettings();
104cdf0e10cSrcweir 	SAL_DLLPRIVATE void    ImplLoadRes( const ResId& rResId );
105cdf0e10cSrcweir 
106cdf0e10cSrcweir public:
107cdf0e10cSrcweir #define IMPL_FLOATWIN_HITTEST_OUTSIDE		((sal_uInt16)0x0001)
108cdf0e10cSrcweir #define IMPL_FLOATWIN_HITTEST_WINDOW		((sal_uInt16)0x0002)
109cdf0e10cSrcweir #define IMPL_FLOATWIN_HITTEST_RECT			((sal_uInt16)0x0004)
110cdf0e10cSrcweir 	SAL_DLLPRIVATE FloatingWindow*  ImplFloatHitTest( Window* pReference, const Point& rPos, sal_uInt16& rHitTest );
111cdf0e10cSrcweir 	SAL_DLLPRIVATE FloatingWindow*  ImplFindLastLevelFloat();
112cdf0e10cSrcweir 	SAL_DLLPRIVATE sal_Bool			    ImplIsFloatPopupModeWindow( const Window* pWindow );
ImplSetMouseDown()113cdf0e10cSrcweir 	SAL_DLLPRIVATE void			    ImplSetMouseDown() { mbMouseDown = sal_True; }
ImplIsMouseDown() const114cdf0e10cSrcweir 	SAL_DLLPRIVATE sal_Bool    			ImplIsMouseDown() const  { return mbMouseDown; }
115cdf0e10cSrcweir 	SAL_DLLPRIVATE static Point    	ImplCalcPos( Window* pWindow,
116cdf0e10cSrcweir                                                  const Rectangle& rRect, sal_uLong nFlags,
117cdf0e10cSrcweir                                                  sal_uInt16& rArrangeIndex );
118cdf0e10cSrcweir 	SAL_DLLPRIVATE void			    ImplEndPopupMode( sal_uInt16 nFlags = 0, sal_uLong nFocusId = 0 );
119cdf0e10cSrcweir     SAL_DLLPRIVATE Rectangle&       ImplGetItemEdgeClipRect();
ImplIsInPrivatePopupMode() const120cdf0e10cSrcweir     SAL_DLLPRIVATE sal_Bool             ImplIsInPrivatePopupMode() const { return mbInPopupMode; }
121cdf0e10cSrcweir //#endif
122cdf0e10cSrcweir 
123cdf0e10cSrcweir public:
124*e1beba7dSHerbert Dürr 	explicit		FloatingWindow( Window* pParent, WinBits nStyle = WB_STDFLOATWIN );
125*e1beba7dSHerbert Dürr 	explicit		FloatingWindow( Window* pParent, const ResId& );
126*e1beba7dSHerbert Dürr 	virtual			~FloatingWindow();
127cdf0e10cSrcweir 
128cdf0e10cSrcweir 	virtual long	Notify( NotifyEvent& rNEvt );
129cdf0e10cSrcweir 	virtual void	StateChanged( StateChangedType nType );
130cdf0e10cSrcweir 	virtual void	DataChanged( const DataChangedEvent& rDCEvt );
131cdf0e10cSrcweir 
132cdf0e10cSrcweir 	virtual void	PopupModeEnd();
133cdf0e10cSrcweir 
134cdf0e10cSrcweir 	void			SetTitleType( sal_uInt16 nTitle );
GetTitleType() const135cdf0e10cSrcweir 	sal_uInt16			GetTitleType() const { return mnTitle; }
136cdf0e10cSrcweir 
137cdf0e10cSrcweir 	void			StartPopupMode( const Rectangle& rRect, sal_uLong nFlags = 0 );
138cdf0e10cSrcweir 	void			StartPopupMode( ToolBox* pBox, sal_uLong nFlags = 0  );
139cdf0e10cSrcweir 	void			EndPopupMode( sal_uInt16 nFlags = 0 );
140cdf0e10cSrcweir 	void			AddPopupModeWindow( Window* pWindow );
141cdf0e10cSrcweir 	void			RemovePopupModeWindow( Window* pWindow );
GetPopupModeFlags() const142cdf0e10cSrcweir 	sal_uLong			GetPopupModeFlags() const { return mnPopupModeFlags; }
SetPopupModeFlags(sal_uLong nFlags)143cdf0e10cSrcweir     void			SetPopupModeFlags( sal_uLong nFlags ) { mnPopupModeFlags = nFlags; }
IsInPopupMode() const144cdf0e10cSrcweir 	sal_Bool			IsInPopupMode() const { return mbPopupMode; }
IsInCleanUp() const145cdf0e10cSrcweir 	sal_Bool			IsInCleanUp() const { return mbInCleanUp; }
IsPopupModeCanceled() const146cdf0e10cSrcweir 	sal_Bool			IsPopupModeCanceled() const { return mbPopupModeCanceled; }
IsPopupModeTearOff() const147cdf0e10cSrcweir 	sal_Bool			IsPopupModeTearOff() const { return mbPopupModeTearOff; }
148cdf0e10cSrcweir 
SetPopupModeEndHdl(const Link & rLink)149cdf0e10cSrcweir 	void			SetPopupModeEndHdl( const Link& rLink ) { maPopupModeEndHdl = rLink; }
GetPopupModeEndHdl() const150cdf0e10cSrcweir 	const Link& 	GetPopupModeEndHdl() const	{ return maPopupModeEndHdl; }
151cdf0e10cSrcweir 
GrabsFocus() const152cdf0e10cSrcweir     sal_Bool            GrabsFocus() const { return mbGrabFocus; }
153cdf0e10cSrcweir 
154cdf0e10cSrcweir 	static Point    CalcFloatingPosition( Window* pWindow, const Rectangle& rRect, sal_uLong nFlags, sal_uInt16& rArrangeIndex );
155cdf0e10cSrcweir };
156cdf0e10cSrcweir 
157cdf0e10cSrcweir #endif // _SV_FLOATWIN_HXX
158