kalzium
kalziumtabletype.h
Go to the documentation of this file.00001 /*************************************************************************** 00002 * Copyright (C) 2005, 2006 by Pino Toscano, toscano.pino@tiscali.it * 00003 * Copyright (C) 2007 by Carste Niehaus, cniehaus@kde.org * 00004 * * 00005 * This program is free software; you can redistribute it and/or modify * 00006 * it under the terms of the GNU General Public License as published by * 00007 * the Free Software Foundation; either version 2 of the License, or * 00008 * (at your option) any later version. * 00009 * * 00010 * This program is distributed in the hope that it will be useful, * 00011 * but WITHOUT ANY WARRANTY; without even the implied warranty of * 00012 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * 00013 * GNU General Public License for more details. * 00014 * * 00015 * You should have received a copy of the GNU General Public License * 00016 * along with this program; if not, write to the * 00017 * Free Software Foundation, Inc., * 00018 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * 00019 ***************************************************************************/ 00020 00021 #ifndef KALZIUMTABLETYPE_H 00022 #define KALZIUMTABLETYPE_H 00023 00024 class KalziumNumerationType; 00025 class KalziumTableType; 00026 00027 #include <QByteArray> 00028 #include <QPoint> 00029 #include <QRect> 00030 #include <QSize> 00031 #include <QStringList> 00032 00038 class KalziumTableTypeFactory 00039 { 00040 public: 00044 static KalziumTableTypeFactory* instance(); 00045 00050 KalziumTableType* build( int id ) const; 00051 00057 KalziumTableType* build( const QByteArray& id ) const; 00058 00062 QStringList tables() const; 00063 private: 00064 KalziumTableTypeFactory(); 00065 00066 QList<KalziumTableType*> m_tables; 00067 }; 00068 00075 class KalziumTableType 00076 { 00077 public: 00081 static KalziumTableType* instance(); 00082 00083 virtual ~KalziumTableType(); 00084 00089 virtual QByteArray name() const = 0; 00094 virtual QString description() const = 0; 00095 00099 virtual QSize size() const = 0; 00100 00106 virtual int elementAtCoords( const QPoint& coords ) const = 0; 00110 virtual QRect elementRect( const int numelem ) const = 0; 00111 00116 virtual QRect numerationRect( const int numelem, KalziumNumerationType *nt ) const; 00117 00125 virtual int previousOf( int element ) const; 00126 00134 virtual int nextOf( int element ) const; 00135 00141 virtual int firstElement() const; 00142 00146 virtual QList<int> elementList() const; 00147 00148 protected: 00149 KalziumTableType(); 00150 00154 QList<int> m_elementList; 00155 00161 QPoint elementUnderMouse( const QPoint& coords ) const; 00162 }; 00163 00169 class KalziumClassicTableType : public KalziumTableType 00170 { 00171 public: 00172 static KalziumClassicTableType* instance(); 00173 00174 QByteArray name() const; 00175 QString description() const; 00176 00177 QSize size() const; 00178 00179 int elementAtCoords( const QPoint& coords ) const; 00180 QRect elementRect( const int numelem ) const; 00181 00182 private: 00183 KalziumClassicTableType(); 00184 }; 00185 00191 class KalziumShortTableType : public KalziumTableType 00192 { 00193 public: 00194 static KalziumShortTableType* instance(); 00195 00196 QByteArray name() const; 00197 QString description() const; 00198 00199 QSize size() const; 00200 00201 int elementAtCoords( const QPoint& coords ) const; 00202 QRect elementRect( const int numelem ) const; 00203 00204 int previousOf( int element ) const; 00205 int nextOf( int element ) const; 00206 00207 private: 00208 KalziumShortTableType(); 00209 00215 static int translateToShort(int num); 00216 }; 00217 00223 class KalziumDTableType : public KalziumTableType 00224 { 00225 public: 00226 static KalziumDTableType* instance(); 00227 00228 QByteArray name() const; 00229 QString description() const; 00230 00231 QSize size() const; 00232 00233 int elementAtCoords( const QPoint& coords ) const; 00234 QRect elementRect( const int numelem ) const; 00235 00236 int previousOf( int element ) const; 00237 int nextOf( int element ) const; 00238 00239 int firstElement() const; 00240 00241 private: 00242 KalziumDTableType(); 00243 00249 static int translateToD(int num); 00250 }; 00251 00258 class KalziumDZTableType : public KalziumTableType 00259 { 00260 public: 00261 static KalziumDZTableType* instance(); 00262 00263 QByteArray name() const; 00264 QString description() const; 00265 00266 QSize size() const; 00267 00268 int elementAtCoords( const QPoint& coords ) const; 00269 QRect elementRect( const int numelem ) const; 00270 00271 private: 00272 KalziumDZTableType(); 00273 }; 00274 00275 #endif // KALZIUMTABLETYPE_H
KDE 4.0 API Reference