RADLib
RADical C++ application framework
RADUi::DocumentWorkspaceModel Class Reference

Document workspace model for tabbed editors and browsers. More...

#include <RADAppKit.h>

+ Inheritance diagram for RADUi::DocumentWorkspaceModel:
+ Collaboration diagram for RADUi::DocumentWorkspaceModel:

Public Member Functions

const std::vector< DocumentTab > & tabs () const
 Returns all tabs. More...
 
const std::string & activeId () const
 Returns active tab id. More...
 
void upsertTab (DocumentTab tab)
 Adds or replaces a tab. More...
 
bool setActive (std::string id)
 Sets active tab id. More...
 
bool removeTab (const std::string &id)
 Removes tab by id. More...
 
bool setModified (const std::string &id, bool modified)
 Marks a tab modified or clean. More...
 
bool requestClose (const std::string &id)
 Emits closeRequested for a closeable tab. More...
 
bool hasModifiedTabs () const
 Returns true when any tab is modified. More...
 
void clear ()
 Clears all tabs. More...
 
- Public Member Functions inherited from RADCore::RADObject
 RADObject ()
 Creates a RADObject bound to the current thread. More...
 
virtual ~RADObject ()
 Disconnects tracked event links and releases lifetime token. More...
 
void registerLink (const ConnectionRecord &record)
 Registers a connection for cleanup when this object is destroyed. More...
 
std::thread::id threadId () const
 Returns the thread id this object is currently associated with. More...
 
EventLoopassociatedEventLoop () const
 Returns the associated event loop, if any. More...
 
ThreadAffinity threadAffinity () const
 Returns both thread id and associated loop atomically. More...
 
std::weak_ptr< void > lifetimeToken () const
 Returns a weak token used to drop queued callbacks after destruction. More...
 
void moveToThread (std::thread::id tId, EventLoop *loop=nullptr)
 Moves the object's affinity to tId and optional loop. More...
 

Public Attributes

RADCore::Event< void() > changed
 Raised when tabs or active tab changes. More...
 
RADCore::Event< void(std::string) > closeRequested
 Raised when a tab close is requested. More...
 

Detailed Description

Document workspace model for tabbed editors and browsers.

Member Function Documentation

◆ activeId()

const std::string& RADUi::DocumentWorkspaceModel::activeId ( ) const

Returns active tab id.

◆ clear()

void RADUi::DocumentWorkspaceModel::clear ( )

Clears all tabs.

◆ hasModifiedTabs()

bool RADUi::DocumentWorkspaceModel::hasModifiedTabs ( ) const

Returns true when any tab is modified.

◆ removeTab()

bool RADUi::DocumentWorkspaceModel::removeTab ( const std::string &  id)

Removes tab by id.

◆ requestClose()

bool RADUi::DocumentWorkspaceModel::requestClose ( const std::string &  id)

Emits closeRequested for a closeable tab.

◆ setActive()

bool RADUi::DocumentWorkspaceModel::setActive ( std::string  id)

Sets active tab id.

◆ setModified()

bool RADUi::DocumentWorkspaceModel::setModified ( const std::string &  id,
bool  modified 
)

Marks a tab modified or clean.

◆ tabs()

const std::vector<DocumentTab>& RADUi::DocumentWorkspaceModel::tabs ( ) const

Returns all tabs.

◆ upsertTab()

void RADUi::DocumentWorkspaceModel::upsertTab ( DocumentTab  tab)

Adds or replaces a tab.

Member Data Documentation

◆ changed

RADCore::Event<void () > RADUi::DocumentWorkspaceModel::changed

Raised when tabs or active tab changes.

◆ closeRequested

RADCore::Event<void (std::string) > RADUi::DocumentWorkspaceModel::closeRequested

Raised when a tab close is requested.


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