Beispiel #1
0
void AddPlasmaExportMenu()
{
    IMenuManager* pMenuMan = GetCOREInterface()->GetMenuManager();
    IMenu* fileMenu = pMenuMan->FindMenu("&File");

    int i;

    bool plasmaExportFound = false;

    // Make sure our action isn't already in the menu
    TSTR ourName = GetString(IDS_PLASMA_EXPORT);
    for (i = 0; i < fileMenu->NumItems(); i++)
    {
        IMenuItem* fileMenuItem = fileMenu->GetItem(i);
        const TSTR& title = fileMenuItem->GetTitle();
        if (title == ourName)
            plasmaExportFound = true;

        // KLUDGE - MaxAss didn't define the file submenu with an accelerator.
        // This fixes it.
        if (title == (CStr)"MAX File Operations")
        {
            fileMenuItem->SetUseCustomTitle(true);
            bool custom = fileMenuItem->GetUseCustomTitle();
            fileMenuItem->SetTitle("MAX File Opera&tions");

            pMenuMan->UpdateMenuBar();
        }
    }

    if (!plasmaExportFound)
    {
        // Menu item isn't there, add it
        for (i = 0; i < fileMenu->NumItems(); i++)
        {
            IMenuItem* fileMenuItem = fileMenu->GetItem(i);
            const TSTR& title = fileMenuItem->GetTitle();
            // We want to add it after the "Export Selected" menu item
            if (title == (CStr)"Export Selected...")
            {
                ActionTable* pActionTable = GetCOREInterface()->GetActionManager()->FindTable(kActionId);
                if (!pActionTable)
                {
                    hsAssert(0, "Action table not found");
                    return;
                }

                IMenuItem* menuItem = GetIMenuItem();
                menuItem->SetActionItem(pActionTable->GetAction(kActionExport));
                fileMenu->AddItem(menuItem, i+1);

                pMenuMan->UpdateMenuBar();

                return;
            }
        }
    }
}
Beispiel #2
0
fresult YNDialogForm::CreateMenu( IMenu** o_mnu )
{
	fresult fres;
	MenuFactory* mf = _Factories->GetMenuFactory();

	//ready factory
	mf->CurrentInterlaced = true;
	mf->CurrentTextFormatHandle = TF_MENU;
	mf->CurrentEvenTextFormatHandle = TF_MENUEVEN;
	mf->ClearSettings();

	//Set up menu
	MenuItemSettings* mis;
	//ItemOriginZ
	mis = &mf->Settings[ItemOriginZ];
	mis->ImgHandle = small_arrow_right_red;
	mis->OverrideTextFormat = TF_MENU_RED;
	mis->Text = "                     ";
	fres = _FormManager->GetCloseFormHandler(&mis->Handler, fsrOK);
	mis->Empty = FALSE;

	//ItemOriginE
	mis = &mf->Settings[ItemOriginE];
	mis->ImgHandle = small_arrow_bottom;
	mis->Text = "назад";
	fres = _FormManager->GetCloseFormHandler(&mis->Handler, fsrCancel);
	ENSURESUCCESS(fres);
	mis->Empty = FALSE;

	//create mnu
	IMenu* mnu = NULL;
	fres = mf->GetMenu(ABCXYZLER, &mnu);
	ENSURESUCCESS(fres);

	//Clean up
	mf->ClearSettings();
	mf->DefaultInterlaced=mf->CurrentInterlaced;
	mf->DefaultTextFormatHandle=mf->CurrentTextFormatHandle;
	mf->DefaultEvenTextFormatHandle=mf->CurrentEvenTextFormatHandle;

	//Get menu Items
	_miYes = (MenuItem*)mnu->GetItem(0);
	FAILIF(_miYes==NULL);
	_miCancel =(MenuItem*)mnu->GetItem(1);
	FAILIF(_miCancel==NULL);

	*o_mnu = mnu;
	return SUCCESS;
}
Beispiel #3
0
fresult ItemsListFormBase::CreateMenu( IMenu** o_mnu )
{
	fresult fres;
	MenuFactory* mf = _Factories->GetMenuFactory();

	//ready factory
	mf->CurrentInterlaced = true;
	mf->CurrentTextFormatHandle = TF_MENU;
	mf->CurrentEvenTextFormatHandle = TF_MENUEVEN;
	mf->ClearSettings();

	//Set up menu
	MenuItemSettings* settings = mf->Settings;
	MenuItemSettings* mis;

	//ItemOriginX
	mis = &settings[ItemOriginX];
	mis->ImgHandle = scroll_up;
	mis->Handler = _AutoDispatchMenuHandler;
	mis->Empty = FALSE;

	//ItemOriginZ
	mis = &settings[ItemOriginZ];
	mis->ImgHandle = scroll_down;
	mis->Handler = _AutoDispatchMenuHandler;
	mis->Empty = FALSE;

	//ItemOriginL
	mis = &settings[ItemOriginL];
	mis->ImgHandle = small_arrow_bottom;
	mis->Text = _prevText;
	mis->Handler = _AutoDispatchMenuHandler;
	mis->Empty = FALSE;

	//ItemOriginE
	mis = &settings[ItemOriginE];
	mis->ImgHandle = small_arrow_bottom;
	mis->Text = "назад";
	fres = _FormManager->GetCloseFormHandler(&mis->Handler, fsrCancel);
	ENSURESUCCESS(fres);
	mis->Empty = FALSE;
	
	//ItemOriginR
	mis = &settings[ItemOriginR];
	mis->ImgHandle = small_arrow_bottom;
	mis->Text = _nextText;
	mis->Handler = _AutoDispatchMenuHandler;
	mis->Empty = FALSE;
	//call derived update settings
	UpdateMenuSettings(settings);

	//create mnu
	IMenu* mnu = NULL;
	fres = mf->GetMenu(ABCXYZLER, &mnu);
	ENSURESUCCESS(fres);

	for (ubyte_t i=0; i<mnu->GetItemsCount();i++)
	{
		MenuItem* mi = (MenuItem*)(mnu->GetItem(i));
		if (StringEquals(mi->GetName(), "L") == TRUE)
		{
			_mnuBack = mi;
		}
		if (StringEquals(mi->GetName(), "R") == TRUE)
		{
			_mnuNext = mi;
		}
	}

	//Clean up
	mf->ClearSettings();
	mf->DefaultInterlaced=mf->CurrentInterlaced;
	mf->DefaultTextFormatHandle=mf->CurrentTextFormatHandle;
	mf->DefaultEvenTextFormatHandle=mf->CurrentEvenTextFormatHandle;

	//Get menu Items

	*o_mnu = mnu;
	return SUCCESS;
}