Beispiel #1
0
void MainWindow::updateActions()
{
	QAction *undoAction = m_windowsManager->getAction(UndoAction);

	if (undoAction)
	{
		m_ui->actionUndo->setEnabled(undoAction->isEnabled());
		m_ui->actionUndo->setText(undoAction->text());
	}
	else
	{
		m_ui->actionUndo->setEnabled(false);
		m_ui->actionUndo->setText(tr("Undo"));
	}

	QAction *redoAction = m_windowsManager->getAction(RedoAction);

	if (redoAction)
	{
		m_ui->actionRedo->setEnabled(redoAction->isEnabled());
		m_ui->actionRedo->setText(redoAction->text());
	}
	else
	{
		m_ui->actionRedo->setEnabled(false);
		m_ui->actionRedo->setText(tr("Redo"));
	}

	updateAction(m_windowsManager->getAction(CutAction), m_ui->actionCut);
	updateAction(m_windowsManager->getAction(CopyAction), m_ui->actionCopy);
	updateAction(m_windowsManager->getAction(PasteAction), m_ui->actionPaste);
	updateAction(m_windowsManager->getAction(DeleteAction), m_ui->actionDelete);
	updateAction(m_windowsManager->getAction(SelectAllAction), m_ui->actionSelectAll);
	updateAction(m_windowsManager->getAction(FindAction), m_ui->actionFind);
	updateAction(m_windowsManager->getAction(FindNextAction), m_ui->actionFindNext);
	updateAction(m_windowsManager->getAction(FindPreviousAction), m_ui->actionFindPrevious);
	updateAction(m_windowsManager->getAction(ReloadAction), m_ui->actionReload);
	updateAction(m_windowsManager->getAction(StopAction), m_ui->actionStop);
	updateAction(m_windowsManager->getAction(ViewSourceAction), m_ui->actionViewSource);
	updateAction(m_windowsManager->getAction(InspectPageAction), m_ui->actionInspectPage);
	updateAction(m_windowsManager->getAction(GoBackAction), m_ui->actionGoBack);
	updateAction(m_windowsManager->getAction(RewindAction), m_ui->actionRewind);
	updateAction(m_windowsManager->getAction(GoForwardAction), m_ui->actionGoForward);
	updateAction(m_windowsManager->getAction(FastForwardAction), m_ui->actionFastForward);

	const bool canZoom = m_windowsManager->canZoom();

	m_ui->actionZoomOut->setEnabled(canZoom);
	m_ui->actionZoomIn->setEnabled(canZoom);
	m_ui->actionZoomOriginal->setEnabled(canZoom);
}
Beispiel #2
0
void ToonModel::update() {
	updateAction();
}
void Menu::changed( HMENU hmenu, ItemPtr item )
{
    static const unsigned int MAX_MENU_TEXT = 1024;
    char txtBuf[ MAX_MENU_TEXT + 1 ];
    int i = 0;
    unsigned int j = 0;
    while( i < GetMenuItemCount( hmenu ) )
    {
        MENUITEMINFO info = { sizeof( info ),
                              MIIM_BITMAP | MIIM_CHECKMARKS | MIIM_DATA | MIIM_FTYPE | MIIM_ID |
                              MIIM_STATE | MIIM_STRING | MIIM_SUBMENU
                            };
        info.cch = MAX_MENU_TEXT;
        info.dwTypeData = txtBuf;
        GetMenuItemInfo( hmenu, i, TRUE, &info );

        if( j < item->num() )
        {
            ItemPtr sub = ( *item )[ j ];
            if( ( Item* )info.dwItemData != sub )
            {
                insertMenuItem( hmenu, i, sub );
                ZeroMemory( &info, sizeof( info ) );
                info.cbSize = sizeof( info );
                info.fMask = MIIM_BITMAP | MIIM_CHECKMARKS | MIIM_DATA | MIIM_FTYPE | MIIM_ID |
                             MIIM_STATE | MIIM_STRING | MIIM_SUBMENU;
                info.cch = MAX_MENU_TEXT;
                info.dwTypeData = txtBuf;
                GetMenuItemInfo( hmenu, i, TRUE, &info );
            }
            if( sub->type() == "SEPARATOR" )
                updateSeparator( hmenu, i, sub, info );
            else if( sub->type() == "GROUP" )
                updateGroup( hmenu, i, sub, info );
            else if( sub->type() == "ACTION" )
                updateAction( hmenu, i, sub, info );
            else if( sub->type() == "TOGGLE" )
                updateToggle( hmenu, i, sub, info );
            else if( sub->type() == "CHOICE" )
                updateChoice( hmenu, i, sub, info );
            else if( sub->type() == "EXPANDED_CHOICE" )
                updateExpandedChoice( hmenu, i, sub, info );
            else
                updateUnknownItem( hmenu, i, sub, info );
            GetMenuItemInfo( hmenu, i, TRUE, &info );
            ++i;
            ++j;
        }
        else
            DeleteMenu( hmenu, i, MF_BYPOSITION );
    }
    for(; j< item->num(); ++j )
    {
        ItemPtr sub = ( *item )[ j ];
        insertMenuItem( hmenu, i, sub );
        MENUITEMINFO info = { sizeof( info ),
                              MIIM_BITMAP | MIIM_CHECKMARKS | MIIM_DATA | MIIM_FTYPE | MIIM_ID |
                              MIIM_STATE | MIIM_STRING | MIIM_SUBMENU
                            };
        info.cch = MAX_MENU_TEXT;
        info.dwTypeData = txtBuf;
        GetMenuItemInfo( hmenu, i, TRUE, &info );
        if( sub->type() == "SEPARATOR" )
            updateSeparator( hmenu, i, sub, info );
        else if( sub->type() == "GROUP" )
            updateGroup( hmenu, i, sub, info );
        else if( sub->type() == "ACTION" )
            updateAction( hmenu, i, sub, info );
        else if( sub->type() == "TOGGLE" )
            updateToggle( hmenu, i, sub, info );
        else if( sub->type() == "CHOICE" )
            updateChoice( hmenu, i, sub, info );
        else if( sub->type() == "EXPANDED_CHOICE" )
            updateExpandedChoice( hmenu, i, sub, info );
        else
            updateUnknownItem( hmenu, i, sub, info );
        GetMenuItemInfo( hmenu, i, TRUE, &info );
        ++i;
    }
}
Beispiel #4
0
void MainWindow::updateActions()
{
	QAction *undoAction = m_windowsManager->getAction(UndoAction);

	if (undoAction)
	{
		m_actionsManager->getAction(QLatin1String("Undo"))->setEnabled(undoAction->isEnabled());
		m_actionsManager->getAction(QLatin1String("Undo"))->setText(undoAction->text());
	}
	else
	{
		m_actionsManager->getAction(QLatin1String("Undo"))->setEnabled(false);
		m_actionsManager->getAction(QLatin1String("Undo"))->setText(tr("Undo"));
	}

	QAction *redoAction = m_windowsManager->getAction(RedoAction);

	if (redoAction)
	{
		m_actionsManager->getAction(QLatin1String("Redo"))->setEnabled(redoAction->isEnabled());
		m_actionsManager->getAction(QLatin1String("Redo"))->setText(redoAction->text());
	}
	else
	{
		m_actionsManager->getAction(QLatin1String("Redo"))->setEnabled(false);
		m_actionsManager->getAction(QLatin1String("Redo"))->setText(tr("Redo"));
	}

	updateAction(m_windowsManager->getAction(CutAction), m_actionsManager->getAction(QLatin1String("Cut")));
	updateAction(m_windowsManager->getAction(CopyAction), m_actionsManager->getAction(QLatin1String("Copy")));
	updateAction(m_windowsManager->getAction(PasteAction), m_actionsManager->getAction(QLatin1String("Paste")));
	updateAction(m_windowsManager->getAction(DeleteAction), m_actionsManager->getAction(QLatin1String("Delete")));
	updateAction(m_windowsManager->getAction(SelectAllAction), m_actionsManager->getAction(QLatin1String("SelectAll")));
	updateAction(m_windowsManager->getAction(FindAction), m_actionsManager->getAction(QLatin1String("Find")));
	updateAction(m_windowsManager->getAction(FindNextAction), m_actionsManager->getAction(QLatin1String("FindNext")));
	updateAction(m_windowsManager->getAction(FindPreviousAction), m_actionsManager->getAction(QLatin1String("FindPrevious")));
	updateAction(m_windowsManager->getAction(ReloadAction), m_actionsManager->getAction(QLatin1String("Reload")));
	updateAction(m_windowsManager->getAction(StopAction), m_actionsManager->getAction(QLatin1String("Stop")));
	updateAction(m_windowsManager->getAction(ViewSourceAction), m_actionsManager->getAction(QLatin1String("ViewSource")));
	updateAction(m_windowsManager->getAction(InspectPageAction), m_actionsManager->getAction(QLatin1String("InspectPage")));
	updateAction(m_windowsManager->getAction(GoBackAction), m_actionsManager->getAction(QLatin1String("GoBack")));
	updateAction(m_windowsManager->getAction(RewindAction), m_actionsManager->getAction(QLatin1String("Rewind")));
	updateAction(m_windowsManager->getAction(GoForwardAction), m_actionsManager->getAction(QLatin1String("GoForward")));
	updateAction(m_windowsManager->getAction(FastForwardAction), m_actionsManager->getAction(QLatin1String("FastForward")));

	const bool canZoom = m_windowsManager->canZoom();

	m_actionsManager->getAction(QLatin1String("ZoomOut"))->setEnabled(canZoom);
	m_actionsManager->getAction(QLatin1String("ZoomIn"))->setEnabled(canZoom);
	m_actionsManager->getAction(QLatin1String("ZoomOriginal"))->setEnabled(canZoom);
}