mirror of
https://github.com/dborth/snes9xgx.git
synced 2024-11-01 00:15:14 +01:00
file browser arrow buttons now steal focus
This commit is contained in:
parent
5df651b562
commit
ee619670e9
@ -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
|
||||
|
@ -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()
|
||||
|
@ -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)
|
||||
|
Loading…
Reference in New Issue
Block a user