Appearance options support.
This commit is contained in:
@@ -7,16 +7,16 @@ struct ConfOption
|
||||
/* Name of this option. It's helpful to delimit this with newlines, as it'll
|
||||
* be the default display title. */
|
||||
CString name;
|
||||
void (*MoveData)( int &sel, bool ToSel );
|
||||
void (*MoveData)( int &sel, bool ToSel, const CStringArray &choices );
|
||||
|
||||
/* If MakeOptionsListCB is set, it'll be called by MakeOptionsList; otherwise
|
||||
* the contents of names is returned. */
|
||||
void MakeOptionsList( CStringArray &out ) const;
|
||||
|
||||
inline int Get() const { int sel; MoveData( sel, true ); return sel; }
|
||||
inline void Put( int sel ) const { MoveData( sel, false ); }
|
||||
inline int Get( const CStringArray &choices ) const { int sel; MoveData( sel, true, choices ); return sel; }
|
||||
inline void Put( int sel, const CStringArray &choices ) const { MoveData( sel, false, choices ); }
|
||||
|
||||
ConfOption( const char *n, void (*m)( int &sel, bool in ),
|
||||
ConfOption( const char *n, void (*m)( int &sel, bool in, const CStringArray &choices ),
|
||||
const char *c0=NULL, const char *c1=NULL, const char *c2=NULL, const char *c3=NULL, const char *c4=NULL, const char *c5=NULL, const char *c6=NULL, const char *c7=NULL, const char *c8=NULL, const char *c9=NULL, const char *c10=NULL, const char *c11=NULL, const char *c12=NULL, const char *c13=NULL, const char *c14=NULL, const char *c15=NULL, const char *c16=NULL, const char *c17=NULL, const char *c18=NULL, const char *c19=NULL )
|
||||
{
|
||||
name = n;
|
||||
@@ -26,6 +26,16 @@ struct ConfOption
|
||||
PUSH(c0);PUSH(c1);PUSH(c2);PUSH(c3);PUSH(c4);PUSH(c5);PUSH(c6);PUSH(c7);PUSH(c8);PUSH(c9);PUSH(c10);PUSH(c11);PUSH(c12);PUSH(c13);PUSH(c14);PUSH(c15);PUSH(c16);PUSH(c17);PUSH(c18);PUSH(c19);
|
||||
#undef PUSH
|
||||
}
|
||||
|
||||
ConfOption( const char *n, void (*m)( int &sel, bool in, const CStringArray &choices ),
|
||||
void (*lst)( CStringArray &out ) )
|
||||
{
|
||||
name = n;
|
||||
MoveData = m;
|
||||
MakeOptionsListCB = lst;
|
||||
}
|
||||
|
||||
|
||||
private:
|
||||
vector<CString> names;
|
||||
void (*MakeOptionsListCB)( CStringArray &out );
|
||||
|
||||
Reference in New Issue
Block a user