File diff r13591:48a163a06543 → r13592:acc23e8ddd40
src/signs_gui.cpp
Show inline comments
 
@@ -74,50 +74,48 @@ struct SignList {
 
		/* Reset the name sorter sort cache */
 
		this->last_sign = NULL;
 
	}
 
};
 

	
 
const Sign *SignList::last_sign = NULL;
 

	
 
/** Enum referring to the widgets of the sign list window */
 
enum SignListWidgets {
 
	SLW_CLOSEBOX = 0,
 
	SLW_CAPTION,
 
	SLW_STICKY,
 
	SLW_LIST,
 
	SLW_SCROLLBAR,
 
	SLW_RESIZE,
 
};
 

	
 
struct SignListWindow : Window, SignList {
 
	int text_offset; // Offset of the sign text relative to the left edge of the SLW_LIST widget.
 

	
 
	SignListWindow(const WindowDesc *desc, WindowNumber window_number) : Window()
 
	{
 
		this->InitNested(desc, window_number);
 

	
 
		this->vscroll.SetCapacity((this->GetWidget<NWidgetBase>(SLW_LIST)->current_y - WD_FRAMERECT_TOP - WD_FRAMERECT_BOTTOM) / this->resize.step_height);
 

	
 
		/* Create initial list. */
 
		this->signs.ForceRebuild();
 
		this->signs.ForceResort();
 
		this->BuildSignsList();
 
		this->SortSignsList();
 
		this->vscroll.SetCount(this->signs.Length());
 
	}
 

	
 
	virtual void OnPaint()
 
	{
 
		this->DrawWidgets();
 
	}
 

	
 
	virtual void DrawWidget(const Rect &r, int widget) const
 
	{
 
		switch (widget) {
 
			case SLW_LIST: {
 
				uint y = r.top + WD_FRAMERECT_TOP; // Offset from top of widget.
 
				/* No signs? */
 
				if (this->vscroll.GetCount() == 0) {
 
					DrawString(r.left + WD_FRAMETEXT_LEFT, r.right, y, STR_STATION_LIST_NONE);
 
					return;
 
				}