summaryrefslogtreecommitdiff
path: root/vcl/inc/vcl/floatwin.hxx
blob: 7007c7ec77242689d46be0e798240397fddc9aed (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
 *
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 * 
 * Copyright 2000, 2010 Oracle and/or its affiliates.
 *
 * OpenOffice.org - a multi-platform office productivity suite
 *
 * This file is part of OpenOffice.org.
 *
 * OpenOffice.org is free software: you can redistribute it and/or modify
 * it under the terms of the GNU Lesser General Public License version 3
 * only, as published by the Free Software Foundation.
 *
 * OpenOffice.org is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU Lesser General Public License version 3 for more details
 * (a copy is included in the LICENSE file that accompanied this code).
 *
 * You should have received a copy of the GNU Lesser General Public License
 * version 3 along with OpenOffice.org.  If not, see
 * <http://www.openoffice.org/license.html>
 * for a copy of the LGPLv3 License.
 *
 ************************************************************************/

#ifndef _SV_FLOATWIN_HXX
#define _SV_FLOATWIN_HXX

#include <vcl/sv.h>
#include <vcl/dllapi.h>
#include <vcl/syswin.hxx>

class ToolBox;
class PopupModeEvent;

// ------------------------
// - FloatingWindow-Types -
// ------------------------

#define FLOATWIN_POPUPMODE_ALLOWTEAROFF 		((ULONG)0x00000001)
#define FLOATWIN_POPUPMODE_ANIMATIONSLIDE		((ULONG)0x00000002)
#define FLOATWIN_POPUPMODE_NOAUTOARRANGE		((ULONG)0x00000004)
#define FLOATWIN_POPUPMODE_NOANIMATION			((ULONG)0x00000008)
#define FLOATWIN_POPUPMODE_DOWN 				((ULONG)0x00000010)
#define FLOATWIN_POPUPMODE_UP					((ULONG)0x00000020)
#define FLOATWIN_POPUPMODE_LEFT 				((ULONG)0x00000040)
#define FLOATWIN_POPUPMODE_RIGHT				((ULONG)0x00000080)
#define FLOATWIN_POPUPMODE_NOFOCUSCLOSE 		((ULONG)0x00000100)
#define FLOATWIN_POPUPMODE_NOKEYCLOSE			((ULONG)0x00000200)
#define FLOATWIN_POPUPMODE_NOMOUSECLOSE 		((ULONG)0x00000400)
#define FLOATWIN_POPUPMODE_NOMOUSERECTCLOSE 	((ULONG)0x00000800)
#define FLOATWIN_POPUPMODE_ALLMOUSEBUTTONCLOSE	((ULONG)0x00001000)
#define FLOATWIN_POPUPMODE_NOAPPFOCUSCLOSE		((ULONG)0x00002000)
#define FLOATWIN_POPUPMODE_PATHMOUSECANCELCLICK ((ULONG)0x00004000)
#define FLOATWIN_POPUPMODE_NEWLEVEL 			((ULONG)0x00008000)
#define FLOATWIN_POPUPMODE_NOMOUSEUPCLOSE		((ULONG)0x00010000)
#define FLOATWIN_POPUPMODE_GRABFOCUS        	((ULONG)0x00020000)

#define FLOATWIN_POPUPMODEEND_CANCEL			((USHORT)0x0001)
#define FLOATWIN_POPUPMODEEND_TEAROFF			((USHORT)0x0002)
#define FLOATWIN_POPUPMODEEND_DONTCALLHDL		((USHORT)0x0004)
#define FLOATWIN_POPUPMODEEND_CLOSEALL			((USHORT)0x0008)

#define FLOATWIN_TITLE_NORMAL					((USHORT)0x0001)
#define FLOATWIN_TITLE_TEAROFF					((USHORT)0x0002)
#define FLOATWIN_TITLE_POPUP					((USHORT)0x0004)
#define FLOATWIN_TITLE_NONE 					((USHORT)0x0008)

// ------------------
// - FloatingWindow -
// ------------------

class VCL_DLLPUBLIC FloatingWindow : public SystemWindow
{
    class   ImplData;
private:
    FloatingWindow* mpNextFloat;
    Window* 		mpFirstPopupModeWin;
    ImplData*       mpImplData;
    Rectangle		maFloatRect;
    ULONG			mnPostId;
    ULONG			mnPopupModeFlags;
    USHORT			mnTitle;
    USHORT			mnOldTitle;
    BOOL			mbInPopupMode;
    BOOL			mbPopupMode;
    BOOL			mbPopupModeCanceled;
    BOOL			mbPopupModeTearOff;
    BOOL			mbMouseDown;
    BOOL			mbOldSaveBackMode;
    BOOL			mbGrabFocus;    // act as key input window, although focus is not set
    BOOL			mbInCleanUp;
    Link			maPopupModeEndHdl;

    SAL_DLLPRIVATE void    ImplCallPopupModeEnd();
    DECL_DLLPRIVATE_LINK(  ImplEndPopupModeHdl, void* );

    // Copy assignment is forbidden and not implemented.
    SAL_DLLPRIVATE         FloatingWindow (const FloatingWindow &);
    SAL_DLLPRIVATE         FloatingWindow & operator= (const FloatingWindow &);

protected:
    using Window::ImplInit;
    SAL_DLLPRIVATE void    ImplInit( Window* pParent, WinBits nStyle );
    SAL_DLLPRIVATE void    ImplInitSettings();
    SAL_DLLPRIVATE void    ImplLoadRes( const ResId& rResId );

public:
#define IMPL_FLOATWIN_HITTEST_OUTSIDE		((USHORT)0x0001)
#define IMPL_FLOATWIN_HITTEST_WINDOW		((USHORT)0x0002)
#define IMPL_FLOATWIN_HITTEST_RECT			((USHORT)0x0004)
    SAL_DLLPRIVATE FloatingWindow*  ImplFloatHitTest( Window* pReference, const Point& rPos, USHORT& rHitTest );
    SAL_DLLPRIVATE FloatingWindow*  ImplFindLastLevelFloat();
    SAL_DLLPRIVATE BOOL			    ImplIsFloatPopupModeWindow( const Window* pWindow );
    SAL_DLLPRIVATE void			    ImplSetMouseDown() { mbMouseDown = TRUE; }
    SAL_DLLPRIVATE BOOL    			ImplIsMouseDown() const  { return mbMouseDown; }
    SAL_DLLPRIVATE static Point    	ImplCalcPos( Window* pWindow,
                                                 const Rectangle& rRect, ULONG nFlags,
                                                 USHORT& rArrangeIndex );
    SAL_DLLPRIVATE void			    ImplEndPopupMode( USHORT nFlags = 0, ULONG nFocusId = 0 );
    SAL_DLLPRIVATE Rectangle&       ImplGetItemEdgeClipRect();
    SAL_DLLPRIVATE BOOL             ImplIsInPrivatePopupMode() const { return mbInPopupMode; }

public:
                    FloatingWindow( Window* pParent, WinBits nStyle = WB_STDFLOATWIN );
                    FloatingWindow( Window* pParent, const ResId& rResId );
                    ~FloatingWindow();

    virtual long	Notify( NotifyEvent& rNEvt );
    virtual void	StateChanged( StateChangedType nType );
    virtual void	DataChanged( const DataChangedEvent& rDCEvt );

    virtual void	PopupModeEnd();

    void			SetTitleType( USHORT nTitle );
    USHORT			GetTitleType() const { return mnTitle; }

    void			StartPopupMode( const Rectangle& rRect, ULONG nFlags = 0 );
    void			StartPopupMode( ToolBox* pBox, ULONG nFlags = 0  );
    void			EndPopupMode( USHORT nFlags = 0 );
    void			AddPopupModeWindow( Window* pWindow );
    void			RemovePopupModeWindow( Window* pWindow );
    ULONG			GetPopupModeFlags() const { return mnPopupModeFlags; }
    void			SetPopupModeFlags( ULONG nFlags ) { mnPopupModeFlags = nFlags; }
    BOOL			IsInPopupMode() const { return mbPopupMode; }
    BOOL			IsInCleanUp() const { return mbInCleanUp; }
    BOOL			IsPopupModeCanceled() const { return mbPopupModeCanceled; }
    BOOL			IsPopupModeTearOff() const { return mbPopupModeTearOff; }

    void			SetPopupModeEndHdl( const Link& rLink ) { maPopupModeEndHdl = rLink; }
    const Link& 	GetPopupModeEndHdl() const	{ return maPopupModeEndHdl; }

    BOOL            GrabsFocus() const { return mbGrabFocus; }

    static Point    CalcFloatingPosition( Window* pWindow, const Rectangle& rRect, ULONG nFlags, USHORT& rArrangeIndex );
};

#endif // _SV_FLOATWIN_HXX

/* vim:set shiftwidth=4 softtabstop=4 expandtab: */