mirror of
https://github.com/amyinspace/MagicSetEditor2.git
synced 2026-06-10 04:57:00 -04:00
Alignment is preserved when sorting (changing column images)
git-svn-id: svn://svn.code.sf.net/p/magicseteditor/code/trunk@366 0fc631ac-6414-0410-93d0-97cfa31319b6
This commit is contained in:
@@ -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();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user