/*
 * This file is part of roccat-tools.
 *
 * roccat-tools 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.
 *
 * roccat-tools is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with roccat-tools. If not, see <http://www.gnu.org/licenses/>.
 */

#include "konepure_color_palette_button.h"
#include "roccat/konepure.h"

#define KONEPURE_COLOR_PALETTE_BUTTON_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), KONEPURE_COLOR_PALETTE_BUTTON_TYPE, KonepureColorPaletteButtonClass))
#define IS_KONEPURE_COLOR_PALETTE_BUTTON_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), KONEPURE_COLOR_PALETTE_BUTTON_TYPE))

typedef struct _KonepureColorPaletteButtonClass KonepureColorPaletteButtonClass;

struct _KonepureColorPaletteButton {
	RoccatColorPaletteButton parent;
};

struct _KonepureColorPaletteButtonClass {
	RoccatColorPaletteButtonClass parent_class;
};

G_DEFINE_TYPE(KonepureColorPaletteButton, konepure_color_palette_button, ROCCAT_COLOR_PALETTE_BUTTON_TYPE);

/* these are the colors for on screen display, which differ from the device colors */
static GdkColor const colors[KONEPURE_RMP_LIGHT_INFO_COLORS_NUM] = {
	{0, 0x06 * 257, 0x90 * 257, 0xfd * 257},
	{0, 0x00 * 257, 0x73 * 257, 0xff * 257},
	{0, 0x24 * 257, 0x00 * 257, 0xff * 257},
	{0, 0x5c * 257, 0x18 * 257, 0xe9 * 257},
	{0, 0x80 * 257, 0x17 * 257, 0xe5 * 257},
	{0, 0xc6 * 257, 0x18 * 257, 0xeb * 257},
	{0, 0xff * 257, 0x05 * 257, 0x81 * 257},
	{0, 0xfb * 257, 0x15 * 257, 0x00 * 257},
	{0, 0xfc * 257, 0x7c * 257, 0x00 * 257},
	{0, 0xfe * 257, 0xf2 * 257, 0x00 * 257},
	{0, 0xce * 257, 0xfb * 257, 0x18 * 257},
	{0, 0x27 * 257, 0xfe * 257, 0x03 * 257},
	{0, 0x1c * 257, 0xa7 * 257, 0x30 * 257},
	{0, 0x15 * 257, 0xea * 257, 0x96 * 257},
	{0, 0x0e * 257, 0xeb * 257, 0xe2 * 257},
	{0, 0x00 * 257, 0xc5 * 257, 0xfa * 257},
};

GtkWidget *konepure_color_palette_button_new(void) {
	KonepureColorPaletteButton *button;

	button = KONEPURE_COLOR_PALETTE_BUTTON(g_object_new(KONEPURE_COLOR_PALETTE_BUTTON_TYPE,
			NULL));

	roccat_color_palette_button_set_colors(ROCCAT_COLOR_PALETTE_BUTTON(button), colors, KONEPURE_RMP_LIGHT_INFO_COLORS_NUM);

	return GTK_WIDGET(button);
}

static void konepure_color_palette_button_init(KonepureColorPaletteButton *button) {}

static void konepure_color_palette_button_class_init(KonepureColorPaletteButtonClass *klass) {}
