mirror of
https://github.com/amyinspace/MagicSetEditor2.git
synced 2026-06-10 13:06:59 -04:00
Multiple choice choices can be drawn as radio buttons instead of check boxes
git-svn-id: svn://svn.code.sf.net/p/magicseteditor/code/trunk@463 0fc631ac-6414-0410-93d0-97cfa31319b6
This commit is contained in:
@@ -49,11 +49,11 @@ IMPLEMENT_REFLECTION(ChoiceField) {
|
||||
|
||||
ChoiceField::Choice::Choice()
|
||||
: first_id(0)
|
||||
, line_below(false), enabled(true)
|
||||
, line_below(false), enabled(true), type(CHOICE_TYPE_CHECK)
|
||||
{}
|
||||
ChoiceField::Choice::Choice(const String& name)
|
||||
: name(name), first_id(0)
|
||||
, line_below(false), enabled(true)
|
||||
, line_below(false), enabled(true), type(CHOICE_TYPE_CHECK)
|
||||
{}
|
||||
|
||||
|
||||
@@ -139,6 +139,11 @@ String ChoiceField::Choice::choiceNameNice(int id) const {
|
||||
}
|
||||
|
||||
|
||||
IMPLEMENT_REFLECTION_ENUM(ChoiceChoiceType) {
|
||||
VALUE_N("check", CHOICE_TYPE_CHECK);
|
||||
VALUE_N("radio", CHOICE_TYPE_RADIO);
|
||||
}
|
||||
|
||||
IMPLEMENT_REFLECTION_NO_GET_MEMBER(ChoiceField::Choice) {
|
||||
if (isGroup() || line_below || enabled.isScripted() || (tag.reading() && tag.isComplex())) {
|
||||
// complex values are groups
|
||||
@@ -147,6 +152,7 @@ IMPLEMENT_REFLECTION_NO_GET_MEMBER(ChoiceField::Choice) {
|
||||
REFLECT(choices);
|
||||
REFLECT(line_below);
|
||||
REFLECT(enabled);
|
||||
REFLECT(type);
|
||||
} else {
|
||||
REFLECT_NAMELESS(name);
|
||||
}
|
||||
|
||||
@@ -46,6 +46,12 @@ class ChoiceField : public Field {
|
||||
DECLARE_REFLECTION();
|
||||
};
|
||||
|
||||
|
||||
enum ChoiceChoiceType {
|
||||
CHOICE_TYPE_CHECK,
|
||||
CHOICE_TYPE_RADIO
|
||||
};
|
||||
|
||||
/// An item that can be chosen for this field
|
||||
class ChoiceField::Choice : public IntrusivePtrBase<ChoiceField::Choice> {
|
||||
public:
|
||||
@@ -57,6 +63,7 @@ class ChoiceField::Choice : public IntrusivePtrBase<ChoiceField::Choice> {
|
||||
vector<ChoiceP> choices; ///< Choices and sub groups in this group
|
||||
bool line_below; ///< Show a line after this item?
|
||||
Scriptable<bool> enabled; ///< Is this item enabled?
|
||||
ChoiceChoiceType type; ///< How should this item be shown, only for multiple choice fields
|
||||
/// First item-id in this group (can be the default item)
|
||||
/** Item-ids are consecutive integers, a group uses all ids [first_id..lastId()).
|
||||
* The top level group has first_id 0.
|
||||
|
||||
Reference in New Issue
Block a user