/*
 * Copyright (c) 2002 Robert Collins.
 * Copyright (c) 2005-2006 Tom N Harris.
 *
 *     This program is free software; you can redistribute it and/or modify
 *     it under the terms of the GNU General Public License as published by
 *     the Free Software Foundation; either version 2 of the License, or
 *     (at your option) any later version.
 *
 *     A copy of the GNU General Public License can be found at
 *     http://www.gnu.org/
 *
 * Written by Robert Collins <robertc@hotmail.com>
 * Written by Tom N Harris <telliamed@whoopdedo.org>
 *
 */

#ifndef SETUP_PICKLINE_H
#define SETUP_PICKLINE_H

#include <string>

#include "win32.h"
#include "cString.h"

namespace Setup
{

class PickView;

class PickLine
{
public:

	enum CheckState
	{
		CheckStateUnchecked,
		CheckStateChecked,
		CheckStateIndeterminate,
	};
	static CheckState NextCheckState(CheckState c)
	{
		c = CheckState(int(c) - 1);
		if (c < CheckStateUnchecked)
			c = CheckStateChecked;
		return c;
	}

	virtual void paint(HDC hdc, int x, int y, int row, int indent) = 0;
	virtual int click(int myrow, int ClickedRow, int x, int indent) = 0;
	virtual int itemCount() const = 0;
	virtual PickLine * getRow(int row) = 0;
	// this may indicate bad inheritance model.
	virtual bool isContainer(void) const = 0;
	virtual void insert(PickLine *) = 0;
	virtual void setColumn(int col, String const & text) = 0;
	virtual CheckState getCheckState() const = 0;
	virtual void setCheckState(CheckState checked) = 0;
	const std::string & key() const
		{ return m_key; }

	virtual ~PickLine()
	{
	};
protected:
	PickLine()
	{
	};
	PickLine(std::string const & aKey)
		: m_key(aKey)
	{
	};
	PickLine(PickLine const &);
	PickLine & operator=(PickLine const &);

	static void PickLine::DrawCheck(PickView &, HDC, HRGN, int, int, CheckState);

	friend class PickView;

	const std::string m_key;
};

};

#endif /* SETUP_PICKLINE_H */
