/*
 * This file is autogenerated with bcop:
 * The Compiz option code generator
 *
 * This program 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 General Public License for more details.
 *
 */


#include <core/core.h>

#include "vpswitch_options.h"

VpswitchOptions::VpswitchOptions (bool init /* = true */) :
    mOptions (VpswitchOptions::OptionNum),
    mNotify (VpswitchOptions::OptionNum)
{
    if (init)
        initOptions ();
}

void
VpswitchOptions::initOptions ()
{
    unsigned int state;
    CompAction action;

    // begin_key
    mOptions[VpswitchOptions::BeginKey].setName ("begin_key", CompOption::TypeKey);
    state = CompAction::StateAutoGrab;
    action = CompAction ();
    action.setState (state | CompAction::StateInitKey);
    mOptions[VpswitchOptions::BeginKey].value().set (action);
    if (screen) screen->addAction (&mOptions[VpswitchOptions::BeginKey].value ().action ());

    // switch_to_1_key
    mOptions[VpswitchOptions::SwitchTo1Key].setName ("switch_to_1_key", CompOption::TypeKey);
    state = CompAction::StateAutoGrab;
    action = CompAction ();
    action.setState (state | CompAction::StateInitKey);
    mOptions[VpswitchOptions::SwitchTo1Key].value().set (action);
    if (screen) screen->addAction (&mOptions[VpswitchOptions::SwitchTo1Key].value ().action ());

    // switch_to_2_key
    mOptions[VpswitchOptions::SwitchTo2Key].setName ("switch_to_2_key", CompOption::TypeKey);
    state = CompAction::StateAutoGrab;
    action = CompAction ();
    action.setState (state | CompAction::StateInitKey);
    mOptions[VpswitchOptions::SwitchTo2Key].value().set (action);
    if (screen) screen->addAction (&mOptions[VpswitchOptions::SwitchTo2Key].value ().action ());

    // switch_to_3_key
    mOptions[VpswitchOptions::SwitchTo3Key].setName ("switch_to_3_key", CompOption::TypeKey);
    state = CompAction::StateAutoGrab;
    action = CompAction ();
    action.setState (state | CompAction::StateInitKey);
    mOptions[VpswitchOptions::SwitchTo3Key].value().set (action);
    if (screen) screen->addAction (&mOptions[VpswitchOptions::SwitchTo3Key].value ().action ());

    // switch_to_4_key
    mOptions[VpswitchOptions::SwitchTo4Key].setName ("switch_to_4_key", CompOption::TypeKey);
    state = CompAction::StateAutoGrab;
    action = CompAction ();
    action.setState (state | CompAction::StateInitKey);
    mOptions[VpswitchOptions::SwitchTo4Key].value().set (action);
    if (screen) screen->addAction (&mOptions[VpswitchOptions::SwitchTo4Key].value ().action ());

    // switch_to_5_key
    mOptions[VpswitchOptions::SwitchTo5Key].setName ("switch_to_5_key", CompOption::TypeKey);
    state = CompAction::StateAutoGrab;
    action = CompAction ();
    action.setState (state | CompAction::StateInitKey);
    mOptions[VpswitchOptions::SwitchTo5Key].value().set (action);
    if (screen) screen->addAction (&mOptions[VpswitchOptions::SwitchTo5Key].value ().action ());

    // switch_to_6_key
    mOptions[VpswitchOptions::SwitchTo6Key].setName ("switch_to_6_key", CompOption::TypeKey);
    state = CompAction::StateAutoGrab;
    action = CompAction ();
    action.setState (state | CompAction::StateInitKey);
    mOptions[VpswitchOptions::SwitchTo6Key].value().set (action);
    if (screen) screen->addAction (&mOptions[VpswitchOptions::SwitchTo6Key].value ().action ());

    // switch_to_7_key
    mOptions[VpswitchOptions::SwitchTo7Key].setName ("switch_to_7_key", CompOption::TypeKey);
    state = CompAction::StateAutoGrab;
    action = CompAction ();
    action.setState (state | CompAction::StateInitKey);
    mOptions[VpswitchOptions::SwitchTo7Key].value().set (action);
    if (screen) screen->addAction (&mOptions[VpswitchOptions::SwitchTo7Key].value ().action ());

    // switch_to_8_key
    mOptions[VpswitchOptions::SwitchTo8Key].setName ("switch_to_8_key", CompOption::TypeKey);
    state = CompAction::StateAutoGrab;
    action = CompAction ();
    action.setState (state | CompAction::StateInitKey);
    mOptions[VpswitchOptions::SwitchTo8Key].value().set (action);
    if (screen) screen->addAction (&mOptions[VpswitchOptions::SwitchTo8Key].value ().action ());

    // switch_to_9_key
    mOptions[VpswitchOptions::SwitchTo9Key].setName ("switch_to_9_key", CompOption::TypeKey);
    state = CompAction::StateAutoGrab;
    action = CompAction ();
    action.setState (state | CompAction::StateInitKey);
    mOptions[VpswitchOptions::SwitchTo9Key].value().set (action);
    if (screen) screen->addAction (&mOptions[VpswitchOptions::SwitchTo9Key].value ().action ());

    // switch_to_10_key
    mOptions[VpswitchOptions::SwitchTo10Key].setName ("switch_to_10_key", CompOption::TypeKey);
    state = CompAction::StateAutoGrab;
    action = CompAction ();
    action.setState (state | CompAction::StateInitKey);
    mOptions[VpswitchOptions::SwitchTo10Key].value().set (action);
    if (screen) screen->addAction (&mOptions[VpswitchOptions::SwitchTo10Key].value ().action ());

    // switch_to_11_key
    mOptions[VpswitchOptions::SwitchTo11Key].setName ("switch_to_11_key", CompOption::TypeKey);
    state = CompAction::StateAutoGrab;
    action = CompAction ();
    action.setState (state | CompAction::StateInitKey);
    mOptions[VpswitchOptions::SwitchTo11Key].value().set (action);
    if (screen) screen->addAction (&mOptions[VpswitchOptions::SwitchTo11Key].value ().action ());

    // switch_to_12_key
    mOptions[VpswitchOptions::SwitchTo12Key].setName ("switch_to_12_key", CompOption::TypeKey);
    state = CompAction::StateAutoGrab;
    action = CompAction ();
    action.setState (state | CompAction::StateInitKey);
    mOptions[VpswitchOptions::SwitchTo12Key].value().set (action);
    if (screen) screen->addAction (&mOptions[VpswitchOptions::SwitchTo12Key].value ().action ());

    // left_button
    mOptions[VpswitchOptions::LeftButton].setName ("left_button", CompOption::TypeButton);
    state = CompAction::StateAutoGrab;
    action = CompAction ();
    action.setState (state | CompAction::StateInitButton);
    mOptions[VpswitchOptions::LeftButton].value().set (action);
    if (screen) screen->addAction (&mOptions[VpswitchOptions::LeftButton].value ().action ());

    // right_button
    mOptions[VpswitchOptions::RightButton].setName ("right_button", CompOption::TypeButton);
    state = CompAction::StateAutoGrab;
    action = CompAction ();
    action.setState (state | CompAction::StateInitButton);
    mOptions[VpswitchOptions::RightButton].value().set (action);
    if (screen) screen->addAction (&mOptions[VpswitchOptions::RightButton].value ().action ());

    // up_button
    mOptions[VpswitchOptions::UpButton].setName ("up_button", CompOption::TypeButton);
    state = CompAction::StateAutoGrab;
    action = CompAction ();
    action.setState (state | CompAction::StateInitButton);
    mOptions[VpswitchOptions::UpButton].value().set (action);
    if (screen) screen->addAction (&mOptions[VpswitchOptions::UpButton].value ().action ());

    // down_button
    mOptions[VpswitchOptions::DownButton].setName ("down_button", CompOption::TypeButton);
    state = CompAction::StateAutoGrab;
    action = CompAction ();
    action.setState (state | CompAction::StateInitButton);
    mOptions[VpswitchOptions::DownButton].value().set (action);
    if (screen) screen->addAction (&mOptions[VpswitchOptions::DownButton].value ().action ());

    // next_button
    mOptions[VpswitchOptions::NextButton].setName ("next_button", CompOption::TypeButton);
    state = CompAction::StateAutoGrab;
    action = CompAction ();
    action.setState (state | CompAction::StateInitButton);
    action.buttonFromString ("Button5");
    mOptions[VpswitchOptions::NextButton].value().set (action);
    if (screen) screen->addAction (&mOptions[VpswitchOptions::NextButton].value ().action ());

    // prev_button
    mOptions[VpswitchOptions::PrevButton].setName ("prev_button", CompOption::TypeButton);
    state = CompAction::StateAutoGrab;
    action = CompAction ();
    action.setState (state | CompAction::StateInitButton);
    action.buttonFromString ("Button4");
    mOptions[VpswitchOptions::PrevButton].value().set (action);
    if (screen) screen->addAction (&mOptions[VpswitchOptions::PrevButton].value ().action ());

    // initiate_button
    mOptions[VpswitchOptions::InitiateButton].setName ("initiate_button", CompOption::TypeButton);
    state = CompAction::StateAutoGrab;
    action = CompAction ();
    action.setState (state | CompAction::StateInitButton);
    action.buttonFromString ("Button2");
    mOptions[VpswitchOptions::InitiateButton].value().set (action);
    if (screen) screen->addAction (&mOptions[VpswitchOptions::InitiateButton].value ().action ());

    // init_plugin
    mOptions[VpswitchOptions::InitPlugin].setName ("init_plugin", CompOption::TypeString);
    mOptions[VpswitchOptions::InitPlugin].value().set(CompString ("rotate"));

    // init_action
    mOptions[VpswitchOptions::InitAction].setName ("init_action", CompOption::TypeString);
    mOptions[VpswitchOptions::InitAction].value().set(CompString ("initiate_button"));

}

VpswitchOptions::~VpswitchOptions ()
{
}


CompOption::Vector &
VpswitchOptions::getOptions ()
{
    return mOptions;
}

bool
VpswitchOptions::setOption (const CompString &name, CompOption::Value &value)
{
    CompOption   *o;
    unsigned int index;

    o = CompOption::findOption (mOptions, name, &index);

    if (!o)
        return false;

    switch (index)
    {
        case VpswitchOptions::BeginKey:
            if (o->set (value))
            {
                if (!mNotify[VpswitchOptions::BeginKey].empty ())
                    mNotify[VpswitchOptions::BeginKey] (o, VpswitchOptions::BeginKey);
                return true;
            }
            break;
        case VpswitchOptions::SwitchTo1Key:
            if (o->set (value))
            {
                if (!mNotify[VpswitchOptions::SwitchTo1Key].empty ())
                    mNotify[VpswitchOptions::SwitchTo1Key] (o, VpswitchOptions::SwitchTo1Key);
                return true;
            }
            break;
        case VpswitchOptions::SwitchTo2Key:
            if (o->set (value))
            {
                if (!mNotify[VpswitchOptions::SwitchTo2Key].empty ())
                    mNotify[VpswitchOptions::SwitchTo2Key] (o, VpswitchOptions::SwitchTo2Key);
                return true;
            }
            break;
        case VpswitchOptions::SwitchTo3Key:
            if (o->set (value))
            {
                if (!mNotify[VpswitchOptions::SwitchTo3Key].empty ())
                    mNotify[VpswitchOptions::SwitchTo3Key] (o, VpswitchOptions::SwitchTo3Key);
                return true;
            }
            break;
        case VpswitchOptions::SwitchTo4Key:
            if (o->set (value))
            {
                if (!mNotify[VpswitchOptions::SwitchTo4Key].empty ())
                    mNotify[VpswitchOptions::SwitchTo4Key] (o, VpswitchOptions::SwitchTo4Key);
                return true;
            }
            break;
        case VpswitchOptions::SwitchTo5Key:
            if (o->set (value))
            {
                if (!mNotify[VpswitchOptions::SwitchTo5Key].empty ())
                    mNotify[VpswitchOptions::SwitchTo5Key] (o, VpswitchOptions::SwitchTo5Key);
                return true;
            }
            break;
        case VpswitchOptions::SwitchTo6Key:
            if (o->set (value))
            {
                if (!mNotify[VpswitchOptions::SwitchTo6Key].empty ())
                    mNotify[VpswitchOptions::SwitchTo6Key] (o, VpswitchOptions::SwitchTo6Key);
                return true;
            }
            break;
        case VpswitchOptions::SwitchTo7Key:
            if (o->set (value))
            {
                if (!mNotify[VpswitchOptions::SwitchTo7Key].empty ())
                    mNotify[VpswitchOptions::SwitchTo7Key] (o, VpswitchOptions::SwitchTo7Key);
                return true;
            }
            break;
        case VpswitchOptions::SwitchTo8Key:
            if (o->set (value))
            {
                if (!mNotify[VpswitchOptions::SwitchTo8Key].empty ())
                    mNotify[VpswitchOptions::SwitchTo8Key] (o, VpswitchOptions::SwitchTo8Key);
                return true;
            }
            break;
        case VpswitchOptions::SwitchTo9Key:
            if (o->set (value))
            {
                if (!mNotify[VpswitchOptions::SwitchTo9Key].empty ())
                    mNotify[VpswitchOptions::SwitchTo9Key] (o, VpswitchOptions::SwitchTo9Key);
                return true;
            }
            break;
        case VpswitchOptions::SwitchTo10Key:
            if (o->set (value))
            {
                if (!mNotify[VpswitchOptions::SwitchTo10Key].empty ())
                    mNotify[VpswitchOptions::SwitchTo10Key] (o, VpswitchOptions::SwitchTo10Key);
                return true;
            }
            break;
        case VpswitchOptions::SwitchTo11Key:
            if (o->set (value))
            {
                if (!mNotify[VpswitchOptions::SwitchTo11Key].empty ())
                    mNotify[VpswitchOptions::SwitchTo11Key] (o, VpswitchOptions::SwitchTo11Key);
                return true;
            }
            break;
        case VpswitchOptions::SwitchTo12Key:
            if (o->set (value))
            {
                if (!mNotify[VpswitchOptions::SwitchTo12Key].empty ())
                    mNotify[VpswitchOptions::SwitchTo12Key] (o, VpswitchOptions::SwitchTo12Key);
                return true;
            }
            break;
        case VpswitchOptions::LeftButton:
            if (o->set (value))
            {
                if (!mNotify[VpswitchOptions::LeftButton].empty ())
                    mNotify[VpswitchOptions::LeftButton] (o, VpswitchOptions::LeftButton);
                return true;
            }
            break;
        case VpswitchOptions::RightButton:
            if (o->set (value))
            {
                if (!mNotify[VpswitchOptions::RightButton].empty ())
                    mNotify[VpswitchOptions::RightButton] (o, VpswitchOptions::RightButton);
                return true;
            }
            break;
        case VpswitchOptions::UpButton:
            if (o->set (value))
            {
                if (!mNotify[VpswitchOptions::UpButton].empty ())
                    mNotify[VpswitchOptions::UpButton] (o, VpswitchOptions::UpButton);
                return true;
            }
            break;
        case VpswitchOptions::DownButton:
            if (o->set (value))
            {
                if (!mNotify[VpswitchOptions::DownButton].empty ())
                    mNotify[VpswitchOptions::DownButton] (o, VpswitchOptions::DownButton);
                return true;
            }
            break;
        case VpswitchOptions::NextButton:
            if (o->set (value))
            {
                if (!mNotify[VpswitchOptions::NextButton].empty ())
                    mNotify[VpswitchOptions::NextButton] (o, VpswitchOptions::NextButton);
                return true;
            }
            break;
        case VpswitchOptions::PrevButton:
            if (o->set (value))
            {
                if (!mNotify[VpswitchOptions::PrevButton].empty ())
                    mNotify[VpswitchOptions::PrevButton] (o, VpswitchOptions::PrevButton);
                return true;
            }
            break;
        case VpswitchOptions::InitiateButton:
            if (o->set (value))
            {
                if (!mNotify[VpswitchOptions::InitiateButton].empty ())
                    mNotify[VpswitchOptions::InitiateButton] (o, VpswitchOptions::InitiateButton);
                return true;
            }
            break;
        case VpswitchOptions::InitPlugin:
            if (o->set (value))
            {
                if (!mNotify[VpswitchOptions::InitPlugin].empty ())
                    mNotify[VpswitchOptions::InitPlugin] (o, VpswitchOptions::InitPlugin);
                return true;
            }
            break;
        case VpswitchOptions::InitAction:
            if (o->set (value))
            {
                if (!mNotify[VpswitchOptions::InitAction].empty ())
                    mNotify[VpswitchOptions::InitAction] (o, VpswitchOptions::InitAction);
                return true;
            }
            break;
        default:
            break;
    }
    return false;

}

