コード例 #1
0
ファイル: MouseEvents.cpp プロジェクト: AresAndy/ufoai
void MouseEventManager::updateStatusText(GdkEventKey* event) {
	_activeFlags = _modifiers.getKeyboardFlags(event->state);

	std::string statusText("");

	if (_activeFlags != 0) {
		for (ButtonIdMap::iterator it = _buttonId.begin(); it != _buttonId.end(); ++it) {
			// Look up an event with this button ID and the given modifier
			ui::XYViewEvent xyEvent = findXYViewEvent(it->second, _activeFlags);

			if (xyEvent != ui::xyNothing) {
				statusText += _modifiers.getModifierStr(_activeFlags, true) + "-";
				statusText += getShortButtonName(it->first) + ": ";
				statusText += printXYViewEvent(xyEvent);
				statusText += " ";
			}

			// Look up an event with this button ID and the given modifier
			ui::ObserverEvent obsEvent = findObserverEvent(it->second, _activeFlags);

			if (obsEvent != ui::obsNothing) {
				statusText += _modifiers.getModifierStr(_activeFlags, true) + "-";
				statusText += getShortButtonName(it->first) + ": ";
				statusText += printObserverEvent(obsEvent);
				statusText += " ";
			}
		}
	}

	GlobalRadiant().setStatusText(statusText);
}
コード例 #2
0
void MouseEventManager::updateStatusText(wxKeyEvent& ev)
{
	unsigned int newFlags = _modifiers.getKeyboardFlags(ev);

    // Only do this if the flags actually changed
    if (newFlags == _activeFlags)
    {
        return;
    }

    _activeFlags = newFlags;

    std::string statusText("");

    if (_activeFlags != 0)
    {
        for (ButtonIdMap::iterator it = _buttonId.begin(); it != _buttonId.end(); it++)
        {
            // Look up an event with this button ID and the given modifier
            ui::XYViewEvent xyEvent = findXYViewEvent(it->second, _activeFlags);

            if (xyEvent != ui::xyNothing)
            {
                statusText += _modifiers.getModifierStr(_activeFlags, true) + "-";
                statusText += getShortButtonName(it->first) + ": ";
                statusText += printXYViewEvent(xyEvent);
                statusText += " ";
            }

            // Look up an event with this button ID and the given modifier
            ui::ObserverEvent obsEvent = findObserverEvent(it->second, _activeFlags);

            if (obsEvent != ui::obsNothing)
            {
                statusText += _modifiers.getModifierStr(_activeFlags, true) + "-";
                statusText += getShortButtonName(it->first) + ": ";
                statusText += printObserverEvent(obsEvent);
                statusText += " ";
            }
        }
    }

    // Pass the call
    GlobalUIManager().getStatusBarManager().setText(STATUSBAR_COMMAND, statusText);
}