Harlinn.Windows 0.1
Loading...
Searching...
No Matches
Harlinn::Windows::Application Class Reference

#include <HWApplication.h>

Inheritance diagram for Harlinn::Windows::Application:
[legend]
Collaboration diagram for Harlinn::Windows::Application:
[legend]

Public Types

using Base = Common::Core::Application
 
- Public Types inherited from Harlinn::Common::Core::Application
using Base = Concurrency::ActiveObject<std::shared_ptr<ApplicationMessage>>
 
- Public Types inherited from Harlinn::Common::Core::Concurrency::ActiveObject< std::shared_ptr< ApplicationMessage > >
using Base
 
using ESFT
 
- Public Types inherited from Harlinn::Common::Core::Concurrency::ActiveObjectBase< std::shared_ptr< ApplicationMessage >, maxQueueSize >
using MessageType
 
using ConcurrentQueue
 
using Event
 

Public Member Functions

HW_EXPORT Application (const std::shared_ptr< Windows::ApplicationOptions > &options, COINIT comInitalizationFlags=COINIT::COINIT_APARTMENTTHREADED)
 
HW_EXPORT Application ()
 
virtual HW_EXPORT ~Application ()
 
virtual HW_EXPORT int Run (Form &mainform)
 
HW_EXPORT int Run (const std::unique_ptr< Form > &mainform)
 
virtual HW_EXPORT int Run (Form &mainform, MessageLoop &messageLoop)
 
template<typename FormT >
requires std::is_base_of_v<Form, FormT>
int Run ()
 
HW_EXPORT const WindowClassesGetWindowClasses () const
 
HW_EXPORT WindowClassesGetWindowClasses ()
 
- Public Member Functions inherited from Harlinn::Common::Core::Application
HCC_EXPORT Application (const std::shared_ptr< ApplicationOptions > &options)
 
HCC_EXPORT Application ()
 
HCC_EXPORT ~Application ()
 
 Application (const Application &other)=delete
 
 Application (Application &&other)=delete
 
Applicationoperator= (const Application &other)=delete
 
Applicationoperator= (Application &&other)=delete
 
const std::shared_ptr< ApplicationOptions > & Options () const
 
bool Start (const TimeSpan &timeout) override
 Starts the message processing thread.
 
bool Stop (const TimeSpan &timeout) override
 Stops the message processing thread by posting the stop message, closing the message queue, and waiting for the thread to exit.
 
HCC_EXPORT void PostThreadAttachedMessage ()
 
HCC_EXPORT void PostThreadDetachedMessage ()
 
- Public Member Functions inherited from Harlinn::Common::Core::Concurrency::ActiveObject< std::shared_ptr< ApplicationMessage > >
 ActiveObject (const WideString &threadName)
 Constructs a new instance of an ActiveObject object.
 
virtual ~ActiveObject ()=default
 
bool Start ()
 Starts the message processing thread.
 
bool Stop ()
 Stops the message processing thread by posting the stop message, closing the message queue, and waiting for the thread to exit.
 
- Public Member Functions inherited from Harlinn::Common::Core::Concurrency::ActiveObjectBase< std::shared_ptr< ApplicationMessage >, maxQueueSize >
 ActiveObjectBase (const WideString &threadName)
 Constructs a new active object.
 
const WideStringThreadName () const noexcept
 
bool Started () const noexcept
 Determine whether the active object has started the message processing thread.
 
bool Stopped () const noexcept
 Determine whether the active object has exited the message processing thread.
 
size_t MessagesPosted () const
 Retrieves the number of messages posted to the active object.
 
size_t MessagesProcessed () const
 Retrieves the number of messages processed by the message processing loop.
 
virtual bool PostMessage (const MessageType &message)
 Posts a message to the active object.
 
virtual bool PostMessage (MessageType &&message)
 Posts a message, by moving it, to the active object.
 

Static Public Member Functions

static HW_EXPORT ApplicationCurrent ()
 
static HW_EXPORT WindowClassGetWindowClass (const WideString &className)
 
static HW_EXPORT WindowClassGetWindowClass (const wchar_t *className)
 
static void RegisterWindowClass (std::unique_ptr< WindowClass > &&windowClass)
 
- Static Public Member Functions inherited from Harlinn::Common::Core::Application
static ApplicationInstance () noexcept
 
static HCC_EXPORT UInt64 MainThreadId () noexcept
 
static HCC_EXPORT void HandleDllMainEvent (HMODULE moduleHandle, DWORD reason, LPVOID freeLibrary) noexcept
 

Private Member Functions

HW_EXPORT void AddControl (HWND hWnd, Control *control)
 
HW_EXPORT void RemoveControl (HWND hWnd)
 
HW_EXPORT ControlGetControl (HWND hWnd)
 

Private Attributes

WindowClasses windowClasses_
 
std::unordered_map< HWND, Control * > controls_
 

Static Private Attributes

static ApplicationcurrentApplication_ = nullptr
 

Friends

class Control
 

Additional Inherited Members

- Public Attributes inherited from Harlinn::Common::Core::Application
boost::signals2::signal< void(UInt32 attachedThreadId)> OnThreadAttached
 
boost::signals2::signal< void(UInt32 detachedThreadId)> OnThreadDetached
 
- Public Attributes inherited from Harlinn::Common::Core::Concurrency::ActiveObjectBase< std::shared_ptr< ApplicationMessage >, maxQueueSize >
Event< void(ActiveObjectBase *, const ActiveObjectMessageEventArgs< MessageType > &)> OnProcessMessage
 Register callbacks with this signal to process messages passed to the active object.
 
Event< void(ActiveObjectBase *, const ActiveObjectExceptionEventArgs &)> OnException
 Register callbacks with this signal to process exceptions caught in the message event loop of the active object.
 
- Static Public Attributes inherited from Harlinn::Common::Core::Concurrency::ActiveObject< std::shared_ptr< ApplicationMessage > >
static constexpr Int64 DefaultStartStopTimeoutInTicks
 
- Protected Member Functions inherited from Harlinn::Common::Core::Application
virtual HCC_EXPORT void ProcessMessage (const MessageType &message) override
 
virtual bool IsStopMessage (const MessageType &message) const noexcept override
 IsStopMessage must be implemented by derived classes to determine if a message is a stop message causing the event loop to be terminated.
 
virtual void PostStopMessage () override
 PostStopMessage must be implemented by derived classes. The implementation must post a message the will cause IsStopMessage to return true.
 
virtual HCC_EXPORT void BeforeProcessMessages () override
 
virtual HCC_EXPORT void ProcessThreadAttachedMessage (const std::shared_ptr< ApplicationThreadAttachedMessage > &message)
 
virtual HCC_EXPORT void ProcessThreadDetachedMessage (const std::shared_ptr< ApplicationThreadDetachedMessage > &message)
 
- Protected Member Functions inherited from Harlinn::Common::Core::Concurrency::ActiveObjectBase< std::shared_ptr< ApplicationMessage >, maxQueueSize >
void ProcessMessages ()
 This function implements the message processing loop.
 
virtual void AfterProcessMessages ()
 Provides an opportunity to implement any cleanup that needs to be performed in the context of the worker thread of the active object after the message loop exits.
 
virtual void Run (EventWaitHandle &manualEventWaitHandle)
 Run must be called by the thread that will be used to process messages for the active object.
 
virtual void HandleException (const std::exception &error, const WideString &message)
 Called when exceptions are caught in the message processing loop.
 

Member Typedef Documentation

◆ Base

Constructor & Destructor Documentation

◆ Application() [1/2]

Harlinn::Windows::Application::Application ( const std::shared_ptr< Windows::ApplicationOptions > & options,
COINIT comInitalizationFlags = COINIT::COINIT_APARTMENTTHREADED )

◆ Application() [2/2]

HW_EXPORT Harlinn::Windows::Application::Application ( )

◆ ~Application()

virtual HW_EXPORT Harlinn::Windows::Application::~Application ( )
virtual

Member Function Documentation

◆ AddControl()

void Harlinn::Windows::Application::AddControl ( HWND hWnd,
Control * control )
private

◆ Current()

Application * Harlinn::Windows::Application::Current ( )
static

◆ GetControl()

Control * Harlinn::Windows::Application::GetControl ( HWND hWnd)
private

◆ GetWindowClass() [1/2]

WindowClass * Harlinn::Windows::Application::GetWindowClass ( const wchar_t * className)
static

◆ GetWindowClass() [2/2]

WindowClass * Harlinn::Windows::Application::GetWindowClass ( const WideString & className)
static

◆ GetWindowClasses() [1/2]

WindowClasses & Harlinn::Windows::Application::GetWindowClasses ( )

◆ GetWindowClasses() [2/2]

const WindowClasses & Harlinn::Windows::Application::GetWindowClasses ( ) const

◆ RegisterWindowClass()

static void Harlinn::Windows::Application::RegisterWindowClass ( std::unique_ptr< WindowClass > && windowClass)
inlinestatic

◆ RemoveControl()

void Harlinn::Windows::Application::RemoveControl ( HWND hWnd)
private

◆ Run() [1/4]

template<typename FormT >
requires std::is_base_of_v<Form, FormT>
int Harlinn::Windows::Application::Run ( )
inline

◆ Run() [2/4]

int Harlinn::Windows::Application::Run ( const std::unique_ptr< Form > & mainform)

◆ Run() [3/4]

int Harlinn::Windows::Application::Run ( Form & mainform)
virtual

◆ Run() [4/4]

int Harlinn::Windows::Application::Run ( Form & mainform,
MessageLoop & messageLoop )
virtual

Friends And Related Symbol Documentation

◆ Control

friend class Control
friend

Member Data Documentation

◆ controls_

std::unordered_map<HWND, Control*> Harlinn::Windows::Application::controls_
private

◆ currentApplication_

Application * Harlinn::Windows::Application::currentApplication_ = nullptr
staticprivate

◆ windowClasses_

WindowClasses Harlinn::Windows::Application::windowClasses_
private

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