parley
lesson.h
Go to the documentation of this file.00001 /*************************************************************************** 00002 00003 Copyright 2008 Avgoustinos Kadis <avgoustinos.kadis@kdemail.net> 00004 00005 ***************************************************************************/ 00006 00007 /*************************************************************************** 00008 * * 00009 * This program is free software; you can redistribute it and/or modify * 00010 * it under the terms of the GNU General Public License as published by * 00011 * the Free Software Foundation; either version 2 of the License, or * 00012 * (at your option) any later version. * 00013 * * 00014 ***************************************************************************/ 00015 #ifndef SCRIPTINGSCRIPTOBJECTLESSON_H 00016 #define SCRIPTINGSCRIPTOBJECTLESSON_H 00017 00018 #include <keduvoclesson.h> 00019 #include "container.h" 00020 00021 #include <QObject> 00022 #include <QStringList> 00023 00024 #include <KSharedPtr> 00025 00026 namespace Scripting 00027 { 00028 00029 class Expression; 00030 00047 class Lesson : public Container 00048 { 00049 Q_OBJECT 00050 public: 00051 00052 Lesson ( KEduVocLesson * lesson ); 00053 00054 Lesson ( KEduVocContainer * container ); 00055 00056 Lesson ( const QString& name ); 00057 00058 ~Lesson(); 00059 00060 public slots: 00072 QVariantList entries ( bool recursive = false ) const; 00073 00074 void setEntries(QVariantList entries); 00075 00077 QObject * entry ( int row, bool recursive = false ); 00078 00080 int entryCount ( bool recursive = false ); 00081 00095 QObject* newEntry(); 00096 00109 QObject* newEntry ( QStringList translations ); 00110 00122 void appendEntry ( Expression * entry ); 00123 00135 void appendNewEntry ( QStringList translations ); 00136 00142 void insertEntry ( int index, Expression * entry ); 00143 00157 void removeEntry ( QObject * entry ); 00158 00162 void clearEntries(); 00163 00164 // @note this one doesn't work with the previous one (python doesn't know which one to call) 00165 /* 00166 * Creates and returns a new Expression Object 00167 * @param expression 00168 * @return A new Expression object 00169 */ 00170 // QObject* newEntry ( const QString & expression ); 00171 00172 00173 //child lesson public functions (just to change the names from "Container" to "Lesson") 00177 void appendChildLesson ( Lesson *child ) { appendChildContainer ( child ); } 00181 void insertChildLesson ( int row, Lesson *child ) { insertChildContainer ( row, child ); } 00182 /* 00183 * Delete child lesson of the specified @p row 00184 */ 00185 // void deleteChildLesson ( int row ) { deleteChildContainer ( row ); } 00189 void removeChildLesson ( int row ) { removeChildContainer ( row ); } 00193 QObject *childLesson ( int row ) { return new Lesson ( m_lesson->childContainer ( row ) ); } 00194 00201 QObject *childLesson ( const QString& name ) { return new Lesson ( m_lesson->childContainer ( name ) ); } 00202 00214 QVariantList childLessons ( bool recursive = false ); 00215 00231 QObject * findChildLesson ( const QString& name ); 00232 00236 int childLessonCount() const { return childContainerCount(); } 00237 00238 private: 00239 KEduVocLesson* m_lesson; 00240 }; 00241 00242 } 00243 00244 #endif
KDE 4.4 API Reference