summaryrefslogtreecommitdiffstats
path: root/libksirtet/lib/pline.h
blob: 2defd10a0af2f7ac72e45fc462d5394645d33a65 (plain)
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
#ifndef PLINE_H
#define PLINE_H

#include <qframe.h>
#include <qscrollbar.h>
#include <qlineedit.h>
#include <qlabel.h>
#include <qptrlist.h>
#include <qlayout.h>

#include "types.h"

class QPushButton;

/** Internal class : display a "player line" in netmeeting. */
class MeetingLine : public QFrame
{
 Q_OBJECT

 public:
    MeetingLine(bool isOwner, bool readerIsServer, bool serverLine,
				QWidget *parent, const char *name = 0);

	MeetingCheckBox::Type type() const { return tcb->type(); }
	void setType(MeetingCheckBox::Type type) { tcb->setType(type); }
	void setText(const QString &text) { qle->setText(text); }

	void setData(const ExtData &ed);
	void data(ExtData &ed) const;
	QString text() const { return qle->text(); }

 signals:
	void typeChanged(MeetingCheckBox::Type);
	void textChanged(const QString &);

 private slots:
	void _typeChanged(int t)
		{ emit typeChanged((MeetingCheckBox::Type)t); }
	void _textChanged(const QString &text) { emit textChanged(text); }

 protected:
	QHBoxLayout *hbl;

 private:
	MeetingCheckBox       *tcb;
	QLabel                *lname, *labH, *labAI;
	QValueList<BoardData>  bds;
	QLineEdit             *qle;
};

class PlayerLine : public QFrame
{
 Q_OBJECT

 public:
	PlayerLine(PlayerComboBox::Type type, const QString &txt,
			   bool humanSetting, bool AISetting,
			   bool canBeEmpty, bool acceptAI,
			   QWidget *parent = 0, const char *name = 0);

	PlayerComboBox::Type type() const { return pcb->type(); }
	QString name() const { return edit->text(); }

 signals:
	void setHuman();
	void setAI();
	void typeChanged(int);

 private slots:
	void setSlot();
	void typeChangedSlot(int);

 private:
	PlayerComboBox *pcb;
	QLineEdit      *edit;
	QPushButton    *setting;
	bool            hs, as;
};

/** Internal class : scrolable list of widgets. */
class GWidgetList : public QWidget
{
 Q_OBJECT

 public:
	GWidgetList(uint interval, QWidget *parent = 0, const char * name = 0);

	void remove(uint i);
	uint size() const { return widgets.count(); }

 protected:
	/** The widget must be created with this widget as parent. */
	void append(QWidget *);
	QWidget *widget(uint i) { return widgets.at(i); }

 private:
	QPtrList<QWidget> widgets;
	QVBoxLayout vbl;
};

template <class Type>
class WidgetList : public GWidgetList
{
 public:
	WidgetList(uint interval, QWidget *parent=0, const char *name=0)
	: GWidgetList(interval, parent, name) {}

	void append(Type *w) { GWidgetList::append(w); }
	Type *widget(uint i) { return (Type *)GWidgetList::widget(i); }
};

#endif // PLINE_H