#include <math.h>
-/*********************************************************************
-** Class: QtxColorScale
-** Descr: Color Scale widget.
-** Level: Public
-*********************************************************************/
-
+/*!
+ Constructor
+*/
QtxColorScale::QtxColorScale( QWidget* parent, const char* name, WFlags f )
: QFrame( parent, name, f | WResizeNoErase | WRepaintNoErase ),
myDock( 0 ),
setCaption( tr ( "Color scale" ) );
}
+/*!
+ Constructor
+*/
QtxColorScale::QtxColorScale( const int num, QWidget* parent, const char* name, WFlags f )
: QFrame( parent, name, f | WResizeNoErase | WRepaintNoErase ),
myDock( 0 ),
#if QT_VER == 3
+/*!
+ Constructor
+*/
QtxColorScale::QtxColorScale( Dock* dock, const char* name, WFlags f )
: QFrame( dock, name, f | WResizeNoErase | WRepaintNoErase ),
myMin( 0.0 ),
#endif
+/*!
+ Destructor
+*/
QtxColorScale::~QtxColorScale()
{
}
-//================================================================
-// Function : minimum
-// Purpose : Returns minimal limit of scale.
-//================================================================
-
+/*!
+ \returns minimal limit of scale.
+*/
double QtxColorScale::minimum() const
{
return myMin;
}
-//================================================================
-// Function : maximum
-// Purpose : Returns maximal limit of scale.
-//================================================================
-
+/*!
+ \return maximal limit of scale.
+*/
double QtxColorScale::maximum() const
{
return myMax;
}
-//================================================================
-// Function : range
-// Purpose : Returns range (minimal and maximal limits) of scale.
-//================================================================
-
+/*!
+ \return range (minimal and maximal limits) of scale.
+*/
void QtxColorScale::range( double& min, double& max ) const
{
min = myMin;
max = myMax;
}
-//================================================================
-// Function : title
-// Purpose : Returns the current title string.
-//================================================================
-
+/*!
+ \return the current title string.
+*/
QString QtxColorScale::title() const
{
return myTitle;
}
-//================================================================
-// Function : format
-// Purpose : Returns the current format of number presentation in
-// labels for Auto label mode (sprintf specification).
-//================================================================
-
+/*!
+ \returns the current format of number presentation in labels for Auto label mode (sprintf specification).
+*/
QString QtxColorScale::format() const
{
return myFormat;
}
-//================================================================
-// Function : dumpMode
-// Purpose : Returns dump mode.
-//================================================================
-
+/*!
+ \return dump mode.
+*/
int QtxColorScale::dumpMode() const
{
return myDumpMode;
}
-//================================================================
-// Function : labelMode
-// Purpose : Returns label mode.
-//================================================================
-
+/*!
+ \return label mode.
+*/
int QtxColorScale::labelMode() const
{
return myLabelMode;
}
-//================================================================
-// Function : colorMode
-// Purpose : Returns color mode.
-//================================================================
-
+/*!
+ \return color mode.
+*/
int QtxColorScale::colorMode() const
{
return myColorMode;
}
-//================================================================
-// Function : intervalsNumber
-// Purpose : Returns intervals number of color scale.
-//================================================================
-
+/*!
+ \return intervals number of color scale.
+*/
int QtxColorScale::intervalsNumber() const
{
return myInterval;
}
-//================================================================
-// Function : label
-// Purpose : Returns the user label of specified interval.
-//================================================================
-
+/*!
+ \return the user label of specified interval.
+*/
QString QtxColorScale::label( const int idx ) const
{
QString res;
return res;
}
-//================================================================
-// Function : color
-// Purpose : Returns the user color of specified interval.
-//================================================================
-
+/*!
+ \return the user color of specified interval.
+*/
QColor QtxColorScale::color( const int idx ) const
{
QColor res;
return res;
}
-//================================================================
-// Function : labels
-// Purpose : Returns the user labels.
-//================================================================
-
+/*!
+ \return the user labels.
+*/
void QtxColorScale::labels( QStringList& list ) const
{
list = myLabels;
}
-//================================================================
-// Function : colors
-// Purpose : Returns the user color.
-//================================================================
-
+/*!
+ \return the user color.
+*/
void QtxColorScale::colors( QValueList<QColor>& list ) const
{
list = myColors;
}
-//================================================================
-// Function : labelPosition
-// Purpose : Returns the label position.
-//================================================================
-
+/*!
+ \return the label position.
+*/
int QtxColorScale::labelPosition() const
{
return myLabelPos;
}
-//================================================================
-// Function : titlePosition
-// Purpose : Returns the title position.
-//================================================================
-
+/*!
+ \return the title position.
+*/
int QtxColorScale::titlePosition() const
{
return myTitlePos;
}
-//================================================================
-// Function : setMinimum
-// Purpose : Sets the minimum limit.
-//================================================================
-
+/*!
+ Sets the minimum limit.
+*/
void QtxColorScale::setMinimum( const double val )
{
setRange( val, maximum() );
}
-//================================================================
-// Function : setMaximum
-// Purpose : Sets the maximum limit.
-//================================================================
-
+/*!
+ Sets the maximum limit.
+*/
void QtxColorScale::setMaximum( const double val )
{
setRange( minimum(), val );
}
-//================================================================
-// Function : setRange
-// Purpose : Sets the minimum and maximum limits.
-//================================================================
-
+/*!
+ Sets the minimum and maximum limits.
+*/
void QtxColorScale::setRange( const double min, const double max )
{
if ( myMin == min && myMax == max )
updateScale();
}
-//================================================================
-// Function : setTitle
-// Purpose : Sets the title string.
-//================================================================
-
+/*!
+ Sets the title string.
+*/
void QtxColorScale::setTitle( const QString& str )
{
if ( myTitle == str )
updateScale();
}
-//================================================================
-// Function : setFormat
-// Purpose : Sets the format of number presentation in labels for
-// Auto label mode (sprintf specification).
-//================================================================
-
+/*!
+ Sets the format of number presentation in labels for
+ Auto label mode (sprintf specification).
+*/
void QtxColorScale::setFormat( const QString& format )
{
if ( myFormat == format )
updateScale();
}
-//================================================================
-// Function : setIntervalsNumber
-// Purpose : Sets the number of intervals.
-//================================================================
-
+/*!
+ Sets the number of intervals.
+*/
void QtxColorScale::setIntervalsNumber( const int num )
{
if ( myInterval == num || num < 1 )
updateScale();
}
-//================================================================
-// Function : setLabel
-// Purpose : Sets the user label for specified interval. If number
-// of interval is negative then user label will be added
-// as new at the end of list.
-//================================================================
-
+/*!
+ Sets the user label for specified interval. If number
+ of interval is negative then user label will be added
+ as new at the end of list.
+*/
void QtxColorScale::setLabel( const QString& txt, const int idx )
{
bool changed = false;
updateScale();
}
-//================================================================
-// Function : setColor
-// Purpose : Sets the user color for specified interval. If number
-// of interval is negative then user color will be added
-// as new at the end of list.
-//================================================================
-
+/*!
+ Sets the user color for specified interval. If number
+ of interval is negative then user color will be added
+ as new at the end of list.
+*/
void QtxColorScale::setColor( const QColor& clr, const int idx )
{
bool changed = false;
updateScale();
}
-//================================================================
-// Function : setLabels
-// Purpose : Replace the all user label with specified list.
-//================================================================
-
+/*!
+ Replace the all user label with specified list.
+*/
void QtxColorScale::setLabels( const QStringList& list )
{
if ( list.isEmpty() )
updateScale();
}
-//================================================================
-// Function : setColors
-// Purpose : Replace the all user colors with specified list.
-//================================================================
-
+/*!
+ Replace the all user colors with specified list.
+*/
void QtxColorScale::setColors( const QValueList<QColor>& list )
{
if ( list.isEmpty() )
updateScale();
}
-//================================================================
-// Function : setColorMode
-// Purpose : Sets the color mode (Auto or User).
-//================================================================
-
+/*!
+ Sets the color mode (Auto or User).
+*/
void QtxColorScale::setColorMode( const int mode )
{
if ( myColorMode == mode )
updateScale();
}
-//================================================================
-// Function : setDumpMode
-// Purpose : Sets the dump mode.
-//================================================================
-
+/*!
+ Sets the dump mode.
+*/
void QtxColorScale::setDumpMode( const int mode )
{
myDumpMode = mode;
}
-//================================================================
-// Function : setLabelMode
-// Purpose : Sets the label mode (Auto or User).
-//================================================================
-
+/*!
+ Sets the label mode (Auto or User).
+*/
void QtxColorScale::setLabelMode( const int mode )
{
if ( myLabelMode != mode )
}
}
-//================================================================
-// Function : setLabelPosition
-// Purpose : Sets the label position.
-//================================================================
-
+/*!
+ Sets the label position.
+*/
void QtxColorScale::setLabelPosition( const int pos )
{
if ( myLabelPos != pos && pos >= None && pos <= Center )
}
}
-//================================================================
-// Function : setTitlePosition
-// Purpose : Sets the title position.
-//================================================================
-
+/*!
+ Sets the title position.
+*/
void QtxColorScale::setTitlePosition( const int pos )
{
if ( myTitlePos != pos && pos >= None && pos <= Center )
}
}
-//================================================================
-// Function : setFlags
-// Purpose : Set the specified flags.
-//================================================================
-
+/*!
+ Set the specified flags.
+*/
void QtxColorScale::setFlags( const int flags )
{
int prev = myFlags;
updateScale();
}
-//================================================================
-// Function : testFlags
-// Purpose : Returns true if specified flags are setted.
-//================================================================
-
+/*!
+ \return true if specified flags are setted.
+*/
bool QtxColorScale::testFlags( const int flags ) const
{
return ( myFlags & flags ) == flags;
}
-//================================================================
-// Function : clearFlags
-// Purpose : Clear (reset) the specified flags.
-//================================================================
-
+/*!
+ Clear (reset) the specified flags.
+*/
void QtxColorScale::clearFlags( const int flags )
{
int prev = myFlags;
updateScale();
}
-//================================================================
-// Function : minimumSizeHint
-// Purpose :
-//================================================================
-
+/*!
+ \return minimum size hint
+*/
QSize QtxColorScale::minimumSizeHint() const
{
QSize sz = calculateSize( true, myFlags, titlePosition() != None, labelPosition() != None, true );
return sz + QSize( frameWidth(), frameWidth() );
}
-//================================================================
-// Function : sizeHint
-// Purpose :
-//================================================================
-
+/*!
+ \return size hint
+*/
QSize QtxColorScale::sizeHint() const
{
QSize sz = calculateSize( false, myFlags, titlePosition() != None, labelPosition() != None, true );
return sz + QSize( frameWidth(), frameWidth() );
}
-//================================================================
-// Function : calculateSize
-// Purpose : Dump color scale into pixmap with current size.
-//================================================================
-
+/*!
+ Dump color scale into pixmap with current size.
+*/
QSize QtxColorScale::calculateSize( const bool min, const int flags, const bool title,
const bool labels, const bool colors ) const
{
return QSize( W, H );
}
-//================================================================
-// Function : dump
-// Purpose : Dump color scale into pixmap with current size.
-//================================================================
-
+/*!
+ Dump color scale into pixmap with current size.
+*/
QPixmap QtxColorScale::dump() const
{
QPixmap aPix;
return aPix;
}
-//================================================================
-// Function : dump
-// Purpose : Dump color scale into pixmap with specified size.
-//================================================================
-
+/*!
+ Dump color scale into pixmap with specified size.
+*/
QPixmap QtxColorScale::dump( const int w, const int h ) const
{
#if QT_VER < 3
#endif
}
-//================================================================
-// Function : dump
-// Purpose : Dump color scale into pixmap with specified size
-// and background color.
-//================================================================
-
+/*!
+ Dump color scale into pixmap with specified size and background color.
+*/
QPixmap QtxColorScale::dump( const QColor& bg, const int w, const int h ) const
{
QPixmap aPix;
return aPix;
}
-//================================================================
-// Function : show
-// Purpose : Show the color scale. [Reimplemented]
-//================================================================
-
+/*!
+ Show the color scale. [Reimplemented]
+*/
void QtxColorScale::show()
{
#if QT_VER == 3
QFrame::show();
}
-//================================================================
-// Function : hide
-// Purpose : Hides the color scale. [Reimplemented]
-//================================================================
-
+/*!
+ Hides the color scale. [Reimplemented]
+*/
void QtxColorScale::hide()
{
#if QT_VER == 3
QFrame::hide();
}
-//================================================================
-// Function : drawContents
-// Purpose : Draw color scale contents. [Reimplemented]
-//================================================================
-
+/*!
+ Draw color scale contents. [Reimplemented]
+*/
void QtxColorScale::drawContents( QPainter* p )
{
if ( !isUpdatesEnabled() )
titlePosition() != None, labelPosition() != None, true );
}
-//================================================================
-// Function : drawScale
-// Purpose : Draw color scale contents.
-//================================================================
-
+/*!
+ Draw color scale contents.
+*/
void QtxColorScale::drawScale( QPainter* p, const bool transp, const int X, const int Y,
const int W, const int H, const bool title,
const bool label, const bool scale ) const
p->drawPixmap( X, Y, cache );
}
-//================================================================
-// Function : drawScale
-// Purpose : Draw color scale contents.
-//================================================================
-
+/*!
+ Draw color scale contents.
+*/
void QtxColorScale::drawScale( QPainter* p, const QColor& bg, const bool transp,
const int X, const int Y, const int W, const int H,
const bool drawTitle, const bool drawLabel, const bool drawColors ) const
}
}
-//================================================================
-// Function : getFormat
-// Purpose : Returns the format for number labels.
-//================================================================
-
+/*!
+ \return the format for number labels.
+*/
QString QtxColorScale::getFormat() const
{
QString aFormat = format();
return aFormat;
}
-//================================================================
-// Function : getNumber
-// Purpose : Returns the number for specified interval.
-//================================================================
-
+/*!
+ \return the number for specified interval.
+*/
double QtxColorScale::getNumber( const int idx ) const
{
double val = 0;
return val;
}
-//================================================================
-// Function : getLabel
-// Purpose : Returns the label for specified interval according
-// to the current label mode.
-//================================================================
-
+/*!
+ \return the label for specified interval according to the current label mode.
+*/
QString QtxColorScale::getLabel( const int idx ) const
{
QString res;
return res;
}
-//================================================================
-// Function : getColor
-// Purpose : Returns the color for specified interval according
-// to the current color mode.
-//================================================================
-
+/*!
+ \return the color for specified interval according to the current color mode.
+*/
QColor QtxColorScale::getColor( const int idx ) const
{
QColor res;
return res;
}
-//================================================================
-// Function : updateScale
-// Purpose : Update color scale if it required.
-//================================================================
-
+/*!
+ Update color scale if it required.
+*/
void QtxColorScale::updateScale()
{
update();
updateGeometry();
}
-//================================================================
-// Function : simpleRichText
-// Purpose : Return QSimpleRichText object for title. If title
-// not defined (empty string) then return null pointer.
-// Object should be deleted by caller function.
-//================================================================
-
+/*!
+ \return QSimpleRichText object for title. If title
+ not defined (empty string) then return null pointer.
+ Object should be deleted by caller function.
+*/
QSimpleRichText* QtxColorScale::simpleRichText( const int flags ) const
{
QSimpleRichText* srt = 0;
#if QT_VER == 3
-/*********************************************************************
-** Class: QtxColorScale::Dock
-** Descr: Dockable window contains the color scale.
-** Level: Public
-*********************************************************************/
-
-//================================================================
-// Function : Dock
-// Purpose : Constructor.
-//================================================================
+/*!
+ \class QtxColorScale::Dock
+ Dockable window contains the color scale.
+*/
+/*!
+ Constructor
+*/
QtxColorScale::Dock::Dock( Place p, QWidget* parent, const char* name, WFlags f )
: QDockWindow( p, parent, name, f ),
myBlockShow( false ),
setCaption( tr ( "Color scale" ) );
}
-//================================================================
-// Function : ~Dock
-// Purpose : Destructor.
-//================================================================
-
+/*!
+ Destructor.
+*/
QtxColorScale::Dock::~Dock()
{
}
-//================================================================
-// Function : colorScale
-// Purpose : Returns color scale widget.
-//================================================================
-
+/*!
+ \return color scale widget.
+*/
QtxColorScale* QtxColorScale::Dock::colorScale() const
{
return myScale;
}
-//================================================================
-// Function : activate
-// Purpose : Set the dockable window is visible for main window.
-//================================================================
-
+/*!
+ Set the dockable window is visible for main window.
+*/
void QtxColorScale::Dock::activate()
{
if ( myBlockShow )
mw->setAppropriate( this, true );
}
-//================================================================
-// Function : deactivate
-// Purpose : Set the dockable window is hidden for main window.
-//================================================================
-
+/*!
+ Set the dockable window is hidden for main window.
+*/
void QtxColorScale::Dock::deactivate()
{
if ( myBlockShow )
mw->setAppropriate( this, false );
}
-//================================================================
-// Function : isActive
-// Purpose : Returns true if the dockable window is visible.
-//================================================================
-
+/*!
+ \return true if the dockable window is visible.
+*/
bool QtxColorScale::Dock::isActive() const
{
QMainWindow* mw = 0;
return false;
}
-//================================================================
-// Function : show
-// Purpose : Reimplemented for internal reasons.
-//================================================================
-
+/*!
+ Redefined show
+*/
void QtxColorScale::Dock::show()
{
bool f = myBlockShow;
myBlockShow = f;
}
-//================================================================
-// Function : hide
-// Purpose : Reimplemented for internal reasons.
-//================================================================
-
+/*!
+ Redefined hide
+*/
void QtxColorScale::Dock::hide()
{
bool f = myBlockShow;
myBlockShow = f;
}
-//================================================================
-// Function : resize
-// Purpose : Make extent width as maximum value of widget width.
-//================================================================
-
+/*!
+ Make extent width as maximum value of widget width.
+*/
void QtxColorScale::Dock::resize( int w, int h )
{
QDockWindow::resize( w, h );
setFixedExtentHeight( QMAX( fixedExtent().height(), h ) );
}
-//================================================================
-// Function : setOrientation
-// Purpose :
-//================================================================
-
+/*!
+ Set orientation
+ \param o - new orientation
+*/
void QtxColorScale::Dock::setOrientation( Orientation o )
{
bool b = myBlockResize;