X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/bc55e31bdc7fbf6f1006f298ed8310e7972984e9..032bc940fcde34cc649eaa111cd6aff1cda66104:/src/generic/htmllbox.cpp diff --git a/src/generic/htmllbox.cpp b/src/generic/htmllbox.cpp index c70d7b85f4..c034af5f20 100644 --- a/src/generic/htmllbox.cpp +++ b/src/generic/htmllbox.cpp @@ -46,6 +46,9 @@ FORCE_WXHTML_MODULES() // small border always added to the cells: static const wxCoord CELL_BORDER = 2; +const wxChar wxHtmlListBoxNameStr[] = wxT("htmlListBox"); +const wxChar wxSimpleHtmlListBoxNameStr[] = wxT("simpleHtmlListBox"); + // ============================================================================ // private classes // ============================================================================ @@ -301,7 +304,7 @@ void wxHtmlListBox::CacheItem(size_t n) const // set the cell's ID to item's index so that CellCoordsToPhysical() // can quickly find the item: - cell->SetId(wxString::Format(_T("%u"), n)); + cell->SetId(wxString::Format(_T("%lu"), (unsigned long)n)); cell->Layout(GetClientSize().x - 2*GetMargins().x); @@ -402,6 +405,13 @@ void wxHtmlListBox::OnHTMLLinkClicked(const wxHtmlLinkInfo& link) OnLinkClicked(GetItemForCell(link.GetHtmlCell()), link); } +void wxHtmlListBox::OnLinkClicked(size_t WXUNUSED(n), + const wxHtmlLinkInfo& link) +{ + wxHtmlLinkEvent event(GetId(), link); + GetEventHandler()->ProcessEvent(event); +} + wxHtmlOpeningStatus wxHtmlListBox::OnHTMLOpeningURL(wxHtmlURLType WXUNUSED(type), const wxString& WXUNUSED(url), @@ -438,6 +448,16 @@ void wxHtmlListBox::SetHTMLStatusText(const wxString& WXUNUSED(text)) // nothing to do } +wxCursor wxHtmlListBox::GetHTMLCursor(HTMLCursor type) const +{ + // we don't want to show text selection cursor in listboxes + if (type == HTMLCursor_Text) + return wxHtmlWindow::GetDefaultHTMLCursor(HTMLCursor_Default); + + // in all other cases, use the same cursor as wxHtmlWindow: + return wxHtmlWindow::GetDefaultHTMLCursor(type); +} + // ---------------------------------------------------------------------------- // wxHtmlListBox handling of HTML links // ---------------------------------------------------------------------------- @@ -531,4 +551,131 @@ void wxHtmlListBox::OnLeftDown(wxMouseEvent& event) } } + +// ---------------------------------------------------------------------------- +// wxSimpleHtmlListBox +// ---------------------------------------------------------------------------- + +bool wxSimpleHtmlListBox::Create(wxWindow *parent, wxWindowID id, + const wxPoint& pos, + const wxSize& size, + int n, const wxString choices[], + long style, + const wxValidator& validator, + const wxString& name) +{ + if (!wxHtmlListBox::Create(parent, id, pos, size, style, name)) + return false; + + SetValidator(validator); + for (int i=0; iIsFrozen()) + RefreshAll(); +} + #endif // wxUSE_HTML