summaryrefslogtreecommitdiff
path: root/vcl
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2017-01-05 10:43:16 +0000
committerCaolán McNamara <caolanm@redhat.com>2017-01-05 11:33:59 +0000
commit82ebe06bce6efd0ed4204f6fcf4a139da44716cb (patch)
treebecf277b55f096ea14f9a148dec3cf556a26a996 /vcl
parentbc5bd4a0297141863acebc6fc7bcd3a6e6008869 (diff)
unwind radio and check img lists
Change-Id: I7ce7621254583207b913555614204a3733e74263
Diffstat (limited to 'vcl')
-rw-r--r--vcl/inc/svdata.hxx4
-rw-r--r--vcl/inc/svids.hrc45
-rw-r--r--vcl/source/app/svmain.cxx12
-rw-r--r--vcl/source/control/button.cxx97
-rw-r--r--vcl/source/src/images.src160
5 files changed, 240 insertions, 78 deletions
diff --git a/vcl/inc/svdata.hxx b/vcl/inc/svdata.hxx
index 362938766dd3..3ce64d736328 100644
--- a/vcl/inc/svdata.hxx
+++ b/vcl/inc/svdata.hxx
@@ -210,8 +210,8 @@ typedef std::vector< std::pair< OUString, FieldUnit > > FieldUnitStringList;
struct ImplSVCtrlData
{
- ImageList* mpCheckImgList = nullptr; // ImageList for CheckBoxes
- ImageList* mpRadioImgList = nullptr; // ImageList for RadioButtons
+ std::vector<Image> maCheckImgList; // ImageList for CheckBoxes
+ std::vector<Image> maRadioImgList; // ImageList for RadioButtons
Image* mpDisclosurePlus = nullptr;
Image* mpDisclosureMinus = nullptr;
ImplTBDragMgr* mpTBDragMgr = nullptr; // DragMgr for ToolBox
diff --git a/vcl/inc/svids.hrc b/vcl/inc/svids.hrc
index 18f123819226..86ea7be9e67a 100644
--- a/vcl/inc/svids.hrc
+++ b/vcl/inc/svids.hrc
@@ -23,16 +23,41 @@
#define SV_RESID_STDOFFSET 0
#define SV_RESID_MONOOFFSET 1
-// ATTENTION: These IDs must be spaced at least by 10, as, depending on style,
-// an offset will get added:
-
-#define SV_RESID_BITMAP_CHECK 1000
-#define SV_RESID_BITMAP_RADIO 1010
-
-#define SV_RESID_BITMAP_ERRORBOX 1020
-#define SV_RESID_BITMAP_QUERYBOX 1021
-#define SV_RESID_BITMAP_WARNINGBOX 1022
-#define SV_RESID_BITMAP_INFOBOX 1023
+#define SV_RESID_BITMAP_CHECK1 1000
+#define SV_RESID_BITMAP_CHECK2 1001
+#define SV_RESID_BITMAP_CHECK3 1002
+#define SV_RESID_BITMAP_CHECK4 1003
+#define SV_RESID_BITMAP_CHECK5 1004
+#define SV_RESID_BITMAP_CHECK6 1005
+#define SV_RESID_BITMAP_CHECK7 1006
+#define SV_RESID_BITMAP_CHECK8 1007
+#define SV_RESID_BITMAP_CHECK9 1008
+#define SV_RESID_BITMAP_CHECKMONO1 1009
+#define SV_RESID_BITMAP_CHECKMONO2 1010
+#define SV_RESID_BITMAP_CHECKMONO3 1011
+#define SV_RESID_BITMAP_CHECKMONO4 1012
+#define SV_RESID_BITMAP_CHECKMONO5 1013
+#define SV_RESID_BITMAP_CHECKMONO6 1014
+#define SV_RESID_BITMAP_CHECKMONO7 1015
+#define SV_RESID_BITMAP_CHECKMONO8 1016
+#define SV_RESID_BITMAP_CHECKMONO9 1017
+#define SV_RESID_BITMAP_RADIO1 1018
+#define SV_RESID_BITMAP_RADIO2 1019
+#define SV_RESID_BITMAP_RADIO3 1020
+#define SV_RESID_BITMAP_RADIO4 1021
+#define SV_RESID_BITMAP_RADIO5 1022
+#define SV_RESID_BITMAP_RADIO6 1023
+#define SV_RESID_BITMAP_RADIOMONO1 1024
+#define SV_RESID_BITMAP_RADIOMONO2 1025
+#define SV_RESID_BITMAP_RADIOMONO3 1026
+#define SV_RESID_BITMAP_RADIOMONO4 1027
+#define SV_RESID_BITMAP_RADIOMONO5 1028
+#define SV_RESID_BITMAP_RADIOMONO6 1029
+
+#define SV_RESID_BITMAP_ERRORBOX 1030
+#define SV_RESID_BITMAP_QUERYBOX 1031
+#define SV_RESID_BITMAP_WARNINGBOX 1032
+#define SV_RESID_BITMAP_INFOBOX 1033
#define SV_RESID_BITMAP_SCROLLMSK 1050
#define SV_RESID_BITMAP_WHEELVH 1051
diff --git a/vcl/source/app/svmain.cxx b/vcl/source/app/svmain.cxx
index e7b86478f54b..d398d6bc2562 100644
--- a/vcl/source/app/svmain.cxx
+++ b/vcl/source/app/svmain.cxx
@@ -420,16 +420,8 @@ void DeInitVCL()
Scheduler::ImplDeInitScheduler();
pSVData->maWinData.maMsgBoxImgList.clear();
- if ( pSVData->maCtrlData.mpCheckImgList )
- {
- delete pSVData->maCtrlData.mpCheckImgList;
- pSVData->maCtrlData.mpCheckImgList = nullptr;
- }
- if ( pSVData->maCtrlData.mpRadioImgList )
- {
- delete pSVData->maCtrlData.mpRadioImgList;
- pSVData->maCtrlData.mpRadioImgList = nullptr;
- }
+ pSVData->maCtrlData.maCheckImgList.clear();
+ pSVData->maCtrlData.maRadioImgList.clear();
if ( pSVData->maCtrlData.mpDisclosurePlus )
{
delete pSVData->maCtrlData.mpDisclosurePlus;
diff --git a/vcl/source/control/button.cxx b/vcl/source/control/button.cxx
index d88ad0417d17..9e0140e81dd3 100644
--- a/vcl/source/control/button.cxx
+++ b/vcl/source/control/button.cxx
@@ -2745,9 +2745,8 @@ Size RadioButton::ImplGetRadioImageSize() const
return aSize;
}
-static void LoadThemedImageList (const StyleSettings &rStyleSettings,
- ImageList *pList, const ResId &rResId,
- sal_uInt16 nImages)
+static void LoadThemedImageList(const StyleSettings &rStyleSettings,
+ std::vector<Image>& rList, const std::vector<ResId> &rResources)
{
Color aColorAry1[6];
Color aColorAry2[6];
@@ -2765,9 +2764,13 @@ static void LoadThemedImageList (const StyleSettings &rStyleSettings,
aColorAry2[5] = rStyleSettings.GetWindowTextColor();
static_assert( sizeof(aColorAry1) == sizeof(aColorAry2), "aColorAry1 must match aColorAry2" );
- // FIXME: do we want the mask for the checkbox ?
- pList->InsertFromHorizontalBitmap (rResId, nImages,
- aColorAry1, aColorAry2, SAL_N_ELEMENTS(aColorAry1));
+
+ for (const auto &a : rResources)
+ {
+ BitmapEx aBmpEx(a);
+ aBmpEx.Replace(aColorAry1, aColorAry2, SAL_N_ELEMENTS(aColorAry1));
+ rList.push_back(Image(aBmpEx));
+ }
}
Image RadioButton::GetRadioImage( const AllSettings& rSettings, DrawButtonFlags nFlags )
@@ -2779,52 +2782,56 @@ Image RadioButton::GetRadioImage( const AllSettings& rSettings, DrawButtonFlags
if ( rStyleSettings.GetOptions() & StyleSettingsOptions::Mono )
nStyle = STYLE_RADIOBUTTON_MONO;
- if ( !pSVData->maCtrlData.mpRadioImgList ||
+ if ( pSVData->maCtrlData.maRadioImgList.empty() ||
(pSVData->maCtrlData.mnRadioStyle != nStyle) ||
(pSVData->maCtrlData.mnLastRadioFColor != rStyleSettings.GetFaceColor().GetColor()) ||
(pSVData->maCtrlData.mnLastRadioWColor != rStyleSettings.GetWindowColor().GetColor()) ||
(pSVData->maCtrlData.mnLastRadioLColor != rStyleSettings.GetLightColor().GetColor()) )
{
- if ( pSVData->maCtrlData.mpRadioImgList )
- delete pSVData->maCtrlData.mpRadioImgList;
+ pSVData->maCtrlData.maRadioImgList.clear();
pSVData->maCtrlData.mnLastRadioFColor = rStyleSettings.GetFaceColor().GetColor();
pSVData->maCtrlData.mnLastRadioWColor = rStyleSettings.GetWindowColor().GetColor();
pSVData->maCtrlData.mnLastRadioLColor = rStyleSettings.GetLightColor().GetColor();
ResMgr* pResMgr = ImplGetResMgr();
- pSVData->maCtrlData.mpRadioImgList = new ImageList();
- if( pResMgr )
- LoadThemedImageList( rStyleSettings,
- pSVData->maCtrlData.mpRadioImgList,
- ResId( SV_RESID_BITMAP_RADIO+nStyle, *pResMgr ), 6
- );
+ if (pResMgr)
+ {
+ std::vector<ResId> aResources;
+ aResources.push_back(ResId(nStyle ? SV_RESID_BITMAP_RADIOMONO1 : SV_RESID_BITMAP_RADIO1, *pResMgr));
+ aResources.push_back(ResId(nStyle ? SV_RESID_BITMAP_RADIOMONO2 : SV_RESID_BITMAP_RADIO2, *pResMgr));
+ aResources.push_back(ResId(nStyle ? SV_RESID_BITMAP_RADIOMONO3 : SV_RESID_BITMAP_RADIO3, *pResMgr));
+ aResources.push_back(ResId(nStyle ? SV_RESID_BITMAP_RADIOMONO4 : SV_RESID_BITMAP_RADIO4, *pResMgr));
+ aResources.push_back(ResId(nStyle ? SV_RESID_BITMAP_RADIOMONO5 : SV_RESID_BITMAP_RADIO5, *pResMgr));
+ aResources.push_back(ResId(nStyle ? SV_RESID_BITMAP_RADIOMONO6 : SV_RESID_BITMAP_RADIO6, *pResMgr));
+ LoadThemedImageList( rStyleSettings, pSVData->maCtrlData.maRadioImgList, aResources);
+ }
pSVData->maCtrlData.mnRadioStyle = nStyle;
}
- sal_uInt16 nId;
+ sal_uInt16 nIndex;
if ( nFlags & DrawButtonFlags::Disabled )
{
if ( nFlags & DrawButtonFlags::Checked )
- nId = 6;
+ nIndex = 5;
else
- nId = 5;
+ nIndex = 4;
}
else if ( nFlags & DrawButtonFlags::Pressed )
{
if ( nFlags & DrawButtonFlags::Checked )
- nId = 4;
+ nIndex = 3;
else
- nId = 3;
+ nIndex = 2;
}
else
{
if ( nFlags & DrawButtonFlags::Checked )
- nId = 2;
+ nIndex = 1;
else
- nId = 1;
+ nIndex = 0;
}
- return pSVData->maCtrlData.mpRadioImgList->GetImage( nId );
+ return pSVData->maCtrlData.maRadioImgList[nIndex];
}
void RadioButton::ImplSetMinimumNWFSize()
@@ -3613,57 +3620,65 @@ Image CheckBox::GetCheckImage( const AllSettings& rSettings, DrawButtonFlags nFl
if ( rStyleSettings.GetOptions() & StyleSettingsOptions::Mono )
nStyle = STYLE_CHECKBOX_MONO;
- if ( !pSVData->maCtrlData.mpCheckImgList ||
+ if ( pSVData->maCtrlData.maCheckImgList.empty() ||
(pSVData->maCtrlData.mnCheckStyle != nStyle) ||
(pSVData->maCtrlData.mnLastCheckFColor != rStyleSettings.GetFaceColor().GetColor()) ||
(pSVData->maCtrlData.mnLastCheckWColor != rStyleSettings.GetWindowColor().GetColor()) ||
(pSVData->maCtrlData.mnLastCheckLColor != rStyleSettings.GetLightColor().GetColor()) )
{
- if ( pSVData->maCtrlData.mpCheckImgList )
- delete pSVData->maCtrlData.mpCheckImgList;
+ pSVData->maCtrlData.maCheckImgList.clear();
pSVData->maCtrlData.mnLastCheckFColor = rStyleSettings.GetFaceColor().GetColor();
pSVData->maCtrlData.mnLastCheckWColor = rStyleSettings.GetWindowColor().GetColor();
pSVData->maCtrlData.mnLastCheckLColor = rStyleSettings.GetLightColor().GetColor();
ResMgr* pResMgr = ImplGetResMgr();
- pSVData->maCtrlData.mpCheckImgList = new ImageList();
if( pResMgr )
- LoadThemedImageList( rStyleSettings,
- pSVData->maCtrlData.mpCheckImgList,
- ResId( SV_RESID_BITMAP_CHECK+nStyle, *pResMgr ), 9 );
+ {
+ std::vector<ResId> aResources;
+ aResources.push_back(ResId(nStyle ? SV_RESID_BITMAP_CHECKMONO1 : SV_RESID_BITMAP_CHECK1, *pResMgr));
+ aResources.push_back(ResId(nStyle ? SV_RESID_BITMAP_CHECKMONO2 : SV_RESID_BITMAP_CHECK2, *pResMgr));
+ aResources.push_back(ResId(nStyle ? SV_RESID_BITMAP_CHECKMONO3 : SV_RESID_BITMAP_CHECK3, *pResMgr));
+ aResources.push_back(ResId(nStyle ? SV_RESID_BITMAP_CHECKMONO4 : SV_RESID_BITMAP_CHECK4, *pResMgr));
+ aResources.push_back(ResId(nStyle ? SV_RESID_BITMAP_CHECKMONO5 : SV_RESID_BITMAP_CHECK5, *pResMgr));
+ aResources.push_back(ResId(nStyle ? SV_RESID_BITMAP_CHECKMONO6 : SV_RESID_BITMAP_CHECK6, *pResMgr));
+ aResources.push_back(ResId(nStyle ? SV_RESID_BITMAP_CHECKMONO7 : SV_RESID_BITMAP_CHECK7, *pResMgr));
+ aResources.push_back(ResId(nStyle ? SV_RESID_BITMAP_CHECKMONO8 : SV_RESID_BITMAP_CHECK8, *pResMgr));
+ aResources.push_back(ResId(nStyle ? SV_RESID_BITMAP_CHECKMONO9 : SV_RESID_BITMAP_CHECK9, *pResMgr));
+ LoadThemedImageList(rStyleSettings, pSVData->maCtrlData.maCheckImgList, aResources);
+ }
pSVData->maCtrlData.mnCheckStyle = nStyle;
}
- sal_uInt16 nId;
+ sal_uInt16 nIndex;
if ( nFlags & DrawButtonFlags::Disabled )
{
if ( nFlags & DrawButtonFlags::DontKnow )
- nId = 9;
+ nIndex = 8;
else if ( nFlags & DrawButtonFlags::Checked )
- nId = 6;
+ nIndex = 5;
else
- nId = 5;
+ nIndex = 4;
}
else if ( nFlags & DrawButtonFlags::Pressed )
{
if ( nFlags & DrawButtonFlags::DontKnow )
- nId = 8;
+ nIndex = 7;
else if ( nFlags & DrawButtonFlags::Checked )
- nId = 4;
+ nIndex = 3;
else
- nId = 3;
+ nIndex = 2;
}
else
{
if ( nFlags & DrawButtonFlags::DontKnow )
- nId = 7;
+ nIndex = 6;
else if ( nFlags & DrawButtonFlags::Checked )
- nId = 2;
+ nIndex = 1;
else
- nId = 1;
+ nIndex = 0;
}
- return pSVData->maCtrlData.mpCheckImgList->GetImage( nId );
+ return pSVData->maCtrlData.maCheckImgList[nIndex];
}
void CheckBox::ImplSetMinimumNWFSize()
diff --git a/vcl/source/src/images.src b/vcl/source/src/images.src
index 5417e5365bc0..10b0eb7bf292 100644
--- a/vcl/source/src/images.src
+++ b/vcl/source/src/images.src
@@ -19,59 +19,189 @@
#include <svids.hrc>
-Bitmap (SV_RESID_BITMAP_CHECK + SV_RESID_STDOFFSET)
+Bitmap SV_RESID_BITMAP_CHECK1
{
- File = "check.png";
+ File = "check1.png";
};
-Bitmap (SV_RESID_BITMAP_CHECK + SV_RESID_MONOOFFSET)
+Bitmap SV_RESID_BITMAP_CHECK2
{
- File = "checkmono.png";
+ File = "check2.png";
};
-Bitmap (SV_RESID_BITMAP_SCROLLVH)
+Bitmap SV_RESID_BITMAP_CHECK3
+{
+ File = "check3.png";
+};
+
+Bitmap SV_RESID_BITMAP_CHECK4
+{
+ File = "check4.png";
+};
+
+Bitmap SV_RESID_BITMAP_CHECK5
+{
+ File = "check5.png";
+};
+
+Bitmap SV_RESID_BITMAP_CHECK6
+{
+ File = "check6.png";
+};
+
+Bitmap SV_RESID_BITMAP_CHECK7
+{
+ File = "check7.png";
+};
+
+Bitmap SV_RESID_BITMAP_CHECK8
+{
+ File = "check8.png";
+};
+
+Bitmap SV_RESID_BITMAP_CHECK9
+{
+ File = "check9.png";
+};
+
+Bitmap SV_RESID_BITMAP_CHECKMONO1
+{
+ File = "checkmono1.png";
+};
+
+Bitmap SV_RESID_BITMAP_CHECKMONO2
+{
+ File = "checkmono2.png";
+};
+
+Bitmap SV_RESID_BITMAP_CHECKMONO3
+{
+ File = "checkmono3.png";
+};
+
+Bitmap SV_RESID_BITMAP_CHECKMONO4
+{
+ File = "checkmono4.png";
+};
+
+Bitmap SV_RESID_BITMAP_CHECKMONO5
+{
+ File = "checkmono5.png";
+};
+
+Bitmap SV_RESID_BITMAP_CHECKMONO6
+{
+ File = "checkmono6.png";
+};
+
+Bitmap SV_RESID_BITMAP_CHECKMONO7
+{
+ File = "checkmono7.png";
+};
+
+Bitmap SV_RESID_BITMAP_CHECKMONO8
+{
+ File = "checkmono8.png";
+};
+
+Bitmap SV_RESID_BITMAP_CHECKMONO9
+{
+ File = "checkmono9.png";
+};
+
+Bitmap SV_RESID_BITMAP_SCROLLVH
{
File = "scrollvh.png";
};
-Bitmap (SV_RESID_BITMAP_SCROLLV)
+Bitmap SV_RESID_BITMAP_SCROLLV
{
File = "scrollv.png";
};
-Bitmap (SV_RESID_BITMAP_SCROLLH)
+Bitmap SV_RESID_BITMAP_SCROLLH
{
File = "scrollh.png";
};
-Bitmap (SV_RESID_BITMAP_WHEELVH)
+Bitmap SV_RESID_BITMAP_WHEELVH
{
File = "wheelvh.png";
};
-Bitmap (SV_RESID_BITMAP_WHEELV)
+Bitmap SV_RESID_BITMAP_WHEELV
{
File = "wheelv.png";
};
-Bitmap (SV_RESID_BITMAP_WHEELH)
+Bitmap SV_RESID_BITMAP_WHEELH
{
File = "wheelh.png";
};
-Bitmap (SV_RESID_BITMAP_SCROLLMSK)
+Bitmap SV_RESID_BITMAP_SCROLLMSK
{
File = "scrmsk.png";
};
-Bitmap (SV_RESID_BITMAP_RADIO + SV_RESID_STDOFFSET)
+Bitmap SV_RESID_BITMAP_RADIO1
+{
+ File = "radio1.png";
+};
+
+Bitmap SV_RESID_BITMAP_RADIO2
+{
+ File = "radio2.png";
+};
+
+Bitmap SV_RESID_BITMAP_RADIO3
+{
+ File = "radio3.png";
+};
+
+Bitmap SV_RESID_BITMAP_RADIO4
+{
+ File = "radio4.png";
+};
+
+Bitmap SV_RESID_BITMAP_RADIO5
+{
+ File = "radio5.png";
+};
+
+Bitmap SV_RESID_BITMAP_RADIO6
+{
+ File = "radio6.png";
+};
+
+Bitmap SV_RESID_BITMAP_RADIOMONO1
+{
+ File = "radiomono1.png";
+};
+
+Bitmap SV_RESID_BITMAP_RADIOMONO2
+{
+ File = "radiomono2.png";
+};
+
+Bitmap SV_RESID_BITMAP_RADIOMONO3
+{
+ File = "radiomono3.png";
+};
+
+Bitmap SV_RESID_BITMAP_RADIOMONO4
+{
+ File = "radiomono4.png";
+};
+
+Bitmap SV_RESID_BITMAP_RADIOMONO5
{
- File = "radio.png";
+ File = "radiomono5.png";
};
-Bitmap (SV_RESID_BITMAP_RADIO + SV_RESID_MONOOFFSET)
+Bitmap SV_RESID_BITMAP_RADIOMONO6
{
- File = "radiomono.png";
+ File = "radiomono6.png";
};
Bitmap SV_RESID_BITMAP_ERRORBOX