libplasma
uiloader.cpp
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020 #include "uiloader.h"
00021
00022 #include <QStringList>
00023
00024 namespace Plasma
00025 {
00026
00027 class UiLoaderPrivate
00028 {
00029 public:
00030 QStringList widgets;
00031 QStringList layouts;
00032 };
00033
00034 UiLoader::UiLoader( QObject *parent )
00035 : d( new UiLoaderPrivate() )
00036 {
00037 d->widgets
00038 << "CheckBox"
00039 << "Flash"
00040 << "Icon"
00041 << "Label"
00042 << "PushButton"
00043 << "RadioButton"
00044 << "Meter";
00045
00046 d->layouts
00047 << "VBoxLayout"
00048 << "HBoxLayout"
00049 << "FlowLayout";
00050 }
00051
00052 UiLoader::~UiLoader()
00053 {
00054 delete d;
00055 }
00056
00057 QStringList UiLoader::availableWidgets() const
00058 {
00059 return d->widgets;
00060 }
00061
00062 Applet *UiLoader::createWidget( const QString &className, Applet *parent )
00063 {
00064 #ifdef RICHARD_WORK
00065 if (className == QString("CheckBox")) {
00066 return new CheckBox( parent );
00067 }
00068 else if (className == QString("Flash")) {
00069 return new Flash( parent );
00070 }
00071 else if (className == QString("Icon")) {
00072 return new Icon( parent );
00073 }
00074 else if (className == QString("Label")) {
00075 return new Label( parent );
00076 }
00077 else if (className == QString("PushButton")) {
00078 return new PushButton( parent );
00079 }
00080 else if (className == QString("RadioButton")) {
00081 return new RadioButton( parent );
00082 }
00083 else if (className == QString("Meter")) {
00084 return new Meter( parent );
00085 }
00086 #endif
00087 return 0;
00088 }
00089
00090 QStringList UiLoader::availableLayouts() const
00091 {
00092 return d->layouts;
00093 }
00094
00095 Layout *UiLoader::createLayout( const QString &className, LayoutItem *parent )
00096 {
00097 #ifdef RICHARD_WORK
00098 if (className == QString("HBoxLayout")) {
00099 return new HBoxLayout( parent );
00100 }
00101 else if (className == QString("VBoxLayout")) {
00102 return new VBoxLayout( parent );
00103 }
00104 else if (className == QString("FlowLayout")) {
00105 return new FlowLayout( parent );
00106 }
00107 #endif
00108 return 0;
00109 }
00110
00111 }