tolists.h

Go to the documentation of this file.
00001 // OSB library ************************************************ -*- C++ -*-
00006 /*
00007   AUTHOR(S): Stephan Broennimann (vb)
00008 
00009   RCS information
00010    $Name: OSB_060808 $
00011    $Revision: 1.52 $
00012 
00013   License
00014    OSB rating and billing library for communication networks
00015    Copyright (C) 2004, 2005, 2006  OSB systems
00016 
00017    This file may be distributed and/or modify under the terms of the
00018    GNU General Public License (GPL) as published by the Free Software
00019    Foundation which is provided in the file LICENSE.GPL included in the
00020    packaging of this file.
00021 
00022    The file is distributed in the hope that it will be useful, but WITHOUT
00023    ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
00024    FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
00025    for more details.
00026 
00027    Holders of a OSB Commercial License may use this file under the terms
00028    and conditions of this commercial license.
00029  */
00030 #ifndef _TSLIST_H_
00031 #define _TSLIST_H_
00032 
00033 // ************************************************************************
00034 // included header files
00035 // + standard includes
00036 #include <string>
00037 
00038 // + Qt3 headers
00039 #include <qlistview.h>
00040 #include <qdatetime.h>
00041 
00042 // + OSB headers
00043 #include <osbconst.h>                   // CfgStatus
00044 
00045 // + local headers
00046 
00047 // ************************************************************************
00048 // class declarations
00049 namespace OSB_LIB {
00050     class TariffObject;
00051     class ToCfgBase;
00052     class ToCfgTsBase;
00053     class ToVersion;
00054 }
00055 
00056 namespace OSB_GUI {
00057     class ToMenuCmd;
00058     class ToMenu;
00059 }
00060 
00061 // ************************************************************************
00062 // namespace extensions
00063 namespace OSB_GUI {
00064 
00065 // ************************************************************************
00066 // class definitions
00075     class ToListItem {
00076     public:
00078         virtual ~ToListItem();
00079     public:
00093         virtual bool setupMenu(ToMenu& toMenu) = 0;
00103         virtual bool commandEvent(ToMenuCmd cmd) = 0;
00104     };
00105 
00113     class GroupItem : virtual public QListViewItem {
00114     public:
00116         GroupItem(
00117                   QListView* parent,
00118                   int        key,
00119             const QString&   label
00120         );
00122         GroupItem(
00123                   QListViewItem* parent,
00124                   int            key,
00125             const QString&       label
00126         );
00132         explicit GroupItem(
00133             QListViewItem* parent
00134         );
00135     private:
00137         virtual void paintCell(
00138                   QPainter*    p,
00139             const QColorGroup& cg,
00140                   int          col,
00141                   int          width,
00142                   int          align
00143         );
00152         virtual int compare(QListViewItem* item, int col, bool asc) const;
00153     private:
00155         int key_;
00156     };
00157 
00164     class ToGroup : public GroupItem,
00165                     virtual public ToListItem
00166     {
00167     public:
00169         ToGroup(
00170                   QListView* parent,
00171                   int        key,
00172             const QString&   label
00173         );
00175         ToGroup(
00176                   QListViewItem* parent,
00177                   int            key,
00178             const QString&       label
00179         );
00181         explicit ToGroup(
00182             QListViewItem* parent
00183         );
00184     public:
00186         virtual void newObject() = 0;
00192         virtual void populate() = 0;
00193 
00202         virtual bool setupMenu(ToMenu& toMenu);
00203 
00214         virtual bool commandEvent(ToMenuCmd cmd);
00215     protected:
00222         virtual void setOpen(bool open);
00223     };                                  // class ToGroup
00224 
00228     class ToItem : virtual public QListViewItem,
00229                    virtual public ToListItem
00230     {
00231     public:
00233         explicit ToItem(
00234             QListViewItem* parent
00235         );
00236 
00248         virtual bool setupMenu(ToMenu& toMenu);
00249 
00262         virtual bool commandEvent(ToMenuCmd cmd);
00263 
00265         virtual void showObject() const = 0;
00267         virtual void editObject() = 0;
00269         virtual void delObject() = 0;
00276         virtual int compare(QListViewItem* i, int col, bool asc) const;
00277     protected:
00279         void set(const std::string& name);
00281         virtual long objId() const = 0;
00282     };                                  // class ToItem
00283 
00287     class ToGroupItem : public GroupItem,
00288                         public ToItem
00289     {
00290     public:
00292         explicit ToGroupItem(
00293             QListViewItem* parent
00294         );
00295 
00296     public:
00309         virtual bool setupMenu(ToMenu& toMenu);
00310 
00324         virtual bool commandEvent(ToMenuCmd cmd);
00326         virtual void newVersion() = 0;
00327 
00333         int compare(QListViewItem* i, int col, bool asc) const;
00334     protected:
00341         virtual void setOpen(bool open);
00347         virtual void populate() = 0;
00348     };                                  // class ToGroupItem
00349 
00353     class ToCfgItem : public ToItem {
00354     protected:
00360         explicit ToCfgItem(
00361             QListViewItem* parent
00362         );
00363     protected:
00365         void set(
00366             const std::string&        name,
00367             const OSB_LIB::ToCfgBase& to
00368         );
00370         OSB_LIB::CfgStatus status() const;
00372         virtual void changeStatus() = 0;
00374         virtual bool setupMenu(ToMenu& toMenu);
00376         virtual bool commandEvent(ToMenuCmd cmd);
00377     private:
00384         int compare(QListViewItem* i, int col, bool asc) const;
00391         const QPixmap* pixmap(int col) const;
00392     private:
00394         OSB_LIB::CfgStatus status_;
00395     };                                  // class ToCfgItem
00396 
00400     class ToCfgTsItem : public QListViewItem,
00401                         public ToListItem
00402     {
00403     protected:
00409         explicit ToCfgTsItem(
00410             QListViewItem* parent
00411         );
00412     protected:
00425         virtual bool setupMenu(ToMenu& toMenu);
00439         virtual bool commandEvent(ToMenuCmd cmd);
00446         void set(
00447             const std::string&          name,
00448             const OSB_LIB::ToCfgTsBase& to
00449         );
00450 
00454         OSB_LIB::CfgStatus status() const;
00458         QDateTime releaseTs() const;
00464         virtual long objId() const = 0;
00466         virtual void showObject() const = 0;
00468         virtual void editObject() = 0;
00470         virtual void delObject() = 0;
00472         virtual void changeStatus() = 0;
00473     private:
00480         int compare(QListViewItem* i, int col, bool asc) const;
00487         const QPixmap* pixmap(int col) const;
00488     private:
00490         OSB_LIB::CfgStatus status_;
00492         QDateTime releaseTs_;
00493     };                                  // class ToCfgTsItem
00494 
00498     class ToVsItem : public ToCfgTsItem {
00499     public:
00505         explicit ToVsItem(
00506             QListViewItem* parent
00507         );
00508     protected:
00510         virtual long vsId() const = 0;
00516         void set(const OSB_LIB::ToVersion& toVs);
00517     private:
00523         long objId() const;
00524     };                                  // class ToVsItem
00525 }                                       // namespace OSB_GUI
00526 
00527 // ************************************************************************
00528 // inline definitions
00529 namespace OSB_GUI {
00530 }                                       // namespace OSB_GUI
00531 #endif                                  // #ifndef _TSLIST_H_

Generated on Sat Sep 2 14:17:37 2006 for OSB Library by  doxygen 1.4.7