mirror of
https://github.com/bsnes-emu/bsnes.git
synced 2025-10-04 15:41:58 +02:00
byuu says: - phoenix/All: converted all instances of const char* to const nall::string& - above used to require: label.setText(string("FPS: ", fps)); but can now use: label.setText({"FPS", fps}); - also avoids the need for the internal implementations to have to check for null string pointers - phoenix/GTK+: no longer disabling double buffering on the viewport. Does not cause flickering, and fixes redraw issue on window resize - phoenix/Qt: like phoenix/GTK+, it will use the default font on the menubar as well, so child menu items are consistently sized now - Linux: file browser can list contents of / and won't let you go higher; Windows needs a similar guard for n:/ or \\ - UPS soft-patching support added - external XML memory map loading support added - cartridge folder support added: if folder ends in .sfc and there is ONE .sfc ROM inside it, it will load the folder as if it were a ROM - input assignment refreshes text instead of reloading the list, this saves your position - auto-advance wasn't working very well, will try again later - input clear all button removed since it's pretty fast now to do clear+down:repeat
29 lines
1.0 KiB
C++
Executable File
29 lines
1.0 KiB
C++
Executable File
void TextBox::create(Window &parent, unsigned x, unsigned y, unsigned width, unsigned height, const string &text) {
|
|
widget->window = CreateWindowEx(
|
|
WS_EX_CLIENTEDGE, L"EDIT", utf16_t(text),
|
|
WS_CHILD | WS_TABSTOP | WS_VISIBLE | ES_AUTOHSCROLL | ES_AUTOVSCROLL,
|
|
x, y, width, height,
|
|
parent.widget->window, (HMENU)object->id, GetModuleHandle(0), 0
|
|
);
|
|
SetWindowLongPtr(widget->window, GWLP_USERDATA, (LONG_PTR)this);
|
|
SendMessage(widget->window, WM_SETFONT, (WPARAM)(parent.window->defaultFont ? parent.window->defaultFont : OS::os->proportionalFont), 0);
|
|
}
|
|
|
|
string TextBox::text() {
|
|
unsigned length = GetWindowTextLength(widget->window);
|
|
wchar_t text[length + 1];
|
|
GetWindowText(widget->window, text, length + 1);
|
|
text[length] = 0;
|
|
return utf8_t(text);
|
|
}
|
|
|
|
void TextBox::setText(const string &text) {
|
|
object->locked = true;
|
|
SetWindowText(widget->window, utf16_t(text));
|
|
object->locked = false;
|
|
}
|
|
|
|
void TextBox::setEditable(bool editable) {
|
|
SendMessage(widget->window, EM_SETREADONLY, editable == false, 0);
|
|
}
|