dbaccess/source/ui/app/AppTitleWindow.cxx |   41 ++++++++++++------------------
 dbaccess/source/ui/app/AppTitleWindow.hxx |    3 --
 2 files changed, 18 insertions(+), 26 deletions(-)

New commits:
commit d10e8fb97981d12ff62eddebd4300f21c49a71c6
Author:     Caolán McNamara <caol...@redhat.com>
AuthorDate: Wed Aug 19 10:22:16 2020 +0100
Commit:     Caolán McNamara <caol...@redhat.com>
CommitDate: Wed Aug 19 14:27:34 2020 +0200

    put label inside another window to create the padding
    
    instead of using blank labels for spacing
    
    Change-Id: Ie3c7f761bccbaf916473e7ef92912bdb62e43c5b
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/100979
    Tested-by: Jenkins
    Reviewed-by: Caolán McNamara <caol...@redhat.com>

diff --git a/dbaccess/source/ui/app/AppTitleWindow.cxx 
b/dbaccess/source/ui/app/AppTitleWindow.cxx
index d6d121ba4909..f3a8023312c2 100644
--- a/dbaccess/source/ui/app/AppTitleWindow.cxx
+++ b/dbaccess/source/ui/app/AppTitleWindow.cxx
@@ -27,28 +27,24 @@ namespace dbaui
 {
 
 OTitleWindow::OTitleWindow(vcl::Window* _pParent, const char* pTitleId, 
WinBits _nBits, bool _bShift)
-: Window(_pParent,_nBits | WB_DIALOGCONTROL)
-, m_aSpace1(VclPtr<FixedText>::Create(this))
-, m_aSpace2(VclPtr<FixedText>::Create(this))
-, m_aTitle(VclPtr<FixedText>::Create(this))
-, m_pChild(nullptr)
-, m_bShift(_bShift)
+    : Window(_pParent,_nBits | WB_DIALOGCONTROL)
+    , m_aTitleFrame(VclPtr<vcl::Window>::Create(this))
+    , m_aTitle(VclPtr<FixedText>::Create(m_aTitleFrame, WB_VCENTER))
+    , m_pChild(nullptr)
+    , m_bShift(_bShift)
 {
     setTitle(pTitleId);
     SetBorderStyle(WindowBorderStyle::MONO);
     ImplInitSettings();
 
     const StyleSettings& rStyle = 
Application::GetSettings().GetStyleSettings();
-    vcl::Window* pWindows[] = { m_aSpace1.get(), m_aSpace2.get(), 
m_aTitle.get() };
-    for (vcl::Window* pWindow : pWindows)
-    {
-        vcl::Font aFont = pWindow->GetControlFont();
-        aFont.SetWeight(WEIGHT_BOLD);
-        pWindow->SetControlFont(aFont);
-        pWindow->SetControlForeground(rStyle.GetLightColor());
-        pWindow->SetControlBackground(rStyle.GetShadowColor());
-        pWindow->Show();
-    }
+    vcl::Font aFont = m_aTitle->GetControlFont();
+    aFont.SetWeight(WEIGHT_BOLD);
+    m_aTitle->SetControlFont(aFont);
+    m_aTitle->SetControlForeground(rStyle.GetLightColor());
+    m_aTitleFrame->SetBackground(rStyle.GetShadowColor());
+    m_aTitleFrame->Show();
+    m_aTitle->Show();
 }
 
 OTitleWindow::~OTitleWindow()
@@ -63,9 +59,8 @@ void OTitleWindow::dispose()
         m_pChild->Hide();
     }
     m_pChild.disposeAndClear();
-    m_aSpace1.disposeAndClear();
-    m_aSpace2.disposeAndClear();
     m_aTitle.disposeAndClear();
+    m_aTitleFrame.disposeAndClear();
     vcl::Window::dispose();
 }
 
@@ -87,12 +82,10 @@ void OTitleWindow::Resize()
     sal_Int32 nYOffset = aTextSize.Height();
     sal_Int32 nHeight = GetTextHeight() + 2*nYOffset;
 
-    m_aSpace1->SetPosSizePixel(  Point(SPACE_BORDER, SPACE_BORDER ),
-                                Size(nXOffset , nHeight - SPACE_BORDER) );
-    m_aSpace2->SetPosSizePixel(  Point(nXOffset + SPACE_BORDER, SPACE_BORDER ),
-                                Size(nOutputWidth - nXOffset - 2*SPACE_BORDER, 
nYOffset) );
-    m_aTitle->SetPosSizePixel(   Point(nXOffset + SPACE_BORDER, nYOffset + 
SPACE_BORDER),
-                                Size(nOutputWidth - nXOffset - 2*SPACE_BORDER, 
nHeight - nYOffset - SPACE_BORDER) );
+    m_aTitleFrame->SetPosSizePixel(Point(SPACE_BORDER, SPACE_BORDER),
+                                   Size(nOutputWidth - 2*SPACE_BORDER, nHeight 
- SPACE_BORDER));
+    m_aTitle->SetPosSizePixel(Point(nXOffset, 0),
+                              Size(nOutputWidth - nXOffset - 2*SPACE_BORDER, 
nHeight - SPACE_BORDER));
     if ( m_pChild )
     {
         m_pChild->SetPosSizePixel(  Point(m_bShift ? (nXOffset+SPACE_BORDER) : 
sal_Int32(SPACE_BORDER), nHeight + nXOffset + SPACE_BORDER),
diff --git a/dbaccess/source/ui/app/AppTitleWindow.hxx 
b/dbaccess/source/ui/app/AppTitleWindow.hxx
index c6a8d417df7f..ebb7fae7e42d 100644
--- a/dbaccess/source/ui/app/AppTitleWindow.hxx
+++ b/dbaccess/source/ui/app/AppTitleWindow.hxx
@@ -25,8 +25,7 @@ namespace dbaui
 {
     class OTitleWindow : public vcl::Window
     {
-        VclPtr<FixedText>   m_aSpace1;
-        VclPtr<FixedText>   m_aSpace2;
+        VclPtr<vcl::Window> m_aTitleFrame;
         VclPtr<FixedText>   m_aTitle;
         VclPtr<vcl::Window> m_pChild;
         bool                m_bShift;
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to