qwt_column_symbol.h
/* -*- mode: C++ ; c-file-style: "stroustrup" -*- *****************************
* Qwt Widget Library
* Copyright (C) 1997 Josef Wilgen
* Copyright (C) 2002 Uwe Rathmann
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the Qwt License, Version 1.0
*****************************************************************************/
#ifndef QWT_COLUMN_SYMBOL_H
#define QWT_COLUMN_SYMBOL_H
#include "qwt_global.h"
#include "qwt_interval.h"
#include <qpen.h>
#include <qsize.h>
#include <qrect.h>
class QPainter;
class QPalette;
class QRect;
class QwtText;
class QWT_EXPORT QwtColumnRect
{
public:
enum Direction
{
LeftToRight,
RightToLeft,
BottomToTop,
TopToBottom
};
QwtColumnRect():
direction( BottomToTop )
{
}
QRectF toRect() const
{
QRectF r( hInterval.minValue(), vInterval.minValue(),
hInterval.maxValue() - hInterval.minValue(),
vInterval.maxValue() - vInterval.minValue() );
r = r.normalized();
if ( hInterval.borderFlags() & QwtInterval::ExcludeMinimum )
r.adjust( 1, 0, 0, 0 );
if ( hInterval.borderFlags() & QwtInterval::ExcludeMaximum )
r.adjust( 0, 0, -1, 0 );
if ( vInterval.borderFlags() & QwtInterval::ExcludeMinimum )
r.adjust( 0, 1, 0, 0 );
if ( vInterval.borderFlags() & QwtInterval::ExcludeMaximum )
r.adjust( 0, 0, 0, -1 );
return r;
}
Qt::Orientation orientation() const
{
if ( direction == LeftToRight || direction == RightToLeft )
return Qt::Horizontal;
return Qt::Vertical;
}
QwtInterval hInterval;
QwtInterval vInterval;
Direction direction;
};
class QWT_EXPORT QwtColumnSymbol
{
public:
enum Style
{
NoStyle = -1,
Box,
UserStyle = 1000
};
enum FrameStyle
{
NoFrame,
Plain,
Raised
};
public:
QwtColumnSymbol( Style = NoStyle );
virtual ~QwtColumnSymbol();
void setFrameStyle( FrameStyle );
FrameStyle frameStyle() const;
void setLineWidth( int width );
int lineWidth() const;
void setPalette( const QPalette & );
const QPalette &palette() const;
void setStyle( Style );
Style style() const;
virtual void draw( QPainter *, const QwtColumnRect & ) const;
protected:
void drawBox( QPainter *, const QwtColumnRect & ) const;
private:
class PrivateData;
PrivateData* d_data;
};
#endif
QwtColumnSymbol::Plain
@ Plain
A plain frame style.
Definition: qwt_column_symbol.h:129
QwtColumnRect::orientation
Qt::Orientation orientation() const
Definition: qwt_column_symbol.h:74
QwtColumnRect::toRect
QRectF toRect() const
Definition: qwt_column_symbol.h:54
QwtInterval::ExcludeMaximum
@ ExcludeMaximum
Max value is not included in the interval.
Definition: qwt_interval.h:42
QwtColumnRect::QwtColumnRect
QwtColumnRect()
Build an rectangle with invalid intervals directed BottomToTop.
Definition: qwt_column_symbol.h:48
QwtColumnSymbol
A drawing primitive for columns.
Definition: qwt_column_symbol.h:94
QwtColumnRect::hInterval
QwtInterval hInterval
Interval for the horizontal coordinates.
Definition: qwt_column_symbol.h:83
QwtColumnSymbol::NoFrame
@ NoFrame
No frame.
Definition: qwt_column_symbol.h:126
QwtColumnSymbol::FrameStyle
FrameStyle
Definition: qwt_column_symbol.h:124
QwtText
A class representing a text.
Definition: qwt_text.h:52
QwtColumnRect::vInterval
QwtInterval vInterval
Interval for the vertical coordinates.
Definition: qwt_column_symbol.h:86
QwtColumnSymbol::Style
Style
Definition: qwt_column_symbol.h:101
QwtColumnRect::LeftToRight
@ LeftToRight
From left to right.
Definition: qwt_column_symbol.h:35
QwtInterval::ExcludeMinimum
@ ExcludeMinimum
Min value is not included in the interval.
Definition: qwt_interval.h:39
QwtColumnRect::Direction
Direction
Direction of the column.
Definition: qwt_column_symbol.h:33
QwtColumnSymbol::Box
@ Box
Definition: qwt_column_symbol.h:109
QwtColumnRect::RightToLeft
@ RightToLeft
From right to left.
Definition: qwt_column_symbol.h:38
QwtColumnRect
Directed rectangle representing bounding rectangle and orientation of a column.
Definition: qwt_column_symbol.h:29
QwtInterval
A class representing an interval.
Definition: qwt_interval.h:27
QwtColumnRect::direction
Direction direction
Direction.
Definition: qwt_column_symbol.h:89
QwtColumnRect::BottomToTop
@ BottomToTop
From bottom to top.
Definition: qwt_column_symbol.h:41