Add a popup menu to the MDI sample.

This is just to test how wxEVT_MENU_HIGHLIGHT events from popup menu items are
handled under the different platforms.

Also log menu events to the canvas window too as it now gets some.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@78226 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
2014-12-05 22:17:38 +00:00
parent 5ef2ab09c6
commit 1c6bb3f5b8
2 changed files with 47 additions and 22 deletions

View File

@@ -17,26 +17,6 @@ public:
virtual bool OnInit() wxOVERRIDE;
};
class MyCanvas : public wxScrolledWindow
{
public:
MyCanvas(wxWindow *parent, const wxPoint& pos, const wxSize& size);
virtual void OnDraw(wxDC& dc) wxOVERRIDE;
bool IsDirty() const { return m_dirty; }
void SetText(const wxString& text) { m_text = text; Refresh(); }
private:
void OnEvent(wxMouseEvent& event);
wxString m_text;
bool m_dirty;
wxDECLARE_EVENT_TABLE();
};
// Helper class logging menu open/close events.
class MenuEventLogger
{
@@ -77,6 +57,32 @@ protected:
wxDECLARE_NO_COPY_CLASS(MenuEventLogger);
};
class MyCanvas : public wxScrolledWindow,
private MenuEventLogger
{
public:
MyCanvas(wxFrame *parent, const wxPoint& pos, const wxSize& size);
virtual void OnDraw(wxDC& dc) wxOVERRIDE;
bool IsDirty() const { return m_dirty; }
void SetText(const wxString& text) { m_text = text; Refresh(); }
private:
void OnMenuOpen(wxMenuEvent& event) { LogMenuOpenClose(event, "opened"); }
void OnMenuHighlight(wxMenuEvent& event) { LogMenuHighlight(event); }
void OnMenuClose(wxMenuEvent& event) { LogMenuOpenClose(event, "closed"); }
void OnMenu(wxContextMenuEvent& event);
void OnEvent(wxMouseEvent& event);
wxString m_text;
bool m_dirty;
wxDECLARE_EVENT_TABLE();
};
// Define a new frame
class MyFrame : public wxMDIParentFrame,
private MenuEventLogger