/* ====================================================================
 * Copyright (c) 2003-2006, Martin Hauner
 *                          http://subcommander.tigris.org
 *
 * Subcommander is licensed as described in the file doc/COPYING, which
 * you should have received as part of this distribution.
 * ====================================================================
 */

#ifndef _SC_LOGLVI_H
#define _SC_LOGLVI_H

// sc
#include "LogData.h"
#include "util/Id.h"
class Cancel;

// qt
#include <qlistview.h>


class LogLvi : public QListViewItem
{
  typedef QListViewItem super;

public:
  LogLvi( QListView* parent, const LogData* data );
  LogLvi( QListViewItem* parent, const LogData* data );
  virtual ~LogLvi();

  // -1  i > this
  // 0   i = this
  // 1   i < this
  int compare( QListViewItem*, int, bool ) const;
  void paintCell( QPainter* p, const QColorGroup& cg, int column, int width, int alignment );

  unsigned long getId();

  void add( const LogData* data );
  void start();
  void stop();

  bool isStopped() const;
  bool isCancelable() const;
  bool isError() const;

  void setCancelable( Cancel* );
  void setCanceled();
  void setCancelNormal();
  void setCancelActive();
  void setCancelDisabled();
  
  bool isOnCancel( int x );

private:
  bool hasError();
  void adjustColumns();

  unsigned long    _sortId;
  const LogData*   _data;

  bool             _stopped;
  bool             _canceled;
  LogLvi*          _last;
  Cancel*          _cancel;
};


#endif //  _SC_LOGLVI_H


syntax highlighted by Code2HTML, v. 0.9.1