diff options
author | Markus Mohrhard <markus.mohrhard@googlemail.com> | 2017-10-08 01:28:14 +0200 |
---|---|---|
committer | Markus Mohrhard <markus.mohrhard@googlemail.com> | 2017-10-12 01:28:29 +0200 |
commit | 2dd1645d7cd12e8f5d8e950af3d156f8df2fa417 (patch) | |
tree | 680f01c504a885c342782a94e9a32078a8ecb5bf /vcl | |
parent | 4d1ee296def5fde9c77702d3d19d76be33cbdaad (diff) |
allow adding a menu to a modal dialog
Change-Id: I3da2ec747f73c44bf7bcb8a7ec3d116272dc806f
Reviewed-on: https://gerrit.libreoffice.org/43252
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Markus Mohrhard <markus.mohrhard@googlemail.com>
Diffstat (limited to 'vcl')
-rw-r--r-- | vcl/source/window/dialog.cxx | 32 |
1 files changed, 21 insertions, 11 deletions
diff --git a/vcl/source/window/dialog.cxx b/vcl/source/window/dialog.cxx index 84189899b775..a9e278111484 100644 --- a/vcl/source/window/dialog.cxx +++ b/vcl/source/window/dialog.cxx @@ -389,6 +389,18 @@ vcl::Window* Dialog::GetDefaultParent(WinBits nStyle) return pParent; } +VclPtr<vcl::Window> Dialog::AddBorderWindow(vcl::Window* pParent, WinBits nStyle) +{ + VclPtrInstance<ImplBorderWindow> pBorderWin( pParent, nStyle, BorderWindowStyle::Frame ); + SystemWindow::ImplInit( pBorderWin, nStyle & ~WB_BORDER, nullptr ); + pBorderWin->mpWindowImpl->mpClientWindow = this; + pBorderWin->GetBorder( mpWindowImpl->mnLeftBorder, mpWindowImpl->mnTopBorder, mpWindowImpl->mnRightBorder, mpWindowImpl->mnBottomBorder ); + mpWindowImpl->mpBorderWindow = pBorderWin; + mpWindowImpl->mpRealParent = pParent; + + return pBorderWin; +} + void Dialog::ImplInit( vcl::Window* pParent, WinBits nStyle, InitFlag eFlag ) { SystemWindowFlags nSysWinMode = Application::GetSystemWindowMode(); @@ -414,14 +426,9 @@ void Dialog::ImplInit( vcl::Window* pParent, WinBits nStyle, InitFlag eFlag ) (nSysWinMode & SystemWindowFlags::DIALOG) ) { // create window with a small border ? - if ( (nStyle & (WB_BORDER | WB_NOBORDER | WB_MOVEABLE | WB_SIZEABLE | WB_CLOSEABLE)) == WB_BORDER ) + if (mbForceBorderWindow || ((nStyle & (WB_BORDER | WB_NOBORDER | WB_MOVEABLE | WB_SIZEABLE | WB_CLOSEABLE)) == WB_BORDER )) { - VclPtrInstance<ImplBorderWindow> pBorderWin( pParent, nStyle, BorderWindowStyle::Frame ); - SystemWindow::ImplInit( pBorderWin, nStyle & ~WB_BORDER, nullptr ); - pBorderWin->mpWindowImpl->mpClientWindow = this; - pBorderWin->GetBorder( mpWindowImpl->mnLeftBorder, mpWindowImpl->mnTopBorder, mpWindowImpl->mnRightBorder, mpWindowImpl->mnBottomBorder ); - mpWindowImpl->mpBorderWindow = pBorderWin; - mpWindowImpl->mpRealParent = pParent; + AddBorderWindow(pParent, nStyle); } else { @@ -509,12 +516,13 @@ void Dialog::doDeferredInit(WinBits nBits) { VclPtr<vcl::Window> pParent = mpDialogParent; mpDialogParent = nullptr; - ImplInit(pParent, nBits, mnInitFlag); + ImplInit(pParent, nBits | WB_BORDER, mnInitFlag); mbIsDeferredInit = false; } Dialog::Dialog(vcl::Window* pParent, const OUString& rID, const OUString& rUIXMLDescription) : SystemWindow(WindowType::DIALOG) + , mbForceBorderWindow(false) , mnInitFlag(InitFlag::Default) , maID(rID) { @@ -522,8 +530,9 @@ Dialog::Dialog(vcl::Window* pParent, const OUString& rID, const OUString& rUIXML loadUI(pParent, OUStringToOString(rID, RTL_TEXTENCODING_UTF8), rUIXMLDescription); } -Dialog::Dialog(vcl::Window* pParent, const OUString& rID, const OUString& rUIXMLDescription, WindowType nType, InitFlag eFlag) +Dialog::Dialog(vcl::Window* pParent, const OUString& rID, const OUString& rUIXMLDescription, WindowType nType, InitFlag eFlag, bool bBorder) : SystemWindow(nType) + , mbForceBorderWindow(bBorder) , mnInitFlag(eFlag) , maID(rID) { @@ -533,6 +542,7 @@ Dialog::Dialog(vcl::Window* pParent, const OUString& rID, const OUString& rUIXML Dialog::Dialog(vcl::Window* pParent, WinBits nStyle, InitFlag eFlag) : SystemWindow(WindowType::DIALOG) + , mbForceBorderWindow(false) , mnInitFlag(eFlag) { ImplInitDialogData(); @@ -1356,8 +1366,8 @@ ModalDialog::ModalDialog( vcl::Window* pParent, WinBits nStyle ) : ImplInit( pParent, nStyle ); } -ModalDialog::ModalDialog( vcl::Window* pParent, const OUString& rID, const OUString& rUIXMLDescription ) : - Dialog(pParent, rID, rUIXMLDescription, WindowType::MODALDIALOG) +ModalDialog::ModalDialog( vcl::Window* pParent, const OUString& rID, const OUString& rUIXMLDescription, bool bBorder ) : + Dialog(pParent, rID, rUIXMLDescription, WindowType::MODALDIALOG, InitFlag::Default, bBorder) { } |