cputils.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.11 $
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 _CPUTILS_H_
00031 #define _CPUTILS_H_
00032 
00033 // ************************************************************************
00034 // included header files
00035 // + standard includes
00036 
00037 // + libraries
00038 #include <osbid.h>
00039 #include <qlineedit.h>
00040 #include <qlistview.h>
00041 
00042 // + local headers
00043 
00044 // ************************************************************************
00045 // class declarations
00046 namespace OSB_LIB {
00047     class ConnectionPt;
00048 }
00049 
00050 // ************************************************************************
00051 // namespace extensions
00052 namespace OSB_GUI {
00053 
00054 // ************************************************************************
00055 // forward declarations
00056 
00057 // ************************************************************************
00058 // type definitions
00059 
00060 // ************************************************************************
00061 // class definitions
00065     class LvCpSelect : public QListView {
00067         class Item;
00068     public:
00070         explicit LvCpSelect(
00071                   QWidget* parent,
00072             const char*    name   = "lvCpSelect_",
00073                   WFlags   f      = 0
00074         );
00076         OSB_LIB::Id<OSB_LIB::ConnectionPt> cpId() const;
00078         const std::string cpName() const;
00085         void setCpId(
00086             const OSB_LIB::Id<OSB_LIB::ConnectionPt>& cpId
00087         );
00089         void populate();
00090     private:
00092         Item* findItem(
00093             const OSB_LIB::Id<OSB_LIB::ConnectionPt>& cpId,
00094                   QListViewItem*                      fristChild
00095         );
00096     };
00097 
00101     class LvCpSelect::Item : public QListViewItem {
00103         typedef OSB_LIB::Id<OSB_LIB::ConnectionPt> CpId;
00104     public:
00106         Item(
00107                   QListView*             parent,
00108             const OSB_LIB::ConnectionPt& cp,
00109                   bool                   hasChildren
00110         );
00112         Item(
00113                   QListViewItem*         parent,
00114             const OSB_LIB::ConnectionPt& cp,
00115                   bool                   hasChildren
00116         );
00117     public:
00119         const CpId& cpId() const;
00121         const std::string cpName() const;
00123         void setOpen(bool open);
00124     private:
00126         CpId cpId_;
00127     };
00128 
00132     class SelectCp : public QWidget {
00133         Q_OBJECT                        // for vim ->;
00134     public:
00141         explicit SelectCp(
00142                   QWidget* parent,
00143             const char*    name   = "selectCp_",
00144                   WFlags   flags  = 0
00145         );
00152         void popup();
00158         bool result() const;
00160 
00161 
00162         OSB_LIB::Id<OSB_LIB::ConnectionPt> cpId() const;
00164         const std::string cpName() const;
00171         void setCpId(
00172             const OSB_LIB::Id<OSB_LIB::ConnectionPt>& cpId
00173         );
00180         void populate();
00182     signals:
00189         void sigClosed(bool result);
00190     private:
00192         void closeEvent(QCloseEvent* event);
00199         void keyPressEvent(QKeyEvent* event);
00205         void resizeEvent(QResizeEvent* event);
00206     private:
00208         LvCpSelect* lv_;
00210         bool result_;
00211     };                                  // class SelectCp
00212 
00216     class LeConnectionPt : public QLineEdit {
00217         Q_OBJECT                        // for vim ->;
00218     public:
00224         explicit LeConnectionPt(
00225                   QWidget* parent,
00226             const char*    name    = "leCp_"
00227         );
00228     public:
00230         const OSB_LIB::Id<OSB_LIB::ConnectionPt>& cpId() const;
00232         void setText(const OSB_LIB::ConnectionPt& cp);
00234         void clear();
00236         bool editable() const;
00238         void setEditable(bool on);
00239     private:
00241         void focusInEvent(QFocusEvent* event);
00243         void keyPressEvent(QKeyEvent* event);
00245         void mousePressEvent(QMouseEvent* event);
00251         void resizeEvent(QResizeEvent* event);
00252     private slots:
00254         void selectCp();
00256         void selectCpClosed(bool result);
00257     private:
00259         OSB_LIB::Id<OSB_LIB::ConnectionPt> cpId_;
00261         bool editable_;
00263         SelectCp* selectCp_;
00264     };                                  // class LeConnectionPt
00265 }                                       // namespace OSB_GUI
00266 
00267 // ************************************************************************
00268 // inline definitions
00269 namespace OSB_GUI {
00270 }                                       // namespace OSB_GUI
00271 #endif                                  // #ifndef _CPUTILS_H_

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