A slightly different implementation to use the standard menu names to clean up the code a bit for mac. http://wiki.wxwidgets.org/WxMac-specifi ... S_menu_bar.
This will put the Prefs, Help, Exit, and About menu items where they should go automatically. There will be no quit in the file menu, it is moved to the application menu. Other than that, it should behave the same, but because we are using the standard menu item names, we can axe some of the #if statements:
Code: Select all
Index: src/mmex.cpp
===================================================================
--- src/mmex.cpp (revision 662)
+++ src/mmex.cpp (working copy)
@@ -164,20 +164,20 @@
EVT_MENU(MENU_IMPORT_QIF, mmGUIFrame::OnImportQIF)
EVT_MENU(MENU_IMPORT_QFX, mmGUIFrame::OnImportQFX)
EVT_MENU(MENU_IMPORT_UNIVCSV, mmGUIFrame::OnImportUniversalCSV)
- EVT_MENU(MENU_QUIT, mmGUIFrame::OnQuit)
+ EVT_MENU(wxID_EXIT, mmGUIFrame::OnQuit)
EVT_MENU(MENU_NEWACCT, mmGUIFrame::OnNewAccount)
EVT_MENU(MENU_ACCTLIST, mmGUIFrame::OnAccountList)
EVT_MENU(MENU_ACCTEDIT, mmGUIFrame::OnEditAccount)
EVT_MENU(MENU_ACCTDELETE, mmGUIFrame::OnDeleteAccount)
EVT_MENU(MENU_ORGCATEGS, mmGUIFrame::OnOrgCategories)
EVT_MENU(MENU_ORGPAYEE, mmGUIFrame::OnOrgPayees)
- EVT_MENU(MENU_OPTIONS, mmGUIFrame::OnOptions)
+ EVT_MENU(wxID_PREFERENCES, mmGUIFrame::OnOptions)
EVT_MENU(MENU_BUDGETSETUPDIALOG, mmGUIFrame::OnBudgetSetupDialog)
- EVT_MENU(MENU_HELP, mmGUIFrame::OnHelp)
+ EVT_MENU(wxID_HELP, mmGUIFrame::OnHelp)
EVT_MENU(MENU_CHECKUPDATE, mmGUIFrame::OnCheckUpdate)
EVT_MENU(MENU_REPORTISSUES, mmGUIFrame::OnReportIssues)
EVT_MENU(MENU_ANNOUNCEMENTMAILING, mmGUIFrame::OnBeNotified)
- EVT_MENU(MENU_ABOUT, mmGUIFrame::OnAbout)
+ EVT_MENU(wxID_ABOUT, mmGUIFrame::OnAbout)
EVT_MENU(MENU_PRINT_PAGE_SETUP, mmGUIFrame::OnPrintPageSetup)
EVT_MENU(MENU_PRINT_REPORT, mmGUIFrame::OnPrintPageReport)
EVT_MENU(MENU_PRINT_PREVIEW_REPORT, mmGUIFrame::OnPrintPagePreview)
@@ -302,9 +302,6 @@
// mmIniOptions::enableGraphs_ = false;
//#endif
#if defined (__WXMAC__) || defined (__WXOSX__)
- wxApp::s_macAboutMenuItemId = MENU_ABOUT;
- wxApp::s_macPreferencesMenuItemId = MENU_OPTIONS;
- wxApp::s_macHelpMenuTitleName = "&Help";
wxSystemOptions::SetOption(wxMAC_ALWAYS_USE_GENERIC_LISTCTRL,1);
#endif
@@ -638,7 +635,7 @@
menuBar_->FindItem(MENU_IMPORT)->Enable(enable);
menuBar_->FindItem(MENU_PRINT_PREVIEW)->Enable(enable);
menuBar_->FindItem(MENU_PRINT)->Enable(enable);
- menuBar_->FindItem(MENU_OPTIONS)->Enable(enable);
+ menuBar_->FindItem(wxID_PREFERENCES)->Enable(enable);
if (mmIniOptions::enableRepeatingTransactions_)
menuBar_->FindItem(MENU_BILLSDEPOSITS)->Enable(enable);
if (mmIniOptions::enableStocks_)
@@ -2070,7 +2067,7 @@
menuFile->AppendSeparator();
- wxMenuItem* menuItemQuit = new wxMenuItem(menuFile, MENU_QUIT,
+ wxMenuItem* menuItemQuit = new wxMenuItem(menuFile, wxID_EXIT,
_("E&xit\tAlt-X"), _("Quit this program"));
menuItemQuit->SetBitmap(wxBitmap(exit_xpm));
menuFile->Append(menuItemQuit);
@@ -2173,14 +2170,14 @@
menuTools->AppendSeparator();
- wxMenuItem* menuItemOptions = new wxMenuItem(menuTools, MENU_OPTIONS,
+ wxMenuItem* menuItemOptions = new wxMenuItem(menuTools, wxID_PREFERENCES,
_("&Options"), _("Show the Options Dialog"));
menuItemOptions->SetBitmap(wxBitmap(wrench_xpm));
menuTools->Append(menuItemOptions);
wxMenu *menuHelp = new wxMenu;
- wxMenuItem* menuItemHelp = new wxMenuItem(menuTools, MENU_HELP,
+ wxMenuItem* menuItemHelp = new wxMenuItem(menuTools, wxID_HELP,
_("&Help\tCtrl-F1"), _("Show the Help file"));
menuItemHelp->SetBitmap(wxBitmap(help_xpm));
menuHelp->Append(menuItemHelp);
@@ -2230,7 +2227,7 @@
menuHelp->Append(menuItemNotify);
}
- wxMenuItem* menuItemAbout = new wxMenuItem(menuTools, MENU_ABOUT,
+ wxMenuItem* menuItemAbout = new wxMenuItem(menuTools, wxID_ABOUT,
_("&About..."), _("Show about dialog"));
menuItemAbout->SetBitmap(wxBitmap(about_xpm));
menuHelp->Append(menuItemAbout);
@@ -3176,7 +3173,7 @@
}
else if (dlg->getReturnCode() == 2)
{
- wxCommandEvent evt(wxEVT_COMMAND_MENU_SELECTED, MENU_HELP);
+ wxCommandEvent evt(wxEVT_COMMAND_MENU_SELECTED, wxID_HELP);
AddPendingEvent(evt);
}
else if (dlg->getReturnCode() == 3)