[Libreoffice-commits] .: Branch 'feature/cmclayout' - 2 commits - sfx2/source sw/source vcl/inc vcl/source vcl/unx

Caolán McNamara caolan at kemper.freedesktop.org
Fri May 18 06:18:06 PDT 2012


 sfx2/source/dialog/tabdlg.cxx            |    4 -
 sw/source/ui/dialog/wordcountdialog.cxx  |    8 ---
 vcl/inc/vcl/dialog.hxx                   |   12 ++++
 vcl/inc/vcl/layout.hxx                   |   14 ++++-
 vcl/inc/vcl/settings.hxx                 |   40 +++++++++++++++
 vcl/source/app/settings.cxx              |    4 +
 vcl/source/window/builder.cxx            |    2 
 vcl/source/window/dialog.cxx             |   70 +++++++++++++++++++++-----
 vcl/source/window/layout.cxx             |   81 ++++++++++++++++---------------
 vcl/unx/gtk/gdi/salnativewidgets-gtk.cxx |   49 ++++++++++++++++++
 10 files changed, 217 insertions(+), 67 deletions(-)

New commits:
commit 5335e33f000e2482a7318dec01599476970aa996
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Fri May 18 14:05:20 2012 +0100

    and set 3dlook for reused toplevel dialogs

diff --git a/vcl/source/window/builder.cxx b/vcl/source/window/builder.cxx
index 183b718..380bebc 100644
--- a/vcl/source/window/builder.cxx
+++ b/vcl/source/window/builder.cxx
@@ -201,7 +201,7 @@ Window *VclBuilder::insertObject(Window *pParent, const rtl::OString &rClass, co
         pCurrentChild = m_pParent;
         //toplevels default to resizable
         if (pCurrentChild->IsDialog())
-            pCurrentChild->SetStyle(pCurrentChild->GetStyle() | WB_SIZEMOVE);
+            pCurrentChild->SetStyle(pCurrentChild->GetStyle() | WB_SIZEMOVE | WB_3DLOOK);
     }
     else
     {
commit 408e45dc0359e2424cc3d9b181f3649e3c869f54
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Fri May 18 13:48:13 2012 +0100

    implement sucking in the padding from the theme
    
    pretty up dialogs, centralize adding the borders into
    VclContainer, reduce default space between buttons

diff --git a/sfx2/source/dialog/tabdlg.cxx b/sfx2/source/dialog/tabdlg.cxx
index 474259d..33cb57f 100644
--- a/sfx2/source/dialog/tabdlg.cxx
+++ b/sfx2/source/dialog/tabdlg.cxx
@@ -523,12 +523,8 @@ void SfxTabDialog::Init_Impl( sal_Bool bFmtFlag, const String* pUserButtonText )
     rtl::OString sFill(RTL_CONSTASCII_STRINGPARAM("fill"));
     rtl::OString sExpand(RTL_CONSTASCII_STRINGPARAM("expand"));
     rtl::OString sPackType(RTL_CONSTASCII_STRINGPARAM("pack-type"));
-    rtl::OString sBorderWidth(RTL_CONSTASCII_STRINGPARAM("border-width"));
 
     vbox.setChildProperty(sFill, true);
-    //TO-DO, when vcontent_area belongs to dialog via builder, this becomes
-    //content-area-border on the dialog
-    vbox.setChildProperty(sBorderWidth, sal_Int32(7));
 
     action_area.setChildProperty(sFill, true);
 
diff --git a/sw/source/ui/dialog/wordcountdialog.cxx b/sw/source/ui/dialog/wordcountdialog.cxx
index 741436f..b7ed417 100644
--- a/sw/source/ui/dialog/wordcountdialog.cxx
+++ b/sw/source/ui/dialog/wordcountdialog.cxx
@@ -87,12 +87,8 @@ SwWordCountDialog::SwWordCountDialog(Dialog* pParent)
     rtl::OString sFill(RTL_CONSTASCII_STRINGPARAM("fill"));
     rtl::OString sExpand(RTL_CONSTASCII_STRINGPARAM("expand"));
     rtl::OString sPackType(RTL_CONSTASCII_STRINGPARAM("pack-type"));
-    rtl::OString sBorderWidth(RTL_CONSTASCII_STRINGPARAM("border-width"));
 
     vbox.setChildProperty(sFill, true);
-    //TO-DO, when vcontent_area belongs to dialog via builder, this becomes
-    //content-area-border on the dialog
-    vbox.setChildProperty(sBorderWidth, sal_Int32(7));
 
     action_area.setChildProperty(sFill, true);
 
@@ -105,7 +101,7 @@ SwWordCountDialog::SwWordCountDialog(Dialog* pParent)
     aCurrentSelectionLine.setChildProperty(sExpand, true);
 
     aSelectionBox.setChildProperty(sFill, true);
-    aSelectionBox.setChildProperty(sBorderWidth, sal_Int32(7));
+    aSelectionBox.set_border_width(7);
 
     aSelectionRow1.setChildProperty(sFill, true);
     aSelectionRow1.setChildProperty(sExpand, true);
@@ -130,7 +126,7 @@ SwWordCountDialog::SwWordCountDialog(Dialog* pParent)
     aDocLine.setChildProperty(sExpand, true);
 
     aDocBox.setChildProperty(sFill, true);
-    aDocBox.setChildProperty(sBorderWidth, sal_Int32(7));
+    aDocBox.set_border_width(7);
 
     aDocRow1.setChildProperty(sFill, true);
     aDocRow1.setChildProperty(sExpand, true);
diff --git a/vcl/inc/vcl/dialog.hxx b/vcl/inc/vcl/dialog.hxx
index 92b29bb..39e50e5 100644
--- a/vcl/inc/vcl/dialog.hxx
+++ b/vcl/inc/vcl/dialog.hxx
@@ -55,6 +55,7 @@ private:
     sal_Bool            mbInClose;
     sal_Bool            mbModalMode;
     sal_Int8        mnCancelClose;  //liuchen 2009-7-22, support Excel VBA UserForm_QueryClose event
+    int             m_nBorderWidth;
     Timer           maLayoutTimer;
 
     SAL_DLLPRIVATE void    ImplInitDialogData();
@@ -91,6 +92,17 @@ public:
     virtual Size    GetOptimalSize(WindowSizeType eType) const;
     virtual void    Resize();
     bool            isLayoutEnabled() const;
+    virtual bool set_property(const rtl::OString &rKey, const rtl::OString &rValue);
+
+    void set_border_width(int nBorderWidth)
+    {
+        m_nBorderWidth = nBorderWidth;
+    }
+    int get_border_width() const
+    {
+        return m_nBorderWidth;
+    }
+
 
     virtual sal_Bool    Close();
 
diff --git a/vcl/inc/vcl/layout.hxx b/vcl/inc/vcl/layout.hxx
index 1840fb4..c2ed2ed 100644
--- a/vcl/inc/vcl/layout.hxx
+++ b/vcl/inc/vcl/layout.hxx
@@ -35,13 +35,25 @@
 class VCL_DLLPUBLIC VclContainer : public Window
 {
 public:
-    VclContainer(Window *pParent) : Window(pParent) {}
+    VclContainer(Window *pParent) : Window(pParent), m_nBorderWidth(0) {}
     virtual Size GetOptimalSize(WindowSizeType eType) const;
     using Window::SetPosSizePixel;
     virtual void SetPosSizePixel(const Point& rNewPos, const Size& rNewSize);
+    virtual bool set_property(const rtl::OString &rKey, const rtl::OString &rValue);
+
+    void set_border_width(int nBorderWidth)
+    {
+        m_nBorderWidth = nBorderWidth;
+    }
+    int get_border_width() const
+    {
+        return m_nBorderWidth;
+    }
 protected:
     virtual Size calculateRequisition() const = 0;
     virtual void setAllocation(const Size &rAllocation) = 0;
+private:
+    int m_nBorderWidth;
 };
 
 enum VclPackType
diff --git a/vcl/inc/vcl/settings.hxx b/vcl/inc/vcl/settings.hxx
index f69f91f..863a617 100644
--- a/vcl/inc/vcl/settings.hxx
+++ b/vcl/inc/vcl/settings.hxx
@@ -212,6 +212,34 @@ public:
                                         { return !(*this == rSet); }
 };
 
+struct DialogStyle
+{
+    int content_area_border;
+    int content_area_spacing;
+    int button_spacing;
+    int action_area_border;
+    DialogStyle()
+        : content_area_border(2)
+        , content_area_spacing(0)
+        , button_spacing(6)
+        , action_area_border(5)
+    {}
+};
+
+struct FrameStyle
+{
+    int left;
+    int right;
+    int top;
+    int bottom;
+    FrameStyle()
+        : left(2)
+        , right(2)
+        , top(2)
+        , bottom(2)
+    {}
+};
+
 // -----------------
 // - ImplStyleData -
 // -----------------
@@ -325,6 +353,8 @@ private:
     sal_Bool                            mbHideDisabledMenuItems;
     sal_Bool                            mnAcceleratorsInContextMenus;
     Wallpaper                       maWorkspaceGradient;
+    DialogStyle                     maDialogStyle;
+    FrameStyle                      maFrameStyle;
     const void*                     mpFontOptions;
 };
 
@@ -831,6 +861,16 @@ public:
     void                            SetWorkspaceGradient( const Wallpaper& rWall )
                                         { CopyData(); mpData->maWorkspaceGradient = rWall; }
 
+    const DialogStyle&              GetDialogStyle() const
+                                        { return mpData->maDialogStyle; }
+    void                            SetDialogStyle( const DialogStyle& rStyle )
+                                        { CopyData(); mpData->maDialogStyle = rStyle; }
+
+    const FrameStyle&               GetFrameStyle() const
+                                        { return mpData->maFrameStyle; }
+    void                            SetFrameStyle( const FrameStyle& rStyle )
+                                        { CopyData(); mpData->maFrameStyle = rStyle; }
+
     void                            SetStandardStyles();
 
     const StyleSettings&            operator =( const StyleSettings& rSet );
diff --git a/vcl/source/app/settings.cxx b/vcl/source/app/settings.cxx
index c95d561..6b4791e 100644
--- a/vcl/source/app/settings.cxx
+++ b/vcl/source/app/settings.cxx
@@ -309,7 +309,9 @@ ImplStyleData::ImplStyleData( const ImplStyleData& rData ) :
     maFieldFont( rData.maFieldFont ),
     maIconFont( rData.maIconFont ),
     maGroupFont( rData.maGroupFont ),
-    maWorkspaceGradient( rData.maWorkspaceGradient )
+    maWorkspaceGradient( rData.maWorkspaceGradient ),
+    maDialogStyle( rData.maDialogStyle ),
+    maFrameStyle( rData.maFrameStyle )
 {
     mnRefCount                  = 1;
     mnBorderSize                = rData.mnBorderSize;
diff --git a/vcl/source/window/dialog.cxx b/vcl/source/window/dialog.cxx
index fd189ed..d484213 100644
--- a/vcl/source/window/dialog.cxx
+++ b/vcl/source/window/dialog.cxx
@@ -192,19 +192,30 @@ void ImplWindowAutoMnemonic( Window* pWindow )
     }
 }
 
-static Window* getActionAreaButtonList(Dialog *pDialog)
+static VclButtonBox* getActionArea(Dialog *pDialog)
 {
-    Window* pChild;
+    VclButtonBox *pButtonBox = NULL;
     if (pDialog->isLayoutEnabled())
     {
-        VclBox *pBox = dynamic_cast<VclBox*>(pDialog->GetWindow(WINDOW_FIRSTCHILD));
-        VclButtonBox *pButtonBox = pBox ?
-            dynamic_cast<VclButtonBox*>(pBox->GetWindow(WINDOW_LASTCHILD)) : 0;
-        pChild = pButtonBox ? pButtonBox->GetWindow(WINDOW_FIRSTCHILD) : 0;
+        Window *pBox = pDialog->GetWindow(WINDOW_FIRSTCHILD);
+        Window *pChild = pBox->GetWindow(WINDOW_LASTCHILD);
+        while (pChild)
+        {
+            pButtonBox = dynamic_cast<VclButtonBox*>(pChild);
+            if (pButtonBox)
+                break;
+            pChild = pChild->GetWindow(WINDOW_PREV);
+        }
     }
-    else
-        pChild = pDialog->GetWindow( WINDOW_FIRSTCHILD );
-    return pChild;
+    return pButtonBox;
+}
+
+static Window* getActionAreaButtonList(Dialog *pDialog)
+{
+    VclButtonBox* pButtonBox = getActionArea(pDialog);
+    if (pButtonBox)
+        return pButtonBox->GetWindow(WINDOW_FIRSTCHILD);
+    return pDialog->GetWindow(WINDOW_FIRSTCHILD);
 }
 
 // =======================================================================
@@ -307,6 +318,7 @@ void Dialog::ImplInitDialogData()
     mbInClose               = sal_False;
     mbModalMode             = sal_False;
     mnMousePositioned       = 0;
+    m_nBorderWidth          = 0;
     mpDialogImpl            = new DialogImpl;
 
     //To-Do, reuse maResizeTimer
@@ -432,7 +444,6 @@ void Dialog::ImplInitSettings()
     // fallback to settings color
     else
         SetBackground( GetSettings().GetStyleSettings().GetDialogColor() );
-
 }
 
 // -----------------------------------------------------------------------
@@ -544,6 +555,8 @@ void Dialog::StateChanged( StateChangedType nType )
             //resize dialog to fit requisition on initial show
             const Window *pContainer = GetWindow(WINDOW_FIRSTCHILD);
             Size aSize = pContainer->get_preferred_size();
+            aSize.Height() += 2*m_nBorderWidth;
+            aSize.Width() += 2*m_nBorderWidth;
 
             Size aMax = GetOptimalSize(WINDOWSIZE_MAXIMUM);
             aSize.Width() = std::min(aMax.Width(), aSize.Width());
@@ -1048,17 +1061,35 @@ Size Dialog::GetOptimalSize(WindowSizeType eType) const
         return SystemWindow::GetOptimalSize(eType);
 
     Size aSize = GetWindow(WINDOW_FIRSTCHILD)->GetOptimalSize(eType);
+    aSize.Height() += 2*m_nBorderWidth;
+    aSize.Width() += 2*m_nBorderWidth;
     return Window::CalcWindowSize(aSize);
 }
 
 IMPL_LINK( Dialog, ImplHandleLayoutTimerHdl, void*, EMPTYARG )
 {
-    assert(isLayoutEnabled());
+    VclBox *pBox = dynamic_cast<VclBox*>(GetWindow(WINDOW_FIRSTCHILD));
     Size aSize = GetSizePixel();
-    aSize.Width() -= mpWindowImpl->mnLeftBorder + mpWindowImpl->mnRightBorder;
-    aSize.Height() -= mpWindowImpl->mnTopBorder + mpWindowImpl->mnBottomBorder;
-    Point aPos(mpWindowImpl->mnLeftBorder, mpWindowImpl->mnTopBorder);
-    GetWindow(WINDOW_FIRSTCHILD)->SetPosSizePixel(aPos, aSize);
+    aSize.Width() -= mpWindowImpl->mnLeftBorder + mpWindowImpl->mnRightBorder
+        + 2 * m_nBorderWidth;
+    aSize.Height() -= mpWindowImpl->mnTopBorder + mpWindowImpl->mnBottomBorder
+        + 2 * m_nBorderWidth;
+    Point aPos(mpWindowImpl->mnLeftBorder + m_nBorderWidth,
+        mpWindowImpl->mnTopBorder + m_nBorderWidth);
+
+    const DialogStyle& rDialogStyle =
+        GetSettings().GetStyleSettings().GetDialogStyle();
+    pBox->set_border_width(rDialogStyle.content_area_border);
+    pBox->set_spacing(rDialogStyle.content_area_spacing);
+
+    VclButtonBox *pActionArea = getActionArea(this);
+    if (pActionArea)
+    {
+        pActionArea->set_border_width(rDialogStyle.action_area_border);
+        pActionArea->set_spacing(rDialogStyle.button_spacing);
+    }
+
+    pBox->SetPosSizePixel(aPos, aSize);
     return 0;
 }
 
@@ -1073,6 +1104,15 @@ void Dialog::Resize()
     maLayoutTimer.Start();
 }
 
+bool Dialog::set_property(const rtl::OString &rKey, const rtl::OString &rValue)
+{
+    if (rKey.equalsL(RTL_CONSTASCII_STRINGPARAM("border-width")))
+        set_border_width(rValue.toInt32());
+    else
+        return SystemWindow::set_property(rKey, rValue);
+    return true;
+}
+
 // -----------------------------------------------------------------------
 
 ModelessDialog::ModelessDialog( Window* pParent, const ResId& rResId ) :
diff --git a/vcl/source/window/layout.cxx b/vcl/source/window/layout.cxx
index b3789a5..ef31201 100644
--- a/vcl/source/window/layout.cxx
+++ b/vcl/source/window/layout.cxx
@@ -33,13 +33,34 @@ Size VclContainer::GetOptimalSize(WindowSizeType eType) const
 {
     if (eType == WINDOWSIZE_MAXIMUM)
         return Window::GetOptimalSize(eType);
-    return calculateRequisition();
+
+    Size aSize = calculateRequisition();
+    aSize.Width() += m_nBorderWidth*2;
+    aSize.Height() += m_nBorderWidth*2;
+    return aSize;
 }
 
 void VclContainer::SetPosSizePixel(const Point& rAllocPos, const Size& rAllocation)
 {
-    Window::SetPosSizePixel(rAllocPos, rAllocation);
-    setAllocation(rAllocation);
+    Size aAllocation = rAllocation;
+    aAllocation.Width() -= m_nBorderWidth*2;
+    aAllocation.Height() -= m_nBorderWidth*2;
+
+    Point aAllocPos = rAllocPos;
+    aAllocPos.X() += m_nBorderWidth;
+    aAllocPos.Y() += m_nBorderWidth;
+
+    Window::SetPosSizePixel(aAllocPos, aAllocation);
+    setAllocation(aAllocation);
+}
+
+bool VclContainer::set_property(const rtl::OString &rKey, const rtl::OString &rValue)
+{
+    if (rKey.equalsL(RTL_CONSTASCII_STRINGPARAM("border-width")))
+        set_border_width(rValue.toInt32());
+    else
+        return Window::set_property(rKey, rValue);
+    return true;
 }
 
 Size VclBox::calculateRequisition() const
@@ -79,12 +100,6 @@ Size VclBox::calculateRequisition() const
         setPrimaryDimension(aSize, nPrimaryDimension + m_nSpacing * (nVisibleChildren-1));
     }
 
-    rtl::OString sBorderWidth(RTL_CONSTASCII_STRINGPARAM("border-width"));
-    sal_Int32 nBorderWidth = getWidgetProperty<sal_Int32>(sBorderWidth);
-
-    aSize.Width() += nBorderWidth*2;
-    aSize.Height() += nBorderWidth*2;
-
     return aSize;
 }
 
@@ -106,16 +121,9 @@ void VclBox::setAllocation(const Size &rAllocation)
     if (!nVisibleChildren)
         return;
 
-    rtl::OString sBorderWidth(RTL_CONSTASCII_STRINGPARAM("border-width"));
-    sal_Int32 nBorderWidth = getWidgetProperty<sal_Int32>(sBorderWidth);
-
-    Size aAllocation = rAllocation;
-    aAllocation.Width() -= nBorderWidth*2;
-    aAllocation.Height() -= nBorderWidth*2;
-
-    long nAllocPrimaryDimension = getPrimaryDimension(aAllocation);
+    long nAllocPrimaryDimension = getPrimaryDimension(rAllocation);
 
-    long nHomogeneousDimension, nExtraSpace = 0;
+    long nHomogeneousDimension = 0, nExtraSpace = 0;
     if (m_bHomogeneous)
     {
         nHomogeneousDimension = ((nAllocPrimaryDimension -
@@ -124,9 +132,7 @@ void VclBox::setAllocation(const Size &rAllocation)
     else if (nExpandChildren)
     {
         Size aRequisition = calculateRequisition();
-        aRequisition.Width() -= nBorderWidth*2;
-        aRequisition.Height() -= nBorderWidth*2;
-        nExtraSpace = (getPrimaryDimension(aAllocation) - getPrimaryDimension(aRequisition)) / nExpandChildren;
+        nExtraSpace = (getPrimaryDimension(rAllocation) - getPrimaryDimension(aRequisition)) / nExpandChildren;
     }
 
     rtl::OString sPadding(RTL_CONSTASCII_STRINGPARAM("padding"));
@@ -135,7 +141,7 @@ void VclBox::setAllocation(const Size &rAllocation)
 
     for (sal_Int32 ePackType = VCL_PACK_START; ePackType <= VCL_PACK_END; ++ePackType)
     {
-        Point aPos(nBorderWidth, nBorderWidth);
+        Point aPos(0, 0);
         if (ePackType == VCL_PACK_END)
         {
             long nPrimaryCoordinate = getPrimaryCoordinate(aPos);
@@ -166,7 +172,7 @@ void VclBox::setAllocation(const Size &rAllocation)
                 if (bExpand)
                     setPrimaryDimension(aBoxSize, nPrimaryDimension + nExtraSpace);
             }
-            setSecondaryDimension(aBoxSize, getSecondaryDimension(aAllocation));
+            setSecondaryDimension(aBoxSize, getSecondaryDimension(rAllocation));
 
             Point aChildPos(aPos);
             Size aChildSize(aBoxSize);
@@ -211,7 +217,7 @@ bool VclBox::set_property(const rtl::OString &rKey, const rtl::OString &rValue)
     else if (rKey.equalsL(RTL_CONSTASCII_STRINGPARAM("homogeneous")))
         set_homogeneous(toBool(rValue));
     else
-        return Window::set_property(rKey, rValue);
+        return VclContainer::set_property(rKey, rValue);
     return true;
 }
 
@@ -277,12 +283,6 @@ void VclButtonBox::setAllocation(const Size &rAllocation)
     if (!nVisibleChildren)
         return;
 
-    rtl::OString sChildInternalPadX(RTL_CONSTASCII_STRINGPARAM("child-internal-pad-x"));
-    sal_Int32 nChildInternalPadX = getWidgetStyleProperty<sal_Int32>(sChildInternalPadX, DEFAULT_CHILD_INTERNAL_PAD_X);
-    rtl::OString sChildInternalPadY(RTL_CONSTASCII_STRINGPARAM("child-internal-pad-y"));
-    sal_Int32 nChildInternalPadY = getWidgetStyleProperty<sal_Int32>(sChildInternalPadY, DEFAULT_CHILD_INTERNAL_PAD_Y);
-    Size aChildPad(nChildInternalPadX, nChildInternalPadY);
-
     Size aSize = rAllocation;
 
     long nAllocPrimaryDimension = getPrimaryDimension(rAllocation);
@@ -290,9 +290,7 @@ void VclButtonBox::setAllocation(const Size &rAllocation)
     long nHomogeneousDimension = ((getPrimaryDimension(aRequisition) -
         (nVisibleChildren - 1) * m_nSpacing)) / nVisibleChildren;
 
-    nHomogeneousDimension = nHomogeneousDimension - getPrimaryDimension(aChildPad) * 2;
-
-    Point aPos(nChildInternalPadX, nChildInternalPadY);
+    Point aPos(0, 0);
     long nPrimaryCoordinate = getPrimaryCoordinate(aPos);
     setPrimaryCoordinate(aPos, nPrimaryCoordinate + nAllocPrimaryDimension
         - getPrimaryDimension(aRequisition));
@@ -309,8 +307,7 @@ void VclButtonBox::setAllocation(const Size &rAllocation)
         pChild->SetPosSizePixel(aPos, aChildSize);
 
         nPrimaryCoordinate = getPrimaryCoordinate(aPos);
-        setPrimaryCoordinate(aPos, nPrimaryCoordinate + nHomogeneousDimension + m_nSpacing +
-            getPrimaryDimension(aChildPad) * 2);
+        setPrimaryCoordinate(aPos, nPrimaryCoordinate + nHomogeneousDimension + m_nSpacing);
     }
 }
 
@@ -554,7 +551,6 @@ Size VclFrame::calculateRequisition() const
     if (pChild && pChild->IsVisible())
         aRet = pChild->GetOptimalSize(WINDOWSIZE_PREFERRED);
 
-    //To-Do, padding, borders, from style/theme
     if (pLabel && pLabel->IsVisible())
     {
         Size aLabelSize = pLabel->GetOptimalSize(WINDOWSIZE_PREFERRED);
@@ -562,13 +558,21 @@ Size VclFrame::calculateRequisition() const
         aRet.Width() = std::max(aLabelSize.Width(), aRet.Width());
     }
 
+    const FrameStyle &rFrameStyle =
+        GetSettings().GetStyleSettings().GetFrameStyle();
+    aRet.Width() += rFrameStyle.left + rFrameStyle.right;
+    aRet.Height() += rFrameStyle.top + rFrameStyle.bottom;
+
     return aRet;
 }
 
 void VclFrame::setAllocation(const Size &rAllocation)
 {
-    Size aAllocation(rAllocation);
-    Point aChildPos(0, 0);
+    const FrameStyle &rFrameStyle =
+        GetSettings().GetStyleSettings().GetFrameStyle();
+    Size aAllocation(rAllocation.Width() - rFrameStyle.left - rFrameStyle.right,
+        rAllocation.Height() - rFrameStyle.top - rFrameStyle.bottom);
+    Point aChildPos(rFrameStyle.left, rFrameStyle.top);
 
     WindowImpl* pWindowImpl = ImplGetWindowImpl();
 
@@ -578,7 +582,6 @@ void VclFrame::setAllocation(const Size &rAllocation)
 
     if (pLabel && pLabel->IsVisible())
     {
-        //To-Do, borders etc.
         Size aLabelSize = pLabel->GetOptimalSize(WINDOWSIZE_PREFERRED);
         aLabelSize.Height() = std::min(aLabelSize.Height(), aAllocation.Height());
         aLabelSize.Width() = std::min(aLabelSize.Width(), aAllocation.Width());
diff --git a/vcl/unx/gtk/gdi/salnativewidgets-gtk.cxx b/vcl/unx/gtk/gdi/salnativewidgets-gtk.cxx
index 0b723e1..90a43be 100644
--- a/vcl/unx/gtk/gdi/salnativewidgets-gtk.cxx
+++ b/vcl/unx/gtk/gdi/salnativewidgets-gtk.cxx
@@ -108,6 +108,8 @@ struct NWFWidgetData
     GtkWidget *  gHScale;
     GtkWidget *  gVScale;
     GtkWidget *  gVSeparator;
+    GtkWidget *  gDialog;
+    GtkWidget *  gFrame;
 
     NWPixmapCacheList* gNWPixmapCacheList;
     NWPixmapCache* gCacheTabItems;
@@ -147,6 +149,8 @@ struct NWFWidgetData
         gHScale( NULL ),
         gVScale( NULL ),
         gVSeparator ( NULL ),
+        gDialog( NULL ),
+        gFrame( NULL ),
         gNWPixmapCacheList( NULL ),
         gCacheTabItems( NULL ),
         gCacheTabPages( NULL )
@@ -189,6 +193,8 @@ static void NWEnsureGTKToolbar           ( SalX11Screen nScreen );
 static void NWEnsureGTKMenubar           ( SalX11Screen nScreen );
 static void NWEnsureGTKMenu              ( SalX11Screen nScreen );
 static void NWEnsureGTKTooltip           ( SalX11Screen nScreen );
+static void NWEnsureGTKDialog            ( SalX11Screen nScreen );
+static void NWEnsureGTKFrame             ( SalX11Screen nScreen );
 static void NWEnsureGTKProgressBar       ( SalX11Screen nScreen );
 static void NWEnsureGTKTreeView          ( SalX11Screen nScreen );
 static void NWEnsureGTKSlider            ( SalX11Screen nScreen );
@@ -478,6 +484,8 @@ void GtkData::deInitNWF( void )
             gtk_widget_destroy( gWidgetData[i].gMenuWidget );
         if( gWidgetData[i].gTooltipPopup )
             gtk_widget_destroy( gWidgetData[i].gTooltipPopup );
+        if( gWidgetData[i].gDialog )
+            gtk_widget_destroy( gWidgetData[i].gDialog );
         delete gWidgetData[i].gCacheTabPages;
         gWidgetData[i].gCacheTabPages = NULL;
         delete gWidgetData[i].gCacheTabItems;
@@ -3389,6 +3397,8 @@ void GtkSalGraphics::updateSettings( AllSettings& rSettings )
     NWEnsureGTKScrollbars( m_nXScreen );
     NWEnsureGTKEditBox( m_nXScreen );
     NWEnsureGTKTooltip( m_nXScreen );
+    NWEnsureGTKDialog( m_nXScreen );
+    NWEnsureGTKFrame( m_nXScreen );
 
 #if OSL_DEBUG_LEVEL > 2
     printStyleColors( pStyle );
@@ -3410,6 +3420,22 @@ void GtkSalGraphics::updateSettings( AllSettings& rSettings )
     aTextColor = getColor( pTooltipStyle->fg[ GTK_STATE_NORMAL ] );
     aStyleSet.SetHelpTextColor( aTextColor );
 
+    DialogStyle aDialogStyle(aStyleSet.GetDialogStyle());
+    gtk_widget_style_get (gWidgetData[m_nXScreen].gDialog,
+        "content-area-border", &aDialogStyle.content_area_border,
+        "content-area-spacing", &aDialogStyle.content_area_spacing,
+        "button-spacing", &aDialogStyle.button_spacing,
+        "action-area-border", &aDialogStyle.action_area_border,
+        NULL);
+    aStyleSet.SetDialogStyle(aDialogStyle);
+
+    FrameStyle aFrameStyle(aStyleSet.GetFrameStyle());
+    aFrameStyle.left = aFrameStyle.right =
+        gWidgetData[m_nXScreen].gFrame->style->xthickness;
+    aFrameStyle.top = aFrameStyle.bottom =
+        gWidgetData[m_nXScreen].gFrame->style->ythickness;
+    aStyleSet.SetFrameStyle(aFrameStyle);
+
     // mouse over text colors
     aTextColor = getColor( pStyle->fg[ GTK_STATE_PRELIGHT ] );
     aStyleSet.SetButtonRolloverTextColor( aTextColor );
@@ -4083,6 +4109,29 @@ static void NWEnsureGTKTooltip( SalX11Screen nScreen )
     }
 }
 
+static void NWEnsureGTKDialog( SalX11Screen nScreen )
+{
+    if( !gWidgetData[nScreen].gDialog )
+    {
+        gWidgetData[nScreen].gDialog = gtk_dialog_new();
+        GdkScreen* pScreen = gdk_display_get_screen( gdk_display_get_default(),
+                                                     nScreen.getXScreen() );
+        if( pScreen )
+            gtk_window_set_screen( GTK_WINDOW(gWidgetData[nScreen].gDialog), pScreen );
+        gtk_widget_realize(gWidgetData[nScreen].gDialog);
+        gtk_widget_ensure_style(gWidgetData[nScreen].gDialog);
+    }
+}
+
+static void NWEnsureGTKFrame( SalX11Screen nScreen )
+{
+    if( !gWidgetData[nScreen].gFrame )
+    {
+        gWidgetData[nScreen].gFrame = gtk_frame_new(NULL);
+        NWAddWidgetToCacheWindow( gWidgetData[nScreen].gFrame, nScreen );
+    }
+}
+
 static void NWEnsureGTKProgressBar( SalX11Screen nScreen )
 {
     if( !gWidgetData[nScreen].gProgressBar )


More information about the Libreoffice-commits mailing list