当前位置: 首页>>代码示例>>C++>>正文


C++ DeleteWindowById函数代码示例

本文整理汇总了C++中DeleteWindowById函数的典型用法代码示例。如果您正苦于以下问题:C++ DeleteWindowById函数的具体用法?C++ DeleteWindowById怎么用?C++ DeleteWindowById使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了DeleteWindowById函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: ShowNewsMessage

/** Do a forced show of a specific message */
static void ShowNewsMessage(const NewsItem *ni)
{
	assert(_total_news != 0);

	/* Delete the news window */
	DeleteWindowById(WC_NEWS_WINDOW, 0);

	/* setup forced news item */
	_forced_news = ni;

	if (_forced_news != NULL) {
		DeleteWindowById(WC_NEWS_WINDOW, 0);
		ShowNewspaper(ni);
	}
}
开发者ID:TeddyDesTodes,项目名称:openttd,代码行数:16,代码来源:news_gui.cpp

示例2: DEF_CONTENT_RECEIVE_COMMAND

DEF_CONTENT_RECEIVE_COMMAND(Client, PACKET_CONTENT_SERVER_CONTENT)
{
	if (this->curFile == NULL) {
		delete this->curInfo;
		/* When we haven't opened a file this must be our first packet with metadata. */
		this->curInfo = new ContentInfo;
		this->curInfo->type     = (ContentType)p->Recv_uint8();
		this->curInfo->id       = (ContentID)p->Recv_uint32();
		this->curInfo->filesize = p->Recv_uint32();
		p->Recv_string(this->curInfo->filename, lengthof(this->curInfo->filename));

		if (!this->BeforeDownload()) {
			this->Close();
			return false;
		}
	} else {
		/* We have a file opened, thus are downloading internal content */
		size_t toRead = (size_t)(p->size - p->pos);
		if (fwrite(p->buffer + p->pos, 1, toRead, this->curFile) != toRead) {
			DeleteWindowById(WC_NETWORK_STATUS_WINDOW, 0);
			ShowErrorMessage(STR_CONTENT_ERROR_COULD_NOT_DOWNLOAD_FILE_NOT_WRITABLE, STR_CONTENT_ERROR_COULD_NOT_DOWNLOAD, WL_ERROR);
			this->Close();
			fclose(this->curFile);
			this->curFile = NULL;

			return false;
		}

		this->OnDownloadProgress(this->curInfo, (uint)toRead);

		if (toRead == 0) this->AfterDownload();
	}

	return true;
}
开发者ID:oshepherd,项目名称:openttd-progsigs,代码行数:35,代码来源:network_content.cpp

示例3: MoveToNextItem

/** Move to the next news item */
static void MoveToNextItem()
{
	InvalidateWindowData(WC_STATUS_BAR, 0, SBI_NEWS_DELETED); // invalidate the statusbar
	DeleteWindowById(WC_NEWS_WINDOW, 0); // close the newspapers window if shown
	_forced_news = NULL;
	_statusbar_news_item = NULL;

	/* if we're not at the last item, then move on */
	if (_current_news != _latest_news) {
		_current_news = (_current_news == NULL) ? _oldest_news : _current_news->next;
		const NewsItem *ni = _current_news;
		const NewsType type = ni->type;

		/* check the date, don't show too old items */
		if (_date - _news_type_data[type].age > ni->date) return;

		switch (_news_type_data[type].GetDisplay()) {
			default: NOT_REACHED();
			case ND_OFF: // Off - show nothing only a small reminder in the status bar
				InvalidateWindowData(WC_STATUS_BAR, 0, SBI_SHOW_REMINDER);
				break;

			case ND_SUMMARY: // Summary - show ticker
				ShowTicker(ni);
				break;

			case ND_FULL: // Full - show newspaper
				ShowNewspaper(ni);
				break;
		}
	}
}
开发者ID:andythenorth,项目名称:NotRoadTypes,代码行数:33,代码来源:news_gui.cpp

示例4: ShowOnScreenKeyboard

/**
 * Show the on-screen keyboard (osk) associated with a given textbox
 * @param parent pointer to the Window where this keyboard originated from
 * @param button widget number of parent's textbox
 */
void ShowOnScreenKeyboard(Window *parent, int button)
{
	DeleteWindowById(WC_OSK, 0);

	GetKeyboardLayout();
	new OskWindow(&_osk_desc, parent, button);
}
开发者ID:J0anJosep,项目名称:OpenTTD,代码行数:12,代码来源:osk_gui.cpp

示例5: ShowDropDownListAt

/**
 * Show a drop down list.
 * @param w        Parent window for the list.
 * @param list     Prepopulated DropDownList. Will be deleted when the list is
 *                 closed.
 * @param selected The initially selected list item.
 * @param button   The widget which is passed to Window::OnDropdownSelect and OnDropdownClose.
 *                 Unless you override those functions, this should be then widget index of the dropdown button.
 * @param wi_rect  Coord of the parent drop down button, used to position the dropdown menu.
 * @param auto_width The width is determined by the widest item in the list,
 *                   in this case only one of \a left or \a right is used (depending on text direction).
 * @param instant_close Set to true if releasing mouse button should close the
 *                      list regardless of where the cursor is.
 */
void ShowDropDownListAt(Window *w, DropDownList *list, int selected, int button, Rect wi_rect, Colours wi_colour, bool auto_width, bool instant_close)
{
	DeleteWindowById(WC_DROPDOWN_MENU, 0);

	/* The preferred position is just below the dropdown calling widget */
	int top = w->top + wi_rect.bottom + 1;

	/* The preferred width equals the calling widget */
	uint width = wi_rect.right - wi_rect.left + 1;

	uint max_item_width = 0;

	if (auto_width) {
		/* Find the longest item in the list */
		for (DropDownList::const_iterator it = list->begin(); it != list->end(); ++it) {
			const DropDownListItem *item = *it;
			max_item_width = max(max_item_width, item->Width() + 5);
		}
	}

	/* Total length of list */
	int list_height = 0;

	for (DropDownList::const_iterator it = list->begin(); it != list->end(); ++it) {
		DropDownListItem *item = *it;
		list_height += item->Height(width);
	}

	/* Height of window visible */
	int height = list_height;

	/* Check if the status bar is visible, as we don't want to draw over it */
	int screen_bottom = GetMainViewBottom();
	bool scroll = false;

	/* Check if the dropdown will fully fit below the widget */
	if (top + height + 4 >= screen_bottom) {
		/* If not, check if it will fit above the widget */
		if (w->top + wi_rect.top - height > GetMainViewTop()) {
			top = w->top + wi_rect.top - height - 4;
		} else {
			/* ... and lastly if it won't, enable the scroll bar and fit the
			 * list in below the widget */
			int avg_height = list_height / (int)list->size();
			int rows = (screen_bottom - 4 - top) / avg_height;
			height = rows * avg_height;
			scroll = true;
			/* Add space for the scroll bar if we automatically determined
			 * the width of the list. */
			max_item_width += NWidgetScrollbar::GetVerticalDimension().width;
		}
	}

	if (auto_width) width = max(width, max_item_width);

	Point dw_pos = { w->left + (_current_text_dir == TD_RTL ? wi_rect.right + 1 - width : wi_rect.left), top};
	Dimension dw_size = {width, height};
	new DropdownWindow(w, list, selected, button, instant_close, dw_pos, dw_size, wi_colour, scroll);
}
开发者ID:fonsinchen,项目名称:openttd-cargodist,代码行数:73,代码来源:dropdown.cpp

示例6: free

BaseStation::~BaseStation()
{
	free(this->name);
	free(this->speclist);

	if (CleaningPool()) return;

	Owner owner = this->owner;
	if (!Company::IsValidID(owner)) owner = _local_company;
	WindowNumber wno = (this->index << 16) | VLW_STATION_LIST | owner;
	DeleteWindowById(WC_TRAINS_LIST, wno | (VEH_TRAIN << 11));
	DeleteWindowById(WC_ROADVEH_LIST, wno | (VEH_ROAD << 11));
	DeleteWindowById(WC_SHIPS_LIST, wno | (VEH_SHIP << 11));
	DeleteWindowById(WC_AIRCRAFT_LIST, wno | (VEH_AIRCRAFT << 11));

	this->sign.MarkDirty();
}
开发者ID:jemmyw,项目名称:openttd,代码行数:17,代码来源:station.cpp

示例7: free

BaseStation::~BaseStation()
{
	free(this->name);
	free(this->speclist);

	if (CleaningPool()) return;

	Owner owner = this->owner;
	if (!Company::IsValidID(owner)) owner = _local_company;
	if (!Company::IsValidID(owner)) return; // Spectators
	DeleteWindowById(WC_TRAINS_LIST,   VehicleListIdentifier(VL_STATION_LIST, VEH_TRAIN,    owner, this->index).Pack());
	DeleteWindowById(WC_ROADVEH_LIST,  VehicleListIdentifier(VL_STATION_LIST, VEH_ROAD,     owner, this->index).Pack());
	DeleteWindowById(WC_SHIPS_LIST,    VehicleListIdentifier(VL_STATION_LIST, VEH_SHIP,     owner, this->index).Pack());
	DeleteWindowById(WC_AIRCRAFT_LIST, VehicleListIdentifier(VL_STATION_LIST, VEH_AIRCRAFT, owner, this->index).Pack());

	this->sign.MarkDirty();
}
开发者ID:koreapyj,项目名称:openttd-yacd,代码行数:17,代码来源:station.cpp

示例8: while

/**
 * Clean up a station by clearing vehicle orders and invalidating windows.
 * Aircraft-Hangar orders need special treatment here, as the hangars are
 * actually part of a station (tiletype is STATION), but the order type
 * is OT_GOTO_DEPOT.
 */
Station::~Station()
{
	if (CleaningPool()) return;

	while (!this->loading_vehicles.empty()) {
		this->loading_vehicles.front()->LeaveStation();
	}

	Aircraft *a;
	FOR_ALL_AIRCRAFT(a) {
		if (!a->IsNormalAircraft()) continue;
		if (a->targetairport == this->index) a->targetairport = INVALID_STATION;
	}

	Vehicle *v;
	FOR_ALL_VEHICLES(v) {
		/* Forget about this station if this station is removed */
		if (v->last_station_visited == this->index) {
			v->last_station_visited = INVALID_STATION;
		}
	}

	this->sign.MarkDirty();
	InvalidateWindowData(WC_STATION_LIST, this->owner, 0);

	DeleteWindowById(WC_STATION_VIEW, index);
	WindowNumber wno = (this->index << 16) | VLW_STATION_LIST | this->owner;
	DeleteWindowById(WC_TRAINS_LIST, wno | (VEH_TRAIN << 11));
	DeleteWindowById(WC_ROADVEH_LIST, wno | (VEH_ROAD << 11));
	DeleteWindowById(WC_SHIPS_LIST, wno | (VEH_SHIP << 11));
	DeleteWindowById(WC_AIRCRAFT_LIST, wno | (VEH_AIRCRAFT << 11));

	/* Now delete all orders that go to the station */
	RemoveOrderFromAllVehicles(OT_GOTO_STATION, this->index);

	/* Remove all news items */
	DeleteStationNews(this->index);

	for (CargoID c = 0; c < NUM_CARGO; c++) {
		this->goods[c].cargo.Truncate(0);
	}

	CargoPacket::InvalidateAllFrom(this->index);
}
开发者ID:Voxar,项目名称:OpenTTD,代码行数:50,代码来源:station.cpp

示例9: DeleteWindowByClass

/* static */ void ScriptWindow::Close(WindowClass window, uint32 number)
{
	if (ScriptGame::IsMultiplayer()) return;

	if (number == NUMBER_ALL) {
		DeleteWindowByClass((::WindowClass)window);
		return;
	}

	DeleteWindowById((::WindowClass)window, number);
}
开发者ID:koreapyj,项目名称:openttd-yapp,代码行数:11,代码来源:script_window.cpp

示例10: OnClick

	virtual void OnClick(Point pt, int widget, int click_count)
	{
		if (widget == WID_NCDS_CANCELOK) {
			if (this->downloaded_bytes != this->total_bytes) {
				_network_content_client.Close();
				delete this;
			} else {
				/* If downloading succeeded, close the online content window. This will close
				 * the current window as well. */
				DeleteWindowById(WC_NETWORK_WINDOW, WN_NETWORK_WINDOW_CONTENT_LIST);
			}
		}
	}
开发者ID:gfarfl,项目名称:openttd-cargodist,代码行数:13,代码来源:network_content_gui.cpp

示例11: while

/**
 * Clean up a station by clearing vehicle orders and invalidating windows.
 * Aircraft-Hangar orders need special treatment here, as the hangars are
 * actually part of a station (tiletype is STATION), but the order type
 * is OT_GOTO_DEPOT.
 */
Station::~Station()
{
	if (CleaningPool()) {
		for (CargoID c = 0; c < NUM_CARGO; c++) {
			this->goods[c].cargo.OnCleanPool();
		}
		return;
	}

	while (!this->loading_vehicles.empty()) {
		this->loading_vehicles.front()->LeaveStation();
	}

	Aircraft *a;
	FOR_ALL_AIRCRAFT(a) {
		if (!a->IsNormalAircraft()) continue;
		if (a->targetairport == this->index) a->targetairport = INVALID_STATION;
	}

	Vehicle *v;
	FOR_ALL_VEHICLES(v) {
		/* Forget about this station if this station is removed */
		if (v->last_station_visited == this->index) {
			v->last_station_visited = INVALID_STATION;
		}
	}

	/* Clear the persistent storage. */
	delete this->airport.psa;

	if (this->owner == OWNER_NONE) {
		/* Invalidate all in case of oil rigs. */
		InvalidateWindowClassesData(WC_STATION_LIST, 0);
	} else {
		InvalidateWindowData(WC_STATION_LIST, this->owner, 0);
	}

	DeleteWindowById(WC_STATION_VIEW, index);

	/* Now delete all orders that go to the station */
	RemoveOrderFromAllVehicles(OT_GOTO_STATION, this->index);

	/* Remove all news items */
	DeleteStationNews(this->index);

	for (CargoID c = 0; c < NUM_CARGO; c++) {
		this->goods[c].cargo.Truncate(0);
	}

	CargoPacket::InvalidateAllFrom(this->index);
}
开发者ID:davidwlewis,项目名称:openttd-cargodist,代码行数:57,代码来源:station.cpp

示例12: CmdGoalQuestionAnswer

/**
 * Reply to a goal question.
 * @param tile unused.
 * @param flags type of operation
 * @param p1 Unique ID to use for this question.
 * @param p2 Button the company pressed
 * @param text Text of the question.
 * @return the cost of this operation or an error
 */
CommandCost CmdGoalQuestionAnswer(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const char *text)
{
	if (p1 > UINT16_MAX) return CMD_ERROR;
	if (p2 >= GOAL_QUESTION_BUTTON_COUNT) return CMD_ERROR;

	if (_current_company == OWNER_DEITY) {
		/* It has been requested to close this specific question on all clients */
		if (flags & DC_EXEC) DeleteWindowById(WC_GOAL_QUESTION, p1);
		return CommandCost();
	}

	if (_networking && _local_company == _current_company) {
		/* Somebody in the same company answered the question. Close the window */
		if (flags & DC_EXEC) DeleteWindowById(WC_GOAL_QUESTION, p1);
		if (!_network_server) return CommandCost();
	}

	if (flags & DC_EXEC) {
		Game::NewEvent(new ScriptEventGoalQuestionAnswer(p1, (ScriptCompany::CompanyID)(byte)_current_company, (ScriptGoal::QuestionButton)(1 << p2)));
	}

	return CommandCost();
}
开发者ID:Ayutac,项目名称:OpenTTD,代码行数:32,代码来源:goal.cpp

示例13: IConsoleSwitch

/** Toggle in-game console between opened and closed. */
void IConsoleSwitch()
{
	switch (_iconsole_mode) {
		case ICONSOLE_CLOSED:
			new IConsoleWindow();
			break;

		case ICONSOLE_OPENED: case ICONSOLE_FULL:
			DeleteWindowById(WC_CONSOLE, 0);
			break;
	}

	MarkWholeScreenDirty();
}
开发者ID:a7omic,项目名称:OpenTTD,代码行数:15,代码来源:console_gui.cpp

示例14: cur_company

/* static */ void AI::Stop(CompanyID company)
{
	if (_networking && !_network_server) return;

	Backup<CompanyByte> cur_company(_current_company, company, FILE_LINE);
	Company *c = Company::Get(company);

	delete c->ai_instance;
	c->ai_instance = NULL;

	cur_company.Restore();

	InvalidateWindowData(WC_AI_DEBUG, 0, -1);
	DeleteWindowById(WC_AI_SETTINGS, company);
}
开发者ID:a7omic,项目名称:OpenTTD,代码行数:15,代码来源:ai_core.cpp

示例15: CleanupGeneration

/**
 * Clean up the 'mess' of generation. That is, show windows again, reset
 * thread variables, and delete the progress window.
 */
static void CleanupGeneration()
{
	_generating_world = false;

	if (_cursor.sprite == SPR_CURSOR_ZZZ) SetMouseCursor(SPR_CURSOR_MOUSE, PAL_NONE);
	/* Show all vital windows again, because we have hidden them */
	if (_gw.threaded && _game_mode != GM_MENU) ShowVitalWindows();
	_gw.active   = false;
	_gw.proc     = NULL;
	_gw.abortp   = NULL;
	_gw.threaded = false;

	DeleteWindowById(WC_GENERATE_PROGRESS_WINDOW, 0);
	MarkWholeScreenDirty();
}
开发者ID:a7omic,项目名称:OpenTTD,代码行数:19,代码来源:genworld.cpp


注:本文中的DeleteWindowById函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。