* Get the height in pixels used by a page element. * @param pe The story page element. * @param max_width Available width to display content. * @return the height in pixels. */
| 317 | * @return the height in pixels. |
| 318 | */ |
| 319 | uint GetPageElementHeight(const StoryPageElement &pe, int max_width) const |
| 320 | { |
| 321 | switch (pe.type) { |
| 322 | case SPET_TEXT: |
| 323 | return GetStringHeight(pe.text.GetDecodedString(), max_width); |
| 324 | |
| 325 | case SPET_GOAL: |
| 326 | case SPET_LOCATION: { |
| 327 | Dimension sprite_dim = GetSpriteSize(GetPageElementSprite(pe)); |
| 328 | return sprite_dim.height; |
| 329 | } |
| 330 | |
| 331 | case SPET_BUTTON_PUSH: |
| 332 | case SPET_BUTTON_TILE: |
| 333 | case SPET_BUTTON_VEHICLE: { |
| 334 | Dimension dim = GetStringBoundingBox(pe.text.GetDecodedString(), FS_NORMAL); |
| 335 | return dim.height + WidgetDimensions::scaled.framerect.Vertical() + WidgetDimensions::scaled.frametext.Vertical(); |
| 336 | } |
| 337 | |
| 338 | default: |
| 339 | NOT_REACHED(); |
| 340 | } |
| 341 | return 0; |
| 342 | } |
| 343 | |
| 344 | /** |
| 345 | * Get the float style of a page element. |
nothing calls this directly
no test coverage detected