166 lines
6.4 KiB
C++
166 lines
6.4 KiB
C++
|
|
// -*- C++ -*-
|
|
|
|
|
|
namespace Hurricane {
|
|
|
|
/*! \defgroup graphicsGroup Graphics
|
|
* \brief Access to Graphical Resources.
|
|
*
|
|
* \section secGraphicsStructure General Structure of the Graphics Object
|
|
*
|
|
* First, the Graphics object is a singleton that has to be
|
|
* accessed through the static getGraphics methods.
|
|
*
|
|
* The Graphics object contains a set of DisplayStyles of which
|
|
* one is active at a time and so used to do all drawings.
|
|
* Each DisplayStyle is identified though a name and can be
|
|
* selected with the setStyle() method.
|
|
*
|
|
* The DisplayStyle itself is a set of DrawingStyle.
|
|
* Each DrawingStyle is named and provides a QColor, a QPen
|
|
* and a QBrush. QColor, QPen & QBrush are build from the
|
|
* \c (red,green,blue) , \c BorderWidth and \c pattern .
|
|
*
|
|
* Direct access to the DrawingStyle: once a DisplayStyle has
|
|
* been selected, the Graphics accessors getColor(), getPen()
|
|
* or getBrush() gives you access to the DrawingStyles.
|
|
*
|
|
* Minimal DisplayStyle: any DisplayStyle contains at least
|
|
* the following DrawingStyles :
|
|
* <ul>
|
|
* <li>\b Fallback : the default DrawingStyle.
|
|
* <li>\b Background
|
|
* <li>\b Foreground
|
|
* <li>\b Rubber
|
|
* <li>\b Phantom
|
|
* <li>\b Boundaries
|
|
* <li>\b Marker
|
|
* <li>\b SelectionDraw
|
|
* <li>\b SelectionFill
|
|
* <li>\b Grid
|
|
* <li>\b Spot
|
|
* <li>\b Ghost
|
|
* <li>\b Text
|
|
* <li>\b Undef
|
|
* </ul>
|
|
*
|
|
* Configuration parsers should create a DrawingStyle for each
|
|
* BasicLayer, with the name of the BasicLayer as the key. So the
|
|
* following code should be valid :
|
|
\code
|
|
QBrush layerBrush = Graphics::getBrush ( layer->getName() );
|
|
\endcode
|
|
* If no DrawingStyle of that name is defined, the \b Fallback
|
|
* will be used.
|
|
*
|
|
*/
|
|
|
|
//! \addtogroup graphicsGroup
|
|
//! \{
|
|
|
|
/*! \class Graphics
|
|
* \brief Manage basic graphical configuration (\b API)
|
|
*
|
|
* The Graphics class is a singleton which provides a simplificated
|
|
* access to graphical resources from Qt and manages graphics
|
|
* styles used to draw all the objects from the CellWidget.
|
|
*/
|
|
|
|
//! \}
|
|
|
|
|
|
/*! \function Graphics* Graphics::getGraphics();
|
|
* \Return The Graphics singleton.
|
|
*/
|
|
|
|
/*! \function bool Graphics::isEnabled();
|
|
* \Return \true if Qt has been activated.
|
|
*/
|
|
|
|
/*! \function const QFont Graphics::getFixedFont(int weight=QFont::Normal, bool italic=false, bool underline=false, int scale=0);
|
|
* \param weight the font's weight (see Qt::Weight).
|
|
* \param italic select the italic variant of the font.
|
|
* \param underline the font will be underlined.
|
|
* \param scale added to the font's default point size.
|
|
* \return A QFont, the size of the font is guessed from the system's default.
|
|
*/
|
|
|
|
/*! \function const Name& Graphics::getGroup(const Name& key);
|
|
* \Return The group owning the DrawingStyle of which key is \e key.
|
|
*/
|
|
|
|
/*! \function const QColor& Graphics::getColor(const Name& key, const DisplayStyle::HSVr& darkening=DisplayStyle::HSVr());
|
|
* \Return The QColor associated to the DrawingStyle \e key darkened by a factor \e darkening.
|
|
*/
|
|
|
|
/*! \function const QPen& Graphics::getPen(const Name& key, const DisplayStyle::HSVr& darkening=DisplayStyle::HSVr());
|
|
* \Return The QPen associated to the DrawingStyle \e key darkened by a factor \e darkening.
|
|
*/
|
|
|
|
/*! \function const QBrush& Graphics::getBrush(const Name& key, const DisplayStyle::HSVr& darkening=DisplayStyle::HSVr());
|
|
* \Return The QBrush associated to the DrawingStyle \e key by a factor \e darkening.
|
|
*/
|
|
|
|
/*! \function const string& Graphics::getPattern(const Name& key);
|
|
* \Return The pattern associated to the DrawingStyle \e key.
|
|
*/
|
|
|
|
/*! \function const float Graphics::getThreshold(const Name& key);
|
|
* \Return The display threshold associated to the DrawingStyle \e key.
|
|
*/
|
|
|
|
/*! \function const DisplayStyle::HSVr& Graphics::getDarkening();
|
|
* \Return The darkening factor applied to non-selected objects.
|
|
*/
|
|
|
|
/*! \function const ColorScale& Graphics::getColorScale( ColorScale::ScaleType );
|
|
* \Return The darkening factor applied to non-selected objects.
|
|
*/
|
|
|
|
/*! \function const QColor Graphics::darken( const QColor& color );
|
|
* \Return The QColor with the darkening factor applied.
|
|
*/
|
|
|
|
/*! \function const QColor Graphics::darken( const QColor& color );
|
|
* \Return The QColor with the darkening factor applied.
|
|
*/
|
|
|
|
/*! \function const TextTranslator& Graphics::getHtmlTranslator();
|
|
* \Return The translator applied to generate html text.
|
|
* \see toHtml()
|
|
*/
|
|
|
|
/*! \function const string Graphics::toHtml( const string& );
|
|
* \Return A string suitable for HTML enabled devices, such as most of the
|
|
* Qt widgets. Special characters like \c '&' are replaced by their
|
|
* HTML counterpart (\c \&)
|
|
*/
|
|
|
|
|
|
/*! \function const void Graphics::addStyle(DisplayStyle* displayStyle);
|
|
* Adds a new DisplayStyle to the Graphics environment.
|
|
* The DisplayStyle contains it's name by which it can be
|
|
* accessed later. If any previous DisplayStyle of the same
|
|
* name was existing it is silently replaced.
|
|
*/
|
|
|
|
/*! \function void Graphics::setStyle(const Name& key);
|
|
* Make the DisplayStyle whose name is \e key the currently
|
|
* used one.
|
|
*/
|
|
|
|
/*! \function DisplayStyle* Graphics::getStyle(const Name& key);
|
|
* \Return The DisplayStyle whose name is \e key.
|
|
*/
|
|
|
|
/*! \function DisplayStyle* Graphics::getStyle();
|
|
* \Return The DisplayStyle which is currently in use.
|
|
*/
|
|
|
|
/*! \function void Graphics::enable();
|
|
* Effectively calls Qt, allocated Pens & Brushes and so on.
|
|
*/
|
|
|
|
}
|