#ifndef _SELECTABLE_ITEM_H_
#define _SELECTABLE_ITEM_H_

/********************************************************************
	created:	 2009/07/23
	created:	 23:7:2009   19:20
	file base:	 selectable_item.h
	author:		 Nan Liangliang
    contact:     liangliangnan@gmail.com
    affiliation: Shenzhen Institute of Advanced Technology
	
	purpose:	 
*********************************************************************/


#include "geometry_types.h"
#include "geometry_global.h"
#include "color.h"



class GEOMETRY_API SelectableItem
{
public:
	SelectableItem(const Colorf& c = Colorf(0.0f, 0.0f, 0.0f, 1.0f))
		: color_(c)
		, visible_(true)
		, selected_(false)
		, highlighted_(false)
	{
	}

	virtual void set_color(const Colorf& c)  { color_ = c ; }
	const Colorf& color() const { 
		if (selected_)
			return Global::color_selected;
		else if (highlighted_)
			return Global::color_highlighted;
		else
			return color_ ; 
	}
	
	const float& point_size() const {
		if (highlighted_)
			return Global::highlighted_point_size;
		else
			return Global::point_size;
	}

	virtual bool is_visible() const  { return visible_; }
	virtual void set_visible(bool b) { visible_ = b ;   }

	bool is_selected() const  { return selected_; }
	virtual void set_selected(bool b) {	selected_ = b ; }

	bool is_highlighted() const  { return highlighted_; }
	virtual void set_highlighted(bool b) { highlighted_ = b ;   }

	virtual void draw() const = 0;
	virtual void draw_with_name(unsigned int i) const = 0; 

protected:
	bool         visible_ ;

	bool         selected_ ;
	bool         highlighted_;

	// Note: color changes according to the status. So client code 
	//       should not use it directly, use "color()" instead.
	Colorf      color_ ; 
} ;

#endif