Ejemplo n.º 1
0
	Text_input::Text_input(std::string font, Mesure x, Mesure y, Mesure w, Mesure h, WritingRestriction wrestriction) :Rectangle(x, y, w, h), restrictions(wrestriction)
	{
		set_bgcolor(0xffffff);
		set_bgopacity(1);
		set_font(font);
		set_font_size(21);
		set_alignement(left);
		ever_refresh_text = true;
	}
Ejemplo n.º 2
0
void draw_nullstate(MENU *state) {
	set_bgcolor(state->bgcolor);
	clr();

	int i;
	for (i = 0; i < state->buttonCount; i++) {
		draw_text_button(state->buttons[i]);
	}

}
Ejemplo n.º 3
0
void draw_recordstate(MENU *state) {
#ifdef STATETESTMODE
	printf("Clear state for record state->\n");
#endif
	set_bgcolor(state->bgcolor);
	clr();

	int i;
	for (i = 0; i < state->buttonCount; i++) {
		draw_text_button(state->buttons[i]);
	}
}
Ejemplo n.º 4
0
void draw_component(int origin_x, int origin_y, component *comp) {
	int x = comp->x+origin_x;
	int y = comp->y+origin_y;
	if (comp->hidden == 0) {
		set_style(comp->style);
		set_color(comp->color);
		set_bgcolor(comp->bgcolor);
		draw(x, y, comp->resource);
	}
	if (comp->next != NULL) {
		draw_component(origin_x, origin_y, comp->next);
	}
	if (comp->child != NULL) {
		draw_component(x, y, comp->child);
	}
}
Ejemplo n.º 5
0
Archivo: oo_ui.c Proyecto: EX311/moira
int main(int argc, char *argv[])
{
	int ret;
	struct tsdev *ts;
	lua_State *L;

	myfb = myfb_open();
	set_vfb_buf(1);
	ts = ts_init();

	L = luaL_newstate();
	luaL_openlibs(L);

	lua_register(L, "SET_COUNT", lua_set_icon_count);
	lua_register(L, "SET_ICON", lua_set_icon_info);
	lua_register(L, "SET_CMD", lua_set_cmd_list);
	lua_register(L, "SET_BGCOLOR", lua_set_bgcolor);
	lua_register(L, "SET_BGIMAGE", lua_set_bgimage);

	luaL_dofile(L, file_ui);
	lua_close(L);

	while (1) {
		int c, da_count, old_da_count, pid, state = 0;
		struct ts_sample samp;
		struct icon *i;
		struct cmd_list *j;

		da_count = get_DeviceAttached();
		if (!da_count)
			da_count = 0;

		if (!old_da_count)
			old_da_count = da_count;
		else {
			if (old_da_count != da_count) {
				clear_screen();
				put_string_center(myfb->fbvar.xres/2, myfb->fbvar.yres/2 - 10, "Attached Info is changed!", white);
				put_string_center(myfb->fbvar.xres/2, myfb->fbvar.yres/2 + 10, "Touch the screen!", white);
				old_da_count = da_count;
				ret = ts_read(ts, &samp, 1);
				continue;
			}
		}

		set_bgimage();
		set_bgcolor();
		for (c=0; c<=da_count; c++)
			draw_block(myfb->fbvar.xres-12*c-12, 3);
		
		if (head == NULL) {
			put_string_center(myfb->fbvar.xres/2, myfb->fbvar.yres/2, "Sorry, No Apps. registered!", white);
#ifdef DEBUG
			fprintf(stderr, "No Apps!\n");
#endif
			break;
		}

		for (i=head; i != NULL; i=i->next)
			draw_icon(i);

		ret = ts_read(ts, &samp, 1);
		if (ret < 0) {
			perror("ts_read");
			continue;
		}
		if (ret != 1)
			continue;

		if (samp.x > 310 && samp.y >230)
			break;

		for (i=head, j=cmdlist; i != NULL; i=i->next, j=j->next) {
			if (icon_handle(i, &samp) > 0) {
				if (chat_count < 20)
					continue;
				chat_count = 0;

				pid = fork();
				if (pid == 0) {
#ifdef DEBUG
					fprintf(stderr, " *** This is CHILD! ***\n");
#endif
					if (j)
						ret = execl(j->path, j->args, 0);
					if (ret < 0) {
						perror("execl");
						exit(1);
					}
				} else {
					sleep(1);
					wait(&state);
					no_count = 0;
					put_string_center(myfb->fbvar.xres/2, myfb->fbvar.yres/2, "End of Program!", white);
#ifdef DEBUG
					fprintf(stderr, " *** End of CHILD! ***\n");
#endif
				}
			}
		}
	}

	clear_screen();
	put_string_center(myfb->fbvar.xres/2, myfb->fbvar.yres/2, "Thanks for Use!", white);

	free_icon();
	free_cmd();
	ts_close(ts);
	free_vfb_buf(1);
	myfb_close();
	return 0;
}