Example #1
0
//---------------------------------------------------------------------------
void DeleteListItem( PSI_CONTROL pc, PLISTITEM hli )
{
	PLISTITEM pli = (PLISTITEM)hli;
	PLISTITEM cur;
	ValidatedControlData( PLISTBOX, LISTBOX_CONTROL, plb, pc );
	if( plb )
	{
		cur = plb->items;
		while( cur )
		{
			if( cur == pli )
			break;
			cur = cur->next;
		}
		if( cur )
		{
			PLISTITEM pliNew;
			if( pli->prior )
				pli->prior->next = pli->next;
			else
				plb->items = cur->next;

			if( pli->next )
			{
				pli->next->prior = pli->prior;
				pliNew = pli->next;
			}
			else
			{
				plb->last = pli->prior;
				pliNew = pli->prior;
			}

			if( plb->firstshown == pli )
			{
				if( pli->next )
					plb->firstshown = pli->next;
				else if( pli->prior )
					plb->firstshown = pli->prior;
				else
					plb->firstshown = NULL;
			}
			if( plb->lastshown == pli )
				plb->lastshown = NULL;
			if( plb->current == pli )
			{
			// set current selection
				plb->current = pliNew;
			}
			Release( pli->text );
			Release( pli );
		}
		if( !plb->flags.bDestroying )
			SmudgeCommon(pc);
	}
}
Example #2
0
static void CPROC RefreshProc( uintptr_t psvTimer )
{
	CTEXTSTR *results;
	PODBC odbc = SQLGetODBCEx( cashball_local.DSN, cashball_local.user, cashball_local.password );

	SQLRecordQueryf( odbc, NULL, &results, NULL, "select Cashball from v_SessionCashball" );
	if( results && results[0] )
	{
		if( StrCmp( cashball_local.value, results[0] ) )
		{
			if( cashball_local.value )
			{
				Deallocate( TEXTSTR, cashball_local.value );
			}
			cashball_local.value = StrDup( results[0] );
			{
				INDEX idx;
				PSI_CONTROL pc;
				LIST_FORALL( cashball_local.timers, idx, PSI_CONTROL, pc )
					SmudgeCommon( pc );
			}
		}
	}
	else
	{
		if( cashball_local.value )
		{
			Deallocate( TEXTSTR, cashball_local.value );
			cashball_local.value = NULL;
			{
				INDEX idx;
				PSI_CONTROL pc;
				LIST_FORALL( cashball_local.timers, idx, PSI_CONTROL, pc )
					SmudgeCommon( pc );
			}
		}
	}
	SQLEndQuery( odbc );
	SQLDropODBC( odbc );
}
Example #3
0
void ClearSelectedItems( PSI_CONTROL pc )
{
	ValidatedControlData( PLISTBOX, LISTBOX_CONTROL, plb, pc );
	PLISTITEM pli;
	plb->first_selected = NULL; // no selection
	pli = plb->items;
	while( pli )
	{
		pli->flags.bSelected = FALSE;
		pli = pli->next;
	}
	SmudgeCommon( pc );
}
Example #4
0
PSI_PROC( void, ResetList )( PSI_CONTROL pc )
{
	ValidatedControlData( PLISTBOX, LISTBOX_CONTROL, plb, pc );
	if( plb )
	{
		plb->flags.bDestroying = 1; // fake it...
		while( plb->items )
			DeleteListItem( pc, (PLISTITEM)plb->items );

		plb->flags.bDestroying = 0; // okay we're not really ...
		SmudgeCommon( pc );
	}
}
Example #5
0
	void flush( void )
	{
		if( _wd && _ht )
		{
			//Log4( WIDE("Flushing update to display... %d,%d - %d,%d"), _x, _y, _wd, _ht );
         if( pDisplay )
				UpdateDisplayPortion( pDisplay, _x, _y, _wd, _ht );
			else
            SmudgeCommon( pControl );
		}
		_wd = 0;
		_ht = 0;
	}
Example #6
0
void CPROC UpdateGrid( uintptr_t psv )
{
	SmudgeCommon( (PSI_CONTROL)psv );
}
Example #7
0
int CPROC TableMouse( PCOMMON psv, int32_t x, int32_t y, uint32_t b )
{
	// what can I do with a mouse?
	// I can drraw on a frame... I don't need to be a control...
	//lprintf( WIDE("mouse: %d %d %x"), x, y, b);
	if( ( b & MK_LBUTTON ) && !( l._b & MK_LBUTTON ) )
	{
		int s = y / l.step_y;
		int f = x / l.step_x;
		if( s > 3 )
			if( SUS_LT(y, int32_t, ((l.step_y * 3) + l.height), uint32_t ) )
				s = 3;
		if( f > 12 )
			if( SUS_LT(x, int32_t, ((l.step_x * 13 ) + l.width ), uint32_t ) )
            f = 12;
		lprintf( WIDE("s:%d f:%d %p"), s, f, l.cards[s][f] );
		if( ( s < 4 && s >= 0 )
			&&( f >= 0 && f < 13 ) )
		{
			lprintf( WIDE("s:%d f:%d %p"), s, f, l.cards[s][f] );
			if( l.cards[s][f] )
			{
				if( l.nHand < 2 )
				{
               l.hand_id[l.nHand] = s * 13 + f;
               l.hand_card[l.nHand] = l.cards[s][f];
					HandAdd( l.hand, l.cards[s][f] );
					l.cards[s][f] = NULL;
					l.hand_image[l.nHand++] = l.card_image[s][f];
               SmudgeCommon( l.frame );
				}
				else if( l.nTable < 5 )
				{
               l.table_id[l.nTable] = s * 13 + f;
               l.table_card[l.nTable] = l.cards[s][f];
					DeckPlayCard( l.deck, l.cards[s][f] );
					l.cards[s][f] = NULL;
					l.table_image[l.nTable++] = l.card_image[s][f];
               SmudgeCommon( l.frame );
				}
			}
		}
		else if( x > 300 && x < ( 300 + 1 * l.step_x + l.width ) &&
				  y > 10 && y < 10 + l.height )
		{
			if( l.nHand )
			{
            l.nHand--;
				l.cards[0][l.hand_id[l.nHand]] = GrabCard( l.hand_card[l.nHand] );
				SmudgeCommon( l.frame );
			}
		}
      else if( x > 300 && x < ( 300 + 5 * l.step_x ) &&
				  y > 90 && y < 90 + l.height )
		{
			if( l.nTable )
			{
				l.nTable--;
				l.cards[0][l.table_id[l.nTable]] = GrabCard( l.table_card[l.nTable] );
				SmudgeCommon( l.frame );
			}
		}
		// else check if on hand
		// else check if on table
      // else check if on player select
	}
	l._b = b;
   return 1;
}