libAlgAudio  v1.99-440-g08538e5-dirty
The development library for AlgAudio framework.
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
AlgAudio::MainWindow Class Reference

#include <MainWindow.hpp>

Inheritance diagram for AlgAudio::MainWindow:
AlgAudio::Window AlgAudio::SubscriptionsManager AlgAudio::IAlertable

Public Types

enum  SaveAlertReply { SaveAlertReply::Cancel, SaveAlertReply::Discard, SaveAlertReply::Save }
 

Public Member Functions

void AskToSaveBeforeCalling (std::function< void()> f)
 
void New ()
 
void Open ()
 
void ProcessCloseEvent () override
 
void ProcessKeyboardEvent (KeyData data) override
 
LateReturn< SaveAlertReplyShowDoYouWantToSaveAlert ()
 
LateReturn ShowErrorAlert (std::string message, std::string button_text) override
 
LateReturn< int > ShowSimpleAlert (std::string message, std::string button1_text, std::string button2_text, AlertType type=AlertType::NONE, Color button1_color=Theme::Get("bg-button-neutral"), Color button2_color=Theme::Get("bg-button-neutral")) override
 
bool SaveAs ()
 
bool Save ()
 
bool Save (std::string path)
 
- Public Member Functions inherited from AlgAudio::Window
template<class W , typename... Args>
std::shared_ptr< W > Create (Args...args)
 
unsigned int GetID () const
 
SDL_Renderer * GetRenderer () const
 
std::shared_ptr< UIWidgetGetRoot () const
 
Size2D GetSize () const
 
SDL_Window * GetWindow () const
 
void Insert (std::shared_ptr< UIWidget > child)
 
Windowoperator= (const Window &)=delete
 
void ProcessEnterEvent ()
 
void ProcessLeaveEvent ()
 
void ProcessMotionEvent (Point2D)
 
void ProcessMouseButtonEvent (bool down, MouseButton button, Point2D)
 
void ProcessResizeEvent ()
 
void ProcessWheelEvent (MouseButton button)
 
void Render ()
 
void SetNeedsRedrawing ()
 
 Window (const Window &)=delete
 
 ~Window ()
 

Static Public Member Functions

static std::shared_ptr
< MainWindow
Create ()
 
- Static Public Member Functions inherited from AlgAudio::Window
static std::shared_ptr< WindowCreate (std::string title="AlgAudio", int w=350, int h=300, bool centered=true, bool resizable=true)
 

Additional Inherited Members

- Public Attributes inherited from AlgAudio::Window
Signal on_close
 
- Public Attributes inherited from AlgAudio::SubscriptionsManager
SubscriptionList subscriptions
 
- Protected Member Functions inherited from AlgAudio::Window
 Window (std::string title, int w, int h, bool centered=true, bool resizable=true)
 

Member Enumeration Documentation

Enumerator
Cancel 
Discard 
Save 

Member Function Documentation

void AlgAudio::MainWindow::AskToSaveBeforeCalling ( std::function< void()>  f)

This helper method asks the user to save the file, potentially saves it, and afterwards invokes a function.

static std::shared_ptr<MainWindow> AlgAudio::MainWindow::Create ( )
static
void AlgAudio::MainWindow::New ( )

Asks the user to save their work, and clears the canvas.

void AlgAudio::MainWindow::Open ( )

Displays the open dialog and loads the selected file, if any.

void AlgAudio::MainWindow::ProcessCloseEvent ( )
overridevirtual

Reimplemented from AlgAudio::Window.

void AlgAudio::MainWindow::ProcessKeyboardEvent ( KeyData  data)
overridevirtual

Reimplemented from AlgAudio::Window.

bool AlgAudio::MainWindow::Save ( )

Returns true on a successful save.

bool AlgAudio::MainWindow::Save ( std::string  path)

Returns true on a successful save.

bool AlgAudio::MainWindow::SaveAs ( )

Returns true on a successful save.

LateReturn<SaveAlertReply> AlgAudio::MainWindow::ShowDoYouWantToSaveAlert ( )
LateReturn AlgAudio::MainWindow::ShowErrorAlert ( std::string  message,
std::string  button_text 
)
overridevirtual

Reimplemented from AlgAudio::Window.

LateReturn<int> AlgAudio::MainWindow::ShowSimpleAlert ( std::string  message,
std::string  button1_text,
std::string  button2_text,
AlertType  type = AlertType::NONE,
Color  button1_color = Theme::Get("bg-button-neutral"),
Color  button2_color = Theme::Get("bg-button-neutral") 
)
overridevirtual

Returns 0 if the first button was clicked, 1, if the second.

Reimplemented from AlgAudio::Window.


The documentation for this class was generated from the following file: