PageView - Change to keep some of the original API names because it makes more sense.

This commit is contained in:
Neo Kim 2015-11-10 21:30:43 +09:00
parent 9cbbd283c7
commit 94637bef2f
2 changed files with 12 additions and 25 deletions

View File

@ -96,17 +96,17 @@ void PageView::addWidgetToPage(Widget *widget, ssize_t pageIdx, bool forceCreate
insertCustomItem(widget, pageIdx); insertCustomItem(widget, pageIdx);
} }
void PageView::addPage(Layout* page) void PageView::addPage(Widget* page)
{ {
pushBackCustomItem(page); pushBackCustomItem(page);
} }
void PageView::insertPage(Layout* page, int idx) void PageView::insertPage(Widget* page, int idx)
{ {
insertCustomItem(page, idx); insertCustomItem(page, idx);
} }
void PageView::removePage(Layout* page) void PageView::removePage(Widget* page)
{ {
removeItem(getIndex(page)); removeItem(getIndex(page));
} }

View File

@ -122,7 +122,7 @@ public:
* @param pageIdx A given index. * @param pageIdx A given index.
* @param forceCreate If `forceCreate` is true and `widget` isn't exists, pageview would create a default page and add it. * @param forceCreate If `forceCreate` is true and `widget` isn't exists, pageview would create a default page and add it.
* *
* Since v3.9, this is deprecated. Use `ListView::insertCustomItem(Widget* item, ssize_t index)` instead. * Since v3.9, this is deprecated. Use `insertPage(Widget* page, int idx)` instead.
*/ */
CC_DEPRECATED_ATTRIBUTE void addWidgetToPage(Widget* widget, ssize_t pageIdx, bool forceCreate); CC_DEPRECATED_ATTRIBUTE void addWidgetToPage(Widget* widget, ssize_t pageIdx, bool forceCreate);
@ -130,54 +130,42 @@ public:
* Insert a page into the end of PageView. * Insert a page into the end of PageView.
* *
* @param page Page to be inserted. * @param page Page to be inserted.
*
* Since v3.9, this is deprecated. Use `ListView::pushBackCustomItem(Widget* item)` instead.
*/ */
CC_DEPRECATED_ATTRIBUTE void addPage(Layout* page); void addPage(Widget* page);
/** /**
* Insert a page into PageView at a given index. * Insert a page into PageView at a given index.
* *
* @param page Page to be inserted. * @param page Page to be inserted.
* @param idx A given index. * @param idx A given index.
*
* Since v3.9, this is deprecated. Use `ListView::insertCustomItem(Widget* item, ssize_t index)` instead.
*/ */
CC_DEPRECATED_ATTRIBUTE void insertPage(Layout* page, int idx); void insertPage(Widget* page, int idx);
/** /**
* Remove a page of PageView. * Remove a page of PageView.
* *
* @param page Page to be removed. * @param page Page to be removed.
*
* Since v3.9, this is deprecated. Use `ListView::removeItem(getIndex(item))` instead.
*/ */
CC_DEPRECATED_ATTRIBUTE void removePage(Layout* page); void removePage(Widget* page);
/** /**
* Remove a page at a given index of PageView. * Remove a page at a given index of PageView.
* *
* @param index A given index. * @param index A given index.
*
* Since v3.9, this is deprecated. Use `ListView::removeItem(ssize_t index)` instead.
*/ */
CC_DEPRECATED_ATTRIBUTE void removePageAtIndex(ssize_t index); void removePageAtIndex(ssize_t index);
/** /**
* @brief Remove all pages of the PageView. * @brief Remove all pages of the PageView.
*
* Since v3.9, this is deprecated. Use `ListView::removeAllItems()` instead.
*/ */
CC_DEPRECATED_ATTRIBUTE void removeAllPages(); void removeAllPages();
/** /**
* Scroll to a page with a given index. * Scroll to a page with a given index.
* *
* @param idx A given index in the PageView. Index start from 0 to pageCount -1. * @param idx A given index in the PageView. Index start from 0 to pageCount -1.
*
* Since v3.9, this is deprecated. Use `ListView::scrollToItem(ssize_t itemIndex, Vec2::ANCHOR_MIDDLE, Vec2::ANCHOR_MIDDLE)` instead.
*/ */
CC_DEPRECATED_ATTRIBUTE void scrollToPage(ssize_t idx); void scrollToPage(ssize_t idx);
/** /**
* Scroll to a page with a given index. * Scroll to a page with a given index.
@ -244,7 +232,6 @@ public:
*/ */
CC_DEPRECATED_ATTRIBUTE void addEventListenerPageView(Ref *target, SEL_PageViewEvent selector); CC_DEPRECATED_ATTRIBUTE void addEventListenerPageView(Ref *target, SEL_PageViewEvent selector);
/** /**
* @brief Add a page turn callback to PageView, then when one page is turning, the callback will be called. * @brief Add a page turn callback to PageView, then when one page is turning, the callback will be called.
* *