diff options
author | belugas <belugas@openttd.org> | 2007-03-10 03:25:15 +0000 |
---|---|---|
committer | belugas <belugas@openttd.org> | 2007-03-10 03:25:15 +0000 |
commit | 8ef56794abb5f01989165a72f20ae05be8c371bc (patch) | |
tree | 9f1ac38dc29ecc98c328a2f7352fcff640a84dbe /src | |
parent | 8b2f9c82070e75903bfcce30f1d21309d3a044d3 (diff) | |
download | openttd-8ef56794abb5f01989165a72f20ae05be8c371bc.tar.xz |
(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.
Diffstat (limited to 'src')
-rw-r--r-- | src/widget.cpp | 7 | ||||
-rw-r--r-- | src/window.h | 1 |
2 files changed, 8 insertions, 0 deletions
diff --git a/src/widget.cpp b/src/widget.cpp index 3b1cc8d21..8d564ac8f 100644 --- a/src/widget.cpp +++ b/src/widget.cpp @@ -235,6 +235,13 @@ void DrawWindowWidgets(const Window *w) 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); diff --git a/src/window.h b/src/window.h index 0ed84b2ac..7f48d523d 100644 --- a/src/window.h +++ b/src/window.h @@ -492,6 +492,7 @@ enum WindowWidgetTypes { 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 |