Handle events from the application/window and actions from the user of your application by deriving an an object from ApplicationHandlerInterface.
More...
#include <tb_application_handler_interface.hpp>
The RealtimeApplication takes an ApplicationHandlerInterface object that will handle window events and changes including actions the user of your application takes with menus and dialogs. This is similar to the AppDelegate object in Cocoa or WndProc function in Win32.
- Warning
- Most classes in the Application area are up for a complete redesign of the public facing interface.
◆ ~ApplicationHandlerInterface()
| virtual TurtleBrains::Application::ApplicationHandlerInterface::~ApplicationHandlerInterface |
( |
void |
| ) |
|
|
pure virtual |
◆ CanWindowResize()
| virtual bool TurtleBrains::Application::ApplicationHandlerInterface::CanWindowResize |
( |
void |
| ) |
const |
|
virtual |
Should return true if the application will let the user resize the window and false if the window size should not be changed. Default implementation returns true.
- Note
- Unless there are very specific needs to keeping the window size constrained, this should always return true. Consider that some Linux window managers suck and force the window to specific sizes that don't match desired.
◆ CollectWindowProperties()
| virtual void TurtleBrains::Application::ApplicationHandlerInterface::CollectWindowProperties |
( |
WindowProperties & |
windowProperties | ) |
|
|
virtual |
Invoked to retrieve the size, and properties of the Real-time OpenGL window during the creation of the window.
- Parameters
-
| windowProperties | A reference to the properties of the window, filled out by you. The default settings are initialized beforehand, so if you want a default sized window, there is no need to do anything! |
◆ OnBecomeActive()
| virtual void TurtleBrains::Application::ApplicationHandlerInterface::OnBecomeActive |
( |
void |
| ) |
|
|
virtual |
Invoked each time the window gains or regains focus.
◆ OnBecomeInactive()
| virtual void TurtleBrains::Application::ApplicationHandlerInterface::OnBecomeInactive |
( |
void |
| ) |
|
|
virtual |
Invoked each time the window loses focus to another application.
◆ OnCreateGraphicsContext()
| virtual void TurtleBrains::Application::ApplicationHandlerInterface::OnCreateGraphicsContext |
( |
void |
| ) |
|
|
virtual |
- Note
- the name may change, not finalized.
◆ OnDestroyGraphicsContext()
| virtual void TurtleBrains::Application::ApplicationHandlerInterface::OnDestroyGraphicsContext |
( |
void |
| ) |
|
|
virtual |
- Note
- the name may change, not finalized.
◆ OnDialogAction()
◆ OnDroppedFiles()
| virtual void TurtleBrains::Application::ApplicationHandlerInterface::OnDroppedFiles |
( |
const std::vector< String > & |
droppedFiles | ) |
|
|
virtual |
This is invoked when the user drops a file, or files, onto the main application window, the default implementation does nothing.
- Parameters
-
| droppedFiles | A container holding 1-n files that were dropped onto the application window. |
- Note
- This is Windows specific as of 2022-06-14.
◆ OnMenuAction()
Invoked each time the user clicks a menu item from a Window Menu or Context menu.
- Parameters
-
| menu | The identifier of the menu object that was interacted with to be distinguished between one menu and the next within your application. |
| menuItem | The menu item that was clicked by the user for the given menu. |
◆ OnRealtimeUpdate()
| virtual void TurtleBrains::Application::ApplicationHandlerInterface::OnRealtimeUpdate |
( |
void |
| ) |
|
|
virtual |
Invoked once for each frame of a real-time application. This is invoked very often and generally as quickly as possible.
◆ OnWindowClose()
| virtual void TurtleBrains::Application::ApplicationHandlerInterface::OnWindowClose |
( |
void |
| ) |
|
|
virtual |
Invoked only once just before the window is destroyed, there is no way to cancel the window from closing once this is called.
◆ OnWindowOpen()
| virtual void TurtleBrains::Application::ApplicationHandlerInterface::OnWindowOpen |
( |
void |
| ) |
|
|
virtual |
Invoked only once while the window is being created, just before it is shown so that a window menu, status bar, or other portions can be setup and added to the window.
◆ OnWindowRequestClose()
| virtual bool TurtleBrains::Application::ApplicationHandlerInterface::OnWindowRequestClose |
( |
void |
| ) |
|
|
virtual |
This is invoked as soon as the user pressed 'X' to close the window, or any other type of terminate/close/quit event. Return true to proceed with the close, or false to continue normal running without trying to close immediate (the default behavior).
- Note
- This was added to allow the GameApplication to perform a normal shutdown process that invoked OnClose() on the current scene before closing. The GameApplication handler will return false to this and then proceed it's normal shutdown.
◆ OnWindowResize()
| virtual void TurtleBrains::Application::ApplicationHandlerInterface::OnWindowResize |
( |
tbCore::uint16 & |
windowWidth, |
|
|
tbCore::uint16 & |
windowHeight |
|
) |
| |
|
virtual |
Invoked when the window size is changing, particularly when the user is dragging the frame.
◆ SetApplication()
| virtual void TurtleBrains::Application::ApplicationHandlerInterface::SetApplication |
( |
RealtimeApplication * |
application | ) |
|
|
virtual |
- Note
- This will be called with a nullptr when the application handler is being detached from application.