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

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

void
MousepollOptions::initOptions ()
{

    // mouse_poll_interval
    mOptions[MousepollOptions::MousePollInterval].setName ("mouse_poll_interval", CompOption::TypeInt);
    mOptions[MousepollOptions::MousePollInterval].rest ().set (1, 500);
    mOptions[MousepollOptions::MousePollInterval].value().set((int) 10);

}

MousepollOptions::~MousepollOptions ()
{
}


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

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

}

