MCPcopy Create free account
hub / github.com/davisking/dlib / on_string_put

Method on_string_put

dlib/gui_widgets/widgets.cpp:1219–1249  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1217// ----------------------------------------------------------------------------------------
1218
1219 void text_field::
1220 on_string_put(
1221 const std::wstring &str
1222 )
1223 {
1224 if (has_focus && enabled && !hidden){
1225 ustring ustr = convert_to_utf32(str);
1226 if (highlight_start <= highlight_end)
1227 {
1228 text_ = text_.substr(0,highlight_start) + ustr +
1229 text_.substr(highlight_end+1,text_.size()-highlight_end-1);
1230 move_cursor(highlight_start+ustr.size());
1231 highlight_start = 0;
1232 highlight_end = -1;
1233 on_no_text_selected();
1234 parent.invalidate_rectangle(rect);
1235 }
1236 else
1237 {
1238 text_ = text_.substr(0,cursor_pos) + ustr +
1239 text_.substr(cursor_pos,text_.size()-cursor_pos);
1240 move_cursor(cursor_pos+ustr.size());
1241 }
1242 unsigned long height;
1243 mfont->compute_size(text_,text_width,height,text_pos);
1244
1245 // send out the text modified event
1246 if (text_modified_handler.is_set())
1247 text_modified_handler();
1248 }
1249 }
1250
1251// ----------------------------------------------------------------------------------------
1252

Callers

nothing calls this directly

Calls 4

convert_to_utf32Function · 0.85
compute_sizeMethod · 0.80
sizeMethod · 0.45
is_setMethod · 0.45

Tested by

no test coverage detected