Better function name for cStack changeSelectedPage()
This commit is contained in:
@@ -85,7 +85,7 @@ bool cStack::setPage(size_t n) {
|
||||
return !failed;
|
||||
}
|
||||
|
||||
void cStack::doSelectPage(int dir, bool loop) {
|
||||
void cStack::changeSelectedPage(int dir, bool loop) {
|
||||
curPage += dir;
|
||||
if(loop){
|
||||
if(curPage < 0) curPage += nPages;
|
||||
|
@@ -60,7 +60,7 @@ public:
|
||||
/// Page forward or backward in the stack
|
||||
/// @param dir Usually -1 or 1
|
||||
/// @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.
|
||||
/// @return The current page number
|
||||
size_t getPage() const;
|
||||
|
@@ -1720,9 +1720,9 @@ class cChooseScenario {
|
||||
return true;
|
||||
}
|
||||
|
||||
bool doSelectPage(int dir) {
|
||||
bool changeSelectedPage(int dir) {
|
||||
auto& stk = dynamic_cast<cStack&>(me["list"]);
|
||||
stk.doSelectPage(dir, true);
|
||||
stk.changeSelectedPage(dir, true);
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -1762,8 +1762,8 @@ public:
|
||||
set_cursor(sword_curs);
|
||||
|
||||
me["cancel"].attachClickHandler(std::bind(&cChooseScenario::doCancel, this));
|
||||
me["next"].attachClickHandler(std::bind(&cChooseScenario::doSelectPage, this, 1));
|
||||
me["prev"].attachClickHandler(std::bind(&cChooseScenario::doSelectPage, this, -1));
|
||||
me["next"].attachClickHandler(std::bind(&cChooseScenario::changeSelectedPage, this, 1));
|
||||
me["prev"].attachClickHandler(std::bind(&cChooseScenario::changeSelectedPage, this, -1));
|
||||
me["start1"].attachClickHandler(std::bind(&cChooseScenario::doSelectScenario, this, 0));
|
||||
me["start2"].attachClickHandler(std::bind(&cChooseScenario::doSelectScenario, this, 1));
|
||||
me["start3"].attachClickHandler(std::bind(&cChooseScenario::doSelectScenario, this, 2));
|
||||
@@ -2011,11 +2011,11 @@ class cFilePicker {
|
||||
return true;
|
||||
}
|
||||
|
||||
bool doSelectPage(int dir) {
|
||||
bool changeSelectedPage(int dir) {
|
||||
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
|
||||
// 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["next"].show();
|
||||
if(stk.getPage() == 0){
|
||||
@@ -2089,8 +2089,8 @@ public:
|
||||
// when replaying, basically make Left/Right buttons no-op.
|
||||
// Load/Save buttons should send a dummy result.
|
||||
if(!replaying){
|
||||
me["next"].attachClickHandler(std::bind(&cFilePicker::doSelectPage, this, 1));
|
||||
me["prev"].attachClickHandler(std::bind(&cFilePicker::doSelectPage, this, -1));
|
||||
me["next"].attachClickHandler(std::bind(&cFilePicker::changeSelectedPage, this, 1));
|
||||
me["prev"].attachClickHandler(std::bind(&cFilePicker::changeSelectedPage, this, -1));
|
||||
init_pages();
|
||||
}else{
|
||||
for(int i = 0; i < SLOTS_PER_PAGE; ++i){
|
||||
@@ -2104,7 +2104,7 @@ public:
|
||||
}
|
||||
|
||||
// Hide the prev button and populate the first page
|
||||
doSelectPage(0);
|
||||
changeSelectedPage(0);
|
||||
|
||||
me.run();
|
||||
if(!me.hasResult()) return "";
|
||||
|
Reference in New Issue
Block a user