Ejemplo n.º 1
0
static void initialise(void)
{
	lowPowerModeInitialise();
	configInitialise();
	screenInitialise();
	clockInitialise();
	receiverInitialise();
	buttonInitialise();
	menuInitialise();
}
Ejemplo n.º 2
0
/* Initialise a form and all it's widgets */
static void widgStartForm(W_FORM *psForm)
{
	WIDGET			*psCurr;
	W_FORMGETALL	sGetAll;

	/* Initialise this form */
	// This whole function should be redundant, since all widgets are initialised when created...
	//formInitialise(psForm);

	/*Initialise the widgets on the form */
	formInitGetAllWidgets(psForm, &sGetAll);
	psCurr = formGetAllWidgets(&sGetAll);
	while (psCurr != NULL)
	{
		switch (psCurr->type)
		{
		case WIDG_FORM:
			widgStartForm((W_FORM *)psCurr);
			break;
		case WIDG_LABEL:
			break;
		case WIDG_BUTTON:
			buttonInitialise((W_BUTTON *)psCurr);
			break;
		case WIDG_EDITBOX:
			((W_EDITBOX *)psCurr)->initialise();
			break;
		case WIDG_BARGRAPH:
			break;
		case WIDG_SLIDER:
			sliderInitialise((W_SLIDER *)psCurr);
			break;
		default:
			ASSERT(!"Unknown widget type", "Unknown widget type");
			break;
		}

		psCurr = psCurr->psNext;
		if (!psCurr)
		{
			/* Got to the end of this list see if there is another */
			psCurr = formGetAllWidgets(&sGetAll);
		}
	}
}
Ejemplo n.º 3
0
/* Create a button widget data structure */
W_BUTTON* buttonCreate(const W_BUTINIT* psInit)
{
	W_BUTTON* psWidget;

	if (psInit->style & ~(WBUT_PLAIN | WIDG_HIDDEN | WFORM_NOCLICKMOVE
	                    | WBUT_NOPRIMARY | WBUT_SECONDARY | WBUT_TXTCENTRE))
	{
		ASSERT(!"unknown button style", "buttonCreate: unknown button style");
		return NULL;
	}

	/* Allocate the required memory */
	psWidget = (W_BUTTON *)malloc(sizeof(W_BUTTON));
	if (psWidget == NULL)
	{
		debug(LOG_FATAL, "buttonCreate: Out of memory" );
		abort();
		return NULL;
	}
	/* Allocate memory for the text and copy it if necessary */
	if (psInit->pText)
	{
		psWidget->pText = psInit->pText;
	}
	else
	{
		psWidget->pText = NULL;
	}
	/* Allocate the memory for the tip and copy it if necessary */
	if (psInit->pTip)
	{
		psWidget->pTip = psInit->pTip;
	}
	else
	{
		psWidget->pTip = NULL;
	}

	/* Initialise the structure */
	psWidget->type = WIDG_BUTTON;
	psWidget->id = psInit->id;
	psWidget->formID = psInit->formID;
	psWidget->style = psInit->style;
	psWidget->x = psInit->x;
	psWidget->y = psInit->y;
	psWidget->width = psInit->width;
	psWidget->height = psInit->height;
	psWidget->callback = psInit->pCallback;
	psWidget->pUserData = psInit->pUserData;
	psWidget->UserData = psInit->UserData;
	psWidget->AudioCallback = WidgGetAudioCallback();
	psWidget->HilightAudioID = WidgGetHilightAudioID();
	psWidget->ClickedAudioID = WidgGetClickedAudioID();

	if (psInit->pDisplay)
	{
		psWidget->display = psInit->pDisplay;
	}
	else
	{
		psWidget->display = buttonDisplay;
	}
	psWidget->FontID = psInit->FontID;

	buttonInitialise(psWidget);

	return psWidget;
}
Ejemplo n.º 4
0
/* Create a button widget data structure */
BOOL buttonCreate(W_BUTTON **ppsWidget, W_BUTINIT *psInit)
{
	if (psInit->style & ~(WBUT_PLAIN | WIDG_HIDDEN | WFORM_NOCLICKMOVE |
						  WBUT_NOPRIMARY | WBUT_SECONDARY | WBUT_TXTCENTRE ))
	{
		ASSERT((FALSE, "Unknown button style"));
		return FALSE;
	}

//#ifdef DEBUG
//	if (psInit->pText)
//	{
//		ASSERT((PTRVALID(psInit->psFont, sizeof(PROP_FONT)),
//			"buttonCreate: Invalid font pointer"));
//	}
//#endif

	/* Allocate the required memory */
#if W_USE_MALLOC
	*ppsWidget = (W_BUTTON *)MALLOC(sizeof(W_BUTTON));
	if (*ppsWidget == NULL)
#else
	if (!HEAP_ALLOC(psButHeap, ppsWidget))
#endif
	{
		ASSERT((FALSE, "buttonCreate: Out of memory"));
		return FALSE;
	}
	/* Allocate memory for the text and copy it if necessary */
	if (psInit->pText)
	{
#if W_USE_STRHEAP
		if (!widgAllocCopyString(&(*ppsWidget)->pText, psInit->pText))
		{
			ASSERT((FALSE, "buttonCreate: Out of memory"));
#if W_USE_MALLOC
			FREE(*ppsWidget);
#else
			HEAP_FREE(psButHeap, *ppsWidget);
#endif
			return FALSE;
		}
#else
		(*ppsWidget)->pText = psInit->pText;
#endif
	}
	else
	{
		(*ppsWidget)->pText = NULL;
	}
	/* Allocate the memory for the tip and copy it if necessary */
	if (psInit->pTip)
	{
#if W_USE_STRHEAP
		if (!widgAllocCopyString(&(*ppsWidget)->pTip, psInit->pTip))
		{
			/* Out of memory - just carry on without the tip */
			ASSERT((FALSE, "buttonCreate: Out of memory"));
			(*ppsWidget)->pTip = NULL;
		}
#else
		(*ppsWidget)->pTip = psInit->pTip;
#endif
	}
	else
	{
		(*ppsWidget)->pTip = NULL;
	}

	/* Initialise the structure */
	(*ppsWidget)->type = WIDG_BUTTON;
	(*ppsWidget)->id = psInit->id;
	(*ppsWidget)->formID = psInit->formID;
	(*ppsWidget)->style = psInit->style;
	(*ppsWidget)->x = psInit->x;
	(*ppsWidget)->y = psInit->y;
	(*ppsWidget)->width = psInit->width;
	(*ppsWidget)->height = psInit->height;
	(*ppsWidget)->callback = psInit->pCallback;
	(*ppsWidget)->pUserData = psInit->pUserData;
	(*ppsWidget)->UserData = psInit->UserData;
	(*ppsWidget)->AudioCallback = WidgGetAudioCallback();
	(*ppsWidget)->HilightAudioID = WidgGetHilightAudioID();
	(*ppsWidget)->ClickedAudioID = WidgGetClickedAudioID();


	if (psInit->pDisplay)
	{
		(*ppsWidget)->display = psInit->pDisplay;
	}
	else
	{
		(*ppsWidget)->display = buttonDisplay;
	}
//	(*ppsWidget)->psFont = psInit->psFont;
	(*ppsWidget)->FontID = psInit->FontID;

	buttonInitialise(*ppsWidget);

	return TRUE;
}