Esempio n. 1
0
/* ******************************************************************** *
 * private: go in a menu item and start function
 * @param
 * @return
 * ******************************************************************** */
void	LCDMenuLib::goEnter()
/* ******************************************************************** */
{
	LCDMenu *tmp;	// declare opjects
	uint8_t name		= function;
	uint8_t j			= 0;
	
	if (function == _LCDML_NO_FUNC) { //check button lock		
		//check if element has childs
		if ((tmp = curMenu->getChild(curloc + curloc_correction())) != NULL) { // check child			
			goMenu(*tmp);					
			name = tmp->name;		

			//check if element has childs			
			if ((tmp = tmp->getChild(0)) != NULL) {			
				
				while ((tmp = tmp->getSibling(1)) != NULL)
				{
					if (bitRead(group_en, tmp->disp) || bitRead(control, _LCDML_control_disable_hidden)) {
						j++;
					}					
				}
			}

			if (j == 0) {				
				function = name;
				countChilds();
			}			
		}		
	}
}
Esempio n. 2
0
/* ******************************************************************** *
 * private
 * @param
 *		menu instance (pointer)
 *		menu element (pointer)
 * @return
 *		search status (uint8)
 * ******************************************************************** */
uint8_t		LCDMenuLib::selectElementDirect(LCDMenu &p_m, uint8_t p_search)
/* ******************************************************************** */
{
	//deklaration
	LCDMenu * search = &p_m;
	LCDMenu * tmp;	
	uint8_t found	 = 0;

	bitSet(control, _LCDML_control_search_display);
			
	do 
	{
		tmp = search->getChild(0);
			
		if (tmp) {//check elements for childs					
			goEnter();					
			
			if (tmp->name == p_search) { //search elements in this layer			
				found = 1;				
				break;
			}
			else {
				function = _LCDML_NO_FUNC;
			}

			found = selectElementDirect(*tmp, p_search); //recursive search until found is true or last item reached
						
			if (found == 1) {  //check result
				//something found
				break; 
			} 
			else {
				function = _LCDML_NO_FUNC;				
				//nothing found
				//goto next root element
				goBack();
				Button_udlr(_LCDML_button_down);				
			}				
		} 
		else {			
			//no childs found				
			if (search->name == p_search) {  //search
			
				//found something
				found = 1;				
				break;
			} 
			else {
				function = _LCDML_NO_FUNC;
				//select next element			
				Button_udlr(_LCDML_button_down);				
			}
		}		
	} while ((search=search->getSibling(1)) != NULL && found == 0);

	if (found == 1) {
		bitClear(control, _LCDML_control_search_display);
	}
	//return result
	return found;	
}