35 #include <wx/imaglist.h>
133 if (
size_t(item) >=
m_Data.size())
139 return m_Data[index].m_Severity;
141 return m_Data[index].m_SeqId;
143 return m_Data[index].m_Title;
145 return m_Data[index].m_ErrMsg;
163 static auto compare_fn = [](
auto itemA,
auto itemB,
bool ascending) {
164 return ascending ? itemA < itemB : itemA > itemB;
170 }
else if (revert_direction) {
175 auto itemA = m_Data[indexA];
176 auto itemB = m_Data[indexB];
180 return compare_fn(itemA.m_Severity, itemB.m_Severity, m_Ascending);
182 return compare_fn(itemA.m_SeqId, itemB.m_SeqId, m_Ascending);
184 return compare_fn(itemA.m_Title, itemB.m_Title, m_Ascending);
186 return compare_fn(itemA.m_ErrMsg, itemB.m_ErrMsg, m_Ascending);
194 : wxListCtrl(parent, id, pos,
size, style)
200 font.SetUnderlined(
true);
204 wxInitAllImageHandlers();
205 static bool bitmap_registered =
false;
206 if (!bitmap_registered)
210 bitmap_registered =
true;
220 InsertColumn(0,
_(
" "), wxLIST_FORMAT_LEFT, 16);
221 InsertColumn(1,
_(
" Severity"), wxLIST_FORMAT_LEFT);
222 InsertColumn(2,
_(
"Sequence"), wxLIST_FORMAT_LEFT);
223 InsertColumn(3,
_(
"Error title"), wxLIST_FORMAT_LEFT);
224 InsertColumn(4,
_(
"Message & Object Description"), wxLIST_FORMAT_LEFT, 750);
272 if (sorted_col > 0) {
278 if (GetItemCount() > 0) {
279 SetColumnWidth(0, wxLIST_AUTOSIZE_USEHEADER);
280 SetColumnWidth(1, wxLIST_AUTOSIZE_USEHEADER);
281 SetColumnWidth(2, wxLIST_AUTOSIZE);
282 SetColumnWidth(3, wxLIST_AUTOSIZE);
283 SetColumnWidth(4, wxLIST_AUTOSIZE);
286 SetColumnWidth(0, wxLIST_AUTOSIZE_USEHEADER);
287 SetColumnWidth(1, wxLIST_AUTOSIZE_USEHEADER);
288 SetColumnWidth(2, wxLIST_AUTOSIZE_USEHEADER);
289 SetColumnWidth(3, wxLIST_AUTOSIZE_USEHEADER);
290 SetColumnWidth(4, wxLIST_AUTOSIZE_USEHEADER);
297 item.SetMask(wxLIST_MASK_IMAGE);
313 long selected_data_index;
315 if (selected_index != -1) {
319 SetItemState(selected_index, 0, wxLIST_STATE_SELECTED);
322 auto sort_by_col =
event.GetColumn();
325 if (sorted_col != sort_by_col && sorted_col > 0) {
327 item.SetMask(wxLIST_MASK_IMAGE);
329 this->SetColumn(sorted_col, item);
338 item.SetMask(wxLIST_MASK_IMAGE);
344 if (selected_index != -1) {
346 SetItemState(index_to_select, wxLIST_STATE_SELECTED, wxLIST_STATE_SELECTED);
347 EnsureVisible(index_to_select);
353 return GetNextItem(-1, wxLIST_NEXT_ALL, wxLIST_STATE_SELECTED);
359 return find(ordered_indices.begin(), ordered_indices.end(), data_index) - ordered_indices.begin();
vector< long > m_OrderedIndices
vector to store ordered indices
string GetDataByCol(long item, long column) const
CErrorData & operator=(const CErrorData &other)
string GetItemText(long item) const
void SortByColumn(long col, bool revert_direction)
wxItemAttr m_SelectAttr
the item attribute for the selectable row
long x_FindIndexOfDataIndex(long data_index) const
virtual wxItemAttr * OnGetItemAttr(long item) const override
long x_GetSelectedIndex() const
virtual int OnGetItemImage(long item) const override
string GetItemText(long item) const
void SetData(CRef< CErrorData > error_data)
void OnColumnClicked(wxListEvent &event)
virtual wxString OnGetItemText(long item, long column) const override
CErrorListCtrl(wxWindow *parent, wxWindowID id=wxID_ANY, const wxPoint &pos=wxDefaultPosition, const wxSize &size=wxDefaultSize, long style=wxLC_REPORT|wxLC_VIRTUAL)
CRef< CErrorData > m_ListData
wxImageList * m_imageListSmall
long GetActualIndex(long item) const
virtual void RegisterFileAlias(const wxArtID &anId, const wxArtClient &aClient, const wxSize &aSize, const wxString &aName, long aType=wxBITMAP_TYPE_ANY, int anIndex=-1)
static const char * empty_xpm[]
static const char * down_xpm[]
static const char * up_xpm[]
static const char * column
#define END_NCBI_SCOPE
End previously defined NCBI scope.
#define BEGIN_NCBI_SCOPE
Define ncbi namespace.
constexpr auto sort(_Init &&init)
const struct ncbi::grid::netcache::search::fields::SIZE size
wxFileArtProvider * GetDefaultFileArtProvider()
wxString ToWxString(const string &s)