1
0
mirror of https://github.com/cookiengineer/audacity synced 2025-11-21 16:37:12 +01:00

ProjectWindowPlacement wraps project's frame, toolkit-neutrally

This commit is contained in:
Paul Licameli
2021-02-09 12:50:27 -05:00
parent 2facbe0d53
commit 3c2a6e7f6c
2 changed files with 17 additions and 1 deletions

View File

@@ -14,7 +14,8 @@
#include "KeyboardCapture.h"
#include "TempDirectory.h"
#include "./widgets/ErrorDialog.h"
#include "widgets/ErrorDialog.h"
#include "widgets/wxWidgetsBasicUI.h"
#include <wx/display.h>
#include <wx/filename.h>
@@ -199,6 +200,15 @@ AUDACITY_DLL_API const wxFrame &GetProjectFrame( const AudacityProject &project
return *ptr;
}
std::unique_ptr<const BasicUI::WindowPlacement>
ProjectFramePlacement( AudacityProject *project )
{
if (!project)
return std::make_unique<BasicUI::WindowPlacement>();
return std::make_unique<wxWidgetsWindowPlacement>(
&GetProjectFrame(*project));
}
AUDACITY_DLL_API wxWindow &GetProjectPanel( AudacityProject &project )
{
auto ptr = project.GetPanel();

View File

@@ -22,6 +22,7 @@
class wxFrame;
class wxWindow;
namespace BasicUI { class WindowPlacement; }
class AudacityProject;
@@ -176,6 +177,11 @@ inline const wxFrame *FindProjectFrame( const AudacityProject *project ) {
return project ? &GetProjectFrame( *project ) : nullptr;
}
//! Make a WindowPlacement object suitable for `project` (which may be null)
/*! @post return value is not null */
AUDACITY_DLL_API std::unique_ptr<const BasicUI::WindowPlacement>
ProjectFramePlacement( AudacityProject *project );
///\brief Get the main sub-window of the project frame that displays track data
// (as a wxWindow only, when you do not need to use the subclass TrackPanel)
AUDACITY_DLL_API wxWindow &GetProjectPanel( AudacityProject &project );