diff options
author | rubidium <rubidium@openttd.org> | 2008-05-17 13:01:30 +0000 |
---|---|---|
committer | rubidium <rubidium@openttd.org> | 2008-05-17 13:01:30 +0000 |
commit | 87015f5b6395f15a624f67e25dce10fe52a12c81 (patch) | |
tree | 46351975e7a6b7a08ca8eedc476a4109e9a1b776 /src/sortlist_type.h | |
parent | 8b5421290027ab67cba25225111e3561ddd7af07 (diff) | |
download | openttd-87015f5b6395f15a624f67e25dce10fe52a12c81.tar.xz |
(svn r13140) -Codechange: move the gui-list-sorting out of window_gui.h so window_gui.h only needs to be included in *_gui.cpp.
Diffstat (limited to 'src/sortlist_type.h')
-rw-r--r-- | src/sortlist_type.h | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/src/sortlist_type.h b/src/sortlist_type.h new file mode 100644 index 000000000..a3e428554 --- /dev/null +++ b/src/sortlist_type.h @@ -0,0 +1,31 @@ +/* $Id$ */ + +/** @file sortlist_type.h Base types for having sorted lists in GUIs. */ + +#ifndef SORTLIST_TYPE_H +#define SORTLIST_TYPE_H + +enum SortListFlags { + VL_NONE = 0, ///< no sort + VL_DESC = 1 << 0, ///< sort descending or ascending + VL_RESORT = 1 << 1, ///< instruct the code to resort the list in the next loop + VL_REBUILD = 1 << 2, ///< create sort-listing to use for qsort and friends + VL_END = 1 << 3, +}; +DECLARE_ENUM_AS_BIT_SET(SortListFlags); + +struct Listing { + bool order; ///< Ascending/descending + byte criteria; ///< Sorting criteria +}; + +template <typename T> +struct GUIList { + T* sort_list; ///< The items to sort. + SortListFlags flags; ///< used to control sorting/resorting/etc. + uint16 list_length; ///< length of the list being sorted + uint16 resort_timer; ///< resort list after a given amount of ticks if set + byte sort_type; ///< what criteria to sort on +}; + +#endif /* SORTLIST_TYPE_H */ |