]> git.saurik.com Git - wxWidgets.git/commitdiff
Use xpms for checked/unchecked states instead of drawing them (yielded junk)
authorRobert Roebling <robert@roebling.de>
Fri, 17 Oct 2008 11:58:39 +0000 (11:58 +0000)
committerRobert Roebling <robert@roebling.de>
Fri, 17 Oct 2008 11:58:39 +0000 (11:58 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@56395 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

samples/treectrl/checked.xpm [new file with mode: 0644]
samples/treectrl/treetest.cpp
samples/treectrl/unchecked.xpm [new file with mode: 0644]

diff --git a/samples/treectrl/checked.xpm b/samples/treectrl/checked.xpm
new file mode 100644 (file)
index 0000000..2ea7964
--- /dev/null
@@ -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+",
+".+++++++++++."};
index a2dc2ebd701aef2de2698e46e7461b2ace3a2bf9..15069adaca8cba78d05f8f64a917465df8dd675c 100644 (file)
@@ -50,6 +50,9 @@
 #include "state4.xpm"
 #include "state5.xpm"
 
 #include "state4.xpm"
 #include "state5.xpm"
 
+#include "unchecked.xpm"
+#include "checked.xpm"
+
 #ifndef __WXMSW__
     #include "../sample.xpm"
 #endif
 #ifndef __WXMSW__
     #include "../sample.xpm"
 #endif
@@ -925,35 +928,18 @@ void MyTreeCtrl::CreateStateImageList(bool del)
     }
     else
     {
     }
     else
     {
-        wxRendererNative& renderer = wxRendererNative::Get();
-
-        wxSize size(renderer.GetCheckBoxSize(this));
-
-        // 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);
-        }
+        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);
 
 
-        states->Add(checkBmp);
+        for ( size_t i = 0; i < WXSIZEOF(icons); i++ )
+            states->Add(icons[i]);
     }
 
     AssignStateImageList(states);
     }
 
     AssignStateImageList(states);
diff --git a/samples/treectrl/unchecked.xpm b/samples/treectrl/unchecked.xpm
new file mode 100644 (file)
index 0000000..0c5f7fd
--- /dev/null
@@ -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",
+".+++++++++++.",
+"+@@@@@@@@@@@+",
+"+@##########+",
+"+@$$$$$$$$$$+",
+"+@%%%%%%%%%%+",
+"+@&&&&&&&&&&+",
+"+@**********+",
+"+@==========+",
+"+@----------+",
+"+@;;;;;;;;;;+",
+"+@>>>>>>>>>>+",
+"+@,,,,,,,,,,+",
+".+++++++++++."};