Representation of a dynamic inheritance of styles. More...
#include <KEYStyleContext.h>
Public Member Functions | |
| KEYStyleContext () | |
| Construct an empty context. More... | |
| void | push (const KEYStylePtr_t &style) |
| Push a style onto the active styles stack. More... | |
| void | pop () |
| Pop a style from the active styles stack. More... | |
| boost::any | find (const std::string &property, bool lookInParent=false) const |
Find the current value of property property. More... | |
Private Types | |
| typedef std::deque< KEYStylePtr_t > | Stack_t |
| The internal type of style stack. More... | |
Private Attributes | |
| Stack_t | m_stack |
Representation of a dynamic inheritance of styles.
A static inheritance of styles is represented by the "parent" relation of styles. A dynamic inheritance is defined by the way styles are applied on elements. One or more styles may be active at any given moment (e.g., a character style of a text span and a paragraph style of the paragraph) and a property can be inherited from the enclosing style.
The property getters in specific implementations of KEYStyle should take a pointer to a KEYStyleContext.
|
private |
The internal type of style stack.
std::deque is used instead of std::stack because std::stack does not allow iteration through the elements.
| libetonyek::KEYStyleContext::KEYStyleContext | ( | ) |
Construct an empty context.
| boost::any libetonyek::KEYStyleContext::find | ( | const std::string & | property, |
| bool | lookInParent = false |
||
| ) | const |
Find the current value of property property.
The search traverses the stack of active styles from top to bottom. The search ends if property is found or if bottom is reached.
Referenced by libetonyek::KEYStyleBase::lookup().
| void libetonyek::KEYStyleContext::pop | ( | ) |
Pop a style from the active styles stack.
Referenced by libetonyek::KEYOutput::~KEYOutput().
| void libetonyek::KEYStyleContext::push | ( | const KEYStylePtr_t & | style | ) |
Push a style onto the active styles stack.
The previous top style becomes a dynamic parent style.
Referenced by libetonyek::KEYOutput::KEYOutput().