/********************************* CPrtQListViewItem.h ****************************
 *                                                                                *
 *                                                                                *
 *   This program is free software; you can redistribute it and/or modify         *
 *   it under the terms of the CeCILL Version 1 du 21/06/2004                     *
 *   License (GPL compatible)                                                     *
 *                              http://www.cecill.info/                           *
 *   as published by :                                                            *
 *                                                                                *
 *   Commissariat à l'Energie Atomique                                            *
 *   - CEA,                                                                       *
 *                            31-33 rue de la Fédération, 75752 PARIS cedex 15.   *
 *                            FRANCE                                              *
 *   Centre National de la Recherche Scientifique                                 *
 *   - CNRS,                                                                      *
 *                            3 rue Michel-Ange, 75794 Paris cedex 16.            *
 *                            FRANCE                                              *
 *   Institut National de Recherche en Informatique et en Automatique             *
 *   - INRIA,                                                                     *
 *                            Domaine de Voluceau, Rocquencourt, BP 105, 78153    *
 *                            FRANCE                                              *
 *                                                                                *
 *         This program is distributed in the hope that it will be useful,        *
 *         but WITHOUT ANY WARRANTY; without even the implied warranty of         *
 *         MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.                   *
 *         CeCILL  License (GPL compatible) for more details.                     *
 *                                                                                *
 **********************************************************************************/

// C++ Interface: CPrtQListViewItem.h
//
// Description:
//
//
// Author: Eric MAEKER <eric.maeker@free.fr>, (C) 2008
//
// Copyright: See COPYING file that comes with this distribution
//
//
#ifndef CPrtQListViewItem_H
#define CPrtQListViewItem_H
#include <qstring.h>
#include <qlistview.h>
#include <qstring.h>
#include <qpainter.h>
#include <qcolor.h>
#include <qstyle.h>
#include <qdatetime.h>
#include <qpixmap.h>
#include "Theme.h"


#define LISTVIEW_TYPE_COLUMN		0
#define LISTVIEW_PRIORITY_COLUMN	1
#define LISTVIEW_ETAT_COLUMN		2

#define LISTVIEW_DATE_COLUMN		3
#define LISTVIEW_LIBELLE_COLUMN		4

//#define SPACE_TXT 9
class CPrtQListViewItem : public QListViewItem
{
public:

   CPrtQListViewItem(QListView * listview ,
		     const QString &libelle ,
		     const QString &idRubList,
		     const QString &date, 
		     const QString &pkDoc, 
		     const QString &subType,
		     const QString &type,
		     const QString &signUser,
		     const QString &user);

   CPrtQListViewItem(QListViewItem * listview ,
		     const QString &libelle ,
		     const QString &idRubList,
		     const QString &date, 
		     const QString &pkDoc, 
		     const QString &subType,
		     const QString &type,
		     const QString &signUser,
		     const QString &user);

   CPrtQListViewItem(QListViewItem * listview ,
		     QListViewItem * after ,
		     const QString libelle = QString::null );

   CPrtQListViewItem(QListView     * listview ,
		     QListViewItem * after ,
		     const QString libelle = QString::null );

   ~CPrtQListViewItem();


   void    setValue(const QString &iD_Rublist, const QString  &type, const QString &user, const QString &subType) ;
   void    getValue(QString &iD_Rublist, QString  &type, QString &user, QString &subType) ;

   QString	get_ID_Rublist() ;
   QString	getPkDoc() ;
   QString	getLibelle();
   QString	getType() ;
   QString	getUser() ;
   QString	getSubType();
   QString	getNom();
   QString	getPrenom();
   QString	getGUID();

   QString	getDate(QString& format);
   QDateTime	getDate();
   bool		isLightBackground();


   void		setPkDoc(QString n);
   void		setNom (QString n);
   void		setPrenom (QString n);
   void		setGUID (QString n);
   void		set_ID_Rublist(QString& n);
   void		set_ID_Rublist(int n);
   void		setType(QString& n);
   void		setUser(QString& n);
   void		setSignUser(QString& n);
   void		setSubType(QString& n);
   void		setDate(QString& n);
   void		setDate(QDateTime& dt);
   void		setLightBackground(bool c);
   void		setModified( bool m );

   // Réimplémentation du trie  pour les dates essentiellement
   int compare( QListViewItem *i, int col, bool asc ) const;
   // Réimplémentation pour l'esthétique
   void paintCell( QPainter * p, const QColorGroup & cg, int column, int width, int align );

   // Conserve la mise en forme de chaque colonnes
   void		columnStyleInitialise(int nbColumns);


 //................. DATA .....................................


protected:
   QString	m_Type;			/*!< Type de la rubrique. \sa CRubList.h */
   QString	m_SubType;		/*!< Sous-type de la rubrique. */
   QString	m_ID_Rublist;		/*!< Position de l'item dans la RubList. */
   QString	m_Libelle;		/*!< Libelle de la rubrique. */
   QString	m_pkDoc;		/*!< Clé primaire de la rubrique. */
   QString	m_User;			/*!< Utilisateur Actuel */
   QString	m_signUser;		/*!< Utilisateur signataire de la rubrique */
   QDateTime	m_Date;			/*!< Date de la rubrique */
   QString	m_GUID;			/*!< GUID Patient si besoin */
   QString	m_NomPatient;		/*!< Nom du Patient si besoin */
   QString	m_PrenomPatient;	/*!< Prénom du Patient si besoin */

   bool		m_LightBackground;	/*!< Couleur du background de la QListViewItem (TRUE=light, FALSE=dark) */
   bool		m_Modified;		/*!< Signale une modification dans le contenu du document associé à cet item */
   QMemArray<bool>	columnIsBold;	/*!< Sauvegarde le style de chaque colonnes */
   QMemArray<bool>	columnIsItalic;	/*!< Sauvegarde le style de chaque colonnes */
   QMemArray<bool>	columnIsUnderline;	/*!< Sauvegarde le style de chaque colonnes */

};

#endif
