2009-03-11 18:28:37 +01:00
|
|
|
/****************************************************************************
|
2009-04-10 10:12:37 +02:00
|
|
|
* libwiigui
|
2009-03-11 18:28:37 +01:00
|
|
|
*
|
2009-04-10 10:12:37 +02:00
|
|
|
* Tantric 2009
|
2009-03-11 18:28:37 +01:00
|
|
|
*
|
|
|
|
* gui_filebrowser.cpp
|
|
|
|
*
|
|
|
|
* GUI class definitions
|
|
|
|
***************************************************************************/
|
|
|
|
|
|
|
|
#include "gui.h"
|
|
|
|
#include "filebrowser.h"
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Constructor for the GuiFileBrowser class.
|
|
|
|
*/
|
|
|
|
GuiFileBrowser::GuiFileBrowser(int w, int h)
|
|
|
|
{
|
|
|
|
width = w;
|
|
|
|
height = h;
|
|
|
|
selectedItem = 0;
|
|
|
|
selectable = true;
|
|
|
|
listChanged = true; // trigger an initial list update
|
|
|
|
focus = 0; // allow focus
|
|
|
|
|
|
|
|
trigA = new GuiTrigger;
|
|
|
|
if(GCSettings.WiimoteOrientation)
|
|
|
|
trigA->SetSimpleTrigger(-1, WPAD_BUTTON_2 | WPAD_CLASSIC_BUTTON_A, PAD_BUTTON_A);
|
|
|
|
else
|
|
|
|
trigA->SetSimpleTrigger(-1, WPAD_BUTTON_A | WPAD_CLASSIC_BUTTON_A, PAD_BUTTON_A);
|
|
|
|
|
2009-04-10 10:12:37 +02:00
|
|
|
trigHeldA = new GuiTrigger;
|
2009-04-13 21:36:33 +02:00
|
|
|
trigHeldA->SetHeldTrigger(-1, WPAD_BUTTON_A | WPAD_CLASSIC_BUTTON_A, PAD_BUTTON_A);
|
2009-04-10 10:12:37 +02:00
|
|
|
|
2009-04-05 03:51:56 +02:00
|
|
|
btnSoundOver = new GuiSound(button_over_pcm, button_over_pcm_size, SOUND_PCM);
|
|
|
|
btnSoundClick = new GuiSound(button_click_pcm, button_click_pcm_size, SOUND_PCM);
|
|
|
|
|
2009-03-11 18:28:37 +01:00
|
|
|
bgGameSelection = new GuiImageData(bg_game_selection_png);
|
|
|
|
bgGameSelectionImg = new GuiImage(bgGameSelection);
|
|
|
|
bgGameSelectionImg->SetParent(this);
|
|
|
|
bgGameSelectionImg->SetAlignment(ALIGN_LEFT, ALIGN_MIDDLE);
|
|
|
|
|
|
|
|
bgGameSelectionEntry = new GuiImageData(bg_game_selection_entry_png);
|
|
|
|
gameFolder = new GuiImageData(folder_png);
|
|
|
|
|
|
|
|
scrollbar = new GuiImageData(scrollbar_png);
|
|
|
|
scrollbarImg = new GuiImage(scrollbar);
|
|
|
|
scrollbarImg->SetParent(this);
|
|
|
|
scrollbarImg->SetAlignment(ALIGN_RIGHT, ALIGN_TOP);
|
|
|
|
scrollbarImg->SetPosition(0, 30);
|
|
|
|
|
|
|
|
arrowDown = new GuiImageData(scrollbar_arrowdown_png);
|
|
|
|
arrowDownImg = new GuiImage(arrowDown);
|
|
|
|
arrowDownOver = new GuiImageData(scrollbar_arrowdown_over_png);
|
|
|
|
arrowDownOverImg = new GuiImage(arrowDownOver);
|
|
|
|
arrowUp = new GuiImageData(scrollbar_arrowup_png);
|
|
|
|
arrowUpImg = new GuiImage(arrowUp);
|
|
|
|
arrowUpOver = new GuiImageData(scrollbar_arrowup_over_png);
|
|
|
|
arrowUpOverImg = new GuiImage(arrowUpOver);
|
|
|
|
scrollbarBox = new GuiImageData(scrollbar_box_png);
|
|
|
|
scrollbarBoxImg = new GuiImage(scrollbarBox);
|
|
|
|
scrollbarBoxOver = new GuiImageData(scrollbar_box_over_png);
|
|
|
|
scrollbarBoxOverImg = new GuiImage(scrollbarBoxOver);
|
|
|
|
|
|
|
|
arrowUpBtn = new GuiButton(arrowUpImg->GetWidth(), arrowUpImg->GetHeight());
|
|
|
|
arrowUpBtn->SetParent(this);
|
|
|
|
arrowUpBtn->SetImage(arrowUpImg);
|
|
|
|
arrowUpBtn->SetImageOver(arrowUpOverImg);
|
|
|
|
arrowUpBtn->SetAlignment(ALIGN_RIGHT, ALIGN_TOP);
|
|
|
|
arrowUpBtn->SetSelectable(false);
|
2009-04-13 10:43:50 +02:00
|
|
|
arrowUpBtn->SetClickable(false);
|
|
|
|
arrowUpBtn->SetHoldable(true);
|
|
|
|
arrowUpBtn->SetTrigger(trigHeldA);
|
2009-04-05 03:51:56 +02:00
|
|
|
arrowUpBtn->SetSoundOver(btnSoundOver);
|
|
|
|
arrowUpBtn->SetSoundClick(btnSoundClick);
|
2009-03-11 18:28:37 +01:00
|
|
|
|
|
|
|
arrowDownBtn = new GuiButton(arrowDownImg->GetWidth(), arrowDownImg->GetHeight());
|
|
|
|
arrowDownBtn->SetParent(this);
|
|
|
|
arrowDownBtn->SetImage(arrowDownImg);
|
|
|
|
arrowDownBtn->SetImageOver(arrowDownOverImg);
|
|
|
|
arrowDownBtn->SetAlignment(ALIGN_RIGHT, ALIGN_BOTTOM);
|
|
|
|
arrowDownBtn->SetSelectable(false);
|
2009-04-13 10:43:50 +02:00
|
|
|
arrowDownBtn->SetClickable(false);
|
|
|
|
arrowDownBtn->SetHoldable(true);
|
|
|
|
arrowDownBtn->SetTrigger(trigHeldA);
|
2009-04-05 03:51:56 +02:00
|
|
|
arrowDownBtn->SetSoundOver(btnSoundOver);
|
|
|
|
arrowDownBtn->SetSoundClick(btnSoundClick);
|
2009-03-11 18:28:37 +01:00
|
|
|
|
|
|
|
scrollbarBoxBtn = new GuiButton(scrollbarBoxImg->GetWidth(), scrollbarBoxImg->GetHeight());
|
|
|
|
scrollbarBoxBtn->SetParent(this);
|
|
|
|
scrollbarBoxBtn->SetImage(scrollbarBoxImg);
|
|
|
|
scrollbarBoxBtn->SetImageOver(scrollbarBoxOverImg);
|
|
|
|
scrollbarBoxBtn->SetAlignment(ALIGN_RIGHT, ALIGN_TOP);
|
2009-04-10 10:12:37 +02:00
|
|
|
scrollbarBoxBtn->SetMinY(0);
|
2009-06-18 07:47:02 +02:00
|
|
|
scrollbarBoxBtn->SetMaxY(156);
|
2009-03-11 18:28:37 +01:00
|
|
|
scrollbarBoxBtn->SetSelectable(false);
|
2009-04-10 10:12:37 +02:00
|
|
|
scrollbarBoxBtn->SetClickable(false);
|
2009-04-13 10:43:50 +02:00
|
|
|
scrollbarBoxBtn->SetHoldable(true);
|
2009-04-10 10:12:37 +02:00
|
|
|
scrollbarBoxBtn->SetTrigger(trigHeldA);
|
2009-03-11 18:28:37 +01:00
|
|
|
|
2009-06-18 07:47:02 +02:00
|
|
|
for(int i=0; i<FILE_PAGESIZE; i++)
|
2009-03-11 18:28:37 +01:00
|
|
|
{
|
2009-06-18 07:47:02 +02:00
|
|
|
fileListText[i] = new GuiText(NULL, 20, (GXColor){0, 0, 0, 0xff});
|
2009-06-07 20:00:57 +02:00
|
|
|
fileListText[i]->SetAlignment(ALIGN_LEFT, ALIGN_MIDDLE);
|
|
|
|
fileListText[i]->SetPosition(5,0);
|
|
|
|
|
|
|
|
fileListBg[i] = new GuiImage(bgGameSelectionEntry);
|
|
|
|
fileListFolder[i] = new GuiImage(gameFolder);
|
|
|
|
|
2009-06-18 07:47:02 +02:00
|
|
|
fileList[i] = new GuiButton(380, 26);
|
2009-06-07 20:00:57 +02:00
|
|
|
fileList[i]->SetParent(this);
|
|
|
|
fileList[i]->SetLabel(fileListText[i]);
|
|
|
|
fileList[i]->SetImageOver(fileListBg[i]);
|
2009-06-18 07:47:02 +02:00
|
|
|
fileList[i]->SetPosition(2,26*i+3);
|
2009-06-07 20:00:57 +02:00
|
|
|
fileList[i]->SetTrigger(trigA);
|
|
|
|
fileList[i]->SetSoundClick(btnSoundClick);
|
2009-03-11 18:28:37 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Destructor for the GuiFileBrowser class.
|
|
|
|
*/
|
|
|
|
GuiFileBrowser::~GuiFileBrowser()
|
|
|
|
{
|
|
|
|
delete arrowUpBtn;
|
|
|
|
delete arrowDownBtn;
|
|
|
|
delete scrollbarBoxBtn;
|
|
|
|
|
|
|
|
delete bgGameSelectionImg;
|
|
|
|
delete scrollbarImg;
|
|
|
|
delete arrowDownImg;
|
|
|
|
delete arrowDownOverImg;
|
|
|
|
delete arrowUpImg;
|
|
|
|
delete arrowUpOverImg;
|
|
|
|
delete scrollbarBoxImg;
|
|
|
|
delete scrollbarBoxOverImg;
|
|
|
|
|
|
|
|
delete bgGameSelection;
|
|
|
|
delete bgGameSelectionEntry;
|
|
|
|
delete gameFolder;
|
|
|
|
delete scrollbar;
|
|
|
|
delete arrowDown;
|
|
|
|
delete arrowDownOver;
|
|
|
|
delete arrowUp;
|
|
|
|
delete arrowUpOver;
|
|
|
|
delete scrollbarBox;
|
|
|
|
delete scrollbarBoxOver;
|
|
|
|
|
2009-04-05 03:51:56 +02:00
|
|
|
delete btnSoundOver;
|
|
|
|
delete btnSoundClick;
|
2009-04-15 08:33:58 +02:00
|
|
|
delete trigHeldA;
|
2009-04-27 08:58:23 +02:00
|
|
|
delete trigA;
|
2009-03-11 18:28:37 +01:00
|
|
|
|
2009-06-18 07:47:02 +02:00
|
|
|
for(int i=0; i<FILE_PAGESIZE; i++)
|
2009-03-11 18:28:37 +01:00
|
|
|
{
|
2009-06-07 20:00:57 +02:00
|
|
|
delete fileListText[i];
|
|
|
|
delete fileList[i];
|
|
|
|
delete fileListBg[i];
|
|
|
|
delete fileListFolder[i];
|
2009-03-11 18:28:37 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void GuiFileBrowser::SetFocus(int f)
|
|
|
|
{
|
|
|
|
focus = f;
|
|
|
|
|
2009-06-18 07:47:02 +02:00
|
|
|
for(int i=0; i<FILE_PAGESIZE; i++)
|
2009-06-07 20:00:57 +02:00
|
|
|
fileList[i]->ResetState();
|
2009-03-11 18:28:37 +01:00
|
|
|
|
|
|
|
if(f == 1)
|
2009-06-07 20:00:57 +02:00
|
|
|
fileList[selectedItem]->SetState(STATE_SELECTED);
|
2009-03-11 18:28:37 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
void GuiFileBrowser::ResetState()
|
|
|
|
{
|
|
|
|
state = STATE_DEFAULT;
|
2009-04-13 10:43:50 +02:00
|
|
|
stateChan = -1;
|
2009-03-20 08:30:29 +01:00
|
|
|
selectedItem = 0;
|
2009-03-11 18:28:37 +01:00
|
|
|
|
2009-06-18 07:47:02 +02:00
|
|
|
for(int i=0; i<FILE_PAGESIZE; i++)
|
2009-03-11 18:28:37 +01:00
|
|
|
{
|
2009-06-07 20:00:57 +02:00
|
|
|
fileList[i]->ResetState();
|
2009-03-11 18:28:37 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void GuiFileBrowser::TriggerUpdate()
|
|
|
|
{
|
|
|
|
listChanged = true;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Draw the button on screen
|
|
|
|
*/
|
|
|
|
void GuiFileBrowser::Draw()
|
|
|
|
{
|
|
|
|
if(!this->IsVisible())
|
|
|
|
return;
|
|
|
|
|
|
|
|
bgGameSelectionImg->Draw();
|
|
|
|
|
2009-06-18 07:47:02 +02:00
|
|
|
for(int i=0; i<FILE_PAGESIZE; i++)
|
2009-03-11 18:28:37 +01:00
|
|
|
{
|
2009-06-07 20:00:57 +02:00
|
|
|
fileList[i]->Draw();
|
2009-03-11 18:28:37 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
scrollbarImg->Draw();
|
|
|
|
arrowUpBtn->Draw();
|
|
|
|
arrowDownBtn->Draw();
|
|
|
|
scrollbarBoxBtn->Draw();
|
2009-03-16 06:16:20 +01:00
|
|
|
|
|
|
|
this->UpdateEffects();
|
2009-03-11 18:28:37 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
void GuiFileBrowser::Update(GuiTrigger * t)
|
|
|
|
{
|
2009-03-20 08:30:29 +01:00
|
|
|
if(state == STATE_DISABLED || !t)
|
|
|
|
return;
|
|
|
|
|
2009-04-27 08:58:23 +02:00
|
|
|
int position = 0;
|
|
|
|
int positionWiimote = 0;
|
2009-04-10 10:12:37 +02:00
|
|
|
|
2009-03-11 18:28:37 +01:00
|
|
|
arrowUpBtn->Update(t);
|
|
|
|
arrowDownBtn->Update(t);
|
|
|
|
scrollbarBoxBtn->Update(t);
|
|
|
|
|
2009-04-13 10:43:50 +02:00
|
|
|
// move the file listing to respond to wiimote cursor movement
|
|
|
|
if(scrollbarBoxBtn->GetState() == STATE_HELD &&
|
|
|
|
scrollbarBoxBtn->GetStateChan() == t->chan &&
|
|
|
|
t->wpad.ir.valid &&
|
2009-06-18 07:47:02 +02:00
|
|
|
browser.numEntries > FILE_PAGESIZE
|
2009-04-13 10:43:50 +02:00
|
|
|
)
|
2009-04-10 10:12:37 +02:00
|
|
|
{
|
2009-04-13 10:43:50 +02:00
|
|
|
scrollbarBoxBtn->SetPosition(0,0);
|
2009-04-27 08:58:23 +02:00
|
|
|
positionWiimote = t->wpad.ir.y - 60 - scrollbarBoxBtn->GetTop();
|
2009-04-10 10:12:37 +02:00
|
|
|
|
2009-04-27 08:58:23 +02:00
|
|
|
if(positionWiimote < scrollbarBoxBtn->GetMinY())
|
|
|
|
positionWiimote = scrollbarBoxBtn->GetMinY();
|
|
|
|
else if(positionWiimote > scrollbarBoxBtn->GetMaxY())
|
|
|
|
positionWiimote = scrollbarBoxBtn->GetMaxY();
|
2009-04-10 10:12:37 +02:00
|
|
|
|
2009-06-18 07:47:02 +02:00
|
|
|
browser.pageIndex = (positionWiimote * browser.numEntries)/156.0 - selectedItem;
|
2009-04-13 10:43:50 +02:00
|
|
|
|
|
|
|
if(browser.pageIndex <= 0)
|
|
|
|
{
|
|
|
|
browser.pageIndex = 0;
|
2009-04-10 10:12:37 +02:00
|
|
|
}
|
2009-06-18 07:47:02 +02:00
|
|
|
else if(browser.pageIndex+FILE_PAGESIZE >= browser.numEntries)
|
2009-04-13 10:43:50 +02:00
|
|
|
{
|
2009-06-18 07:47:02 +02:00
|
|
|
browser.pageIndex = browser.numEntries-FILE_PAGESIZE;
|
2009-04-13 10:43:50 +02:00
|
|
|
}
|
|
|
|
listChanged = true;
|
2009-04-27 08:58:23 +02:00
|
|
|
focus = false;
|
2009-04-10 10:12:37 +02:00
|
|
|
}
|
|
|
|
|
2009-04-15 08:31:58 +02:00
|
|
|
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);
|
|
|
|
}
|
|
|
|
|
2009-03-11 18:28:37 +01:00
|
|
|
// pad/joystick navigation
|
|
|
|
if(!focus)
|
|
|
|
{
|
|
|
|
goto endNavigation; // skip navigation
|
|
|
|
listChanged = false;
|
|
|
|
}
|
|
|
|
|
2009-04-13 10:43:50 +02:00
|
|
|
if(t->Right())
|
2009-03-11 18:28:37 +01:00
|
|
|
{
|
2009-06-18 07:47:02 +02:00
|
|
|
if(browser.pageIndex < browser.numEntries && browser.numEntries > FILE_PAGESIZE)
|
2009-03-11 18:28:37 +01:00
|
|
|
{
|
2009-06-18 07:47:02 +02:00
|
|
|
browser.pageIndex += FILE_PAGESIZE;
|
|
|
|
if(browser.pageIndex+FILE_PAGESIZE >= browser.numEntries)
|
|
|
|
browser.pageIndex = browser.numEntries-FILE_PAGESIZE;
|
2009-03-11 18:28:37 +01:00
|
|
|
listChanged = true;
|
|
|
|
}
|
|
|
|
}
|
2009-04-13 10:43:50 +02:00
|
|
|
else if(t->Left())
|
2009-03-11 18:28:37 +01:00
|
|
|
{
|
|
|
|
if(browser.pageIndex > 0)
|
|
|
|
{
|
2009-06-18 07:47:02 +02:00
|
|
|
browser.pageIndex -= FILE_PAGESIZE;
|
2009-03-11 18:28:37 +01:00
|
|
|
if(browser.pageIndex < 0)
|
|
|
|
browser.pageIndex = 0;
|
|
|
|
listChanged = true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else if(t->Down())
|
|
|
|
{
|
|
|
|
if(browser.pageIndex + selectedItem + 1 < browser.numEntries)
|
|
|
|
{
|
2009-06-18 07:47:02 +02:00
|
|
|
if(selectedItem == FILE_PAGESIZE-1)
|
2009-03-11 18:28:37 +01:00
|
|
|
{
|
|
|
|
// move list down by 1
|
|
|
|
browser.pageIndex++;
|
|
|
|
listChanged = true;
|
|
|
|
}
|
2009-06-07 20:00:57 +02:00
|
|
|
else if(fileList[selectedItem+1]->IsVisible())
|
2009-03-11 18:28:37 +01:00
|
|
|
{
|
2009-06-07 20:00:57 +02:00
|
|
|
fileList[selectedItem]->ResetState();
|
|
|
|
fileList[++selectedItem]->SetState(STATE_SELECTED, t->chan);
|
2009-03-11 18:28:37 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else if(t->Up())
|
|
|
|
{
|
|
|
|
if(selectedItem == 0 && browser.pageIndex + selectedItem > 0)
|
|
|
|
{
|
|
|
|
// move list up by 1
|
|
|
|
browser.pageIndex--;
|
|
|
|
listChanged = true;
|
|
|
|
}
|
|
|
|
else if(selectedItem > 0)
|
|
|
|
{
|
2009-06-07 20:00:57 +02:00
|
|
|
fileList[selectedItem]->ResetState();
|
|
|
|
fileList[--selectedItem]->SetState(STATE_SELECTED, t->chan);
|
2009-03-11 18:28:37 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
endNavigation:
|
|
|
|
|
2009-06-18 07:47:02 +02:00
|
|
|
for(int i=0; i<FILE_PAGESIZE; i++)
|
2009-03-11 18:28:37 +01:00
|
|
|
{
|
|
|
|
if(listChanged)
|
|
|
|
{
|
|
|
|
if(browser.pageIndex+i < browser.numEntries)
|
|
|
|
{
|
2009-06-07 20:00:57 +02:00
|
|
|
if(fileList[i]->GetState() == STATE_DISABLED)
|
|
|
|
fileList[i]->SetState(STATE_DEFAULT);
|
2009-03-11 18:28:37 +01:00
|
|
|
|
2009-06-07 20:00:57 +02:00
|
|
|
fileList[i]->SetVisible(true);
|
2009-03-11 18:28:37 +01:00
|
|
|
|
2009-06-07 20:00:57 +02:00
|
|
|
fileListText[i]->SetText(browserList[browser.pageIndex+i].displayname);
|
2009-03-11 18:28:37 +01:00
|
|
|
|
|
|
|
if(browserList[browser.pageIndex+i].isdir) // directory
|
|
|
|
{
|
2009-06-07 20:00:57 +02:00
|
|
|
fileList[i]->SetIcon(fileListFolder[i]);
|
|
|
|
fileListText[i]->SetPosition(30,0);
|
2009-03-11 18:28:37 +01:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2009-06-07 20:00:57 +02:00
|
|
|
fileList[i]->SetIcon(NULL);
|
|
|
|
fileListText[i]->SetPosition(10,0);
|
2009-03-11 18:28:37 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2009-06-07 20:00:57 +02:00
|
|
|
fileList[i]->SetVisible(false);
|
|
|
|
fileList[i]->SetState(STATE_DISABLED);
|
2009-03-11 18:28:37 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2009-06-07 20:00:57 +02:00
|
|
|
if(i != selectedItem && fileList[i]->GetState() == STATE_SELECTED)
|
|
|
|
fileList[i]->ResetState();
|
|
|
|
else if(focus && i == selectedItem && fileList[i]->GetState() == STATE_DEFAULT)
|
|
|
|
fileList[selectedItem]->SetState(STATE_SELECTED, t->chan);
|
2009-03-11 18:28:37 +01:00
|
|
|
|
2009-05-28 09:08:25 +02:00
|
|
|
int currChan = t->chan;
|
|
|
|
|
2009-06-07 20:00:57 +02:00
|
|
|
if(t->wpad.ir.valid && !fileList[i]->IsInside(t->wpad.ir.x, t->wpad.ir.y))
|
2009-05-28 09:08:25 +02:00
|
|
|
t->chan = -1;
|
|
|
|
|
2009-06-07 20:00:57 +02:00
|
|
|
fileList[i]->Update(t);
|
2009-05-28 09:08:25 +02:00
|
|
|
t->chan = currChan;
|
2009-03-11 18:28:37 +01:00
|
|
|
|
2009-06-07 20:00:57 +02:00
|
|
|
if(fileList[i]->GetState() == STATE_SELECTED)
|
2009-03-11 18:28:37 +01:00
|
|
|
{
|
|
|
|
selectedItem = i;
|
|
|
|
browser.selIndex = browser.pageIndex + i;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2009-04-13 10:43:50 +02:00
|
|
|
// update the location of the scroll box based on the position in the file list
|
2009-04-27 08:58:23 +02:00
|
|
|
if(positionWiimote > 0)
|
2009-05-27 08:24:01 +02:00
|
|
|
{
|
2009-04-27 08:58:23 +02:00
|
|
|
position = positionWiimote; // follow wiimote cursor
|
2009-05-27 08:24:01 +02:00
|
|
|
}
|
2009-04-27 08:58:23 +02:00
|
|
|
else
|
2009-05-27 08:24:01 +02:00
|
|
|
{
|
2009-06-18 07:47:02 +02:00
|
|
|
position = 156*(browser.pageIndex + FILE_PAGESIZE/2.0) / (browser.numEntries*1.0);
|
2009-05-27 08:24:01 +02:00
|
|
|
|
2009-06-18 07:47:02 +02:00
|
|
|
if(browser.pageIndex/(FILE_PAGESIZE/2.0) < 1)
|
2009-05-27 08:24:01 +02:00
|
|
|
position = 0;
|
2009-06-18 07:47:02 +02:00
|
|
|
else if((browser.pageIndex+FILE_PAGESIZE)/(FILE_PAGESIZE*1.0) >= (browser.numEntries)/(FILE_PAGESIZE*1.0))
|
|
|
|
position = 156;
|
2009-05-27 08:24:01 +02:00
|
|
|
}
|
2009-04-27 08:58:23 +02:00
|
|
|
|
|
|
|
scrollbarBoxBtn->SetPosition(0,position+36);
|
2009-04-13 10:43:50 +02:00
|
|
|
|
2009-03-11 18:28:37 +01:00
|
|
|
listChanged = false;
|
|
|
|
|
|
|
|
if(updateCB)
|
|
|
|
updateCB(this);
|
|
|
|
}
|