Use xpms for checked/unchecked states instead of drawing them (yielded junk)

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@56395 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Robert Roebling 2008-10-17 11:58:39 +00:00
parent 51725fc0c2
commit 11339a3884
3 changed files with 98 additions and 28 deletions

View File

@ -0,0 +1,54 @@
/* XPM */
static const char * checked_xpm[] = {
"13 13 38 1",
" c None",
". c #CCCED3",
"+ c #838793",
"@ c #C4C7CF",
"# c #F5F5F5",
"$ c #BBBBBB",
"% c #131313",
"& c #0C0C0C",
"* c #F6F6F6",
"= c #BEBEBE",
"- c #030303",
"; c #060606",
"> c #B4B4B4",
", c #F7F7F7",
"' c #C6C6C6",
") c #080808",
"! c #000000",
"~ c #C0C0C0",
"{ c #020202",
"] c #363636",
"^ c #F9F9F9",
"/ c #505050",
"( c #2C2C2C",
"_ c #545454",
": c #606060",
"< c #010101",
"[ c #FAFAFA",
"} c #FBFBFB",
"| c #333333",
"1 c #1D1D1D",
"2 c #FCFCFC",
"3 c #C4C4C4",
"4 c #FDFDFD",
"5 c #B9B9B9",
"6 c #FEFEFE",
"7 c #5E5E5E",
"8 c #777777",
"9 c #FFFFFF",
".+++++++++++.",
"+@@@@@@@@@@@+",
"+@######$%&#+",
"+@*****=-;**+",
"+@$>,,')!~,,+",
"+@{!]^/!(^^^+",
"+@_!!:<![[[[+",
"+@}|!!!1}}}}+",
"+@22)!!32222+",
"+@445!)44444+",
"+@6667866666+",
"+@9999999999+",
".+++++++++++."};

View File

@ -50,6 +50,9 @@
#include "state4.xpm" #include "state4.xpm"
#include "state5.xpm" #include "state5.xpm"
#include "unchecked.xpm"
#include "checked.xpm"
#ifndef __WXMSW__ #ifndef __WXMSW__
#include "../sample.xpm" #include "../sample.xpm"
#endif #endif
@ -925,35 +928,18 @@ void MyTreeCtrl::CreateStateImageList(bool del)
} }
else else
{ {
wxRendererNative& renderer = wxRendererNative::Get(); wxIcon icons[2];
icons[0] = wxIcon(unchecked_xpm);
icons[1] = wxIcon(checked_xpm);
int width = icons[0].GetWidth(),
height = icons[0].GetHeight();
// Make an state image list containing small icons
states = new wxImageList(width, height, true);
wxSize size(renderer.GetCheckBoxSize(this)); for ( size_t i = 0; i < WXSIZEOF(icons); i++ )
states->Add(icons[i]);
// make an state checkbox image list
states = new wxImageList(size.GetWidth(), size.GetHeight(), true);
wxBitmap checkBmp(size.GetWidth(), size.GetHeight());
wxRect rect(size);
// create no checked image
{
// first create bitmap in a memory DC
wxMemoryDC memDC(checkBmp);
memDC.Clear();
// then draw a check mark into it
renderer.DrawCheckBox(this, memDC, rect, 0);
} // select checkBmp out of memDC
states->Add(checkBmp);
// create checked image
{
wxMemoryDC memDC(checkBmp);
memDC.Clear();
renderer.DrawCheckBox(this, memDC, rect, wxCONTROL_CHECKED);
}
states->Add(checkBmp);
} }
AssignStateImageList(states); AssignStateImageList(states);

View File

@ -0,0 +1,30 @@
/* XPM */
static const char * unchecked_xpm[] = {
"13 13 14 1",
" c None",
". c #CCCED3",
"+ c #838793",
"@ c #C4C7CF",
"# c #F5F5F5",
"$ c #F6F6F6",
"% c #F7F7F7",
"& c #F9F9F9",
"* c #FAFAFA",
"= c #FBFBFB",
"- c #FCFCFC",
"; c #FDFDFD",
"> c #FEFEFE",
", c #FFFFFF",
".+++++++++++.",
"+@@@@@@@@@@@+",
"+@##########+",
"+@$$$$$$$$$$+",
"+@%%%%%%%%%%+",
"+@&&&&&&&&&&+",
"+@**********+",
"+@==========+",
"+@----------+",
"+@;;;;;;;;;;+",
"+@>>>>>>>>>>+",
"+@,,,,,,,,,,+",
".+++++++++++."};