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

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

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

    // ignore_sticky
    mOptions[MaximumizeOptions::IgnoreSticky].setName ("ignore_sticky", CompOption::TypeBool);
    mOptions[MaximumizeOptions::IgnoreSticky].value().set(true);

    // ignore_overlapping
    mOptions[MaximumizeOptions::IgnoreOverlapping].setName ("ignore_overlapping", CompOption::TypeBool);
    mOptions[MaximumizeOptions::IgnoreOverlapping].value().set(false);

    // allow_shrink
    mOptions[MaximumizeOptions::AllowShrink].setName ("allow_shrink", CompOption::TypeBool);
    mOptions[MaximumizeOptions::AllowShrink].value().set(true);

    // maximumize_left
    mOptions[MaximumizeOptions::MaximumizeLeft].setName ("maximumize_left", CompOption::TypeBool);
    mOptions[MaximumizeOptions::MaximumizeLeft].value().set(true);

    // maximumize_right
    mOptions[MaximumizeOptions::MaximumizeRight].setName ("maximumize_right", CompOption::TypeBool);
    mOptions[MaximumizeOptions::MaximumizeRight].value().set(true);

    // maximumize_up
    mOptions[MaximumizeOptions::MaximumizeUp].setName ("maximumize_up", CompOption::TypeBool);
    mOptions[MaximumizeOptions::MaximumizeUp].value().set(true);

    // maximumize_down
    mOptions[MaximumizeOptions::MaximumizeDown].setName ("maximumize_down", CompOption::TypeBool);
    mOptions[MaximumizeOptions::MaximumizeDown].value().set(true);

    // trigger_max_key
    mOptions[MaximumizeOptions::TriggerMaxKey].setName ("trigger_max_key", CompOption::TypeKey);
    state = CompAction::StateAutoGrab;
    action = CompAction ();
    action.setState (state | CompAction::StateInitKey);
    action.keyFromString ("<Super>M");
    mOptions[MaximumizeOptions::TriggerMaxKey].value().set (action);
    if (screen) screen->addAction (&mOptions[MaximumizeOptions::TriggerMaxKey].value ().action ());

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

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

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

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

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

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

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

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

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

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

    // trigger_min_key
    mOptions[MaximumizeOptions::TriggerMinKey].setName ("trigger_min_key", CompOption::TypeKey);
    state = CompAction::StateAutoGrab;
    action = CompAction ();
    action.setState (state | CompAction::StateInitKey);
    action.keyFromString ("<Super><Shift>M");
    mOptions[MaximumizeOptions::TriggerMinKey].value().set (action);
    if (screen) screen->addAction (&mOptions[MaximumizeOptions::TriggerMinKey].value ().action ());

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

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

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

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

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

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

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

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

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

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

}

MaximumizeOptions::~MaximumizeOptions ()
{
}


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

bool
MaximumizeOptions::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 MaximumizeOptions::IgnoreSticky:
            if (o->set (value))
            {
                if (!mNotify[MaximumizeOptions::IgnoreSticky].empty ())
                    mNotify[MaximumizeOptions::IgnoreSticky] (o, MaximumizeOptions::IgnoreSticky);
                return true;
            }
            break;
        case MaximumizeOptions::IgnoreOverlapping:
            if (o->set (value))
            {
                if (!mNotify[MaximumizeOptions::IgnoreOverlapping].empty ())
                    mNotify[MaximumizeOptions::IgnoreOverlapping] (o, MaximumizeOptions::IgnoreOverlapping);
                return true;
            }
            break;
        case MaximumizeOptions::AllowShrink:
            if (o->set (value))
            {
                if (!mNotify[MaximumizeOptions::AllowShrink].empty ())
                    mNotify[MaximumizeOptions::AllowShrink] (o, MaximumizeOptions::AllowShrink);
                return true;
            }
            break;
        case MaximumizeOptions::MaximumizeLeft:
            if (o->set (value))
            {
                if (!mNotify[MaximumizeOptions::MaximumizeLeft].empty ())
                    mNotify[MaximumizeOptions::MaximumizeLeft] (o, MaximumizeOptions::MaximumizeLeft);
                return true;
            }
            break;
        case MaximumizeOptions::MaximumizeRight:
            if (o->set (value))
            {
                if (!mNotify[MaximumizeOptions::MaximumizeRight].empty ())
                    mNotify[MaximumizeOptions::MaximumizeRight] (o, MaximumizeOptions::MaximumizeRight);
                return true;
            }
            break;
        case MaximumizeOptions::MaximumizeUp:
            if (o->set (value))
            {
                if (!mNotify[MaximumizeOptions::MaximumizeUp].empty ())
                    mNotify[MaximumizeOptions::MaximumizeUp] (o, MaximumizeOptions::MaximumizeUp);
                return true;
            }
            break;
        case MaximumizeOptions::MaximumizeDown:
            if (o->set (value))
            {
                if (!mNotify[MaximumizeOptions::MaximumizeDown].empty ())
                    mNotify[MaximumizeOptions::MaximumizeDown] (o, MaximumizeOptions::MaximumizeDown);
                return true;
            }
            break;
        case MaximumizeOptions::TriggerMaxKey:
            if (o->set (value))
            {
                if (!mNotify[MaximumizeOptions::TriggerMaxKey].empty ())
                    mNotify[MaximumizeOptions::TriggerMaxKey] (o, MaximumizeOptions::TriggerMaxKey);
                return true;
            }
            break;
        case MaximumizeOptions::TriggerMaxLeft:
            if (o->set (value))
            {
                if (!mNotify[MaximumizeOptions::TriggerMaxLeft].empty ())
                    mNotify[MaximumizeOptions::TriggerMaxLeft] (o, MaximumizeOptions::TriggerMaxLeft);
                return true;
            }
            break;
        case MaximumizeOptions::TriggerMaxRight:
            if (o->set (value))
            {
                if (!mNotify[MaximumizeOptions::TriggerMaxRight].empty ())
                    mNotify[MaximumizeOptions::TriggerMaxRight] (o, MaximumizeOptions::TriggerMaxRight);
                return true;
            }
            break;
        case MaximumizeOptions::TriggerMaxUp:
            if (o->set (value))
            {
                if (!mNotify[MaximumizeOptions::TriggerMaxUp].empty ())
                    mNotify[MaximumizeOptions::TriggerMaxUp] (o, MaximumizeOptions::TriggerMaxUp);
                return true;
            }
            break;
        case MaximumizeOptions::TriggerMaxDown:
            if (o->set (value))
            {
                if (!mNotify[MaximumizeOptions::TriggerMaxDown].empty ())
                    mNotify[MaximumizeOptions::TriggerMaxDown] (o, MaximumizeOptions::TriggerMaxDown);
                return true;
            }
            break;
        case MaximumizeOptions::TriggerMaxHorizontally:
            if (o->set (value))
            {
                if (!mNotify[MaximumizeOptions::TriggerMaxHorizontally].empty ())
                    mNotify[MaximumizeOptions::TriggerMaxHorizontally] (o, MaximumizeOptions::TriggerMaxHorizontally);
                return true;
            }
            break;
        case MaximumizeOptions::TriggerMaxVertically:
            if (o->set (value))
            {
                if (!mNotify[MaximumizeOptions::TriggerMaxVertically].empty ())
                    mNotify[MaximumizeOptions::TriggerMaxVertically] (o, MaximumizeOptions::TriggerMaxVertically);
                return true;
            }
            break;
        case MaximumizeOptions::TriggerMaxUpLeft:
            if (o->set (value))
            {
                if (!mNotify[MaximumizeOptions::TriggerMaxUpLeft].empty ())
                    mNotify[MaximumizeOptions::TriggerMaxUpLeft] (o, MaximumizeOptions::TriggerMaxUpLeft);
                return true;
            }
            break;
        case MaximumizeOptions::TriggerMaxUpRight:
            if (o->set (value))
            {
                if (!mNotify[MaximumizeOptions::TriggerMaxUpRight].empty ())
                    mNotify[MaximumizeOptions::TriggerMaxUpRight] (o, MaximumizeOptions::TriggerMaxUpRight);
                return true;
            }
            break;
        case MaximumizeOptions::TriggerMaxDownLeft:
            if (o->set (value))
            {
                if (!mNotify[MaximumizeOptions::TriggerMaxDownLeft].empty ())
                    mNotify[MaximumizeOptions::TriggerMaxDownLeft] (o, MaximumizeOptions::TriggerMaxDownLeft);
                return true;
            }
            break;
        case MaximumizeOptions::TriggerMaxDownRight:
            if (o->set (value))
            {
                if (!mNotify[MaximumizeOptions::TriggerMaxDownRight].empty ())
                    mNotify[MaximumizeOptions::TriggerMaxDownRight] (o, MaximumizeOptions::TriggerMaxDownRight);
                return true;
            }
            break;
        case MaximumizeOptions::TriggerMinKey:
            if (o->set (value))
            {
                if (!mNotify[MaximumizeOptions::TriggerMinKey].empty ())
                    mNotify[MaximumizeOptions::TriggerMinKey] (o, MaximumizeOptions::TriggerMinKey);
                return true;
            }
            break;
        case MaximumizeOptions::TriggerMinLeft:
            if (o->set (value))
            {
                if (!mNotify[MaximumizeOptions::TriggerMinLeft].empty ())
                    mNotify[MaximumizeOptions::TriggerMinLeft] (o, MaximumizeOptions::TriggerMinLeft);
                return true;
            }
            break;
        case MaximumizeOptions::TriggerMinRight:
            if (o->set (value))
            {
                if (!mNotify[MaximumizeOptions::TriggerMinRight].empty ())
                    mNotify[MaximumizeOptions::TriggerMinRight] (o, MaximumizeOptions::TriggerMinRight);
                return true;
            }
            break;
        case MaximumizeOptions::TriggerMinUp:
            if (o->set (value))
            {
                if (!mNotify[MaximumizeOptions::TriggerMinUp].empty ())
                    mNotify[MaximumizeOptions::TriggerMinUp] (o, MaximumizeOptions::TriggerMinUp);
                return true;
            }
            break;
        case MaximumizeOptions::TriggerMinDown:
            if (o->set (value))
            {
                if (!mNotify[MaximumizeOptions::TriggerMinDown].empty ())
                    mNotify[MaximumizeOptions::TriggerMinDown] (o, MaximumizeOptions::TriggerMinDown);
                return true;
            }
            break;
        case MaximumizeOptions::TriggerMinHorizontally:
            if (o->set (value))
            {
                if (!mNotify[MaximumizeOptions::TriggerMinHorizontally].empty ())
                    mNotify[MaximumizeOptions::TriggerMinHorizontally] (o, MaximumizeOptions::TriggerMinHorizontally);
                return true;
            }
            break;
        case MaximumizeOptions::TriggerMinVertically:
            if (o->set (value))
            {
                if (!mNotify[MaximumizeOptions::TriggerMinVertically].empty ())
                    mNotify[MaximumizeOptions::TriggerMinVertically] (o, MaximumizeOptions::TriggerMinVertically);
                return true;
            }
            break;
        case MaximumizeOptions::TriggerMinUpLeft:
            if (o->set (value))
            {
                if (!mNotify[MaximumizeOptions::TriggerMinUpLeft].empty ())
                    mNotify[MaximumizeOptions::TriggerMinUpLeft] (o, MaximumizeOptions::TriggerMinUpLeft);
                return true;
            }
            break;
        case MaximumizeOptions::TriggerMinUpRight:
            if (o->set (value))
            {
                if (!mNotify[MaximumizeOptions::TriggerMinUpRight].empty ())
                    mNotify[MaximumizeOptions::TriggerMinUpRight] (o, MaximumizeOptions::TriggerMinUpRight);
                return true;
            }
            break;
        case MaximumizeOptions::TriggerMinDownLeft:
            if (o->set (value))
            {
                if (!mNotify[MaximumizeOptions::TriggerMinDownLeft].empty ())
                    mNotify[MaximumizeOptions::TriggerMinDownLeft] (o, MaximumizeOptions::TriggerMinDownLeft);
                return true;
            }
            break;
        case MaximumizeOptions::TriggerMinDownRight:
            if (o->set (value))
            {
                if (!mNotify[MaximumizeOptions::TriggerMinDownRight].empty ())
                    mNotify[MaximumizeOptions::TriggerMinDownRight] (o, MaximumizeOptions::TriggerMinDownRight);
                return true;
            }
            break;
        default:
            break;
    }
    return false;

}

