21#include "linestyleedit.h"
22#include "editoritem.h"
26#include <tqcombobox.h>
33 static const char *nopen[]={
36 "................................................",
37 "................................................",
38 "................................................",
39 "................................................",
40 "................................................",
41 "................................................",
42 "................................................",
43 "................................................",
44 "................................................",
45 "................................................",
46 "................................................",
47 "................................................",
48 "................................................",
49 "................................................",
50 "................................................",
51 "................................................"};
53 static const char *solid[]={
57 "................................................",
58 "................................................",
59 "................................................",
60 "................................................",
61 "................................................",
62 "................................................",
63 "................................................",
64 ".###########################################....",
65 ".###########################################....",
66 "................................................",
67 "................................................",
68 "................................................",
69 "................................................",
70 "................................................",
71 "................................................",
72 "................................................"};
74 static const char *dash[]={
78 "................................................",
79 "................................................",
80 "................................................",
81 "................................................",
82 "................................................",
83 "................................................",
84 "................................................",
85 ".#########..#########..#########..##########....",
86 ".#########..#########..#########..##########....",
87 "................................................",
88 "................................................",
89 "................................................",
90 "................................................",
91 "................................................",
92 "................................................",
93 "................................................"};
95 static const char *dashdot[]={
99 "................................................",
100 "................................................",
101 "................................................",
102 "................................................",
103 "................................................",
104 "................................................",
105 "................................................",
106 ".#########..##..#########..##..#########..##....",
107 ".#########..##..#########..##..#########..##....",
108 "................................................",
109 "................................................",
110 "................................................",
111 "................................................",
112 "................................................",
113 "................................................",
114 "................................................"};
116 static const char *dashdotdot[]={
120 "................................................",
121 "................................................",
122 "................................................",
123 "................................................",
124 "................................................",
125 "................................................",
126 "................................................",
127 ".#########..##..##..#########..##..##..#####....",
128 ".#########..##..##..#########..##..##..#####....",
129 "................................................",
130 "................................................",
131 "................................................",
132 "................................................",
133 "................................................",
134 "................................................",
135 "................................................"};
138LineStyleEdit::LineStyleEdit( Property *property, TQWidget *parent, const char *name)
141 TQHBoxLayout *l = new TQHBoxLayout( this, 0, 0);
142 m_edit = new TQComboBox( this);
143 m_edit->setSizePolicy(TQSizePolicy::Expanding, TQSizePolicy::Expanding);
144 m_edit->setMinimumHeight(5);
145 l->addWidget(m_edit);
147 m_edit->insertItem(TQPixmap(nopen));
148 m_edit->insertItem(TQPixmap(solid));
149 m_edit->insertItem(TQPixmap(dash));
150 m_edit->insertItem(TQPixmap(dashdot));
151 m_edit->insertItem(TQPixmap(dashdotdot));
153 setLeavesTheSpaceForRevertButton( true);
154 setFocusWidget(m_edit);
155 connect(m_edit, TQ_SIGNAL(activated( int)), this, TQ_SLOT(slotValueChanged( int)));
158LineStyleEdit::~LineStyleEdit()
164 return m_edit->currentItem();
168LineStyleEdit::setValue( const TQVariant &value, bool emitChange)
170 if (!value.canCast(TQVariant::Int))
172 if ((value.toInt() > 5) || (value.toInt() < 0))
175 m_edit->blockSignals( true);
176 m_edit->setCurrentItem(value.toInt());
177 m_edit->blockSignals( false);
179 emit valueChanged( this);
183LineStyleEdit::drawViewer(TQPainter *p, const TQColorGroup &, const TQRect &r, const TQVariant &value)
187 if (!value.canCast(TQVariant::Int))
191 switch (value.toInt()) {
193 px = TQPixmap(nopen);
196 px = TQPixmap(solid);
202 px = TQPixmap(dashdot);
205 px = TQPixmap(dashdotdot);
210 p->drawPixmap(r.left()+KPROPEDITOR_ITEM_MARGIN, r.top()+(r.height()-px.height())/2, px);
214LineStyleEdit::slotValueChanged( int)
216 emit valueChanged( this);
220LineStyleEdit::setReadOnlyInternal( bool readOnly)
225#include "linestyleedit.moc"
The base class representing a single property.
const char * name(StdAction id)
Namespace for a set of classes implementing generic properties framework.
|