mirror of
https://github.com/RYDE-WORK/ballistica.git
synced 2026-01-19 21:37:57 +08:00
added allow_clear_button arg to bauiv1.textwidget()
This commit is contained in:
parent
896aa9c663
commit
7c45d16155
40
.efrocachemap
generated
40
.efrocachemap
generated
@ -4061,26 +4061,26 @@
|
||||
"build/assets/windows/Win32/ucrtbased.dll": "2def5335207d41b21b9823f6805997f1",
|
||||
"build/assets/windows/Win32/vc_redist.x86.exe": "b08a55e2e77623fe657bea24f223a3ae",
|
||||
"build/assets/windows/Win32/vcruntime140d.dll": "865b2af4d1e26a1a8073c89acb06e599",
|
||||
"build/prefab/full/linux_arm64_gui/debug/ballisticakit": "db921cf43e8ebf733712fb5bbc673f66",
|
||||
"build/prefab/full/linux_arm64_gui/release/ballisticakit": "4be0f3a7a88da423847863af41ac9c63",
|
||||
"build/prefab/full/linux_arm64_server/debug/dist/ballisticakit_headless": "7c92d738e7cc724de2ca31cb876224e6",
|
||||
"build/prefab/full/linux_arm64_server/release/dist/ballisticakit_headless": "c2f69ed83f77b602e2a2b2b1c1c78cc6",
|
||||
"build/prefab/full/linux_x86_64_gui/debug/ballisticakit": "b1c766d4ce567f965c53ff2a4c5c85f4",
|
||||
"build/prefab/full/linux_x86_64_gui/release/ballisticakit": "86ebbd9111f8a0fe7905cef7aba1f6db",
|
||||
"build/prefab/full/linux_x86_64_server/debug/dist/ballisticakit_headless": "8182f4e00ad579eb4c7be5ec1ddca8cb",
|
||||
"build/prefab/full/linux_x86_64_server/release/dist/ballisticakit_headless": "3d9e0e7ad8706133e61fb7f7127c3ff5",
|
||||
"build/prefab/full/mac_arm64_gui/debug/ballisticakit": "5f98bf8b11376161a6f2f60900703f8a",
|
||||
"build/prefab/full/mac_arm64_gui/release/ballisticakit": "99d7d247a422eaa46737e3232408e879",
|
||||
"build/prefab/full/mac_arm64_server/debug/dist/ballisticakit_headless": "ffd6ad4dda003e9cd1434aa4a5bc9b09",
|
||||
"build/prefab/full/mac_arm64_server/release/dist/ballisticakit_headless": "216efc77915b75f39f0f15c2806bfbb9",
|
||||
"build/prefab/full/mac_x86_64_gui/debug/ballisticakit": "ad9829c065248ee3cde01b6a31deafed",
|
||||
"build/prefab/full/mac_x86_64_gui/release/ballisticakit": "3e9e4e1761fd763eb584598fc0a3ad0a",
|
||||
"build/prefab/full/mac_x86_64_server/debug/dist/ballisticakit_headless": "7522a6fcac27b2579f9cc0b712ce413b",
|
||||
"build/prefab/full/mac_x86_64_server/release/dist/ballisticakit_headless": "0c92e386ab7406da6a719131321bf592",
|
||||
"build/prefab/full/windows_x86_gui/debug/BallisticaKit.exe": "608cb03aef4dc547aa7433f83f898911",
|
||||
"build/prefab/full/windows_x86_gui/release/BallisticaKit.exe": "db136c26a3a37611aef68046f2fab62c",
|
||||
"build/prefab/full/windows_x86_server/debug/dist/BallisticaKitHeadless.exe": "3edbd652fbc7afe69f60335bab00875a",
|
||||
"build/prefab/full/windows_x86_server/release/dist/BallisticaKitHeadless.exe": "48e5cd932b8c322be18b593508d5c451",
|
||||
"build/prefab/full/linux_arm64_gui/debug/ballisticakit": "ae5d54179a3a0fae2de63332844033ad",
|
||||
"build/prefab/full/linux_arm64_gui/release/ballisticakit": "6ee081b61d4f2fdbd93486ded4f9a64c",
|
||||
"build/prefab/full/linux_arm64_server/debug/dist/ballisticakit_headless": "e7407d776c2109ff69a3cb5ba7ee96e3",
|
||||
"build/prefab/full/linux_arm64_server/release/dist/ballisticakit_headless": "31a2f27c9f96e6514546c2c287e2b02a",
|
||||
"build/prefab/full/linux_x86_64_gui/debug/ballisticakit": "afe92df503843db897e9d352f0f9d15d",
|
||||
"build/prefab/full/linux_x86_64_gui/release/ballisticakit": "1c195ea2f0436b0857bcf1f53596c9ed",
|
||||
"build/prefab/full/linux_x86_64_server/debug/dist/ballisticakit_headless": "cebf710fd74b426078849cfb61ddfe05",
|
||||
"build/prefab/full/linux_x86_64_server/release/dist/ballisticakit_headless": "70444645dab4201857c281df50c7fbab",
|
||||
"build/prefab/full/mac_arm64_gui/debug/ballisticakit": "4e65b35e7013a39b3c805e6b23f4c5be",
|
||||
"build/prefab/full/mac_arm64_gui/release/ballisticakit": "a701d452a5a66b30b1a328c7e9da1d2f",
|
||||
"build/prefab/full/mac_arm64_server/debug/dist/ballisticakit_headless": "90f94c72541a8b559fe5f937f59736cd",
|
||||
"build/prefab/full/mac_arm64_server/release/dist/ballisticakit_headless": "4f003ada50c0dea27919ffaf12ed9290",
|
||||
"build/prefab/full/mac_x86_64_gui/debug/ballisticakit": "20b922e9f65985fec9c19bd31b834542",
|
||||
"build/prefab/full/mac_x86_64_gui/release/ballisticakit": "046391bb7ddf1a3e76c07a0299211572",
|
||||
"build/prefab/full/mac_x86_64_server/debug/dist/ballisticakit_headless": "2101b917622227aa21533653b21f9192",
|
||||
"build/prefab/full/mac_x86_64_server/release/dist/ballisticakit_headless": "09bd3c5237d9cc020c805252470a05f5",
|
||||
"build/prefab/full/windows_x86_gui/debug/BallisticaKit.exe": "1af6ad786269c5b2f2790d51bf651eb3",
|
||||
"build/prefab/full/windows_x86_gui/release/BallisticaKit.exe": "727fdbc097b2e24e12687ea9cf3c566a",
|
||||
"build/prefab/full/windows_x86_server/debug/dist/BallisticaKitHeadless.exe": "a5e39a8fbb33b22b5c6791fe7a2c39f5",
|
||||
"build/prefab/full/windows_x86_server/release/dist/BallisticaKitHeadless.exe": "8ba33e36b368e3f2e31da15399fcad99",
|
||||
"build/prefab/lib/linux_arm64_gui/debug/libballisticaplus.a": "d9865523059d8cf11b2bef4b9da9a8c9",
|
||||
"build/prefab/lib/linux_arm64_gui/release/libballisticaplus.a": "56d6440f62c271c4ce9ef520400395a3",
|
||||
"build/prefab/lib/linux_arm64_server/debug/libballisticaplus.a": "d9865523059d8cf11b2bef4b9da9a8c9",
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
### 1.7.33 (build 21778, api 8, 2024-03-13)
|
||||
### 1.7.33 (build 21779, api 8, 2024-03-13)
|
||||
- Stress test input-devices are now a bit smarter; they won't press any buttons
|
||||
while UIs are up (this could cause lots of chaos if it happened).
|
||||
- Added a 'Show Demos When Idle' option in advanced settings. If enabled, the
|
||||
@ -69,6 +69,8 @@
|
||||
cleanly however (an `on_app_active_changed()` call in the `AppMode` class).
|
||||
This means that it also applies to other platforms when the app reaches the
|
||||
'inactive' state; for instance when minimizing the window on the SDL build.
|
||||
- Added an `allow_clear_button` arg to bauiv1.textwidget() which can be used to
|
||||
disable the 'X' button that clears editable text widgets.
|
||||
|
||||
### 1.7.31 (build 21727, api 8, 2023-12-17)
|
||||
- Added `bascenev1.get_connection_to_host_info_2()` which is an improved
|
||||
|
||||
@ -52,7 +52,7 @@ if TYPE_CHECKING:
|
||||
|
||||
# Build number and version of the ballistica binary we expect to be
|
||||
# using.
|
||||
TARGET_BALLISTICA_BUILD = 21778
|
||||
TARGET_BALLISTICA_BUILD = 21779
|
||||
TARGET_BALLISTICA_VERSION = '1.7.33'
|
||||
|
||||
|
||||
|
||||
@ -39,7 +39,7 @@ auto main(int argc, char** argv) -> int {
|
||||
namespace ballistica {
|
||||
|
||||
// These are set automatically via script; don't modify them here.
|
||||
const int kEngineBuildNumber = 21778;
|
||||
const int kEngineBuildNumber = 21779;
|
||||
const char* kEngineVersion = "1.7.33";
|
||||
const int kEngineApiVersion = 8;
|
||||
|
||||
|
||||
@ -1932,6 +1932,7 @@ static auto PyTextWidget(PyObject* self, PyObject* args,
|
||||
PyObject* query_description_obj = Py_None;
|
||||
PyObject* adapter_finished_obj = Py_None;
|
||||
PyObject* glow_type_obj = Py_None;
|
||||
PyObject* allow_clear_button_obj = Py_None;
|
||||
|
||||
static const char* kwlist[] = {"edit",
|
||||
"parent",
|
||||
@ -1972,9 +1973,10 @@ static auto PyTextWidget(PyObject* self, PyObject* args,
|
||||
"query_description",
|
||||
"adapter_finished",
|
||||
"glow_type",
|
||||
"allow_clear_button",
|
||||
nullptr};
|
||||
if (!PyArg_ParseTupleAndKeywords(
|
||||
args, keywds, "|OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO",
|
||||
args, keywds, "|OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO",
|
||||
const_cast<char**>(kwlist), &edit_obj, &parent_obj, &size_obj,
|
||||
&pos_obj, &text_obj, &v_align_obj, &h_align_obj, &editable_obj,
|
||||
&padding_obj, &on_return_press_call_obj, &on_activate_call_obj,
|
||||
@ -1985,7 +1987,8 @@ static auto PyTextWidget(PyObject* self, PyObject* args,
|
||||
&shadow_obj, &autoselect_obj, &rotate_obj, &enabled_obj,
|
||||
&force_internal_editing_obj, &always_show_carat_obj, &big_obj,
|
||||
&extra_touch_border_scale_obj, &res_scale_obj, &query_max_chars_obj,
|
||||
&query_description_obj, &adapter_finished_obj, &glow_type_obj))
|
||||
&query_description_obj, &adapter_finished_obj, &glow_type_obj,
|
||||
&allow_clear_button_obj))
|
||||
return nullptr;
|
||||
|
||||
if (!g_base->CurrentContext().IsEmpty()) {
|
||||
@ -2209,6 +2212,9 @@ static auto PyTextWidget(PyObject* self, PyObject* args,
|
||||
}
|
||||
widget->set_glow_type(glow_type);
|
||||
}
|
||||
if (allow_clear_button_obj != Py_None) {
|
||||
widget->set_allow_clear_button(Python::GetPyBool(allow_clear_button_obj));
|
||||
}
|
||||
|
||||
// If making a new widget, add it at the end.
|
||||
if (edit_obj == Py_None) {
|
||||
@ -2266,7 +2272,8 @@ static PyMethodDef PyTextWidgetDef = {
|
||||
" query_max_chars: bauiv1.Widget | None = None,\n"
|
||||
" query_description: bauiv1.Widget | None = None,\n"
|
||||
" adapter_finished: bool | None = None,\n"
|
||||
" glow_type: str | None = None)\n"
|
||||
" glow_type: str | None = None,\n"
|
||||
" allow_clear_button: bool | None = None)\n"
|
||||
" -> bauiv1.Widget\n"
|
||||
"\n"
|
||||
"Create or edit a text widget.\n"
|
||||
|
||||
@ -30,7 +30,7 @@ TextWidget::TextWidget() {
|
||||
// FIXME - should generalize this to any controller-only situation.
|
||||
if (g_buildconfig.ostype_android()) {
|
||||
if (g_base->input->touch_input() == nullptr) {
|
||||
do_clear_button_ = false;
|
||||
implicit_clear_button_ = false;
|
||||
}
|
||||
}
|
||||
birth_time_millisecs_ =
|
||||
@ -253,7 +253,8 @@ void TextWidget::Draw(base::RenderPass* pass, bool draw_transparent) {
|
||||
|
||||
// Clear button.
|
||||
if (editable() && (IsHierarchySelected() || always_show_carat_)
|
||||
&& !text_raw_.empty() && do_clear_button_) {
|
||||
&& !text_raw_.empty() && implicit_clear_button_
|
||||
&& allow_clear_button_) {
|
||||
base::SimpleComponent c(pass);
|
||||
c.SetTransparent(true);
|
||||
if (clear_pressed_ && clear_mouse_over_) {
|
||||
@ -819,7 +820,8 @@ auto TextWidget::HandleMessage(const base::WidgetMessage& m) -> bool {
|
||||
if (editable() && (IsHierarchySelected() || always_show_carat_)
|
||||
&& !text_raw_.empty() && (x >= width_ - 35)
|
||||
&& (x < width_ + kClearMargin) && (y > -kClearMargin)
|
||||
&& (y < height_ + kClearMargin) && do_clear_button_) {
|
||||
&& (y < height_ + kClearMargin) && implicit_clear_button_
|
||||
&& allow_clear_button_) {
|
||||
clear_pressed_ = clear_mouse_over_ = true;
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -73,6 +73,7 @@ class TextWidget : public Widget {
|
||||
void set_flatness(float flatness) { flatness_ = flatness; }
|
||||
void set_shadow(float shadow) { shadow_ = shadow; }
|
||||
void set_res_scale(float res_scale);
|
||||
void set_allow_clear_button(bool val) { allow_clear_button_ = val; }
|
||||
auto GetTextWidth() -> float;
|
||||
void OnLanguageChange() override;
|
||||
void AdapterFinished();
|
||||
@ -130,7 +131,8 @@ class TextWidget : public Widget {
|
||||
bool selectable_{};
|
||||
bool clear_pressed_{};
|
||||
bool clear_mouse_over_{};
|
||||
bool do_clear_button_{true};
|
||||
bool implicit_clear_button_{true};
|
||||
bool allow_clear_button_{true};
|
||||
int carat_position_{9999};
|
||||
int max_chars_{99999};
|
||||
float res_scale_{1.0f};
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user