27 bgOptionsImg =
new GuiImage(bgOptions);
28 bgOptionsImg->setParent(
this);
29 bgOptionsImg->setAlignment(ALIGN_H::LEFT, ALIGN_V::MIDDLE);
34 scrollbarImg =
new GuiImage(scrollbar);
35 scrollbarImg->setParent(
this);
36 scrollbarImg->setAlignment(ALIGN_H::RIGHT, ALIGN_V::TOP);
37 scrollbarImg->setPosition(0, 30);
40 arrowDownImg =
new GuiImage(arrowDown);
41 arrowDownOver =
new GuiImageData(scrollbar_arrowdown_over_png);
42 arrowDownOverImg =
new GuiImage(arrowDownOver);
45 arrowUpOver =
new GuiImageData(scrollbar_arrowup_over_png);
46 arrowUpOverImg =
new GuiImage(arrowUpOver);
48 arrowUpBtn =
new GuiButton(arrowUpImg->getWidth(), arrowUpImg->getHeight());
49 arrowUpBtn->setParent(
this);
50 arrowUpBtn->setImage(arrowUpImg);
51 arrowUpBtn->setImageOver(arrowUpOverImg);
52 arrowUpBtn->setAlignment(ALIGN_H::RIGHT, ALIGN_V::TOP);
53 arrowUpBtn->setSelectable(
false);
54 arrowUpBtn->setTrigger(trigA);
56 arrowDownBtn =
new GuiButton(arrowDownImg->getWidth(), arrowDownImg->getHeight());
57 arrowDownBtn->setParent(
this);
58 arrowDownBtn->setImage(arrowDownImg);
59 arrowDownBtn->setImageOver(arrowDownOverImg);
60 arrowDownBtn->setAlignment(ALIGN_H::RIGHT, ALIGN_V::BOTTOM);
61 arrowDownBtn->setSelectable(
false);
62 arrowDownBtn->setTrigger(trigA);
64 for(
int i=0; i<OPTION_PAGESIZE; i++)
67 optionTxt[i]->
setAlignment(ALIGN_H::LEFT, ALIGN_V::MIDDLE);
68 optionTxt[i]->setPosition(8,4);
69 optionTxt[i]->setMaxWidth(235);
72 optionVal[i]->setAlignment(ALIGN_H::LEFT, ALIGN_V::MIDDLE);
76 optionBg[i] =
new GuiImage(bgOptionsEntry);
80 optionBtn[i]->setParent(
this);
81 optionBtn[i]->setLabel(optionTxt[i], 0);
83 optionBtn[i]->setImageOver(optionBg[i]);
84 optionBtn[i]->setPosition(2,30*i+3);
85 optionBtn[i]->setTrigger(trigA);
86 optionBtn[i]->setSoundOver(
nullptr);
245 if(
state == STATE::DISABLED || !controller)
250 arrowUpBtn->update(controller);
251 arrowDownBtn->update(controller);
258 for(
int i=0; i<OPTION_PAGESIZE; ++i)
262 if(optionBtn[i]->
getState() == STATE::DISABLED)
264 optionBtn[i]->setVisible(
true);
265 optionBtn[i]->setState(STATE::DEFAULT);
268 optionTxt[i]->setText(options->name[next]);
269 optionVal[i]->setText(options->value[next]);
270 optionIndex[i] = next;
275 optionBtn[i]->setVisible(
false);
276 optionBtn[i]->setState(STATE::DISABLED);
281 auto pad = controller->getPadData();
282 int currentChan = controller->getChannel();
288 bool channelActive = pad.validPointer || pad.buttons_d != 0 || pad.buttons_h != 0;
290 for(
int i=0; i<OPTION_PAGESIZE; ++i)
292 if(i != selectedItem && optionBtn[i]->
getState() == STATE::SELECTED)
293 optionBtn[i]->resetState();
294 else if(
focus && channelActive && i == selectedItem && optionBtn[i]->
getState() == STATE::DEFAULT)
295 optionBtn[selectedItem]->setState(STATE::SELECTED, currentChan);
296 else if(
focus && channelActive && i == selectedItem && optionBtn[i]->
getState() == STATE::SELECTED &&
303 optionBtn[i]->resetState();
309 if(pad.validPointer && !optionBtn[i]->isInside(pad.cursor_x, pad.cursor_y))
310 controller->setChannel(-1);
312 optionBtn[i]->update(controller);
313 controller->setChannel(currentChan);
315 if(optionBtn[i]->
getState() == STATE::SELECTED)
318 if(selectedItem == i) {
319 optionTxt[i]->setScroll(SCROLL::HORIZONTAL);
320 optionVal[i]->setScroll(SCROLL::HORIZONTAL);
324 optionTxt[i]->setScroll(SCROLL::NONE);
333 if(controller->down() || arrowDownBtn->getState() == STATE::CLICKED)
335 next = this->
findMenuItem(optionIndex[selectedItem], 1);
339 if(selectedItem == OPTION_PAGESIZE-1)
345 else if(optionBtn[selectedItem+1]->
isVisible())
347 optionBtn[selectedItem]->resetState();
348 optionBtn[selectedItem+1]->setState(STATE::SELECTED, controller->getChannel());
352 arrowDownBtn->resetState();
354 else if(controller->up() || arrowUpBtn->getState() == STATE::CLICKED)
356 prev = this->
findMenuItem(optionIndex[selectedItem], -1);
360 if(selectedItem == 0)
368 optionBtn[selectedItem]->resetState();
369 optionBtn[selectedItem-1]->setState(STATE::SELECTED, controller->getChannel());
373 arrowUpBtn->resetState();
Display, manage, and manipulate text in the GUI.
void setAlignment(ALIGN_H hor, ALIGN_V vert)
Sets the text alignment.