OpenTTD
Data Structures | Enumerations | Functions | Variables
signs_gui.cpp File Reference

The GUI for signs. More...

#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 "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...
 
WindowShowSignList ()
 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 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 145 of file signs_gui.cpp.

Function Documentation

◆ DeleteRenameSignWindow()

void DeleteRenameSignWindow ( SignID  sign)

Close the sign window associated with the given sign.

Parameters
signThe sign to close the window for.

Definition at line 580 of file signs_gui.cpp.

References 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
siThe sign that was clicked on.

Definition at line 555 of file signs_gui.cpp.

References _ctrl_pressed, _local_company, and OWNER_DEITY.

◆ RenameSign()

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

Actually rename the sign.

Parameters
indexthe sign to rename.
textthe new name.
Returns
true if the window will already be removed after returning.

Definition at line 414 of file signs_gui.cpp.

References CMD_MSG, CMD_RENAME_SIGN, DoCommandP(), and StrEmpty().

Referenced by SignWindow::OnClick().

◆ ShowRenameSignWindow()

void ShowRenameSignWindow ( const Sign si)

Show the window to change the text of a sign.

Parameters
siThe sign to show the window for.

Definition at line 568 of file signs_gui.cpp.

References DeleteWindowByClass(), and WC_QUERY_STRING.

Referenced by CcPlaceSign().

◆ ShowSignList()

Window* ShowSignList ( )

Open the sign list window.

Returns
newly opened sign list window, or NULL 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
hotkeyHotkey
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(WWT_CLOSEBOX, COLOUR_GREY),
NWidget(WWT_CAPTION, COLOUR_GREY, WID_QES_CAPTION), SetDataTip(STR_WHITE_STRING, STR_TOOLTIP_WINDOW_TITLE_DRAG_THIS),
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),
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),
}
Horizontal container.
Definition: widget_type.h:75
Arrow to the right or in case of RTL to the left.
Definition: widget_type.h:38
Arrow to the left or in case of RTL to the right.
Definition: widget_type.h:37
a textbox for typing
Definition: widget_type.h:71
Close box (at top-left of a window)
Definition: widget_type.h:69
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:1046
Text of the query.
Definition: sign_widget.h:29
static NWidgetPart SetDataTip(uint32 data, StringID tip)
Widget part function for setting the data and tooltip.
Definition: widget_type.h:1014
static NWidgetPart SetMinimalSize(int16 x, int16 y)
Widget part function for setting the minimal size.
Definition: widget_type.h:947
Delete button.
Definition: sign_widget.h:32
Normal push-button (no toggle button) with text caption.
Definition: widget_type.h:104
Simple depressed panel.
Definition: widget_type.h:50
static NWidgetPart NWidget(WidgetType tp, Colours col, int16 idx=-1)
Widget part function for starting a new 'real' widget.
Definition: widget_type.h:1114
OK button.
Definition: sign_widget.h:30
Window caption (window title between closebox and stickybox)
Definition: widget_type.h:61
Caption of the window.
Definition: sign_widget.h:28
static NWidgetPart EndContainer()
Widget part function for denoting the end of a container (horizontal, vertical, WWT_FRAME, WWT_INSET, or WWT_PANEL).
Definition: widget_type.h:999
Cancel button.
Definition: sign_widget.h:31
Normal push-button (no toggle button) with arrow caption.
Definition: widget_type.h:106
static NWidgetPart SetFill(uint fill_x, uint fill_y)
Widget part function for setting filling.
Definition: widget_type.h:983
Next button.
Definition: sign_widget.h:34
Previous button.
Definition: sign_widget.h:33

Definition at line 526 of file signs_gui.cpp.

◆ _nested_sign_list_widgets

const NWidgetPart _nested_sign_list_widgets[]
static
Initial value:
= {
NWidget(WWT_CLOSEBOX, COLOUR_GREY),
NWidget(WWT_CAPTION, COLOUR_GREY, WID_SIL_CAPTION), SetDataTip(STR_SIGN_LIST_CAPTION, STR_TOOLTIP_WINDOW_TITLE_DRAG_THIS),
NWidget(WWT_SHADEBOX, COLOUR_GREY),
NWidget(WWT_DEFSIZEBOX, COLOUR_GREY),
NWidget(WWT_STICKYBOX, COLOUR_GREY),
NWidget(WWT_PANEL, COLOUR_GREY), SetFill(1, 1),
NWidget(WWT_EDITBOX, COLOUR_GREY, 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),
NWidget(WWT_TEXTBTN, COLOUR_GREY, WID_SIL_FILTER_MATCH_CASE_BTN), SetDataTip(STR_SIGN_LIST_MATCH_CASE, STR_SIGN_LIST_MATCH_CASE_TOOLTIP),
NWidget(WWT_RESIZEBOX, COLOUR_GREY),
}
static NWidgetPart SetResize(int16 dx, int16 dy)
Widget part function for setting the resize step.
Definition: widget_type.h:930
Horizontal container.
Definition: widget_type.h:75
a textbox for typing
Definition: widget_type.h:71
Resize box (normally at bottom-right of a window)
Definition: widget_type.h:68
Close box (at top-left of a window)
Definition: widget_type.h:69
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:1046
List of signs.
Definition: sign_widget.h:19
Scrollbar of list.
Definition: sign_widget.h:20
Default window size box (at top-right of a window, between WWT_SHADEBOX and WWT_STICKYBOX) ...
Definition: widget_type.h:65
static NWidgetPart SetDataTip(uint32 data, StringID tip)
Widget part function for setting the data and tooltip.
Definition: widget_type.h:1014
static NWidgetPart SetMinimalSize(int16 x, int16 y)
Widget part function for setting the minimal size.
Definition: widget_type.h:947
Text box for typing a filter string.
Definition: sign_widget.h:21
Simple depressed panel.
Definition: widget_type.h:50
static NWidgetPart NWidget(WidgetType tp, Colours col, int16 idx=-1)
Widget part function for starting a new 'real' widget.
Definition: widget_type.h:1114
Right offset of the text of the frame.
Definition: window_gui.h:73
Left offset of the text of the frame.
Definition: window_gui.h:72
Window caption (window title between closebox and stickybox)
Definition: widget_type.h:61
Vertical container.
Definition: widget_type.h:77
static NWidgetPart EndContainer()
Widget part function for denoting the end of a container (horizontal, vertical, WWT_FRAME, WWT_INSET, or WWT_PANEL).
Definition: widget_type.h:999
Sticky box (at top-right of a window, after WWT_DEFSIZEBOX)
Definition: widget_type.h:66
static NWidgetPart SetFill(uint fill_x, uint fill_y)
Widget part function for setting filling.
Definition: widget_type.h:983
Vertical scrollbar.
Definition: widget_type.h:84
Button to toggle if case sensitive filtering should be used.
Definition: sign_widget.h:22
static NWidgetPart SetScrollbar(int index)
Attach a scrollbar to a widget.
Definition: widget_type.h:1095
Shade box (at top-right of a window, between WWT_DEBUGBOX and WWT_DEFSIZEBOX)
Definition: widget_type.h:64
Caption of the window.
Definition: sign_widget.h:18
(Toggle) Button with text
Definition: widget_type.h:55

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
}
All data for a single hotkey.
Definition: hotkeys.h:24
Focus the edit box for editing the filter string.
Definition: signs_gui.cpp:146

Definition at line 355 of file signs_gui.cpp.