Exemple #1
0
void PaletteItemButton::draw(DrawContext dc) {
	Glib::RefPtr<StyleContext> style = parent->get_style_context();

	Gdk::RGBA dark = style->get_border_color(STATE_FLAG_NORMAL);
	Gdk::RGBA light = style->get_color(STATE_FLAG_NORMAL);

	dc->set_antialias(Cairo::ANTIALIAS_NONE);
	if(select) {
		dc->set_source_rgb(dark.get_red(), dark.get_green(), dark.get_blue());
	}
	else if(opened) {
		Gdk::RGBA sel = style->get_color(STATE_FLAG_SELECTED);
		dc->set_source_rgb(sel.get_red(), sel.get_green(), sel.get_blue());
	}

	if(select || opened) {
		dc->rectangle(x, y, width, height);
		dc->fill();
		dc->set_line_width(1.0);
		dc->set_source_rgb(light.get_red(), light.get_green(), light.get_blue());
		dc->rectangle(x, y, width, height);
		dc->stroke();
	}

	dc->set_antialias(Cairo::ANTIALIAS_DEFAULT);
	/*
	if(select)
	style->paint_box(parent->get_window(),
						Gtk::STATE_ACTIVE,
						down ? Gtk::SHADOW_IN : Gtk::SHADOW_OUT,
						Gdk::Rectangle(x, y, width, height),
						*parent, ustring(), x, y, width, height);
	else if(opened)
		style->paint_box(parent->get_window(),
							Gtk::STATE_SELECTED,
							Gtk::SHADOW_IN,
							Gdk::Rectangle(x, y, width, height),
							*parent, ustring(), x, y, width, height);
	*/

	dc->save();
	dc->translate(x + 3, y + 3);
	Gdk::Cairo::set_source_pixbuf(dc, icon, 0.0, 0.0);
	dc->rectangle (0, 0, 24, 24);
	dc->clip();
	dc->paint();
	dc->restore();
}
Exemple #2
0
const Style Style::styleGTK(Glib::RefPtr<Gtk::StyleContext> styleContext)
{
	const auto colorPositive = styleContext->get_color();
	auto colorPositiveLight = colorPositive;
	colorPositiveLight.set_alpha(0.5);

	return
		{
			true,
			true,
			1.0,
			styleContext->get_background_color(),
			colorPositive,
			colorPositiveLight,
			Gdk::RGBA("#3080e9"),
			Gdk::RGBA("#505050"),
			Gdk::RGBA("#606060"),
			288.0,
			60.0,
			30.0,
			20.0,
			5.0,
			3.0,
			18.0
		};
}
Exemple #3
0
void PaletteItemGroup::draw(DrawContext dc) {
	Glib::RefPtr<StyleContext> style = parent->get_style_context();

	Gdk::RGBA dark = style->get_border_color(STATE_FLAG_NORMAL);
	Gdk::RGBA light = style->get_color(STATE_FLAG_NORMAL);

	dc->set_line_width(0.5);
	dc->set_source_rgb(dark.get_red() + 0.2, dark.get_green() + 0.2, dark.get_blue() + 0.2);
	dc->rectangle(x + 1, y, width, minHeight);
	dc->fill();
	dc->set_source_rgb(light.get_red(), light.get_green(), light.get_blue());
	dc->rectangle(x + 1, y, width, minHeight);
	dc->stroke();

//	if(select)
//		Gdk::Cairo::set_source_color(dc, style->get_text(Gtk::STATE_NORMAL));
//	else
//		Gdk::Cairo::set_source_color(dc, style->get_text(Gtk::STATE_SELECTED));
	dc->move_to(x + 10,y + 11);
	dc->set_font_size(GROUP_FONT_SIZE);
	dc->show_text(caption);

	PaletteItem::draw(dc);
}
Exemple #4
0
void PaletteItemTab::draw(DrawContext dc) {
	Glib::RefPtr<StyleContext> style = parent->get_style_context();

	Gdk::RGBA dark = style->get_border_color(STATE_FLAG_NORMAL);
	Gdk::RGBA light = style->get_color(STATE_FLAG_NORMAL);

	dc->set_line_width(0.5);

	if(select || opened) {
		if(select) {
			Gdk::RGBA norm = style->get_background_color(STATE_FLAG_NORMAL);
			//TypeColor sel = style->get_base(Gtk::STATE_SELECTED);

			Cairo::RefPtr<Cairo::LinearGradient> lin_grad = Cairo::LinearGradient::create(0, y, width, y + minHeight);
			//Cairo::RefPtr<Cairo::LinearGradient> lin_grad = Cairo::LinearGradient::create(width / 2, y, width / 2, y + minHeight);
			lin_grad->add_color_stop_rgb(0, dark.get_red(), dark.get_green(), dark.get_blue());
			lin_grad->add_color_stop_rgb(1, light.get_red(), light.get_green(), light.get_blue());
			dc->set_source(lin_grad);
		}
		else if(opened) {
			Gdk::RGBA sel = style->get_color(STATE_FLAG_SELECTED);
			dc->set_source_rgb(sel.get_red(), sel.get_green(), sel.get_blue());
		}

		dc->rectangle(x, y, width + 2, minHeight);
		dc->fill();

		/*
		tabRoundRect(dc, x + 1, y, width, minHeight);
		dc->fill();
		dc->set_source_rgb(light.get_red_p(), light.get_green_p(), light.get_blue_p());
		tabRoundRect(dc, x + 1, y, width, minHeight);
		dc->stroke();
		*/
	}
	//dc->rectangle(x, y, width, height);
	//dc->stroke();
	/*
	style->paint_box(parent->get_window(),
						opened ? Gtk::STATE_SELECTED : (select ? Gtk::STATE_ACTIVE : Gtk::STATE_NORMAL),
						Gtk::SHADOW_IN,
						Gdk::Rectangle(x + 1, y, width, 20),
						*parent, ustring(), x + 1, y, width, 20);
	*/
	if(select)
		dc->set_source_rgb(1.0, 1.0, 1.0);
	else
		dc->set_source_rgb(0.0, 0.0, 0.0);
	dc->move_to(x + 20,y + 14);
	dc->set_font_size(TAB_FONT_SIZE);
	dc->show_text(caption);

	dc->set_line_width(1);

	if(opened) {
		Cairo::Antialias a = dc->get_antialias();
		dc->set_antialias(Cairo::ANTIALIAS_NONE);
		dc->set_source_rgb(dark.get_red(), dark.get_green(), dark.get_blue());
		dc->move_to(x + 3, y + height);
		dc->rel_line_to(width - 6, 0);
		dc->stroke();
		dc->set_antialias(a);
	}

	dc->set_source_rgb(0.3, 0.3, 0.3);
	dc->arc(x + 10, y + 10, 4, 0, 2*3.1415);
	dc->fill();

	PaletteItem::draw(dc);
}