X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/b0401bea7830839decc8d8660896a0dfb23e8d51..81f5836b8953c11551767e7bf16467824432c0a3:/samples/listctrl/listtest.h?ds=sidebyside diff --git a/samples/listctrl/listtest.h b/samples/listctrl/listtest.h index 90359d0030..600eaf4b1a 100644 --- a/samples/listctrl/listtest.h +++ b/samples/listctrl/listtest.h @@ -9,6 +9,14 @@ // Licence: wxWindows license ///////////////////////////////////////////////////////////////////////////// +// not all ports have support for EVT_CONTEXT_MENU yet, don't define +// USE_CONTEXT_MENU for those which don't +#if defined(__WXMOTIF__) || defined(__WXPM__) || defined(__WXX11__) || defined(__WXMGL__) + #define USE_CONTEXT_MENU 0 +#else + #define USE_CONTEXT_MENU 1 +#endif + // Define a new application type class MyApp: public wxApp { @@ -32,6 +40,9 @@ public: : wxListCtrl(parent, id, pos, size, style), m_attr(*wxBLUE, *wxLIGHT_GREY, wxNullFont) { +#ifdef __POCKETPC__ + EnableContextMenu(); +#endif } // add one item to the listctrl in report mode @@ -61,14 +72,22 @@ public: void OnChar(wxKeyEvent& event); +#if USE_CONTEXT_MENU + void OnContextMenu(wxContextMenuEvent& event); +#endif + + void OnRightClick(wxMouseEvent& event); + private: + void ShowContextMenu(const wxPoint& pos); + wxLog *m_logOld; void SetColumnImage(int col, int image); void LogEvent(const wxListEvent& event, const wxChar *eventName); void LogColEvent(const wxListEvent& event, const wxChar *eventName); virtual wxString OnGetItemText(long item, long column) const; - virtual int OnGetItemImage(long item) const; + virtual int OnGetItemColumnImage(long item, long column) const; virtual wxListItemAttr *OnGetItemAttr(long item) const; wxListItemAttr m_attr; @@ -81,7 +100,7 @@ private: class MyFrame: public wxFrame { public: - MyFrame(const wxChar *title, int x, int y, int w, int h); + MyFrame(const wxChar *title); virtual ~MyFrame(); void DoSize(); @@ -187,4 +206,3 @@ enum LIST_CTRL = 1000 }; -