[Libreoffice-commits] core.git: Branch 'feature/unitver' - vcl/source

Andrzej Hunt andrzej at ahunt.org
Sun May 31 13:00:15 PDT 2015


 vcl/source/window/builder.cxx |   19 ++++++++++++++++++-
 1 file changed, 18 insertions(+), 1 deletion(-)

New commits:
commit de6b5a3ed8415cf419d708a2f90445d97e189e1a
Author: Andrzej Hunt <andrzej at ahunt.org>
Date:   Sun May 31 20:59:41 2015 +0100

    Support placeholder_text for GtkEntry/Edit in VclBuilder
    
    Support for ComboBox and related classes will need to be added
    separately, although they seem to reuse GtkEntry internally
    in the .ui file.
    
    Change-Id: Ibfda803663a22d5c6318fe9315b66b8af6189872

diff --git a/vcl/source/window/builder.cxx b/vcl/source/window/builder.cxx
index 64d08c4..b8af547 100644
--- a/vcl/source/window/builder.cxx
+++ b/vcl/source/window/builder.cxx
@@ -878,6 +878,18 @@ namespace
         return sTooltipText;
     }
 
+    OString extractPlaceholderText(VclBuilder::stringmap &rMap)
+    {
+        OString sPlaceholderText;
+        VclBuilder::stringmap::iterator aFind = rMap.find(OString("placeholder_text"));
+        if (aFind != rMap.end())
+        {
+            sPlaceholderText = aFind->second;
+            rMap.erase(aFind);
+        }
+        return sPlaceholderText;
+    }
+
     void setupFromActionName(Button *pButton, VclBuilder::stringmap &rMap, const uno::Reference<frame::XFrame>& rFrame)
     {
         if (!rFrame.is())
@@ -1607,7 +1619,12 @@ VclPtr<vcl::Window> VclBuilder::makeObject(vcl::Window *pParent, const OString &
     }
     else if (name == "GtkEntry")
     {
-        xWindow = VclPtr<Edit>::Create(pParent, WB_LEFT|WB_VCENTER|WB_BORDER|WB_3DLOOK);
+        VclPtrInstance<Edit> xEdit(pParent, WB_LEFT|WB_VCENTER|WB_BORDER|WB_3DLOOK);
+
+        OUString sPlaceHolderText(OStringToOUString(extractPlaceholderText(rMap), RTL_TEXTENCODING_UTF8));
+        xEdit->SetPlaceholderText(sPlaceHolderText);
+
+        xWindow = xEdit;
         ensureDefaultWidthChars(rMap);
     }
     else if (name == "GtkNotebook")


More information about the Libreoffice-commits mailing list