Public Member Functions | |
NewsWindow (const WindowDesc *desc, const NewsItem *ni) | |
void | DrawNewsBorder (const Rect &r) const |
virtual Point | OnInitialPosition (const WindowDesc *desc, int16 sm_width, int16 sm_height, int window_number) |
Compute the initial position of the window. | |
virtual void | OnPaint () |
The window must be repainted. | |
virtual void | UpdateWidgetSize (int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize) |
Update size and resize step of a widget in the window. | |
virtual void | SetStringParameters (int widget) const |
Initialize string parameters for a widget. | |
virtual void | DrawWidget (const Rect &r, int widget) const |
Draw the contents of a nested widget. | |
virtual void | OnClick (Point pt, int widget, int click_count) |
A click with the left mouse button has been made on the window. | |
virtual EventState | OnKeyPress (uint16 key, uint16 keycode) |
A key has been pressed. | |
virtual void | OnInvalidateData (int data) |
Some data on this window has become invalid. | |
virtual void | OnTick () |
Called once per (game) tick. | |
Data Fields | |
uint16 | chat_height |
Height of the chat window. | |
uint16 | status_height |
Height of the status bar window. | |
const NewsItem * | ni |
News item to display. | |
Static Public Attributes | |
static uint | duration = 0 |
Remaining time for showing current news message (may only be accessed while a news item is displayed). | |
Private Member Functions | |
StringID | GetCompanyMessageString () const |
StringID | GetNewVehicleMessageString (int widget) const |
Definition at line 279 of file news_gui.cpp.
virtual Point NewsWindow::OnInitialPosition | ( | const WindowDesc * | desc, | |
int16 | sm_width, | |||
int16 | sm_height, | |||
int | window_number | |||
) | [inline, virtual] |
Compute the initial position of the window.
*desc | The pointer to the WindowDesc of the window to create. | |
sm_width | Smallest width of the window. | |
sm_height | Smallest height of the window. | |
window_number | The window number of the new window. |
Reimplemented from Window.
Definition at line 340 of file news_gui.cpp.
References WindowDesc::default_width, DrawPixelInfo::height, max(), and DrawPixelInfo::width.
virtual void NewsWindow::OnPaint | ( | ) | [inline, virtual] |
The window must be repainted.
Reimplemented from Window.
Definition at line 346 of file news_gui.cpp.
References Window::DrawWidgets().
virtual void NewsWindow::UpdateWidgetSize | ( | int | widget, | |
Dimension * | size, | |||
const Dimension & | padding, | |||
Dimension * | fill, | |||
Dimension * | resize | |||
) | [inline, virtual] |
Update size and resize step of a widget in the window.
After retrieval of the minimal size and the resize-steps of a widget, this function is called to allow further refinement, typically by computing the real maximal size of the content. Afterwards, size is taken to be the minimal size of the widget and resize is taken to contain the resize steps. For the convenience of the callee, padding contains the amount of padding between the content and the edge of the widget. This should be added to the returned size.
widget | Widget number. | |
size | Size of the widget. | |
padding | Recommended amount of space between the widget content and the widget edge. | |
fill | Fill step of the widget. | |
resize | Resize step of the widget. |
Reimplemented from Window.
Definition at line 351 of file news_gui.cpp.
References CopyInDParam(), GetEngineInfoString(), GetStringMultiLineBoundingBox(), Dimension::height, lengthof, maxdim(), ni, NR_ENGINE, NTW_COMPANY_MSG, NTW_MESSAGE, NTW_VEH_INFO, NTW_VEH_NAME, NTW_VEH_TITLE, and Dimension::width.
virtual void NewsWindow::SetStringParameters | ( | int | widget | ) | const [inline, virtual] |
Initialize string parameters for a widget.
Calls to this function are made during initialization to measure the size (that is as part of InitNested()), during drawing, and while re-initializing the window. Only for widgets that render text initializing is requested.
widget | Widget number. |
Reimplemented from Window.
Definition at line 389 of file news_gui.cpp.
References ni, NTW_DATE, and SetDParam().
virtual void NewsWindow::DrawWidget | ( | const Rect & | r, | |
int | widget | |||
) | const [inline, virtual] |
Draw the contents of a nested widget.
r | Rectangle occupied by the widget. | |
widget | Number of the widget to draw. |
Reimplemented from Window.
Definition at line 394 of file news_gui.cpp.
References Rect::bottom, CompanyNewsInformation::colour, CopyInDParam(), DrawCompanyManagerFace(), DrawStringMultiLine(), DrawVehicleEngine(), CompanyNewsInformation::face, FILLRECT_RECOLOUR, GetEngineInfoString(), GetEnginePalette(), GfxFillRect(), Rect::left, lengthof, ni, NR_ENGINE, NTW_COMPANY_MSG, NTW_MESSAGE, NTW_MGR_FACE, NTW_MGR_NAME, NTW_PANEL, NTW_VEH_BKGND, NTW_VEH_INFO, NTW_VEH_NAME, NTW_VEH_SPR, NTW_VEH_TITLE, CompanyNewsInformation::president_name, Rect::right, SA_CENTER, SetDParamStr(), and Rect::top.
virtual void NewsWindow::OnClick | ( | Point | pt, | |
int | widget, | |||
int | click_count | |||
) | [inline, virtual] |
A click with the left mouse button has been made on the window.
pt | the point inside the window that has been clicked. | |
widget | the clicked widget. | |
click_count | Number of fast consecutive clicks at same position |
Reimplemented from Window.
Definition at line 447 of file news_gui.cpp.
References _ctrl_pressed, _forced_news, duration, GetReferenceTile(), INVALID_TILE, ni, NR_VEHICLE, NTW_CAPTION, NTW_CLOSEBOX, NTW_VIEWPORT, and ScrollMainWindowTo().
virtual EventState NewsWindow::OnKeyPress | ( | uint16 | key, | |
uint16 | keycode | |||
) | [inline, virtual] |
A key has been pressed.
key | the Unicode value of the key. | |
keycode | the untranslated key code including shift state. |
Reimplemented from Window.
Definition at line 480 of file news_gui.cpp.
References Window::ES_HANDLED, and Window::ES_NOT_HANDLED.
virtual void NewsWindow::OnInvalidateData | ( | int | data | ) | [inline, virtual] |
Some data on this window has become invalid.
data | information about the changed data. |
Reimplemented from Window.
Definition at line 490 of file news_gui.cpp.
References chat_height.