From 38b8259f3b85b91a1a4a4b1fbbff1a35c708810e Mon Sep 17 00:00:00 2001 From: frosch Date: Mon, 7 Jun 2010 19:56:32 +0000 Subject: (svn r19943) -Fix [FS#3865]: Disallow moving of vehicle news window. --- src/news_gui.cpp | 10 +++++++--- src/widget.cpp | 2 +- src/window_gui.h | 3 ++- 3 files changed, 10 insertions(+), 5 deletions(-) diff --git a/src/news_gui.cpp b/src/news_gui.cpp index d90b8eb3a..b73670175 100644 --- a/src/news_gui.cpp +++ b/src/news_gui.cpp @@ -193,10 +193,10 @@ static const WindowDesc _thin_news_desc( /* 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 */ @@ -394,9 +394,13 @@ struct NewsWindow : Window { 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; + break; case NTW_MESSAGE: CopyInDParam(0, this->ni->params, lengthof(this->ni->params)); diff --git a/src/widget.cpp b/src/widget.cpp index 350dcde80..298c7ab44 100644 --- a/src/widget.cpp +++ b/src/widget.cpp @@ -526,7 +526,7 @@ static inline void DrawCloseBox(const Rect &r, Colours colour, StringID str) * @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); diff --git a/src/window_gui.h b/src/window_gui.h index b1512abf9..5d15d8f5a 100644 --- a/src/window_gui.h +++ b/src/window_gui.h @@ -132,8 +132,9 @@ enum WidgetDrawDistances { 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; -- cgit v1.2.3-54-g00ecf