Exemple #1
0
bool ecConfigItem::SetValue (long nValue, CdlTransaction transaction/*=NULL*/)
{
    wxASSERT (m_optionType == ecLong);
    const CdlValuable valuable = GetCdlValuable();
    wxASSERT (valuable);
    
    if(transaction) {
        if (CdlValueFlavor_BoolData == valuable->get_flavor ()) {
            // set the user bool to the current bool when changing a booldata
            // value to avoid a possible change in the current bool
            valuable->set_enabled_and_value (transaction, valuable->is_enabled (), (cdl_int) nValue, CdlValueSource_User);
        } else { // CdlValueFlavor_Data
            valuable->set_integer_value (transaction, nValue, CdlValueSource_User);
        }
    } else {
        if (CdlValueFlavor_BoolData == valuable->get_flavor ()) {
            // set the user bool to the current bool when changing a booldata
            // value to avoid a possible change in the current bool
            valuable->set_enabled_and_value (valuable->is_enabled (), (cdl_int) nValue, CdlValueSource_User);
        } else { // CdlValueFlavor_Data
            valuable->set_integer_value (nValue, CdlValueSource_User);
        }
    }

    // TODO: BoolData?
    m_value = nValue;
    
    return TRUE;
}
Exemple #2
0
bool ecConfigItem::SetValue(const wxString& value, CdlTransaction transaction/*=NULL*/)
{
    wxASSERT ((m_optionType == ecString) || (m_optionType == ecEnumerated));
    const CdlValuable valuable = GetCdlValuable();
    wxASSERT (valuable);
    const std::string str = value.c_str();
    if(transaction){
        if (CdlValueFlavor_BoolData == valuable->get_flavor ()){
            // set the user bool to the current bool when changing a booldata
            // value to avoid a possible change in the current bool
            valuable->set_enabled_and_value (transaction, valuable->is_enabled (), str, CdlValueSource_User);
        } else {// CdlValueFlavor_Data
            valuable->set_value (transaction, str, CdlValueSource_User);
        }
    } else {
        if (CdlValueFlavor_BoolData == valuable->get_flavor ()){
            // set the user bool to the current bool when changing a booldata
            // value to avoid a possible change in the current bool
            valuable->set_enabled_and_value (valuable->is_enabled (), str, CdlValueSource_User);
        } else {// CdlValueFlavor_Data
            valuable->set_value (str, CdlValueSource_User);
        }
    }

    // TODO: eliminate m_value, since the value is always taken from the Cdl object.
    m_value = value;
    
    return TRUE;
}
Exemple #3
0
bool ecConfigItem::IsEnabled() const
{
    const CdlValuable valuable = GetCdlValuable();
    return NULL==valuable ||valuable->is_enabled();
}