Exemplo n.º 1
0
void drawMainMenu( void )
{
    PYGMYCOLOR pygmyColor;
    PYGMYFILE pygmyFile;
    PYGMYWIDGET widgetButton;

    pinInterrupt( eventMouseMoveUp, A0, TRIGGER_RISING, 1 );
    pinInterrupt( eventMouseMoveDown, D3, TRIGGER_RISING, 1 );
    pinInterrupt( eventMouseMoveLeft, TA0, TRIGGER_RISING, 1 );
    pinInterrupt( eventMouseMoveRight, DAC1, TRIGGER_RISING, 1 );
    pinInterrupt( eventMouseClickLeft, DAC2, TRIGGER_RISING, 1 );
    pinInterrupt( eventMouseClickCenter, TX2, TRIGGER_RISING, 1 );
    pinInterrupt( eventMouseClickRight, RX2, TRIGGER_RISING, 1 );

    colorSetRGB( colorGetRootColor(), 0x65, 0xBE, 0xFF ); //0x48, 0x8E, 0xDF );
    colorSetRGB( colorGetRootBackColor(), 0x65, 0x65, 0x65 );
    colorSetRGB( colorGetRootFocusColor(), 0x65, 0x65, 0x65 );//0x38, 0x6E, 0xBF  );
    colorSetRGB( colorGetRootFocusBackColor(), 0x65, 0x8E, 0xDF );
    colorSetRGB( colorGetRootClearColor(), 0xFF, 0x0E, 0xE0 );//0xFF, 0xE0, 0xE0 );
     
    guiSetRadius( 8 );
    guiSetStyle( VISIBLE|BUTTON|ROUNDED|BORDER|CENTERED );
    
    formFreeAll();
    formNew( 0, 0, 128, 128 );
    //formCurrentSetColor;
    //formCurrentSetBackColor;
    //formCurrentSetClearColor;
    widgetButton.Style = CAPTION|FILLED|VISIBLE|ROUNDED|BORDER|CENTERED;
    //widgetButton.Style = FILLED|VISIBLE|ROUNDED|BORDER|CENTERED;
    widgetButton.Type = BUTTON;
    widgetButton.X = 0;
    widgetButton.Y = 6;
    widgetButton.Width = 127;
    widgetButton.Height = 36;
    widgetButton.String = "Start Game";
    formAddWidget( &widgetButton );
    //widgetAddEventHandler( widgetGetCurrent(), eventGotFocus, GOTFOCUS );
    //widgetAddEventHandler( widgetGetCurrent(), eventLostFocus, LOSTFOCUS );
    widgetAddEventHandler( widgetGetCurrent(), gemInit, SELECTED );
    
    widgetButton.Y = 46;
    widgetButton.String = "RF Demo";
    formAddWidget( &widgetButton );
    //widgetAddEventHandler( widgetGetCurrent(), eventGotFocus, GOTFOCUS );
    //widgetAddEventHandler( widgetGetCurrent(), eventLostFocus, LOSTFOCUS );
    widgetAddEventHandler( widgetGetCurrent(), drawRFTest, SELECTED );
    
    widgetButton.Y = 86;
    widgetButton.String = "Contrast";
    formAddWidget( &widgetButton );
    //widgetAddEventHandler( widgetGetCurrent(), eventGotFocus, GOTFOCUS );
    //widgetAddEventHandler( widgetGetCurrent(), eventLostFocus, LOSTFOCUS );
    //widgetAddEventHandler( widgetGetCurrent(), eventSelected, SELECTED );
    
    drawForms( );
}
Exemplo n.º 2
0
void drawRFTest( void )
{
    //PYGMYCOLOR pygmyColor;
    //PYGMYFILE pygmyFile;
    PYGMYWIDGET widgetButton;

    colorSetRGB( colorGetRootColor(), 0x65, 0xBE, 0xFF ); //0x48, 0x8E, 0xDF );
    colorSetRGB( colorGetRootBackColor(), 0x65, 0x65, 0x65 );
    colorSetRGB( colorGetRootFocusColor(), 0x65, 0x65, 0x65 );//0x38, 0x6E, 0xBF  );
    colorSetRGB( colorGetRootFocusBackColor(), 0x65, 0x8E, 0xDF );
    colorSetRGB( colorGetRootClearColor(), 0xFF, 0x0E, 0xE0 );
     
    guiSetRadius( 8 );
    guiSetStyle( VISIBLE|BUTTON|ROUNDED|BORDER|CENTERED );
    
    formFreeAll();
    formNew( 0, 0, 128, 128 );
    
    widgetButton.Style = CAPTION|CENTERED|VISIBLE|ROUNDED|BORDER;
    widgetButton.Type = LABEL;
    widgetButton.X = 0;
    widgetButton.Y = 6;
    widgetButton.Width = 127;
    widgetButton.Height = 36;
    widgetButton.String = "Humidity";
    formAddWidget( &widgetButton );
    
    widgetButton.Style = CAPTION|VISIBLE|ROUNDED;
    widgetButton.Type = LABEL;
    widgetButton.X = 0;
    widgetButton.Y = 46;
    widgetButton.Width = 127;
    widgetButton.Height = 36;
    copyString( "Waiting...", globalHumidity );
    widgetButton.String = globalHumidity;
    formAddWidget( &widgetButton );
    //formSetFocus( formGetWidgetCount() - 1 );
    
    widgetButton.Style = CAPTION|FILLED|VISIBLE|ROUNDED|BORDER|CENTERED;
    widgetButton.Type = BUTTON;
    widgetButton.Y = 86;
    widgetButton.String = "Back";
    formAddWidget( &widgetButton );
    formSetFocus( formGetWidgetCount() - 1 );
    
    widgetAddEventHandler( widgetGetCurrent(), eventRFBack, SELECTED );
    
    
    drawForms();
    //taskNewSimple( "humidity", 1000, (void*)threadRFHumidity );
}
Exemplo n.º 3
0
/* Add a slider to a form */
bool widgAddSlider(W_SCREEN *psScreen, const W_SLDINIT* psInit)
{
	W_SLIDER	*psSlider;
	W_FORM		*psForm;

	ASSERT( psScreen != NULL,
		"widgAddEditBox: Invalid screen pointer" );

	if (widgCheckIDForm((W_FORM *)psScreen->psForm, psInit->id))
	{
		ASSERT(false, "widgSlider: ID number has already been used (%d)", psInit->id);
		return false;
	}

	/* Find the form to put the slider on */
	if (psInit->formID == 0)
	{
		psForm = (W_FORM *)psScreen->psForm;
	}
	else
	{
		psForm = (W_FORM *)widgGetFromID(psScreen, psInit->formID);
		if (!psForm
		 || psForm->type != WIDG_FORM)
		{
			ASSERT(false, "widgAddSlider: Could not find parent form from formID");
			return false;
		}
	}

	/* Create the slider structure */
	psSlider = sliderCreate(psInit);
	if (psSlider == NULL
	/* Add it to the form */
	 || !formAddWidget(psForm, (WIDGET *)psSlider, (W_INIT *)psInit))
	{
		return false;
	}

	return true;
}
Exemplo n.º 4
0
/* Add a button to the widget screen */
bool widgAddButton(W_SCREEN *psScreen, const W_BUTINIT* psInit)
{
	W_BUTTON	*psButton;
	W_FORM		*psForm;

	ASSERT( psScreen != NULL,
		"widgAddButton: Invalid screen pointer" );

	if (widgCheckIDForm((W_FORM *)psScreen->psForm,psInit->id))
	{
		ASSERT( false, "widgAddButton: ID number has already been used(%d)", psInit->id );
		return false;
	}

	/* Find the form to put the button on */
	if (psInit->formID == 0)
	{
		psForm = (W_FORM *)psScreen->psForm;
	}
	else
	{
		psForm = (W_FORM *)widgGetFromID(psScreen, psInit->formID);
		if (psForm == NULL || psForm->type != WIDG_FORM)
		{
			ASSERT( false,
				"widgAddButton: Could not find parent form from formID" );
			return false;
		}
	}

	/* Create the button structure */
	psButton = buttonCreate(psInit);
	if (psButton == NULL
	/* Add it to the form */
	 || !formAddWidget(psForm, (WIDGET *)psButton, (W_INIT *)psInit))
	{
		return false;
	}

	return true;
}
Exemplo n.º 5
0
/* Add a form to the widget screen */
bool widgAddForm(W_SCREEN *psScreen, const W_FORMINIT* psInit)
{
	W_FORM	*psParent, *psForm;

	ASSERT( psScreen != NULL,
		"widgAddForm: Invalid screen pointer" );

	if (widgCheckIDForm((W_FORM *)psScreen->psForm,psInit->id))
	{
		ASSERT( false, "widgAddForm: ID number has already been used (%d)", psInit->id );
		return false;
	}

	/* Find the form to add the widget to */
	if (psInit->formID == 0)
	{
		/* Add to the base form */
		psParent = (W_FORM *)psScreen->psForm;
	}
	else
	{
		psParent = (W_FORM *)widgGetFromID(psScreen, psInit->formID);
		if (!psParent || psParent->type != WIDG_FORM)
		{
			ASSERT( false,
				"widgAddForm: Could not find parent form from formID" );
			return false;
		}
	}

	/* Create the form structure */
	psForm = formCreate(psInit);
	if (psForm == NULL
	/* Add it to the screen */
	 || !formAddWidget(psParent, (WIDGET *)psForm, (W_INIT *)psInit))
	{
		return false;
	}

	return true;
}
Exemplo n.º 6
0
/* Add a bar graph to the widget screen */
BOOL widgAddBarGraph(W_SCREEN *psScreen, const W_BARINIT* psInit)
{
	W_BARGRAPH	*psBarGraph;
	W_FORM		*psForm;

	ASSERT( psScreen != NULL,
		"widgAddEditBox: Invalid screen pointer" );

	if (widgCheckIDForm((W_FORM *)psScreen->psForm,psInit->id))
	{
		ASSERT( false, "widgAddBarGraph: ID number has already been used (%d)", psInit->id );
		return false;
	}

	/* Find the form to put the bar graph on */
	if (psInit->formID == 0)
	{
		psForm = (W_FORM *)psScreen->psForm;
	}
	else
	{
		psForm = (W_FORM *)widgGetFromID(psScreen, psInit->formID);
		if (!psForm || psForm->type != WIDG_FORM)
		{
			ASSERT( false,
				"widgAddBarGraph: Could not find parent form from formID" );
			return false;
		}
	}

	/* Create the bar graph structure */
	psBarGraph = barGraphCreate(psInit);
	if (psBarGraph == NULL
	/* Add it to the form */
	 || !formAddWidget(psForm, (WIDGET *)psBarGraph, (W_INIT *)psInit))
	{
		return false;
	}

	return true;
}