parameterswidget.h 2.46 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30
/*
* KmPlot - a math. function plotter for the KDE-Desktop
*
* Copyright (C) 2006 David Saxton <david@bluehaze.org>
*               
* This file is part of the KDE Project.
* KmPlot is part of the KDE-EDU Project.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
* 
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
* GNU General Public License for more details.
* 
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
*/

#ifndef _PARAMETERSWIDGET_H
#define _PARAMETERSWIDGET_H

#include <QGroupBox>
#include <QList>

#include "ui_parameterswidget.h"
Peter Hedlund's avatar
Peter Hedlund committed
31
#include "function.h"
32

33 34
class EquationEdit;

35 36 37 38 39 40 41 42 43 44
class ParametersWidget : public QGroupBox, public Ui_ParametersWidget
{
	Q_OBJECT
	public:
		ParametersWidget( QWidget * parent );
		
		/**
		 * Initializes the contents of the widgets to the settings in
		 * \p function.
		 */
45
		void init( const ParameterSettings & parameters );
46
		/**
47
		 * \return the current settings as specified in the widgets.
48
		 */
49
		ParameterSettings parameterSettings() const;
50 51 52 53 54 55 56 57
		/**
		 * The ParametersWidget can make sure that when the user wants to use
		 * a parameter (i.e. the Use List checkbox or Use Slider checkbox is
		 * checked), the function string has a parameter variable. Use this
		 * to add an EquationEdit for a function string that ParametersWidget
		 * will update when necessary.
		 */
		void associateEquationEdit( EquationEdit * edit );
58 59 60 61 62 63 64
		
	signals:
		/**
		 * Emitted when the user edits the list of parameters.
		 */
		void parameterListChanged();
		
65
	private slots:
66 67 68 69
		/**
		 * Called when the "Edit [parameter] List" button is clicked.
		 */
		void editParameterList();
70 71 72 73
		/**
		 * Called when one of the checkboxes is checked.
		 */
		void updateEquationEdits();
74 75 76 77 78 79 80
		
	protected:
		/**
		 * If we are currently editing a cartesian function, this will be set
		 * to its parameter list.
		 */
		QList<Value> m_parameters;
81 82 83 84
		/**
		 * The list of equation edits that may be updated. See sassociateEquationEdit.
		 */
		QList<EquationEdit*> m_equationEdits;
85 86 87
};

#endif