File: delay.h

package info (click to toggle)
ksimus-boolean 0.3.6-13
  • links: PTS
  • area: main
  • in suites: lenny
  • size: 3,296 kB
  • ctags: 768
  • sloc: sh: 8,092; cpp: 4,980; perl: 2,029; makefile: 102
file content (147 lines) | stat: -rw-r--r-- 4,194 bytes parent folder | download | duplicates (3)
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
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
/***************************************************************************
                          delay.h  -  description
                             -------------------
    begin                : Tue Jun 18 2002
    copyright            : (C) 2002 by Rasmus Diekenbrock
    email                : ksimus@gmx.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 DELAY_H
#define DELAY_H

// C-Includes

// QT-Includes
#include <qbitarray.h>

// KDE-Includes

// KSimus-Includes
#include "ksimus/compview.h"
#include "ksimus/componentinfo.h"
#include "ksimus/ksimtime.h"
#include "ksimus/boolean1out.h"

// Project-Includes

// Forward declaration
class ConnectorBoolIn;
class KSimTimeSpinBox;


namespace KSimLibBoolean
{

const ComponentInfo * getDelayInfo();


//###############################################################
//###############################################################

/**A Delay.
  *@author Rasmus Diekenbrock
  */

class Delay : public Boolean1Out
{
	Q_OBJECT

public:
	Delay(CompContainer * container, const ComponentInfo * ci);
//	~Delay();

	/** Executes the simulation of this component */
	virtual void calculate();
	/** Reset all simulation variables */
	virtual void reset();

	/** save component properties */
	virtual void save(KSimData & file) const;
	/** load component properties
	*   copyLoad is true, if the load function is used as a copy function
	*	Returns true if successful */
	virtual bool load(KSimData & file, bool copyLoad);

	/** Creates the general property page for the property dialog.
	  * This function creeates a @ref DelayPropertyGeneralWidget.
	  * This function is called by @ref addGeneralProperty*/
	virtual ComponentPropertyBaseWidget * createGeneralProperty(QWidget *parent);

	ConnectorBoolIn * getInputConnector() const { return m_input; };

	void setDelayTime(const KSimTimeBase & delay) { m_delayTime = delay; };
	const KSimTimeBase & getDelayTime()const { return m_delayTime; };

private:
	ConnectorBoolIn * m_input;
	KSimTime m_delayTime;
	bool m_lastState;
	unsigned int m_counter;
	unsigned int m_index;
	QBitArray m_list;
};

//###############################################################
//###############################################################


class DelayView : public CompView
{
public:
	DelayView(Delay * comp, eViewType viewType);
//	~DelayView();
	virtual void draw(QPainter * p);
	
	Delay * getDelay() const { return (Delay*) getComponent(); };

};


//###############################################################
//###############################################################

class DelayPropertyGeneralWidget : public Boolean1OutPropertyGeneralWidget
{
	Q_OBJECT

public:
	DelayPropertyGeneralWidget(Delay * comp, QWidget *parent=0, const char *name=0);
//	~DelayPropertyGeneralWidget();


	/** The function acceptPressed() is called, if changes are accepted.
		You have to reimplement this function, if you add new properties.
		If you do so, then first call function changeData() and than changed data!
	 */
	virtual void acceptPressed();
	/** The function defaultPressed() is called, if user wants to set the default values.
		You have to reimplement this slot, if you add new properties.
	 */
	virtual void defaultPressed();

	Delay * getDelay() const { return (Delay*) getComponent(); };

private slots:
	void slotChanged(const KSimTime & time);


private:
	KSimTimeSpinBox * m_delayTime;
	QLabel * m_delayTimeHint;
};
//###############################################################



} //namespace KSimLibBoolean

#endif