/*
 * 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 "clone_options.h"

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

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

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

}

CloneOptions::~CloneOptions ()
{
}


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

bool
CloneOptions::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 CloneOptions::InitiateButton:
            if (o->set (value))
            {
                if (!mNotify[CloneOptions::InitiateButton].empty ())
                    mNotify[CloneOptions::InitiateButton] (o, CloneOptions::InitiateButton);
                return true;
            }
            break;
        default:
            break;
    }
    return false;

}

