Example #1
0
void __fastcall TForm1::FindFile2(TMenuItem *parent, String path) {
	TSearchRec sr;

	if (FindFirst(TPath::Combine(path, "*.*"), faDirectory, sr) == 0) {
		do {
			if (sr.Name == "." || sr.Name == ".." || sr.Attr != faDirectory)
				continue;
			TMenuItem *item = AddMenu(parent, sr, TPath::Combine(path, sr.Name));
			if (sr.Attr & faDirectory && chbSubDirectory->Checked) {
				FindFile2(item, TPath::Combine(path, sr.Name));
			}
		}
		while (!FindNext(sr));
	}

	if (FindFirst(TPath::Combine(path, edtPattern->Text), faAnyFile, sr) == 0) {
		do {
			if (sr.Name == "." || sr.Name == ".." || sr.Attr & faDirectory)
				continue;
			AddMenu(parent, sr, TPath::Combine(path, sr.Name));
		}
		while (!FindNext(sr));
	}

	FindClose(sr);
}
Example #2
0
void CBaseDialog::CreateDialogAndMenu(UINT nIDMenuResource, UINT uiClassMenuResource, UINT uidClassMenuTitle)
{
	DebugPrintEx(DBGCreateDialog, CLASS, _T("CreateDialogAndMenu"), _T("id = 0x%X\n"), nIDMenuResource);

	m_lpszTemplateName = MAKEINTRESOURCE(IDD_BLANK_DIALOG);

	DisplayParentedDialog(NULL, NULL);

	HMENU hMenu = NULL;
	if (nIDMenuResource)
	{
		hMenu = ::LoadMenu(NULL, MAKEINTRESOURCE(nIDMenuResource));
	}
	else
	{
		hMenu = ::CreateMenu();
	}

	HMENU hMenuOld = ::GetMenu(m_hWnd);
	if (hMenuOld) ::DestroyMenu(hMenuOld);
	::SetMenu(m_hWnd, hMenu);

	AddMenu(hMenu, IDR_MENU_PROPERTY, IDS_PROPERTYMENU, (UINT)-1);

	AddMenu(hMenu, uiClassMenuResource, uidClassMenuTitle, (UINT)-1);

	m_ulAddInMenuItems = ExtendAddInMenu(hMenu, m_ulAddInContext);

	AddMenu(hMenu, IDR_MENU_TOOLS, IDS_TOOLSMENU, (UINT)-1);

	HMENU hSub = ::GetSubMenu(hMenu, 0);
	::AppendMenu(hSub, MF_SEPARATOR, NULL, NULL);
	WCHAR szExit[16] = { 0 };
	int iRet = NULL;
	iRet = LoadStringW(GetModuleHandle(NULL),
		IDS_EXIT,
		szExit,
		_countof(szExit));
	::AppendMenuW(hSub, MF_ENABLED | MF_STRING, IDCANCEL, szExit);

	// Make sure the menu background is filled in the right color
	MENUINFO mi = { 0 };
	mi.cbSize = sizeof(MENUINFO);
	mi.fMask = MIM_BACKGROUND;
	mi.hbrBack = GetSysBrush(cBackground);
	::SetMenuInfo(hMenu, &mi);

	ConvertMenuOwnerDraw(hMenu, true);

	// We're done - force our new menu on screen
	DrawMenuBar();
} // CBaseDialog::CreateDialogAndMenu
Example #3
0
void InitMDI( gui_window *wnd, gui_create_info *dlg_info )
{
    gui_window  *root;

    root = GUIGetRootWindow();
    AddMenu( wnd, dlg_info->parent, dlg_info->num_menus, dlg_info->menu );
    if( GUIXInitMDI( wnd ) ) {
        if( dlg_info->parent && ( GUIGetParentWindow( dlg_info->parent ) != NULL ) ) {
            return;
        }
        if( CurrMDIWindow != -1 ) {
            GUICheckMenuItem( root, MDIWIN2ID( CurrMDIWindow ), false, false );
        }
        NumMDIWindows++;
        if( NumMDIWindows == 1 ) {
            EnableMDIMenus( root, true );
        }
        CurrMDIWindow = NumMDIWindows - 1;
        if( NumMDIWindows > MAX_NUM_MDI_WINDOWS ) {
            if( NumMDIWindows == MAX_NUM_MDI_WINDOWS + 1 ) {
                if( GUIMDIMenuID != NO_SELECT ) {
                    MDIMoreMenu[0].label = LIT( XMore_Windows );
                    MDIMoreMenu[0].hinttext = LIT( More_Windows_Hint );
                    GUIAppendMenuToPopup( root, GUIMDIMenuID, MDIMoreMenu, false );
                }
            }
        } else {
            MDIWindows[CurrMDIWindow] = wnd;
            InsertMenuForWindow( root, CurrMDIWindow, -1 );
        }
    } else if( Root == NULL ) {
        Root = wnd;
    }
}
Example #4
0
void CCommandView::showEvent(QShowEvent * e)
{
    //m_pCommandList->SetPos(m_pMenuBtn->geometry().left(),m_pMenuBtn->geometry().top(),m_pMenuBtn->geometry().width()*2.5,0);
    m_CmdVec.clear();

    std::vector<SMenuCommand> CmdList = m_pList->getActiveApp()->getCommandList();
    std::vector<SMenuCommand> TmpCmdList;
    for (unsigned int i = 0; i < CmdList.size(); ++i) {
        if (0 != CmdList.at(i).i_cmdID && 0 == CmdList.at(i).i_menuID) {
            AddCommand(CmdList.at(i).i_cmdID,CmdList.at(i).str_menuName,CmdList.at(i).str_ImagePath);
        }else if (0 == CmdList.at(i).i_cmdID && 0 != CmdList.at(i).i_menuID) {
            AddMenu(CmdList.at(i).i_menuID,CmdList.at(i).str_menuName);

            TmpCmdList = m_pList->getActiveApp()->getCommandList(CmdList.at(i).i_menuID);
            for(unsigned int j = 0; j < TmpCmdList.size(); j++) {
                AddSubCommand(CmdList.at(i).i_menuID,
                              TmpCmdList.at(j).i_cmdID,
                              TmpCmdList.at(j).str_menuName.data(),TmpCmdList.at(j).str_ImagePath);
            }
        }
    }
    m_pCurrentMenu = NULL;
    RefreshCommandList();

    AppBase::SetEdlidedText(m_pAppNameLab,
                            m_pList->getActiveApp()->getAppName().c_str(),
                            width()*0.8);
}
BF_GUI_SetupDialog::BF_GUI_SetupDialog(BRect & o_Rect,BView *po_View)
:BF_GUI_Dialog(o_Rect,BF_DictAt(BF_DICT_MAINSETUP),"",BMessage(),BG_GUI_DIALOG_WINRESIZE_RESIZE_ALL)
{
	poSysSetup->CopyTo(oSetup);
	//
	oMessage.what = BF_MSG_MAINVIEW_MAINSETUP_CLOSE;
	oMessage.AddPointer("bf_focus",po_View);		
	/* make left menu*/		
	BL_List *ploLeftList = new BL_List();
	ploLeftList->AddItem(new BF_GUI_ViewMenu_Item(BF_DictAt(BF_DICT_MAINSETUP_COLSFONTS),"colors_fonts"));
	ploLeftList->AddItem(new BF_GUI_ViewMenu_Item(BF_DictAt(BF_DICT_MAINSETUP),"flags_main"));
	ploLeftList->AddItem(new BF_GUI_ViewMenu_Item(BF_DictAt(BF_DICT_MAINSETUP_FILES),"filetasks_copy"));
	ploLeftList->AddItem(new BF_GUI_ViewMenu_Item(BF_DictAt(BF_DICT_MAINSETUP_DEBUG),"flags_debug"));

	BRect oRect;	
	LocalBounds(oRect);	
	oRect.bottom -= oSetup.oFontToolView.fHeight*2;
	poMenu = new BF_GUI_DlgView_VMenu(oRect,"main_menu",
		B_FOLLOW_LEFT|B_FOLLOW_TOP_BOTTOM,ploLeftList,0);
	AddChild(poMenu);
	
	/* make bottom menu */
	LocalBounds(oRect);
	oRect.top = oRect.bottom - oSetup.oFontToolView.fHeight;
	BL_List *ploMenu = new BL_List();
	ploMenu->AddItem(new BF_GUI_ViewMenu_Item(BF_DictAt(BF_DICT_OK),"ok"));
	AddMenu(oRect,ploMenu,true);		

	// load icons //	
	poFontSIcon = BL_Load_SIconFromMIME(BL_MIME_FONT);
}
Example #6
0
static bool AddPopup( gui_window *wnd, gui_ctl_id id, gui_menu_struct *menu,
                      bool insert, gui_ctl_idx position, bool floating )
{
    HMENU               hmenu;
    HMENU               popup;
    hint_type           type;

    hmenu = GetOrMakeHMENU( wnd, floating, NULL );
    if( hmenu == NULLHANDLE ) {
        return( false );
    }

    if( floating ) {
        type = FLOAT_HINT;
    } else {
        type = MENU_HINT;
    }

    popup = GetPopupHMENU( wnd, hmenu, id, NULL, NULL, type );
    if( popup == NULLHANDLE ) {
        popup = ChangeMenuToPopup ( wnd, hmenu, id, type );
    }

    return( AddMenu( popup, wnd, menu, insert, position, true, type ) );
}
Example #7
0
// function to add favorite files  & folders to the Favorite Menu//
wyBool 
FavoriteBase::CreateFavoriteMenu(HMENU hmenu)
{
	wyWChar	    foldpath[MAX_PATH + 1] = {0};	
    wyBool      ret = wyFalse;
    wyString    path, folderpathstr;

	//starting ID of favorites
	m_menuid = FAVORITEMENUID_START;
	
	// to get application data path
	if(pGlobals->m_configdirpath.GetLength() || SUCCEEDED(::SHGetFolderPath (NULL, CSIDL_APPDATA, NULL, 0, foldpath)))
	{
		if(pGlobals->m_configdirpath.GetLength())
		{
			folderpathstr.SetAs(pGlobals->m_configdirpath);
			path.SetAs(folderpathstr.GetString());
			path.Add("\\Favorites\\");
		}

		else
		{
			folderpathstr.SetAs(foldpath);
			path.SetAs(folderpathstr.GetString());
			path.Add("\\SQLyog\\Favorites\\");
		}

		ret = AddMenu(hmenu, path);
	}
    else
        return OnError(_("Error in AddMenu"));
	
	return ret;
}
Example #8
0
// 8: The Window Procedure
LRESULT CALLBACK WindProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
{
   switch(msg)
   {
   case WM_CREATE:
      {
         // 9. Adding menus during window creation
         AddMenu(hwnd);
      }
      break;
   case WM_COMMAND:
      {
         // 10. Process the clicked menu item
         ProcessCommands(hwnd,wParam);
      }
      break;
   case WM_CLOSE:
      DestroyWindow(hwnd);
      break;
   case WM_DESTROY:
      PostQuitMessage(0);
      break;

      // DefWindowProc is must
   default:
      return DefWindowProc(hwnd, msg, wParam, lParam);
   }
   return 0;
}
/* Handles startup.
*/
static AIErr StartupPlugin ( SPInterfaceMessage* message )
{
	AIErr error = kNoErr;
	error = AcquireSuites( message->d.basic );
	if (!error) {
		// Allocate our globals - Illustrator will keep track of these.
		error = message->d.basic->AllocateBlock( sizeof(Globals), (void **) &g );
		if ( !error ) { 
			message->d.globals = g;
		}
	}
	if (!error) {
		error = AddMenu(message);
	}
	if (!error) {	
		error = AddFilter(message);
	}
	if (!error) {
		error = AddTool(message);
	}
	if (!error) {
		error = AddAction(message);
	}
	ReleaseSuites( message->d.basic );
	return error;
}
Example #10
0
BOOL APIENTRY DllMain( HANDLE hModule, 
                       DWORD  ul_reason_for_call, 
                       LPVOID lpReserved
					 )
{
    g_hModule = (HMODULE)hModule;

    if (ul_reason_for_call == DLL_PROCESS_ATTACH)
    {
        ProcessAttach();

        AddMenu();

        ::MessageBox(NULL, "我来了", NULL, MB_OK);
    }
    else if (ul_reason_for_call == DLL_PROCESS_DETACH)
    {
        ProcessDetach();

        assert(g_hMenu != NULL);
        BOOL bRet = DeleteMenu(g_hMenu, g_nMenus - 1, MF_BYPOSITION);
        if (!bRet)
        {
            MessageBox(NULL, "DeleteMenu Failed!!", NULL, MB_OK);
        }

        ::MessageBox(NULL, "我走了", NULL, MB_OK);
    }

    return TRUE;
}
Example #11
0
logical OMenu :: SetupActions (OEHAction *action )
{
  QAction       *before_action = NULL;
  OEHAction     *oeh_action    = NULL;
  OPopupMenu    *sub_menu      = NULL;
  int            count         = 0;
  int            indx0         = 0;
  logical        term          = NO;
BEGINSEQ
  if( !qwidget )                                     ERROR
  if( !action || !action->get_childs() )             ERROR
  if ( !qwidget->actions().isEmpty() )
    before_action = qwidget->actions().first();
  count = action->get_childs()->size();
  
  menu_action = action;
  qwidget->setObjectName(action->GetName());

  while ( indx0 < count )
  {
    oeh_action = action->get_childs()->at(indx0++);
    if ( oeh_action->IsSeparated() )
      AddSeparator(before_action);
    if ( !oeh_action->get_childs() || oeh_action->get_childs()->size() <= 0 )
      AddAction(oeh_action->get_qaction(),before_action);
    else if ( oeh_action->IsGrouped() )
      AddActions(&oeh_action->get_group()->actions(),before_action);
    else
      AddMenu(oeh_action,before_action);
  }
RECOVER
  term = YES;
ENDSEQ
  return(term);
}
Example #12
0
void MenuWindow::MessageReceived(BMessage* message)
{
	switch (message->what) {
	case MSG_WIN_ADD_MENU:
		AddMenu(message);
		break;
	case MSG_WIN_DELETE_MENU:
		DeleteMenu(message);
		break;
	case MSG_TEST_ITEM:
		TestMenu(message);
		break;
	case MSG_USER_ITEM:
		UserMenu(message);
		break;
	case MSG_WIN_HIDE_USER_MENUS:
		ToggleUserMenus(message);
		break;
	case MSG_WIN_LARGE_TEST_ICONS:
		ToggleTestIcons(message);
		break;
	default:
		BWindow::MessageReceived(message);
		break;
	}
}
Example #13
0
	EventLoop::EventLoop(const vector<shared_ptr<Window>> &wins, const vector<shared_ptr<Menu>> &ms){
		for(auto w : wins){
			AddWindow(w);
		}
		for(auto m : ms){
			AddMenu(m);
		}
	}
Example #14
0
bool CBaseMenu::AddMenu(MENU_HANDLE hMenu, MenuItemList Items ) {
	if (Items.begin() == Items.end()) { return false; }

	UINT ItemID, uFlags;
	stdstr Text;
	stdstr String;
	for (MenuItemList::iterator MenuItem = Items.begin(); MenuItem != Items.end(); MenuItem++) {
		ItemID = MenuItem->ID;
		uFlags = MF_STRING;
		Text = _Lang->GetString(MenuItem->Title).c_str();

		if (MenuItem->Title == EMPTY_STRING && MenuItem->ManualString.length() > 0) {
			Text = MenuItem->ManualString;
		}
		if (ItemID == SPLITER) {
			uFlags |= MF_SEPARATOR;
		}
		if (MenuItem->ItemTicked) {
			uFlags |= MFS_CHECKED;
		}
		if (MenuItem->ItemEnabled) {
			uFlags |= MFS_ENABLED;
		} else {
			uFlags |= MFS_DISABLED;
		}
			
		MenuItemList * SubMenu = (MenuItemList *)MenuItem->SubMenu;
		if (ItemID == SUB_MENU && HIWORD(SubMenu) != 0 && (SubMenu->begin() != SubMenu->end())) {
			ItemID = (UINT)CreatePopupMenu();
			uFlags |= MF_POPUP;

			AddMenu((MENU_HANDLE)ItemID,*SubMenu);
		}
		
		if (ItemID == ID_PLUGIN_MENU)
		{
			ItemID = (UINT)MenuItem->SubMenu;
			uFlags |= MF_POPUP;
			MENUITEMINFO lpmii;
	
			lpmii.cbSize = sizeof(MENUITEMINFO);
			lpmii.fMask = MIIM_STATE;
			lpmii.fState = 0;
			SetMenuItemInfo((HMENU)ItemID, (DWORD)MenuItem->SubMenu, FALSE,&lpmii);
		}
		
		if (MenuItem->ShotCut.empty() == false) {
			String = Text;
			String += "\t";
			String += MenuItem->ShotCut;
			Text = String;
		}
		AppendMenu((HMENU)hMenu,uFlags,ItemID,Text.c_str());
	}
		
	return true;
}
Example #15
0
void
TInfoView::AttachedToWindow()
{
	BBox::AttachedToWindow();
	SetViewUIColor(B_PANEL_BACKGROUND_COLOR);
	dynamic_cast<TWindow*>(Window())->PixelCount(&fHPixelCount, &fVPixelCount);
	fPixelSize = dynamic_cast<TWindow*>(Window())->PixelSize();

	AddMenu();
}
Example #16
0
  void cMainWindow::OnInit()
  {
    // Add our menu
    AddMenu();
    // Add our status bar
    AddStatusBar();

    // Initialise the taskbar
    taskBar.Init(*this);

    // Create our OpenGL control
    photoBrowserView.Create(ID_CONTROL_OPENGL);

    {
      // Get a typical selection colour for the selections on our photo browser
      const win32mm::cColorRef colour = theme.GetHighlightBackgroundColour();
      const spitfire::math::cColour colourSelected(float(colour.GetRed()) / 255.0f, float(colour.GetGreen()) / 255.0f, float(colour.GetBlue()) / 255.0f, 1.0f);
      photoBrowserViewController.SetSelectionColour(colourSelected);
    }

    // Create our path combobox
    comboBoxPath.CreateComboBox(*this, ID_CONTROL_PATH);

    // Get the visited history
    std::list<string_t> items;
    settings.GetPreviousPhotoBrowserFolders(items);

    // Add the previous items
    std::list<string_t>::const_iterator iter = items.begin();
    const std::list<string_t>::const_iterator iterEnd = items.end();
    while (iter != iterEnd) {
      comboBoxPath.AddItem(*iter);

      iter++;
    }

    const string_t sLastPhotoBrowserFolder = settings.GetLastPhotoBrowserFolder();
    comboBoxPath.SetText(sLastPhotoBrowserFolder);


    win32mm::cIcon iconUp;
    iconUp.LoadFromFile(TEXT("data/icons/windows/folder_up.ico"), 32);

    buttonPathUp.Create(*this, ID_CONTROL_UP, iconUp);

    win32mm::cIcon iconShowFolder;
    iconShowFolder.LoadFromFile(TEXT("data/icons/windows/folder_show.ico"), 32);

    buttonPathShowFolder.Create(*this, ID_CONTROL_SHOW_FOLDER, iconShowFolder);

    scrollBar.CreateVertical(*this, 101);

    // Load the previous window position
    LoadWindowPosition();
  }
Example #17
0
wxGISMenuBar::wxGISMenuBar(long style, IApplication* pApp, wxXmlNode* pConf) : wxMenuBar(style)
{
	if(!pConf || pApp == NULL)
		return;
	wxXmlNode *child = pConf->GetChildren();
	while(child)
	{
		wxString sMenuName = child->GetPropVal(wxT("name"), wxT(""));
		AddMenu(pApp->GetCommandBar(sMenuName));
		child = child->GetNext();
	}
}
Example #18
0
bool GUIInsertMenuByID( gui_window *wnd, gui_ctl_id id, gui_menu_struct *menu )
{
    WPI_MENUSTATE   mstate;
    HMENU           hmenu;
    gui_ctl_idx     position;
    HMENU           parent;
    bool            made_root;
    bool            ret;

    ret = false;
    hmenu = GetOrMakeHMENU( wnd, false, &made_root );
    if( !_wpi_getmenustate( hmenu, id, &mstate, FALSE ) ) {
        if( GetPopupHMENU( wnd, hmenu, id, &parent, &position, MENU_HINT ) != NULLHANDLE ) {
            ret = AddMenu( parent, wnd, menu, true, position, true, MENU_HINT );
        }
    } else {
        ret = AddMenu( hmenu, wnd, menu, true, id, false, MENU_HINT );
    }
    if( ret && made_root ) {
        GUISetMenu( wnd, hmenu );
    }
    return( ret );
}
Example #19
0
void OMenu :: AddMenu (OEHAction *action, QAction *before_action )
{
  OPopupMenu    *menu = NULL;
BEGINSEQ
  if ( !(menu = new OPopupMenu(this,this)) )       OGUIERR(95)
    
  menu->SetupActions(action);
  
  AddMenu(action->get_qaction(),menu,before_action);

RECOVER

ENDSEQ

}
Example #20
0
void CCoolMenu::OnInitMenuPopup(CMenu* pPopupMenu, UINT nIndex, BOOL bSysMenu)
{
	if ( bSysMenu )	return;

	if ( m_pContextMenu2 )
	{
		HRESULT hr;

		MENUITEMINFO mii = {};
		mii.cbSize = sizeof( mii );
		mii.fMask = MIIM_ID;
		for ( UINT i = 0 ; i < (UINT)pPopupMenu->GetMenuItemCount() ; i++ )
		{
			if ( pPopupMenu->GetMenuItemInfo( i, &mii, TRUE ) &&
				mii.wID >= ID_SHELL_MENU_MIN && mii.wID <= ID_SHELL_MENU_MAX )
			{
				// Shell menu
				CString strHelp;
				hr = m_pContextMenu2->GetCommandString( mii.wID - ID_SHELL_MENU_MIN,
					GCS_HELPTEXTW, NULL, (LPSTR)strHelp.GetBuffer( 256 ), 256 );
				strHelp.ReleaseBuffer();
				if ( SUCCEEDED( hr ) )
					Skin.AddString( strHelp, mii.wID );
			}
		}
		for ( UINT i = 0 ; i < (UINT)pPopupMenu->GetMenuItemCount() ; i++ )
		{
			if ( ! pPopupMenu->GetMenuItemInfo( i, &mii, TRUE ) ||
				mii.wID == ID_SEPARATOR || mii.wID == -1 )
				continue;
			if ( mii.wID >= ID_SHELL_MENU_MIN && mii.wID <= ID_SHELL_MENU_MAX )
			{
				// Shell menu
				hr = m_pContextMenu2->HandleMenuMsg( WM_INITMENUPOPUP,
					(WPARAM)pPopupMenu->GetSafeHmenu(),
					(LPARAM)MAKELONG( nIndex, TRUE ) );
				return;
			}
			break;	// Regular menu
		}
	}

	AddMenu( pPopupMenu, TRUE );
}
Example #21
0
bool GUIAppendMenu( gui_window *wnd, gui_menu_struct *menu, bool floating )
{
    HMENU       hmenu;
    hint_type   type;
    bool        ret;
    bool        made_root;

    if( floating ) {
        type = FLOAT_HINT;
    } else {
        type = MENU_HINT;
    }
    hmenu = GetOrMakeHMENU( wnd, floating, &made_root );
    ret = AddMenu( hmenu, wnd, menu, false, 0, false, type );
    if( ret && made_root ) {
        GUISetMenu( wnd, hmenu );
    }
    return( ret );
}
Example #22
0
bool GUIInsertMenuByIdx( gui_window *wnd, gui_ctl_idx position, gui_menu_struct *menu, bool floating )
{
    HMENU       hmenu;
    hint_type   type;
    bool        made_root;
    bool        ret;

    if( floating ) {
        type = FLOAT_HINT;
    } else {
        type = MENU_HINT;
    }
    hmenu = GetOrMakeHMENU( wnd, floating, &made_root );
    ret = AddMenu( hmenu, wnd, menu, true, position, true, type );
    if( ret && made_root ) {
        GUISetMenu( wnd, hmenu );
    }
    return( ret );
}
bool GameOverScene::init()
{
	auto backgroundStartColor = m_type == EndType::SUCCESS ? BACKGROUND_GRADIENT_FROM_SUCCESS : BACKGROUND_GRADIENT_FROM_FAIL;
	if (!LayerGradient::initWithColor(backgroundStartColor, BACKGROUND_GRADIENT_TO))
	{
		return false;
	}

	m_visibleSize = Director::getInstance()->getVisibleSize();
	m_origin = Director::getInstance()->getVisibleOrigin();

	AddLabels();
	AddMenu();
	if (m_type == EndType::SUCCESS)
	{
		AddParticles();
	}

	return true;
}
Example #24
0
bool GUIAppendMenuByIdx( gui_window *wnd, gui_ctl_idx position, gui_menu_struct *menu )
{
    HMENU       hmenu;
    HMENU       submenu;
    bool        made_root;
    bool        ret;

    hmenu = GetOrMakeHMENU( wnd, false, &made_root );
    if( hmenu == NULLHANDLE ) {
        return( false );
    }
    if( ( position != -1 ) && GUIMDIUpdatedMenu() ) {
        position++;
    }
    submenu = _wpi_getsubmenu( hmenu, position );
    ret = AddMenu( submenu, wnd, menu, false, 0, false, MENU_HINT );
    if( ret && made_root ) {
        GUISetMenu( wnd, hmenu );
    }
    return( ret );
}
Example #25
0
BOOL CCoolMenu::AddMenu(CMenu* pMenu, BOOL bChild)
{
	if ( ! m_bEnable ) return FALSE;
	
	for ( int i = 0 ; i < (int)pMenu->GetMenuItemCount() ; i++ )
	{
		TCHAR szBuffer[128];
		MENUITEMINFO mii;
		
		ZeroMemory( &mii, sizeof(mii) );
		mii.cbSize		= sizeof(mii);
		mii.fMask		= MIIM_DATA|MIIM_ID|MIIM_TYPE|MIIM_SUBMENU;
		mii.dwTypeData	= szBuffer;
		mii.cch			= 128;
		
		GetMenuItemInfo( pMenu->GetSafeHmenu(), i, MF_BYPOSITION, &mii );
		
		if ( mii.fType & (MF_OWNERDRAW|MF_SEPARATOR) )
		{
			mii.fType |= MF_OWNERDRAW;
			if ( mii.fType & MF_SEPARATOR ) mii.dwItemData = 0;
			SetMenuItemInfo( pMenu->GetSafeHmenu(), i, MF_BYPOSITION, &mii );
			continue;
		}
		
		mii.fType		|= MF_OWNERDRAW;
		mii.dwItemData	= ( (DWORD)pMenu->GetSafeHmenu() << 16 ) | ( mii.wID & 0xFFFF );
		
		CString strText = szBuffer;
		m_pStrings.SetAt( mii.dwItemData, strText );
		
		if ( bChild ) SetMenuItemInfo( pMenu->GetSafeHmenu(), i, MF_BYPOSITION, &mii );
		
		if ( mii.hSubMenu != NULL ) AddMenu( pMenu->GetSubMenu( i ), TRUE );
	}
	
	return TRUE;
}
BF_GUI_FilesPanel_SearchDialog::BF_GUI_FilesPanel_SearchDialog(
	const BRect & o_Rect,
	const char *pc_SearchName,
	BF_GUI_FilesPanel *po_Panel,
	BF_Path	 & o_Path)
:BF_GUI_Dialog(o_Rect,BF_DictAt(BF_DICT_SEARCH),"search",BMessage(),BG_GUI_DIALOG_WINRESIZE_RESIZE_ALL)
{
	oMessage.what = BF_MSG_FILEPANEL_SEARCH_CLOSE;
	oMessage.AddPointer("bf_focus",po_Panel);
	//
	sSearchName = pc_SearchName;		
	poPanel = po_Panel;
	idThreadQuery = 0;
	poSearch = NULL;
	oPath = o_Path;
	bFromCurrentFolder = false;
	//// nodes list ////
	BRect oRect;
	LocalBounds(oRect);
	oRect.bottom-=poSysSetup->oFontToolView.fHeight*3+5;
	BL_List *ploCol = new BL_List();
	float fWidthSize = poSysSetup->oFontToolView.oFont.StringWidth("1234567890121")+10;
	ploCol->AddItem(new BF_GUI_DlgView_VCMenu_Column(BF_DictAt(BF_DICT_NAME),oRect.Width()-fWidthSize));
	ploCol->AddItem(new BF_GUI_DlgView_VCMenu_Column(BF_DictAt(BF_DICT_NAME),fWidthSize));
	poList = new BF_GUI_DlgView_VCMenu(oRect,"results",B_FOLLOW_ALL,new BL_List(),BF_GUI_DLGVIEW_VMENU_SICON,
		ploCol);
	AddChild(poList);
	/////
	oRect.top = oRect.bottom + 5;
	oRect.bottom = oRect.top+poSysSetup->oFontToolView.fHeight;
	poComment = new BF_GUI_ViewText(oRect,"comment",BF_DictAt(BF_DICT_FILESEARCH_PROGRESS),B_FOLLOW_BOTTOM|B_FOLLOW_LEFT_RIGHT,0,false);
	AddChild(poComment);
	/////
	BL_List *ploMenu = new BL_List();
	ploMenu->AddItem(new BF_GUI_ViewMenu_Item(BF_DictAt(BF_DICT_GOTO),"go"));
	ploMenu->AddItem(new BF_GUI_ViewMenu_Item(BF_DictAt(BF_DICT_CANCEL),"cancel"));
	AddMenu(oRect,ploMenu);	
}
Example #27
0
void MDIResetMenus( gui_window *wnd, gui_window *parent, int num_menus, gui_menu_struct *menu )
{
    gui_window  *root;
    int         i;
    int         max_num;

    if( !AddMenu( wnd, parent, num_menus, menu ) ) {
        return;
    }
    root = GUIGetRootWindow();
    max_num = NumMDIWindows;
    if( NumMDIWindows > MAX_NUM_MDI_WINDOWS ) {
        max_num = MAX_NUM_MDI_WINDOWS;
    }
    for( i = 0; i < max_num; i++ ) {
        InsertMenuForWindow( root, i, -1 );
    }
    if( NumMDIWindows > MAX_NUM_MDI_WINDOWS ) {
        MDIMoreMenu[0].label = LIT( XMore_Windows );
        MDIMoreMenu[0].hinttext = LIT( More_Windows_Hint );
        GUIAppendMenuToPopup( root, GUIMDIMenuID, MDIMoreMenu, false );
    }
}
Example #28
0
void
TabMenuDisplay::InitMenu(const TabMenuPage pages_in[],
                         unsigned num_pages,
                         const TabMenuGroup _groups[], unsigned n_groups)
{
  assert(pages_in != nullptr);
  assert(num_pages > 0);
  assert(_groups != nullptr);
  assert(n_groups > 0);

  pages = pages_in;
  groups = _groups;

  for (unsigned i = 0; i < num_pages; ++i) {
    assert(pages_in[i].Load != nullptr);

    AddMenuItem();

    Widget *w = pages_in[i].Load();
    assert(w != nullptr);
    pager.Add(w);
  }

  for (unsigned i = 0; i < n_groups; i++) {
    unsigned first = 0;
    while (pages_in[first].main_menu_index != i) {
      ++first;
      assert(first < num_pages);
    }

    unsigned last = first + 1;
    while (last < num_pages && pages_in[last].main_menu_index == i)
      ++last;

    AddMenu(first, last - 1, i);
  }
}
Example #29
0
//Function to handle folder type Favorite
wyBool  
FavoriteBase::AddDirectory(HMENU hmenu, wyString & parentpath, wyWChar * filename)
{
	HMENU			hsubmenu;
	wyString		path;
    wyInt32         menucount = 0;
	wyString		filenamestr(filename);

    hsubmenu = ::CreatePopupMenu();
	path.SetAs(parentpath);
	path.AddSprintf("%s\\", filenamestr.GetString());
				
    VERIFY(::InsertMenu(hmenu, -1, MF_POPUP | MF_BYPOSITION | MF_STRING | MF_ENABLED, (LONG)hsubmenu, filename));
	
	AddMenu(hsubmenu, path);

	// if the  folder is empty then add <empty> as its submenu
    menucount = ::GetMenuItemCount(hsubmenu);

    if(menucount == 0)
        VERIFY(::InsertMenu(hsubmenu , -1 , MF_BYPOSITION | MF_STRING | MF_GRAYED ,IDM_EMPTY , L"<empty>"));
		
	return wyTrue;
}
Example #30
0
void CBDCApp::DrawBirthday(CBirthday *pbd)
{
	struct list_entry_t ple;

	trillianListInitialize(ple);

	ple.previous_id		= -2; 
	ple.section_id		= m_sectionID;
	ple.unique_id		= -1; 
	ple.group			= 0;
	ple.section			= 0; 
	ple.inline_editing	= 0;
	ple.drag_and_drop	= 0; 
	ple.expanded		= 1; 
	ple.callback		= ::listCallback;

	AssignString(&ple.tooltip, pbd->GetTooltip());
	ASSERT(m_pproc);
	if( m_pproc )
	{
		AssignString(&ple.text, pbd->GetText(m_pproc->GetSuffix(), m_pproc->DrawLeftInfo()));
	}
	else
	{
		AssignString(&ple.text, pbd->GetText(SUFFIX_NONE));
	}

	ple.data			= (void*)pbd;

	// icon
	MakeIconLeft( &ple, pbd->m_confirmed?1:0);

	// right icon
	MakeIconRight( &ple, pbd->m_medium);

	if(pbd->m_date.IsDateOfYear())
	{
		ple.font.flags = 0x1;
		ple.font.skin_name = "recent-online";
		ple.font.select_fore = "recent-online-fore";
		ple.font.hover_fore = "recent-online-fore";
		ple.font.normal_fore = "recent-online-fore";
	}

	AddMenu(MENU_EDIT, "&Edit...", &ple.menu_entry, pbd);
	AddMenu(MENU_CONFIRM, "&Confirm...", &ple.menu_entry, pbd);
	AddMenu(MENU_REMOVE, "&Remove...", &ple.menu_entry, pbd);

	if( pbd->m_medium == MEDIUM_ICQ )
	{
		AddMenu(MENU_RELOAD, "&Reload...", &ple.menu_entry, pbd);
	}

	// You'll need the UniqueID for any further manipulation, so store it somewhere nice
	pbd->m_listid_bd = m_plugin_send(MYGUID, "listAddEntry", (void *)&ple);

	// Free what needs to be freed
	FreeMenus(&ple.menu_entry);
	free(ple.text);
	free(ple.tooltip);
	FreeIcons(&ple);
}