Ejemplo n.º 1
0
void MenuWidget::eraseItem(int pos)
{
	assert(pos >= 0 && pos < items_texts.size());

	items_texts.erase(items_texts.begin()+pos);
	items_checked.erase(items_checked.begin()+pos);
	items_rects.erase(items_rects.begin()+pos);

	if(focused_item >= items_texts.size())
		focused_item = items_texts.size() - 1;

	recompute_dimensions();
}
Ejemplo n.º 2
0
void MenuWidget::insertItem(std::string text, int pos)
{
	int size = items_texts.size();
	assert(pos <= size);

	if(pos < 0)pos = size;
	
	items_texts.insert(items_texts.begin()+pos, text);
	items_checked.insert(items_checked.begin()+pos, false);
	items_rects.insert(items_rects.begin()+pos, hgeRect());
	

	recompute_dimensions();
}
Ejemplo n.º 3
0
static void
piano_keyboard_size_allocate(GtkWidget *widget, GtkAllocation *allocation)
{
	/* XXX: Are these two needed? */
	g_return_if_fail(widget != NULL);
	g_return_if_fail(allocation != NULL);

	widget->allocation = *allocation;

	recompute_dimensions(PIANO_KEYBOARD(widget));

	if (GTK_WIDGET_REALIZED(widget)) {
		gdk_window_move_resize (widget->window, allocation->x, allocation->y, allocation->width, allocation->height);
	}
}
Ejemplo n.º 4
0
MenuWidget::MenuWidget(float x, float y)
:font("font1.fnt")
{
	focused_item = -1;
	is_visible = 0;

	rect = hgeRect(x, y, 0, 0);

	color.SetHWColor(0xFFFFE060);
	light_color.SetHWColor(0xFFFFFFFF);
	shadow.SetHWColor(0x30000000);
	offset = 2;
	timer = 0;
	frame = 2;
	spf = 0.1f;

	recompute_dimensions();
}