void IRCLobbyView::actionPerformed(mMouseEvent me)
{
    static const int chat_scroll_lines=8;
    static const int server_scroll_lines=3;
    if (me.getID() == mMouseEvent::MOUSE_EVENT_CLICKED) {
        if (me.getSource(serverUpButton)) {
            topViewableItem-=server_scroll_lines;
            if (topViewableItem < 0) {
                topViewableItem = 0;
            }
        } else if (me.getSource(serverDownButton)) {
            int max_size=lobby_connection->game_servers->size()-1;
            topViewableItem+=server_scroll_lines;
            if (topViewableItem >= max_size) {
                topViewableItem = max_size;
            }
        } else if (me.getSource(chatUpButton)) {
            skipChatLines+=chat_scroll_lines;
            if(skipChatLines>=((int)lobby_connection->chat_messages.size())) {
                skipChatLines=((int)lobby_connection->chat_messages.size())-1;
            }
        } else if (me.getSource(chatDownButton)) {
            skipChatLines-=chat_scroll_lines;
            if (skipChatLines <= 0) {
                skipChatLines = 0;
            }
        }
    }
}
// actionPerformed
//---------------------------------------------------------------------------
void HostOptionsView::actionPerformed(mMouseEvent me)
{
    if (me.getSource()==&checkPublic) {
        if ( getVisible() ) {
            GameConfig::server_public = checkPublic.getState();
        }
    } else if (me.getSource()==&checkPowerUp) {
        if ( getVisible() ) {
            GameConfig::game_powerups = checkPowerUp.getState();
        }
    } else if (me.getSource()==&choiceWindSpeed) {
        windSpeed = choiceWindSpeed.getSelectedIndex();

        updateWindSpeedString();
    } else if (me.getSource()==&choiceCloudCoverage) {
        cloudCoverageCount = choiceCloudCoverage.getSelectedIndex();

        updateGameConfigCloudCoverage();
    } else if (me.getSource()==&choiceGameType) {
        if ( getVisible() ) {
            gameType = choiceGameType.getSelectedIndex();

            updateGameConfigGameType();
        }
    }
} // end HostOptionsView::actionPerformed
// actionPerformed
//--------------------------------------------------------------------------
void HelpScrollView::actionPerformed(mMouseEvent me)
{
    if (me.getID() == mMouseEvent::MOUSE_EVENT_CLICKED) {
        if (me.getSource(upButton)) {
            if (--topViewableItem < 0) {
                topViewableItem = 0;
            }
        } else if (me.getSource(downButton)) {
            if (++topViewableItem >= text.getCount() - maxViewableItems) {
                topViewableItem = text.getCount() - maxViewableItems;
            }
        }
    }

} // end HelpScrollView::actionPerformed
Esempio n. 4
0
// actionPerformed
//---------------------------------------------------------------------------
void LibView::actionPerformed(mMouseEvent me)
{
    if (me.getSource(checkBoxAllowParticleGeneration)) {
        Particle2D::setCreateParticles(checkBoxAllowParticleGeneration.getState());
    } else if (me.getSource(checkBoxAllowTimeSlice)) {
        gTimeSliceFlag = checkBoxAllowTimeSlice.getState();
    } else if (me.getSource(checkBoxAllowSpanBlitting)) {
        allowSpanBlitting = checkBoxAllowSpanBlitting.getState();
    } else if (me.getSource(checkBoxParticlesCanHaveSmoke)) {
        ParticleInterface::gParticlesCanHaveSmoke = checkBoxParticlesCanHaveSmoke.getState();
    } else if (me.getSource(checkBoxSolidColorExplosionParticles)) {
        ParticleInterface::gSolidColorExplosionParticles = checkBoxSolidColorExplosionParticles.getState();
    } else if (me.getSource(checkBoxParticleInterfaceSim)) {
        ParticleInterface::gTestSim = checkBoxParticleInterfaceSim.getState();
    } else if (me.getSource(checkBoxSolidBackground)) {
        GameView::gDrawSolidBackground = checkBoxSolidBackground.getState();
    } else if (me.getSource(checkBoxDrawExplosionParticleCount)) {
        ParticleInterface::gDrawExplosionParticleCount = checkBoxDrawExplosionParticleCount.getState();
    }

} // end LibView::actionPerformed
// actionPerformed
//---------------------------------------------------------------------------
void VehicleSelectionView::actionPerformed(mMouseEvent me)
{
    if (me.getID() == mMouseEvent::MOUSE_EVENT_CLICKED) {
        if (me.getSource(buttonStaticDisplay)) {
            if (buttonStaticDisplay.getLabel() == "On") {
                buttonStaticDisplay.setLabel("Off");
            } else {
                buttonStaticDisplay.setLabel("On");
            }

            VehicleSelectionView::displayMiniProductionStatus = !VehicleSelectionView::displayMiniProductionStatus;
        }

        if (me.getSource(buttonPower)) {
            if (buttonPower.getLabel() == "On") {
                buttonPower.setLabel("Off");
            } else {
                buttonPower.setLabel("On");
            }

            vsvUnitGenOn = !vsvUnitGenOn;
            changeMade   = true;
            sendOutpostStatus();
        }

        if (me.getSource(buttonOk)) {
            Desktop::setVisibilityNoDoAnything("VehicleSelectionView", false);
            sendOutpostStatus();
            changeMade = false;
        }
    } else if (me.getID() == mMouseEvent::MOUSE_EVENT_ENTERED) {
        if (me.getSource(abstractButtonValentine)) {
            highlightedUnitType = _unit_type_valentine;
        }
        if (me.getSource(abstractButtonLeopard)) {
            highlightedUnitType = _unit_type_leopard;
        }
        if (me.getSource(abstractButtonAbrams)) {
            highlightedUnitType = _unit_type_abrams;
        }
        if (me.getSource(abstractButtonHammerhead)) {
            highlightedUnitType = _unit_type_hammerhead;
        }
        if (me.getSource(abstractButtonLynx)) {
            highlightedUnitType = _unit_type_lynx;
        }
        if (me.getSource(abstractButtonM109)) {
            highlightedUnitType = _unit_type_m109;
        }
        if (me.getSource(abstractButtonSpahpanzer)) {
            highlightedUnitType = _unit_type_spahpanzer;
        }
        if (me.getSource(abstractButtonScorpion)) {
            highlightedUnitType = _unit_type_scorpion;
        }
        if (me.getSource(abstractButtonHumvee)) {
            highlightedUnitType = _unit_type_humvee;
        }
        if (me.getSource(abstractButtonArcher)) {
            highlightedUnitType = _unit_type_archer;
        }
    }

} // end VehicleSelectionView::actionPerformed