File: mspinbox.h

package info (click to toggle)
scribus 1.3.3.13.dfsg~svn20081228-2
  • links: PTS
  • area: main
  • in suites: squeeze
  • size: 54,668 kB
  • ctags: 14,434
  • sloc: cpp: 165,840; ansic: 8,920; python: 3,149; xml: 419; makefile: 114; perl: 94; sh: 69
file content (127 lines) | stat: -rw-r--r-- 3,559 bytes parent folder | download | duplicates (2)
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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
/*
For general Scribus (>=1.3.2) copyright and licensing information please refer
to the COPYING file provided with the program. Following this notice may exist
a copyright and/or license notice that predates the release of Scribus 1.3.2
for which a new license (GPL+exception) is in place.
*/
/***************************************************************************
                          mspinbox.h  -  description
                             -------------------
    begin                : Sat Jun 16 2001
    copyright            : (C) 2001 by Franz Schmid
    email                : Franz.Schmid@altmuehlnet.de
 ***************************************************************************/

/***************************************************************************
 *                                                                         *
 *   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.                                   *
 *                                                                         *
 ***************************************************************************/

#ifndef MSPINBOX_H
#define MSPINBOX_H

#include <qmap.h>
#include <qspinbox.h>
#include <qstring.h>
#include "scribusapi.h"

class FunctionParser;

/** \brief Enthanced QSpinBox
  *@author Franz Schmid
  */
class SCRIBUS_API MSpinBox : public QSpinBox  
{
	Q_OBJECT
	
public:
	/*!
	\author Franz Schmid
	\param pa Parent Widget
	\param s Number of Decimals
	*/
	MSpinBox(QWidget *pa, int s);
	/*!
	\author Franz Schmid
	\param minValue minimal bound
	\param maxValue maximal bound
	\param pa Parent Widget
	\param s Number of Decimals
	*/
	MSpinBox(double minValue, double maxValue, QWidget *pa, int s);
	~MSpinBox() {};
	/*!
	\author Franz Schmid
	\brief Returns the current Value of the SpinBox
	\retval double The Value
	 */
	double value();
	/*!
	\author Franz Schmid
	\brief Gets the Minimum Value of the Spinbox
	\retval The Value
	*/
	double minValue();
	/*!
	\author Franz Schmid
	\brief Gets the Maximim Value of the Spinbox
	\retval The Value
	*/
	double maxValue();
	QString mapValueToText(int value);
	/*!
	\author Franz Schmid
	\brief Maps the Text of the Spinbox to the Value, does Unit Conversion and Calculations
	\param ok not used
	\retval int The Value
	*/
	int mapTextToValue(bool *ok);
	void setTabAdvance(bool enable);
	int Decimals;
	int Width;
	bool tabAdvance;
	QLineEdit *ed;
	void setDecimals( int deci );
	bool isReadOnly() const;
	void setConstants(const QMap<QString, double>&);

public slots:
	void textChanged();
	void stepDown();
	/*!
	\author Franz Schmid
	\brief Sets the Maximum Value of the Spinbox
	\param val new Value
	 */
	void setMaxValue(double val);
	/*!
	\author Franz Schmid
	\brief Sets the Minimum Value of the Spinbox
	\param val new Value
	*/
	void setMinValue(double val);
	/*!
	\author Franz Schmid
	\brief Sets the Value of the Spinbox
	\param val new Value
	*/
	void setValue(double val);
	void setReadOnly(bool ro);
	void setValues(double min, double max, int deci, double val);
	void getValues(double *min, double *max, int *deci, double *val);

protected:
	bool eventFilter( QObject* ob, QEvent* ev );
	void setParameters( int s );
	void setFPConstants(FunctionParser &fp);
	bool readOnly;
	int oldLineStep;
	bool edited;
	QMap <QString, double> functionParserConstants;
};

#endif