@@ -190,16 +190,16 @@ static const WindowDesc _thin_news_desc(
0,
_nested_thin_news_widgets, lengthof(_nested_thin_news_widgets)
);
/* Small news items. */
static const NWidgetPart _nested_small_news_widgets[] = {
/* Caption + close box */
/* Caption + close box. The caption is no WWT_CAPTION as the window shall not be moveable and so on. */
NWidget(NWID_HORIZONTAL),
NWidget(WWT_CLOSEBOX, COLOUR_LIGHT_BLUE, NTW_CLOSEBOX),
NWidget(WWT_CAPTION, COLOUR_LIGHT_BLUE, NTW_CAPTION), SetDataTip(STR_NEWS_MESSAGE_CAPTION, STR_NULL),
NWidget(WWT_EMPTY, COLOUR_LIGHT_BLUE, NTW_CAPTION), SetFill(1, 0),
EndContainer(),
/* Main part */
NWidget(WWT_PANEL, COLOUR_LIGHT_BLUE, NTW_HEADLINE),
NWidget(WWT_INSET, COLOUR_LIGHT_BLUE, NTW_INSET), SetPadding(2, 2, 2, 2),
NWidget(NWID_VIEWPORT, INVALID_COLOUR, NTW_VIEWPORT), SetPadding(1, 1, 1, 1), SetMinimalSize(274, 47), SetFill(1, 0),
@@ -391,15 +391,19 @@ struct NewsWindow : Window {
if (widget == NTW_DATE) SetDParam(0, this->ni->date);
}
virtual void DrawWidget(const Rect &r, int widget) const
{
switch (widget) {
case NTW_CAPTION:
DrawCaption(r, COLOUR_LIGHT_BLUE, this->owner, STR_NEWS_MESSAGE_CAPTION);
break;
case NTW_PANEL:
this->DrawNewsBorder(r);
return;
case NTW_MESSAGE:
CopyInDParam(0, this->ni->params, lengthof(this->ni->params));
DrawStringMultiLine(r.left + 2, r.right - 2, r.top, r.bottom, this->ni->string_id, TC_FROMSTRING, SA_CENTER);
@@ -523,13 +523,13 @@ static inline void DrawCloseBox(const Re
* Draw a caption bar.
* @param r Rectangle of the bar.
* @param colour Colour of the window.
* @param owner 'Owner' of the window.
* @param str Text to draw in the bar.
*/
static inline void DrawCaption(const Rect &r, Colours colour, Owner owner, StringID str)
void DrawCaption(const Rect &r, Colours colour, Owner owner, StringID str)
DrawFrameRect(r.left, r.top, r.right, r.bottom, colour, FR_BORDERONLY);
DrawFrameRect(r.left + 1, r.top + 1, r.right - 1, r.bottom - 1, colour, (owner == INVALID_OWNER) ? FR_LOWERED | FR_DARKENED : FR_LOWERED | FR_DARKENED | FR_BORDERONLY);
if (owner != INVALID_OWNER) {
GfxFillRect(r.left + 2, r.top + 2, r.right - 2, r.bottom - 2, _colour_gradient[_company_colours[owner]][4]);
@@ -129,14 +129,15 @@ enum WidgetDrawDistances {
WD_SORTBUTTON_ARROW_WIDTH = 11, ///< Width of up/down arrow of sort button state.
WD_PAR_VSEP_NORMAL = 2, ///< Normal amount of vertical space between two paragraphs of text.
WD_PAR_VSEP_WIDE = 8, ///< Large amount of vertical space between two paragraphs of text.
};
/* wiget.cpp */
/* widget.cpp */
void DrawFrameRect(int left, int top, int right, int bottom, Colours colour, FrameFlags flags);
void DrawCaption(const Rect &r, Colours colour, Owner owner, StringID str);
/* window.cpp */
extern Window *_z_front_window;
extern Window *_z_back_window;
extern Window *_focused_window;
Status change: