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

qwt_plot_item.cpp

00001 /* -*- mode: C++ ; c-file-style: "stroustrup" -*- *****************************
00002  * Qwt Widget Library
00003  * Copyright (C) 1997   Josef Wilgen
00004  * Copyright (C) 2002   Uwe Rathmann
00005  * 
00006  * This library is free software; you can redistribute it and/or
00007  * modify it under the terms of the Qwt License, Version 1.0
00008  *****************************************************************************/
00009 
00010 #include "qwt_plot.h"
00011 #include "qwt_plot_item.h"
00012 
00014 QwtPlotItem::QwtPlotItem(QwtPlot *parent, bool nbl)
00015 {
00016     d_parent = parent;
00017     d_enabled = nbl;
00018 }
00019 
00021 QwtPlotItem::~QwtPlotItem()
00022 {
00023 }
00024 
00026 void QwtPlotItem::reparent(QwtPlot *parent)
00027 {
00028     d_parent = parent;
00029 }
00030 
00035 void QwtPlotItem::setEnabled(bool tf) 
00036 { 
00037     if ( tf != d_enabled )
00038     {
00039         d_enabled = tf; 
00040         itemChanged(); 
00041     }
00042 }
00043 
00048 bool QwtPlotItem::enabled()  const
00049 { 
00050     return d_enabled; 
00051 }
00052 
00054 void QwtPlotItem::itemChanged()
00055 {
00056     if ( d_parent )
00057         d_parent->autoRefresh();
00058 }
00059 
00061 
00062 QwtPlotMappedItem::QwtPlotMappedItem(QwtPlot *parent, bool nbl): 
00063     QwtPlotItem(parent, nbl)
00064 {
00065     d_xAxis = QwtPlot::xBottom;
00066     d_yAxis = QwtPlot::yLeft;
00067 }
00068 
00070 void QwtPlotMappedItem::setAxis(int xAxis, int yAxis)
00071 {
00072     if (xAxis == QwtPlot::xBottom || xAxis == QwtPlot::xTop )
00073        d_xAxis = xAxis;
00074 
00075     if (yAxis == QwtPlot::yLeft || yAxis == QwtPlot::yRight )
00076        d_yAxis = yAxis;
00077 
00078     itemChanged();    
00079 }
00080 
00082 void QwtPlotMappedItem::setXAxis(int axis)
00083 {
00084     if (axis == QwtPlot::xBottom || axis == QwtPlot::xTop )
00085     {
00086        d_xAxis = axis;
00087        itemChanged();    
00088     }
00089 }
00090 
00092 void QwtPlotMappedItem::setYAxis(int axis)
00093 {
00094     if (axis == QwtPlot::yLeft || axis == QwtPlot::yRight )
00095     {
00096        d_yAxis = axis;
00097        itemChanged();   
00098     }
00099 }
00100 
00102 int QwtPlotMappedItem::xAxis() const 
00103 { 
00104     return d_xAxis; 
00105 }
00106 
00108 int QwtPlotMappedItem::yAxis() const 
00109 { 
00110     return d_yAxis; 
00111 }

Generated on Sun Nov 21 11:12:43 2004 for Qwt User's Guide by doxygen 1.3.5