FlowArithmeticCalculator 1.0.0
Flow Arithmetic Calculator
Loading...
Searching...
No Matches
gui::window::WindowBase< Canvas > Class Template Referenceabstract

The abstract base class for implementing a window. More...

#include <WindowBase.h>

+ Inheritance diagram for gui::window::WindowBase< Canvas >:
+ Collaboration diagram for gui::window::WindowBase< Canvas >:

Public Member Functions

 WindowBase (int width, int height, std::shared_ptr< spdlog::logger > logger)
 
 ~WindowBase () override=default
 
 WindowBase (const WindowBase &)=delete
 
WindowBaseoperator= (const WindowBase &)=delete
 
 WindowBase (WindowBase &&) noexcept=default
 
WindowBaseoperator= (WindowBase &&) noexcept=default
 
virtual void run ()=0
 Runs the main window loop.
 
virtual bool shouldClose () const =0
 Whether the window should close.
 
void handleMouseDown ()
 Handles the mouse down event; should be called internally by the window implementation.
 
void handleMouseUp ()
 Handles the mouse up event; should be called internally by the window implementation.
 
void handleNumericKeyPress (int number)
 Handles the numeric key press event; should be called internally by the window implementation.
 
void handleEscapeKeyPress ()
 Handles the ESC key press event; should be called internally by the window implementation.
 
void handleRightClick ()
 Handles the right click event; should be called internally by the window implementation.
 
void handleMouseMove (int x, int y)
 Handles the mouse move event; should be called internally by the window implementation.
 
business_logic::geometry::Size2D getWindowSize () override
 Get the window size.
 
business_logic::geometry::Size2D getFramebufferSize () override
 Get the framebuffer size.
 
- Public Member Functions inherited from business_logic::delegate::IWindowDelegate
virtual ~IWindowDelegate ()=default
 
virtual void focusWindow ()=0
 Focus the window.
 
virtual void showWarning (const std::string &title, const std::string &message)=0
 Show a warning message.
 
virtual std::optional< FloatingPointpromptFloatingPointInput (const std::string &title, const std::string &message, const std::optional< FloatingPoint > &defaultValue)=0
 Prompt for a floating point input.
 
virtual bool promptConfirmation (const std::string &title, const std::string &message)=0
 Prompt for user confirmation.
 

Protected Attributes

std::shared_ptr< business_logic::BlocksManagerblocksManager
 
std::shared_ptr< spdlog::logger > logger
 
business_logic::geometry::Size2D winSize
 
business_logic::geometry::Size2D framebufferSize
 

Detailed Description

template<typename Canvas>
class gui::window::WindowBase< Canvas >

The abstract base class for implementing a window.

See also
business_logic::delegate::IWindowDelegate
Template Parameters
CanvasThe type of the canvas

Definition at line 27 of file WindowBase.h.

Constructor & Destructor Documentation

◆ WindowBase() [1/3]

template<typename Canvas >
gui::window::WindowBase< Canvas >::WindowBase ( int  width,
int  height,
std::shared_ptr< spdlog::logger >  logger 
)
inline

Definition at line 29 of file WindowBase.h.

◆ ~WindowBase()

template<typename Canvas >
gui::window::WindowBase< Canvas >::~WindowBase ( )
overridedefault

◆ WindowBase() [2/3]

template<typename Canvas >
gui::window::WindowBase< Canvas >::WindowBase ( const WindowBase< Canvas > &  )
delete

◆ WindowBase() [3/3]

template<typename Canvas >
gui::window::WindowBase< Canvas >::WindowBase ( WindowBase< Canvas > &&  )
defaultnoexcept

Member Function Documentation

◆ getFramebufferSize()

template<typename Canvas >
business_logic::geometry::Size2D gui::window::WindowBase< Canvas >::getFramebufferSize ( )
inlineoverridevirtual

Get the framebuffer size.

Returns
The framebuffer size

Implements business_logic::delegate::IWindowDelegate.

Definition at line 141 of file WindowBase.h.

References gui::window::WindowBase< Canvas >::framebufferSize.

Referenced by gui::renderer::SkiaRendererImpl::reinitializeSurface().

+ Here is the caller graph for this function:

◆ getWindowSize()

template<typename Canvas >
business_logic::geometry::Size2D gui::window::WindowBase< Canvas >::getWindowSize ( )
inlineoverridevirtual

Get the window size.

Returns
The window size

Implements business_logic::delegate::IWindowDelegate.

Definition at line 136 of file WindowBase.h.

References gui::window::WindowBase< Canvas >::winSize.

Referenced by gui::renderer::SkiaRendererImpl::handleWindowResized(), gui::renderer::SkiaRendererImpl::reinitializeSurface(), and gui::renderer::SkiaRendererImpl::render().

+ Here is the caller graph for this function:

◆ handleEscapeKeyPress()

template<typename Canvas >
void gui::window::WindowBase< Canvas >::handleEscapeKeyPress ( )
inline

Handles the ESC key press event; should be called internally by the window implementation.

Definition at line 78 of file WindowBase.h.

References gui::window::WindowBase< Canvas >::blocksManager.

Referenced by gui::window::GLFWQtWindowImpl< RendererImpl, Canvas >::initializeGLFWWindow().

+ Here is the caller graph for this function:

◆ handleMouseDown()

template<typename Canvas >
void gui::window::WindowBase< Canvas >::handleMouseDown ( )
inline

Handles the mouse down event; should be called internally by the window implementation.

Definition at line 60 of file WindowBase.h.

References gui::window::WindowBase< Canvas >::blocksManager, and gui::window::WindowBase< Canvas >::handleMouseDown().

Referenced by gui::window::WindowBase< Canvas >::handleMouseDown(), and gui::window::GLFWQtWindowImpl< RendererImpl, Canvas >::initializeGLFWWindow().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ handleMouseMove()

template<typename Canvas >
void gui::window::WindowBase< Canvas >::handleMouseMove ( int  x,
int  y 
)
inline

Handles the mouse move event; should be called internally by the window implementation.

Definition at line 131 of file WindowBase.h.

References gui::window::WindowBase< Canvas >::blocksManager.

Referenced by gui::window::GLFWQtWindowImpl< RendererImpl, Canvas >::initializeGLFWWindow(), and gui::window::GLFWQtWindowImpl< RendererImpl, Canvas >::postInitialize().

+ Here is the caller graph for this function:

◆ handleMouseUp()

template<typename Canvas >
void gui::window::WindowBase< Canvas >::handleMouseUp ( )
inline

Handles the mouse up event; should be called internally by the window implementation.

Definition at line 66 of file WindowBase.h.

References gui::window::WindowBase< Canvas >::blocksManager.

Referenced by gui::window::GLFWQtWindowImpl< RendererImpl, Canvas >::initializeGLFWWindow().

+ Here is the caller graph for this function:

◆ handleNumericKeyPress()

template<typename Canvas >
void gui::window::WindowBase< Canvas >::handleNumericKeyPress ( int  number)
inline

Handles the numeric key press event; should be called internally by the window implementation.

Definition at line 72 of file WindowBase.h.

References gui::window::WindowBase< Canvas >::blocksManager.

Referenced by gui::window::GLFWQtWindowImpl< RendererImpl, Canvas >::initializeGLFWWindow().

+ Here is the caller graph for this function:

◆ handleRightClick()

template<typename Canvas >
void gui::window::WindowBase< Canvas >::handleRightClick ( )
inline

Handles the right click event; should be called internally by the window implementation.

Definition at line 84 of file WindowBase.h.

References gui::window::WindowBase< Canvas >::blocksManager, business_logic::input::InputChoice< T >::displayName, and gui::window::WindowBase< Canvas >::logger.

Referenced by gui::window::GLFWQtWindowImpl< RendererImpl, Canvas >::initializeGLFWWindow().

+ Here is the caller graph for this function:

◆ operator=() [1/2]

template<typename Canvas >
WindowBase & gui::window::WindowBase< Canvas >::operator= ( const WindowBase< Canvas > &  )
delete

◆ operator=() [2/2]

template<typename Canvas >
WindowBase & gui::window::WindowBase< Canvas >::operator= ( WindowBase< Canvas > &&  )
defaultnoexcept

◆ run()

template<typename Canvas >
virtual void gui::window::WindowBase< Canvas >::run ( )
pure virtual

Runs the main window loop.

Implemented in gui::window::GLFWQtWindowImpl< RendererImpl, Canvas >.

◆ shouldClose()

template<typename Canvas >
virtual bool gui::window::WindowBase< Canvas >::shouldClose ( ) const
pure virtual

Whether the window should close.

Returns
bool True if the window should close, false otherwise

Implemented in gui::window::GLFWQtWindowImpl< RendererImpl, Canvas >.

Member Data Documentation

◆ blocksManager

◆ framebufferSize

template<typename Canvas >
business_logic::geometry::Size2D gui::window::WindowBase< Canvas >::framebufferSize
protected

The framebuffer size

Definition at line 162 of file WindowBase.h.

Referenced by gui::window::WindowBase< Canvas >::getFramebufferSize().

◆ logger

◆ winSize

template<typename Canvas >
business_logic::geometry::Size2D gui::window::WindowBase< Canvas >::winSize
protected

The window size

Definition at line 157 of file WindowBase.h.

Referenced by gui::window::WindowBase< Canvas >::getWindowSize().


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