/*  This file is part of the KDE project
    Copyright (C) 2007 Matthias Kretz <kretz@kde.org>

    This library is free software; you can redistribute it and/or
    modify it under the terms of the GNU Library General Public
    License version 2 as published by the Free Software Foundation.

    This library is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
    Library General Public License for more details.

    You should have received a copy of the GNU Library General Public License
    along with this library; see the file COPYING.LIB.  If not, write to
    the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
    Boston, MA 02110-1301, USA.

*/

#include "mixerenumcontrol.h"
#include "mixerenumcontrol_p.h"

namespace Phonon
{
namespace Mixer
{

MixerEnumControl::MixerEnumControl(MixerEnumControlPrivate &dd)
    : MixerControl(dd)
{
}

MixerEnumControl::MixerEnumControl(const MixerEnumControl &rhs)
    : MixerControl(*new MixerEnumControlPrivate(const_cast<MixerEnumControlSharedData *>(rhs.d_func()->s_func())))
{
}

MixerEnumControl &MixerEnumControl::operator=(const MixerEnumControl &rhs)
{
    MixerControl::operator=(rhs);
    return *this;
}

QStringList MixerEnumControl::options() const
{
    K_S(const MixerEnumControl);
    return s->m_options;
}

QString MixerEnumControl::currentOption() const
{
    K_S(const MixerEnumControl);
    return s->currentOption();
}

void MixerEnumControl::setCurrentIndex(const QString &option)
{
    K_S(MixerEnumControl);
    s->setCurrentIndex(option);
}

int MixerEnumControl::currentIndex() const
{
    K_S(const MixerEnumControl);
    return s->currentIndex();
}

void MixerEnumControl::setCurrentIndex(int index)
{
    K_S(MixerEnumControl);
    s->setCurrentIndex(index);
}

template<> MixerEnumControl mixercontrol_cast<MixerEnumControl>(const MixerControl &mc)
{
    if (mc.type() == MixerControl::Enum) {
        return static_cast<const MixerEnumControl &>(mc);
    }
    return MixerEnumControl(*new MixerEnumControlPrivate(0));
}

MixerEnumControl::Category MixerEnumControl::category() const
{
    K_S(const MixerEnumControl);
    return s->m_category;
}

} // namespace Mixer
} // namespace Phonon

template<> PHONON_MIXER_EXPORT Phonon::Mixer::MixerEnumControl qobject_cast<Phonon::Mixer::MixerEnumControl>(QObject *o)
{
    Phonon::Mixer::MixerEnumControlSharedData *s = qobject_cast<Phonon::Mixer::MixerEnumControlSharedData *>(o);
    return Phonon::Mixer::MixerEnumControl(*new Phonon::Mixer::MixerEnumControlPrivate(s));
}

// vim: sw=4 sts=4 et tw=100
