+void MyFrame::CreateBox()
+{
+ bool multi = GetMenuBar()->IsChecked(HtmlLbox_ToggleMulti);
+
+ if ( GetMenuBar()->IsChecked(HtmlLbox_CustomBox) )
+ {
+ m_hlbox = new MyHtmlListBox(this, multi);
+ }
+ else // simple listbox
+ {
+ m_hlbox = new wxSimpleHtmlListBox(this, wxID_ANY, wxDefaultPosition, wxDefaultSize,
+ 0, NULL, multi ? wxLB_MULTIPLE : 0);
+
+ // unlike wxHtmlListBox which is abstract, wxSimpleHtmlListBox is a
+ // concrete control and doesn't support virtual mode, this we need
+ // to add all of its items from the beginning
+ wxArrayString arr;
+ for (size_t n = 0; n < 1000; n++ )
+ {
+ wxColour clr((unsigned char)(abs((int)n - 192) % 256),
+ (unsigned char)(abs((int)n - 256) % 256),
+ (unsigned char)(abs((int)n - 128) % 256));
+ int level = n % 6 + 1;
+
+ wxString label = wxString::Format(wxT("<h%d><font color=%s>")
+ wxT("Item</font> <b>%lu</b>")
+ wxT("</h%d>"),
+ level,
+ clr.GetAsString(wxC2S_HTML_SYNTAX).c_str(),
+ (unsigned long)n, level);
+ arr.Add(label);
+ }
+
+ GetSimpleBox()->Append(arr);
+ }
+}
+
+