Example #1
0
//
//   FUNCTION: ContextMenuExt::QueryContextMenu
//
//   PURPOSE: The Shell calls IContextMenu::QueryContextMenu to allow the 
//            context menu handler to add its menu items to the menu. It 
//            passes in the HMENU handle in the hmenu parameter. The 
//            indexMenu parameter is set to the index to be used for the 
//            first menu item that is to be added.
//
// doc about MENUITEMINFO: 
// http://msdn.microsoft.com/en-us/library/windows/desktop/ms647578(v=vs.85).aspx
//
// doc about InsertMenuItem:
// http://msdn.microsoft.com/en-us/library/windows/desktop/ms647988(v=vs.85).aspx
//
IFACEMETHODIMP ContextMenuExt::QueryContextMenu(
    HMENU hMenu, UINT indexMenu, UINT idCmdFirst, UINT idCmdLast, UINT uFlags)
{
    // If uFlags include CMF_DEFAULTONLY then we should not do anything.
    if (CMF_DEFAULTONLY & uFlags)
    {
        return MAKE_HRESULT(SEVERITY_SUCCESS, 0, USHORT(0));
    }

	// context menu menu handle
	m_hTopMenu = hMenu;
	// position index
	m_topMenuIndex = indexMenu;
	m_subMenuIndex = 0;
	// command id
	m_firstCmdId = idCmdFirst;
	m_currentCmdId = idCmdFirst;

	m_cmdIdToCommand.clear();

	// create and populate the submenu.
	if (!CreateSubMenu()) {
		return HRESULT_FROM_WIN32(GetLastError());
	}

	// create and populate top level menu
	if (!CreateTopMenu()) {
		return HRESULT_FROM_WIN32(GetLastError());
	}
	
    // Return an HRESULT value with the severity set to SEVERITY_SUCCESS. 
    // Set the code value to the offset of the largest command identifier 
    // that was assigned, plus one (1).
	return MAKE_HRESULT(SEVERITY_SUCCESS, 0, USHORT(m_currentCmdId - idCmdFirst + 1));
}
Example #2
0
void SpellCheck::OnEditorContextMenuShowing(clContextMenuEvent& e)
{
    e.Skip();
    wxMenu* menu = CreateSubMenu();
    menu->Check(XRCID(s_contCheckID.ToUTF8()), m_checkContinuous);
    e.GetMenu()->Append(IDM_BASE, _("Spell Checker"), menu);
}
Example #3
0
void SnipWiz::OnEditorContextMenu(clContextMenuEvent& event)
{
    event.Skip();
    IEditor* editor = m_mgr->GetActiveEditor();
    CHECK_PTR_RET(editor);

    if(FileExtManager::IsCxxFile(editor->GetFileName())) {
        wxMenu* newMenu = CreateSubMenu();
        event.GetMenu()->Append(wxID_ANY, _("Snippets"), newMenu);
    }
}
Example #4
0
			GuiComboBoxBase::GuiComboBoxBase(IStyleController* _styleController)
				:GuiMenuButton(_styleController)
			{
				commandExecutor=new CommandExecutor(this);
				styleController=dynamic_cast<IStyleController*>(GetStyleController());
				styleController->SetCommandExecutor(commandExecutor.Obj());

				CreateSubMenu();
				SetCascadeAction(false);

				GetBoundsComposition()->BoundsChanged.AttachMethod(this, &GuiComboBoxBase::OnBoundsChanged);
			}
Example #5
0
void
TabMenuControl::InitMenu(const PageItem pages_in[],
                         unsigned num_pages,
                         const TCHAR *main_menu_captions[],
                         unsigned num_menu_captions)
{
  assert(pages_in);
  assert(main_menu_captions);

  pages = pages_in;

  for (unsigned i = 0; i < num_menu_captions; i++)
    CreateSubMenu(pages_in, num_pages, main_menu_captions[i], i);

  pager.AddClient(tab_display);
  buttons.append(new SubMenuButton(caption));

  assert(GetNumPages() == num_pages);
}
Example #6
0
void CreateLogLevelSubmenu (GtkWidget *menu,
			    char *szName,
			    int active,
			    GtkSignalFunc func)
{
  int ix;
  GtkWidget *submenu, *this;
  GSList *radiolist = NULL;
  submenu = CreateSubMenu(menu, szName);
  for (ix = LOG_EMERG; ix <= LOG_DEBUG; ix++) {
    this = CreateMenuRadio(submenu,
			   logs[ix],
			   &radiolist,
			   func,
			   GINT_TO_POINTER(ix));
    if (active == ix) {
      gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(this), TRUE);
    }
  }
}
Example #7
0
HMENU MenuTemplate::CreateSubMenu(const MenuTemplate* items, UINT& itemIndex, UINT itemCount, GetStringFunc getString)
{
	HMENU menu = CreatePopupMenu();

	do
	{
		const MenuTemplate& item = items[itemIndex];
		++itemIndex;

		UINT itemFlags = MF_STRING;
		UINT_PTR itemId = item.id;
		const WCHAR* itemText = item.idText ? getString(item.idText) : nullptr;

		if (item.type == MenuItem_ItemGrayed)
		{
			itemFlags |= MF_GRAYED;
		}
		else if (item.type == MenuItem_Separator)
		{
			itemFlags = MF_SEPARATOR;
		}
		else if (item.type == MenuItem_SubMenuBegin)
		{
			itemFlags = MF_POPUP;
			itemId = (UINT_PTR)CreateSubMenu(items, itemIndex, itemCount, getString);
		}
		else if (item.type == MenuItem_SubMenuEnd)
		{
			return menu;
		}

		AppendMenu(menu, itemFlags, itemId, itemText);
	}
	while (itemIndex < itemCount);

	return menu;
}
Example #8
0
HMENU MenuTemplate::CreateMenu(const MenuTemplate* items, UINT itemCount, GetStringFunc getString)
{
	UINT itemIndex = 0;
	return CreateSubMenu(items, itemIndex, itemCount, getString);
}
Example #9
0
void *CSimAppToolkit::SelectItemPlugin(void)
{
	return(CreateSubMenu((PU8)"PIXTEL SAT",subMenu,9));
}
Example #10
0
Uint32 cUIMenu::AddSubMenu( const String& Text, cSubTexture * Icon, cUIMenu * SubMenu ) {
	return Add( CreateSubMenu( Text, Icon, SubMenu ) );
}