kchart

#include <KDFrame.h>

Classes

class  KDFrameCorner

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 TQString backPixmapModeToString (BackPixmapMode type)
static BackPixmapMode stringToBackPixmapMode (const TQString &string)
void setSimpleFrame (SimpleFrame frame, int lineWidth, int midLineWidth, TQPen pen, TQBrush background=TQBrush(), const TQPixmap *backPixmap=0, BackPixmapMode backPixmapMode=PixStretched)
void clearProfile (ProfileName name)
void addProfileSection (ProfileName name, int wid, TQPen 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 TQString cornerNameToString (CornerName type)
static CornerName stringToCornerName (const TQString &string)
static TQString cornerStyleToString (CornerStyle type)
static CornerStyle stringToCornerStyle (const TQString &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 (TQBrush background=TQBrush(TQt::NoBrush))
void setBackPixmap (const TQPixmap *backPixmap=0, BackPixmapMode backPixmapMode=PixStretched)
const TQBrush & background (const TQPixmap *&backPixmap, BackPixmapMode &backPixmapMode) const
void setInnerRect (TQRect innerRect)
TQRect innerRect () const
virtual void paintBackground (TQPainter &painter, const TQRect &innerRect) const
virtual void paintEdges (TQPainter &painter, const TQRect &innerRect) const
virtual void paintCorners (TQPainter &painter, const TQRect &innerRect) const
virtual void paint (TQPainter *painter, KDFramePaintSteps steps=PaintAll, TQRect innerRect=TQRect(0, 0, 0, 0)) const
void clearAll ()

Signals

void changed ()

Public Member Functions

 KDFrame (TQRect innerRect=TQRect(0, 0, 0, 0), SimpleFrame frame=FrameFlat, int lineWidth=1, int midLineWidth=0, TQPen pen=TQPen(), TQBrush background=TQBrush(), const TQPixmap *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 (TQDomDocument &document, TQDomNode &parent, const TQString &elementName, const KDFrame &frame)
static void createFrameProfileNode (TQDomDocument &document, TQDomNode &parent, const TQString &elementName, KDFrameProfile profile)
static bool readFrameNode (const TQDomElement &element, KDFrame &frame)
static bool readFrameProfileNode (const TQDomElement &element, KDFrameProfile &profile)

Friends

TQTextStream & operator<< (TQTextStream &s, const KDFrame &p)
TQTextStream & operator>> (TQTextStream &s, KDFrame &p)

Detailed Description

The main class of KDFrame.

KDFrame is made for highly configurable rectangular frame drawing.

A frame may consist of an (optional) border and/or an (optional) background. \ifndef 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.

Note
Each of the edges and each of the corners may use their own user-definable profile.

The frame corners ( see types defined in CornerStyle ) are set up via setCorner()

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()

Definition at line 87 of file KDFrame.h.

Member Enumeration Documentation

◆ BackPixmapMode

These are ways how to display a pixmap that might be painted into the inner area.

\Note To have a 'tiled' background image do not use a background pixmap but use a background brush holding this pixmap.

Definition at line 109 of file KDFrame.h.

◆ CornerName

Deprecated
Feature scheduled for future release, at present not implemented.

Definition at line 349 of file KDFrame.h.

◆ CornerStyle

Deprecated
Feature scheduled for future release, at present not implemented.

Definition at line 425 of file KDFrame.h.

◆ KDFramePaintSteps

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
See also
paint

Definition at line 843 of file KDFrame.h.

◆ ProfileName

Deprecated
Feature scheduled for future release, at present not implemented.

Definition at line 241 of file KDFrame.h.

◆ 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

All pre-defined frames have normal corners.

Definition at line 177 of file KDFrame.h.

Constructor & Destructor Documentation

◆ KDFrame()

KDFrame::KDFrame ( TQRect innerRect = TQRect(0,0,0,0),
SimpleFrame frame = FrameFlat,
int lineWidth = 1,
int midLineWidth = 0,
TQPen pen = TQPen(),
TQBrush background = TQBrush(),
const TQPixmap * 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...

Note
The rectangle applies to the inner area of the frame. The Frame is drawn around this area: touching it but not covering it. The outer size of the frame and the position of its outer left corner depends from the frame profile width.

\Note To have a 'tiled' background image do not specify a backPixmap but use a background brush holding this pixmap.

See also
rect, setInnerRect, setProfile

Definition at line 917 of file KDFrame.h.

◆ ~KDFrame()

KDFrame::~KDFrame ( )
virtual

Destructor.

Only defined to have it virtual.

Definition at line 47 of file KDFrame.cpp.

Member Function Documentation

◆ addProfileSection

void KDFrame::addProfileSection ( ProfileName name,
int wid,
TQPen pen,
KDFrameProfileSection::Direction dir = KDFrameProfileSection::DirPlain,
KDFrameProfileSection::Curvature curv = KDFrameProfileSection::CvtPlain )
slot

Deprecated
Feature scheduled for future release, at present not implemented.

Definition at line 200 of file KDFrame.cpp.

◆ background

const TQBrush & KDFrame::background ( const TQPixmap *& backPixmap,
BackPixmapMode & backPixmapMode ) const
inlineslot

Returns the brush that is used to fill the inner area of this frame, or a TQBrush( \cNoBrush ) if no background is to be drawn.

Parameters
backPixmapreceives the pixmap used for drawing the background or a null pixmap, test this by calling backPixmap.isNull()

\Note If a 'tiled' background image is shown the respective pixmap may be found by calling the brush's pixmap() function.

See also
setBackground, setBackPixmap

Definition at line 763 of file KDFrame.h.

◆ backPixmapModeToString

TQString KDFrame::backPixmapModeToString ( BackPixmapMode type)
inlinestaticslot

Converts the specified background pixmap mode enum to a string representation.

Parameters
typethe background pixmap mode to convert
Returns
the string representation of the background pixmap mode enum

Definition at line 120 of file KDFrame.h.

◆ changed

void KDFrame::changed ( )
signal

This signal is emitted when any of the frame parameters has changed.

◆ clearAll

void KDFrame::clearAll ( )
inlineslot

Remove all settings and specify no border, no edges, no background.

Definition at line 879 of file KDFrame.h.

◆ clearProfile

void KDFrame::clearProfile ( ProfileName name)
slot

Deprecated
Feature scheduled for future release, at present not implemented.

Definition at line 186 of file KDFrame.cpp.

◆ cornerNameToString

TQString KDFrame::cornerNameToString ( CornerName type)
inlinestaticslot

Deprecated
Feature scheduled for future release, at present not implemented.

Definition at line 366 of file KDFrame.h.

◆ cornerProfile

const KDFrameProfile & KDFrame::cornerProfile ( CornerName name) const
inlineslot

Deprecated
Feature scheduled for future release, at present not implemented.

Definition at line 677 of file KDFrame.h.

◆ cornerStyle

CornerStyle KDFrame::cornerStyle ( CornerName name) const
inlineslot

Deprecated
Feature scheduled for future release, at present not implemented.

Definition at line 635 of file KDFrame.h.

◆ cornerStyleToString

TQString KDFrame::cornerStyleToString ( CornerStyle type)
inlinestaticslot

Deprecated
Feature scheduled for future release, at present not implemented.

Definition at line 440 of file KDFrame.h.

◆ cornerWidth

int KDFrame::cornerWidth ( CornerName name) const
inlineslot

Deprecated
Feature scheduled for future release, at present not implemented.

Definition at line 656 of file KDFrame.h.

◆ createFrameNode()

void KDFrame::createFrameNode ( TQDomDocument & document,
TQDomNode & parent,
const TQString & elementName,
const KDFrame & frame )
static

Creates a DOM element node that represents a frame for use in a DOM document.

Parameters
documentthe DOM document to which the node will belong
parentthe parent node to which the new node will be appended
elementNamethe name of the new node
framethe frame to be represented

Definition at line 407 of file KDFrame.cpp.

◆ createFrameProfileNode()

void KDFrame::createFrameProfileNode ( TQDomDocument & document,
TQDomNode & parent,
const TQString & elementName,
KDFrameProfile profile )
static

Creates a DOM element node that represents a frame profile for use in a DOM document.

Parameters
documentthe DOM document to which the node will belong
parentthe parent node to which the new node will be appended
elementNamethe name of the new node
profilethe profile to be represented

Definition at line 445 of file KDFrame.cpp.

◆ deepCopy()

void KDFrame::deepCopy ( KDFrame & D,
const KDFrame & R )
inlinestatic

Definition at line 985 of file KDFrame.h.

◆ innerRect

TQRect KDFrame::innerRect ( ) const
inlineslot

Returns the position and the size of the frame.

Note
The rectangle returns to the inner area of the frame. The Frame is drawn around this area: touching it but not covering it. The outer size of the frame and the position of its outer left corner depends from the frame profile width.
See also
setInnerRect, setProfile

Definition at line 797 of file KDFrame.h.

◆ paint

void KDFrame::paint ( TQPainter * painter,
KDFramePaintSteps steps = PaintAll,
TQRect innerRect = TQRect(0,0,0,0) ) const
virtualslot

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 );.

Parameters
painterThe TQPainter to be used for drawing.
stepsThe 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.
innerRectThe 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.

Definition at line 156 of file KDFrame.cpp.

◆ paintBackground

void KDFrame::paintBackground ( TQPainter & painter,
const TQRect & innerRect ) const
virtualslot

Paint methode drawing the background (if any) of the frame.

Note
Under normal circumstances you will never have to call this methode since it is called internally by paint() if you start it with PaintBackground (or with PaintAll, resp.) for the steps parameter.

Definition at line 61 of file KDFrame.cpp.

◆ paintCorners

void KDFrame::paintCorners ( TQPainter & painter,
const TQRect & innerRect ) const
virtualslot

Paint methode drawing the corners (if any) of the frame.

Note
Under normal circumstances you will never have to call this methode since it is called internally by paint() if you start it with PaintCorners (or with PaintAll, PaintBorder, resp.) for the steps parameter.

Definition at line 147 of file KDFrame.cpp.

◆ paintEdges

void KDFrame::paintEdges ( TQPainter & painter,
const TQRect & innerRect ) const
virtualslot

Paint methode drawing the edges (if any) of the frame.

Note
Under normal circumstances you will never have to call this methode since it is called internally by paint() if you start it with PaintEdges (or with PaintAll, PaintBorder, resp.) for the steps parameter.

Definition at line 112 of file KDFrame.cpp.

◆ profile

const KDFrameProfile & KDFrame::profile ( ProfileName name) const
slot

Deprecated
Feature scheduled for future release, at present not implemented.

Definition at line 232 of file KDFrame.cpp.

◆ readFrameNode()

bool KDFrame::readFrameNode ( const TQDomElement & element,
KDFrame & frame )
static

Reads data from a DOM element node that represents a frame object and fills a KDFrame object with the data.

Parameters
elementthe DOM element to read from
framethe frame object to read the data into

Definition at line 475 of file KDFrame.cpp.

◆ readFrameProfileNode()

bool KDFrame::readFrameProfileNode ( const TQDomElement & element,
KDFrameProfile & profile )
static

Reads data from a DOM element node that represents a frame profile and fills a KDFrameProfile object with the data.

Parameters
elementthe DOM element to read from
profilethe frame profile object to read the data into

Definition at line 556 of file KDFrame.cpp.

◆ setBackground

void KDFrame::setBackground ( TQBrush background = TQBrush( TQt::NoBrush ))
inlineslot

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 TQBrush( \cTQt::NoBrush ).

\Note To have a 'tiled' background image just use a brush holding this pixmap - for other ways to show background images please use setBackPixmap.

See also
setBackPixmap, background

Definition at line 730 of file KDFrame.h.

◆ setBackPixmap

void KDFrame::setBackPixmap ( const TQPixmap * backPixmap = 0,
BackPixmapMode backPixmapMode = PixStretched )
inlineslot

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.

\Note To have a 'tiled' background image do not use setBackPixmap but use setBackground specifying a brush holding the pixmap.

See also
setBackground, background

Definition at line 744 of file KDFrame.h.

◆ setCorner

void KDFrame::setCorner ( CornerName name,
CornerStyle style,
int width,
KDFrameProfile *const profile = 0 )
inlineslot

Deprecated
Feature scheduled for future release, at present not implemented.

Definition at line 586 of file KDFrame.h.

◆ setCorners

void KDFrame::setCorners ( CornerStyle style,
int width,
KDFrameProfile *const profile = 0 )
inlineslot

Deprecated
Feature scheduled for future release, at present not implemented.

Definition at line 615 of file KDFrame.h.

◆ setInnerRect

void KDFrame::setInnerRect ( TQRect innerRect)
inlineslot

Specifies the position and the size of area that is surrounded by the frame.

Note
The rectangle applies to the inner area of the frame. The Frame is drawn around this area: touching it but not covering it. The outer size of the frame and the position of its outer left corner depends from the frame profile width(s).
See also
innerRect, setCorners, setSimpleFrame, setProfile

Definition at line 782 of file KDFrame.h.

◆ setProfile

void KDFrame::setProfile ( ProfileName name,
const KDFrameProfile & profile )
slot

Deprecated
Feature scheduled for future release, at present not implemented.

Definition at line 218 of file KDFrame.cpp.

◆ setSimpleFrame

void KDFrame::setSimpleFrame ( SimpleFrame frame,
int lineWidth,
int midLineWidth,
TQPen pen,
TQBrush background = TQBrush(),
const TQPixmap * backPixmap = 0,
BackPixmapMode backPixmapMode = PixStretched )
slot

Deprecated
Feature scheduled for future release, at present not implemented.

Definition at line 248 of file KDFrame.cpp.

◆ setSunPos

void KDFrame::setSunPos ( CornerName sunPos)
inlineslot

Deprecated
Feature scheduled for future release, at present not implemented.

Definition at line 699 of file KDFrame.h.

◆ stringToBackPixmapMode

BackPixmapMode KDFrame::stringToBackPixmapMode ( const TQString & string)
inlinestaticslot

Converts the specified string to a background pixmap mode enum value.

Parameters
stringthe string to convert
Returns
the background pixmap mode enum value

Definition at line 140 of file KDFrame.h.

◆ stringToCornerName

CornerName KDFrame::stringToCornerName ( const TQString & string)
inlinestaticslot

Deprecated
Feature scheduled for future release, at present not implemented.

Definition at line 394 of file KDFrame.h.

◆ stringToCornerStyle

CornerStyle KDFrame::stringToCornerStyle ( const TQString & string)
inlinestaticslot

Deprecated
Feature scheduled for future release, at present not implemented.

Definition at line 464 of file KDFrame.h.

◆ sunPos

CornerName KDFrame::sunPos ( ) const
inlineslot

Deprecated
Feature scheduled for future release, at present not implemented.

Definition at line 713 of file KDFrame.h.

◆ operator<<

TQTextStream & operator<< ( TQTextStream & s,
const KDFrame & p )
friend

Writes the KDFrame object p as an XML document to the text stream s.

Parameters
sthe text stream to write to
pthe KDFrame object to write
Returns
the text stream after the write operation

◆ operator>>

TQTextStream & operator>> ( TQTextStream & s,
KDFrame & p )
friend

Reads the an XML document from the text stream s into the KDFrame object p.

Parameters
sthe text stream to read from
pthe KDFrame object to read into
Returns
the text stream after the read operation

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