Added Pop-up menus.
Hunted down bug in dnd Changed widget, that wxWin connects to in certain case (in controls, where m_widget is not the connect widget, such as list control and text control) Compile fixes all over git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@486 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -82,7 +82,8 @@ public:
|
||||
void OnHelp (wxCommandEvent& event);
|
||||
void OnLogClear(wxCommandEvent& event);
|
||||
|
||||
void OnMouseBtnDown(wxMouseEvent& event);
|
||||
void OnLeftDown(wxMouseEvent& event);
|
||||
void OnRightDown(wxMouseEvent& event);
|
||||
|
||||
bool OnClose();
|
||||
|
||||
@@ -116,10 +117,8 @@ BEGIN_EVENT_TABLE(DnDFrame, wxFrame)
|
||||
EVT_MENU(Menu_Drag, DnDFrame::OnDrag)
|
||||
EVT_MENU(Menu_Help, DnDFrame::OnHelp)
|
||||
EVT_MENU(Menu_Clear, DnDFrame::OnLogClear)
|
||||
|
||||
EVT_LEFT_DOWN(OnMouseBtnDown)
|
||||
EVT_RIGHT_DOWN(OnMouseBtnDown)
|
||||
EVT_MIDDLE_DOWN(OnMouseBtnDown)
|
||||
EVT_LEFT_DOWN(OnLeftDown)
|
||||
EVT_RIGHT_DOWN(OnRightDown)
|
||||
END_EVENT_TABLE()
|
||||
|
||||
// `Main program' equivalent, creating windows and returning main app frame
|
||||
@@ -291,10 +290,11 @@ bool DnDFrame::OnClose()
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
void DnDFrame::OnMouseBtnDown(wxMouseEvent& /* event */ )
|
||||
void DnDFrame::OnLeftDown(wxMouseEvent &WXUNUSED(event) )
|
||||
{
|
||||
if ( !m_strText.IsEmpty() ) {
|
||||
// start drag operation
|
||||
|
||||
wxTextDataObject data(m_strText);
|
||||
wxDropSource dragSource(data, this);
|
||||
const char *pc;
|
||||
@@ -312,6 +312,17 @@ void DnDFrame::OnMouseBtnDown(wxMouseEvent& /* event */ )
|
||||
}
|
||||
}
|
||||
|
||||
void DnDFrame::OnRightDown(wxMouseEvent &event )
|
||||
{
|
||||
wxMenu *menu = new wxMenu;
|
||||
|
||||
menu->Append(Menu_Drag, "&Test drag...");
|
||||
menu->Append(Menu_About, "&About");
|
||||
menu->Append(Menu_Quit, "E&xit");
|
||||
|
||||
PopupMenu( menu, event.GetX(), event.GetY() );
|
||||
}
|
||||
|
||||
DnDFrame::~DnDFrame()
|
||||
{
|
||||
if ( m_pLog != NULL ) {
|
||||
|
Reference in New Issue
Block a user