OpenTTD Source 20241224-master-gee860a5c8e
textbuf_gui.h File Reference

Stuff related to the text buffer GUI. More...

#include "window_type.h"
#include "string_type.h"
#include "strings_type.h"

Go to the source code of this file.

Typedefs

typedef void QueryCallbackProc(Window *, bool)
 Callback procedure for the ShowQuery method.
 

Enumerations

enum  QueryStringFlags { QSF_NONE = 0 , QSF_ACCEPT_UNCHANGED = 0x01 , QSF_ENABLE_DEFAULT = 0x02 , QSF_LEN_IN_CHARS = 0x04 }
 Flags used in ShowQueryString() call. More...
 

Functions

void ShowQueryString (StringID str, StringID caption, uint max_len, Window *parent, CharSetFilter afilter, QueryStringFlags flags)
 Show a query popup window with a textbox in it.
 
void ShowQuery (StringID caption, StringID message, Window *w, QueryCallbackProc *callback, bool focus=false)
 Show a confirmation window with standard 'yes' and 'no' buttons The window is aligned to the centre of its parent.
 

Variables

static const uint OSK_KEYBOARD_ENTRIES = 50
 The number of 'characters' on the on-screen keyboard.
 
std::string _keyboard_opt [2]
 The number of characters has to be OSK_KEYBOARD_ENTRIES.
 

Detailed Description

Stuff related to the text buffer GUI.

Definition in file textbuf_gui.h.

Typedef Documentation

◆ QueryCallbackProc

typedef void QueryCallbackProc(Window *, bool)

Callback procedure for the ShowQuery method.

Definition at line 28 of file textbuf_gui.h.

Enumeration Type Documentation

◆ QueryStringFlags

Flags used in ShowQueryString() call.

Enumerator
QSF_ACCEPT_UNCHANGED 

return success even when the text didn't change

QSF_ENABLE_DEFAULT 

enable the 'Default' button ("\0" is returned)

QSF_LEN_IN_CHARS 

the length of the string is counted in characters

Definition at line 18 of file textbuf_gui.h.

Function Documentation

◆ ShowQuery()

void ShowQuery ( StringID  caption,
StringID  message,
Window parent,
QueryCallbackProc callback,
bool  focus 
)

Show a confirmation window with standard 'yes' and 'no' buttons The window is aligned to the centre of its parent.

Parameters
captionstring shown as window caption
messagestring that will be shown for the window
parentpointer to parent window, if this pointer is nullptr the parent becomes the main window WC_MAIN_WINDOW
callbackcallback function pointer to set in the window descriptor
focuswhether the window should be focussed (by default false)

Definition at line 1203 of file misc_gui.cpp.

References QueryWindow::Close(), GetMainWindow(), Window::parent, QueryWindow::proc, SetFocusedWindow(), WC_CONFIRM_POPUP_QUERY, and Window::window_class.

Referenced by CmdPause(), MakeScreenshotWithConfirm(), DepotWindow::OnClick(), GenerateLandscapeWindow::OnClick(), GenerateProgressWindow::OnClick(), VehicleGroupWindow::OnClick(), BuildIndustryWindow::OnClick(), NetworkContentListWindow::OnClick(), NewGRFWindow::OnClick(), GameSettingsWindow::OnClick(), ScenarioEditorLandscapeGenerationWindow::OnClick(), NetworkClientListWindow::OnDropdownSelect(), and SaveLoadWindow::OnTimeout().

◆ ShowQueryString()

void ShowQueryString ( StringID  str,
StringID  caption,
uint  maxsize,
Window parent,
CharSetFilter  afilter,
QueryStringFlags  flags 
)

Variable Documentation

◆ _keyboard_opt

std::string _keyboard_opt[2]
extern

The number of characters has to be OSK_KEYBOARD_ENTRIES.

However, these have to be UTF-8 encoded, which means up to 4 bytes per character.

Definition at line 27 of file osk_gui.cpp.

Referenced by GetKeyboardLayout().

◆ OSK_KEYBOARD_ENTRIES

const uint OSK_KEYBOARD_ENTRIES = 50
static

The number of 'characters' on the on-screen keyboard.

Definition at line 34 of file textbuf_gui.h.

Referenced by GetKeyboardLayout(), and OskWindow::UpdateOskState().