#include <KDFrame.h>


Public Types | |
| enum | BackPixmapMode { PixCentered, PixScaled, PixStretched } |
| enum | SimpleFrame { FrameFlat, FrameElegance, FrameBoxRaized, FrameBoxSunken, FramePanelRaized, FramePanelSunken, FrameSemicircular } |
| enum | ProfileName { ProfileTop, ProfileRight, ProfileBottom, ProfileLeft } |
| enum | CornerName { CornerTopLeft, CornerTopRight, CornerBottomLeft, CornerBottomRight, CornerUNKNOWN } |
| enum | CornerStyle { CornerNormal, CornerRound, CornerOblique } |
| enum | KDFramePaintSteps { PaintBackground, PaintEdges, PaintCorners, PaintBorder, PaintAll } |
Public Slots | |
| static QString | backPixmapModeToString (BackPixmapMode type) |
| static BackPixmapMode | stringToBackPixmapMode (const QString &string) |
| void | setSimpleFrame (SimpleFrame frame, int lineWidth, int midLineWidth, QPen pen, QBrush background=QBrush(), const QPixmap *backPixmap=0, BackPixmapMode backPixmapMode=PixStretched) |
| void | clearProfile (ProfileName name) |
| void | addProfileSection (ProfileName name, int wid, QPen pen, KDFrameProfileSection::Direction dir=KDFrameProfileSection::DirPlain, KDFrameProfileSection::Curvature curv=KDFrameProfileSection::CvtPlain) |
| void | setProfile (ProfileName name, const KDFrameProfile &profile) |
| const KDFrameProfile & | profile (ProfileName name) const |
| static QString | cornerNameToString (CornerName type) |
| static CornerName | stringToCornerName (const QString &string) |
| static QString | cornerStyleToString (CornerStyle type) |
| static CornerStyle | stringToCornerStyle (const QString &string) |
| void | setCorner (CornerName name, CornerStyle style, int width, KDFrameProfile *const profile=0) |
| void | setCorners (CornerStyle style, int width, KDFrameProfile *const profile=0) |
| CornerStyle | cornerStyle (CornerName name) const |
| int | cornerWidth (CornerName name) const |
| const KDFrameProfile & | cornerProfile (CornerName name) const |
| void | setSunPos (CornerName sunPos) |
| CornerName | sunPos () const |
| void | setBackground (QBrush background=QBrush(Qt::NoBrush)) |
| void | setBackPixmap (const QPixmap *backPixmap=0, BackPixmapMode backPixmapMode=PixStretched) |
| const QBrush & | background (const QPixmap *&backPixmap, BackPixmapMode &backPixmapMode) const |
| void | setInnerRect (QRect innerRect) |
| QRect | innerRect () const |
| virtual void | paintBackground (QPainter &painter, const QRect &innerRect) const |
| virtual void | paintEdges (QPainter &painter, const QRect &innerRect) const |
| virtual void | paintCorners (QPainter &painter, const QRect &innerRect) const |
| virtual void | paint (QPainter *painter, KDFramePaintSteps steps=PaintAll, QRect innerRect=QRect(0, 0, 0, 0)) const |
| void | clearAll () |
Signals | |
| void | changed () |
Public Member Functions | |
| KDFrame (QRect innerRect=QRect(0, 0, 0, 0), SimpleFrame frame=FrameFlat, int lineWidth=1, int midLineWidth=0, QPen pen=QPen(), QBrush background=QBrush(), const QPixmap *backPixmap=0, BackPixmapMode backPixmapMode=PixStretched, int shadowWidth=0, CornerName sunPos=CornerTopLeft) | |
| virtual | ~KDFrame () |
Static Public Member Functions | |
| static void | deepCopy (KDFrame &D, const KDFrame &R) |
| static void | createFrameNode (QDomDocument &document, QDomNode &parent, const QString &elementName, const KDFrame &frame) |
| static void | createFrameProfileNode (QDomDocument &document, QDomNode &parent, const QString &elementName, KDFrameProfile profile) |
| static bool | readFrameNode (const QDomElement &element, KDFrame &frame) |
| static bool | readFrameProfileNode (const QDomElement &element, KDFrameProfile &profile) |
Private Member Functions | |
| KDFrame (const KDFrame &) | |
| KDFrame & | operator= (const KDFrame &) |
| void | setProfileSectionsAutoDelete (bool on) const |
Private Attributes | |
| int | _shadowWidth |
| CornerName | _sunPos |
| QBrush | _background |
| QPixmap | _backPixmap |
| BackPixmapMode | _backPixmapMode |
| QRect | _innerRect |
| KDFrameProfile | _profileSections |
| KDFrameProfile | _topProfile |
| KDFrameProfile | _rightProfile |
| KDFrameProfile | _bottomProfile |
| KDFrameProfile | _leftProfile |
| KDFrameCorner | _cornerTL |
| KDFrameCorner | _cornerTR |
| KDFrameCorner | _cornerBL |
| KDFrameCorner | _cornerBR |
Friends | |
| QTextStream & | operator<< (QTextStream &s, const KDFrame &p) |
| QTextStream & | operator>> (QTextStream &s, KDFrame &p) |
Classes | |
| class | KDFrameCorner |
A frame may consist of an (optional) border and/or an (optional) background. v200 This class is work in progress, at present only single line frame borders and (scaled/streched) background pictures are available. See KDChartParams::setSimpleFrame() to learn how to use them.
The border may consist of up to four edges and/or up to four border corners.
Some commonly used frame profiles (e.g. raised box, sunken panel) are predefined in SimpleFrame, see setSimpleFrame(). To learn how to specify your frame profiles have a look at example code given with setProfile()
| enum KDFrame::SimpleFrame |
These simple frames are pre-defined for your convenience
FrameFlat a flat rectangular frame FrameElegance a flat frame consisting of three lines FrameBoxRaized a raised box FrameBoxSunken a sunken box FramePanelRaized a raised panel FramePanelSunken a sunken panel FrameSemicircular a raised box with round edges| enum KDFrame::ProfileName |
| enum KDFrame::CornerName |
| enum KDFrame::CornerStyle |
The different steps taken to paint the frame: first paint the background then the edges then the corners. By choosing PaintAll all the parts of the frame will be drawn.
PaintBackground -- first paints the brush, then paints the pixmap if any PaintEdges PaintCorners PaintBorder -- paint the edges and the corners but not the background PaintAll
| KDFrame::KDFrame | ( | QRect | innerRect = QRect(0,0,0,0), |
|
| SimpleFrame | frame = FrameFlat, |
|||
| int | lineWidth = 1, |
|||
| int | midLineWidth = 0, |
|||
| QPen | pen = QPen(), |
|||
| QBrush | background = QBrush(), |
|||
| const QPixmap * | backPixmap = 0, |
|||
| BackPixmapMode | backPixmapMode = PixStretched, |
|||
| int | shadowWidth = 0, |
|||
| CornerName | sunPos = CornerTopLeft | |||
| ) | [inline] |
Default Constructor. Defines default values.
The constructor does *not* have a parent parameter since drawing of the frame is not done transparently but by (one or more) explicit calls of the frames paint() methode. See explanation given there to learn about the why and how of this...
| KDFrame::KDFrame | ( | const KDFrame & | ) | [inline, private] |
| virtual KDFrame::~KDFrame | ( | ) | [virtual] |
Destructor. Only defined to have it virtual.
| static QString KDFrame::backPixmapModeToString | ( | BackPixmapMode | type | ) | [inline, static, slot] |
Converts the specified background pixmap mode enum to a string representation.
| type | the background pixmap mode to convert |
| static BackPixmapMode KDFrame::stringToBackPixmapMode | ( | const QString & | string | ) | [inline, static, slot] |
Converts the specified string to a background pixmap mode enum value.
| string | the string to convert |
| void KDFrame::setSimpleFrame | ( | SimpleFrame | frame, | |
| int | lineWidth, | |||
| int | midLineWidth, | |||
| QPen | pen, | |||
| QBrush | background = QBrush(), |
|||
| const QPixmap * | backPixmap = 0, |
|||
| BackPixmapMode | backPixmapMode = PixStretched | |||
| ) | [slot] |
| void KDFrame::clearProfile | ( | ProfileName | name | ) | [slot] |
| void KDFrame::addProfileSection | ( | ProfileName | name, | |
| int | wid, | |||
| QPen | pen, | |||
| KDFrameProfileSection::Direction | dir = KDFrameProfileSection::DirPlain, |
|||
| KDFrameProfileSection::Curvature | curv = KDFrameProfileSection::CvtPlain | |||
| ) | [slot] |
| void KDFrame::setProfile | ( | ProfileName | name, | |
| const KDFrameProfile & | profile | |||
| ) | [slot] |
| const KDFrameProfile& KDFrame::profile | ( | ProfileName | name | ) | const [slot] |
| static QString KDFrame::cornerNameToString | ( | CornerName | type | ) | [inline, static, slot] |
| static CornerName KDFrame::stringToCornerName | ( | const QString & | string | ) | [inline, static, slot] |
| static QString KDFrame::cornerStyleToString | ( | CornerStyle | type | ) | [inline, static, slot] |
| static CornerStyle KDFrame::stringToCornerStyle | ( | const QString & | string | ) | [inline, static, slot] |
| void KDFrame::setCorner | ( | CornerName | name, | |
| CornerStyle | style, | |||
| int | width, | |||
| KDFrameProfile *const | profile = 0 | |||
| ) | [inline, slot] |
| void KDFrame::setCorners | ( | CornerStyle | style, | |
| int | width, | |||
| KDFrameProfile *const | profile = 0 | |||
| ) | [inline, slot] |
| CornerStyle KDFrame::cornerStyle | ( | CornerName | name | ) | const [inline, slot] |
| int KDFrame::cornerWidth | ( | CornerName | name | ) | const [inline, slot] |
| const KDFrameProfile& KDFrame::cornerProfile | ( | CornerName | name | ) | const [inline, slot] |
| void KDFrame::setSunPos | ( | CornerName | sunPos | ) | [inline, slot] |
| CornerName KDFrame::sunPos | ( | ) | const [inline, slot] |
| void KDFrame::setBackground | ( | QBrush | background = QBrush( Qt::NoBrush ) |
) | [inline, slot] |
Specifies the brush to be used to fill the inner area of this frame, calling this methode without passing in a parameter re-sets the background brush to QBrush( NoBrush ).
To have a 'tiled' background image just use a brush holding this pixmap - for other ways to show background images please use setBackPixmap.
| void KDFrame::setBackPixmap | ( | const QPixmap * | backPixmap = 0, |
|
| BackPixmapMode | backPixmapMode = PixStretched | |||
| ) | [inline, slot] |
Specifies a pixmap to be used to fill the inner area of this frame, calling this methode without passing in a parameter removes the background pixmap.
To have a 'tiled' background image do not use setBackPixmap but use setBackground specifying a brush holding the pixmap.
| const QBrush& KDFrame::background | ( | const QPixmap *& | backPixmap, | |
| BackPixmapMode & | backPixmapMode | |||
| ) | const [inline, slot] |
Returns the brush that is used to fill the inner area of this frame, or a QBrush( ) if no background is to be drawn.
| backPixmap | receives the pixmap used for drawing the background or a null pixmap, test this by calling backPixmap.isNull() |
| void KDFrame::setInnerRect | ( | QRect | innerRect | ) | [inline, slot] |
Specifies the position and the size of area that is surrounded by the frame.
| QRect KDFrame::innerRect | ( | ) | const [inline, slot] |
Returns the position and the size of the frame.
| virtual void KDFrame::paintBackground | ( | QPainter & | painter, | |
| const QRect & | innerRect | |||
| ) | const [virtual, slot] |
Paint methode drawing the background (if any) of the frame.
PaintBackground (or with PaintAll, resp.) for the steps parameter. | virtual void KDFrame::paintEdges | ( | QPainter & | painter, | |
| const QRect & | innerRect | |||
| ) | const [virtual, slot] |
Paint methode drawing the edges (if any) of the frame.
PaintEdges (or with PaintAll, PaintBorder, resp.) for the steps parameter. | virtual void KDFrame::paintCorners | ( | QPainter & | painter, | |
| const QRect & | innerRect | |||
| ) | const [virtual, slot] |
Paint methode drawing the corners (if any) of the frame.
PaintCorners (or with PaintAll, PaintBorder, resp.) for the steps parameter. | virtual void KDFrame::paint | ( | QPainter * | painter, | |
| KDFramePaintSteps | steps = PaintAll, |
|||
| QRect | innerRect = QRect(0, 0, 0, 0) | |||
| ) | const [virtual, slot] |
Paint methode actually drawing the frame.
This method must be called from inside the paint() methode of your widget.
In order not to override the inner contents of the frame you normally would first call paint( painter, PaintBackground ); then do all the inside drawing and finally call paint( painter, PaintBorder );. In case the inner contents are allowed to (partially) override the frame border you could do the following: First call paint( painter, PaintBackground ); immediately followed by paint( painter, PaintEdges ); then do all your inside work and finally draw paint( painter, PaintCorners );.
| painter | The QPainter to be used for drawing. | |
| steps | The part of the frame to be drawn, use KDFrame::PaintAll to draw the entire frame and the background, use KDFrame::PaintBackground to draw only the background, use KDFrame::PaintEdges to draw just the edges, use KDFrame::PaintCorners to draw only the corners. | |
| innerRect | The area inside the frame. Use this parameter to temporarily override the innerRect set by the constructor of KDFrame or by setInnerRect(). This approach can be usefull if you want to draw several frames that differ only regarding to their position and size but share the same edges/corners/background settings. In this case you could decide to instantiate only one KDFrame set up the desired settings and just call its paint() methode several time - giving it the appropriate innerRect for each frame. This would result in less memory usage since you could use that single KDFrame object as kind of a shared ressource. |
| void KDFrame::clearAll | ( | ) | [inline, slot] |
Remove all settings and specify no border, no edges, no background.
| static void KDFrame::createFrameNode | ( | QDomDocument & | document, | |
| QDomNode & | parent, | |||
| const QString & | elementName, | |||
| const KDFrame & | frame | |||
| ) | [static] |
Creates a DOM element node that represents a frame for use in a DOM document.
| document | the DOM document to which the node will belong | |
| parent | the parent node to which the new node will be appended | |
| elementName | the name of the new node | |
| frame | the frame to be represented |
| static void KDFrame::createFrameProfileNode | ( | QDomDocument & | document, | |
| QDomNode & | parent, | |||
| const QString & | elementName, | |||
| KDFrameProfile | profile | |||
| ) | [static] |
Creates a DOM element node that represents a frame profile for use in a DOM document.
| document | the DOM document to which the node will belong | |
| parent | the parent node to which the new node will be appended | |
| elementName | the name of the new node | |
| profile | the profile to be represented |
| static bool KDFrame::readFrameNode | ( | const QDomElement & | element, | |
| KDFrame & | frame | |||
| ) | [static] |
Reads data from a DOM element node that represents a frame object and fills a KDFrame object with the data.
| element | the DOM element to read from | |
| frame | the frame object to read the data into |
| static bool KDFrame::readFrameProfileNode | ( | const QDomElement & | element, | |
| KDFrameProfile & | profile | |||
| ) | [static] |
Reads data from a DOM element node that represents a frame profile and fills a KDFrameProfile object with the data.
| element | the DOM element to read from | |
| profile | the frame profile object to read the data into |
| void KDFrame::changed | ( | ) | [signal] |
This signal is emitted when any of the frame parameters has changed.
| void KDFrame::setProfileSectionsAutoDelete | ( | bool | on | ) | const [inline, private] |
| QTextStream& operator<< | ( | QTextStream & | s, | |
| const KDFrame & | p | |||
| ) | [friend] |
| QTextStream& operator>> | ( | QTextStream & | s, | |
| KDFrame & | p | |||
| ) | [friend] |
int KDFrame::_shadowWidth [private] |
Stores the width of the shadow.
CornerName KDFrame::_sunPos [private] |
Stores the position of the sun.
QBrush KDFrame::_background [private] |
Stores the brush to be used to fill the inner area.
QPixmap KDFrame::_backPixmap [private] |
Stores the pixmap to be painted into the inner area.
BackPixmapMode KDFrame::_backPixmapMode [private] |
Stores the way how to display the pixmap that is to be painted into the inner area.
QRect KDFrame::_innerRect [private] |
Stores the position and size of the frame.
KDFrameProfile KDFrame::_profileSections [private] |
Stores all currently used profile settings for a controlled deletion.
KDFrameProfile KDFrame::_topProfile [private] |
Stores the profile settings for the top side of the frame.
KDFrameProfile KDFrame::_rightProfile [private] |
Stores the profile settings for the right side of the frame.
KDFrameProfile KDFrame::_bottomProfile [private] |
Stores the profile settings for the bottom side of the frame.
KDFrameProfile KDFrame::_leftProfile [private] |
Stores the profile settings for the left side of the frame.
KDFrameCorner KDFrame::_cornerTL [private] |
Stores the settings for the top left corner of the frame.
KDFrameCorner KDFrame::_cornerTR [private] |
Stores the settings for the top right corner of the frame.
KDFrameCorner KDFrame::_cornerBL [private] |
Stores the settings for the bottom left corner of the frame.
KDFrameCorner KDFrame::_cornerBR [private] |
Stores the settings for the bottom right corner of the frame.
1.5.6