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_DIALOG_HXX
21 #define INCLUDED_VCL_DIALOG_HXX
23 #include <tools/solar.h>
24 #include <vcl/dllapi.h>
25 #include <vcl/syswin.hxx>
26 #include <vcl/timer.hxx>
27 #include <vcl/vclptr.hxx>
35 class VCL_DLLPUBLIC Dialog
: public SystemWindow
38 enum class InitFlag
{ Default
, NoParent
};
41 VclPtr
<Dialog
> mpPrevExecuteDlg
;
42 DialogImpl
* mpDialogImpl
;
43 long mnMousePositioned
;
48 InitFlag mnInitFlag
; // used for deferred init
50 VclPtr
<VclButtonBox
> mpActionArea
;
51 VclPtr
<VclBox
> mpContentArea
;
53 SAL_DLLPRIVATE
void ImplInitDialogData();
54 SAL_DLLPRIVATE
void ImplInitSettings();
56 virtual void ApplySettings(vcl::RenderContext
& rRenderContext
) SAL_OVERRIDE
;
58 SAL_DLLPRIVATE
Dialog (const Dialog
&) SAL_DELETED_FUNCTION
;
59 SAL_DLLPRIVATE Dialog
& operator= (const Dialog
&) SAL_DELETED_FUNCTION
;
61 DECL_DLLPRIVATE_LINK( ImplAsyncCloseHdl
, void* );
64 using Window::ImplInit
;
65 SAL_DLLPRIVATE
void ImplInit( vcl::Window
* pParent
, WinBits nStyle
, InitFlag eFlag
= InitFlag::Default
);
68 SAL_DLLPRIVATE
bool IsInClose() const { return mbInClose
; }
69 virtual void doDeferredInit(WinBits nBits
) SAL_OVERRIDE
;
72 explicit Dialog( WindowType nType
);
73 explicit Dialog( vcl::Window
* pParent
, const OUString
& rID
, const OUString
& rUIXMLDescription
, WindowType nType
, InitFlag eFlag
= InitFlag::Default
);
74 virtual void Draw( OutputDevice
* pDev
, const Point
& rPos
, const Size
& rSize
, sal_uLong nFlags
) SAL_OVERRIDE
;
75 virtual void settingOptimalLayoutSize(Window
*pBox
) SAL_OVERRIDE
;
78 friend class VclBuilder
;
79 void set_action_area(VclButtonBox
* pBox
);
80 void set_content_area(VclBox
* pBox
);
83 explicit Dialog( vcl::Window
* pParent
, WinBits nStyle
= WB_STDDIALOG
, InitFlag eFlag
= InitFlag::Default
);
84 explicit Dialog( vcl::Window
* pParent
, const OUString
& rID
, const OUString
& rUIXMLDescription
);
86 virtual void dispose() SAL_OVERRIDE
;
88 virtual bool Notify( NotifyEvent
& rNEvt
) SAL_OVERRIDE
;
89 virtual void StateChanged( StateChangedType nStateChange
) SAL_OVERRIDE
;
90 virtual void DataChanged( const DataChangedEvent
& rDCEvt
) SAL_OVERRIDE
;
92 virtual void queue_resize(StateChangedType eReason
= StateChangedType::Layout
) SAL_OVERRIDE
;
93 virtual bool set_property(const OString
&rKey
, const OString
&rValue
) SAL_OVERRIDE
;
94 VclButtonBox
* get_action_area() { return mpActionArea
; }
95 VclBox
* get_content_area() { return mpContentArea
; }
97 virtual bool Close() SAL_OVERRIDE
;
99 virtual short Execute();
100 bool IsInExecute() const { return mbInExecute
; }
102 // Dialog::Execute replacement API
104 // Link impl: DECL_LINK( MyEndDialogHdl, Dialog* ); <= param is dialog just ended
105 virtual void StartExecuteModal( const Link
<>& rEndDialogHdl
);
106 long GetResult() const;
108 bool ImplStartExecuteModal();
109 static void ImplEndExecuteModal();
112 // Dialog::Execute replacement API
115 void EndDialog( long nResult
= 0 );
116 static void EndAllDialogs( vcl::Window
* pParent
=NULL
);
118 void GetDrawWindowBorder( sal_Int32
& rLeftBorder
, sal_Int32
& rTopBorder
,
119 sal_Int32
& rRightBorder
, sal_Int32
& rBottomBorder
) const;
121 void SetModalInputMode( bool bModal
);
122 void SetModalInputMode( bool bModal
, bool bSubModalDialogs
);
123 bool IsModalInputMode() const { return mbModalMode
; }
125 void GrabFocusToFirstControl();
128 // - ModelessDialog -
129 class VCL_DLLPUBLIC ModelessDialog
: public Dialog
131 ModelessDialog (const ModelessDialog
&) SAL_DELETED_FUNCTION
;
132 ModelessDialog
& operator= (const ModelessDialog
&) SAL_DELETED_FUNCTION
;
135 explicit ModelessDialog( vcl::Window
* pParent
, const OUString
& rID
, const OUString
& rUIXMLDescription
, Dialog::InitFlag eFlag
= Dialog::InitFlag::Default
);
139 class VCL_DLLPUBLIC ModalDialog
: public Dialog
142 explicit ModalDialog( vcl::Window
* pParent
, WinBits nStyle
= WB_STDMODAL
);
143 explicit ModalDialog( vcl::Window
* pParent
, const OUString
& rID
, const OUString
& rUIXMLDescription
);
147 void Show( bool bVisible
= true );
153 SAL_DLLPRIVATE
ModalDialog (const ModalDialog
&) SAL_DELETED_FUNCTION
;
154 SAL_DLLPRIVATE ModalDialog
& operator= (const ModalDialog
&) SAL_DELETED_FUNCTION
;
157 #endif // INCLUDED_VCL_DIALOG_HXX
159 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */