delete suggestions_popup;
suggestions->remove_all_objects();
delete suggestions;
- delete [] positions;
delete [] wtext;
if( size > 0 )
delete [] text;
wtext = 0;
wsize = 0;
wlen = 0;
- positions = 0;
- plen = 0;
keypress_draw = 1;
last_keypress = 0;
separators = 0;
wchar_t *ntext = new wchar_t[nsize+1];
memcpy(ntext, wtext, wsize*sizeof(wtext[0]));
delete [] wtext; wtext = ntext; wsize = nsize;
- int *npositions = new int[nsize+1];
- if( plen > 0 )
- memcpy(npositions, positions, (plen+1)*sizeof(positions[0]));
- else
- npositions[0] = 0;
- delete [] positions; positions = npositions; plen = nsize;
}
wlen = BC_Resources::encode(src_enc, dst_enc, text, strlen(text),
(char*)wtext, wsize*sizeof(wchar_t)) / sizeof(wchar_t);
if( col < 0 ) col = 0;
char *cur = current_suggestion + col;
tstrcat(cur);
- draw(0); // update positions
highlight_letter2 = wtext_update();
//printf("BC_TextBox::set_suggestions %d %d\n", __LINE__, suggestion_column);
set_color(color);
if(highlight_letter1 >= row_begin &&
highlight_letter1 <= row_end)
- highlight_x1 = positions[highlight_letter1];
+ highlight_x1 = get_x_position(highlight_letter1, row_begin);
else
highlight_x1 = 0;
if(highlight_letter2 > row_begin &&
highlight_letter2 <= row_end)
- highlight_x2 = positions[highlight_letter2];
+ highlight_x2 = get_x_position(highlight_letter2, row_begin);
else
highlight_x2 = get_w();
int len = row_end - row_begin;
if( len > 0 ) {
set_color(enabled ? resources->text_default : DMGREY);
- draw_wtext(text_x, k + text_ascent, wtext_row, len,
- 0, &positions[wtext_row - wtext]);
+ draw_wtext(text_x, k + text_ascent, wtext_row, len, 0);
}
- else
- positions[wtext_row - wtext] = 0;
// Get ibeam location
if(ibeam_letter >= row_begin && ibeam_letter <= row_end) {
need_ibeam = 0;
ibeam_y = k - text_y;
- ibeam_x = positions[ibeam_letter];
+ ibeam_x = get_x_position(ibeam_letter, row_begin);
}
}
}
if( top_level->event_win == win && enabled &&
!(top_level->get_resources()->textbox_focus_policy & CLICK_ACTIVATE) )
{
- tooltip_done = 0;
if( !active ) {
top_level->deactivate();
activate();
tooltip_text && tooltip_text[0] != 0 && highlighted)
{
show_tooltip();
- tooltip_done = 1;
result = 1;
}
}
}
+int BC_TextBox::get_x_position(int i, int start)
+{
+ return get_text_width(font, &wtext[start], i - start);
+}
+
void BC_TextBox::get_ibeam_position(int &x, int &y)
{
int i, row_begin, row_end;
row_end = i;
if( ibeam_letter >= row_begin && ibeam_letter <= row_end ) {
- x = get_text_width(font, &wtext[row_begin], ibeam_letter - row_begin);
+ x = get_x_position(ibeam_letter, row_begin);
//printf("BC_TextBox::get_ibeam_position %d %d %d %d %d\n", ibeam_letter, row_begin, row_end, x, y);
return;
}
if(item)
{
popup->textbox->update(item->get_text());
+ popup->textbox->set_text_row(0);
popup->handle_event();
}
return 1;
void BC_PopupTextBox::update(const char *text)
{
textbox->update(text);
+ textbox->set_text_row(0);
}
void BC_PopupTextBox::update_list(ArrayList<BC_ListBoxItem*> *data)
{
- listbox->update(data,
- 0,
- 0,
- 1);
+ listbox->update(data, 0, 0, 1);
}
return textbox->get_h();
}
+int BC_PopupTextBox::get_show_query()
+{
+ return listbox->get_show_query();
+}
+
+void BC_PopupTextBox::set_show_query(int v)
+{
+ listbox->set_show_query(v);
+}
+
int BC_PopupTextBox::handle_event()
{
return 1;
int BC_TumbleTextBox::update(const char *value)
{
textbox->update(value);
+ textbox->set_text_row(0);
return 0;
}
int BC_TumbleTextBox::update(int64_t value)
{
textbox->update(value);
+ textbox->set_text_row(0);
return 0;
}
int BC_TumbleTextBox::update(float value)
{
textbox->update(value);
+ textbox->set_text_row(0);
return 0;
}
{
tumbler->set_boundaries(min, max);
}
+
+void BC_TumbleTextBox::set_tooltip(const char *text)
+{
+ textbox->set_tooltip(text);
+}
+