renamed GalleryList member column -> subcolumn, so we can have proper columns later on as well.

git-svn-id: svn://svn.code.sf.net/p/magicseteditor/code/trunk@1134 0fc631ac-6414-0410-93d0-97cfa31319b6
This commit is contained in:
twanvl
2008-08-11 11:56:35 +00:00
parent 36db4512c5
commit 351d5b7613
6 changed files with 82 additions and 79 deletions
+15 -15
View File
@@ -32,14 +32,14 @@ class GalleryList : public wxPanel {
GalleryList(Window* parent, int id, int direction = wxHORIZONTAL, bool always_focused = true);
/// Select the given column
void selectColumn(size_t column);
void selectSubColumn(size_t subcol);
/// Select the given item in the given column (or in the active column)
void select(size_t item, size_t column = NO_SELECTION, bool event = true);
void select(size_t item, size_t subcol = NO_SELECTION, bool event = true);
/// Is there an item selected?
inline bool hasSelection(size_t column = 0) const { return columns[column].selection < itemCount(); }
inline bool hasSelection(size_t subcol = 0) const { return subcolumns[subcol].selection < itemCount(); }
/// Is the given item selected?
inline bool isSelected(size_t item, size_t column = 0) const {
return column < columns.size() && columns[column].selection == item;
inline bool isSelected(size_t item, size_t subcol = 0) const {
return subcol < subcolumns.size() && subcolumns[subcol].selection == item;
}
/// Redraw only the selected items
@@ -47,10 +47,10 @@ class GalleryList : public wxPanel {
protected:
static const size_t NO_SELECTION = (size_t)-1;
size_t active_column; ///< The active column
wxSize item_size; ///< The total size of a single item (over all columns)
int direction; ///< Direction of the list, can be wxHORIZONTAL or wxVERTICAL
bool always_focused; ///< Always draw as if focused
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
bool always_focused; ///< Always draw as if focused
/// Redraw the list after changing the selection or the number of items
void update();
@@ -59,8 +59,8 @@ class GalleryList : public wxPanel {
virtual size_t itemCount() const = 0;
/// Draw an item
virtual void drawItem(DC& dc, int x, int y, size_t item) = 0;
/// How 'salient' should the selection in the given column be?
virtual double columnActivity(size_t col) const { return 0.7; }
/// How 'salient' should the selection in the given subcolumn be?
virtual double subcolumnActivity(size_t col) const { return 0.7; }
/// Filter calls to select, or apply some extra operaions
virtual void onSelect(size_t item, size_t col, bool& changes) {}
@@ -68,14 +68,14 @@ class GalleryList : public wxPanel {
/// Return the desired size of control
virtual wxSize DoGetBestSize() const;
/// Information on the columns
struct Column {
/// Information on the subcolumns. These are columns inside items
struct SubColumn {
wxPoint offset;
wxSize size;
bool can_select;
size_t selection;
};
vector<Column> columns;
vector<SubColumn> subcolumns;
private:
DECLARE_EVENT_TABLE();
@@ -121,7 +121,7 @@ class GalleryList : public wxPanel {
}
public:
typedef Column Column_for_typeof;
typedef SubColumn SubColumn_for_typeof;
protected:
/// Send an event
void sendEvent(WXTYPE type);