Audacity 3.2.0
Classes | Namespaces | Functions
BasicUI.h File Reference

Toolkit-neutral facade for basic user interface services. More...

#include <functional>
#include <memory>
#include "Identifier.h"
#include "Internat.h"
Include dependency graph for BasicUI.h:

Go to the source code of this file.

Classes

class  BasicUI::WindowPlacement
 Subclasses may hold information such as a parent window pointer for a dialog. More...
 
struct  BasicUI::ErrorDialogOptions
 Options for variations of error dialogs; the default is for modal dialogs. More...
 
struct  BasicUI::MessageBoxOptions
 
class  BasicUI::ProgressDialog
 Abstraction of a progress dialog with well defined time-to-completion estimate. More...
 
class  BasicUI::GenericProgressDialog
 Abstraction of a progress dialog with undefined time-to-completion estimate. More...
 
class  BasicUI::Services
 Abstract class defines a few user interface services, not mentioning particular toolkits. More...
 

Namespaces

namespace  BasicUI
 

Functions

Services * BasicUI::Get ()
 Fetch the global instance, or nullptr if none is yet installed. More...
 
Services * BasicUI::Install (Services *pInstance)
 Install an implementation; return the previously installed instance. More...
 

Functions that invoke global Services

These dispatch to the global Services, if supplied. If none was supplied, they are mostly no-ops, with exceptions as noted. All should be called on the main thread only, except as noted.

#define ASSERT_MAIN_THREAD()
 
void BasicUI::CallAfter (Action action)
 Schedule an action to be done later, and in the main thread. More...
 
void BasicUI::Yield ()
 Dispatch waiting events, including actions enqueued by CallAfter. More...
 
bool BasicUI::OpenInDefaultBrowser (const wxString &url)
 Open an URL in default browser. More...
 
void BasicUI::ShowErrorDialog (const WindowPlacement &placement, const TranslatableString &dlogTitle, const TranslatableString &message, const ManualPageID &helpPage, const ErrorDialogOptions &options={})
 Show an error dialog with a link to the manual for further help. More...
 
MessageBoxResult BasicUI::ShowMessageBox (const TranslatableString &message, MessageBoxOptions options={})
 Show a modal message box with either Ok or Yes and No, and optionally Cancel. More...
 
std::unique_ptr< ProgressDialogBasicUI::MakeProgress (const TranslatableString &title, const TranslatableString &message, unsigned flags=(ProgressShowStop|ProgressShowCancel), const TranslatableString &remainingLabelText={})
 Create and display a progress dialog. More...
 
std::unique_ptr< GenericProgressDialog > BasicUI::MakeGenericProgress (const WindowPlacement &placement, const TranslatableString &title, const TranslatableString &message)
 Create and display a progress dialog (return nullptr if Services not installed) More...
 
template<typename ItType , typename FnType >
void BasicUI::SplitProgress (ItType first, ItType last, FnType action, ProgressReporter parent)
 Helper for the update of a task's progress bar when this task is made of a range's subtasks. More...
 
int BasicUI::ShowMultiDialog (const TranslatableString &message, const TranslatableString &title, const TranslatableStrings &buttons, const ManualPageID &helpPage, const TranslatableString &boxMsg, bool log)
 Display a dialog with radio buttons. More...
 
std::unique_ptr< WindowPlacement > BasicUI::FindFocus ()
 Find the window that is accepting keyboard input, if any. More...
 
void BasicUI::SetFocus (const WindowPlacement &focus)
 Set the window that accepts keyboard input. More...
 
bool BasicUI::IsUsingRtlLayout ()
 Whether using a right-to-left language layout. More...
 
bool BasicUI::IsUiThread ()
 Whether the current thread is the UI thread. More...
 

Types used in the Services interface

enum class  BasicUI::ErrorDialogType { BasicUI::ModelessError , BasicUI::ModalError , BasicUI::ModalErrorReport }
 
enum class  BasicUI::Icon {
  BasicUI::None , BasicUI::Warning , BasicUI::Error , BasicUI::Question ,
  BasicUI::Information
}
 
enum class  BasicUI::Button { BasicUI::Default , BasicUI::Ok , BasicUI::YesNo }
 
enum class  BasicUI::MessageBoxResult : int {
  BasicUI::None , BasicUI::Yes , BasicUI::No , BasicUI::Ok ,
  BasicUI::Cancel
}
 
enum  BasicUI::ProgressDialogOptions : unsigned { BasicUI::ProgressShowStop = (1 << 0) , BasicUI::ProgressShowCancel = (1 << 1) , BasicUI::ProgressHideTime = (1 << 2) , BasicUI::ProgressConfirmStopOrCancel = (1 << 3) }
 
enum class  BasicUI::ProgressResult : unsigned { BasicUI::Cancelled = 0 , BasicUI::Success , BasicUI::Failed , BasicUI::Stopped }
 
using BasicUI::Action = std::function< void()>
 
using BasicUI::ProgressReporter = std::function< void(double)>
 
TranslatableString BasicUI::DefaultCaption ()
 "Message", suitably translated More...
 

Detailed Description

Toolkit-neutral facade for basic user interface services.


Audacity: A Digital Audio Editor

Paul Licameli

Definition in file BasicUI.h.

Macro Definition Documentation

◆ ASSERT_MAIN_THREAD

#define ASSERT_MAIN_THREAD ( )
Value:
assert( \
"This function should only be called on the main thread")
bool IsUiThread()
Whether the current thread is the UI thread.
Definition: BasicUI.h:399

Definition at line 406 of file BasicUI.h.