* Copyright 2006, Haiku.
* Distributed under the terms of the MIT License.
*
* Authors:
* Stephan Aßmus <superstippi@gmx.de>
*/
#include "Selectable.h"
#include <debugger.h>
#include "Selection.h"
Selectable::Selectable()
: fSelected(false),
fSelection(NULL)
{
}
Selectable::~Selectable()
{
}
void
Selectable::SetSelected(bool selected, bool exclusive)
{
if (selected == fSelected)
return;
if (fSelection) {
if (selected)
fSelection->Select(this, !exclusive);
else
fSelection->Deselect(this);
} else {
debugger("Selectable needs to know Selection\n");
}
}
void
Selectable::SetSelection(Selection* selection)
{
fSelection = selection;
}
void
Selectable::_SetSelected(bool selected)
{
if (fSelected != selected) {
fSelected = selected;
SelectedChanged();
}
}