UTFWin::DefaultWinProc class

A helper class to simplify the creation of window procedures (IWinProc).

Provides implementations for memory management and GetEventFlags(), so the only method you need to implement is HandleUIMessage(). The template parameter is a combination of EventFlags flags, which determine which kind of events it reacts to. By default, it reacts to basic keyboard/mouse input, and to advanced events. Example usage:

class MyProcedure : public DefaultWinProc<>
{
public:
    bool HandleUIMessage(IWindow* window, const Message& message) override;
};

bool MyProcedure::HandleUIMessage(IWindow* window, const Message& message) {
    if (message.IsType(kMsgButtonClick)) {
        App::ConsolePrintF("Button clicked!");
    }
    return false;
}

Base classes

class IWinProc
This class is a window procedure, also known as an event/message listener.
class DefaultRefCounted
The default implementation of a reference counted class.

Public functions

auto AddRef() -> int override
auto Release() -> int override
auto Cast(uint32_t type) const -> void* override
auto GetEventFlags() const -> int override
Gets the flags that represent which type of messages this IWinProc can handle.

Function documentation

template<int eventFlags>
int UTFWin::DefaultWinProc<eventFlags>::GetEventFlags() const override

Gets the flags that represent which type of messages this IWinProc can handle.

This allows for better performance, since generally a procedure only needs to listen specific events. The flags are in the kEventFlag... values.