[Libreoffice-commits] core.git: include/vcl vcl/source
Markus Mohrhard
markus.mohrhard at googlemail.com
Wed Oct 11 23:28:50 UTC 2017
include/vcl/dialog.hxx | 6 ++++--
vcl/source/window/dialog.cxx | 32 +++++++++++++++++++++-----------
2 files changed, 25 insertions(+), 13 deletions(-)
New commits:
commit 2dd1645d7cd12e8f5d8e950af3d156f8df2fa417
Author: Markus Mohrhard <markus.mohrhard at googlemail.com>
Date: Sun Oct 8 01:28:14 2017 +0200
allow adding a menu to a modal dialog
Change-Id: I3da2ec747f73c44bf7bcb8a7ec3d116272dc806f
Reviewed-on: https://gerrit.libreoffice.org/43252
Tested-by: Jenkins <ci at libreoffice.org>
Reviewed-by: Markus Mohrhard <markus.mohrhard at googlemail.com>
diff --git a/include/vcl/dialog.hxx b/include/vcl/dialog.hxx
index 1ff5136fb41a..9130ee2e46cd 100644
--- a/include/vcl/dialog.hxx
+++ b/include/vcl/dialog.hxx
@@ -54,6 +54,7 @@ private:
bool mbInClose;
bool mbModalMode;
bool mbPaintComplete;
+ bool mbForceBorderWindow;
InitFlag mnInitFlag; // used for deferred init
VclPtr<VclButtonBox> mpActionArea;
@@ -63,6 +64,7 @@ private:
SAL_DLLPRIVATE void ImplInitDialogData();
SAL_DLLPRIVATE void ImplInitSettings();
+ SAL_DLLPRIVATE VclPtr<vcl::Window> AddBorderWindow(vcl::Window* pParent, WinBits nBits);
virtual void ApplySettings(vcl::RenderContext& rRenderContext) override;
@@ -100,7 +102,7 @@ public:
protected:
explicit Dialog( WindowType nType );
- explicit Dialog( vcl::Window* pParent, const OUString& rID, const OUString& rUIXMLDescription, WindowType nType, InitFlag eFlag = InitFlag::Default );
+ explicit Dialog( vcl::Window* pParent, const OUString& rID, const OUString& rUIXMLDescription, WindowType nType, InitFlag eFlag = InitFlag::Default, bool bBorder = false );
virtual void Draw( OutputDevice* pDev, const Point& rPos, const Size& rSize, DrawFlags nFlags ) override;
virtual void settingOptimalLayoutSize(Window *pBox) override;
@@ -189,7 +191,7 @@ class VCL_DLLPUBLIC ModalDialog : public Dialog
{
public:
explicit ModalDialog( vcl::Window* pParent, WinBits nStyle = WB_STDMODAL );
- explicit ModalDialog( vcl::Window* pParent, const OUString& rID, const OUString& rUIXMLDescription );
+ explicit ModalDialog( vcl::Window* pParent, const OUString& rID, const OUString& rUIXMLDescription, bool bBorder = false );
protected:
using Window::Show;
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)
{
}
More information about the Libreoffice-commits
mailing list