Exemplo n.º 1
0
//************************************************************************
// CLCDInput::DeactivateInput
//************************************************************************
void CLCDInput::DeactivateInput()
{
	if(!m_pInput)
		return;
	UnhookWindowsHookEx(m_hKBHook);
	m_hKBHook = NULL;

	m_pInput = NULL;
	
	CLCDConnection *pLCDCon =  CLCDOutputManager::GetInstance()->GetLCDConnection();
	pLCDCon->SetAsForeground(0);
}
Exemplo n.º 2
0
//************************************************************************
// CLCDInput::ActivateInput
//************************************************************************
void CLCDInput::ActivateInput()
{
	if(m_pInput)
		return;

	CLCDConnection *pLCDCon =  CLCDOutputManager::GetInstance()->GetLCDConnection();
	pLCDCon->SetAsForeground(1);

	m_hKBHook = SetWindowsHookEx(WH_KEYBOARD_LL, CLCDInput::KeyboardHook, GetModuleHandle(NULL), 0);
	if(!m_hKBHook)
		return;
	m_pInput = this;
	GetKeyboardState(m_acKeyboardState);
}
Exemplo n.º 3
0
void CConfig::FillDeviceBox(HWND hBox) {
	CLCDConnection *connection = CAppletManager::GetInstance()->GetLCDConnection();
	CLCDDevice *device = NULL;
	int i = 0;
	SendMessage(hBox,CB_RESETCONTENT,0,0);

	while((device = connection->GetAttachedDevice(i++)) != NULL) {
		SendMessage(hBox,CB_ADDSTRING,0,(LPARAM)device->GetDisplayName().c_str());
	}
	
	if(i == 1) {
		SendMessage(hBox,CB_ADDSTRING,0,(LPARAM)_T("No device attached"));
	}

	int iDevice = CConfig::GetIntSetting(DEVICE);
	if( iDevice >= i)
		iDevice = 0;

	SendMessage(hBox,CB_SETCURSEL ,iDevice,0);
}
Exemplo n.º 4
0
//************************************************************************
// Called when an LCD-button is pressed
//************************************************************************
void CNotificationScreen::OnLCDButtonDown(int iButton)
{
	CScreen::OnLCDButtonDown(iButton);	

	if(m_MessageText.IsVisible() &&
		( iButton <= 1 || iButton >=4))
	{
		if(iButton== 1 || iButton == 5)
			m_MessageText.ScrollDown();
		else
			m_MessageText.ScrollUp();

		SetExpiration(CConfig::GetIntSetting(NOTIFY_DURATION)*1000);
	}
	else if(iButton == 2 && m_LNotifications.size() >= 1)
	{
		CNotificationEntry *pEntry = *(m_LNotifications.begin());
		m_LNotifications.pop_front();
		
		if(m_LNotifications.size() >= 1)
			SetButtonBitmap(2,IDB_NEXT);
		else
			SetButtonBitmap(2,NULL);

		DisplayNotification(pEntry);
		SetExpiration(CConfig::GetIntSetting(NOTIFY_DURATION)*1000);
	}
	else if(iButton == 3 && m_pEntry && m_pEntry->pContact)
	{
		SetExpiration(0);

		CLCDConnection *pLCDCon =  CAppletManager::GetInstance()->GetLCDConnection();
		pLCDCon->SetAsForeground(1);
		pLCDCon->SetAsForeground(0);
		CAppletManager::GetInstance()->ActivateChatScreen(m_pEntry->pContact,m_pEntry->iConnectionID);
	}
	else
		SetExpiration(0);
}
Exemplo n.º 5
0
void CConfig::FillDeviceBox(HWND hBox) {
	CLCDConnection *connection = CAppletManager::GetInstance()->GetLCDConnection();
	SendMessage(hBox,CB_RESETCONTENT,0,0);

	int count = 0;
	for (int i = 0; i < 10; i++) {
		CLCDDevice *device = connection->GetAttachedDevice(i);
		if (device != NULL) {
			SendMessage(hBox,CB_ADDSTRING,0,(LPARAM)device->GetDisplayName().c_str());
			count++;
		}
	}

	if (!count) {
		SendMessage(hBox,CB_ADDSTRING,0,(LPARAM)TranslateT("No device attached"));
	}

	int iDevice = CConfig::GetIntSetting(DEVICE);
	if (iDevice >= count)
		iDevice = 0;

	SendMessage(hBox, CB_SETCURSEL, iDevice, 0);
}
Exemplo n.º 6
0
//************************************************************************
// Called when an LCD-button is pressed
//************************************************************************
void CNotificationScreen::OnLCDButtonDown(int iButton)
{
	CScreen::OnLCDButtonDown(iButton);	

	if((iButton == LGLCDBUTTON_BUTTON2 || iButton == LGLCDBUTTON_RIGHT) && m_LNotifications.size() >= 1)
	{
		CNotificationEntry *pEntry = *(m_LNotifications.begin());
		m_LNotifications.pop_front();
		
		if(m_LNotifications.size() >= 1)
			SetButtonBitmap(2,IDB_NEXT);
		else
			SetButtonBitmap(2,NULL);

		DisplayNotification(pEntry);
		SetExpiration(CConfig::GetIntSetting(NOTIFY_DURATION)*1000);
	}
	else if((iButton == LGLCDBUTTON_BUTTON3 || iButton == LGLCDBUTTON_OK) && m_pEntry && m_pEntry->hContact)
	{
		SetExpiration(0);

		CLCDConnection *pLCDCon =  CAppletManager::GetInstance()->GetLCDConnection();
		pLCDCon->SetAsForeground(1);
		pLCDCon->SetAsForeground(0);
		CAppletManager::GetInstance()->ActivateChatScreen(m_pEntry->hContact);
	} else if(!m_MessageText.IsVisible()) {
		SetExpiration(0);
	} else {
		if(iButton == LGLCDBUTTON_BUTTON1 || iButton == LGLCDBUTTON_DOWN) {
			m_MessageText.ScrollDown();
		} else if(iButton == LGLCDBUTTON_BUTTON0 || iButton == LGLCDBUTTON_UP) {
			m_MessageText.ScrollUp();
		}
		SetExpiration(CConfig::GetIntSetting(NOTIFY_DURATION)*1000);
	}	
}
Exemplo n.º 7
0
int APIENTRY _tWinMain(HINSTANCE hInstance,
                     HINSTANCE hPrevInstance,
                     LPTSTR    lpCmdLine,
                     int       nCmdShow)
{
	UNREFERENCED_PARAMETER(hPrevInstance);
	UNREFERENCED_PARAMETER(lpCmdLine);

 	// TODO: Place code here.
	MSG msg;
	HACCEL hAccelTable;

	// Initialize global strings
	LoadString(hInstance, IDS_APP_TITLE, szTitle, MAX_LOADSTRING);
	LoadString(hInstance, IDC_LCDUISAMPLE, szWindowClass, MAX_LOADSTRING);
	MyRegisterClass(hInstance);

	// Perform application initialization:
	if (!InitInstance (hInstance, nCmdShow))
	{
		return FALSE;
	}

	hAccelTable = LoadAccelerators(hInstance, MAKEINTRESOURCE(IDC_LCDUISAMPLE));

    /*
    Here we initialize our connection
    */

    //Create a connection context and connect to LCDMon
    lgLcdConnectContextEx ConnectCtx;
    ConnectCtx.appFriendlyName = g_AppletTitle;

    //This part tells LCDMon what you want to display on.
    //Use LGLCD_APPLET_CAP_BW for monochrome, and
    //LGLCD_APPLET_CAP_QVGA for color.  Or them together
    //to be dual mode.  See the lgcd.h documentation
    //for more details on dual mode applets.
    ConnectCtx.dwAppletCapabilitiesSupported = LGLCD_APPLET_CAP_BW | LGLCD_APPLET_CAP_QVGA;

    //We don't want to autostart a sample
    ConnectCtx.isAutostartable = FALSE;

    //Persistence has been deprecated, so we will skip that field
    //ConnectCtx.isPersistent = doesn't matter

    //This example does not cover the configure callback, but it
    //is very similar to setting up notifications.
    ConnectCtx.onConfigure.configCallback = NULL;
    ConnectCtx.onConfigure.configContext = NULL;

    //In this sample, we are using the default notification
    ConnectCtx.onNotify.notificationCallback = NULL;
    ConnectCtx.onNotify.notifyContext = NULL;

    //Let's use our softbutton callback
    g_SBContext.softbuttonsChangedCallback = OnButtonCB;
    g_SBContext.softbuttonsChangedContext = g_hwnd;

    //Initialize your connection
    //We are using our own softbutton callback
    if( FALSE == g_Connection.Initialize(ConnectCtx, &g_SBContext) )
    {
        return -1;
    }

    

    //Add your monochrome page
    CLCDOutput* pMonoOutput = g_Connection.MonoOutput();
    CLCDPage m_MonoPage;

    pMonoOutput->ShowPage(&m_MonoPage);

    //For monochrome, let's just display some text
    g_MonoText.SetText( _T("Hello monochrome display.\n") );
    g_MonoText.SetOrigin(0,0);
    g_MonoText.SetSize(160, 16);
    g_MonoText.SetFontPointSize(8);
    m_MonoPage.AddObject(&g_MonoText);
      
    
    //Add your color page
    CLCDOutput* pColorOutput = g_Connection.ColorOutput();
    CLCDPage m_ColorPage;

    pColorOutput->ShowPage(&m_ColorPage);

    //Add our new OpenGL object
    //We're going to take up the entire screen with it
    g_OGLObj.Initialize(320,240);
    m_ColorPage.AddObject(&g_OGLObj);


    //Let's setup some OpenGL stuff in this function
    g_OGLObj.MakeCurrent();
    SetupRendering();

	// Main message loop:
	BOOL Done = FALSE;
    DWORD timestamp;



    while(!Done)									
	{
		if( PeekMessage(&msg,NULL,0,0,PM_REMOVE) )	
		{
			if (msg.message==WM_QUIT)				
			{
				Done = TRUE;							
			}
			else									
			{
				TranslateMessage(&msg);				
				DispatchMessage(&msg);				
			}
		}
        else
        {
            timestamp = GetTickCount();
            g_OGLObj.BeginDraw();
            //Do OpenGL rendering here
            //One perk of OpenGL is that we do not have to put this rendering code
            //inside of COGLObject's OnDraw class.
            DoRendering(timestamp);
            g_OGLObj.EndDraw();

            //The update will do the rendering of any LCDUI objects we added to pages
            g_Connection.Update();

            //This loop goes very fast, so let's throttle it a bit
            Sleep(33);
        }
    }

    //Shutdown the connection
    //(also called in the destructor)
    g_Connection.Shutdown();

	return (int) msg.wParam;
}