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 "gfx_func.h"
#include "viewport_func.h"
#include "querystring_gui.h"
#include "sortlist_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"

Go to the source code of this file.

Data Structures

struct  FilterInfo
 Contains the necessary information to decide if a sign should be filtered out or not. More...
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

WindowShowSignList ()
 Open the sign list window.
EventState SignListGlobalHotkeys (uint16 key, uint16 keycode)
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

Hotkey< SignListWindow > * _signlist_hotkeys = SignListWindow::signlist_hotkeys
static const NWidgetPart _nested_sign_list_widgets []
static const WindowDesc _sign_list_desc (WDP_AUTO, 358, 138, WC_SIGN_LIST, WC_NONE, WDF_UNCLICK_BUTTONS, _nested_sign_list_widgets, lengthof(_nested_sign_list_widgets))
static const NWidgetPart _nested_query_sign_edit_widgets []
static const WindowDesc _query_sign_edit_desc (WDP_AUTO, 0, 0, WC_QUERY_STRING, WC_NONE, WDF_CONSTRUCTION|WDF_UNCLICK_BUTTONS, _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 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 154 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 669 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 644 of file signs_gui.cpp.

References _ctrl_pressed, _local_company, Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tpool_type, Tcache, Tzero >::PoolItem< Tpool >::index, 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 468 of file signs_gui.cpp.

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

Referenced by HandleClickOnSign().

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

Referenced by MenuClickMap(), and MainToolbarWindow::OnKeyPress().


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 615 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_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),
        NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, WID_SIL_FILTER_CLEAR_BTN), SetDataTip(STR_SIGN_LIST_CLEAR, STR_SIGN_LIST_CLEAR_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 407 of file signs_gui.cpp.