Commit c06e2254 authored by twanvl's avatar twanvl

Alignment is preserved when sorting (changing column images)

parent cc05d2c2
......@@ -132,7 +132,7 @@ void ItemList::sortBy(long column, bool ascending) {
if (i == column) {
SetColumnImage(i, sort_ascending ? 0 : 1); // arrow up/down
} else if (i == sort_by_column) {
ClearColumnImage(i);
SetColumnImage(i, -1);
}
}
// sort list
......@@ -141,6 +141,16 @@ void ItemList::sortBy(long column, bool ascending) {
refreshList();
}
void ItemList::SetColumnImage(int col, int image) {
// The wx version of this function is broken,
// setting the wxLIST_MASK_IMAGE also sets the FORMAT flag, so we lose alignment info
wxListItem item;
item.SetMask(wxLIST_MASK_IMAGE | wxLIST_MASK_FORMAT);
GetColumn(col, item);
item.SetImage(image);
SetColumn(col, item);
}
// ----------------------------------------------------------------------------- : ItemList : Window events
void ItemList::onColumnClick(wxListEvent& ev) {
......
......@@ -92,6 +92,8 @@ class ItemList : public wxListView {
private:
struct ItemComparer; // for comparing items
void SetColumnImage(int col, int image);
// --------------------------------------------------- : Window events
DECLARE_EVENT_TABLE();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment