added delete to entrys and search box..

master
steffen 13 years ago
parent 60d26e354a
commit 01b9406ca3

Binary file not shown.

@ -1,4 +1,4 @@
/* $Id: gui_entry.c,v 1.16 2013/06/09 20:11:30 steffen Exp $ */ /* $Id: gui_entry.c,v 1.17 2013/06/14 23:03:05 steffen Exp $ */
/*************************************************************************** /***************************************************************************
* gui_entry.c * gui_entry.c
* *
@ -100,6 +100,12 @@ int gui_entry_event (GUIItem *item, GUIEvent *event) {
entry->curpos--; entry->curpos--;
} }
} }
else if (event->key == 0x7f) { // delete
d_printf ("gui_entry:delete");
if (entry->curpos >= 0 && entry->curpos-1 < u8_strlen (entry->text)) {
u8_strdel (entry->text, entry->curpos, 1);
}
}
else if (event->key == 0x1b) { // esc else if (event->key == 0x1b) { // esc
gui_close (); gui_close ();
} }

@ -1,4 +1,4 @@
/* $Id: gui_list.c,v 1.11 2013/04/05 22:36:46 steffen Exp $ */ /* $Id: gui_list.c,v 1.12 2013/06/14 23:03:05 steffen Exp $ */
/*************************************************************************** /***************************************************************************
* gui_list.c * gui_list.c
* *
@ -127,5 +127,6 @@ GUIItem *gui_list_new (int x, int y, int w, int h) {
list->selected = -1; list->selected = -1;
list->vs = 0; list->vs = 0;
list->callback_selectitem = NULL; list->callback_selectitem = NULL;
list->data = NULL;
return item; return item;
}; };

@ -26,14 +26,13 @@
#include "gui.h" #include "gui.h"
#include "system.h" #include "system.h"
#define SEARCH_MAXRESULT 32 #define SEARCH_MAXRESULT 32
void gui_search_close (); void gui_search_close ();
void gui_search_refresh (); void gui_search_refresh ();
void gui_search_next (); void gui_search_next ();
void gui_search_prev (); void gui_search_prev ();
void gui_search_search (); void gui_search_city ();
void gui_search_switch (int pos); void gui_search_switch (int pos);
struct map_search_data search_data[SEARCH_MAXRESULT]; struct map_search_data search_data[SEARCH_MAXRESULT];
@ -41,50 +40,64 @@ int search_data_cnt = 0;
int search_data_cur = -1; int search_data_cur = -1;
static GUIWindow wsearch = {0}; static GUIWindow wsearch = {0};
GUIItem *ws_entryname = NULL;
GUIItem *ws_labelname = NULL;
GUIItem *ws_entrystreet = NULL;
GUIItem *ws_labelstreet = NULL;
GUIItem *ws_btnok = NULL;
GUIItem *ws_btncancel = NULL;
GUIItem *ws_list = NULL;
GUIItem *ws_map = NULL; /* need to finish working on: gui_images and map_view */
void gui_search_show () { void gui_search_show () {
if (wsearch.screen == NULL) gui_window_new (&wsearch, 220, 60, _("Search..")); if (wsearch.screen == NULL) gui_window_new (&wsearch, 220, 260, _("Search.."));
wsearch.screen_changed = 1;
// wmmenu.callback_close = (void*)gui_mainmenu_closecallback;
wsearch.screen_changed = 1; wsearch.screen_changed = 1;
wsearch.style = WGUI_S_VCENTER | WGUI_S_HTOP; wsearch.style = WGUI_S_VCENTER | WGUI_S_HCENTER;
wsearch.title[0] = 0; wsearch.title[0] = 0;
gui_show (&wsearch); /* Name Ok Button */
}; if (ws_labelname == NULL) ws_labelname = gui_label_new (_("City:"), 5, 10);
gui_window_item_add (&wsearch, ws_labelname);
if (ws_entryname == NULL) ws_entryname = gui_entry_new (_(""), 50, 10, 100, 20);
gui_window_item_add (&wsearch, ws_entryname);
GUI_ENTRY_T (ws_entryname)->callback_enter = gui_search_city;
void gui_search_close () { if (ws_btnok == NULL) ws_btnok = gui_button_new (_("Ok"), 165, 5, 50, 20);
gui_close (); GUI_BUTTON_T (ws_btnok)->callback_clicked = (void*) gui_search_close;
}; gui_window_item_add (&wsearch, ws_btnok);
/* street Cancel Button */
if (ws_labelstreet == NULL) ws_labelstreet = gui_label_new (_("Street:"), 5, 35);
gui_window_item_add (&wsearch, ws_labelstreet);
void gui_search_refresh () { if (ws_entrystreet == NULL) ws_entrystreet = gui_entry_new (_(""), 50, 30, 100, 20);
map_refresh (view_lon, view_lat); gui_window_item_add (&wsearch, ws_entrystreet);
draw_redrawmap ();
draw ();
};
if (ws_btncancel == NULL) ws_btncancel = gui_button_new (_("Cancel"), 165, 30, 50, 20);
GUI_BUTTON_T (ws_btncancel)->callback_clicked = (void*) gui_search_close;
gui_window_item_add (&wsearch, ws_btncancel);
void gui_search_prev () { /* result list */
d_printf ("search_data_cur:%d", search_data_cur); if (ws_list == NULL) ws_list = gui_list_new (5, 55, 210, 100);
gui_search_switch (search_data_cur-1); gui_window_item_add (&wsearch, ws_list);
d_printf ("search_data_cur:%d", search_data_cur);
gui_show (&wsearch);
}; };
void gui_search_next () { void gui_search_close () {
d_printf ("search_data_cur:%d", search_data_cur); gui_close ();
gui_search_switch (search_data_cur+1);
d_printf ("search_data_cur:%d", search_data_cur);
}; };
void gui_search_search () { void gui_search_city () {
char text[] = "ttttt..."; int i;
char text[] = "gui_search_city";
search_data_cnt = map_search (text, search_data, SEARCH_MAXRESULT); search_data_cnt = map_search (text, search_data, SEARCH_MAXRESULT);
gui_search_switch (0); for (i = 0; i < search_data_cnt; i++)
d_printf (" %-3d:%s",i , search_data->name[i]);
}; };

Loading…
Cancel
Save