1
0
mirror of https://github.com/cookiengineer/audacity synced 2025-12-22 08:31:14 +01:00

Move code for handling the menu button out of TrackPanel, but...

... Still to do, move out the code for menu items.  They remain accessible
from Shift-M but not from the menu button.

And ESC key is now implemented.
This commit is contained in:
Paul Licameli
2015-07-30 14:57:13 -04:00
committed by Paul Licameli
parent c3f5fea5fc
commit 1a317af2f5
14 changed files with 309 additions and 62 deletions

View File

@@ -8,6 +8,7 @@ Paul Licameli split from TrackPanel.cpp
**********************************************************************/
#include "../../Audacity.h"
#include "TrackButtonHandles.h"
#include "../../HitTestResult.h"
@@ -124,3 +125,44 @@ HitTestResult CloseButtonHandle::HitTest
else
return {};
}
////////////////////////////////////////////////////////////////////////////////
MenuButtonHandle::MenuButtonHandle()
: ButtonHandle{ TrackPanel::IsPopping }
{
}
MenuButtonHandle::~MenuButtonHandle()
{
}
MenuButtonHandle &MenuButtonHandle::Instance()
{
static MenuButtonHandle instance;
return instance;
}
UIHandle::Result MenuButtonHandle::CommitChanges
(const wxMouseEvent &, AudacityProject *, wxWindow *pParent)
{
return mpCell->DoContextMenu(mRect, pParent, NULL);
}
HitTestResult MenuButtonHandle::HitTest
(const wxMouseEvent &event, const wxRect &rect, TrackPanelCell *pCell)
{
wxRect buttonRect;
TrackInfo::GetTitleBarRect(rect, buttonRect);
if (buttonRect.Contains(event.m_x, event.m_y)) {
Instance().mpCell = pCell;
Instance().mRect = buttonRect;
return {
HitPreview(),
&Instance()
};
}
else
return {};
}