#include #include #include "contactWind.h" extern contact* contactList; extern size_t nbContacts; int x_menuContact = 1,y_menuContact = 1; int w_menuContact,h_menuContact; int contactListSelection; int firstConctactShow; int showName = 1; contact* getContactSelected(void) { return contactListSelection+contactList; } void selectNextContact(void) { if( contactListSelection < nbContacts - 1) contactListSelection++; clearContactListW(); } void selectPreviousContact(void) { if( contactListSelection > 0) contactListSelection--; clearContactListW(); } void clearContactListW(void) { for(int i = firstConctactShow; i < h_menuContact && i < nbContacts; i++) { move(y_menuContact+i,x_menuContact); printw("%*s", w_menuContact, " "); } } void showContactListW(void) { int x = x_menuContact; int y = y_menuContact; int w = w_menuContact; int h = h_menuContact; int s = nbContacts; if( contactListSelection < firstConctactShow ) { firstConctactShow-=h/2; if( firstConctactShow < 0 ) firstConctactShow = 0; clearContactListW(); } if( contactListSelection >= firstConctactShow + h ) { attrset(0 | A_NORMAL ); firstConctactShow+=h/2; if( firstConctactShow > nbContacts-1 ) firstConctactShow = nbContacts-1; clearContactListW(); } int i; for(i = firstConctactShow ; i < (h+firstConctactShow) && i < s ; i++) { int color = 0, attr = A_NORMAL; // if( it[i].opt == 1 ) // color = COLOR_BLUE+1; if( contactList[i].conversation ) attr |= A_BOLD; if( i == contactListSelection ) { attr |= A_REVERSE; } attrset( COLOR_PAIR(color) | attr); move(y,x); printw("%*s", w, " "); if( showName ) mvprintc(x,y++,contactList[i].display_name, w); else mvprintc(x,y++,contactList[i].number, w); attrset(0 | A_NORMAL); } for( ; i < s ; i++){ // Clear } }