ResultVal<Handle> HandleTable::Duplicate(Handle handle) { SharedPtr<Object> object = GetGeneric(handle); if (object == nullptr) { LOG_ERROR(Kernel, "Tried to duplicate invalid handle: %08X", handle); return ERR_INVALID_HANDLE; } return Create(std::move(object)); }
void FontEditWidget::UpdatePreview() { /* revert to default font first, to avoid freeing the Font while it is still being referenced */ LargeTextWindow &preview = (LargeTextWindow &)GetGeneric(PREVIEW); preview.SetFont(*GetLook().text_font); font.Load(data); #ifdef HAVE_TEXT_CACHE TextCache::Flush(); #endif if (font.IsDefined()) { preview.SetFont(font); preview.SetText(_T("Sample Text\n123")); } else { preview.SetText(_("Font not found.")); } }
bool SetFocus() override { GetGeneric(INFOBOX).SetFocus(); return true; }