2012-11-28 11:22:11 +00:00
|
|
|
// This file is part of BOINC.
|
|
|
|
// http://boinc.berkeley.edu
|
|
|
|
// Copyright (C) 2008 University of California
|
|
|
|
//
|
|
|
|
// BOINC is free software; you can redistribute it and/or modify it
|
|
|
|
// under the terms of the GNU Lesser General Public License
|
|
|
|
// as published by the Free Software Foundation,
|
|
|
|
// either version 3 of the License, or (at your option) any later version.
|
|
|
|
//
|
|
|
|
// BOINC is distributed in the hope that it will be useful,
|
|
|
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
|
|
|
// See the GNU Lesser General Public License for more details.
|
|
|
|
//
|
|
|
|
// You should have received a copy of the GNU Lesser General Public License
|
|
|
|
// along with BOINC. If not, see <http://www.gnu.org/licenses/>.
|
2010-08-15 14:17:01 +00:00
|
|
|
|
2010-08-18 18:50:41 +00:00
|
|
|
#ifndef _BOINCHTMLLBOX_H_
|
|
|
|
#define _BOINCHTMLLBOX_H_
|
2010-08-15 14:17:01 +00:00
|
|
|
|
2012-11-28 11:22:11 +00:00
|
|
|
#include "wx/htmllbox.h" // base class
|
2010-08-15 14:17:01 +00:00
|
|
|
|
2010-08-17 23:26:36 +00:00
|
|
|
extern const wxChar BOINCHtmlListBoxNameStr[];
|
2010-08-15 14:17:01 +00:00
|
|
|
|
|
|
|
// ----------------------------------------------------------------------------
|
|
|
|
// CBOINCHtmlListBox
|
|
|
|
// ----------------------------------------------------------------------------
|
|
|
|
|
|
|
|
// small border always added to the cells:
|
|
|
|
#define CELL_BORDER 2
|
|
|
|
|
2012-11-28 11:22:11 +00:00
|
|
|
class CBOINCHtmlListBox : public wxHtmlListBox
|
2010-08-15 14:17:01 +00:00
|
|
|
{
|
|
|
|
DECLARE_ABSTRACT_CLASS(CBOINCHtmlListBox)
|
|
|
|
public:
|
|
|
|
// constructors and such
|
|
|
|
// ---------------------
|
|
|
|
|
|
|
|
// default constructor, you must call Create() later
|
|
|
|
CBOINCHtmlListBox();
|
|
|
|
|
|
|
|
// normal constructor which calls Create() internally
|
|
|
|
CBOINCHtmlListBox(wxWindow *parent,
|
|
|
|
wxWindowID id = wxID_ANY,
|
|
|
|
const wxPoint& pos = wxDefaultPosition,
|
|
|
|
const wxSize& size = wxDefaultSize,
|
|
|
|
long style = 0,
|
|
|
|
const wxString& name = BOINCHtmlListBoxNameStr);
|
|
|
|
|
|
|
|
// destructor cleans up whatever resources we use
|
|
|
|
virtual ~CBOINCHtmlListBox();
|
|
|
|
|
2012-11-28 11:22:11 +00:00
|
|
|
int OnGetItemHeight(size_t i) { return (int)OnMeasureItem(i); }
|
|
|
|
int GetItemHeight(size_t i) { return (int)OnMeasureItem(i); }
|
2010-08-15 14:40:23 +00:00
|
|
|
|
2012-11-28 11:22:11 +00:00
|
|
|
void GetItemRect(size_t item, wxRect& rect)
|
|
|
|
{
|
|
|
|
rect.height = GetItemHeight(item);
|
|
|
|
rect.width = GetSize().GetWidth() - 4;
|
|
|
|
}
|
2010-08-15 14:17:01 +00:00
|
|
|
|
|
|
|
protected:
|
2012-11-28 11:22:11 +00:00
|
|
|
// The following overrides of methods in wxHtmlListBox and wxVListBox make
|
|
|
|
// it appear as if we don't allow the user to select entries in the notices.
|
|
|
|
wxColour GetSelectedTextColour(const wxColour& colFg) const { return colFg; }
|
|
|
|
wxColour GetSelectedTextBgColour(const wxColour& colBg) const { return colBg; }
|
2012-11-28 11:47:21 +00:00
|
|
|
void OnDrawBackground(wxDC&, const wxRect&, size_t) const {}
|
2012-12-18 12:38:47 +00:00
|
|
|
|
|
|
|
// The following overrides of methods in wxHtmlListBox
|
|
|
|
// reduce CPU usage and avoid crashes
|
|
|
|
void OnMouseMove(wxMouseEvent&) {}
|
|
|
|
void OnInternalIdle() {}
|
2010-08-15 14:17:01 +00:00
|
|
|
|
|
|
|
private:
|
2012-11-28 11:22:11 +00:00
|
|
|
virtual wxHtmlOpeningStatus OnHTMLOpeningURL(wxHtmlURLType type,
|
2010-08-15 14:17:01 +00:00
|
|
|
const wxString& url,
|
|
|
|
wxString *redirect) const;
|
2012-12-18 12:38:47 +00:00
|
|
|
DECLARE_EVENT_TABLE()
|
2010-08-15 14:17:01 +00:00
|
|
|
DECLARE_NO_COPY_CLASS(CBOINCHtmlListBox)
|
|
|
|
};
|
|
|
|
|
2010-08-18 18:50:41 +00:00
|
|
|
#endif // _BOINCHTMLLBOX_H_
|
2010-08-15 14:17:01 +00:00
|
|
|
|