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

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

void
WinrulesOptions::initOptions ()
{
    CompOption::Value::Vector list;
    CompOption::Value value;

    // skiptaskbar_match
    mOptions[WinrulesOptions::SkiptaskbarMatch].setName ("skiptaskbar_match", CompOption::TypeMatch);
    mOptions[WinrulesOptions::SkiptaskbarMatch].value().set(CompMatch (""));
    mOptions[WinrulesOptions::SkiptaskbarMatch].value().match ().update ();

    // skippager_match
    mOptions[WinrulesOptions::SkippagerMatch].setName ("skippager_match", CompOption::TypeMatch);
    mOptions[WinrulesOptions::SkippagerMatch].value().set(CompMatch (""));
    mOptions[WinrulesOptions::SkippagerMatch].value().match ().update ();

    // above_match
    mOptions[WinrulesOptions::AboveMatch].setName ("above_match", CompOption::TypeMatch);
    mOptions[WinrulesOptions::AboveMatch].value().set(CompMatch (""));
    mOptions[WinrulesOptions::AboveMatch].value().match ().update ();

    // below_match
    mOptions[WinrulesOptions::BelowMatch].setName ("below_match", CompOption::TypeMatch);
    mOptions[WinrulesOptions::BelowMatch].value().set(CompMatch (""));
    mOptions[WinrulesOptions::BelowMatch].value().match ().update ();

    // sticky_match
    mOptions[WinrulesOptions::StickyMatch].setName ("sticky_match", CompOption::TypeMatch);
    mOptions[WinrulesOptions::StickyMatch].value().set(CompMatch (""));
    mOptions[WinrulesOptions::StickyMatch].value().match ().update ();

    // fullscreen_match
    mOptions[WinrulesOptions::FullscreenMatch].setName ("fullscreen_match", CompOption::TypeMatch);
    mOptions[WinrulesOptions::FullscreenMatch].value().set(CompMatch (""));
    mOptions[WinrulesOptions::FullscreenMatch].value().match ().update ();

    // maximize_match
    mOptions[WinrulesOptions::MaximizeMatch].setName ("maximize_match", CompOption::TypeMatch);
    mOptions[WinrulesOptions::MaximizeMatch].value().set(CompMatch (""));
    mOptions[WinrulesOptions::MaximizeMatch].value().match ().update ();

    // no_argb_match
    mOptions[WinrulesOptions::NoArgbMatch].setName ("no_argb_match", CompOption::TypeMatch);
    mOptions[WinrulesOptions::NoArgbMatch].value().set(CompMatch (""));
    mOptions[WinrulesOptions::NoArgbMatch].value().match ().update ();

    // no_move_match
    mOptions[WinrulesOptions::NoMoveMatch].setName ("no_move_match", CompOption::TypeMatch);
    mOptions[WinrulesOptions::NoMoveMatch].value().set(CompMatch (""));
    mOptions[WinrulesOptions::NoMoveMatch].value().match ().update ();

    // no_resize_match
    mOptions[WinrulesOptions::NoResizeMatch].setName ("no_resize_match", CompOption::TypeMatch);
    mOptions[WinrulesOptions::NoResizeMatch].value().set(CompMatch (""));
    mOptions[WinrulesOptions::NoResizeMatch].value().match ().update ();

    // no_minimize_match
    mOptions[WinrulesOptions::NoMinimizeMatch].setName ("no_minimize_match", CompOption::TypeMatch);
    mOptions[WinrulesOptions::NoMinimizeMatch].value().set(CompMatch (""));
    mOptions[WinrulesOptions::NoMinimizeMatch].value().match ().update ();

    // no_maximize_match
    mOptions[WinrulesOptions::NoMaximizeMatch].setName ("no_maximize_match", CompOption::TypeMatch);
    mOptions[WinrulesOptions::NoMaximizeMatch].value().set(CompMatch (""));
    mOptions[WinrulesOptions::NoMaximizeMatch].value().match ().update ();

    // no_close_match
    mOptions[WinrulesOptions::NoCloseMatch].setName ("no_close_match", CompOption::TypeMatch);
    mOptions[WinrulesOptions::NoCloseMatch].value().set(CompMatch (""));
    mOptions[WinrulesOptions::NoCloseMatch].value().match ().update ();

    // no_focus_match
    mOptions[WinrulesOptions::NoFocusMatch].setName ("no_focus_match", CompOption::TypeMatch);
    mOptions[WinrulesOptions::NoFocusMatch].value().set(CompMatch (""));
    mOptions[WinrulesOptions::NoFocusMatch].value().match ().update ();

    // size_matches
    mOptions[WinrulesOptions::SizeMatches].setName ("size_matches", CompOption::TypeList);
    value.set (CompOption::TypeMatch, CompOption::Value::Vector (0));
    mOptions[WinrulesOptions::SizeMatches].set (value);

    // size_width_values
    mOptions[WinrulesOptions::SizeWidthValues].setName ("size_width_values", CompOption::TypeList);
    mOptions[WinrulesOptions::SizeWidthValues].rest ().set (0, 65536);
    list.clear ();
    mOptions[WinrulesOptions::SizeWidthValues].value().set (CompOption::TypeInt, list);

    // size_height_values
    mOptions[WinrulesOptions::SizeHeightValues].setName ("size_height_values", CompOption::TypeList);
    mOptions[WinrulesOptions::SizeHeightValues].rest ().set (0, 65536);
    list.clear ();
    mOptions[WinrulesOptions::SizeHeightValues].value().set (CompOption::TypeInt, list);

}

WinrulesOptions::~WinrulesOptions ()
{
}


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

bool
WinrulesOptions::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 WinrulesOptions::SkiptaskbarMatch:
            if (o->set (value))
            {
                if (!mNotify[WinrulesOptions::SkiptaskbarMatch].empty ())
                    mNotify[WinrulesOptions::SkiptaskbarMatch] (o, WinrulesOptions::SkiptaskbarMatch);
                return true;
            }
            break;
        case WinrulesOptions::SkippagerMatch:
            if (o->set (value))
            {
                if (!mNotify[WinrulesOptions::SkippagerMatch].empty ())
                    mNotify[WinrulesOptions::SkippagerMatch] (o, WinrulesOptions::SkippagerMatch);
                return true;
            }
            break;
        case WinrulesOptions::AboveMatch:
            if (o->set (value))
            {
                if (!mNotify[WinrulesOptions::AboveMatch].empty ())
                    mNotify[WinrulesOptions::AboveMatch] (o, WinrulesOptions::AboveMatch);
                return true;
            }
            break;
        case WinrulesOptions::BelowMatch:
            if (o->set (value))
            {
                if (!mNotify[WinrulesOptions::BelowMatch].empty ())
                    mNotify[WinrulesOptions::BelowMatch] (o, WinrulesOptions::BelowMatch);
                return true;
            }
            break;
        case WinrulesOptions::StickyMatch:
            if (o->set (value))
            {
                if (!mNotify[WinrulesOptions::StickyMatch].empty ())
                    mNotify[WinrulesOptions::StickyMatch] (o, WinrulesOptions::StickyMatch);
                return true;
            }
            break;
        case WinrulesOptions::FullscreenMatch:
            if (o->set (value))
            {
                if (!mNotify[WinrulesOptions::FullscreenMatch].empty ())
                    mNotify[WinrulesOptions::FullscreenMatch] (o, WinrulesOptions::FullscreenMatch);
                return true;
            }
            break;
        case WinrulesOptions::MaximizeMatch:
            if (o->set (value))
            {
                if (!mNotify[WinrulesOptions::MaximizeMatch].empty ())
                    mNotify[WinrulesOptions::MaximizeMatch] (o, WinrulesOptions::MaximizeMatch);
                return true;
            }
            break;
        case WinrulesOptions::NoArgbMatch:
            if (o->set (value))
            {
                if (!mNotify[WinrulesOptions::NoArgbMatch].empty ())
                    mNotify[WinrulesOptions::NoArgbMatch] (o, WinrulesOptions::NoArgbMatch);
                return true;
            }
            break;
        case WinrulesOptions::NoMoveMatch:
            if (o->set (value))
            {
                if (!mNotify[WinrulesOptions::NoMoveMatch].empty ())
                    mNotify[WinrulesOptions::NoMoveMatch] (o, WinrulesOptions::NoMoveMatch);
                return true;
            }
            break;
        case WinrulesOptions::NoResizeMatch:
            if (o->set (value))
            {
                if (!mNotify[WinrulesOptions::NoResizeMatch].empty ())
                    mNotify[WinrulesOptions::NoResizeMatch] (o, WinrulesOptions::NoResizeMatch);
                return true;
            }
            break;
        case WinrulesOptions::NoMinimizeMatch:
            if (o->set (value))
            {
                if (!mNotify[WinrulesOptions::NoMinimizeMatch].empty ())
                    mNotify[WinrulesOptions::NoMinimizeMatch] (o, WinrulesOptions::NoMinimizeMatch);
                return true;
            }
            break;
        case WinrulesOptions::NoMaximizeMatch:
            if (o->set (value))
            {
                if (!mNotify[WinrulesOptions::NoMaximizeMatch].empty ())
                    mNotify[WinrulesOptions::NoMaximizeMatch] (o, WinrulesOptions::NoMaximizeMatch);
                return true;
            }
            break;
        case WinrulesOptions::NoCloseMatch:
            if (o->set (value))
            {
                if (!mNotify[WinrulesOptions::NoCloseMatch].empty ())
                    mNotify[WinrulesOptions::NoCloseMatch] (o, WinrulesOptions::NoCloseMatch);
                return true;
            }
            break;
        case WinrulesOptions::NoFocusMatch:
            if (o->set (value))
            {
                if (!mNotify[WinrulesOptions::NoFocusMatch].empty ())
                    mNotify[WinrulesOptions::NoFocusMatch] (o, WinrulesOptions::NoFocusMatch);
                return true;
            }
            break;
        case WinrulesOptions::SizeMatches:
            if (o->set (value))
            {
                if (!mNotify[WinrulesOptions::SizeMatches].empty ())
                    mNotify[WinrulesOptions::SizeMatches] (o, WinrulesOptions::SizeMatches);
                return true;
            }
            break;
        case WinrulesOptions::SizeWidthValues:
            if (o->set (value))
            {
                if (!mNotify[WinrulesOptions::SizeWidthValues].empty ())
                    mNotify[WinrulesOptions::SizeWidthValues] (o, WinrulesOptions::SizeWidthValues);
                return true;
            }
            break;
        case WinrulesOptions::SizeHeightValues:
            if (o->set (value))
            {
                if (!mNotify[WinrulesOptions::SizeHeightValues].empty ())
                    mNotify[WinrulesOptions::SizeHeightValues] (o, WinrulesOptions::SizeHeightValues);
                return true;
            }
            break;
        default:
            break;
    }
    return false;

}

