1 /////////////////////////////////////////////////////////////////////////////
2 // Name:        htmllbox.cpp
3 // Purpose:     HtmlLbox wxWidgets sample
4 // Author:      Vadim Zeitlin
5 // Modified by:
6 // Created:     31.05.03
7 // Copyright:   (c) 2003 Vadim Zeitlin <vadim@wxwidgets.org>
8 // Licence:     wxWindows licence
9 /////////////////////////////////////////////////////////////////////////////
10 
11 // ============================================================================
12 // declarations
13 // ============================================================================
14 
15 // ----------------------------------------------------------------------------
16 // headers
17 // ----------------------------------------------------------------------------
18 
19 // For compilers that support precompilation, includes "wx/wx.h".
20 #include "wx/wxprec.h"
21 
22 
23 // for all others, include the necessary headers
24 #ifndef WX_PRECOMP
25     #include "wx/app.h"
26     #include "wx/frame.h"
27     #include "wx/log.h"
28     #include "wx/textdlg.h"
29     #include "wx/sizer.h"
30 
31     #include "wx/menu.h"
32     #include "wx/msgdlg.h"
33     #include "wx/textctrl.h"
34 
35     #include "wx/dc.h"
36     #include "wx/icon.h"
37 #endif
38 
39 #include "wx/colordlg.h"
40 #include "wx/numdlg.h"
41 
42 #include "wx/htmllbox.h"
43 
44 // you can also have a file containing HTML strings for testing, enable this if
45 // you want to use it
46 //#define USE_HTML_FILE
47 #ifdef USE_HTML_FILE
48     #include "wx/textfile.h"
49 #endif
50 
51 #include "../sample.xpm"
52 
53 // ----------------------------------------------------------------------------
54 // private classes
55 // ----------------------------------------------------------------------------
56 
57 // to use wxHtmlListBox you must derive a new class from it as you must
58 // implement pure virtual OnGetItem()
59 class MyHtmlListBox : public wxHtmlListBox
60 {
61 public:
MyHtmlListBox()62     MyHtmlListBox() { }
63     MyHtmlListBox(wxWindow *parent, bool multi = false);
64 
SetChangeSelFg(bool change)65     void SetChangeSelFg(bool change) { m_change = change; }
66     void UpdateFirstItem();
67 
68 protected:
69     // override this method to return data to be shown in the listbox (this is
70     // mandatory)
71     virtual wxString OnGetItem(size_t n) const wxOVERRIDE;
72 
73     // change the appearance by overriding these functions (this is optional)
74     virtual void OnDrawSeparator(wxDC& dc, wxRect& rect, size_t n) const wxOVERRIDE;
75     virtual wxColour GetSelectedTextColour(const wxColour& colFg) const wxOVERRIDE;
76 
77     // flag telling us whether we should use fg colour even for the selected
78     // item
79     bool m_change;
80 
81     // flag which we toggle to update the first items text in OnGetItem()
82     bool m_firstItemUpdated;
83 
84 public:
85 
86     // flag which we toggle when the user clicks on the link in 2nd item
87     // to change 2nd item's text
88     bool m_linkClicked;
89 
90 #ifdef USE_HTML_FILE
91     wxTextFile m_file;
92 #endif
93 
94     wxDECLARE_NO_COPY_CLASS(MyHtmlListBox);
95     wxDECLARE_DYNAMIC_CLASS(MyHtmlListBox);
96 };
97 
98 
99 class MyFrame : public wxFrame
100 {
101 public:
102     MyFrame();
103     virtual ~MyFrame();
104 
105     // event handlers
106     void OnSimpleOrCustomBox(wxCommandEvent& event);
107     void OnQuit(wxCommandEvent& event);
108     void OnAbout(wxCommandEvent& event);
109 
110     void OnSetMargins(wxCommandEvent& event);
OnDrawSeparator(wxCommandEvent &)111     void OnDrawSeparator(wxCommandEvent&) { m_hlbox->RefreshAll(); }
112     void OnToggleMulti(wxCommandEvent& event);
113     void OnSelectAll(wxCommandEvent& event);
114     void OnUpdateItem(wxCommandEvent& event);
115     void OnGetItemRect(wxCommandEvent& event);
116 
117     void OnSetBgCol(wxCommandEvent& event);
118     void OnSetSelBgCol(wxCommandEvent& event);
119     void OnSetSelFgCol(wxCommandEvent& event);
120 
121     void OnClear(wxCommandEvent& event);
122 
123     void OnUpdateUISelectAll(wxUpdateUIEvent& event);
124 
125     void OnLboxSelect(wxCommandEvent& event);
OnLboxDClick(wxCommandEvent & event)126     void OnLboxDClick(wxCommandEvent& event)
127     {
128         wxLogMessage("Listbox item %d double clicked.", event.GetInt());
129     }
130 
131     void OnHtmlLinkClicked(wxHtmlLinkEvent& event);
132     void OnHtmlCellHover(wxHtmlCellEvent &event);
133     void OnHtmlCellClicked(wxHtmlCellEvent &event);
134 
GetSimpleBox()135     wxSimpleHtmlListBox *GetSimpleBox()
136         { return wxDynamicCast(m_hlbox, wxSimpleHtmlListBox); }
GetMyBox()137     MyHtmlListBox *GetMyBox()
138         { return wxDynamicCast(m_hlbox, MyHtmlListBox); }
139 
140     void CreateBox();
141 
142 private:
143     wxHtmlListBox *m_hlbox;
144 
145     // any class wishing to process wxWidgets events must use this macro
146     wxDECLARE_EVENT_TABLE();
147 };
148 
149 class MyApp : public wxApp
150 {
151 public:
OnInit()152     virtual bool OnInit() wxOVERRIDE { (new MyFrame())->Show(); return true; }
153 };
154 
155 // ----------------------------------------------------------------------------
156 // constants
157 // ----------------------------------------------------------------------------
158 
159 // IDs for the controls and the menu commands
160 enum
161 {
162     // menu items
163     HtmlLbox_CustomBox = 1,
164     HtmlLbox_SimpleBox,
165     HtmlLbox_Quit,
166 
167     HtmlLbox_SetMargins,
168     HtmlLbox_DrawSeparator,
169     HtmlLbox_ToggleMulti,
170     HtmlLbox_SelectAll,
171     HtmlLbox_UpdateItem,
172     HtmlLbox_GetItemRect,
173 
174     HtmlLbox_SetBgCol,
175     HtmlLbox_SetSelBgCol,
176     HtmlLbox_SetSelFgCol,
177 
178     HtmlLbox_Clear,
179 
180     // it is important for the id corresponding to the "About" command to have
181     // this standard value as otherwise it won't be handled properly under Mac
182     // (where it is special and put into the "Apple" menu)
183     HtmlLbox_About = wxID_ABOUT
184 };
185 
186 // ----------------------------------------------------------------------------
187 // event tables and other macros for wxWidgets
188 // ----------------------------------------------------------------------------
189 
190 wxBEGIN_EVENT_TABLE(MyFrame, wxFrame)
191     EVT_MENU(HtmlLbox_CustomBox,  MyFrame::OnSimpleOrCustomBox)
192     EVT_MENU(HtmlLbox_SimpleBox,  MyFrame::OnSimpleOrCustomBox)
193     EVT_MENU(HtmlLbox_Quit,  MyFrame::OnQuit)
194 
195     EVT_MENU(HtmlLbox_SetMargins, MyFrame::OnSetMargins)
196     EVT_MENU(HtmlLbox_DrawSeparator, MyFrame::OnDrawSeparator)
197     EVT_MENU(HtmlLbox_ToggleMulti, MyFrame::OnToggleMulti)
198     EVT_MENU(HtmlLbox_SelectAll, MyFrame::OnSelectAll)
199     EVT_MENU(HtmlLbox_UpdateItem, MyFrame::OnUpdateItem)
200     EVT_MENU(HtmlLbox_GetItemRect, MyFrame::OnGetItemRect)
201 
202     EVT_MENU(HtmlLbox_About, MyFrame::OnAbout)
203 
204     EVT_MENU(HtmlLbox_SetBgCol, MyFrame::OnSetBgCol)
205     EVT_MENU(HtmlLbox_SetSelBgCol, MyFrame::OnSetSelBgCol)
206     EVT_MENU(HtmlLbox_SetSelFgCol, MyFrame::OnSetSelFgCol)
207 
208     EVT_MENU(HtmlLbox_Clear, MyFrame::OnClear)
209 
210     EVT_UPDATE_UI(HtmlLbox_SelectAll, MyFrame::OnUpdateUISelectAll)
211 
212 
213     EVT_LISTBOX(wxID_ANY, MyFrame::OnLboxSelect)
214     EVT_LISTBOX_DCLICK(wxID_ANY, MyFrame::OnLboxDClick)
215 
216 
217     // the HTML listbox's events
218     EVT_HTML_LINK_CLICKED(wxID_ANY, MyFrame::OnHtmlLinkClicked)
219     EVT_HTML_CELL_HOVER(wxID_ANY, MyFrame::OnHtmlCellHover)
220     EVT_HTML_CELL_CLICKED(wxID_ANY, MyFrame::OnHtmlCellClicked)
221 
222 wxEND_EVENT_TABLE()
223 
224 wxIMPLEMENT_APP(MyApp);
225 
226 // ============================================================================
227 // MyFrame
228 // ============================================================================
229 
230 // ----------------------------------------------------------------------------
231 // MyFrame ctor/dtor
232 // ----------------------------------------------------------------------------
233 
234 // frame constructor
MyFrame()235 MyFrame::MyFrame()
236        : wxFrame(NULL, wxID_ANY, "HtmlLbox wxWidgets Sample",
237                  wxDefaultPosition, wxSize(500, 500))
238 {
239     // set the frame icon
240     SetIcon(wxICON(sample));
241 
242 #if wxUSE_MENUS
243     // create a menu bar
244     wxMenu *menuFile = new wxMenu;
245     menuFile->AppendRadioItem(HtmlLbox_CustomBox, "Use custom box",
246                               "Use a wxHtmlListBox virtual class control");
247     menuFile->AppendRadioItem(HtmlLbox_SimpleBox, "Use simple box",
248                               "Use a wxSimpleHtmlListBox control");
249     menuFile->AppendSeparator();
250     menuFile->Append(HtmlLbox_Quit, "E&xit\tAlt-X", "Quit this program");
251 
252     // create our specific menu
253     wxMenu *menuHLbox = new wxMenu;
254     menuHLbox->Append(HtmlLbox_SetMargins,
255                       "Set &margins...\tCtrl-G",
256                       "Change the margins around the items");
257     menuHLbox->AppendCheckItem(HtmlLbox_DrawSeparator,
258                                "&Draw separators\tCtrl-D",
259                                "Toggle drawing separators between cells");
260     menuHLbox->AppendSeparator();
261     menuHLbox->AppendCheckItem(HtmlLbox_ToggleMulti,
262                                "&Multiple selection\tCtrl-M",
263                                "Toggle multiple selection on/off");
264     menuHLbox->AppendSeparator();
265     menuHLbox->Append(HtmlLbox_SelectAll, "Select &all items\tCtrl-A");
266     menuHLbox->Append(HtmlLbox_UpdateItem, "Update &first item\tCtrl-U");
267     menuHLbox->Append(HtmlLbox_GetItemRect, "Show &rectangle of item #10\tCtrl-R");
268     menuHLbox->AppendSeparator();
269     menuHLbox->Append(HtmlLbox_SetBgCol, "Set &background...\tCtrl-B");
270     menuHLbox->Append(HtmlLbox_SetSelBgCol,
271                       "Set &selection background...\tCtrl-S");
272     menuHLbox->AppendCheckItem(HtmlLbox_SetSelFgCol,
273                                "Keep &foreground in selection\tCtrl-F");
274 
275     menuHLbox->AppendSeparator();
276     menuHLbox->Append(HtmlLbox_Clear, "&Clear\tCtrl-L");
277 
278     // the "About" item should be in the help menu
279     wxMenu *helpMenu = new wxMenu;
280     helpMenu->Append(HtmlLbox_About, "&About\tF1", "Show about dialog");
281 
282     // now append the freshly created menu to the menu bar...
283     wxMenuBar *menuBar = new wxMenuBar();
284     menuBar->Append(menuFile, "&File");
285     menuBar->Append(menuHLbox, "&Listbox");
286     menuBar->Append(helpMenu, "&Help");
287 
288     menuBar->Check(HtmlLbox_DrawSeparator, true);
289 
290     // ... and attach this menu bar to the frame
291     SetMenuBar(menuBar);
292 #endif // wxUSE_MENUS
293 
294 #if wxUSE_STATUSBAR
295     // create a status bar just for fun (by default with 1 pane only)
296     CreateStatusBar(2);
297     SetStatusText("Welcome to wxWidgets!");
298 #endif // wxUSE_STATUSBAR
299 
300     // create the child controls
301     CreateBox();
302     wxTextCtrl *text = new wxTextCtrl(this, wxID_ANY, "",
303                                       wxDefaultPosition, wxDefaultSize,
304                                       wxTE_MULTILINE);
305     delete wxLog::SetActiveTarget(new wxLogTextCtrl(text));
306 
307     // and lay them out
308     wxSizer *sizer = new wxBoxSizer(wxHORIZONTAL);
309     sizer->Add(m_hlbox, 2, wxGROW);
310     sizer->Add(text, 3, wxGROW);
311 
312     SetSizer(sizer);
313 }
314 
~MyFrame()315 MyFrame::~MyFrame()
316 {
317     delete wxLog::SetActiveTarget(NULL);
318 }
319 
CreateBox()320 void MyFrame::CreateBox()
321 {
322     bool multi = GetMenuBar()->IsChecked(HtmlLbox_ToggleMulti);
323 
324     if ( GetMenuBar()->IsChecked(HtmlLbox_CustomBox) )
325     {
326         m_hlbox = new MyHtmlListBox(this, multi);
327     }
328     else // simple listbox
329     {
330         m_hlbox = new wxSimpleHtmlListBox(this, wxID_ANY, wxDefaultPosition, wxDefaultSize,
331                                           0, NULL, multi ? wxLB_MULTIPLE : 0);
332 
333         // unlike wxHtmlListBox which is abstract, wxSimpleHtmlListBox is a
334         // concrete control and doesn't support virtual mode, this we need
335         // to add all of its items from the beginning
336         wxArrayString arr;
337         for (size_t n = 0; n < 1000; n++ )
338         {
339             wxColour clr((unsigned char)(abs((int)n - 192) % 256),
340                          (unsigned char)(abs((int)n - 256) % 256),
341                          (unsigned char)(abs((int)n - 128) % 256));
342             int level = n % 6 + 1;
343 
344             wxString label = wxString::Format("<h%d><font color=%s>"
345                     "Item</font> <b>%lu</b>"
346                     "</h%d>",
347                     level,
348                     clr.GetAsString(wxC2S_HTML_SYNTAX),
349                     (unsigned long)n, level);
350             arr.Add(label);
351         }
352 
353         GetSimpleBox()->Append(arr);
354     }
355 }
356 
357 
358 // ----------------------------------------------------------------------------
359 // menu event handlers
360 // ----------------------------------------------------------------------------
361 
OnSimpleOrCustomBox(wxCommandEvent & WXUNUSED (event))362 void MyFrame::OnSimpleOrCustomBox(wxCommandEvent& WXUNUSED(event))
363 {
364     wxWindow *old = m_hlbox;
365 
366     // we need to recreate the listbox
367     CreateBox();
368     GetSizer()->Replace(old, m_hlbox);
369     delete old;
370 
371     GetSizer()->Layout();
372     Refresh();
373 }
374 
OnQuit(wxCommandEvent & WXUNUSED (event))375 void MyFrame::OnQuit(wxCommandEvent& WXUNUSED(event))
376 {
377     // true is to force the frame to close
378     Close(true);
379 }
380 
OnAbout(wxCommandEvent & WXUNUSED (event))381 void MyFrame::OnAbout(wxCommandEvent& WXUNUSED(event))
382 {
383     wxMessageBox("This sample shows wxHtmlListBox class.\n"
384                  "\n"
385                  "(c) 2003 Vadim Zeitlin",
386                  "About HtmlLbox",
387                  wxOK | wxICON_INFORMATION,
388                  this);
389 }
390 
OnSetMargins(wxCommandEvent & WXUNUSED (event))391 void MyFrame::OnSetMargins(wxCommandEvent& WXUNUSED(event))
392 {
393     long margin = wxGetNumberFromUser
394                   (
395                     "Enter the margins to use for the listbox items.",
396                     "Margin: ",
397                     "HtmlLbox: Set the margins",
398                     0, 0, 20,
399                     this
400                   );
401 
402     if ( margin != -1 )
403     {
404         m_hlbox->SetMargins(margin, margin);
405         m_hlbox->RefreshAll();
406     }
407 }
408 
OnToggleMulti(wxCommandEvent & WXUNUSED (event))409 void MyFrame::OnToggleMulti(wxCommandEvent& WXUNUSED(event))
410 {
411     wxWindow *old = m_hlbox;
412 
413     // we need to recreate the listbox
414     CreateBox();
415     GetSizer()->Replace(old, m_hlbox);
416     delete old;
417 
418     GetSizer()->Layout();
419 }
420 
OnSelectAll(wxCommandEvent & WXUNUSED (event))421 void MyFrame::OnSelectAll(wxCommandEvent& WXUNUSED(event))
422 {
423     m_hlbox->SelectAll();
424 }
425 
OnUpdateUISelectAll(wxUpdateUIEvent & event)426 void MyFrame::OnUpdateUISelectAll(wxUpdateUIEvent& event)
427 {
428     event.Enable( m_hlbox && m_hlbox->HasMultipleSelection() );
429 }
430 
OnUpdateItem(wxCommandEvent & WXUNUSED (event))431 void MyFrame::OnUpdateItem(wxCommandEvent& WXUNUSED(event))
432 {
433     if (GetMyBox())
434         GetMyBox()->UpdateFirstItem();
435 }
436 
OnGetItemRect(wxCommandEvent & WXUNUSED (event))437 void MyFrame::OnGetItemRect(wxCommandEvent& WXUNUSED(event))
438 {
439     static const int ITEM = 10;
440     const wxRect r = m_hlbox->GetItemRect(ITEM);
441     wxLogMessage("Rect of item %d: (%d, %d)-(%d, %d)",
442                  ITEM, r.x, r.y, r.x + r.width, r.y + r.height);
443 }
444 
OnSetBgCol(wxCommandEvent & WXUNUSED (event))445 void MyFrame::OnSetBgCol(wxCommandEvent& WXUNUSED(event))
446 {
447     wxColour col = wxGetColourFromUser(this, m_hlbox->GetBackgroundColour());
448     if ( col.IsOk() )
449     {
450         m_hlbox->SetBackgroundColour(col);
451         m_hlbox->Refresh();
452 
453 #if wxUSE_STATUSBAR
454         SetStatusText("Background colour changed.");
455 #endif // wxUSE_STATUSBAR
456     }
457 }
458 
OnSetSelBgCol(wxCommandEvent & WXUNUSED (event))459 void MyFrame::OnSetSelBgCol(wxCommandEvent& WXUNUSED(event))
460 {
461     wxColour col = wxGetColourFromUser(this, m_hlbox->GetSelectionBackground());
462     if ( col.IsOk() )
463     {
464         m_hlbox->SetSelectionBackground(col);
465         m_hlbox->Refresh();
466 
467 #if wxUSE_STATUSBAR
468         SetStatusText("Selection background colour changed.");
469 #endif // wxUSE_STATUSBAR
470     }
471 }
472 
OnSetSelFgCol(wxCommandEvent & event)473 void MyFrame::OnSetSelFgCol(wxCommandEvent& event)
474 {
475     if (GetMyBox())
476     {
477         GetMyBox()->SetChangeSelFg(!event.IsChecked());
478         GetMyBox()->Refresh();
479     }
480 }
481 
OnClear(wxCommandEvent & WXUNUSED (event))482 void MyFrame::OnClear(wxCommandEvent& WXUNUSED(event))
483 {
484     m_hlbox->Clear();
485 }
486 
OnHtmlLinkClicked(wxHtmlLinkEvent & event)487 void MyFrame::OnHtmlLinkClicked(wxHtmlLinkEvent &event)
488 {
489     wxLogMessage("The url '%s' has been clicked!", event.GetLinkInfo().GetHref());
490 
491     if (GetMyBox())
492     {
493         GetMyBox()->m_linkClicked = true;
494         GetMyBox()->RefreshRow(1);
495     }
496 }
497 
OnHtmlCellHover(wxHtmlCellEvent & event)498 void MyFrame::OnHtmlCellHover(wxHtmlCellEvent &event)
499 {
500     wxLogMessage("Mouse moved over cell %p at %d;%d",
501                  event.GetCell(), event.GetPoint().x, event.GetPoint().y);
502 }
503 
OnHtmlCellClicked(wxHtmlCellEvent & event)504 void MyFrame::OnHtmlCellClicked(wxHtmlCellEvent &event)
505 {
506     wxLogMessage("Click over cell %p at %d;%d",
507                  event.GetCell(), event.GetPoint().x, event.GetPoint().y);
508 
509     // if we don't skip the event, OnHtmlLinkClicked won't be called!
510     event.Skip();
511 }
512 
513 // ----------------------------------------------------------------------------
514 // listbox event handlers
515 // ----------------------------------------------------------------------------
516 
OnLboxSelect(wxCommandEvent & event)517 void MyFrame::OnLboxSelect(wxCommandEvent& event)
518 {
519     wxLogMessage("Listbox selection is now %d.", event.GetInt());
520 
521     if ( m_hlbox->HasMultipleSelection() )
522     {
523         wxString s;
524 
525         bool first = true;
526         unsigned long cookie;
527         for ( int item = m_hlbox->GetFirstSelected(cookie);
528               item != wxNOT_FOUND;
529               item = m_hlbox->GetNextSelected(cookie) )
530         {
531             if ( first )
532                 first = false;
533             else
534                 s << ", ";
535 
536             s << item;
537         }
538 
539         if ( !s.empty() )
540         {
541             wxLogMessage("Selected items: %s", s);
542         }
543     }
544 
545 #if wxUSE_STATUSBAR
546     SetStatusText(wxString::Format(
547                     "# items selected = %lu",
548                     (unsigned long)m_hlbox->GetSelectedCount()
549                   ));
550 #endif // wxUSE_STATUSBAR
551 }
552 
553 // ============================================================================
554 // MyHtmlListBox
555 // ============================================================================
556 
557 wxIMPLEMENT_DYNAMIC_CLASS(MyHtmlListBox, wxHtmlListBox);
558 
MyHtmlListBox(wxWindow * parent,bool multi)559 MyHtmlListBox::MyHtmlListBox(wxWindow *parent, bool multi)
560              : wxHtmlListBox(parent, wxID_ANY, wxDefaultPosition, wxDefaultSize,
561                              multi ? wxLB_MULTIPLE : 0)
562 {
563     m_change = true;
564     m_firstItemUpdated = false;
565     m_linkClicked = false;
566 
567 
568     SetMargins(5, 5);
569 
570 #ifdef USE_HTML_FILE
571     if ( !m_file.Open("results") )
572     {
573         wxLogError("Failed to open results file");
574     }
575     else
576     {
577         SetItemCount(m_file.GetLineCount());
578     }
579 #else
580     SetItemCount(1000);
581 #endif
582 
583     SetSelection(3);
584 }
585 
OnDrawSeparator(wxDC & dc,wxRect & rect,size_t) const586 void MyHtmlListBox::OnDrawSeparator(wxDC& dc, wxRect& rect, size_t) const
587 {
588     if ( ((MyFrame *)GetParent())->
589             GetMenuBar()->IsChecked(HtmlLbox_DrawSeparator) )
590     {
591         dc.SetPen(*wxBLACK_DASHED_PEN);
592         dc.DrawLine(rect.x, rect.y, rect.GetRight(), rect.y);
593         dc.DrawLine(rect.x, rect.GetBottom(), rect.GetRight(), rect.GetBottom());
594     }
595 }
596 
OnGetItem(size_t n) const597 wxString MyHtmlListBox::OnGetItem(size_t n) const
598 {
599     if ( !n && m_firstItemUpdated )
600     {
601         return "<h1><b>Just updated</b></h1>";
602     }
603 
604 #ifdef USE_HTML_FILE
605     wxString s;
606     if ( m_file.IsOpened() )
607         s = m_file[n];
608 
609     return s;
610 #else
611     int level = n % 6 + 1;
612 
613     wxColour clr((unsigned char)(abs((int)n - 192) % 256),
614                  (unsigned char)(abs((int)n - 256) % 256),
615                  (unsigned char)(abs((int)n - 128) % 256));
616 
617     wxString label = wxString::Format("<h%d><font color=%s>"
618                                       "Item</font> <b>%lu</b>"
619                                       "</h%d>",
620                                       level,
621                                       clr.GetAsString(wxC2S_HTML_SYNTAX),
622                                       (unsigned long)n, level);
623     if ( n == 1 )
624     {
625         if ( !m_linkClicked )
626             label += "<a href='1'>Click here...</a>";
627         else
628             label += "<font color='#9999ff'>Clicked here...</font>";
629     }
630 
631     return label;
632 #endif
633 }
634 
GetSelectedTextColour(const wxColour & colFg) const635 wxColour MyHtmlListBox::GetSelectedTextColour(const wxColour& colFg) const
636 {
637     return m_change ? wxHtmlListBox::GetSelectedTextColour(colFg) : colFg;
638 }
639 
UpdateFirstItem()640 void MyHtmlListBox::UpdateFirstItem()
641 {
642     m_firstItemUpdated = !m_firstItemUpdated;
643 
644     RefreshRow(0);
645 }
646