30#include <wx/filedlg.h>
38 MODEL_FILE_PREVIEW_REQUEST_SERVICE* service;
42thread_local PICKER_CONTEXT* currentContext =
nullptr;
50wxWindow* createExtraControl( wxWindow* aParent )
58 currentContext->service->MakeCancel(), currentContext->embedFile );
69 explicit CONTEXT_SCOPE( PICKER_CONTEXT* aContext ) { currentContext = aContext; }
71 ~CONTEXT_SCOPE() { currentContext =
nullptr; }
73 CONTEXT_SCOPE(
const CONTEXT_SCOPE& ) =
delete;
74 CONTEXT_SCOPE& operator=(
const CONTEXT_SCOPE& ) =
delete;
82 wxASSERT_MSG( wxIsMainThread(), wxS(
"model picker must run on the UI thread" ) );
86 wxFAIL_MSG( wxS(
"nested model pickers are unsupported" ) );
93 const long style = ( aOptions.
style & ~( wxFD_MULTIPLE | wxFD_SAVE ) ) | wxFD_OPEN | wxFD_FILE_MUST_EXIST;
94 wxASSERT_MSG( !( aOptions.
style & ( wxFD_MULTIPLE | wxFD_SAVE ) ),
95 wxS(
"model picker supports single-file open only" ) );
101 PICKER_CONTEXT context{ requestService, aOptions.
embedFile };
102 CONTEXT_SCOPE contextScope( &context );
104 if( !dialog.SetExtraControlCreator( &createExtraControl ) )
107 const int modalResult = dialog.ShowModal();
112 if( modalResult == wxID_OK )
114 result.path = dialog.GetPath();
115 result.filterIndex = dialog.GetFilterIndex();
119 result.embedFile = panel->GetEmbedFile();
126void ShutdownNativeModelFilePickerGtk()
128 wxASSERT_MSG( wxIsMainThread(), wxS(
"model picker shutdown must run on the UI thread" ) );
133 delete requestService;
134 requestService =
nullptr;
const wxChar *const traceModelPreview
Flag to enable native operating-system model preview debug output.
wxString result
Test unit parsing edge cases and error handling.
wxLogTrace helper definitions.