3#include "../commands/CommandManager.h"
9#if defined(__WXMAC__) && !wxCHECK_VERSION(3,1,3)
11#include "../CommonCommandFlags.h"
13#include "../Project.h"
14#include "../commands/CommandContext.h"
22#include <AppKit/AppKit.h>
23#include <wx/osx/private.h>
26#include <AppKit/NSApplication.h>
29#include <CoreFoundation/CoreFoundation.h>
40 auto peer = window->GetPeer();
42 auto widget =
static_cast<wxWidgetCocoaImpl*
>(peer)->GetWXWidget();
43 auto nsWindow = [widget window];
45 [nsWindow performMiniaturize:widget];
48 window->Iconize(
true);
57std::vector< std::weak_ptr< AudacityProject > >
sProjects;
72 size_t index,
const std::shared_ptr< AudacityProject > &pProject )
76 wxTheApp->Bind( EVT_PROJECT_ACTIVATION,
RebuildMenu );
77 wxTheApp->Bind( EVT_PROJECT_TITLE_CHANGE,
RebuildMenu );
93 iter = std::find(
begin,
end, evt.GetId() );
94 size_t index = iter -
begin;
96 auto pProject =
sProjects[ index ].lock();
102 wxFrame *frame = pProject->GetFrame();
103 if (frame->IsIconized())
132 auto topWindow =
static_cast<wxTopLevelWindow*
>(window);
133 auto maximized = topWindow->IsMaximized();
137 auto peer = window->GetPeer();
139 auto widget =
static_cast<wxWidgetCocoaImpl*
>(peer)->GetWXWidget();
140 auto nsWindow = [widget window];
142 [nsWindow performZoom:widget];
144 topWindow->Maximize(!maximized);
177#define FN(X) (& WindowActions::Handler :: X)
203 Command(
wxT(
"MacBringAllToFront"),
XXO(
"&Bring All to Front"),
213 wxTheApp->Unbind( wxEVT_MENU,
OnWindow,
id );
220 wxString itemName = project->GetFrame()->GetTitle();
224 if (itemName.empty())
226 itemName =
_(
"<untitled>");
230 wxMenuItem *item = theMenu.Append(itemId, itemName);
231 item->SetCheckable(
true);
232 item->Check(isActive);
235 wxTheApp->Bind( wxEVT_MENU,
OnWindow, itemId );
255 Command(
wxT(
"MacMinimizeAll"),
XXO(
"Minimize All Projects"),
256 FN(OnMacMinimizeAll),
263 Placement{
wxT(
"Optional/Extra/Part2/Misc"), OrderingHint::End },
AUDACITY_DLL_API std::weak_ptr< AudacityProject > GetActiveProject()
void SetActiveProject(AudacityProject *project)
constexpr CommandFlag AlwaysEnabledFlag
wxEvtHandler CommandHandlerObject
const ReservedCommandFlag & NotMinimizedFlag()
AUDACITY_DLL_API wxFrame & GetProjectFrame(AudacityProject &project)
Get the top-level window associated with the project (as a wxFrame only, when you do not need to use ...
for(int ii=0, nn=names.size();ii< nn;++ii)
The top-level handle to an Audacity project. It serves as a source of events that other objects can b...
CommandContext provides additional information to an 'Apply()' command. It provides the project,...
AudacityProject & project
auto end(const Ptr< Type, BaseDeleter > &p)
Enables range-for.
auto begin(const Ptr< Type, BaseDeleter > &p)
Enables range-for.
std::shared_ptr< BaseItem > BaseItemSharedPtr
Namespace for functions for window management (mac only?)
void OnMacZoom(const CommandContext &context)
void OnMacBringAllToFront(const CommandContext &)
void OnMacMinimize(const CommandContext &context)
void OnMacMinimizeAll(const CommandContext &)