working, unfinished edit

This commit is contained in:
Cheng 2022-05-07 14:40:17 +10:00
parent 2133f51ffe
commit bb8b3773c9
No known key found for this signature in database
GPG Key ID: D51301E176B31828
3 changed files with 22 additions and 6 deletions

View File

@ -3,7 +3,8 @@ using ro::base58;
display_wallet::display_wallet(wxWindow* parent, wxFileName& walletfile) :
wxPanel(parent, myID_WALLET_UI, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL, _T("Wallet")),
m_db(nullptr),
m_menuitem_close(this, &display_wallet::close_menu_event_handler)
m_menuitem_close(this, &display_wallet::close_menu_event_handler),
m_menuitem_add_name(this, &display_wallet::add_name_event_handler)
{
wxLogMessage(_T("Loading %s"), walletfile.GetFullPath());
if (!walletfile.IsOk() || !walletfile.HasName() || !walletfile.HasExt()) throw MyException("unexpected file name");
@ -61,17 +62,31 @@ display_wallet::display_wallet(wxWindow* parent, wxFileName& walletfile) :
singletonFrame->m_LastUsedSqlite.Assign(walletfile);
wxMenu* menuFile{ singletonFrame->GetMenuBar()->GetMenu(0) };
m_menuitem_close.Insert(menuFile, 1, "close", "test");
m_menuitem_close.Insert(menuFile, 1, "close", "close wallet");
singletonFrame->GetMenuBar()->EnableTop(1, true); //enable edit menu.
wxMenu* menuEdit{ singletonFrame->GetMenuBar()->GetMenu(1) };
m_menuitem_add_name.Insert(menuEdit, 0, "add name", "create new Zooko identity");
}
display_wallet::~display_wallet() {
assert(true);
singletonFrame->GetMenuBar()->EnableTop(1, false); //disable edit menu.
}
void display_wallet::close_menu_event_handler(wxCommandEvent& event) {
wxMessageDialog dlg(this, event.GetString(), wsz_error, wxICON_ERROR);
Close(true);
}
void display_wallet::add_name_event_handler(wxCommandEvent& event) {
wxMessageDialog dlg(this, "not yet implemented", wsz_error, wxICON_ERROR);
dlg.SetId(myID_ERRORMESSAGE);
dlg.ShowModal();
}
void display_wallet::OnClose(wxCloseEvent& event) {
// This event gives you the opportunity to clean up anything that needs explicit cleanup, albeit if you have done your work right nothing should need explicit cleanup,
// and to object to the closing in a "file not saved" type situation.

View File

@ -11,7 +11,8 @@ private:
wxBoxSizer* m_lSizer;
wxBoxSizer* m_rSizer;
void close_menu_event_handler(wxCommandEvent&);
// MenuLink m_close(display_wallet::close);
void add_name_event_handler(wxCommandEvent&);
MenuLink m_menuitem_close;
MenuLink m_menuitem_add_name;
void OnClose(wxCloseEvent& event);
};

View File

@ -144,11 +144,11 @@ try {
menuHelp->Bind(wxEVT_MENU, &Frame::OnAbout, this, wxID_ABOUT);
wxMenuBar* menuBar = new wxMenuBar;
menuBar->Append(menuFile, menu_strings[0].head);
menuBar->Append(new wxMenu, menu_strings[1].head);
menuBar->Append(new wxMenu, menu_strings[1].head); //Edit menu, initially empty and disabled
menuBar->Append(menuHelp, menu_strings[2].head);
SetMenuBar(menuBar);
CreateStatusBar();
menuBar->EnableTop(1, false);
menuBar->EnableTop(1, false); //disable edit menu.
// child controls
m_LastUsedSqlite.Assign(singletonApp->pConfig->Read(_T("/Wallet/LastUsed"), _T("")));
if (!m_LastUsedSqlite.IsOk() || !m_LastUsedSqlite.HasName() || !m_LastUsedSqlite.HasExt()) {