#include "../frmMain.h"
#include "../search/frmSearch.h"
-enum {
- ID_CONTACTMENU_OPEN,
- ID_CONTACTMENU_NEW,
- ID_CONTACTMENU_EDIT,
- ID_CONTACTMENU_DELETE,
- ID_CONTACTMENU_REFRESHAB,
- ID_CONTACTMENU_REVEAL
-};
-
-XABContactMenu::XABContactMenu(int MenuTypeIn){
+XABContactMenu::XABContactMenu(XABContactMenuType MenuTypeIn){
// Setup the XABContactMenu control.
// Setup the menu items.
AppendMenuItem(wxT("opencontact"), _("Open Contact..."), _(""), ID_CONTACTMENU_OPEN, wxITEM_NORMAL);
- AppendMenuItem(wxT("sep1"), _(""), _(""), wxID_ANY, wxITEM_SEPARATOR);
+ AppendMenuItem(wxT("sep1"), _(""), _(""), ID_CONTACTMENU_SEPARATOR, wxITEM_SEPARATOR);
if (MenuType == XABCONTACTMENU_MAIN){
// Setup the delete and refresh contact options if in the main window.
AppendMenuItem(wxT("deletecontact"), _("Delete Contact..."), _(""), ID_CONTACTMENU_DELETE, wxITEM_NORMAL);
- AppendMenuItem(wxT("sep2"), _(""), _(""), wxID_ANY, wxITEM_SEPARATOR);
+ AppendMenuItem(wxT("sep2"), _(""), _(""), ID_CONTACTMENU_SEPARATOR, wxITEM_SEPARATOR);
AppendMenuItem(wxT("refreshab"), _("Refresh Address Book"), _(""), ID_CONTACTMENU_REFRESHAB, wxITEM_NORMAL);
}
void XABContactMenu::AppendMenuItem(wxString ObjectName,
wxString MenuName,
wxString MenuDescription,
- int ItemID,
+ XABContactMenuID ItemID,
wxItemKind ItemType){
- // Append a menu item to the XABContactMenu control.
-
- wxMenuItem *menuitem = new wxMenuItem(
- NULL,
- ItemID,
- MenuName,
- MenuDescription,
- ItemType,
- NULL
- );
+ if (ItemType == wxITEM_SEPARATOR){
+ this->AppendSeparator();
+ return;
+ }
+ // Append a menu item to the XABContactMenu control.
+
+ wxMenuItem *menuitem = this->Append(ItemID, MenuName, MenuDescription);
this->Connect(menuitem->GetId(), wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler(XABContactMenu::ProcessMenuItemClick));
- this->Append(menuitem);
MenuItems.insert(std::make_pair(ObjectName.ToStdString(), menuitem));
}