void cgraphics_listview_new_row( widget_t *widget, list_item_t *item ) { listview_widget_t *lvw = (listview_widget_t *)widget; item->native = (void *)malloc( sizeof(HWND) * lvw->widget.columns ); memset( item->native, 0, sizeof(HWND) * lvw->widget.columns ); SendMessage( widget->native, LVM_SETITEMCOUNT, (WPARAM)listview_get_rows(OBJECT(widget)), 0 ); }
void b_autowin_gui_save( ) { XMLItem *autoi, *autoc; list_item_t *row; int rows; int a; if ( xidentity == 0 ) { printf( "Invalid identity!\n" ); exit( 0 ); } // remove all items autoi = c_xml_find_child( xidentity, "auto-connect" ); if ( autoi != 0 ) { c_xml_clean_from( autoi->child_head ); autoi->child_head = autoi->child_curr = 0; } else { autoi = c_xml_add_child( xidentity, "auto-connect" ); } rows = listview_get_rows( autowin_servlist ); for ( a = 0; a < rows; a++ ) { /* FIXME: list_widget_get_row isn't very efficient :( */ row = list_widget_get_row( autowin_servlist, 0, a ); autoc = c_xml_add_child( autoi, "server" ); if ( row->data[0] != 0 ) { int *ip = (int *)row->data[0]; c_xml_attrib_set( autoc, "enabled", (*ip) ? "yes" : "no" ); } if ( row->data[1] != 0 ) c_xml_attrib_set( autoc, "name", (char *)row->data[1] ); if ( row->data[2] != 0 ) c_xml_attrib_set( autoc, "channels", (char *)row->data[2] ); } c_xml_dump_file( config, filepath ); }
void cgraphics_listview_remove_row( widget_t *widget, list_item_t *item ) { listview_widget_t *lvw = (listview_widget_t *)widget; int a; HWND *hwnds; SendMessage( widget->native, LVM_SETITEMCOUNT, (WPARAM)listview_get_rows(OBJECT(widget)), 0 ); hwnds = item->native; for ( a = 0; a < lvw->widget.columns; a++ ) { if ( hwnds[a] != 0 ) DestroyWindow( hwnds[a] ); } free( item->native ); }