• Skip to content
  • Skip to link menu
KDE 4.1 API Reference
  • KDE API Reference
  • API Reference
  • Sitemap
  • Contact Us
 

libplasma

uiloader.cpp

Go to the documentation of this file.
00001 /*
00002  *   Copyright 2007 Richard J. Moore <rich@kde.org>
00003  *
00004  *   This program is free software; you can redistribute it and/or modify
00005  *   it under the terms of the GNU Library General Public License as
00006  *   published by the Free Software Foundation; either version 2, or
00007  *   (at your option) any later version.
00008  *
00009  *   This program is distributed in the hope that it will be useful,
00010  *   but WITHOUT ANY WARRANTY; without even the implied warranty of
00011  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00012  *   GNU General Public License for more details
00013  *
00014  *   You should have received a copy of the GNU Library General Public
00015  *   License along with this program; if not, write to the
00016  *   Free Software Foundation, Inc.,
00017  *   51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
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 ); // Constructor here requires a Widget
00076     }
00077     else if (className == QString("PushButton")) {
00078         return new PushButton( parent ); // Constructor here requires a Widget
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 }

libplasma

Skip menu "libplasma"
  • Main Page
  • Namespace List
  • Class Hierarchy
  • Alphabetical List
  • Class List
  • File List
  • Namespace Members
  • Class Members
  • Related Pages

API Reference

Skip menu "API Reference"
  • KWin
  •   KWin Libraries
  • Libraries
  •   libkworkspace
  •   libplasma
  •   libsolidcontrol
  •   libtaskmanager
  • Plasma
  •   Animators
  •   Applets
  •   Engines
  • Solid Modules
Generated for API Reference by doxygen 1.5.4
This website is maintained by Adriaan de Groot and Allen Winter.
KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal