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
|
/***************************************************************************
propertysetter.cpp - description
-------------------
begin : gio lug 24 2003
copyright : (C) 2003 by gulmini luciano
email : [email protected]
***************************************************************************/
/***************************************************************************
* *
* 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. *
* *
***************************************************************************/
#include "propertysetter.h"
#include <tqlineedit.h>
#include <tqcombobox.h>
#include <tqspinbox.h>
#include <tqlabel.h>
#include <tqtooltip.h>
#include <tqregexp.h>
#include <tqvbox.h>
#include <kpushbutton.h>
#include <kdebug.h>
#include <kdialog.h>
#include <kiconloader.h>
#include <tdelocale.h>
#include <klineedit.h>
#include "csseditor_globals.h"
#include "minieditor.h"
propertySetter::propertySetter(TQWidget *parent, const char *name ) : TQHBox(parent,name) {
m_ind = 0;
m_cb = 0L;
m_list.setAutoDelete(true);
m_pb = 0L;
setSpacing( KDialog::spacingHint() );
}
propertySetter::~propertySetter(){
reset();
}
void propertySetter::reset(){
if(!m_list.isEmpty()) m_list.clear();
if(m_pb) {
delete m_pb;
m_pb=0L;
}
m_ind=0;
}
void propertySetter::setComboBox()
{
m_cb = new TQComboBox(this);
connect(m_cb, TQT_SIGNAL(activated(const TQString&)), this, TQT_SIGNAL(valueChanged(const TQString&)));
connect(m_cb, TQT_SIGNAL(textChanged(const TQString&)), this, TQT_SIGNAL(valueChanged(const TQString&)));
m_list.append(m_cb);
}
void propertySetter::setSpinBox(const TQString& initialValue, const TQString& min, const TQString& max, const TQString& s)
{
mySpinBox *editor = new mySpinBox(min.toInt(), max.toInt(), 1, this);
editor->setSuffix(s);
editor->setValue(initialValue.toInt());
connect(editor, TQT_SIGNAL(valueChanged(const TQString&)), this ,TQT_SIGNAL(valueChanged(const TQString&)));
m_list.append(editor);
}
void propertySetter::setLineEdit()
{
TQLineEdit *editor = new TQLineEdit(this);
connect(editor,TQT_SIGNAL(textChanged ( const TQString & )), this, TQT_SIGNAL(valueChanged ( const TQString & )));
m_list.append(editor);
}
void propertySetter::setPredefinedColorListEditor()
{
TQComboBox *editor = new TQComboBox(this);
editor->insertStringList(CSSEditorGlobals::HTMLColors);
connect(editor, TQT_SIGNAL(activated(const TQString&)), this, TQT_SIGNAL(valueChanged(const TQString&)));
m_list.append(editor);
}
void propertySetter::Show(){
TQWidget *w;
for ( w = m_list.first(); w; w = m_list.next() )
w->hide();
m_list.at(m_ind)->show();
if(m_list.count() == 1) {
if(m_pb)
m_pb->hide();
}
else
if(m_ind<(m_list.count()-1)) {
m_ind++;
m_pb->show();
}
else
m_ind=0;
}
void propertySetter::addButton(){
m_pb = new KPushButton(this);
TQToolTip::add(m_pb, i18n( "More..." ));
TQIconSet iconSet = SmallIconSet(TQString::fromLatin1("2rightarrow"));
TQPixmap pixMap = iconSet.pixmap( TQIconSet::Small, TQIconSet::Normal );
m_pb->setIconSet(iconSet);
m_pb->setFixedSize( pixMap.width()+8, pixMap.height()+8 );
m_pb->hide();
connect(m_pb, TQT_SIGNAL(clicked()), this ,TQT_SLOT(Show()));
}
void propertySetter::installMiniEditor(miniEditor *m){
m->connectToPropertySetter(this);
m_list.append(m);
}
#include "propertysetter.moc"
|