예제 #1
0
int LCUI_InitWinApp( LCUI_AppDriver app )
{
	WNDCLASS wndclass;
	TCHAR szAppName[] = TEXT ("LCUI");

	wndclass.cbClsExtra    = 0;
	wndclass.cbWndExtra    = 0;
	wndclass.hbrBackground = NULL;
	wndclass.lpszMenuName  = NULL;
	wndclass.lpfnWndProc   = WndProc;
	wndclass.lpszClassName = szAppName;
	wndclass.hInstance     = win.main_instance;
	wndclass.style         = CS_HREDRAW | CS_VREDRAW;
	wndclass.hCursor       = LoadCursor( NULL, IDC_ARROW );
	wndclass.hIcon         = LoadIcon( win.dll_instance, MAKEINTRESOURCE(IDI_LCUI_ICON) );

	if( !RegisterClass(&wndclass) ) {
		wchar_t str[256];
		wsprintf(str, L"LCUI_InitApp(): error code: %d\n", GetLastError());
		MessageBox( NULL, str, szAppName, MB_ICONERROR );
		return -1;
	}
	app->GetData = WIN_GetData;
	app->PostTask = WIN_PostTask;
	app->WaitEvent = WIN_WaitEvent;
	app->DispatchEvent = WIN_DispatchEvent;
	app->BindSysEvent = WIN_BindSysEvent;
	app->UnbindSysEvent = WIN_UnbindSysEvent;
	app->UnbindSysEvent2 = WIN_UnbindSysEvent2;
	win.trigger = EventTrigger();
	return 0;
}
예제 #2
0
파일: widget_base.c 프로젝트: lc-soft/LCUI
/** 构造函数 */
static void Widget_Init(LCUI_Widget widget)
{
	ZEROSET(widget, LCUI_Widget);
	widget->state = LCUI_WSTATE_CREATED;
	widget->trigger = EventTrigger();
	widget->style = StyleSheet();
	widget->custom_style = StyleSheet();
	widget->inherited_style = StyleSheet();
	widget->computed_style.opacity = 1.0;
	widget->computed_style.visible = TRUE;
	widget->computed_style.focusable = FALSE;
	widget->computed_style.display = SV_BLOCK;
	widget->computed_style.position = SV_STATIC;
	widget->computed_style.pointer_events = SV_AUTO;
	widget->computed_style.box_sizing = SV_CONTENT_BOX;
	widget->computed_style.margin.top.type = LCUI_STYPE_PX;
	widget->computed_style.margin.right.type = LCUI_STYPE_PX;
	widget->computed_style.margin.bottom.type = LCUI_STYPE_PX;
	widget->computed_style.margin.left.type = LCUI_STYPE_PX;
	widget->computed_style.padding.top.type = LCUI_STYPE_PX;
	widget->computed_style.padding.right.type = LCUI_STYPE_PX;
	widget->computed_style.padding.bottom.type = LCUI_STYPE_PX;
	widget->computed_style.padding.left.type = LCUI_STYPE_PX;
	Widget_InitBackground(widget);
	LinkedList_Init(&widget->children);
	LinkedList_Init(&widget->children_show);
}
예제 #3
0
 std::vector<EventTrigger> EventTriggerFactory::GetAllEventTriggers()
 {
     std::vector<EventTrigger> trigger_list;
     for( auto trigger : m_VectorAll )
     {
         trigger_list.push_back( EventTrigger( trigger ) );
     }
     return trigger_list;
 }
예제 #4
0
int LCUI_InitLinuxX11App( LCUI_AppDriver app )
{
	x11.display = XOpenDisplay(NULL);
	if( !x11.display ) {
		return -1;
	}
	x11.screen = DefaultScreen( x11.display );
	x11.rootwin = RootWindow( x11.display, x11.screen );
	x11.cmap = DefaultColormap( x11.display, x11.screen );
	app->WaitEvent = X11_WaitEvent;
	app->PumbEvents = X11_PumpEvents;
	app->PostTask = X11_PostTask;
	app->BindSysEvent = X11_BindSysEvent;
	app->UnbindSysEvent = X11_UnbindSysEvent;
	app->UnbindSysEvent2 = X11_UnbindSysEvent2;
	app->GetData = X11_GetData;
	x11.trigger = EventTrigger();
	return 0;
}
예제 #5
0
	virtual void messageReceived(NetworkAddress *addr, char *buf, int size)
	{
		
		Thread *thread;
		EventMessage evMsg(buf, size, msgManager);
		switch(evMsg.mode)
		{
			case IS_ASYNCH_EVENT:
				printf("Received IS_ASYNCH_EVENT %s\n", evMsg.name);
				extEventManager->addInternalPending(evMsg.name, evMsg.buf, evMsg.bufSize);
				EventTrigger(evMsg.name, evMsg.buf, evMsg.bufSize);
				break;
			case IS_SYNCH_EVENT:
				printf("Received IS_SYNCH_EVENT %s\n", evMsg.name);
				extEventManager->addInternalPending(evMsg.name, evMsg.buf, evMsg.bufSize);
				thread = new Thread();
				thread->start((Runnable *)new TrigWaitRunnable(evMsg.name, evMsg.buf, evMsg.bufSize, evMsg.waitId, false, msgManager, addr), thread);
				break;
			case IS_SYNCH_COLLECT_EVENT:
				printf("Received IS_SYNCH_COLLECT_EVENT %s\n", evMsg.name);
				extEventManager->addInternalPending(evMsg.name, evMsg.buf, evMsg.bufSize);
				thread = new Thread();
				thread->start((Runnable *)new TrigWaitRunnable(evMsg.name, evMsg.buf, evMsg.bufSize, evMsg.waitId, true, msgManager, addr), thread);
				break;
			case IS_EVENT_ACK:
				printf("Received IS_EVENT_ACK %s\n", evMsg.name);
				extEventManager->signalExternalTermination(evMsg.name, evMsg.waitId, 0, 0);
				break;
			case IS_EVENT_COLLECT_ACK:
				printf("Received IS_EVENT_COLLECT_ACK %s\n", evMsg.name);
				extEventManager->signalExternalTermination(evMsg.name, evMsg.waitId, evMsg.bufSize, evMsg.buf);
				break;
			case IS_EVENT_REGISTRATION:
				printf("Received IS_EVENT_REGISTRATION %s\n", evMsg.name);
				extEventManager->addExternalListener(evMsg.name, evMsg.retSize, addr);
				break;
		}
	}
예제 #6
0
// As called from above
void SamplerTasks(void)
{
	if ((status.streaming) && (settings.sampleRate != 0))
	{
		static char* start = NULL;
		unsigned char conType;
		#ifdef SAMPLE_LED
			SAMPLE_LED=LED_TURN_ON;
		#endif

		// Grab a sample with cached sample time
		currentSample.sampleCount = sampleCount;
		currentSample.sampleTicks = sampleTicks;

		// Read sensor values
		MultiSingleSample(&currentSample.sensor);

		// For BR connections -> put over serial link
		conType = HciConType(bluetoothConnection);
		if(conType == HCI_CONN_TYPE_BR)
		{
			// Convert to an outgoing data packet 
			unsigned short num = MakeDataPacket(&currentSample, settings.dataMode, (void*)&start);
			
			// Ensure it was successful
			if ((num == 0) || (start == NULL)) return;
		
			// Try to copy to out buffer - if not enough room then skip this sample	
			if (FifoFree(&streamerFifo)>=num)
			{	
				FifoPush(&streamerFifo, start, num);
				status.newXdata = 0; // Indicate new extended data was sent
			}
		}
		#ifndef DISABLE_LE_MODES
		// For BLE connections -> indicate if turned on, overides notify
		else if ((conType == HCI_CONN_TYPE_LE) && (dataOutHandle.dataFlag != 1) && (dataOutHandle.attCfg & ATT_CFG_INDICATE))
		{
			// Convert to an outgoing data packet 
			unsigned short num = MakeDataPacket(&currentSample, 2, (void*)&start); // 20 byte binary packet

			// Ensure it was successful
			if ((num == 0) || (start == NULL)) return;

			dataOutHandle.dataFlag = 1;
			dataOutHandle.attLen = num;
			dataOutHandle.attData = (unsigned char*)start;
			EventTrigger();
		}
		// For BLE connections -> notify if space and not already indicating
		else if ((conType == HCI_CONN_TYPE_LE) && (dataOutHandle.dataFlag != 1) && (dataOutHandle.attCfg & ATT_CFG_NOTIFY))
		{
			// Convert to an outgoing data packet 
			unsigned short num = MakeDataPacket(&currentSample, 2, (void*)&start); // 20 byte binary packet

			// Ensure it was successful
			if ((num == 0) || (start == NULL)) return;

			dataOutHandle.dataFlag = 1;
			dataOutHandle.attLen = num;
			dataOutHandle.attData = (unsigned char*)start;
			EventTrigger();
		}
		#endif//ENABLE_LE_MODE
		// On returning, if there is another sample triggered - this will be called again 	
	}
}
예제 #7
0
EXPORT int MdsEventTrigger(char const * name, char *buf, int size)
{
	return (EventTrigger(name, buf, size)==0)?1:0;
}