@@ -72,15 +72,6 @@ class edit_box : public frame {
72
72
*/
73
73
void copy_from (const region& obj) override ;
74
74
75
- /* *
76
- * \brief Updates this region's logic.
77
- * \param delta Time spent since last update
78
- * \note Triggered callbacks could destroy the frame. If you need
79
- * to use the frame again after calling this function, use
80
- * the helper class alive_checker.
81
- */
82
- void update (float delta) override ;
83
-
84
75
/* *
85
76
* \brief Calls a script.
86
77
* \param script_name The name of the script
@@ -171,16 +162,16 @@ class edit_box : public frame {
171
162
std::size_t get_letter_count () const ;
172
163
173
164
/* *
174
- * \brief Sets the carret's blink speed .
175
- * \param blink_period The number of seconds to wait between each blink
165
+ * \brief Sets the carret's blink time .
166
+ * \param blink_time The number of seconds to wait between each blink
176
167
*/
177
- void set_blink_period (double blink_period );
168
+ void set_blink_time (double blink_time );
178
169
179
170
/* *
180
- * \brief Returns the carret's blink speed .
181
- * \return the carret's blink speed (time in seconds between each blink)
171
+ * \brief Returns the carret's blink time .
172
+ * \return the carret's blink time (time in seconds between each blink)
182
173
*/
183
- double get_blink_period () const ;
174
+ double get_blink_time () const ;
184
175
185
176
/* *
186
177
* \brief Makes this edit_box allow numeric characters only.
@@ -221,12 +212,28 @@ class edit_box : public frame {
221
212
bool is_integer_only () const ;
222
213
223
214
/* *
224
- * \brief Enables password mode.
215
+ * \brief Enables or disables password mode.
225
216
* \param enable 'true' to enable password mode
226
217
* \note In password mode, the content of the edit_box is replaced
227
218
* by stars (*).
228
219
*/
229
- void enable_password_mode (bool enable);
220
+ void set_password_mode_enabled (bool enable);
221
+
222
+ /* *
223
+ * \brief Enables password mode.
224
+ * \see set_password_mode_enabled
225
+ */
226
+ void enable_password_mode () {
227
+ set_password_mode_enabled (true );
228
+ }
229
+
230
+ /* *
231
+ * \brief Disables password mode.
232
+ * \see set_password_mode_enabled
233
+ */
234
+ void disable_password_mode () {
235
+ set_password_mode_enabled (false );
236
+ }
230
237
231
238
/* *
232
239
* \brief Checks if this edit_box is in password mode.
@@ -238,10 +245,10 @@ class edit_box : public frame {
238
245
* \brief Allows this edit_box to have several lines in it.
239
246
* \param multi_line 'true' to allow several lines in this edit_box
240
247
* \note The behavior of a "multi line" edit_box is very different from
241
- * a single line one.<br>
242
- * History lines are only available to single line edit_boxes.<br>
243
- * Scrolling in a single line edit_box is done horizontally, while
244
- * it is only done vertically in a multi line one.
248
+ * a single line one. History lines are only available to single-line edit_boxes.
249
+ * Scrolling in a single-line edit_box is done horizontally, while it is only done
250
+ * vertically in a multi- line one.
251
+ * \warning Multi-line edit_box is not yet fully implemented!
245
252
*/
246
253
void set_multi_line (bool multi_line);
247
254
@@ -278,7 +285,7 @@ class edit_box : public frame {
278
285
const std::vector<utils::ustring>& get_history_lines () const ;
279
286
280
287
// / Clears the history line list.
281
- void clear_history ();
288
+ void clear_history_lines ();
282
289
283
290
/* *
284
291
* \brief Sets whether keyboard arrows move the carret or not.
@@ -349,13 +356,15 @@ class edit_box : public frame {
349
356
void parse_font_string_node_ (const layout_node& node);
350
357
void parse_text_insets_node_ (const layout_node& node);
351
358
359
+ void update_ (float delta) override ;
360
+
352
361
const std::vector<std::string>& get_type_list_ () const override ;
353
362
354
363
void create_font_string_ ();
355
364
void create_highlight_ ();
356
365
void create_carret_ ();
357
366
358
- void check_text_ ();
367
+ bool check_text_ ();
359
368
void update_displayed_text_ ();
360
369
void update_font_string_ ();
361
370
void update_carret_position_ ();
@@ -372,7 +381,6 @@ class edit_box : public frame {
372
381
utils::ustring unicode_text_;
373
382
utils::ustring displayed_text_;
374
383
utils::ustring::iterator iter_carret_pos_;
375
- utils::ustring::iterator iter_carret_pos_old_;
376
384
377
385
std::size_t display_pos_ = 0 ;
378
386
std::size_t num_letters_ = 0 ;
@@ -390,8 +398,8 @@ class edit_box : public frame {
390
398
std::size_t selection_end_pos_ = 0u ;
391
399
bool is_text_selected_ = false ;
392
400
393
- utils::observer_ptr<texture> carret_ = nullptr ;
394
- double blink_period_ = 0.5 ;
401
+ utils::observer_ptr<texture> carret_ = nullptr ;
402
+ double blink_time_ = 0.5 ;
395
403
utils::periodic_timer carret_timer_;
396
404
397
405
std::vector<utils::ustring> history_line_list_;
0 commit comments