summaryrefslogtreecommitdiff
path: root/vcl
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2012-10-20 12:37:42 +0100
committerCaolán McNamara <caolanm@redhat.com>2012-10-22 09:13:38 +0100
commit324e116a2e454526891b674da58d07061406f868 (patch)
treea71dd7b6bc9ed173becadb27d4bc5a2036a2a28e /vcl
parentc578c327ed9b7f71959b9f300ead479224c5c15c (diff)
add a stock index image to vcl, ala gtk-index
Change-Id: I96cd80f14d557752c19b88bb2c99298d7c3e3e0b
Diffstat (limited to 'vcl')
-rw-r--r--vcl/inc/svids.hrc1
-rw-r--r--vcl/source/src/images.src5
-rw-r--r--vcl/source/window/builder.cxx18
3 files changed, 23 insertions, 1 deletions
diff --git a/vcl/inc/svids.hrc b/vcl/inc/svids.hrc
index e0a64f643cb3..5abe5bd84b51 100644
--- a/vcl/inc/svids.hrc
+++ b/vcl/inc/svids.hrc
@@ -41,6 +41,7 @@
#define SV_RESID_BITMAP_SCROLLMSK 1050
#define SV_RESID_BITMAP_SCROLLBMP 1051
#define SV_RESID_BITMAP_CLOSEDOC 1052
+#define SV_RESID_BITMAP_INDEX 1053
#define SV_DISCLOSURE_PLUS 1060
#define SV_DISCLOSURE_MINUS 1061
diff --git a/vcl/source/src/images.src b/vcl/source/src/images.src
index f0b58f4d82d1..061f59c6b676 100644
--- a/vcl/source/src/images.src
+++ b/vcl/source/src/images.src
@@ -77,6 +77,11 @@ Bitmap SV_RESID_BITMAP_CLOSEDOC
File = "closedoc.png";
};
+Bitmap SV_RESID_BITMAP_INDEX
+{
+ File = "index.png";
+};
+
Bitmap SV_RESID_BITMAP_SPLITHPIN
{
File = "splhpin.png";
diff --git a/vcl/source/window/builder.cxx b/vcl/source/window/builder.cxx
index 735bde150d71..20a2b71de725 100644
--- a/vcl/source/window/builder.cxx
+++ b/vcl/source/window/builder.cxx
@@ -33,6 +33,14 @@
namespace
{
+ sal_uInt16 mapStockToImageResource(OString sType)
+ {
+ sal_uInt16 nRet = 0;
+ if (sType == "gtk-index")
+ nRet = SV_RESID_BITMAP_INDEX;
+ return nRet;
+ }
+
SymbolType mapStockToSymbol(OString sType)
{
SymbolType eRet = SYMBOL_NOSYMBOL;
@@ -54,6 +62,8 @@ namespace
eRet = SYMBOL_HELP;
else if (sType == "gtk-close")
eRet = SYMBOL_CLOSE;
+ else if (mapStockToImageResource(sType))
+ eRet = SYMBOL_IMAGE;
return eRet;
}
}
@@ -168,13 +178,19 @@ VclBuilder::VclBuilder(Window *pParent, OUString sUIDir, OUString sUIFile, OStri
PushButton *pTarget = get<PushButton>(aI->m_sID);
FixedImage *pImage = get<FixedImage>(aI->m_sValue);
aImagesToBeRemoved.insert(aI->m_sValue);
- SymbolType eType = mapStockToSymbol(m_pParserState->m_aStockMap[aI->m_sValue]);
+ const OString &rImage = m_pParserState->m_aStockMap[aI->m_sValue];
+ SymbolType eType = mapStockToSymbol(rImage);
SAL_WARN_IF(!pTarget || !pImage || eType == SYMBOL_NOSYMBOL,
"vcl", "missing elements of button/image/stock");
+ if (!pTarget || eType == SYMBOL_NOSYMBOL)
+ continue;
+
//to-do, situation where image isn't a stock image
if (pTarget && eType != SYMBOL_NOSYMBOL)
{
pTarget->SetSymbol(eType);
+ if (eType == SYMBOL_IMAGE)
+ pTarget->SetModeImage(VclResId(mapStockToImageResource(rImage)));
}
}