Better function name for cStack changeSelectedPage()
This commit is contained in:
@@ -85,7 +85,7 @@ bool cStack::setPage(size_t n) {
|
|||||||
return !failed;
|
return !failed;
|
||||||
}
|
}
|
||||||
|
|
||||||
void cStack::doSelectPage(int dir, bool loop) {
|
void cStack::changeSelectedPage(int dir, bool loop) {
|
||||||
curPage += dir;
|
curPage += dir;
|
||||||
if(loop){
|
if(loop){
|
||||||
if(curPage < 0) curPage += nPages;
|
if(curPage < 0) curPage += nPages;
|
||||||
|
@@ -60,7 +60,7 @@ public:
|
|||||||
/// Page forward or backward in the stack
|
/// Page forward or backward in the stack
|
||||||
/// @param dir Usually -1 or 1
|
/// @param dir Usually -1 or 1
|
||||||
/// @param loop Beyond the first and last page, loop to the other side
|
/// @param loop Beyond the first and last page, loop to the other side
|
||||||
void doSelectPage(int dir, bool loop = true);
|
void changeSelectedPage(int dir, bool loop = true);
|
||||||
/// Get the current page the stack is displaying.
|
/// Get the current page the stack is displaying.
|
||||||
/// @return The current page number
|
/// @return The current page number
|
||||||
size_t getPage() const;
|
size_t getPage() const;
|
||||||
|
@@ -1720,9 +1720,9 @@ class cChooseScenario {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool doSelectPage(int dir) {
|
bool changeSelectedPage(int dir) {
|
||||||
auto& stk = dynamic_cast<cStack&>(me["list"]);
|
auto& stk = dynamic_cast<cStack&>(me["list"]);
|
||||||
stk.doSelectPage(dir, true);
|
stk.changeSelectedPage(dir, true);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1762,8 +1762,8 @@ public:
|
|||||||
set_cursor(sword_curs);
|
set_cursor(sword_curs);
|
||||||
|
|
||||||
me["cancel"].attachClickHandler(std::bind(&cChooseScenario::doCancel, this));
|
me["cancel"].attachClickHandler(std::bind(&cChooseScenario::doCancel, this));
|
||||||
me["next"].attachClickHandler(std::bind(&cChooseScenario::doSelectPage, this, 1));
|
me["next"].attachClickHandler(std::bind(&cChooseScenario::changeSelectedPage, this, 1));
|
||||||
me["prev"].attachClickHandler(std::bind(&cChooseScenario::doSelectPage, this, -1));
|
me["prev"].attachClickHandler(std::bind(&cChooseScenario::changeSelectedPage, this, -1));
|
||||||
me["start1"].attachClickHandler(std::bind(&cChooseScenario::doSelectScenario, this, 0));
|
me["start1"].attachClickHandler(std::bind(&cChooseScenario::doSelectScenario, this, 0));
|
||||||
me["start2"].attachClickHandler(std::bind(&cChooseScenario::doSelectScenario, this, 1));
|
me["start2"].attachClickHandler(std::bind(&cChooseScenario::doSelectScenario, this, 1));
|
||||||
me["start3"].attachClickHandler(std::bind(&cChooseScenario::doSelectScenario, this, 2));
|
me["start3"].attachClickHandler(std::bind(&cChooseScenario::doSelectScenario, this, 2));
|
||||||
@@ -2011,11 +2011,11 @@ class cFilePicker {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool doSelectPage(int dir) {
|
bool changeSelectedPage(int dir) {
|
||||||
auto& stk = dynamic_cast<cStack&>(me["list"]);
|
auto& stk = dynamic_cast<cStack&>(me["list"]);
|
||||||
// This stack doesn't loop. It's easier to implement loading the files one page at a time
|
// This stack doesn't loop. It's easier to implement loading the files one page at a time
|
||||||
// if I know we're not gonna jump from page 0 to the last page, leaving a gap in the vector.
|
// if I know we're not gonna jump from page 0 to the last page, leaving a gap in the vector.
|
||||||
stk.doSelectPage(dir);
|
stk.changeSelectedPage(dir);
|
||||||
me["prev"].show();
|
me["prev"].show();
|
||||||
me["next"].show();
|
me["next"].show();
|
||||||
if(stk.getPage() == 0){
|
if(stk.getPage() == 0){
|
||||||
@@ -2089,8 +2089,8 @@ public:
|
|||||||
// when replaying, basically make Left/Right buttons no-op.
|
// when replaying, basically make Left/Right buttons no-op.
|
||||||
// Load/Save buttons should send a dummy result.
|
// Load/Save buttons should send a dummy result.
|
||||||
if(!replaying){
|
if(!replaying){
|
||||||
me["next"].attachClickHandler(std::bind(&cFilePicker::doSelectPage, this, 1));
|
me["next"].attachClickHandler(std::bind(&cFilePicker::changeSelectedPage, this, 1));
|
||||||
me["prev"].attachClickHandler(std::bind(&cFilePicker::doSelectPage, this, -1));
|
me["prev"].attachClickHandler(std::bind(&cFilePicker::changeSelectedPage, this, -1));
|
||||||
init_pages();
|
init_pages();
|
||||||
}else{
|
}else{
|
||||||
for(int i = 0; i < SLOTS_PER_PAGE; ++i){
|
for(int i = 0; i < SLOTS_PER_PAGE; ++i){
|
||||||
@@ -2104,7 +2104,7 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Hide the prev button and populate the first page
|
// Hide the prev button and populate the first page
|
||||||
doSelectPage(0);
|
changeSelectedPage(0);
|
||||||
|
|
||||||
me.run();
|
me.run();
|
||||||
if(!me.hasResult()) return "";
|
if(!me.hasResult()) return "";
|
||||||
|
Reference in New Issue
Block a user