MCPcopy Create free account
hub / github.com/OpenTTD/OpenTTD / QueryStringWindow

Method QueryStringWindow

src/misc_gui.cpp:909–931  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

907 WidgetID last_user_action = INVALID_WIDGET; ///< Last started user action.
908
909 QueryStringWindow(std::string_view str, StringID caption, uint max_bytes, uint max_chars, WindowDesc &desc, Window *parent, CharSetFilter afilter, QueryStringFlags flags) :
910 Window(desc), editbox(max_bytes, max_chars)
911 {
912 this->editbox.text.Assign(str);
913
914 if (!flags.Test(QueryStringFlag::AcceptUnchanged)) this->editbox.orig = this->editbox.text.GetText();
915
916 this->querystrings[WID_QS_TEXT] = &this->editbox;
917 this->editbox.caption = caption;
918 this->editbox.cancel_button = WID_QS_CANCEL;
919 this->editbox.ok_button = WID_QS_OK;
920 this->editbox.text.afilter = afilter;
921 this->flags = flags;
922
923 this->CreateNestedTree();
924 this->GetWidget<NWidgetStacked>(WID_QS_DEFAULT_SEL)->SetDisplayedPlane((this->flags.Test(QueryStringFlag::EnableDefault)) ? 0 : SZSP_NONE);
925 this->GetWidget<NWidgetStacked>(WID_QS_MOVE_SEL)->SetDisplayedPlane((this->flags.Test(QueryStringFlag::EnableMove)) ? 0 : SZSP_NONE);
926 this->FinishInitNested(WN_QUERY_STRING);
927
928 this->parent = parent;
929
930 this->SetFocusedWidget(WID_QS_TEXT);
931 }
932
933 std::string GetWidgetString(WidgetID widget, StringID stringid) const override
934 {

Callers

nothing calls this directly

Calls 7

TestMethod · 0.80
CreateNestedTreeMethod · 0.80
SetDisplayedPlaneMethod · 0.80
FinishInitNestedMethod · 0.80
SetFocusedWidgetMethod · 0.80
AssignMethod · 0.45
GetTextMethod · 0.45

Tested by

no test coverage detected