feat(chat): distinguish between send and cancel in chat input

This commit is contained in:
2026-07-18 20:49:47 +08:00
parent 75f71a537f
commit c0c385b8d6
8 changed files with 49 additions and 30 deletions

View File

@@ -34,7 +34,7 @@ public:
void set_pause(bool pause);
void set_error(std::string_view error);
void set_mouse(bool pause);
void set_chatting(bool chatting);
void set_chatting(bool chatting, bool send);
// Not thread safe
void handle_chat_message(ChatMessage& message);

View File

@@ -25,7 +25,7 @@ public:
float width() const override;
float height() const override;
void set_d_image(TextureManager& m);
void set_typing(bool typing);
void set_typing(bool typing, bool finished);
void set_app(App* app);
template <typename F> ChatBox& set_on_finish(F&& f) {
m_text_field->set_on_finish(std::forward<F>(f));

View File

@@ -27,7 +27,7 @@ public:
TextField& set_default_image(TextureManager& texture_manager);
TextField& set_auto_scale(bool auto_scale);
TextField& set_app(App* app);
TextField& set_typing(bool typing);
TextField& set_typing(bool typing, bool finished);
TextField& clear_input();
bool handle_mouse_move_event(const MouseMoveEvent& e) override;
bool handle_mouse_button_event(const MouseButtonEvent& e) override;
@@ -74,6 +74,6 @@ private:
void update_input_area();
void start_typing();
void stop_typing();
void stop_typing(bool finished);
};
} // namespace Cubed

View File

@@ -19,7 +19,7 @@ public:
void init() override;
void render(Renderer& renderer) override;
void set_chatting(bool chantting);
void set_chatting(bool chantting, bool sned);
void add_chat_message(ChatMessage& message);