Multicolumn support (major level) for gallery list

git-svn-id: svn://svn.code.sf.net/p/magicseteditor/code/trunk@1137 0fc631ac-6414-0410-93d0-97cfa31319b6
This commit is contained in:
twanvl
2008-08-11 12:21:38 +00:00
parent 62d86bf8c3
commit 5fddaa3715
2 changed files with 40 additions and 11 deletions
+3 -2
View File
@@ -50,6 +50,7 @@ class GalleryList : public wxPanel {
size_t active_subcolumn; ///< The active subcolumn
wxSize item_size; ///< The total size of a single item (over all columns)
int direction; ///< Direction of the list, can be wxHORIZONTAL or wxVERTICAL
size_t column_count; ///< Number of major level columns (if vertical) or rows (if horizontal)
bool always_focused; ///< Always draw as if focused
/// Redraw the list after changing the selection or the number of items
@@ -110,10 +111,10 @@ class GalleryList : public wxPanel {
}
/// Pixel position of an item
inline int itemStart(size_t item) const {
return (int)item * (mainSize(item_size) + SPACING);
return (int)(item / column_count) * (mainSize(item_size) + SPACING);
}
inline int itemEnd(size_t item) const {
return (int)(item + 1) * (mainSize(item_size) + SPACING) + MARGIN;
return (int)(item / column_count + 1) * (mainSize(item_size) + SPACING) + MARGIN;
}
/// Main component of a size (i.e. in the direction of this list)
inline int mainSize(wxSize s) const {