示例#1
0
int BC_Pot::repeat_event(int64_t duration)
{
	if(duration == top_level->get_resources()->tooltip_delay)
	{
		if(tooltip_on)
		{
			if(keypress_tooltip_timer > 0)
			{
				keypress_tooltip_timer -= get_resources()->tooltip_delay;
			}
			else
			if(status != POT_HIGH && status != POT_DN)
			{
				hide_tooltip();
			}
		}
		else
		if(status == POT_HIGH)
		{
			if(use_caption && tooltip_text)
			{
				if(!tooltip_text[0] || isdigit(tooltip_text[0]))
				{
					set_tooltip(get_caption());
					show_tooltip(50);
				}
				else
					show_tooltip();
				tooltip_done = 1;
			}
			return 1;
		}
	}
	return 0;
}
示例#2
0
static nsresult NSAPI nsTooltipListener_OnShowTooltip(nsITooltipListener *iface,
        PRInt32 aXCoord, PRInt32 aYCoord, const PRUnichar *aTipText)
{
    NSContainer *This = NSTOOLTIP_THIS(iface);

    show_tooltip(This->doc, aXCoord, aYCoord, aTipText);

    return NS_OK;
}
示例#3
0
void BC_Pot::show_value_tooltip()
{
	if(use_caption)
	{
		set_tooltip(get_caption());
		show_tooltip(50);
		keypress_tooltip_timer = 2000;
	}
}
示例#4
0
int BC_Pan::repeat_event(int64_t duration)
{
	if( highlighted && !active && !tooltip_done &&
		tooltip_text && tooltip_text[0] != 0 &&
		duration == top_level->get_resources()->tooltip_delay )
	{
		show_tooltip();
		tooltip_done = 1;
		return 1;
	}
	return 0;
}
示例#5
0
/**
 * Add a close button.
 * @param x X position of the button
 * @param y Y position of the button */
void shop_add_close_button(int x, int y)
{
	int mx, my, mb;

	mb = SDL_GetMouseState(&mx, &my) & SDL_BUTTON(SDL_BUTTON_LEFT);

	/* Show X as background */
	StringBlt(ScreenSurface, &SystemFont, "X", x + 1, y + 1, COLOR_BLACK, NULL, NULL);

	/* If mouse is over it */
	if (mx > x - 3 && mx < x + 7 && my > y && my < y + 12)
	{
		/* Show the X in gold */
		StringBlt(ScreenSurface, &SystemFont, "X", x, y, COLOR_HGOLD, NULL, NULL);

		/* If it was clicked, close the shop */
		if (mb && mb_clicked)
		{
			clear_shop(1);
		}
		/* Otherwise display a tooltip */
		else
		{
			if (shop_gui->shop_state == SHOP_STATE_NONE)
			{
				show_tooltip(mx, my, "Click to cancel opening the shop");
			}
			else
			{
				show_tooltip(mx, my, "Close the shop window");
			}
		}
	}
	/* Mouse is not over it, show in white */
	else
	{
		StringBlt(ScreenSurface, &SystemFont, "X", x, y, COLOR_WHITE, NULL, NULL);
	}
}
void process(int mousex, int mousey)
{
	for(std::vector<tooltip>::const_iterator i = tips.begin(); i != tips.end(); ++i) {
		if(mousex > i->rect.x && mousey > i->rect.y &&
		   mousex < i->rect.x + i->rect.w && mousey < i->rect.y + i->rect.h) {
			if(current_tooltip != i) {
				show_tooltip(*i);
				current_tooltip = i;
			}

			return;
		}
	}

	clear_tooltip();
	current_tooltip = tips.end();
}
示例#7
0
void lua_script_init(lua_State **L,HANDLE **lua_filenotify,__int64 *ft)
{
	char fscript[MAX_PATH]={0};
	int script_changed=FALSE;

	get_lua_script_fname(fscript,sizeof(fscript));

	if(lua_script_enable){
		__int64 tt=0;
		get_last_write_time(fscript,&tt);
		if(tt!=(*ft)){
			script_changed=TRUE;
			hide_tooltip();
		}
	}

	if(lua_script_enable){
		if((*L)==0 || script_changed){
			lua_State *lua;
			lua=luaL_newstate();
			if(lua!=0){
				luaL_openlibs(lua);
				if(luaL_loadfile(lua,fscript)!=LUA_OK){
					printf("luaL_loadfile error:%s\n",lua_tostring(lua, -1));
					show_tooltip(lua_tostring(lua, -1),0,0);
					lua_close(lua);
				}
				else{
					lua_register_c_functions(lua);
					if(lua_pcall(lua,0,0,0)!=LUA_OK){
						printf("lua_pcall error:%s\n",lua_tostring(lua, -1));
						show_tooltip(lua_tostring(lua, -1),0,0);
						lua_close(lua);
					}
					else{
						if((*L)!=0)
							lua_close(*L);
						*L=lua;
						get_last_write_time(fscript,ft);
						lua_error_msg=0;
						hide_tooltip();
					}
				}
			}
		}
	}
	if(*lua_filenotify!=0){
		if(FindNextChangeNotification(*lua_filenotify)==0){
			FindCloseChangeNotification(*lua_filenotify);
			*lua_filenotify=0;
		}
	}
	if(*lua_filenotify==0){
		HANDLE fn;
		char path[MAX_PATH]={0};
		get_ini_path(path,sizeof(path));
		fn=FindFirstChangeNotification(path,FALSE,FILE_NOTIFY_CHANGE_FILE_NAME|FILE_NOTIFY_CHANGE_LAST_WRITE);
		if(fn!=INVALID_HANDLE_VALUE)
			*lua_filenotify=fn;
	}
}