| 1 |
#ifndef HEADER_LIST_BOX_ITEM_ZZ_H |
| 2 |
#define HEADER_LIST_BOX_ITEM_ZZ_H |
| 3 |
|
| 4 |
#pragma once |
| 5 |
|
| 6 |
#include <ClanLib/gui.h> |
| 7 |
#include <string> |
| 8 |
|
| 9 |
class CL_ListBoxItem_ZZ : public CL_ListItem |
| 10 |
{ |
| 11 |
public: |
| 12 |
CL_ListBoxItem_ZZ(std::string const & levelname, bool solved) |
| 13 |
: solved(solved) |
| 14 |
{ |
| 15 |
str = levelname; |
| 16 |
} |
| 17 |
virtual ~CL_ListBoxItem_ZZ(){}; |
| 18 |
|
| 19 |
public: |
| 20 |
bool get_solved() const |
| 21 |
{ |
| 22 |
return solved; |
| 23 |
} |
| 24 |
|
| 25 |
std::string const & get_levelname() const |
| 26 |
{ |
| 27 |
return str; |
| 28 |
} |
| 29 |
|
| 30 |
protected: |
| 31 |
virtual bool less_than(const CL_ListItem & item) const |
| 32 |
{ |
| 33 |
// Assume that listbox contain items only this type |
| 34 |
CL_ListBoxItem_ZZ const * other = (CL_ListBoxItem_ZZ const *)&item; |
| 35 |
|
| 36 |
if (get_solved() == other->get_solved()) |
| 37 |
return get_levelname() < other->get_levelname(); |
| 38 |
|
| 39 |
return get_solved() == true; |
| 40 |
} |
| 41 |
virtual bool equal(const CL_ListItem & item) const |
| 42 |
{ |
| 43 |
// Assume that listbox contain items only this type |
| 44 |
CL_ListBoxItem_ZZ const * other = (CL_ListBoxItem_ZZ const *)&item; |
| 45 |
|
| 46 |
return get_solved() == other->get_solved() |
| 47 |
&& get_levelname() == other->get_levelname(); |
| 48 |
} |
| 49 |
|
| 50 |
private: |
| 51 |
bool solved; |
| 52 |
}; |
| 53 |
|
| 54 |
#endif // HEADER_LIST_BOX_ITEM_ZZ_H |