Changeset - r6278:6bb6cc195098
[Not reviewed]
master
0 2 0
belugas - 17 years ago 2007-03-10 03:25:15
belugas@openttd.org
(svn r9088) -Add : a new type of widget, called WWT_TEXT. It is a simple truncated string. It will be usefull on windows where lot of simple text is always drawn on the WE_PAINT event, making the code clearer. For now, left, right (total size of the window), top, color and data are necessary to use it. Maybe more features will be available soon.
2 files changed with 8 insertions and 0 deletions:
0 comments (0 inline, 0 general)
src/widget.cpp
Show inline comments
 
@@ -232,12 +232,19 @@ void DrawWindowWidgets(const Window *w)
 
			if ((wi->type & WWT_MASK) == WWT_TEXTBTN_2 && clicked) str++;
 

	
 
			DrawStringCentered(((r.left + r.right + 1) >> 1) + clicked, ((r.top + r.bottom + 1) >> 1) - 5 + clicked, str, 0);
 
			goto draw_default;
 
		}
 

	
 
		case WWT_TEXT: {
 
			StringID str = wi->data;
 

	
 
			if (str != STR_NULL) DrawStringTruncated(r.left, r.top, str, wi->color, r.right - r.left);
 
			break;
 
		}
 

	
 
		case WWT_INSET: {
 
			StringID str = wi->data;
 
			DrawFrameRect(r.left, r.top, r.right, r.bottom, wi->color, FR_LOWERED | FR_DARKENED);
 

	
 
			if (str != STR_NULL) DrawStringTruncated(r.left + 2, r.top + 1, str, 0, r.right - r.left - 10);
 
			goto draw_default;
src/window.h
Show inline comments
 
@@ -489,12 +489,13 @@ enum WindowWidgetTypes {
 
	WWT_IMGBTN,     ///< button with image
 
	WWT_IMGBTN_2,   ///< button with diff image when clicked
 

	
 
	WWT_TEXTBTN,    ///< button with text
 
	WWT_TEXTBTN_2,  ///< button with diff text when clicked
 
	WWT_LABEL,      ///< centered label
 
	WWT_TEXT,       ///< pure simple text
 
	WWT_MATRIX,
 
	WWT_SCROLLBAR,
 
	WWT_FRAME,      ///< frame
 
	WWT_CAPTION,
 

	
 
	WWT_HSCROLLBAR,
0 comments (0 inline, 0 general)