Main Page | Class Hierarchy | Alphabetical List | Compound List | File List | Compound Members | File Members | Related Pages

QwtScaleIf Class Reference

An interface class for widgets containing a scale. More...

#include <qwt_sclif.h>

Inheritance diagram for QwtScaleIf:

QwtKnob QwtSlider QwtThermo List of all members.

Public Member Functions

 QwtScaleIf ()
virtual ~QwtScaleIf ()
void setScale (double vmin, double vmax, int logarithmic=0)
void setScale (double vmin, double vmax, double step, int logarithmic=0)
void setScale (const QwtScaleDiv &s)
void setScaleMaxMajor (int ticks)
void setScaleMaxMinor (int ticks)
void autoScale ()
int scaleMaxMinor () const
int scaleMaxMajor () const
void setScaleDraw (QwtScaleDraw *)
const QwtScaleDrawscaleDraw () const

Protected Member Functions

bool hasUserScale ()
virtual void scaleChange ()=0
QwtScaleDrawscaleDraw ()

Protected Attributes

QwtScaleDrawd_scaleDraw
int d_maxMajor
int d_maxMinor

Private Attributes

bool d_userScale

Detailed Description

An interface class for widgets containing a scale.

This interface class is used to provide classes with a protected QwtScaleDraw member and a public interface to access that scale.

For internal use only.

The primary purpose of this class is to define a common interface for classes which are supposed to contain a ScaleDraw class. It provides a protected ScaleDraw member called d_scale and a couple of public member functions which allow direct but restricted access to this scale by the user.

Widgets derived from this class have to implement the member function scaleChange(), which is called to notify changes of the scale parameters and usually requires repainting or resizing respectively.

In general, a class derived from QwtScaleIf is expected to manage the division and the position of its scale internally when no user-defined scale is set. It should take the d_maxMinor and d_maxMajor members into account, which can be set by the user. An implementation can check if a user-defined scale is set by calling the hasUserScale() member.

Definition at line 46 of file qwt_sclif.h.


Constructor & Destructor Documentation

QwtScaleIf::QwtScaleIf  ) 
 

Constructor.

Definition at line 13 of file qwt_sclif.cpp.

References d_maxMajor, d_maxMinor, d_scaleDraw, d_userScale, and QwtScaleDraw::setScale().

QwtScaleIf::~QwtScaleIf  )  [virtual]
 

Destructor.

Definition at line 24 of file qwt_sclif.cpp.

References d_scaleDraw.


Member Function Documentation

void QwtScaleIf::autoScale  ) 
 

Advise the widget to control the scale range internally.

Autoscaling is on by default.

See also:
QwtScaleIf::setScale()

Definition at line 99 of file qwt_sclif.cpp.

References d_userScale, and scaleChange().

bool QwtScaleIf::hasUserScale  )  [inline, protected]
 

Check for user-defined scale.

Definition at line 68 of file qwt_sclif.h.

Referenced by QwtSlider::rangeChange(), QwtKnob::rangeChange(), QwtSlider::scaleChange(), and QwtThermo::setRange().

virtual void QwtScaleIf::scaleChange  )  [protected, pure virtual]
 

Notify changed scale.

Implemented in QwtKnob, QwtSlider, and QwtThermo.

Referenced by autoScale(), setScale(), setScaleMaxMajor(), and setScaleMaxMinor().

QwtScaleDraw * QwtScaleIf::scaleDraw  )  [protected]
 

Returns:
scale draw
See also:
QwtScaleIf::setScaleDraw

Definition at line 168 of file qwt_sclif.cpp.

References d_scaleDraw.

const QwtScaleDraw * QwtScaleIf::scaleDraw  )  const
 

Returns:
scale draw
See also:
QwtScaleIf::setScaleDraw

Definition at line 177 of file qwt_sclif.cpp.

References d_scaleDraw.

int QwtScaleIf::scaleMaxMajor  )  const [inline]
 

Returns:
max. number of major tick intervals

Definition at line 61 of file qwt_sclif.h.

int QwtScaleIf::scaleMaxMinor  )  const [inline]
 

Returns:
max. number of minor tick intervals

Definition at line 59 of file qwt_sclif.h.

void QwtScaleIf::setScale const QwtScaleDiv s  ) 
 

Assign a user-defined scale division

Parameters:
s scale division

Definition at line 81 of file qwt_sclif.cpp.

References d_maxMajor, d_maxMinor, d_scaleDraw, d_userScale, QwtScaleDiv::majCnt(), QwtScaleDiv::minCnt(), scaleChange(), QwtScaleDraw::scaleDiv(), and QwtScaleDraw::setScale().

void QwtScaleIf::setScale double  vmin,
double  vmax,
double  step,
int  logarithmic = 0
 

Specify a user-defined scale.

By default, the widget is supposed to control the range of its scale automatically, but sometimes it is desirable to have a user-defined scale which is not in sync with the widget's range, e.g. if a logarithmic scale is needed (sliders don't support that) or if the scale is required to have a fixed range (say 0...100%), independent of the widget's range.

Parameters:
vmin 
vmax interval boundaries
step major step size
logarithmic If != 0, build a logarithmic scale
See also:
QwtScaleIf::autoScale()

Definition at line 66 of file qwt_sclif.cpp.

References d_maxMajor, d_maxMinor, d_scaleDraw, d_userScale, scaleChange(), QwtScaleDraw::scaleDiv(), and QwtScaleDraw::setScale().

void QwtScaleIf::setScale double  vmin,
double  vmax,
int  logarithmic = 0
 

Specify a user-defined scale.

By default, the widget is supposed to control the range of its scale automatically, but sometimes it is desirable to have a user-defined scale which is not in sync with the widget's range, e.g. if a logarithmic scale is needed (sliders don't support that) or if the scale is required to have a fixed range (say 0...100%), independent of the widget's range.

Parameters:
vmin 
vmax boundary values
logarithmic If != 0, Build a logarithmic scale
See also:
QwtScaleIf::autoScale()

Definition at line 44 of file qwt_sclif.cpp.

void QwtScaleIf::setScaleDraw QwtScaleDraw sd  ) 
 

Set a scale draw sd has to be created with new and will be deleted in QwtScaleIf::~QwtScaleIf or the next call of QwtScaleIf::setScaleDraw.

Definition at line 155 of file qwt_sclif.cpp.

References d_scaleDraw.

void QwtScaleIf::setScaleMaxMajor int  ticks  ) 
 

Set the maximum number of major tick intervals.

The scale's major ticks are calculated automatically such that the number of major intervals does not exceed ticks. The default value is 5.

Parameters:
ticks maximal number of major ticks.
See also:
QwtScaleDraw

Definition at line 117 of file qwt_sclif.cpp.

References d_maxMajor, d_maxMinor, d_scaleDraw, QwtScaleDiv::hBound(), QwtScaleDiv::lBound(), QwtScaleDiv::logScale(), scaleChange(), QwtScaleDraw::scaleDiv(), and QwtScaleDraw::setScale().

void QwtScaleIf::setScaleMaxMinor int  ticks  ) 
 

Set the maximum number of minor tick intervals.

The scale's minor ticks are calculated automatically such that the number of minor intervals does not exceed ticks. The default value is 3.

Parameters:
ticks 
See also:
QwtScaleDraw

Definition at line 138 of file qwt_sclif.cpp.

References d_maxMajor, d_maxMinor, d_scaleDraw, QwtScaleDiv::hBound(), QwtScaleDiv::lBound(), QwtScaleDiv::logScale(), scaleChange(), QwtScaleDraw::scaleDiv(), and QwtScaleDraw::setScale().


Member Data Documentation

int QwtScaleIf::d_maxMajor [protected]
 

Definition at line 75 of file qwt_sclif.h.

Referenced by QwtThermo::init(), QwtScaleIf(), QwtSlider::rangeChange(), QwtKnob::rangeChange(), QwtSlider::scaleChange(), QwtThermo::setRange(), setScale(), setScaleMaxMajor(), and setScaleMaxMinor().

int QwtScaleIf::d_maxMinor [protected]
 

Definition at line 76 of file qwt_sclif.h.

Referenced by QwtThermo::init(), QwtScaleIf(), QwtSlider::rangeChange(), QwtKnob::rangeChange(), QwtSlider::scaleChange(), QwtThermo::setRange(), setScale(), setScaleMaxMajor(), and setScaleMaxMinor().

QwtScaleDraw* QwtScaleIf::d_scaleDraw [protected]
 

Definition at line 74 of file qwt_sclif.h.

Referenced by QwtThermo::draw(), QwtSlider::draw(), QwtKnob::draw(), QwtSlider::getScrollMode(), QwtSlider::getValue(), QwtThermo::init(), QwtKnob::layoutKnob(), QwtSlider::layoutSlider(), QwtThermo::layoutThermo(), QwtThermo::minimumSizeHint(), QwtSlider::minimumSizeHint(), QwtKnob::minimumSizeHint(), QwtKnob::QwtKnob(), QwtScaleIf(), QwtSlider::QwtSlider(), QwtSlider::rangeChange(), QwtKnob::rangeChange(), QwtSlider::scaleChange(), scaleDraw(), QwtThermo::setRange(), setScale(), setScaleDraw(), setScaleMaxMajor(), setScaleMaxMinor(), QwtKnob::setTotalAngle(), QwtThermo::sizePolicy(), QwtSlider::xyPosition(), and ~QwtScaleIf().

bool QwtScaleIf::d_userScale [private]
 

Definition at line 79 of file qwt_sclif.h.

Referenced by autoScale(), QwtScaleIf(), and setScale().


The documentation for this class was generated from the following files:
Generated on Fri Nov 7 14:11:49 2003 for Qwt Developer's Guide by doxygen 1.3.2