Commit fd6ebfee authored by twanvl's avatar twanvl

Fancy theming of ListCtrls: explorer style (windows vista+)

This requires that we ev.Skip() EVT_MOTION, otherwise the list becomes very sluggish to update.
parent 25f21546
...@@ -10,7 +10,6 @@ ...@@ -10,7 +10,6 @@
#include <gui/control/card_list.hpp> #include <gui/control/card_list.hpp>
#include <gui/control/card_list_column_select.hpp> #include <gui/control/card_list_column_select.hpp>
#include <gui/icon_menu.hpp> #include <gui/icon_menu.hpp>
#include <gui/util.hpp>
#include <data/game.hpp> #include <data/game.hpp>
#include <data/field.hpp> #include <data/field.hpp>
#include <data/field/choice.hpp> #include <data/field/choice.hpp>
...@@ -57,7 +56,6 @@ CardListBase::CardListBase(Window* parent, int id, long additional_style) ...@@ -57,7 +56,6 @@ CardListBase::CardListBase(Window* parent, int id, long additional_style)
{ {
// add to the list of card lists // add to the list of card lists
card_lists.push_back(this); card_lists.push_back(this);
//enable_themed_selection_rectangle(this); // while this looks fancy, it is buggy
} }
CardListBase::~CardListBase() { CardListBase::~CardListBase() {
...@@ -368,6 +366,7 @@ void CardListBase::onChar(wxKeyEvent& ev) { ...@@ -368,6 +366,7 @@ void CardListBase::onChar(wxKeyEvent& ev) {
} }
void CardListBase::onDrag(wxMouseEvent& ev) { void CardListBase::onDrag(wxMouseEvent& ev) {
ev.Skip();
if (!allowModify()) return; if (!allowModify()) return;
if (ev.Dragging() && selected_item && sort_by_column < 0) { if (ev.Dragging() && selected_item && sort_by_column < 0) {
// reorder card list // reorder card list
...@@ -381,6 +380,7 @@ void CardListBase::onDrag(wxMouseEvent& ev) { ...@@ -381,6 +380,7 @@ void CardListBase::onDrag(wxMouseEvent& ev) {
// move card in the set // move card in the set
set->actions.addAction(new ReorderCardsAction(*set, item, selected_item_pos)); set->actions.addAction(new ReorderCardsAction(*set, item, selected_item_pos));
} }
ev.Skip(false);
} }
} }
} }
......
...@@ -23,6 +23,13 @@ ItemList::ItemList(Window* parent, int id, long additional_style, bool multi_sel ...@@ -23,6 +23,13 @@ ItemList::ItemList(Window* parent, int id, long additional_style, bool multi_sel
il->Add(load_resource_image(_("sort_asc")), Color(255,0,255)); il->Add(load_resource_image(_("sort_asc")), Color(255,0,255));
il->Add(load_resource_image(_("sort_desc")), Color(255,0,255)); il->Add(load_resource_image(_("sort_desc")), Color(255,0,255));
AssignImageList(il, wxIMAGE_LIST_SMALL); AssignImageList(il, wxIMAGE_LIST_SMALL);
// Theming things wx fails to do for us
#if defined(__WXMSW__) && defined(LVS_EX_DOUBLEBUFFER)
// Fancy theming (on windows)
enable_themed_selection_rectangle(this);
// Use double buffering
ListView_SetExtendedListViewStyle(GetHwnd(), ListView_GetExtendedListViewStyle(GetHwnd()) | LVS_EX_DOUBLEBUFFER);
#endif
} }
// ----------------------------------------------------------------------------- : ItemList : Selection // ----------------------------------------------------------------------------- : ItemList : Selection
......
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