mirror of
https://github.com/amyinspace/MagicSetEditor2.git
synced 2026-06-12 13:37:00 -04:00
Fix #11: Gallery list best size: Invalidate cache and don't use DoGetBestClientSize
Revert "Cleanup: use DoGetBestClientSize"
This reverts commit 5700005243.
DoGetBestClient size is a nice idea, but it doesn't take scrollbars into account.
This commit is contained in:
@@ -83,6 +83,7 @@ void GalleryList::update() {
|
|||||||
}
|
}
|
||||||
updateScrollbar();
|
updateScrollbar();
|
||||||
Refresh(false);
|
Refresh(false);
|
||||||
|
InvalidateBestSize();
|
||||||
}
|
}
|
||||||
|
|
||||||
size_t GalleryList::findItem(const wxMouseEvent& ev) const {
|
size_t GalleryList::findItem(const wxMouseEvent& ev) const {
|
||||||
@@ -263,13 +264,14 @@ void GalleryList::onChar(wxKeyEvent& ev) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
wxSize GalleryList::DoGetBestClientSize() const {
|
wxSize GalleryList::DoGetBestSize() const {
|
||||||
|
wxSize ws = GetSize(), cs = GetClientSize();
|
||||||
const int w = item_size.x + 2*MARGIN + 2*BORDER;
|
const int w = item_size.x + 2*MARGIN + 2*BORDER;
|
||||||
const int h = item_size.y + 2*MARGIN + 2*BORDER;
|
const int h = item_size.y + 2*MARGIN + 2*BORDER;
|
||||||
if (direction == wxHORIZONTAL) {
|
if (direction == wxHORIZONTAL) {
|
||||||
return wxSize(w, h * (int)column_count);
|
return wxSize(w, h * (int)column_count) + ws - cs;
|
||||||
} else {
|
} else {
|
||||||
return wxSize(w * (int)column_count, h);
|
return wxSize(w * (int)column_count, h) + ws - cs;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -71,7 +71,7 @@ class GalleryList : public wxPanel {
|
|||||||
virtual void onSelect(size_t item, size_t col, bool& changes) {}
|
virtual void onSelect(size_t item, size_t col, bool& changes) {}
|
||||||
|
|
||||||
/// Return the desired size of control
|
/// Return the desired size of control
|
||||||
virtual wxSize DoGetBestClientSize() const;
|
virtual wxSize DoGetBestSize() const;
|
||||||
|
|
||||||
/// Information on the subcolumns. These are columns inside items
|
/// Information on the subcolumns. These are columns inside items
|
||||||
struct SubColumn {
|
struct SubColumn {
|
||||||
|
|||||||
Reference in New Issue
Block a user