BOOL CPropTreeItemColor::OnSetCursor(CWnd* pWnd, UINT nHitTest, UINT message)
{
	if (nHitTest==HTCLIENT)
	{
		CPoint point;

		GetCursorPos(&point);
		ScreenToClient(&point);

		if (FindSpot(point)!=-1 || m_rcButton.PtInRect(point))
		{
			SetCursor(LoadCursor(ghInst, MAKEINTRESOURCE(IDC_FPOINT)));
			return TRUE;
		}

	}

	return CWnd::OnSetCursor(pWnd, nHitTest, message);
}
BOOL CEGPropertyGridItemColor::OnSetCursor(CWnd* pWnd, UINT nHitTest, UINT message) 
{
	if (nHitTest==HTCLIENT)
	{
		CPoint point;

		GetCursorPos(&point);
		ScreenToClient(&point);

		if (FindSpot(point)!=-1 || m_rcButton.PtInRect(point))
		{
			SetCursor( ::LoadCursor( NULL, MAKEINTRESOURCE(IDC_HAND) ) );
			return TRUE;
		}

	}

	return CWnd::OnSetCursor(pWnd, nHitTest, message);
}
void CPropTreeItemColor::OnMouseMove(UINT, CPoint point)
{
	BOOL bButton;
	LONG nSpot;

	nSpot = FindSpot(point);
	if (nSpot!=m_nSpot)
	{
		Invalidate(FALSE);
		m_nSpot = nSpot;
	}

	bButton = m_rcButton.PtInRect(point);

	if (bButton!=m_bButton)
	{
		m_bButton = bButton;
		Invalidate(FALSE);
	}
}
Example #4
0
int AppBrowser (void)
	{
	Debug ("AppBrowser");

	u32 btn;
	
	redraw = 1;
	appsSelected = -1;	// Current selected app with wimote
	spotSelected = -1;
	spotSelectedLast = -1;
	
	browserRet = -1;
	
	grlibSettings.color_window = RGBA(192,192,192,255);
	grlibSettings.color_windowBg = RGBA(32,32,32,128);
	
	grlib_SetRedrawCallback (Redraw, Overlay);
	
	apps = (s_app*) vars.bigblock; //malloc (usedBytes);
	memset (apps, 0, APPSMAX * sizeof(s_app));
	
	config.run.enabled = 0;
	
	// Immediately draw the screen...
	AppsFree ();
	
	InitializeGui ();
	
	/*
	Redraw ();
	grlib_PushScreen ();
	grlib_PopScreen ();
	grlib_Render();  // Render the frame buffer to the TV
	*/
	
	AppsBrowse (0);
	
	if (config.appPage >= 0 && config.appPage <= pageMax)
		page = config.appPage;
	else
		page = 0;

   FeedCoverCache ();
   LiveCheck (1);
   
   // Loop forever
    while (browserRet == -1)
		{
		if (LiveCheck (0)) redraw = 1;
		
		btn = grlib_GetUserInput();
		
		// If [HOME] was pressed on the first Wiimote, break out of the loop
		if (btn)
			{
			browserRet = ChooseDPadReturnMode (btn);
			if (browserRet != -1) break;
			
			if (btn & WPAD_BUTTON_1) 
				{
				spotSelected = -1;
				page = GoToPage (page, pageMax);
				FeedCoverCache ();
				redraw = 1;
				}
			if (btn & WPAD_BUTTON_2) 
				{
				ShowFilterMenu();
				redraw = 1;
				}
			if (btn & WPAD_BUTTON_A && appsSelected != -1 && sortMode == 0) 
				{
				if (apps[appsSelected].type == AT_HBA)
					{
					if (!QuerySelection (appsSelected))
						{
						redraw = 1;
						continue;
						}
					AppsSetRun (appsSelected);
					browserRet = INTERACTIVE_RET_HBSEL;
					break;
					}
				else if (apps[appsSelected].type == AT_FOLDER) // This is a folder ! Jump inside
					{	
					sprintf (config.subpath, "%s/", apps[appsSelected].path);
					sprintf (config.submount, "%s", apps[appsSelected].mount);
					
					AppsBrowse (0);
					redraw = 1;
					}
				else if (apps[appsSelected].type == AT_FOLDERUP) // This is a folder ! Jump inside
					{	
					int i = strlen(config.subpath);
					
					if (i > 0) i--;
					if (i > 0) i--;
					
					while (i >= 0 && config.subpath[i] != '/')
						config.subpath[i--] = 0;
					
					gui.spotsIdx = 0;
					AppsBrowse (0);
					redraw = 1;
					}
				}

			/////////////////////////////////////////////////////////////////////////////////////////////
			// We are in sort mode, check item
			if (btn & WPAD_BUTTON_A && appsSelected != -1 && sortMode > 0) 
				{
				if (!apps[appsSelected].checked)
					{
					apps[appsSelected].priority = sortMode--;
					apps[appsSelected].checked = TRUE;
					redraw = 1;
					//Debug ("selected %s (%d)\n", apps[appsSelected].name, apps[appsSelected].priority);
					}
				else
					{
					}
				}

			/////////////////////////////////////////////////////////////////////////////////////////////
			// Select application as default
			if (btn & WPAD_BUTTON_B && appsSelected != -1 && sortMode == 0)
				{
				ShowAppMenu (appsSelected);
				redraw = 1;
				}

			/////////////////////////////////////////////////////////////////////////////////////////////
			// If user press (B) stop sort mode
			if (btn & WPAD_BUTTON_B && sortMode > 0)
				{
				SortItems();
				
				int i;
				for (i = 0; i < appsCnt; i++)
					{
					apps[i].priority = appsCnt - i;
					apps[i].checked = FALSE;
					}
				sortMode = 0;
				needToSave = 1;
				redraw = 1;
				}

			if (btn & WPAD_BUTTON_HOME && sortMode > 0)
				{
				grlib_menu (0, "You are in sort mode.\n", "Close");
				redraw = 1;
				}

			if (btn & WPAD_BUTTON_HOME && sortMode == 0)
				{
				ShowMainMenu ();
				redraw = 1;
				}
			
			if (btn & WPAD_BUTTON_MINUS)
				{
				page = ChangePage (0);
				}
			if (btn & WPAD_BUTTON_PLUS) 
				{
				page = ChangePage (1);
				}
			}

		if (CoverCache_IsUpdated ()) 
			{
			redraw = 1;
			}
		
		FindSpot ();

		if (redraw)
			{
			Redraw ();
			grlib_PushScreen ();
			redraw = 0;
			}

		REDRAW();
		
		if (grlibSettings.wiiswitch_poweroff)
			{
			browserRet = INTERACTIVE_RET_SHUTDOWN;
			}

		if (grlibSettings.wiiswitch_reset)
			{
			browserRet = INTERACTIVE_RET_WIIMENU;
			}
			
		if (wiiload.status == WIILOAD_HBZREADY)
			{
			WiiloadZipMenu ();
			AppsBrowse (0);
			redraw = 1;
			}
			
		if (wiiload.status == WIILOAD_HBREADY)
			{
			if (WiiloadCheck())
				browserRet = INTERACTIVE_RET_WIILOAD;
			else
				redraw = 1;
			}
		
		if (vars.themeReloaded) // Restart the browser
			{
			vars.themeReloaded = 0;
			browserRet = INTERACTIVE_RET_TOHOMEBREW;
			}
		}
	
	// Lets close the topbar, if needed
	CLOSETOPBAR();
	CLOSEBOTTOMBAR();
	
	// save current page
	config.appPage = page;

	SaveSettings ();
	
	// Clean up all data
	AppsFree ();
	gui_Clean ();
	//free (apps);
	
	grlib_SetRedrawCallback (NULL, NULL);

	return browserRet;
	}