• Skip to content
  • Skip to link menu
Trinity API Reference
  • Trinity API Reference
  • KDevelop Property Editing Library
 

KDevelop Property Editing Library

  • lib
  • widgets
  • propeditor
propertywidgetproxy.cpp
1 /***************************************************************************
2  * Copyright (C) 2004 by Alexander Dymo *
3  * cloudtemple@mskat.net *
4  * *
5  * This program is free software; you can redistribute it and/or modify *
6  * it under the terms of the GNU Library General Public License as *
7  * published by the Free Software Foundation; either version 2 of the *
8  * License, or (at your option) any later version. *
9  * *
10  * This program is distributed in the hope that it will be useful, *
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of *
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
13  * GNU General Public License for more details. *
14  * *
15  * You should have received a copy of the GNU Library General Public *
16  * License along with this program; if not, write to the *
17  * Free Software Foundation, Inc., *
18  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *
19  ***************************************************************************/
20 #include "propertywidgetproxy.h"
21 
22 #include <tqlayout.h>
23 
24 #include "propertywidget.h"
25 #include "propertymachinefactory.h"
26 
27 namespace PropertyLib{
28 
29 PropertyWidgetProxy::PropertyWidgetProxy(TQWidget *parent, const char *name)
30  :TQWidget(parent, name), mp(0), m_propertyType(Property::Invalid), m_editor(0)
31 {
32  p = new Property();
33  m_layout = new TQHBoxLayout(this, 0, 0);
34 }
35 
36 PropertyWidgetProxy::~PropertyWidgetProxy()
37 {
38  delete mp;
39  delete p;
40 }
41 
42 void PropertyWidgetProxy::setPropertyType(int propertyType)
43 {
44  m_propertyType = static_cast<PropertyType>(propertyType);
45  setWidget();
46 }
47 
48 void PropertyWidgetProxy::setPropertyType2(PropertyType propertyType)
49 {
50  m_propertyType = propertyType;
51  setWidget();
52 }
53 
54 void PropertyWidgetProxy::setWidget()
55 {
56  if (m_editor)
57  delete m_editor;
58  p->setType(m_propertyType);
59  mp = new MultiProperty(p);
60  m_editor = PropertyMachineFactory::getInstance()->machineForProperty(mp)->propertyEditor;
61  if (m_editor)
62  {
63  m_editor->reparent(this, TQPoint(0,0), true);
64  m_layout->addWidget(m_editor);
65  }
66 }
67 
68 TQVariant PropertyWidgetProxy::value() const
69 {
70  if (m_editor)
71  return m_editor->value();
72  else
73  return TQVariant();
74 }
75 
76 void PropertyWidgetProxy::setValue(const TQVariant &value)
77 {
78  if (m_editor)
79  m_editor->setValue(value, false);
80 }
81 
82 bool PropertyWidgetProxy::setProperty( const char * name, const TQVariant & value )
83 {
84  if( strcmp( name, "value") == 0 )
85  {
86  setPropertyType((int) value.type() );
87  setValue( value );
88  return true;
89  }
90  else
91  return TQWidget::setProperty(name, value);
92 }
93 
94 TQVariant PropertyWidgetProxy::property( const char * name ) const
95 {
96  if( strcmp( name, "value") == 0 )
97  return value( );
98  else
99  return TQWidget::property(name);
100 }
101 
102 }
103 
104 #ifndef PURE_QT
105 #include "propertywidgetproxy.moc"
106 #endif
PropertyLib
Namespace which contain property editing classes.
Definition: childproperty.cpp:29
propertymachinefactory.h
Contains PropertyLib::PropertyMachineFactory class and PropertyLib::Machine structure.
PropertyLib::PropertyWidget::value
virtual TQVariant value() const =0
PropertyLib::PropertyWidget::setValue
virtual void setValue(const TQVariant &value, bool emitChange=true)=0
Sets the value shown in the editor widget.
PropertyLib::PropertyMachineFactory::getInstance
static PropertyMachineFactory * getInstance()
Definition: propertymachinefactory.cpp:192
PropertyLib::Machine::propertyEditor
PropertyWidget * propertyEditor
Property viewer and editor widget.
Definition: propertymachinefactory.h:60
PropertyLib::PropertyWidgetProxy::setPropertyType2
void setPropertyType2(PropertyType propertyType)
Sets the type of a property editor to appear.
Definition: propertywidgetproxy.cpp:48
PropertyLib::PropertyWidgetProxy::setPropertyType
void setPropertyType(int propertyType)
Sets the type of a property editor to appear.
Definition: propertywidgetproxy.cpp:42
propertywidget.h
Contains PropertyLib::PropertyWidget class.
PropertyLib::MultiProperty
Holds a list of properties with the same name and type.
Definition: multiproperty.h:49
PropertyLib::PropertyWidgetProxy::setProperty
bool setProperty(const char *name, const TQVariant &value)
Sets the type of an editor basing on the value if the name is "value".
Definition: propertywidgetproxy.cpp:82
PropertyLib::PropertyMachineFactory::machineForProperty
Machine * machineForProperty(MultiProperty *property)
Creates and returns the editor for given property type.
Definition: propertymachinefactory.cpp:73

KDevelop Property Editing Library

Skip menu "KDevelop Property Editing Library"
  • Main Page
  • Namespace List
  • Class Hierarchy
  • Alphabetical List
  • Class List
  • File List
  • Namespace Members
  • Class Members

KDevelop Property Editing Library

Skip menu "KDevelop Property Editing Library"
  • buildtools
  •   lib
  •     base
  •     parsers
  •       autotools
  •       qmake
  •     widgets
  •   api
  • languages
  •   lib
  •     debugger
  •     designer_integration
  •     interfaces
  • lib
  •   catalog
  •   interfaces
  •     extensions
  •     external
  •     extras
  •   util
  •   widgets
  •     propeditor
  • parts
  •   documentation
  •     interfaces
  • src
  •   profileengine
  •     lib
Generated for KDevelop Property Editing Library by doxygen 1.8.13
This website is maintained by Timothy Pearson.