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:
committed by
Paul Licameli
parent
c3f5fea5fc
commit
1a317af2f5
@@ -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 {};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user