Pulp 1.88.0
Cross-platform audio plugin framework
Loading...
Searching...
No Matches
pulp::view::DocumentWindow Class Reference

#include <window_classes.hpp>

Classes

struct  MenuItem
 A menu item in this window's menu bar. More...
struct  Menu
 A top-level menu (e.g. "File", "Edit", "View") with its items. More...

Public Types

using CloseConfirmationHandler = std::function<bool()>
 Hook called when the user requests the window to close (clicked the close button, hit ⌘W, or invoked request_close()).

Public Member Functions

 DocumentWindow (const std::string &title, View &content_root)
 ~DocumentWindow ()
 DocumentWindow (const DocumentWindow &)=delete
DocumentWindow & operator= (const DocumentWindow &)=delete
 DocumentWindow (DocumentWindow &&)=delete
DocumentWindow & operator= (DocumentWindow &&)=delete
void set_menus (std::vector< Menu > menus)
 Set or replace the logical menu model.
const std::vector< Menu > & menus () const
CloseConfirmationHandler set_close_confirmation_handler (CloseConfirmationHandler handler)
 Install a close-confirmation hook.
bool request_close ()
 Programmatic close request — runs the close-confirmation handler and (if it returns true) tears down the underlying WindowHost.
View & content ()
 The content View attached to this window's content area.
const View & content () const
const std::string & title () const
 The window's title.
WindowHost * host ()
 Underlying WindowHost (nullptr until show() is called or until a factory becomes available).
bool show ()
 Create the native window and show it.
void hide ()
 Hide the window without closing it (close-confirm is NOT consulted).
bool has_native_window () const
 True if show() produced a live native window.

Member Typedef Documentation

◆ CloseConfirmationHandler

Hook called when the user requests the window to close (clicked the close button, hit ⌘W, or invoked request_close()).

Returning true allows the close to proceed; returning false cancels it (e.g. when the document is dirty and the user picked "Cancel" in a Save dialog). When unset, every close is allowed.

Constructor & Destructor Documentation

◆ DocumentWindow() [1/3]

pulp::view::DocumentWindow::DocumentWindow ( const std::string & title,
View & content_root )

◆ ~DocumentWindow()

pulp::view::DocumentWindow::~DocumentWindow ( )

◆ DocumentWindow() [2/3]

pulp::view::DocumentWindow::DocumentWindow ( const DocumentWindow & )
delete

◆ DocumentWindow() [3/3]

pulp::view::DocumentWindow::DocumentWindow ( DocumentWindow && )
delete

Member Function Documentation

◆ content() [1/2]

View & pulp::view::DocumentWindow::content ( )
inline

The content View attached to this window's content area.

◆ content() [2/2]

const View & pulp::view::DocumentWindow::content ( ) const
inline

◆ has_native_window()

bool pulp::view::DocumentWindow::has_native_window ( ) const
inline

True if show() produced a live native window.

◆ hide()

void pulp::view::DocumentWindow::hide ( )

Hide the window without closing it (close-confirm is NOT consulted).

◆ host()

WindowHost * pulp::view::DocumentWindow::host ( )
inline

Underlying WindowHost (nullptr until show() is called or until a factory becomes available).

Tests drive the lifecycle hooks via the DocumentWindow API directly and don't depend on this being non-null.

◆ menus()

const std::vector< Menu > & pulp::view::DocumentWindow::menus ( ) const
inline

◆ operator=() [1/2]

DocumentWindow & pulp::view::DocumentWindow::operator= ( const DocumentWindow & )
delete

◆ operator=() [2/2]

DocumentWindow & pulp::view::DocumentWindow::operator= ( DocumentWindow && )
delete

◆ request_close()

bool pulp::view::DocumentWindow::request_close ( )

Programmatic close request — runs the close-confirmation handler and (if it returns true) tears down the underlying WindowHost.

Returns true if the close was actually performed.

◆ set_close_confirmation_handler()

CloseConfirmationHandler pulp::view::DocumentWindow::set_close_confirmation_handler ( CloseConfirmationHandler handler)

Install a close-confirmation hook.

Useful for "Save changes before closing?" workflows. Returns the previously-installed handler so callers can chain.

◆ set_menus()

void pulp::view::DocumentWindow::set_menus ( std::vector< Menu > menus)

Set or replace the logical menu model.

The current DocumentWindow stores this descriptor for host/test consumption; show() does not install a platform menu. Hosts that need one should consume menus() and install their own backend.

◆ show()

bool pulp::view::DocumentWindow::show ( )

Create the native window and show it.

Returns false if no WindowHost::Factory is registered on the current platform (the DocumentWindow stays usable as a logical container — its menus + content + close-confirm handler can still be inspected by tests).

◆ title()

const std::string & pulp::view::DocumentWindow::title ( ) const
inline

The window's title.


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