guiutils.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.28 $
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 _GUIUTILS_H_
00031 #define _GUIUTILS_H_
00032 
00033 // ************************************************************************
00034 // included header files
00035 // + standard includes
00036 #include <string>
00037 #include <sstream>
00038 
00039 // + libraries
00040 #include <osbconst.h>
00041 #include <stringutil.h>
00042 
00043 // + local headers
00044 
00045 // ************************************************************************
00046 // class declarations
00047 // + Qt
00048 class QCheckBox;
00049 class QCursor;
00050 class QDate;
00051 class QDateTime;
00052 class QLabel;
00053 class QListView;
00054 class QPixmap;
00055 class QRadioButton;
00056 class QRect;
00057 class QTime;
00058 class QWidget;
00059 
00060 namespace OSB_LIB {
00061     class Date;
00062     class DateTime;
00063     class Guard;
00064     class OsbError;
00065     class OsbException;
00066     class Time;
00067 }
00068 
00069 // ************************************************************************
00070 // namespace extensions
00071 namespace OSB_GUI {
00072 
00073     // Get the general purpose conversion to string.
00074     using OSB_LIB::mkStr;
00075 
00076     // ********************************************************************
00077     // Free functions
00078 
00080 
00081 
00082     inline int defMargin()  { return 11; }
00084     inline int defSpacing() { return  6; }
00086 
00092 
00093     void setOsbPalette(QLabel* lbl);
00095     void setOsbPalette(QRadioButton* rb);
00097     void setOsbPalette(QCheckBox* cb);
00099     void setOsbPalette(QListView* lv, bool mandatory = false);
00101     void setOsbPalette(QWidget* w, bool mandatory = false);
00103 
00122     OSB_LIB::Guard setAppCursor(
00123         const QCursor& cursor,
00124               bool     replace = false
00125     );
00126 
00132     OSB_LIB::Guard setAppCursor(
00133         int  cursorShape,
00134         bool replace      = false
00135     );
00137 
00143     class PopupMover {
00144     public:
00152         explicit PopupMover(
00153                   QWidget* popup,
00154             const QWidget* visParent = 0
00155         );
00156     public:
00158         bool insideTop() const;
00168         bool intoTop();
00182         bool intoTop(bool coverParent);
00183     private:
00185         QRect rect(
00186             const QWidget* widget,
00187                   bool     relTop
00188         ) const;
00189     private:
00191         QWidget* popup_;
00193         const QWidget* parent_;
00195         const QWidget* topLevel_;
00196     };                                  // class PopupMover
00197 
00199 
00200 
00201     std::string mkStr(const OSB_LIB::CfgStatus cfgStatus);
00210     std::string mkTsStr(
00211         const QDateTime&   ts,
00212         const std::string& notValid = ""
00213     );
00219     std::string mkTsStr(
00220         const OSB_LIB::DateTime& ts,
00221         const std::string&       notValid = ""
00222     );
00231     std::string mkDateStr(
00232         const QDateTime&   ts,
00233         const std::string& notValid = ""
00234     );
00240     std::string mkDateStr(
00241         const OSB_LIB::DateTime& ts,
00242         const std::string&       notValid = ""
00243     );
00252     std::string mkDateStr(
00253         const QDate&       date,
00254         const std::string& notValid = ""
00255     );
00261     std::string mkDateStr(
00262         const OSB_LIB::Date& ts,
00263         const std::string&   notValid = ""
00264     );
00266 
00268 
00269 
00270     const QPixmap& deletePixmap();
00272     const QPixmap& yesPixmap();
00274     const QPixmap& noPixmap();
00276     const QPixmap& nextPixmap();
00278     const QPixmap& prevPixmap();
00280     const QPixmap& mkPixmap(const OSB_LIB::CfgStatus cfgStatus);
00282 
00288     QDateTime mkDt(const OSB_LIB::DateTime& dt);
00289     QDateTime mkDt(const OSB_LIB::Date& d);
00290     QDate mkDate(const OSB_LIB::Date& d);
00291     QTime mkTime(const OSB_LIB::Time& t);
00293 
00295 
00296     OSB_LIB::Date mkDate(const QDate& d);
00297     OSB_LIB::Date mkDate(const QDateTime& d);
00299 
00301 
00302     // ToDo: more parameters needed: see sample implementation.
00303     void mbCritical(const OSB_LIB::OsbError& e);
00304     void mbCritical(const OSB_LIB::OsbException& e);
00306 }                                       // namespace OSB_GUI
00307 
00308 // ************************************************************************
00309 // inline definitions
00310 namespace OSB_GUI {
00311 }                                       // namespace OSB_GUI
00312 #endif                                  // #ifndef _GUIUTILS_H_

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