OpenTTD

- Main Page
- Related Pages
- Modules
- Namespaces
- Data Structures
- Files

- File List
- Globals

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.
Window * | ShowSignList ()
| Open the sign list window.
static bool | RenameSign (SignID index, const char *text)
| Actually rename the sign.
void | HandleClickOnSign (const Sign *si)
| Handle clicking on a sign.
void | ShowRenameSignWindow (const Sign *si)
| Show the window to change the text of a sign.
void | DeleteRenameSignWindow (SignID sign)
| Close the sign window associated with the given sign.

## 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

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 145 of file signs_gui.cpp.

## Function Documentation

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 580 of file signs_gui.cpp.

References FindWindowById(), WC_QUERY_STRING, and WN_QUERY_STRING_SIGN.

Referenced by Sign::~Sign().

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

Handle clicking on a sign.

Parameters

  si | The sign that was clicked on.

Definition at line 555 of file signs_gui.cpp.

References _ctrl_pressed, _local_company, Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tpool_type, Tcache, Tzero >::PoolItem< Tpool >::index, OWNER_DEITY, RenameSign(), and ShowRenameSignWindow().

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 CMD_MSG, CMD_RENAME_SIGN, DoCommandP(), and StrEmpty().

Referenced by HandleClickOnSign(), and SignWindow::OnClick().

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 568 of file signs_gui.cpp.

References DeleteWindowByClass(), and WC_QUERY_STRING.

Referenced by CcPlaceSign(), and HandleClickOnSign().

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.

Referenced by MenuClickMap(), MainToolbarWindow::OnHotkey(), and 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.

References ES_NOT_HANDLED, Window::OnHotkey(), and ShowSignList().

## Variable Documentation

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),
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 526 of file signs_gui.cpp.

const NWidgetPart _nested_sign_list_widgets[]
| static

Initial value:
{
NWidget(NWID_HORIZONTAL),
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),
EndContainer(),
NWidget(NWID_HORIZONTAL),
NWidget(NWID_VERTICAL),
NWidget(WWT_PANEL, COLOUR_GREY, WID_SIL_LIST), SetMinimalSize(WD_FRAMETEXT_LEFT + 16 + 255 + WD_FRAMETEXT_RIGHT, 50),
SetResize(1, 10), SetFill(1, 0), SetScrollbar(WID_SIL_SCROLLBAR), EndContainer(),
NWidget(NWID_HORIZONTAL),
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),
EndContainer(),
NWidget(WWT_TEXTBTN, COLOUR_GREY, 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_GREY, WID_SIL_SCROLLBAR),
EndContainer(),
NWidget(WWT_RESIZEBOX, COLOUR_GREY),
EndContainer(),
EndContainer(),
}

Definition at line 361 of file signs_gui.cpp.

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.