mirror of
https://github.com/dborth/vbagx.git
synced 2024-12-27 03:01:50 +01:00
file browser arrow buttons now steal focus
This commit is contained in:
parent
884ccc90a6
commit
5ccb18fce9
@ -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()
|
||||
|
@ -30,10 +30,7 @@ GuiFileBrowser::GuiFileBrowser(int w, int h)
|
||||
trigA->SetSimpleTrigger(-1, WPAD_BUTTON_A | WPAD_CLASSIC_BUTTON_A, PAD_BUTTON_A);
|
||||
|
||||
trigHeldA = new GuiTrigger;
|
||||
if(GCSettings.WiimoteOrientation)
|
||||
trigHeldA->SetHeldTrigger(-1, WPAD_BUTTON_2 | WPAD_CLASSIC_BUTTON_A, PAD_BUTTON_A);
|
||||
else
|
||||
trigHeldA->SetHeldTrigger(-1, WPAD_BUTTON_A | WPAD_CLASSIC_BUTTON_A, PAD_BUTTON_A);
|
||||
trigHeldA->SetHeldTrigger(-1, WPAD_BUTTON_A | WPAD_CLASSIC_BUTTON_A, PAD_BUTTON_A);
|
||||
|
||||
btnSoundOver = new GuiSound(button_over_pcm, button_over_pcm_size, SOUND_PCM);
|
||||
btnSoundClick = new GuiSound(button_click_pcm, button_click_pcm_size, SOUND_PCM);
|
||||
@ -254,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)
|
||||
{
|
||||
@ -261,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