App

Application class.

Header#include "nativeui/app.h"
Namespacenamespace nu
Typeclass

This class represents current app and provides app wide APIs.

This class can not be created by user, you must create State first and then receive an instance of App via App::GetCurrent.

nu::State state;
nu::App* app = nu::App::GetCurrent();

Class methods

App* GetCurrent()

Return current app.

Return

App*

Methods

void SetApplicationMenu(scoped_refptr<MenuBar> menu) macOS

Set the application menu bar.

Parameters

MenuBar* GetApplicationMenu() const macOS

Return the application menu bar.

Return

MenuBar*

void SetDockBadgeLabel(const std::string& label) macOS

Set the label to be displayed in dock’s badging area.

Parameters

std::string GetDockBadgeLabel() const macOS

Get the label displayed in dock’s badging area.

Return

std::string

void Activate(bool force) macOS

Make current app the active app.

The force parameter is normally set to false. When the Finder launches an app, using a value of false for force allows the app to become active if the user waits for it to launch, but the app remains unobtrusive if the user activates another app. Regardless of the setting of flag, there may be a time lag before the app activates—you should not assume the app will be active immediately after sending this message.

Parameters

void Deactivate() macOS

Deactivate current app.

bool IsActive() macOS

Return whether current app is the active app.

Return

bool

void SetActivationPolicy(App::ActivationPolicy policy) macOS

Modify the app's activation policy.

Parameters

App::ActivationPolicy GetActivationPolicy() const macOS

Return app's activation policy.

Return

App::ActivationPolicy