Commit f8d23544 authored by twanvl's avatar twanvl

card viewers/editors inherit from wxPanel;

GallertList doesn't call select() from onSize
parent 68f2d425
...@@ -65,7 +65,7 @@ void DataEditor::addAction(Action* action) { ...@@ -65,7 +65,7 @@ void DataEditor::addAction(Action* action) {
// ----------------------------------------------------------------------------- : Selection // ----------------------------------------------------------------------------- : Selection
bool DataEditor::AcceptsFocus() const { bool DataEditor::AcceptsFocus() const {
return wxControl::AcceptsFocus(); return wxWindow::AcceptsFocus();
} }
void DataEditor::select(ValueViewer* v) { void DataEditor::select(ValueViewer* v) {
......
...@@ -20,7 +20,7 @@ DEFINE_EVENT_TYPE(EVENT_SIZE_CHANGE); ...@@ -20,7 +20,7 @@ DEFINE_EVENT_TYPE(EVENT_SIZE_CHANGE);
// ----------------------------------------------------------------------------- : CardViewer // ----------------------------------------------------------------------------- : CardViewer
CardViewer::CardViewer(Window* parent, int id, long style) CardViewer::CardViewer(Window* parent, int id, long style)
: wxControl(parent, id, wxDefaultPosition, wxDefaultSize, style) : wxPanel(parent, id, wxDefaultPosition, wxDefaultSize, style & wxNO_BORDER ? style : style | wxSUNKEN_BORDER)
, up_to_date(false) , up_to_date(false)
{} {}
......
...@@ -22,7 +22,7 @@ DECLARE_EVENT_TYPE(EVENT_SIZE_CHANGE, <not used>) ...@@ -22,7 +22,7 @@ DECLARE_EVENT_TYPE(EVENT_SIZE_CHANGE, <not used>)
// ----------------------------------------------------------------------------- : CardViewer // ----------------------------------------------------------------------------- : CardViewer
/// A control to view a single card /// A control to view a single card
class CardViewer : public wxControl, public DataViewer { class CardViewer : public wxPanel, public DataViewer {
public: public:
CardViewer(Window* parent, int id, long style = 0); CardViewer(Window* parent, int id, long style = 0);
......
...@@ -72,8 +72,17 @@ void GalleryList::select(size_t item, size_t subcolumn, bool event) { ...@@ -72,8 +72,17 @@ void GalleryList::select(size_t item, size_t subcolumn, bool event) {
} }
void GalleryList::update() { void GalleryList::update() {
select(subcolumns[active_subcolumn].selection); // ensure selection is visible
updateScrollbar(); SubColumn col = subcolumns[active_subcolumn];
if (col.selection != NO_SELECTION) {
if (itemStart(col.selection) < visible_start) {
scrollTo(itemStart(col.selection), false);
updateScrollbar();
} else if (itemEnd(col.selection) > visibleEnd()) {
scrollTo(itemEnd(col.selection) + visible_start - visibleEnd(), false);
updateScrollbar();
}
}
Refresh(false); Refresh(false);
} }
......
...@@ -37,7 +37,7 @@ void TextCtrl::draw(DC& dc) { ...@@ -37,7 +37,7 @@ void TextCtrl::draw(DC& dc) {
} }
bool TextCtrl::AcceptsFocus() const { bool TextCtrl::AcceptsFocus() const {
return wxControl::AcceptsFocus() && return wxWindow::AcceptsFocus() &&
!viewers.empty() && !viewers.empty() &&
static_cast<FakeTextValue&>(*viewers.front()->getValue()).editable; static_cast<FakeTextValue&>(*viewers.front()->getValue()).editable;
} }
......
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