Lumiera  0.pre.03
»edit your freedom«
WLink< TAR > Class Template Reference

#include "stage/model/w-link.hpp"

Description

template<class TAR>
class stage::model::WLink< TAR >

Managed link to a sigc::trackable UI widget, without taking ownership.

Automatically installs a callback to switch this link into detached state when the target (widget) is destroyed.

Template Parameters
TARthe actual target widget type, which can be forward declared, until the point where the widget is actually constructed or attached. This target type must derive from sigc::trackable
Warning
not threadsafe
Note
only EX_SANE, since attaching, detaching and swapping might throw.

Definition at line 88 of file w-link.hpp.

Public Member Functions

 WLink (TAR &targetWidget)
 
 WLink (WLink const &r)
 
 WLink (WLink &&rr)
 
void clear ()
 detach and deactivate this link More...
 
void connect (TAR &otherTarget)
 (re)connect this smart link to the given target. More...
 
bool isActive () const
 
bool isValid () const
 
 operator bool () const
 
TAR & operator* () const
 
TAR * operator-> () const
 
WLinkoperator= (WLink other)
 

Friends

void swap (WLink &l, WLink &r)
 swap the pointees, including callback registration. More...
 

Private Member Functions

void __ensureAlive () const
 
TAR * attachTo (TAR &target)
 

Private Attributes

TAR * widget_
 

Member Function Documentation

◆ operator=()

WLink& operator= ( WLink< TAR >  other)
inline
Parameters
other
Warning
only EX_SANE

Definition at line 122 of file w-link.hpp.

◆ clear()

void clear ( )
inline

detach and deactivate this link

Note
EX_STRONG (but only under the assumption that also sigc::trackable::remove_destroy_notify_cllback is EX_STRONG)

Definition at line 179 of file w-link.hpp.

Referenced by WLink< TimelineWidget >::connect().

+ Here is the caller graph for this function:

◆ connect()

void connect ( TAR &  otherTarget)
inline

(re)connect this smart link to the given target.

Any previously existing link is detached beforehand

Note
EX_SANE only (assuming sigc::trackable is sane) Might leave this WLink in disconnected state when throwing
Exceptions
error::Externalwhen registration with sigc::trackable fails

Definition at line 193 of file w-link.hpp.

◆ attachTo()

TAR* attachTo ( TAR &  target)
inlineprivate

installs the necessary callback to detach this link in case the target is destroyed

Note
EX_STRONG

Definition at line 214 of file w-link.hpp.

Referenced by WLink< TimelineWidget >::connect().

+ Here is the caller graph for this function:

Friends And Related Function Documentation

◆ swap

void swap ( WLink< TAR > &  l,
WLink< TAR > &  r 
)
friend

swap the pointees, including callback registration.

Warning
only EX_SANE. Might leave the following intermediary states
  • only r was detached
  • both r and l are detached
  • both detached, but only l attached to the former target of r, while the former target of l is now completely detached.

Definition at line 137 of file w-link.hpp.

Referenced by WLink< TimelineWidget >::operator=().

+ Inheritance diagram for WLink< TAR >:
+ Collaboration diagram for WLink< TAR >:

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