file browser arrow buttons now steal focus

This commit is contained in:
dborth 2009-04-15 06:31:58 +00:00
parent 5df651b562
commit ee619670e9
3 changed files with 21 additions and 9 deletions

View File

@ -224,6 +224,9 @@ class GuiElement
//!Set the element's parent
//!\param e Pointer to parent element
void SetParent(GuiElement * e);
//!Gets the element's parent
//!\return Pointer to parent element
GuiElement * GetParent();
//!Gets the current leftmost coordinate of the element
//!Considers horizontal alignment, x offset, width, and parent element's GetLeft() / GetWidth() values
//!\return left coordinate

View File

@ -64,6 +64,11 @@ void GuiElement::SetParent(GuiElement * e)
{
parentElement = e;
}
GuiElement * GuiElement::GetParent()
{
return parentElement;
}
/**
* Get the left position of the GuiElement.
* @see SetLeft()

View File

@ -251,6 +251,19 @@ void GuiFileBrowser::Update(GuiTrigger * t)
listChanged = true;
}
if(arrowDownBtn->GetState() == STATE_HELD && arrowDownBtn->GetStateChan() == t->chan)
{
t->wpad.btns_h |= WPAD_BUTTON_DOWN;
if(!this->IsFocused())
((GuiWindow *)this->GetParent())->ChangeFocus(this);
}
else if(arrowUpBtn->GetState() == STATE_HELD && arrowUpBtn->GetStateChan() == t->chan)
{
t->wpad.btns_h |= WPAD_BUTTON_UP;
if(!this->IsFocused())
((GuiWindow *)this->GetParent())->ChangeFocus(this);
}
// pad/joystick navigation
if(!focus)
{
@ -258,15 +271,6 @@ void GuiFileBrowser::Update(GuiTrigger * t)
listChanged = false;
}
if(arrowDownBtn->GetState() == STATE_CLICKED && arrowDownBtn->GetStateChan() == t->chan)
t->wpad.btns_d |= WPAD_BUTTON_DOWN;
else if(arrowUpBtn->GetState() == STATE_CLICKED && arrowUpBtn->GetStateChan() == t->chan)
t->wpad.btns_d |= WPAD_BUTTON_UP;
else if(arrowDownBtn->GetState() == STATE_HELD && arrowDownBtn->GetStateChan() == t->chan)
t->wpad.btns_h |= WPAD_BUTTON_DOWN;
else if(arrowUpBtn->GetState() == STATE_HELD && arrowUpBtn->GetStateChan() == t->chan)
t->wpad.btns_h |= WPAD_BUTTON_UP;
if(t->Right())
{
if(browser.pageIndex < browser.numEntries && browser.numEntries > PAGESIZE)