bool pawsPetStatWindow::OnButtonPressed( int mouseButton, int keyModifier, pawsWidget* widget )
{
    switch ( widget->GetID() )
    {
    case BTN_FILTER:
    {
        filter = !filter;
        if (!skillString.IsEmpty()) HandleSkillList( skillString );
        return true;
    }

    case BTN_BUY:
    {
        BuySkill();
        return true;
    }

        //case BTN_EDIT:
        //{
        //    pawsCharDescription* descWnd = (pawsCharDescription*)PawsManager::GetSingleton().FindWidget("DescriptionEdit");
        //    descWnd->PostSetup();
        //    descWnd->Show();
        //    return true;
        //}

    }
    return false;
}
void pawsSkillWindow::HandleMessage( MsgEntry* me )
{
    switch ( me->GetType() )
    {
        case MSGTYPE_FACTION_INFO:
        {
            if (!train)
                HandleFactionMsg(me);
            break;
        }

        case MSGTYPE_GUISKILL:
        {
            psGUISkillMessage incoming(me);

            switch (incoming.command)
            {
                case psGUISkillMessage::SKILL_LIST:
                {
                    bool flush = (train != incoming.trainingWindow) || incoming.openWindow;
                    train = incoming.trainingWindow;
                    if (train)
                    {
                        factRequest = false;
                        factions.DeleteAll();
                        factionList->Clear();
                    }

                    skillString = "no";
                    if (!IsVisible() && incoming.openWindow)
                    {
                        Show();
                    }
                    skillString = incoming.commandData;
                    skillCache.apply(&incoming.skillCache);

                    if (IsVisible())
                        HandleSkillList(incoming.focusSkill, flush);

                    hitpointsMax = incoming.hitpointsMax;
                    manaMax = incoming.manaMax;
                    physStaminaMax = incoming.physStaminaMax;
                    menStaminaMax = incoming.menStaminaMax;

                    break;
                }

                case psGUISkillMessage::DESCRIPTION:
                {
                    HandleSkillDescription(incoming.commandData);
                    break;
                }
            }
        }
    }
}
void pawsPetStatWindow::HandleMessage( MsgEntry* me )
{
    psPetSkillMessage incoming(me);

    switch (incoming.command)
    {
    case psPetSkillMessage::SKILL_LIST:
    {
        skillString = "no";
//            if (!IsVisible() && incoming.openWindow)
//                Show();
        skillString = incoming.commandData;
        HandleSkillList(skillString);

        SelectSkill(incoming.focusSkill);

        hitpointsMax = incoming.hitpointsMax;
        manaMax = incoming.manaMax;
        physStaminaMax = incoming.physStaminaMax;
        menStaminaMax = incoming.menStaminaMax;


        csString text;

        text.Format(": %i", hitpointsMax);
        hpTotal->SetText(text);

        text.Format(": %i", manaMax);
        manaTotal->SetText(text);

        text.Format(": %i", physStaminaMax);
        pysStaminaTotal->SetText(text);

        text.Format(": %i", menStaminaMax);
        menStaminaTotal->SetText(text);

        break;
    }

    case psPetSkillMessage::DESCRIPTION:
    {
        HandleSkillDescription(incoming.commandData);
        break;
    }
    }
}
bool pawsSkillWindow::OnButtonPressed(int /*mouseButton*/, int /*keyModifier*/, pawsWidget* widget)
{
    switch ( widget->GetID() )
    {
        case BTN_FILTER:
        {
            filter = !filter;
            HandleSkillList(-1, true);
            return true;
        }

        case BTN_BUY:
        {
            BuySkill();
            return true;
        }

        case BTN_BUYLVL:
        {
            BuyMaxSkill();
            return true;
        }

        case BTN_STATS:
        case BTN_FACTION:
        case BTN_COMBAT:
        case BTN_MAGIC:
        case BTN_JOBS:
        case BTN_VARIOUS:
        {
            previousTab = currentTab; //Keep the selection if we are hitting the same tab where we are.
            currentTab = widget->GetID() - 1000;
            if (previousTab != currentTab)
            {
                selectedSkill.Clear();
            }
            break;
        }

    }
    return false;
}