Пример #1
0
void
APRView::_UpdatePreviews(const BMessage& colors)
{
	rgb_color color;
	for (int32 i = color_description_count() - 1; i >= 0; i--) {
		ColorWhichItem* item = static_cast<ColorWhichItem*>(fAttrList->ItemAt(i));
		if (item == NULL)
			continue;

		color = colors.GetColor(ui_color_name(get_color_description(i)->which),
			make_color(255, 0, 255));

		item->SetColor(color);
		fAttrList->InvalidateItem(i);
	}
}
Пример #2
0
void
APRView::MessageReceived(BMessage *msg)
{
	if (msg->WasDropped()) {
		rgb_color* color = NULL;
		ssize_t size = 0;

		if (msg->FindData("RGBColor", (type_code)'RGBC', (const void**)&color,
				&size) == B_OK) {
			_SetCurrentColor(*color);

			Window()->PostMessage(kMsgUpdate);
		}
	}

	switch (msg->what) {
		case UPDATE_COLOR:
		{
			// Received from the color fPicker when its color changes
			rgb_color color = fPicker->ValueAsColor();
			_SetCurrentColor(color);

			Window()->PostMessage(kMsgUpdate);
			break;
		}

		case ATTRIBUTE_CHOSEN:
		{
			// Received when the user chooses a GUI fAttribute from the list

			ColorWhichItem* item = (ColorWhichItem*)
				fAttrList->ItemAt(fAttrList->CurrentSelection());
			if (item == NULL)
				break;

			fWhich = item->ColorWhich();
			rgb_color color = ui_color(fWhich);
			_SetCurrentColor(color);
			break;
		}

		default:
			BView::MessageReceived(msg);
			break;
	}
}
Пример #3
0
void
APRView::_SetCurrentColor(rgb_color color)
{
	set_ui_color(fWhich, color);
	fCurrentColors.SetColor(ui_color_name(fWhich), color);

	int32 currentIndex = fAttrList->CurrentSelection();
	ColorWhichItem* item = (ColorWhichItem*)fAttrList->ItemAt(currentIndex);
	if (item != NULL) {
		item->SetColor(color);
		fAttrList->InvalidateItem(currentIndex);
	}

	fPicker->SetValue(color);
	fColorPreview->SetColor(color);
	fColorPreview->Invalidate();
}
Пример #4
0
void
APRView::MessageReceived(BMessage *msg)
{
	if (msg->WasDropped()) {
		rgb_color *color;
		ssize_t size;

		if (msg->FindData("RGBColor", (type_code)'RGBC', (const void**)&color,
				&size) == B_OK) {
			SetCurrentColor(*color);
		}
	}

	switch (msg->what) {
		case DECORATOR_CHANGED:
		{
			int32 index = fDecorMenu->IndexOf(fDecorMenu->FindMarked());
			#ifdef ANTARES_TARGET_PLATFORM_ANTARES
			if (index >= 0)
				BPrivate::set_decorator(index);
			#endif
			break;
		}
		case UPDATE_COLOR:
		{
			// Received from the color fPicker when its color changes
			rgb_color color = fPicker->ValueAsColor();
			SetCurrentColor(color);	
			
			Window()->PostMessage(kMsgUpdate);
			break;
		}
		case ATTRIBUTE_CHOSEN:
		{
			// Received when the user chooses a GUI fAttribute from the list

			ColorWhichItem *item = (ColorWhichItem*)
				fAttrList->ItemAt(fAttrList->CurrentSelection());
			if (item == NULL)
				break;

			fWhich = item->ColorWhich();
			rgb_color color = fCurrentSet.GetColor(fWhich);
			SetCurrentColor(color);

			Window()->PostMessage(kMsgUpdate);
			break;
		}
		case REVERT_SETTINGS:
		{
			fCurrentSet = fPrevSet;

			UpdateControls();
			UpdateAllColors();

			Window()->PostMessage(kMsgUpdate);
			break;
		}
		case DEFAULT_SETTINGS:
		{
			fCurrentSet = ColorSet::DefaultColorSet();

			UpdateControls();
			UpdateAllColors();

			if (fDecorMenu) {
				BMenuItem *item = fDecorMenu->FindItem("Default");
				if (item) {
					item->SetMarked(true);
					#ifdef ANTARES_TARGET_PLATFORM_ANTARES
					BPrivate::set_decorator(fDecorMenu->IndexOf(item));
					#endif
				}
			}
			Window()->PostMessage(kMsgUpdate);
			break;
		}
		default:
			BView::MessageReceived(msg);
			break;
	}
}