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::FrameStyle
FrameStyle
Definition: qwt_column_symbol.h:123
QwtColumnRect::toRect
QRectF toRect() const
Definition: qwt_column_symbol.h:54
QwtText
A class representing a text.
Definition: qwt_text.h:51
QwtColumnRect
Directed rectangle representing bounding rectangle and orientation of a column.
Definition: qwt_column_symbol.h:28
QwtColumnRect::QwtColumnRect
QwtColumnRect()
Build an rectangle with invalid intervals directed BottomToTop.
Definition: qwt_column_symbol.h:48
QwtColumnRect::LeftToRight
From left to right.
Definition: qwt_column_symbol.h:35
QwtColumnSymbol
A drawing primitive for columns.
Definition: qwt_column_symbol.h:93
QwtColumnRect::vInterval
QwtInterval vInterval
Interval for the vertical coordinates.
Definition: qwt_column_symbol.h:86
QwtColumnSymbol::Box
Definition: qwt_column_symbol.h:109
QwtColumnRect::hInterval
QwtInterval hInterval
Interval for the horizontal coordinates.
Definition: qwt_column_symbol.h:83
QwtColumnRect::RightToLeft
From right to left.
Definition: qwt_column_symbol.h:38
QwtColumnRect::direction
Direction direction
Direction.
Definition: qwt_column_symbol.h:89
QwtInterval
A class representing an interval.
Definition: qwt_interval.h:26
QwtInterval::ExcludeMaximum
Max value is not included in the interval.
Definition: qwt_interval.h:42
QwtColumnRect::BottomToTop
From bottom to top.
Definition: qwt_column_symbol.h:41
QwtColumnSymbol::Plain
A plain frame style.
Definition: qwt_column_symbol.h:129
QwtInterval::ExcludeMinimum
Min value is not included in the interval.
Definition: qwt_interval.h:39
QwtColumnSymbol::NoFrame
No frame.
Definition: qwt_column_symbol.h:126
QwtColumnSymbol::Style
Style
Definition: qwt_column_symbol.h:100
QwtColumnRect::orientation
Qt::Orientation orientation() const
Definition: qwt_column_symbol.h:74
QwtColumnRect::Direction
Direction
Direction of the column.
Definition: qwt_column_symbol.h:32