[Libreoffice-commits] .: Branch 'feature/cmclayout' - 3 commits - vcl/inc vcl/source

Caolán McNamara caolan at kemper.freedesktop.org
Fri Apr 6 14:43:33 PDT 2012


 vcl/inc/vcl/window.hxx         |   32 ++++++++++++++++++++++++++++++--
 vcl/source/control/lstbox.cxx  |    4 ++++
 vcl/source/control/tabctrl.cxx |    4 ++--
 vcl/source/window/tabdlg.cxx   |    2 +-
 vcl/source/window/window.cxx   |    8 +++++---
 5 files changed, 42 insertions(+), 8 deletions(-)

New commits:
commit f4da833118b23015d13afde3403886e6c109606f
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Fri Apr 6 21:28:37 2012 +0100

    document methods

diff --git a/vcl/inc/vcl/window.hxx b/vcl/inc/vcl/window.hxx
index 625e9f5..01e37ee 100644
--- a/vcl/inc/vcl/window.hxx
+++ b/vcl/inc/vcl/window.hxx
@@ -586,6 +586,15 @@ protected:
             void        CallEventListeners( sal_uLong nEvent, void* pData = NULL );
             void        FireVclEvent( VclSimpleEvent* pEvent );
 
+    /*
+     * Widgets call this to inform their owner container that the widget wants
+     * to renegotiate its size. Should be called when a widget has a new size
+     * request. e.g. a FixedText Control gets a new label.
+     *
+     * akin to gtk_widget_queue_resize
+     */
+    SAL_DLLPRIVATE void queue_resize();
+
     // FIXME: this is a hack to workaround missing layout functionality
     SAL_DLLPRIVATE void ImplAdjustNWFSizes();
 public:
@@ -1060,10 +1069,29 @@ public:
     virtual ::com::sun::star::uno::Reference< ::com::sun::star::datatransfer::clipboard::XClipboard > GetClipboard();
     virtual ::com::sun::star::uno::Reference< ::com::sun::star::datatransfer::clipboard::XClipboard > GetPrimarySelection();
 
-    // Advisory Sizing - what is a good size for this widget ?
+    /*
+     * Advisory Sizing - what is a good size for this widget
+     *
+     * Retrieves the preferred size of a widget ignoring
+     * "width-request" and "height-request" properties.
+     *
+     * Implement this in sub-classes to tell layout
+     * the preferred widget size.
+     */
     virtual Size GetOptimalSize(WindowSizeType eType) const;
+
+    /*
+     * Retrieves the preferred size of a widget taking
+     * into account the "width-request" and "height-request" properties.
+     *
+     * Overrides the result of GetOptimalSize to honor the
+     * width-request and height-request properties.
+     *
+     * @see GetOptimalSize
+     *
+     * akin to gtk_widget_get_preferred_size
+     */
     Size get_preferred_size() const;
-    void queueResize();
 
     virtual void setChildAnyProperty(const rtl::OString &rString, const ::com::sun::star::uno::Any &rValue);
     virtual ::com::sun::star::uno::Any getWidgetAnyProperty(const rtl::OString &rString) const;
diff --git a/vcl/source/control/tabctrl.cxx b/vcl/source/control/tabctrl.cxx
index 6196d77..e594207 100644
--- a/vcl/source/control/tabctrl.cxx
+++ b/vcl/source/control/tabctrl.cxx
@@ -1957,14 +1957,14 @@ void TabControl::SetTabPage( sal_uInt16 nPageId, TabPage* pTabPage )
 
             // Erst hier setzen, damit Resize nicht TabPage umpositioniert
             pItem->mpTabPage = pTabPage;
-            queueResize();
+            queue_resize();
             if ( pItem->mnId == mnCurPageId )
                 ImplChangeTabPage( pItem->mnId, 0 );
         }
         else
         {
             pItem->mpTabPage = NULL;
-            queueResize();
+            queue_resize();
         }
     }
 }
diff --git a/vcl/source/window/tabdlg.cxx b/vcl/source/window/tabdlg.cxx
index 517ce33..0701533 100644
--- a/vcl/source/window/tabdlg.cxx
+++ b/vcl/source/window/tabdlg.cxx
@@ -260,7 +260,7 @@ void TabDialog::StateChanged( StateChangedType nType )
 void TabDialog::AdjustLayout()
 {
     ImplPosControls();
-    queueResize();
+    queue_resize();
 }
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/source/window/window.cxx b/vcl/source/window/window.cxx
index e24c713..d16b831 100644
--- a/vcl/source/window/window.cxx
+++ b/vcl/source/window/window.cxx
@@ -4927,7 +4927,7 @@ void Window::UserEvent( sal_uLong, void* )
 
 void Window::StateChanged( StateChangedType )
 {
-    queueResize();
+    queue_resize();
     DBG_CHKTHIS( Window, ImplDbgCheckWindow );
 }
 
@@ -9632,7 +9632,7 @@ Selection Window::GetSurroundingTextSelection() const
 
 //Poor man's equivalent, when widget wants to renegotiate
 //size, get parent dialog and call resize on it
-void Window::queueResize()
+void Window::queue_resize()
 {
     Dialog *pParent = GetParentDialog();
     if (!pParent)
commit 18130178e408b79968773f90316dead1f0f26f72
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Fri Apr 6 09:01:50 2012 +0100

    don't bother with children resize request while dialog is closing

diff --git a/vcl/source/window/window.cxx b/vcl/source/window/window.cxx
index dfb839f..e24c713 100644
--- a/vcl/source/window/window.cxx
+++ b/vcl/source/window/window.cxx
@@ -9630,13 +9630,15 @@ Selection Window::GetSurroundingTextSelection() const
   return Selection( 0, 0 );
 }
 
-//Poor man's equivalent, when widget want's to renegotiate
+//Poor man's equivalent, when widget wants to renegotiate
 //size, get parent dialog and call resize on it
 void Window::queueResize()
 {
     Dialog *pParent = GetParentDialog();
     if (!pParent)
         return;
+    if (pParent->IsInClose())
+        return;
     if (!pParent->isLayoutEnabled())
         return;
     if (!pParent->IsReallyShown())
commit 2bfdf923e551a93c067918e8b7d90c0a84644034
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Fri Apr 6 08:40:14 2012 +0100

    mpImplLB of ListBox is NULLed during destruction

diff --git a/vcl/source/control/lstbox.cxx b/vcl/source/control/lstbox.cxx
index 9d2f7aa..0f82e65 100644
--- a/vcl/source/control/lstbox.cxx
+++ b/vcl/source/control/lstbox.cxx
@@ -1293,6 +1293,10 @@ sal_Bool ListBox::IsMultiSelectionEnabled() const
 Size ListBox::CalcMinimumSize() const
 {
     Size aSz;
+
+    if (!mpImplLB)
+        return aSz;
+
     if ( !IsDropDownBox() )
         aSz = mpImplLB->CalcSize (mnLineCount ? mnLineCount : mpImplLB->GetEntryList()->GetEntryCount());
     else


More information about the Libreoffice-commits mailing list