this->Connect( showHelp->GetId(), wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( frmMainADT::ShowHelp ) );\r
this->Connect( mnuHelpUpdates->GetId(), wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( frmMainADT::CheckUpdates ) );\r
this->Connect( mnuAbout->GetId(), wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( frmMainADT::ShowAboutWindow ) );\r
- lstContacts->Connect( wxEVT_COMMAND_LIST_ITEM_ACTIVATED, wxListEventHandler( frmMainADT::OpenContactInfo ), NULL, this );\r
+ lstContacts->Connect( wxEVT_COMMAND_LIST_ITEM_ACTIVATED, wxListEventHandler( frmMainADT::OpenContactInfoList ), NULL, this );\r
lstContacts->Connect( wxEVT_COMMAND_LIST_ITEM_DESELECTED, wxListEventHandler( frmMainADT::ShowContactInfo ), NULL, this );\r
lstContacts->Connect( wxEVT_COMMAND_LIST_ITEM_SELECTED, wxListEventHandler( frmMainADT::ShowContactInfo ), NULL, this );\r
+ lstContacts->Connect( wxEVT_RIGHT_UP, wxMouseEventHandler( frmMainADT::ShowContactMenu ), NULL, this );\r
htmContactData->Connect( wxEVT_RIGHT_UP, wxMouseEventHandler( frmMainADT::ShowContactSubmenu ), NULL, this );\r
stbBottom->Connect( wxEVT_SIZE, wxSizeEventHandler( frmMainADT::UpdateSBIconPlacement ), NULL, this );\r
}\r
this->Disconnect( ID_HELP_SHOW, wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( frmMainADT::ShowHelp ) );\r
this->Disconnect( ID_MANAGE_UPDATE, wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( frmMainADT::CheckUpdates ) );\r
this->Disconnect( wxID_ABOUT, wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( frmMainADT::ShowAboutWindow ) );\r
- lstContacts->Disconnect( wxEVT_COMMAND_LIST_ITEM_ACTIVATED, wxListEventHandler( frmMainADT::OpenContactInfo ), NULL, this );\r
+ lstContacts->Disconnect( wxEVT_COMMAND_LIST_ITEM_ACTIVATED, wxListEventHandler( frmMainADT::OpenContactInfoList ), NULL, this );\r
lstContacts->Disconnect( wxEVT_COMMAND_LIST_ITEM_DESELECTED, wxListEventHandler( frmMainADT::ShowContactInfo ), NULL, this );\r
lstContacts->Disconnect( wxEVT_COMMAND_LIST_ITEM_SELECTED, wxListEventHandler( frmMainADT::ShowContactInfo ), NULL, this );\r
+ lstContacts->Disconnect( wxEVT_RIGHT_UP, wxMouseEventHandler( frmMainADT::ShowContactMenu ), NULL, this );\r
htmContactData->Disconnect( wxEVT_RIGHT_UP, wxMouseEventHandler( frmMainADT::ShowContactSubmenu ), NULL, this );\r
stbBottom->Disconnect( wxEVT_SIZE, wxSizeEventHandler( frmMainADT::UpdateSBIconPlacement ), NULL, this );\r
\r
btnSelectAccounts->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( frmSearchADT::SelectAccounts ), NULL, this );\r
btnSearch->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( frmSearchADT::SearchContacts ), NULL, this );\r
btnReset->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( frmSearchADT::ResetContacts ), NULL, this );\r
+ lstResults->Connect( wxEVT_RIGHT_UP, wxMouseEventHandler( frmSearchADT::ShowContactMenu ), NULL, this );\r
this->Connect( mnuContactOpen->GetId(), wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( frmSearchADT::OpenContact ) );\r
this->Connect( mnuContactEdit->GetId(), wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( frmSearchADT::EditContact ) );\r
this->Connect( mnuContactReveal->GetId(), wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( frmSearchADT::RevealContact ) );\r
btnSelectAccounts->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( frmSearchADT::SelectAccounts ), NULL, this );\r
btnSearch->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( frmSearchADT::SearchContacts ), NULL, this );\r
btnReset->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( frmSearchADT::ResetContacts ), NULL, this );\r
+ lstResults->Disconnect( wxEVT_RIGHT_UP, wxMouseEventHandler( frmSearchADT::ShowContactMenu ), NULL, this );\r
this->Disconnect( wxID_ANY, wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( frmSearchADT::OpenContact ) );\r
this->Disconnect( wxID_ANY, wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( frmSearchADT::EditContact ) );\r
this->Disconnect( wxID_ANY, wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( frmSearchADT::RevealContact ) );\r
virtual void ShowHelp( wxCommandEvent& event ) { event.Skip(); }\r
virtual void CheckUpdates( wxCommandEvent& event ) { event.Skip(); }\r
virtual void ShowAboutWindow( wxCommandEvent& event ) { event.Skip(); }\r
- virtual void OpenContactInfo( wxListEvent& event ) { event.Skip(); }\r
+ virtual void OpenContactInfoList( wxListEvent& event ) { event.Skip(); }\r
virtual void ShowContactInfo( wxListEvent& event ) { event.Skip(); }\r
+ virtual void ShowContactMenu( wxMouseEvent& event ) { event.Skip(); }\r
virtual void ShowContactSubmenu( wxMouseEvent& event ) { event.Skip(); }\r
virtual void UpdateSBIconPlacement( wxSizeEvent& event ) { event.Skip(); }\r
\r
virtual void SelectAccounts( wxCommandEvent& event ) { event.Skip(); }\r
virtual void SearchContacts( wxCommandEvent& event ) { event.Skip(); }\r
virtual void ResetContacts( wxCommandEvent& event ) { event.Skip(); }\r
+ virtual void ShowContactMenu( wxMouseEvent& event ) { event.Skip(); }\r
virtual void OpenContact( wxCommandEvent& event ) { event.Skip(); }\r
virtual void EditContact( wxCommandEvent& event ) { event.Skip(); }\r
virtual void RevealContact( wxCommandEvent& event ) { event.Skip(); }\r
frmNewAccount.o frmPreferences.o frmContact.o frmConflictResolution.o \\r
frmEditAccount.o frmInvalidSSLCertificate.o frmSSLCertificate.o \\r
frmUpdate.o\r
-WIDGETOBJS=widgets/XABAccountView.o\r
+WIDGETOBJS=widgets/XABAccountView.o widgets/XABContactMenu.o\r
BMCOOBJS=tools/bitmapcode.o\r
\r
xestiaab: bitmaphelper formobjs widgetobjs commonobjs vcardobjs carddavobjs \\r
#include <wx/dir.h>
#include <wx/stdpaths.h>
#include <wx/fileconf.h>
+#include <wx/gdicmn.h>
//#include <boost/filesystem/fstream.hpp>
// Include the forms.
#include "contacteditor/frmContactEditor.h"
#include "import/import.h"
#include "export/export.h"
+#include "widgets/XABContactMenu.h"
#include "widgets/XABAccountView.h"
#include "version.h"
DEFINE_EVENT_TYPE(CE_UPDATEACCOUNTLIST);
DEFINE_EVENT_TYPE(SE_UPDATECONTACTNOTIF);
DEFINE_EVENT_TYPE(CE_OPENCONTACT);
+DEFINE_EVENT_TYPE(CE_OPENCONTACTLIST);
+DEFINE_EVENT_TYPE(CE_NEWCONTACT);
DEFINE_EVENT_TYPE(CE_EDITCONTACT);
+DEFINE_EVENT_TYPE(CE_DELETECONTACT);
DEFINE_EVENT_TYPE(CE_REVEALCONTACT);
DEFINE_EVENT_TYPE(CE_REMOVECONTACT);
DEFINE_EVENT_TYPE(CE_REMOVESEARCH);
DEFINE_EVENT_TYPE(ACTMGR_STOP);
DEFINE_EVENT_TYPE(WINDOW_ADD);
DEFINE_EVENT_TYPE(WINDOW_EDIT);
-//DEFINE_EVENT_TYPE(WINDOW_DELETE);
DEFINE_EVENT_TYPE(WINDOW_CLOSE);
DEFINE_EVENT_TYPE(CONNSTAT_UPDATE);
DEFINE_EVENT_TYPE(INVALIDSSLCERT);
DEFINE_EVENT_TYPE(SYNCACCOUNT);
DEFINE_EVENT_TYPE(IMPORT_RESULTSSHOW);
DEFINE_EVENT_TYPE(RELOADCONTACTLIST);
+DEFINE_EVENT_TYPE(REFRESHADDRESSBOOK);
BEGIN_EVENT_TABLE(frmMain, wxFrame)
EVT_COMMAND(wxID_ANY, wxEVT_COMMAND_BUTTON_CLICKED, frmMain::ConflictResolution)
EVT_COMMAND(wxID_ANY, CE_UPDATEACCOUNTLIST, frmMain::UpdateAccountList)
EVT_COMMAND(wxID_ANY, SE_UPDATECONTACTNOTIF, frmMain::UpdateSearchContactLists)
EVT_COMMAND(wxID_ANY, CE_OPENCONTACT, frmMain::OpenContactInfo)
+EVT_COMMAND(wxID_ANY, CE_OPENCONTACTLIST, frmMain::OpenContactInfoList)
+EVT_COMMAND(wxID_ANY, CE_NEWCONTACT, frmMain::ShowContactEditorNew)
EVT_COMMAND(wxID_ANY, CE_EDITCONTACT, frmMain::ShowContactEditorEdit)
+EVT_COMMAND(wxID_ANY, CE_DELETECONTACT, frmMain::DeleteContact)
EVT_COMMAND(wxID_ANY, CE_REVEALCONTACT, frmMain::RevealContact)
EVT_COMMAND(wxID_ANY, CE_REMOVESEARCH, frmMain::RemoveContactsWindowPointer)
EVT_COMMAND(wxID_ANY, SYNC_EMPTYSERVER, frmMain::EmptyServerDialog)
EVT_COMMAND(wxID_ANY, SYNCACCOUNT, frmMain::SyncAccount)
EVT_COMMAND(wxID_ANY, IMPORT_RESULTSSHOW, frmMain::ShowImportResults)
EVT_COMMAND(wxID_ANY, RELOADCONTACTLIST, frmMain::ReloadContactList)
+EVT_COMMAND(wxID_ANY, REFRESHADDRESSBOOK, frmMain::RefreshAddressBook)
END_EVENT_TABLE()
frmMain::frmMain( wxWindow* parent )
}
-void frmMain::OpenContactInfo( wxListEvent& event )
+void frmMain::OpenContactInfoList( wxListEvent& event )
{
wxStringTokenizer vcardfileline;
}
+void frmMain::OpenContactInfoList( wxCommandEvent& event ){
+
+ wxListEvent pevent;
+ OpenContactInfoList(pevent);
+
+}
+
void frmMain::OpenContactInfo( wxCommandEvent& event )
{
}
+}
+
+void frmMain::ShowContactMenu( wxMouseEvent& event ){
+
+ bool EnableRefresh = FALSE;
+
+ if (!ActiveAccount.IsEmpty()){
+
+ EnableRefresh = TRUE;
+
+ }
+
+ ContactMenu->SetupPointers(this, lstContacts, EnableRefresh);
+
+ this->PopupMenu(ContactMenu->MenuPointer(), wxDefaultPosition);
+
}
\ No newline at end of file
#include "common/timers.h"
#include "common/events.h"
#include "common/etag.h"
-#include "widgets/XABAccountView.h"
#include "bitmaps.h"
#include "common/sslcertstructs.h"
+#include "widgets/XABContactMenu.h"
+#include "widgets/XABAccountView.h"
//// end generated include
DECLARE_EVENT_TYPE(CE_UPDATEACCOUNTLIST, wxID_ANY)
DECLARE_EVENT_TYPE(SE_UPDATECONTACTNOTIF, wxID_ANY)
DECLARE_EVENT_TYPE(CE_OPENCONTACT, wxID_ANY)
+DECLARE_EVENT_TYPE(CE_OPENCONTACTLIST, wxID_ANY)
+DECLARE_EVENT_TYPE(CE_NEWCONTACT, wxID_ANY)
DECLARE_EVENT_TYPE(CE_EDITCONTACT, wxID_ANY)
+DECLARE_EVENT_TYPE(CE_DELETECONTACT, wxID_ANY)
DECLARE_EVENT_TYPE(CE_REVEALCONTACT, wxID_ANY)
DECLARE_EVENT_TYPE(CE_REMOVESEARCH, wxID_ANY)
DECLARE_EVENT_TYPE(CE_REMOVECONTACT, wxID_ANY)
DECLARE_EVENT_TYPE(SYNCACCOUNT, wxID_ANY);
DECLARE_EVENT_TYPE(IMPORT_RESULTSSHOW, wxID_ANY);
DECLARE_EVENT_TYPE(RELOADCONTACTLIST, wxID_ANY);
+DECLARE_EVENT_TYPE(REFRESHADDRESSBOOK, wxID_ANY);
struct UCNotif{
wxString ContactAccount;
int ContactUID = 0;
int ContactEditorUID = 0;
int WindowMenuItemID = 0;
+ XABContactMenu *ContactMenu = new XABContactMenu(XABCONTACTMENU_MAIN);
protected:
// Handlers for frmMainADT events.
void QuitApp( wxCloseEvent& event );
void LoadPreferences( wxActivateEvent& event );
void LoadPreferences();
void ShowContactInfo( wxListEvent& event );
- void OpenContactInfo( wxListEvent& event );
+ void OpenContactInfoList( wxListEvent& event );
+ void OpenContactInfoList( wxCommandEvent& event );
void OpenContactInfo( wxCommandEvent& event );
void ShowContactEditorNew( wxCommandEvent& event );
void ShowContactEditorEdit( wxCommandEvent& event );
void GetSelectedList( wxCommandEvent& event );
void SyncAccount( wxCommandEvent& event );
void ShowHelp( wxCommandEvent& event );
+ void ShowContactMenu( wxMouseEvent& event );
+ void ProcessMenuItemClick( wxCommandEvent &event );
public:
/** Constructor */
frmMain( wxWindow* parent );
DEFINE_EVENT_TYPE(SE_SEARCHFINISHED);
DEFINE_EVENT_TYPE(SE_UPDATERESULT);
DEFINE_EVENT_TYPE(SE_DELETERESULT);
+DEFINE_EVENT_TYPE(SE_OPENCONTACT);
+DEFINE_EVENT_TYPE(SE_EDITCONTACT);
+DEFINE_EVENT_TYPE(SE_REVEALCONTACT);
BEGIN_EVENT_TABLE(frmSearch, wxFrame)
EVT_COMMAND(wxID_ANY, SE_ADDSEARCHSETTING, frmSearch::AddSearchSetting)
EVT_COMMAND(wxID_ANY, SE_SEARCHFINISHED, frmSearch::SearchFinished)
EVT_COMMAND(wxID_ANY, SE_UPDATERESULT, frmSearch::UpdateResult)
EVT_COMMAND(wxID_ANY, SE_DELETERESULT, frmSearch::DeleteResult)
+ EVT_COMMAND(wxID_ANY, SE_OPENCONTACT, frmSearch::OpenContact)
+ EVT_COMMAND(wxID_ANY, SE_EDITCONTACT, frmSearch::EditContact)
+ EVT_COMMAND(wxID_ANY, SE_REVEALCONTACT, frmSearch::RevealContact)
END_EVENT_TABLE()
//namespace boostfs = boost::filesystem;
}
+}
+
+void frmSearch::ShowContactMenu( wxMouseEvent& event ){
+
+ ContactMenu->SetupPointers(this, lstResults);
+
+ PopupMenu(ContactMenu->MenuPointer(), wxDefaultPosition);
+
}
\ No newline at end of file
#include "AppXestiaAddrBk.h"
#include "vcard/vcard.h"
+#include "widgets/XABContactMenu.h"
#include <map>
-
//// end generated include
DECLARE_EVENT_TYPE(SE_ADDSEARCHSETTING, wxID_ANY)
DECLARE_EVENT_TYPE(SE_SEARCHFINISHED, wxID_ANY)
DECLARE_EVENT_TYPE(SE_UPDATERESULT, wxID_ANY)
DECLARE_EVENT_TYPE(SE_DELETERESULT, wxID_ANY)
+DECLARE_EVENT_TYPE(SE_OPENCONTACT, wxID_ANY)
+DECLARE_EVENT_TYPE(SE_EDITCONTACT, wxID_ANY)
+DECLARE_EVENT_TYPE(SE_REVEALCONTACT, wxID_ANY)
struct SRNotif{
vCardName ContactName;
wxString Account,
std::map<long,wxString> *SRAcc,
std::map<long,wxString> *SRFN);
+ XABContactMenu *ContactMenu = new XABContactMenu(XABCONTACTMENU_SEARCH);
protected:
// Handlers for frmSearchADT events.
void SelectAccounts( wxCommandEvent& event );
void UpdateResult( wxCommandEvent& event );
void DeleteResult( wxCommandEvent& event );
void CloseWindow( wxCloseEvent& event );
+ void ShowContactMenu( wxMouseEvent& event );
public:
/** Constructor */
frmSearch( wxWindow* parent );
--- /dev/null
+#include "XABContactMenu.h"
+#include "../frmMain.h"
+#include "../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){
+
+ MenuType = MenuTypeIn;
+
+ // Setup the menu items.
+
+ AppendMenuItem(wxT("opencontact"), _("Open Contact..."), _(""), ID_CONTACTMENU_OPEN, wxITEM_NORMAL);
+ AppendMenuItem(wxT("sep1"), _(""), _(""), wxID_ANY, wxITEM_SEPARATOR);
+
+ if (MenuType == XABCONTACTMENU_MAIN){
+
+ // Setup up the add contact option if in the main window.
+
+ AppendMenuItem(wxT("newcontact"), _("New Contact..."), _(""), ID_CONTACTMENU_NEW, wxITEM_NORMAL);
+
+ }
+
+ AppendMenuItem(wxT("editcontact"), _("Edit Contact..."), _(""), ID_CONTACTMENU_EDIT, wxITEM_NORMAL);
+
+ if (MenuType == XABCONTACTMENU_SEARCH){
+
+ // Setup up the reveal contact option if in the search window.
+
+ AppendMenuItem(wxT("revealcontact"), _("Reveal Contact..."), _(""), ID_CONTACTMENU_REVEAL, wxITEM_NORMAL);
+
+ }
+
+ 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("refreshab"), _("Refresh Address Book"), _(""), ID_CONTACTMENU_REFRESHAB, wxITEM_NORMAL);
+
+ }
+
+}
+
+XABContactMenu::~XABContactMenu(){
+
+ // Delete the menu items.
+
+ for (std::map<std::string, wxMenuItem*>::iterator MenuItemIter = MenuItems.begin();
+ MenuItemIter != MenuItems.end(); ++MenuItemIter){
+
+ // Delete the wxMenuItem object.
+
+ this->Disconnect(MenuItemIter->second->GetId(), wxEVT_COMMAND_MENU_SELECTED,
+ wxCommandEventHandler(XABContactMenu::ProcessMenuItemClick) );
+ delete(MenuItemIter->second);
+ MenuItemIter->second = NULL;
+
+ }
+
+ MenuItems.clear();
+
+}
+
+void XABContactMenu::AppendMenuItem(wxString ObjectName,
+ wxString MenuName,
+ wxString MenuDescription,
+ int ItemID,
+ wxItemKind ItemType){
+
+ wxMenuItem *menuitem = new wxMenuItem(
+ NULL,
+ ItemID,
+ MenuName,
+ MenuDescription,
+ ItemType,
+ NULL
+ );
+
+ this->Connect(menuitem->GetId(), wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler(XABContactMenu::ProcessMenuItemClick));
+ this->Append(menuitem);
+ MenuItems.insert(std::make_pair(ObjectName.ToStdString(), menuitem));
+
+}
+
+void XABContactMenu::SetupPointers(wxWindow* WindowPtrIn,
+ wxListCtrl* ContactListCtrlIn){
+
+ WindowPtr = WindowPtrIn;
+ ContactListCtrl = ContactListCtrlIn;
+
+}
+
+void XABContactMenu::SetupPointers(wxWindow* WindowPtrIn,
+ wxListCtrl* ContactListCtrlIn,
+ bool EnableAccountSettingsIn){
+
+ WindowPtr = WindowPtrIn;
+ ContactListCtrl = ContactListCtrlIn;
+ EnableAccountSettings = EnableAccountSettingsIn;
+
+}
+
+wxMenu* XABContactMenu::MenuPointer(){
+
+ // Check for the following before passing the pointer:
+ // If an account has been selected.
+ // - Disable Refresh Address Book if not.
+ // If one or more contacts have been selected.
+ // - Disable New, Edit, Delete and Reveal contact as needed.
+
+ bool ContactSelected = FALSE;
+ long ItemIndex = -1;
+ int ContactCount = 0;
+
+ for (;;){
+
+ ItemIndex = ContactListCtrl->GetNextItem(ItemIndex,
+ wxLIST_NEXT_ALL,
+ wxLIST_STATE_SELECTED);
+
+ if (ItemIndex == -1){
+
+ break;
+
+ }
+
+ ContactSelected = TRUE;
+ break;
+
+ }
+
+ if (MenuType == XABCONTACTMENU_MAIN){
+
+ std::map<std::string, wxMenuItem*>::iterator MenuItemIter = MenuItems.find("refreshab");
+
+ if (EnableAccountSettings == FALSE){
+ MenuItemIter->second->Enable(FALSE);
+ MenuItemIter = MenuItems.find("newcontact");
+ MenuItemIter->second->Enable(FALSE);
+ }
+
+ MenuItemIter = MenuItems.find("opencontact");
+ MenuItemIter->second->Enable(ContactSelected);
+ MenuItemIter = MenuItems.find("editcontact");
+ MenuItemIter->second->Enable(ContactSelected);
+ MenuItemIter = MenuItems.find("deletecontact");
+ MenuItemIter->second->Enable(ContactSelected);
+
+ } else if (MenuType == XABCONTACTMENU_SEARCH){
+
+ std::map<std::string, wxMenuItem*>::iterator MenuItemIter = MenuItems.find("opencontact");
+ MenuItemIter->second->Enable(ContactSelected);
+ MenuItemIter = MenuItems.find("editcontact");
+ MenuItemIter->second->Enable(ContactSelected);
+ MenuItemIter = MenuItems.find("revealcontact");
+ MenuItemIter->second->Enable(ContactSelected);
+
+ }
+
+ return this;
+
+}
+
+void XABContactMenu::ProcessMenuItemClick( wxCommandEvent& event){
+
+ int ItemID = event.GetId();
+
+ if (MenuType == XABCONTACTMENU_MAIN){
+
+ switch (ItemID){
+
+ case ID_CONTACTMENU_OPEN:
+ {
+ wxCommandEvent rcevent(CE_OPENCONTACTLIST);
+ wxPostEvent(WindowPtr, rcevent);
+ }
+ break;
+ case ID_CONTACTMENU_NEW:
+ {
+ wxCommandEvent rcevent(CE_NEWCONTACT);
+ wxPostEvent(WindowPtr, rcevent);
+ }
+ break;
+ case ID_CONTACTMENU_EDIT:
+ {
+ wxCommandEvent rcevent(CE_EDITCONTACT);
+ wxPostEvent(WindowPtr, rcevent);
+ }
+ break;
+ case ID_CONTACTMENU_DELETE:
+ {
+ wxCommandEvent rcevent(CE_DELETECONTACT);
+ wxPostEvent(WindowPtr, rcevent);
+ }
+ break;
+ case ID_CONTACTMENU_REFRESHAB:
+ {
+ wxCommandEvent rcevent(REFRESHADDRESSBOOK);
+ wxPostEvent(WindowPtr, rcevent);
+ }
+ break;
+
+ }
+
+ } else if (MenuType == XABCONTACTMENU_SEARCH){
+
+ switch (ItemID){
+
+ case ID_CONTACTMENU_OPEN:
+ {
+ wxCommandEvent rcevent(SE_OPENCONTACT);
+ wxPostEvent(WindowPtr, rcevent);
+ }
+ break;
+ case ID_CONTACTMENU_EDIT:
+ {
+ wxCommandEvent rcevent(SE_EDITCONTACT);
+ wxPostEvent(WindowPtr, rcevent);
+ }
+ break;
+ case ID_CONTACTMENU_REVEAL:
+ {
+ wxCommandEvent rcevent(SE_REVEALCONTACT);
+ wxPostEvent(WindowPtr, rcevent);
+ }
+ break;
+
+ }
+
+ }
+
+}
\ No newline at end of file
--- /dev/null
+#ifndef __WIDGETS_XABCONTACTMENU__
+#define __WIDGETS_XABCONTACTMENU__
+
+#include <map>
+#include <string>
+#include <wx/wx.h>
+#include <wx/listctrl.h>
+#include <wx/app.h>
+
+enum {
+ XABCONTACTMENU_MAIN,
+ XABCONTACTMENU_SEARCH
+};
+
+class XABContactMenuADT : public wxMenu
+{
+
+ private:
+
+ protected:
+ virtual void ProcessMenuItemClick(wxCommandEvent& event) {event.Skip();};
+ public:
+ XABContactMenuADT(){};
+ ~XABContactMenuADT(){};
+
+};
+
+class XABContactMenu : public XABContactMenuADT
+{
+ private:
+ std::map<std::string, wxMenuItem*> MenuItems = {};
+ int MenuType = XABCONTACTMENU_MAIN;
+ wxListCtrl *ContactListCtrl = NULL;
+ wxWindow *WindowPtr = NULL;
+ bool EnableAccountSettings = FALSE;
+ void AppendMenuItem(wxString ObjectName,
+ wxString MenuName,
+ wxString MenuDescription,
+ int ItemID,
+ wxItemKind ItemType);
+ protected:
+ void ProcessMenuItemClick(wxCommandEvent& event);
+ public:
+ XABContactMenu(int MenuType);
+ ~XABContactMenu();
+ void SetupPointers(wxWindow* WindowPtrIn,
+ wxListCtrl* ContactListCtrlIn);
+ void SetupPointers(wxWindow* WindowPtrIn,
+ wxListCtrl* ContactListCtrlIn,
+ bool EnableAccountSettingsIn);
+ wxMenu* MenuPointer();
+
+};
+
+#endif
\ No newline at end of file