Beispiel #1
0
static int hotKeyShowList(
	GOC_HANDLER uchwyt, GOC_MSG wiesc, void *pBuf, unsigned int nBuf)
{
	GOC_FLAGS f = goc_elementGetFlag(lLista);
	if ( f & GOC_EFLAGA_PAINTED )
	{
		goc_listClear(lLista);
		goc_elementIsFlag(lLista, GOC_EFLAGA_PAINTED | GOC_EFLAGA_ENABLE);
		//goc_elementSetFlag(lLista, f);
		goc_systemRepaintUnder(lLista);
		fflush(stdout);
	}
	else
	{
		int size = 0;
		const char **ptr;
		doAction(ACTION_PLAYLIST_GETSIZE, &size);
		doAction(ACTION_PLAYLIST_GETTABLE, &ptr);
		goc_listSetExtTable(lLista, ptr, size);
		doAction(ACTION_PLAYLIST_GETACTUAL, &size);
		goc_sellistSelect(lLista, size);
		goc_listSetCursor(lLista, size);
		goc_elementOrFlag(lLista, GOC_EFLAGA_PAINTED | GOC_EFLAGA_ENABLE);
		goc_systemFocusOn(lLista);
	}
	goc_systemSendMsg(lLista, GOC_MSG_PAINT, 0, 0);
}
Beispiel #2
0
static int nasluch(GOC_HANDLER uchwyt, GOC_MSG wiesc, void *pBuf, unsigned int nBuf)
{
	if ( uchwyt == GOC_HANDLER_SYSTEM )
	{
		if ( wiesc == GOC_MSG_CHAR )
		{
			if ( nBuf == 27 )
				return GOC_ERR_OK;
		}
	}
	else if ( uchwyt == lLista )
	{
		if ( wiesc == GOC_MSG_CHAR )
		{
			if ( nBuf == 0x0D )
			{
				char *selFile = goc_listGetUnderCursor( lLista );
				if ( selFile )
					doAction(ACTION_PLAY, selFile);
				return GOC_ERR_OK;
			}
			else if ( nBuf == 0x116 )
			{
				int pos = goc_listGetCursor(lLista);
				if ( pos > 0 )
				{
					int size = 0;
					const char **ptr;
					doAction(ACTION_PLAYLIST_REMOVEFILE, &pos);
					doAction(ACTION_PLAYLIST_GETSIZE, &size);
					doAction(ACTION_PLAYLIST_GETTABLE, &ptr);
					goc_listSetExtTable(lLista, ptr, size);
					doAction(ACTION_PLAYLIST_GETACTUAL, &size);
					goc_sellistSelect(lLista, size);
					goc_listSetCursor(lLista, pos);
//		goc_elementOrFlag(lLista, GOC_EFLAGA_PAINTED | GOC_EFLAGA_ENABLE);
//		goc_systemFocusOn(lLista);
					goc_systemSendMsg(lLista, GOC_MSG_PAINT, 0, 0);
				}
				return GOC_ERR_OK;
			}
		}
		else if ( wiesc == GOC_MSG_LISTCHANGE )
		{
			// TODO: Opis zaznaczonej pozycji
			return GOC_ERR_OK;
		}
	}
/*	else if ( uchwyt == pLista )
	{
		// selekcjonuj tylko katalogi do dodawania
		if ( wiesc == GOC_MSG_FILELISTADDFILE )
		{
			if ( nBuf != GOC_FILELISTFLAG_FOLDER )
				return GOC_ERR_REFUSE;
		}
	}*/
	return goc_systemDefaultAction(uchwyt, wiesc, pBuf, nBuf);
}
Beispiel #3
0
int controlEvent(unsigned int event)
{
	if ( event == EVENT_CHANGE_SONG ) 
	{
		char buf[256];
		int param;
		param = INFO_FILE;
		doAction(ACTION_INFO, &param);
		sprintf(buf, "Plik: %s", (char *)param); free((char*)param);
		goc_labelSetText(nPlik, buf, 0);
		goc_systemSendMsg(nPlik, GOC_MSG_PAINT, 0, 0);

		param = INFO_TITLE;
		doAction(ACTION_INFO, &param);
		sprintf(buf, "Title: %s", (char *)param); free((char*)param);
		goc_labelSetText(nTitle, buf, 0);
		goc_systemSendMsg(nTitle, GOC_MSG_PAINT, 0, 0);

		param = INFO_ARTIST;
		doAction(ACTION_INFO, &param);
		sprintf(buf, "Artist: %s", (char *)param); free((char*)param);
		goc_labelSetText(nArtist, buf, 0);
		goc_systemSendMsg(nArtist, GOC_MSG_PAINT, 0, 0);
		
		param = INFO_ALBUM;
		doAction(ACTION_INFO, &param);
		sprintf(buf, "Album: %s", (char *)param); free((char*)param);
		goc_labelSetText(nAlbum, buf, 0);
		goc_systemSendMsg(nAlbum, GOC_MSG_PAINT, 0, 0);
		
		param = INFO_YEAR;
		doAction(ACTION_INFO, &param);
		sprintf(buf, "Year: %s", (char *)param); free((char*)param);
		goc_labelSetText(nYear, buf, 0);
		goc_systemSendMsg(nYear, GOC_MSG_PAINT, 0, 0);
		
		param = INFO_COMMENT;
		doAction(ACTION_INFO, &param);
		sprintf(buf, "Comment: %s", (char *)param); free((char*)param);
		goc_labelSetText(nComment, buf, 0);
		goc_systemSendMsg(nComment, GOC_MSG_PAINT, 0, 0);
		if ( goc_elementGetFlag(lLista) & GOC_EFLAGA_PAINTED )
		{
			int pos = 0;
			pos = goc_sellistGetSelectPos(lLista, 0);
			goc_sellistUnselect(lLista, pos);
			pos = 0;
			doAction(ACTION_PLAYLIST_GETACTUAL, &pos);
			goc_sellistSelect(lLista, pos);
			goc_systemSendMsg(lLista, GOC_MSG_PAINT, 0, 0);
		}
	}
	return 0;
}
Beispiel #4
0
int main()
{
	GOC_MSG wiesc;
	GOC_HANDLER lista;
	GOC_HANDLER lista2;
	lista = goc_elementCreate(GOC_ELEMENT_SELLIST, 1, 1, 20, 10,
			GOC_EFLAGA_PAINTED | GOC_EFLAGA_ENABLE,
			GOC_WHITE, GOC_HANDLER_SYSTEM );
	listaBuduj(lista);
	goc_sellistSelect(lista, 1);
	goc_sellistSelect(lista, 4);
	goc_sellistSelect(lista, 5);
	lista2 = goc_elementCreate(GOC_ELEMENT_SELLIST, 21, 1, 20, 10,
			GOC_EFLAGA_PAINTED | GOC_EFLAGA_ENABLE,
			GOC_WHITE, GOC_HANDLER_SYSTEM );
	goc_listAddColumn(lista2, 10);
	goc_listAddColumn(lista2, 10);
	listaBudujKolumna(lista2);
	goc_sellistSelect(lista2, 1);
	goc_sellistSelect(lista2, 4);
	goc_sellistSelect(lista2, 5);
	while (goc_systemCheckMsg( &wiesc ));
	return 0;
}