本文整理汇总了C++中ListBox::setOrientation方法的典型用法代码示例。如果您正苦于以下问题:C++ ListBox::setOrientation方法的具体用法?C++ ListBox::setOrientation怎么用?C++ ListBox::setOrientation使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ListBox
的用法示例。
在下文中一共展示了ListBox::setOrientation方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: items
GCMenu::GCMenu(item items[], int numItems, int x, int y, int width, int height,
bool autosizeX, bool autosizeY, Widget* parent)
:Widget(x, y, width, height, parent), items(items), numItems(numItems), enabled(false) {
setEnabled(true);
/*setDrawBackground(false);*/
Layout *mainLayout = new Layout(0, 0, width, height, NULL, 1, 2);
mainLayout->setDrawBackground(false);
int imageHeight = height - ICON_HEIGHT - DOT_HEIGHT;
ListBox *listBox = new ListBox(0, 0, mainLayout->getWidth(), mainLayout->getHeight(), mainLayout, ListBox::LBO_VERTICAL);
listBox->setSkin(Util::getSkinBack());
subLayout = new Layout(0, 0, width, imageHeight, listBox, 3, 1);
subLayout->setPaddingLeft(5);
subLayout->setPaddingRight(5);
subLayout->setDrawBackground(false);
/*subLayout->setSkin(Util::getSkinBack());*/
leftArrow = new Image(0, 0, ARROW_WIDTH, imageHeight, subLayout, false, false, RES_LEFT_ARROW);
leftArrow->setDrawBackground(false);
mainImage = new TransitionImage(0, 0, width - (ARROW_WIDTH * 2) - 10, imageHeight, subLayout, false, false, NULL);
mainImage->setDrawBackground(false);
rightArrow = new Image(0, 0, ARROW_WIDTH, imageHeight, subLayout, false, false, RES_RIGHT_ARROW);
rightArrow->setDrawBackground(false);
ListBox *iconAndDotList = new ListBox(0, 0, width, ICON_HEIGHT + DOT_HEIGHT, listBox,
ListBox::LBO_VERTICAL);
iconAndDotList->setSkin(Util::getIconListBack());
iconList = new ListBox(0, 0, width, ICON_HEIGHT, iconAndDotList,
ListBox::LBO_HORIZONTAL);
iconList->setDrawBackground(false);
iconsPerList = iconList->getWidth() / (PADDING + MIN_MENU_ICON_WIDTH);
int currentList = -1;
ListBox *tempList = NULL;
Image *tempImage = NULL;
for (int i = 0; i < numItems; i++) {
if (i % iconsPerList == 0) {
tempList = new ListBox(0, 0, iconList->getWidth(), iconList->getHeight(), NULL);
tempList->setOrientation(ListBox::LBO_HORIZONTAL);
tempList->setDrawBackground(false);
currentList++;
iconLists.add(tempList);
}
tempImage = new Image(0, 0, MIN_MENU_ICON_WIDTH + PADDING + ((iconList->getWidth() % (PADDING + MIN_MENU_ICON_WIDTH)) / iconsPerList),
ICON_HEIGHT, tempList, false, false, items[i].icon);
//tempImage->setSkin(Util::getIconSelect());
//tempImage->setDrawBackground(true);
}
dotList = new ListBox(0, 0, width, DOT_HEIGHT, iconAndDotList,
ListBox::LBO_HORIZONTAL);
dotList->setDrawBackground(false);
int dotListPadding = (width - (iconLists.size() * (11 + PADDING))) / 2;
dotList->setPaddingLeft(dotListPadding>0?dotListPadding:0);
for (int j = 0; j < iconLists.size(); j++) {
tempImage = new Image(0, 0, 11 + PADDING, DOT_HEIGHT, dotList, false, false, RES_DESELECTED_LIST_DOT);
}
if (numItems > 0) {
emp = false;
selectedList = 0;
((Image*)dotList->getChildren()[selectedList])->setResource(RES_SELECTED_LIST_DOT);
iconList->add(iconLists[selectedList]);
iconLists[selectedList]->setSelectedIndex(0);
iconLists[selectedList]->getChildren()[iconLists[0]->getSelectedIndex()]->setSelected(true);
((Image*)iconLists[selectedList]->getChildren()[iconLists[selectedList]->getSelectedIndex()])->setResource(items[iconLists[selectedList]->getSelectedIndex()].iconSel);
mainImage->setResource(items[iconLists[selectedList]->getSelectedIndex() + (selectedList * iconsPerList)].bigImage);
}
else {
emp = true;
}
add(mainLayout);
}