OpenTTD Source: src/signs_gui.cpp File Reference

OpenTTD Source 13.1

Data Structures | Enumerations | Functions | Variables
signs_gui.cpp File Reference
`#include "stdafx.h"`
`#include "company_gui.h"`
`#include "company_func.h"`
`#include "signs_base.h"`
`#include "signs_func.h"`
`#include "debug.h"`
`#include "command_func.h"`
`#include "strings_func.h"`
`#include "window_func.h"`
`#include "map_func.h"`
`#include "viewport_func.h"`
`#include "querystring_gui.h"`
`#include "sortlist_type.h"`
`#include "stringfilter_type.h"`
`#include "string_func.h"`
`#include "core/geometry_func.hpp"`
`#include "hotkeys.h"`
`#include "transparency.h"`
`#include "gui.h"`
`#include "signs_cmd.h"`
`#include "widgets/sign_widget.h"`
`#include "table/strings.h"`
`#include "table/sprites.h"`
`#include "safeguards.h"`

Go to the source code of this file.

## Data Structures
struct | SignList
struct | SignListWindow
struct | SignWindow

## Enumerations
enum | SignListHotkeys { SLHK_FOCUS_FILTER_BOX }
| Enum referring to the Hotkeys in the sign list window. More...

## Functions
static EventState | SignListGlobalHotkeys (int hotkey)
| Handler for global hotkeys of the SignListWindow. More...
Window * | ShowSignList ()
| Open the sign list window. More...
static bool | RenameSign (SignID index, const char *text)
| Actually rename the sign. More...
void | HandleClickOnSign (const Sign *si)
| Handle clicking on a sign. More...
void | ShowRenameSignWindow (const Sign *si)
| Show the window to change the text of a sign. More...
void | DeleteRenameSignWindow (SignID sign)
| Close the sign window associated with the given sign. More...

## Variables
static Hotkey | signlist_hotkeys []
static const NWidgetPart | _nested_sign_list_widgets []
static WindowDesc | _sign_list_desc (WDP_AUTO, "list_signs", 358, 138, WC_SIGN_LIST, WC_NONE, 0, _nested_sign_list_widgets, lengthof(_nested_sign_list_widgets), &SignListWindow::hotkeys)
static const NWidgetPart | _nested_query_sign_edit_widgets []
static WindowDesc | _query_sign_edit_desc (WDP_CENTER, "query_sign", 0, 0, WC_QUERY_STRING, WC_NONE, WDF_CONSTRUCTION, _nested_query_sign_edit_widgets, lengthof(_nested_query_sign_edit_widgets))

## Detailed Description

The GUI for signs.

Definition in file signs_gui.cpp.

## Enumeration Type Documentation

## ◆ SignListHotkeys

enum SignListHotkeys

Enum referring to the Hotkeys in the sign list window.

Enumerator
SLHK_FOCUS_FILTER_BOX | Focus the edit box for editing the filter string.

Definition at line 134 of file signs_gui.cpp.

## Function Documentation

## ◆ DeleteRenameSignWindow()

void DeleteRenameSignWindow | ( | SignID | sign | ) |

Close the sign window associated with the given sign.

Parameters

  sign | The sign to close the window for.

Definition at line 596 of file signs_gui.cpp.

References Window::Close(), FindWindowById(), WC_QUERY_STRING, and WN_QUERY_STRING_SIGN.

Referenced by Sign::~Sign().

## ◆ HandleClickOnSign()

void HandleClickOnSign | ( | const Sign * | si | ) |

Handle clicking on a sign.

Parameters

  si | The sign that was clicked on.

Definition at line 567 of file signs_gui.cpp.

References _ctrl_pressed, _local_company, CompanyCanRenameSign(), and OWNER_DEITY.

## ◆ RenameSign()

static bool RenameSign | ( | SignID | index,
|  | const char * | text
| ) |  |
| static

Actually rename the sign.

Parameters

  index | the sign to rename.
  text | the new name.

Returns
  true if the window will already be removed after returning.

Definition at line 414 of file signs_gui.cpp.

References StrEmpty().

Referenced by SignWindow::OnClick().

## ◆ ShowRenameSignWindow()

void ShowRenameSignWindow | ( | const Sign * | si | ) |

Show the window to change the text of a sign.

Parameters

  si | The sign to show the window for.

Definition at line 584 of file signs_gui.cpp.

References CloseWindowByClass(), and WC_QUERY_STRING.

## ◆ ShowSignList()

Window* ShowSignList | ( |  | ) |

Open the sign list window.

Returns
  newly opened sign list window, or nullptr if the window could not be opened.

Definition at line 403 of file signs_gui.cpp.

## ◆ SignListGlobalHotkeys()

static EventState SignListGlobalHotkeys | ( | int | hotkey | ) |
| static

Handler for global hotkeys of the SignListWindow.

Parameters

  hotkey | Hotkey

Returns
  ES_HANDLED if hotkey was accepted.

Definition at line 347 of file signs_gui.cpp.

## Variable Documentation

## ◆ _nested_query_sign_edit_widgets

const NWidgetPart _nested_query_sign_edit_widgets[]
| static

Initial value:
= {
NWidget(NWID_HORIZONTAL),
NWidget(WWT_CLOSEBOX, COLOUR_GREY),
NWidget(WWT_CAPTION, COLOUR_GREY, WID_QES_CAPTION), SetDataTip(STR_WHITE_STRING, STR_TOOLTIP_WINDOW_TITLE_DRAG_THIS),
NWidget(WWT_PUSHIMGBTN, COLOUR_GREY, WID_QES_LOCATION), SetMinimalSize(12, 14), SetDataTip(SPR_GOTO_LOCATION, STR_EDIT_SIGN_LOCATION_TOOLTIP),
EndContainer(),
NWidget(WWT_PANEL, COLOUR_GREY),
NWidget(WWT_EDITBOX, COLOUR_GREY, WID_QES_TEXT), SetMinimalSize(256, 12), SetDataTip(STR_EDIT_SIGN_SIGN_OSKTITLE, STR_NULL), SetPadding(2, 2, 2, 2),
EndContainer(),
NWidget(NWID_HORIZONTAL),
NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, WID_QES_OK), SetMinimalSize(61, 12), SetDataTip(STR_BUTTON_OK, STR_NULL),
NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, WID_QES_CANCEL), SetMinimalSize(60, 12), SetDataTip(STR_BUTTON_CANCEL, STR_NULL),
NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, WID_QES_DELETE), SetMinimalSize(60, 12), SetDataTip(STR_TOWN_VIEW_DELETE_BUTTON, STR_NULL),
NWidget(WWT_PANEL, COLOUR_GREY), SetFill(1, 1), EndContainer(),
NWidget(WWT_PUSHARROWBTN, COLOUR_GREY, WID_QES_PREVIOUS), SetMinimalSize(11, 12), SetDataTip(AWV_DECREASE, STR_EDIT_SIGN_PREVIOUS_SIGN_TOOLTIP),
NWidget(WWT_PUSHARROWBTN, COLOUR_GREY, WID_QES_NEXT), SetMinimalSize(11, 12), SetDataTip(AWV_INCREASE, STR_EDIT_SIGN_NEXT_SIGN_TOOLTIP),
EndContainer(),
}

Definition at line 537 of file signs_gui.cpp.

## ◆ _nested_sign_list_widgets

const NWidgetPart _nested_sign_list_widgets[]
| static

Initial value:
= {
NWidget(NWID_HORIZONTAL),
NWidget(WWT_CLOSEBOX, COLOUR_BROWN),
NWidget(WWT_CAPTION, COLOUR_BROWN, WID_SIL_CAPTION), SetDataTip(STR_SIGN_LIST_CAPTION, STR_TOOLTIP_WINDOW_TITLE_DRAG_THIS),
NWidget(WWT_SHADEBOX, COLOUR_BROWN),
NWidget(WWT_DEFSIZEBOX, COLOUR_BROWN),
NWidget(WWT_STICKYBOX, COLOUR_BROWN),
EndContainer(),
NWidget(NWID_HORIZONTAL),
NWidget(NWID_VERTICAL),
NWidget(WWT_PANEL, COLOUR_BROWN, WID_SIL_LIST), SetMinimalSize(WidgetDimensions::unscaled.frametext.Horizontal() + 16 + 255, 0),
SetResize(1, 1), SetFill(1, 0), SetScrollbar(WID_SIL_SCROLLBAR), EndContainer(),
NWidget(NWID_HORIZONTAL),
NWidget(WWT_PANEL, COLOUR_BROWN), SetFill(1, 1),
NWidget(WWT_EDITBOX, COLOUR_BROWN, WID_SIL_FILTER_TEXT), SetMinimalSize(80, 12), SetResize(1, 0), SetFill(1, 0), SetPadding(2, 2, 2, 2),
SetDataTip(STR_LIST_FILTER_OSKTITLE, STR_LIST_FILTER_TOOLTIP),
EndContainer(),
NWidget(WWT_TEXTBTN, COLOUR_BROWN, WID_SIL_FILTER_MATCH_CASE_BTN), SetDataTip(STR_SIGN_LIST_MATCH_CASE, STR_SIGN_LIST_MATCH_CASE_TOOLTIP),
EndContainer(),
EndContainer(),
NWidget(NWID_VERTICAL),
NWidget(NWID_VERTICAL), SetFill(0, 1),
NWidget(NWID_VSCROLLBAR, COLOUR_BROWN, WID_SIL_SCROLLBAR),
EndContainer(),
NWidget(WWT_RESIZEBOX, COLOUR_BROWN),
EndContainer(),
EndContainer(),
}

Definition at line 361 of file signs_gui.cpp.

## ◆ signlist_hotkeys

Hotkey signlist_hotkeys[]
| static

Initial value:
= {
Hotkey('F', "focus_filter_box", SLHK_FOCUS_FILTER_BOX),
HOTKEY_LIST_END
}

Definition at line 355 of file signs_gui.cpp.

WID_QES_TEXT
@ WID_QES_TEXT
Text of the query.
Definition: sign_widget.h:28
SetScrollbar
static NWidgetPart SetScrollbar(int index)
Attach a scrollbar to a widget.
Definition: widget_type.h:1208
WWT_STICKYBOX
@ WWT_STICKYBOX
Sticky box (at top-right of a window, after WWT_DEFSIZEBOX)
Definition: widget_type.h:64
SetPadding
static NWidgetPart SetPadding(uint8 top, uint8 right, uint8 bottom, uint8 left)
Widget part function for setting additional space around a widget.
Definition: widget_type.h:1141
WidgetDimensions::unscaled
static const WidgetDimensions unscaled
Unscaled widget dimensions.
Definition: window_gui.h:67
WWT_CAPTION
@ WWT_CAPTION
Window caption (window title between closebox and stickybox)
Definition: widget_type.h:59
WWT_DEFSIZEBOX
@ WWT_DEFSIZEBOX
Default window size box (at top-right of a window, between WWT_SHADEBOX and WWT_STICKYBOX)
Definition: widget_type.h:63
NWID_HORIZONTAL
@ NWID_HORIZONTAL
Horizontal container.
Definition: widget_type.h:73
WID_SIL_SCROLLBAR
@ WID_SIL_SCROLLBAR
Scrollbar of list.
Definition: sign_widget.h:18
SetResize
static NWidgetPart SetResize(int16 dx, int16 dy)
Widget part function for setting the resize step.
Definition: widget_type.h:995
WID_QES_DELETE
@ WID_QES_DELETE
Delete button.
Definition: sign_widget.h:31
WWT_PUSHARROWBTN
@ WWT_PUSHARROWBTN
Normal push-button (no toggle button) with arrow caption.
Definition: widget_type.h:106
SetDataTip
static NWidgetPart SetDataTip(uint32 data, StringID tip)
Widget part function for setting the data and tooltip.
Definition: widget_type.h:1109
WWT_EDITBOX
@ WWT_EDITBOX
a textbox for typing
Definition: widget_type.h:69
WWT_PUSHTXTBTN
@ WWT_PUSHTXTBTN
Normal push-button (no toggle button) with text caption.
Definition: widget_type.h:104
WID_QES_CAPTION
@ WID_QES_CAPTION
Caption of the window.
Definition: sign_widget.h:26
NWID_VERTICAL
@ NWID_VERTICAL
Vertical container.
Definition: widget_type.h:75
WID_QES_LOCATION
@ WID_QES_LOCATION
Scroll to sign location.
Definition: sign_widget.h:27
WWT_CLOSEBOX
@ WWT_CLOSEBOX
Close box (at top-left of a window)
Definition: widget_type.h:67
WWT_RESIZEBOX
@ WWT_RESIZEBOX
Resize box (normally at bottom-right of a window)
Definition: widget_type.h:66
WID_SIL_CAPTION
@ WID_SIL_CAPTION
Caption of the window.
Definition: sign_widget.h:16
WWT_PUSHIMGBTN
@ WWT_PUSHIMGBTN
Normal push-button (no toggle button) with image caption.
Definition: widget_type.h:105
EndContainer
static NWidgetPart EndContainer()
Widget part function for denoting the end of a container (horizontal, vertical, WWT_FRAME,...
Definition: widget_type.h:1094
NWID_VSCROLLBAR
@ NWID_VSCROLLBAR
Vertical scrollbar.
Definition: widget_type.h:82
WID_QES_OK
@ WID_QES_OK
OK button.
Definition: sign_widget.h:29
WID_QES_CANCEL
@ WID_QES_CANCEL
Cancel button.
Definition: sign_widget.h:30
NWidget
static NWidgetPart NWidget(WidgetType tp, Colours col, int16 idx=-1)
Widget part function for starting a new 'real' widget.
Definition: widget_type.h:1227
SetMinimalSize
static NWidgetPart SetMinimalSize(int16 x, int16 y)
Widget part function for setting the minimal size.
Definition: widget_type.h:1012
WWT_PANEL
@ WWT_PANEL
Simple depressed panel.
Definition: widget_type.h:48
WID_SIL_LIST
@ WID_SIL_LIST
List of signs.
Definition: sign_widget.h:17
SetFill
static NWidgetPart SetFill(uint fill_x, uint fill_y)
Widget part function for setting filling.
Definition: widget_type.h:1078
WID_QES_PREVIOUS
@ WID_QES_PREVIOUS
Previous button.
Definition: sign_widget.h:32
SLHK_FOCUS_FILTER_BOX
@ SLHK_FOCUS_FILTER_BOX
Focus the edit box for editing the filter string.
Definition: signs_gui.cpp:135
AWV_INCREASE
@ AWV_INCREASE
Arrow to the right or in case of RTL to the left.
Definition: widget_type.h:36
WID_QES_NEXT
@ WID_QES_NEXT
Next button.
Definition: sign_widget.h:33
WWT_TEXTBTN
@ WWT_TEXTBTN
(Toggle) Button with text
Definition: widget_type.h:53
AWV_DECREASE
@ AWV_DECREASE
Arrow to the left or in case of RTL to the right.
Definition: widget_type.h:35
WID_SIL_FILTER_TEXT
@ WID_SIL_FILTER_TEXT
Text box for typing a filter string.
Definition: sign_widget.h:19
WID_SIL_FILTER_MATCH_CASE_BTN
@ WID_SIL_FILTER_MATCH_CASE_BTN
Button to toggle if case sensitive filtering should be used.
Definition: sign_widget.h:20
Hotkey
All data for a single hotkey.
Definition: hotkeys.h:22
WWT_SHADEBOX
@ WWT_SHADEBOX
Shade box (at top-right of a window, between WWT_DEBUGBOX and WWT_DEFSIZEBOX)
Definition: widget_type.h:62