kexi

widgetfactory.cpp
1/* This file is part of the KDE project
2 Copyright (C) 2003 Lucijan Busch <lucijan@gmx.at>
3 Copyright (C) 2004 Cedric Pasteur <cedric.pasteur@free.fr>
4 Copyright (C) 2004-2006 Jaroslaw Staniek <js@iidea.pl>
5
6 This library is free software; you can redistribute it and/or
7 modify it under the terms of the GNU Library General Public
8 License as published by the Free Software Foundation; either
9 version 2 of the License, or (at your option) any later version.
10
11 This library is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 Library General Public License for more details.
15
16 You should have received a copy of the GNU Library General Public License
17 along with this library; see the file COPYING.LIB. If not, write to
18 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
19 * Boston, MA 02110-1301, USA.
20*/
21
22#include "widgetfactory.h"
23
24#include <tqcursor.h>
25#include <tqobjectlist.h>
26#include <tqdict.h>
27#include <tqmetaobject.h>
28
29#include <kdebug.h>
30#include <tdelocale.h>
31//#ifdef KEXI_KTEXTEDIT
32#include <ktextedit.h>
33//#else
34#include <klineedit.h>
35//#endif
36#include <kdialogbase.h>
37#include <keditlistbox.h>
38#include <kxmlguiclient.h>
39#include <tdeactioncollection.h>
40
41#include "richtextdialog.h"
42#include "editlistviewdialog.h"
43#include "resizehandle.h"
44#include "formmanager.h"
45#include "form.h"
46#include "container.h"
47#include "objecttree.h"
48#include "widgetlibrary.h"
49#include "utils.h"
50#include "widgetpropertyset.h"
51#include "widgetwithsubpropertiesinterface.h"
52#include <koproperty/property.h>
53
54using namespace KFormDesigner;
55
57
58WidgetInfo::WidgetInfo(WidgetFactory *f)
59 : m_inheritedClass(0)
60 , m_overriddenAlternateNames(0)
61 , m_factory(f)
62 , m_propertiesWithDisabledAutoSync(0)
63 , m_customTypesForProperty(0)
64{
65}
66
67WidgetInfo::WidgetInfo(WidgetFactory *f, const char* parentFactoryName,
68 const char* inheritedClassName)
69 : m_parentFactoryName( TQCString("kformdesigner_")+parentFactoryName )
70 , m_inheritedClassName(inheritedClassName)
71 , m_inheritedClass(0)
72 , m_overriddenAlternateNames(0)
73 , m_factory(f)
74 , m_propertiesWithDisabledAutoSync(0)
75 , m_customTypesForProperty(0)
76{
77 m_class = inheritedClassName;
78}
79
80WidgetInfo::~WidgetInfo()
81{
82 delete m_overriddenAlternateNames;
83 delete m_propertiesWithDisabledAutoSync;
84 delete m_customTypesForProperty;
85}
86
87void WidgetInfo::addAlternateClassName(const TQCString& alternateName, bool override)
88{
89 m_alternateNames += alternateName;
90 if (override) {
91 if (!m_overriddenAlternateNames)
92 m_overriddenAlternateNames = new TQAsciiDict<char>(101);
93 m_overriddenAlternateNames->insert(alternateName, (char*)1);
94 }
95 else {
96 if (m_overriddenAlternateNames)
97 m_overriddenAlternateNames->take(alternateName);
98 }
99}
100
101bool WidgetInfo::isOverriddenClassName(const TQCString& alternateName) const
102{
103 return m_overriddenAlternateNames && (m_overriddenAlternateNames->find(alternateName) != 0);
104}
105
106void WidgetInfo::setAutoSyncForProperty(const char *propertyName, tristate flag)
107{
108 if (!m_propertiesWithDisabledAutoSync) {
109 if (~flag)
110 return;
111 m_propertiesWithDisabledAutoSync = new TQAsciiDict<char>(101);
112 }
113
114 if (~flag) {
115 m_propertiesWithDisabledAutoSync->remove(propertyName);
116 }
117 else {
118 m_propertiesWithDisabledAutoSync->insert(propertyName, flag==true ? (char*)1 : (char*)2);
119 }
120}
121
122tristate WidgetInfo::autoSyncForProperty(const char *propertyName) const
123{
124 char* flag = m_propertiesWithDisabledAutoSync ? m_propertiesWithDisabledAutoSync->find(propertyName) : 0;
125 if (!flag)
126 return cancelled;
127 return flag==(char*)1 ? true : false;
128}
129
130void WidgetInfo::setCustomTypeForProperty(const char *propertyName, int type)
131{
132 if (!propertyName || type==KoProperty::Auto)
133 return;
134 if (!m_customTypesForProperty) {
135 m_customTypesForProperty = new TQMap<TQCString,int>();
136 }
137 m_customTypesForProperty->replace(propertyName, type);
138}
139
140int WidgetInfo::customTypeForProperty(const char *propertyName) const
141{
142 if (!m_customTypesForProperty || !m_customTypesForProperty->contains(propertyName))
143 return KoProperty::Auto;
144 return (*m_customTypesForProperty)[propertyName];
145}
146
147
149
150WidgetFactory::WidgetFactory(TQObject *parent, const char *name)
151 : TQObject(parent, (const char*)(TQCString("kformdesigner_")+name))
152{
153 m_showAdvancedProperties = true;
154 m_classesByName.setAutoDelete(true);
155 m_hiddenClasses = 0;
156 m_guiClient = 0;
157}
158
159WidgetFactory::~WidgetFactory()
160{
161 delete m_hiddenClasses;
162}
163
165{
166 WidgetInfo *oldw = m_classesByName[w->className()];
167 if (oldw==w)
168 return;
169 if (oldw) {
170 kdWarning() << "WidgetFactory::addClass(): class with name '" << w->className()
171 << "' already exists for factory '" << name() << "'" << endl;
172 return;
173 }
174 m_classesByName.insert( w->className(), w );
175}
176
177void WidgetFactory::hideClass(const char *classname)
178{
179 if (!m_hiddenClasses)
180 m_hiddenClasses = new TQAsciiDict<char>(101, false);
181 m_hiddenClasses->insert(classname, (char*)1);
182}
183
184void
185WidgetFactory::createEditor(const TQCString &classname, const TQString &text,
186 TQWidget *w, Container *container, TQRect geometry,
187 int align, bool useFrame, bool multiLine, BackgroundMode background)
188{
189//#ifdef KEXI_KTEXTEDIT
190 if (multiLine) {
191 KTextEdit *textedit = new KTextEdit(text, TQString(), w->parentWidget());
192 textedit->setTextFormat(TQt::PlainText);
193 textedit->setAlignment(align);
194 if (dynamic_cast<TQTextEdit*>(w)) {
195 textedit->setWordWrap(dynamic_cast<TQTextEdit*>(w)->wordWrap());
196 textedit->setWrapPolicy(dynamic_cast<TQTextEdit*>(w)->wrapPolicy());
197 }
198 textedit->setPalette(w->palette());
199 textedit->setFont(w->font());
200 textedit->setResizePolicy(TQScrollView::Manual);
201 textedit->setGeometry(geometry);
202 if(background == TQt::NoBackground)
203 textedit->setBackgroundMode(w->backgroundMode());
204 else
205 textedit->setBackgroundMode(background);
206// textedit->setPaletteBackgroundColor(textedit->colorGroup().color( TQColorGroup::Base ));
207 textedit->setPaletteBackgroundColor(w->paletteBackgroundColor());
208 for(int i =0; i <= textedit->paragraphs(); i++)
209 textedit->setParagraphBackgroundColor(i, w->paletteBackgroundColor());
210 textedit->selectAll(true);
211 textedit->setColor(w->paletteForegroundColor());
212 textedit->selectAll(false);
213 textedit->moveCursor(TQTextEdit::MoveEnd, false);
214 textedit->setParagraphBackgroundColor(0, w->paletteBackgroundColor());
215 textedit->setVScrollBarMode(TQScrollView::AlwaysOff); //ok?
216 textedit->setHScrollBarMode(TQScrollView::AlwaysOff); //ok?
217 textedit->installEventFilter(this);
218 textedit->setFrameShape(useFrame ? TQFrame::LineEditPanel : TQFrame::NoFrame);
219 textedit->setMargin(2); //to move away from resize handle
220 textedit->show();
221 textedit->setFocus();
222 textedit->selectAll();
223 setEditor(w, textedit);
224
225 connect(textedit, TQ_SIGNAL(textChanged()), this, TQ_SLOT(slotTextChanged()));
226 connect(w, TQ_SIGNAL(destroyed()), this, TQ_SLOT(widgetDestroyed()));
227 connect(textedit, TQ_SIGNAL(destroyed()), this, TQ_SLOT(editorDeleted()));
228//#else
229 }
230 else {
231 KLineEdit *editor = new KLineEdit(text, w->parentWidget());
232 editor->setAlignment(align);
233 editor->setPalette(w->palette());
234 editor->setFont(w->font());
235 editor->setGeometry(geometry);
236 if(background == TQt::NoBackground)
237 editor->setBackgroundMode(w->backgroundMode());
238 else
239 editor->setBackgroundMode(background);
240 editor->installEventFilter(this);
241 editor->setFrame(useFrame);
242 editor->setMargin(2); //to move away from resize handle
243 editor->show();
244 editor->setFocus();
245 editor->selectAll();
246 connect(editor, TQ_SIGNAL(textChanged(const TQString&)), this, TQ_SLOT(changeTextInternal(const TQString&)));
247 connect(w, TQ_SIGNAL(destroyed()), this, TQ_SLOT(widgetDestroyed()));
248 connect(editor, TQ_SIGNAL(destroyed()), this, TQ_SLOT(editorDeleted()));
249
250 setEditor(w, editor);
251// m_editor = editor;
252 }
253 //copy properties if available
255 TQWidget *subwidget = (subpropIface && subpropIface->subwidget()) ? subpropIface->subwidget() : w;
256 if (-1!=m_editor->metaObject()->findProperty("margin", true) && -1!=subwidget->metaObject()->findProperty("margin", true))
257 m_editor->setProperty("margin", subwidget->property("margin"));
258//#endif
259//js m_handles = new ResizeHandleSet(w, container->form(), true);
260 m_handles = container->form()->resizeHandlesForWidget(w);
261 if (m_handles) {
262 m_handles->setEditingMode(true);
263 m_handles->raise();
264 }
265
266 ObjectTreeItem *tree = container->form()->objectTree()->lookup(w->name());
267 if(!tree)
268 return;
269 tree->eventEater()->setContainer(this);
270
271 //m_widget = w;
272 setWidget(w, container);
273 m_editedWidgetClass = classname;
274 m_firstText = text;
275// m_container = container;
276
277 changeTextInternal(text); // to update size of the widget
278}
279
280void
282{
283 ObjectTreeItem *tree = container->form()->objectTree()->lookup(w->name());
284 if(!tree)
285 return;
286 tree->eventEater()->setContainer(this);
287
288 w->setFocus();
289//js m_handles = new ResizeHandleSet(w, container->form(), true);
290 m_handles = container->form()->resizeHandlesForWidget(w);
291 if (m_handles) {
292 m_handles->setEditingMode(true);
293 m_handles->raise();
294 }
295
296 //m_widget = w;
297 setWidget(w, container);
298// m_container = container;
299 setEditor(w, 0);
300// m_editor = 0;
301
302 // widget is disabled, so we re-enable it while editing
303 if(!tree->isEnabled()) {
304 TQPalette p = w->palette();
305 TQColorGroup cg = p.active();
306 p.setActive(p.disabled());
307 p.setDisabled(cg);
308 w->setPalette(p);
309 }
310
311 connect(w, TQ_SIGNAL(destroyed()), this, TQ_SLOT(widgetDestroyed()));
312}
313
314bool
315WidgetFactory::editList(TQWidget *w, TQStringList &list)
316{
317 KDialogBase dialog(w->topLevelWidget(), "stringlist_dialog", true, i18n("Edit List of Items"),
318 KDialogBase::Ok|KDialogBase::Cancel, KDialogBase::Ok, false);
319
320 KEditListBox *edit = new KEditListBox(i18n("Contents of %1").arg(w->name()), &dialog, "editlist");
321 dialog.setMainWidget(edit);
322 edit->insertStringList(list);
323// edit->show();
324
325 if(dialog.exec() == TQDialog::Accepted)
326 {
327 list = edit->items();
328 return true;
329 }
330 return false;
331}
332
333bool
334WidgetFactory::editRichText(TQWidget *w, TQString &text)
335{
336 RichTextDialog dlg(w, text);
337 if(dlg.exec()== TQDialog::Accepted)
338 {
339 text = dlg.text();
340 return true;
341 }
342 return false;
343}
344
345void
346WidgetFactory::editListView(TQListView *listview)
347{
348 EditListViewDialog dlg(((TQWidget*)listview)->topLevelWidget());
349 //dlg.exec(listview);
350}
351
352bool
353WidgetFactory::eventFilter(TQObject *obj, TQEvent *ev)
354{
355 if( ((ev->type() == TQEvent::Resize) || (ev->type() == TQEvent::Move) ) && (obj == m_widget) && editor(m_widget)) {
356 // resize widget using resize handles
357 TQWidget *ed = editor(m_widget);
358 resizeEditor(ed, m_widget, m_widget->className());
359 }
360 else if((ev->type() == TQEvent::Paint) && (obj == m_widget) && editor(m_widget)) {
361 // paint event for container edited (eg button group)
362 return m_container->eventFilter(obj, ev);
363 }
364 else if((ev->type() == TQEvent::MouseButtonPress) && (obj == m_widget) && editor(m_widget)) {
365 // click outside editor --> cancel editing
366 Container *cont = m_container;
367 resetEditor();
368 return cont->eventFilter(obj, ev);
369 }
370
371 if(ev->type() == TQEvent::FocusOut)
372 {
373 TQWidget *w = editor(m_widget);
374 if (!w)
375 w = (TQWidget *)m_widget;
376 if(obj != (TQObject *)w)
377 return false;
378
379 TQWidget *focus = w->topLevelWidget()->focusWidget();
380 if(focus && w != focus && !w->child(focus->name(), focus->className()))
381 resetEditor();
382 }
383 else if(ev->type() == TQEvent::KeyPress)
384 {
385 TQWidget *w = editor(m_widget);
386 if (!w)
387 w = (TQWidget *)m_widget;
388 if(obj != (TQObject *)w)
389 return false;
390
391 TQKeyEvent *e = static_cast<TQKeyEvent*>(ev);
392 if(((e->key() == TQt::Key_Return) || (e->key() == TQt::Key_Enter)) && (e->state() != AltButton))
393 resetEditor();
394 if(e->key() == TQt::Key_Escape)
395 {
396 setEditorText(m_firstText);
397 //changeText(m_firstText);
398 resetEditor();
399 }
400 }
401 else if(ev->type() == TQEvent::ContextMenu) {
402 TQWidget *w = editor(m_widget);
403 if (!w)
404 w = (TQWidget *)m_widget;
405 if(obj != (TQObject *)w)
406 return false;
407
408 return true;
409 }
410// if(obj == m_widget)
411// return m_container->eventFilter(obj, ev);
412// else
413 return false;
414}
415
416void
417WidgetFactory::resetEditor()
418{
419 if (m_container)
420 m_container->stopInlineEditing();
421
422 TQWidget *ed = editor(m_widget);
423 if(m_widget)
424 {
425 ObjectTreeItem *tree = m_container ? m_container->form()->objectTree()->lookup(m_widget->name()) : 0;
426 if(!tree)
427 {
428 kdDebug() << "WidgetFactory::resetEditor() : error cannot found a tree item " << endl;
429 return;
430 }
431 tree->eventEater()->setContainer(m_container);
432 if(m_widget) {// && !ed)
433 setRecursiveCursor(m_widget, m_container->form());
434 if (m_widget->inherits("TQLineEdit") || m_widget->inherits("TQTextEdit")) { //fix weird behaviour
435 m_widget->unsetCursor();
436 m_widget->setCursor(TQt::ArrowCursor);
437 }
438 }
439
440 // disable again the widget
441 if(!ed && !tree->isEnabled()) {
442 TQPalette p = m_widget->palette();
443 TQColorGroup cg = p.active();
444 p.setActive(p.disabled());
445 p.setDisabled(cg);
446 m_widget->setPalette(p);
447 }
448 }
449 if(ed)
450 {
451 changeTextInternal(editorText());
452 disconnect(ed, 0, this, 0);
453 ed->deleteLater();
454 }
455
456 if(m_widget)
457 {
458 disconnect(m_widget, 0, this, 0);
459 m_widget->repaint();
460 }
461
462//js delete m_handles;
463 if (m_handles) {
464 m_handles->setEditingMode(false);
465 }
466 setEditor(m_widget, 0);
467// m_editor = 0;
468 setWidget(0, 0);
469 //m_widget = 0;
470 m_handles = 0;
471// m_container = 0;
472}
473
474void
475WidgetFactory::widgetDestroyed()
476{
477 if(m_editor)
478 {
479 m_editor->deleteLater();
480 m_editor = 0;
481 }
482
483//js delete m_handles;
484 if (m_handles) {
485 m_handles->setEditingMode(false);
486
487 }
488 m_widget = 0;
489 m_handles = 0;
490 m_container = 0;
491}
492
493void
495{
496//js delete m_handles;
497 if (m_handles) {
498 m_handles->setEditingMode(false);
499 }
500 setEditor(m_widget, 0);
501 setWidget(0, 0);
502// m_widget = 0;
503 m_handles = 0;
504// m_container = 0;
505}
506
507void
508WidgetFactory::changeProperty(const char *name, const TQVariant &value, Form *form)
509//WidgetFactory::changeProperty(const char *name, const TQVariant &value, Container *container)
510{
511// if (!form->manager())
512// return;
513 if(form->selectedWidgets()->count() > 1)
514 { // If eg multiple labels are selected, we only want to change the text of one of them (the one the user cliked on)
515 if(m_widget)
516 m_widget->setProperty(name, value);
517 else
518 form->selectedWidgets()->first()->setProperty(name, value);
519 }
520 else
521 {
522 WidgetPropertySet *set = KFormDesigner::FormManager::self()->propertySet();
523 if(set->contains(name))
524 (*set)[name] = value;
525 }
526}
527
528/*
529void
530WidgetFactory::addPropertyDescription(Container *container, const char *prop, const TQString &desc)
531{
532 WidgetPropertySet *buff = container->form()->manager()->buffer();
533 buff->addPropertyDescription(prop, desc);
534}
535
536void
537WidgetFactory::addValueDescription(Container *container, const char *value, const TQString &desc)
538{
539 WidgetPropertySet *buff = container->form()->manager()->buffer();
540 buff->addValueDescription(value, desc);
541}*/
542
543bool
544WidgetFactory::isPropertyVisible(const TQCString &classname, TQWidget *w,
545 const TQCString &property, bool multiple, bool isTopLevel)
546{
547 if (multiple)
548 {
549 return property=="font" || property=="paletteBackgroundColor" || property=="enabled"
550 || property=="paletteForegroundColor" || property=="cursor" || property=="paletteBackgroundPixmap";
551 }
552
553// if(d->properties.isEmpty() && !isTopLevel)
554// d->properties << "caption" << "icon" << "sizeIncrement" << "iconText";
555// if(! (d->properties.grep(property)).isEmpty() )
556// return false;
557
558 return isPropertyVisibleInternal(classname, w, property, isTopLevel);
559// return !multiple && isPropertyVisibleInternal(classname, w, property);
560}
561
562bool
563WidgetFactory::isPropertyVisibleInternal(const TQCString &, TQWidget *w,
564 const TQCString &property, bool isTopLevel)
565{
566 Q_UNUSED( w );
567
568#ifdef KEXI_NO_CURSOR_PROPERTY
570 if (property=="cursor")
571 return false;
572#endif
573
574 if (!isTopLevel
575 && (property=="caption" || property=="icon" || property=="sizeIncrement" || property=="iconText")) {
576 // don't show these properties for a non-toplevel widget
577 return false;
578 }
579 return true;
580}
581
582bool
584 const TQCString& property)
585{
586 Q_UNUSED(classname);
587 Q_UNUSED(w);
588 Q_UNUSED(property);
589 return false;
590}
591
592void
593WidgetFactory::resizeEditor(TQWidget *, TQWidget *, const TQCString&)
594{
595}
596
597void
598WidgetFactory::slotTextChanged()
599{
600 changeTextInternal(editorText());
601}
602
603bool
604WidgetFactory::clearWidgetContent(const TQCString &, TQWidget *)
605{
606 return false;
607}
608
609void
610WidgetFactory::changeTextInternal(const TQString& text)
611{
612 if (changeText( text ))
613 return;
614 //try in inherited
615 if (!m_editedWidgetClass.isEmpty()) {
616 WidgetInfo *wi = m_classesByName[ m_editedWidgetClass ];
617 if (wi && wi->inheritedClass()) {
618// wi->inheritedClass()->factory()->m_container = m_container;
619 wi->inheritedClass()->factory()->changeText( text );
620 }
621 }
622}
623
624bool
625WidgetFactory::changeText(const TQString& text)
626{
627 changeProperty( "text", text, m_container->form() );
628 return true;
629}
630
631bool
632WidgetFactory::readSpecialProperty(const TQCString &, TQDomElement &, TQWidget *, ObjectTreeItem *)
633{
634 return false;
635}
636
637bool
638WidgetFactory::saveSpecialProperty(const TQCString &, const TQString &, const TQVariant&, TQWidget *, TQDomElement &, TQDomDocument &)
639{
640 return false;
641}
642
644{
645 for (TQAsciiDictIterator<WidgetInfo> it(m_classesByName); it.current(); ++it) {
646 if (!it.current()->parentFactoryName().isEmpty())
647 return true;
648 }
649 return false;
650}
651
652TQString WidgetFactory::editorText() const {
653 TQWidget *ed = editor(m_widget);
654 return dynamic_cast<KTextEdit*>(ed) ? dynamic_cast<KTextEdit*>(ed)->text() : dynamic_cast<KLineEdit*>(ed)->text();
655}
656
657void WidgetFactory::setEditorText(const TQString& text) {
658 TQWidget *ed = editor(m_widget);
659 if (dynamic_cast<KTextEdit*>(ed))
660 dynamic_cast<KTextEdit*>(ed)->setText(text);
661 else
662 dynamic_cast<KLineEdit*>(ed)->setText(text);
663}
664
665void WidgetFactory::setEditor(TQWidget *widget, TQWidget *editor)
666{
667 if (!widget)
668 return;
669 WidgetInfo *winfo = m_classesByName[widget->className()];
670 if (!winfo || winfo->parentFactoryName().isEmpty()) {
671 m_editor = editor;
672 }
673 else {
674 WidgetFactory *f = m_library->factory(winfo->parentFactoryName());
675 if (f!=this)
676 f->setEditor(widget, editor);
677 m_editor = editor; //keep a copy
678 }
679}
680
681TQWidget *WidgetFactory::editor(TQWidget *widget) const
682{
683 if (!widget)
684 return 0;
685 WidgetInfo *winfo = m_classesByName[widget->className()];
686 if (!winfo || winfo->parentFactoryName().isEmpty()) {
687 return m_editor;
688 }
689 else {
690 WidgetFactory *f = m_library->factoryForClassName(widget->className());
691 if (f!=this)
692 return f->editor(widget);
693 return m_editor;
694 }
695}
696
697void WidgetFactory::setWidget(TQWidget *widget, Container* container)
698{
699 WidgetInfo *winfo = widget ? m_classesByName[widget->className()] : 0;
700 if (winfo && !winfo->parentFactoryName().isEmpty()) {
701 WidgetFactory *f = m_library->factory(winfo->parentFactoryName());
702 if (f!=this)
703 f->setWidget(widget, container);
704 }
705 m_widget = widget; //keep a copy
706 m_container = container;
707}
708
709TQWidget *WidgetFactory::widget() const
710{
711 return m_widget;
712}
713
714void WidgetFactory::setInternalProperty(const TQCString& classname, const TQCString& property,
715 const TQString& value)
716{
717 m_internalProp[classname+":"+property]=value;
718}
719
720void WidgetFactory::setPropertyOptions( WidgetPropertySet& /*buf*/, const WidgetInfo& /*info*/, TQWidget * /*w*/ )
721{
722 //nothing
723}
724
725#include "widgetfactory.moc"
This class makes a container out of any TQWidget.
Definition container.h:74
virtual bool eventFilter(TQObject *o, TQEvent *e)
Form * form() const
Definition container.h:91
A dialog to edit the contents of a listvuew (TDEListView or TQListView).
void setContainer(TQObject *container)
Sets the object which will receive the events.
Definition container.h:60
static FormManager * self()
Access to FormManager singleton.
WidgetPropertySet * propertySet() const
A simple class representing a form.
Definition form.h:136
ResizeHandleSet * resizeHandlesForWidget(TQWidget *w)
Definition form.cpp:283
WidgetList * selectedWidgets() const
Definition form.h:192
ObjectTree * objectTree() const
Definition form.h:167
An item representing a widget Holds the properties of a widget (classname, name, parent,...
Definition objecttree.h:59
ObjectTreeItem * lookup(const TQString &name)
A simple dialog to edit rich text.
The base class for all widget Factories.
virtual bool readSpecialProperty(const TQCString &classname, TQDomElement &node, TQWidget *w, ObjectTreeItem *item)
bool editRichText(TQWidget *w, TQString &text)
void disableFilter(TQWidget *w, Container *container)
TQMap< TQCString, TQString > m_internalProp
internal properties
virtual bool isPropertyVisibleInternal(const TQCString &classname, TQWidget *w, const TQCString &property, bool isTopLevel)
void createEditor(const TQCString &classname, const TQString &text, TQWidget *w, Container *container, TQRect geometry, int align, bool useFrame=false, bool multiLine=false, BackgroundMode background=TQt::NoBackground)
void changeProperty(const char *name, const TQVariant &value, Form *form)
bool editList(TQWidget *w, TQStringList &list)
virtual bool eventFilter(TQObject *obj, TQEvent *ev)
bool isPropertyVisible(const TQCString &classname, TQWidget *w, const TQCString &property, bool multiple, bool isTopLevel)
void hideClass(const char *classname)
virtual void setPropertyOptions(WidgetPropertySet &buf, const WidgetInfo &info, TQWidget *w)
virtual bool changeText(const TQString &newText)
virtual bool propertySetShouldBeReloadedAfterPropertyChange(const TQCString &classname, TQWidget *w, const TQCString &property)
void setInternalProperty(const TQCString &classname, const TQCString &property, const TQString &value)
void editListView(TQListView *listview)
virtual bool saveSpecialProperty(const TQCString &classname, const TQString &name, const TQVariant &value, TQWidget *w, TQDomElement &parentNode, TQDomDocument &parent)
virtual void resizeEditor(TQWidget *editor, TQWidget *widget, const TQCString &classname)
This class holds properties of widget classes provided by a factory.
void setCustomTypeForProperty(const char *propertyName, int type)
tristate autoSyncForProperty(const char *propertyName) const
void addAlternateClassName(const TQCString &alternateName, bool override=false)
void setAutoSyncForProperty(const char *propertyName, tristate flag)
int customTypeForProperty(const char *propertyName) const
bool isOverriddenClassName(const TQCString &alternateName) const
TQCString className() const
An interface for declaring form widgets to have subproperties.
3-state logical type with three values: true, false and cancelled and convenient operators.
Definition tristate.h:100