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:
twanvl
2007-05-14 00:43:54 +00:00
parent 73c2d9b152
commit f30b14b0f7
2 changed files with 13 additions and 1 deletions
+11 -1
View File
@@ -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) {
+2
View File
@@ -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();