kformula/flake

FormulaRenderer Class Reference

FormulaRenderer takes care of painting and layouting the elements. More...

#include <FormulaRenderer.h>

List of all members.

Public Member Functions

 FormulaRenderer ()
 ~FormulaRenderer ()
void layoutElement (BasicElement *element)
void paintElement (QPainter &p, BasicElement *element, bool hints=false)
void update (QPainter &p, BasicElement *element)
void updateElementLayout (BasicElement *element)

Detailed Description

FormulaRenderer takes care of painting and layouting the elements.

FormulaRenderer follows the visitor pattern. It iterates through the element tree and calls layout() or paint() methods to let the single elements layout or paint itsselves. This more generic approach allows more efficient repainting and relayouting. The update() method is the most interesting of the class as it is used to update the visuals when the formula tree has changed somehow. The method calls layoutElement() and then paintElement(). The former is made to be efficient so it layouts only as many parental elements as needed. Using a central class for painting parts or the whole tree structure that makes up a formula has several advantages. First it reduces a lot of code duplication. Second it takes care of painting and layouting in the right order so that there no need anymore for the single element classes to do so. Third we can control instance AttributeManager and destroying and constructing it often is not needed anymore.

Author:
Martin Pfeiffer <hubipete@gmx.net>

Definition at line 49 of file FormulaRenderer.h.


Constructor & Destructor Documentation

FormulaRenderer::FormulaRenderer (  ) 

The constructor.

Definition at line 25 of file FormulaRenderer.cpp.

FormulaRenderer::~FormulaRenderer (  ) 

The destructor.

Definition at line 31 of file FormulaRenderer.cpp.


Member Function Documentation

void FormulaRenderer::layoutElement ( BasicElement element  ) 

Layout an element and all its children.

Parameters:
element The element to be layouted

Definition at line 58 of file FormulaRenderer.cpp.

void FormulaRenderer::paintElement ( QPainter p,
BasicElement element,
bool  hints = false 
)

Paint an element and all its children.

Parameters:
p The QPainter that should be used to paint the element
element The element to be painted

Definition at line 36 of file FormulaRenderer.cpp.

void FormulaRenderer::update ( QPainter p,
BasicElement element 
)

Update an element after it has changed.

Parameters:
p The QPainter that should be used to paint the element
element The element that has changed

Definition at line 71 of file FormulaRenderer.cpp.

void FormulaRenderer::updateElementLayout ( BasicElement element  ) 

Just for updating one elements layout after a change.

Definition at line 77 of file FormulaRenderer.cpp.


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