当前位置: 首页>>代码示例>>C++>>正文


C++ ListBox::setDrawBackground方法代码示例

本文整理汇总了C++中ListBox::setDrawBackground方法的典型用法代码示例。如果您正苦于以下问题:C++ ListBox::setDrawBackground方法的具体用法?C++ ListBox::setDrawBackground怎么用?C++ ListBox::setDrawBackground使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ListBox的用法示例。


在下文中一共展示了ListBox::setDrawBackground方法的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);
}
开发者ID:AirBayCreative,项目名称:GameCards,代码行数:83,代码来源:GCMenu.cpp


注:本文中的ListBox::setDrawBackground方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。