Ejemplo n.º 1
0
	void ListView::notifyListenersDeleteButtonClicked(
		const MAWidgetEventData& widgetEventData)
	{
		const int itemIndex = widgetEventData.listItemIndex;
		const int sectionIndex = widgetEventData.listSectionIndex;
		ListViewSection* section = NULL;
		ListViewItem* item = NULL;
		const int countListeners = mListViewListeners.size();
		bool isDefaultList = sectionIndex == MAW_RES_INVALID_INDEX;

		if (!isDefaultList)
		{
			section = (ListViewSection*) getChild(sectionIndex);
			item = (ListViewItem*) section->getChild(itemIndex);
		}
		else
		{
			item = (ListViewItem*) getChild(itemIndex);
		}

		for (int i = 0; i < countListeners; i++)
		{
			// deprecated
			mListViewListeners[i]->segmentedListViewItemDelete(
				this,
				section,
				item);

			// new method
			mListViewListeners[i]->listViewItemDelete(
				this,
				section,
				item);
		}
	}
Ejemplo n.º 2
0
/**
 * Show currently used selection style for an list view item.
 * Works on iOS platform.
 */
void SettingsScreen::showSelectionStyleMessageBox()
{
	MAUtil::String textToShow;
	if (mListView->countChildWidgets() == 0)
	{
		textToShow = "The list view section does not have sections.";
	}
	else
	{
		ListViewSection* section = (ListViewSection*) mListView->getChild(0);
		if (section->countChildWidgets() == 0)
		{
			textToShow = "The list view section does not have items.";
		}
		else
		{
			ListViewItem* item = (ListViewItem*) section->getChild(0);
			ListViewItemSelectionStyle selectionStyle =
				item->getSelectionStyle();
			textToShow = "The selection style is: " +
				getSelectionStyleString(selectionStyle);
		}
	}
	maAlert("ListViewItem selection style", textToShow.c_str(), "OK", NULL, NULL);
}
Ejemplo n.º 3
0
	void ListView::notifyListenersItemClicked(
		const MAWidgetEventData& widgetEventData)
	{
		int itemIndex = widgetEventData.listItemIndex;
		int sectionIndex = widgetEventData.listSectionIndex;
		ListViewSection* section = NULL;
		ListViewItem* item = NULL;
		const int countListeners = mListViewListeners.size();
		bool isDefaultList = sectionIndex == MAW_RES_INVALID_INDEX;

		if (isDefaultList)
		{
			// Default list view. Does not contain sections.
			item = (ListViewItem*)getChild(itemIndex);
		}
		else
		{
			// Alphabetical or segmented list view.
			section = (ListViewSection*)getChild(sectionIndex);
			item = (ListViewItem*)section->getChild(itemIndex);
		}

		for (int i = 0; i < countListeners; i++)
		{
			// deprecated methods.
			mListViewListeners[i]->listViewItemClicked(
				this,
				item);
			mListViewListeners[i]->listViewItemClicked(
				this,
				itemIndex);

			// new methods.
			mListViewListeners[i]->listViewItemClicked(
				this,
				sectionIndex,
				itemIndex);
			mListViewListeners[i]->listViewItemClicked(
				this,
				section,
				item);
		}
	}
Ejemplo n.º 4
0
/**
 * Change all the list view's items selection style to a given value.
 * @param style Style to set.
 */
void SettingsScreen::changeSelectionStyle(ListViewItemSelectionStyle style)
{
	int sectionIndex = 0;
	int countSections = mListView->countChildWidgets();

	while (sectionIndex < countSections)
	{
		ListViewSection* section = (ListViewSection*) mListView->getChild(sectionIndex);
		int itemIndex = 0;
		int countItems = section->countChildWidgets();

		while (itemIndex < countItems)
		{
			ListViewItem* item = (ListViewItem*) section->getChild(itemIndex);
			item->setSelectionStyle(style);

			itemIndex++;
		}

		sectionIndex++;
	}
}
Ejemplo n.º 5
0
	/**
	 * Notify listeners when receiving #MAW_EVENT_SEGMENTED_LIST_ITEM_CLICKED.
	 * @deprecated
	 * @param widgetEventData Event's data.
	 */
	void ListView::notifyListenersSectionItemClicked(
		const MAWidgetEventData& widgetEventData)
	{
		int itemIndex = widgetEventData.sectionItemIndex;
		int sectionIndex = widgetEventData.sectionIndex;
		ListViewSection* section = NULL;
		ListViewItem* item = NULL;
		const int countListeners = mListViewListeners.size();
		section = (ListViewSection*)getChild(sectionIndex);
		item = (ListViewItem*)section->getChild(itemIndex);

		for (int i = 0; i < countListeners; i++)
		{
			mListViewListeners[i]->segmentedListViewItemClicked(
				this,
				sectionIndex,
				itemIndex);
			mListViewListeners[i]->segmentedListViewItemClicked(
				this,
				section,
				item);
		}
	}