本文整理汇总了C++中PageView类的典型用法代码示例。如果您正苦于以下问题:C++ PageView类的具体用法?C++ PageView怎么用?C++ PageView使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了PageView类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: switch
void GateSelect::pageViewEvent(Ref *pSender, PageView::EventType type)
{
switch (type)
{
case PageView::EventType::TURNING:
{
PageView* pageView = dynamic_cast<PageView*>(pSender);
this->txtGroup->setString(StringUtils::format("卡组%d",int(pageView->getCurPageIndex()+1)));
tabBar->setIndex(int(pageView->getCurPageIndex()));
// Layout* subPage=pageView->getPage(int(pageView->getCurPageIndex()));
// for(int i=0;i<5;i++)
// {
// ImageView* img=static_cast<ImageView*>(subPage->getChildByName("img_"+Value((i+1)).asString()));
// ImageView* icon=(ImageView*)img->getChildByName("icon");
// if (i<pGroup.npcid_size() && pGroup.npcid(i)!=0) {
// PNpc* pNpc=Manager::getInstance()->getNpc(pGroup.npcid(j));
// XRole* xRole=XRole::record(Value(pNpc->spriteid()));
// icon->loadTexture("face_"+Value(xRole->getId()).asString()+".png");
// img->loadTexture("frame_"+Value(Manager::getInstance()->Qualitys[pNpc->quality()].color).asString()+".png");
// }
// icon->setVisible(j<pGroup.npcid_size() && pGroup.npcid(j)!=0);
//
// }
}
break;
default:
break;
}
}
示例2: XOJ_CHECK_TYPE
void ScrollHandler::goToNextPage()
{
XOJ_CHECK_TYPE(ScrollHandler);
if (this->control->getWindow())
{
if (this->control->getSettings()->isPresentationMode())
{
PageView* view = this->control->getWindow()->getXournal()->getViewFor(this->control->getWindow()->getXournal()->getCurrentPage() + 1);
if (view)
{
double dHeight = view->getDisplayHeight();
double disHeight = this->control->getWindow()->getLayout()->getDisplayHeight();
//this gets reversed when we are going down if the page is smaller than the display height
double top = (-dHeight + disHeight)/2.0 - 7.5;
//the magic 7.5 is from XOURNAL_PADDING_BETWEEN/2
scrollToPage(this->control->getWindow()->getXournal()->getCurrentPage() + 1, top);
}
}
else
{
scrollToPage(this->control->getWindow()->getXournal()->getCurrentPage() + 1);
}
}
}
示例3: lua_cocos2dx_PageView_addEventListenerPageView
static int lua_cocos2dx_PageView_addEventListenerPageView(lua_State* L)
{
if (nullptr == L)
return 0;
int argc = 0;
PageView* self = nullptr;
#if COCOS2D_DEBUG >= 1
tolua_Error tolua_err;
if (!tolua_isusertype(L,1,"ccui.PageView",0,&tolua_err)) goto tolua_lerror;
#endif
self = static_cast<PageView*>(tolua_tousertype(L,1,0));
#if COCOS2D_DEBUG >= 1
if (nullptr == self) {
tolua_error(L,"invalid 'self' in function 'lua_cocos2dx_PageView_addEventListenerPageView'\n", NULL);
return 0;
}
#endif
argc = lua_gettop(L) - 1;
if (1 == argc)
{
#if COCOS2D_DEBUG >= 1
if (!toluafix_isfunction(L,2,"LUA_FUNCTION",0,&tolua_err) )
{
goto tolua_lerror;
}
#endif
LuaCocoStudioEventListener* listener = LuaCocoStudioEventListener::create();
if (nullptr == listener)
{
tolua_error(L,"LuaCocoStudioEventListener create fail\n", NULL);
return 0;
}
LUA_FUNCTION handler = ( toluafix_ref_function(L,2,0));
ScriptHandlerMgr::getInstance()->addObjectHandler((void*)listener, handler, ScriptHandlerMgr::HandlerType::STUDIO_EVENT_LISTENER);
self->setUserObject(listener);
self->addEventListenerPageView(listener, pagevieweventselector(LuaCocoStudioEventListener::eventCallbackFunc));
return 0;
}
CCLOG("'addEventListenerPageView' function of PageView has wrong number of arguments: %d, was expecting %d\n", argc, 1);
return 0;
#if COCOS2D_DEBUG >= 1
tolua_lerror:
tolua_error(L,"#ferror in function 'addEventListenerPageView'.",&tolua_err);
return 0;
#endif
}
示例4: PageView
void MultiPageLayout::addPage( Page * page, int pageIndex, PagePosition position )
{
PageView *view = new PageView(page);
view->setSceneRect(0,0,page->width(),page->height());
int fromCol, columnSpan;
switch(position)
{
case SinglePage:
fromCol = 2;
columnSpan = 2;
break;
case DoublePageFirst:
fromCol = 2;
columnSpan = 1;
break;
case DoublePageSecond:
fromCol = 3;
columnSpan = 1;
break;
}
view->setZoom(zoom);
connect(this,SIGNAL(zoomChanged(double)),view,SLOT(setZoom(double)));
addWidget( view , 1, fromCol, 1, columnSpan, Qt::AlignCenter );
PageControlWidget *control = new PageControlWidget(book, page);
addWidget(control,2,fromCol,1,columnSpan, Qt::AlignCenter);
switch(position)
{
case SinglePage:
case DoublePageFirst:
if(bSwapDirection)
{
connect(control,SIGNAL(addPage()),this,SLOT(addPageAfterSecond()));
connect(control,SIGNAL(removePage()),this,SLOT(removeSecondPage()));
connect(control,SIGNAL(addPageFromTemplate(LayoutTemplate*)),this,SLOT(addPageAfterSecond(LayoutTemplate*)));
}
else
{
connect(control,SIGNAL(addPage()),this,SLOT(addPageAfterFirst()));
connect(control,SIGNAL(removePage()),this,SLOT(removeFirstPage()));
connect(control,SIGNAL(addPageFromTemplate(LayoutTemplate*)),this,SLOT(addPageAfterFirst(LayoutTemplate*)));
}
break;
case DoublePageSecond:
if(bSwapDirection)
{
connect(control,SIGNAL(addPage()),this,SLOT(addPageAfterFirst()));
connect(control,SIGNAL(removePage()),this,SLOT(removeFirstPage()));
connect(control,SIGNAL(addPageFromTemplate(LayoutTemplate*)),this,SLOT(addPageAfterFirst(LayoutTemplate*)));
}
else
{
示例5: XOJ_CHECK_TYPE
void XournalView::resetShapeRecognizer()
{
XOJ_CHECK_TYPE(XournalView);
for (size_t i = 0; i < this->viewPagesLen; i++)
{
PageView* v = this->viewPages[i];
v->resetShapeRecognizer();
}
}
示例6: PageView
PageView* PageView::create()
{
PageView* widget = new PageView();
if (widget && widget->init())
{
widget->autorelease();
return widget;
}
CC_SAFE_DELETE(widget);
return nullptr;
}
示例7: switch
void EventBoard::pageViewEvent(Ref *pSender, PageViewEventType type)
{
auto btnBtn1 = dynamic_cast<Button*>(_UINode->getChildByName(EVENTBOARD_BUTTON1));
auto btnBtn2 = dynamic_cast<Button*>(_UINode->getChildByName(EVENTBOARD_BUTTON2));
auto btnBtn3 = dynamic_cast<Button*>(_UINode->getChildByName(EVENTBOARD_BUTTON3));
switch (type)
{
case cocos2d::ui::PAGEVIEW_EVENT_TURNING:
{
PageView* pageView = dynamic_cast<PageView*> (pSender);
int iPage=pageView->getCurPageIndex();
if (iPage >= MAXPAGE) break;
if (iPage == 0)
{
btnBtn1->loadTextures(EVENTBOARD_BTN_ON, EVENTBOARD_BTN_ON, EVENTBOARD_BTN_ON);
btnBtn2->loadTextures(EVENTBOARD_BTN_OFF, EVENTBOARD_BTN_OFF, EVENTBOARD_BTN_OFF);
btnBtn3->loadTextures(EVENTBOARD_BTN_OFF, EVENTBOARD_BTN_OFF, EVENTBOARD_BTN_OFF);
int iNews1 = atoi(DataAccess::getParamValue("NewsTweebotRead", "0").c_str());
if (iNews1 == 0)
{
playAni();
}
else disableAni();
}
else if (iPage==1)
{
btnBtn1->loadTextures(EVENTBOARD_BTN_OFF, EVENTBOARD_BTN_OFF, EVENTBOARD_BTN_OFF);
btnBtn2->loadTextures(EVENTBOARD_BTN_ON, EVENTBOARD_BTN_ON, EVENTBOARD_BTN_ON);
btnBtn3->loadTextures(EVENTBOARD_BTN_OFF, EVENTBOARD_BTN_OFF, EVENTBOARD_BTN_OFF);
int iNews2 = atoi(DataAccess::getParamValue("NewsSlotRead", "0").c_str());
if (iNews2 == 0)
{
playAni();
}
else disableAni();
}
else if (iPage == 2)
{
btnBtn1->loadTextures(EVENTBOARD_BTN_OFF, EVENTBOARD_BTN_OFF, EVENTBOARD_BTN_OFF);
btnBtn2->loadTextures(EVENTBOARD_BTN_OFF, EVENTBOARD_BTN_OFF, EVENTBOARD_BTN_OFF);
btnBtn3->loadTextures(EVENTBOARD_BTN_ON, EVENTBOARD_BTN_ON, EVENTBOARD_BTN_ON);
int iNews3 = atoi(DataAccess::getParamValue("News10000Read", "0").c_str());
if (iNews3 == 0)
{
playAni();
}
else disableAni();
}
}
break;
default:
break;
}
}
示例8: XOJ_CHECK_TYPE
bool XournalView::paste()
{
XOJ_CHECK_TYPE(XournalView);
int p = getCurrentPage();
if (p < 0 || p >= viewPagesLen)
{
return false;
}
PageView* page = viewPages[p];
return page->paste();
}
示例9: main
int main(int argc, char *argv[]) {
QApplication app(argc, argv);
if (argc != 2) {
fprintf(stderr, "Usage: runcible-open-ext-txt <file>");
return 1;
}
QString filename(argv[1]);
QFile file(filename);
QString suffix(QFileInfo(file).suffix());
qDebug() << "Loading" << filename;
QString text;
if (file.open(QIODevice::ReadOnly)) {
qDebug() << "Opened";
text = file.readAll();
qDebug() << "Loaded";
}
RWindow window;
PageView display;
window.layout()->addWidget(&display);
qDebug() << "Added display.";
QObject::connect(&display, SIGNAL(pageCountChanged(int)), &window, SLOT(showTimeline(int)));
QObject::connect(&display, SIGNAL(pageChanged(int)), &window, SLOT(updateTimeline(int)));
window.showMaximized();
QTextDocument doc;
doc.setDefaultTextOption(QTextOption(Qt::AlignJustify));
doc.setMetaInformation(QTextDocument::DocumentUrl, QUrl::fromLocalFile(filename).toString());
if (suffix == "html") {
doc.setHtml(text);
} else {
text.replace(QRegExp("([^\\r\\n])(\\r)?\\n([^\\n\\r])"), "\\1 \\3");
doc.setPlainText(text);
}
qDebug() << "Created doc.";
display.setDocument(filename, &doc);
qDebug() << "Set doc.";
QObject::connect(&window, SIGNAL(back()), &app, SLOT(quit()));
window.showMessage(doc.metaInformation(QTextDocument::DocumentTitle));
return app.exec();
}
示例10: lua_cocos2dx_PageView_addEventListener
static int lua_cocos2dx_PageView_addEventListener(lua_State* L)
{
if (nullptr == L)
return 0;
int argc = 0;
PageView* self = nullptr;
#if COCOS2D_DEBUG >= 1
tolua_Error tolua_err;
if (!tolua_isusertype(L,1,"ccui.PageView",0,&tolua_err)) goto tolua_lerror;
#endif
self = static_cast<PageView*>(tolua_tousertype(L,1,0));
#if COCOS2D_DEBUG >= 1
if (nullptr == self) {
tolua_error(L,"invalid 'self' in function 'lua_cocos2dx_PageView_addEventListener'\n", NULL);
return 0;
}
#endif
argc = lua_gettop(L) - 1;
if (1 == argc)
{
#if COCOS2D_DEBUG >= 1
if (!toluafix_isfunction(L,2,"LUA_FUNCTION",0,&tolua_err) )
{
goto tolua_lerror;
}
#endif
LUA_FUNCTION handler = ( toluafix_ref_function(L,2,0));
self->addEventListener([=](cocos2d::Ref* ref,PageView::EventType eventType){
handleUIEvent(handler, ref, (int)eventType);
});
ScriptHandlerMgr::getInstance()->addCustomHandler((void*)self, handler);
return 0;
}
luaL_error(L, "'addEventListener' function of PageView has wrong number of arguments: %d, was expecting %d\n", argc, 1);
return 0;
#if COCOS2D_DEBUG >= 1
tolua_lerror:
tolua_error(L,"#ferror in function 'addEventListener'.",&tolua_err);
return 0;
#endif
}
示例11: switch
bool LevelManager::init()
{
if (!Layer::init())
{
return false;
}
Size visibleSize = Director::getInstance()->getVisibleSize();
Vec2 origin = Director::getInstance()->getVisibleOrigin();
_selectedLevelIndex = 0;
auto pageView = PageView::create();
pageView->setContentSize(Size(480.0f,320.0f));
pageView->setAnchorPoint(Vec2(0.5,0.5));
pageView->setPosition(Vec2(visibleSize.width/2,visibleSize.height/2));
for (int i = 0; i < 3;++i)
{
Layout* layout = Layout::create();
layout->setContentSize(Size(480.0f,320.0f));
ImageView* _imageView = ImageView::create(StringUtils::format("preview%d.png",i+1));
_imageView->setContentSize(Size(480.0f,320.0f));
_imageView->setPosition(Vec2(layout->getContentSize().width/2.f,layout->getContentSize().height/2.f));
layout->addChild(_imageView);
pageView->insertPage(layout,i);
}
pageView->addEventListener([=](Ref* pSender,PageView::EventType type){
switch (type)
{
case PageView::EventType::TURNING:
{
PageView* pageView = dynamic_cast<PageView*>(pSender);
_selectedLevelIndex = pageView->getCurPageIndex();
}
break;
default:
break;
}
});
this->addChild(pageView,1);
auto start_button = Button::create("btn-start.png");
start_button->setPosition(Vec2(visibleSize.width/2,visibleSize.height*0.2));
start_button->addTouchEventListener([=](Ref* pSender, Widget::TouchEventType type)
{
if (type==Widget::TouchEventType::ENDED)
{
auto transition = TransitionSlideInR::create(1.5,GameScene::createSceneWithLevel(++_selectedLevelIndex));
Director::getInstance()->pushScene(transition);
}
});
this->addChild(start_button, 1);
return true;
}
示例12: XOJ_CHECK_TYPE
PageView* PagePosition::getViewAt(int x, int y)
{
XOJ_CHECK_TYPE(PagePosition);
for (GList* l = this->views; l != NULL; l = l->next)
{
PageView* v = (PageView*) l->data;
if (v->containsPoint(x, y))
{
return v;
}
}
return NULL;
}
示例13: setLatestPhrase
void SearchDialog::gotoPage(int n, Qt::KeyboardModifiers m,
QString uuid, QString phrase) {
setLatestPhrase(phrase);
if (!pgView) {
qDebug() << "SearchDialog: Pageview disappeared on me.";
return;
}
PageView *view = pgView;
ASSERT(view);
if (m & Qt::ShiftModifier)
view = view->newView();
view->gotoEntryPage(n);
view->ensureSearchVisible(uuid, phrase);
view->window()->raise();
}
示例14: pageViewEvent
//the response function of the pageView mobile
void SelectUI::pageViewEvent(Ref *target, PageViewEventType type)
{
if (type== PAGEVIEW_EVENT_TURNING)
{
PageView * pPageView = dynamic_cast<PageView*>(target);
int m_pPage_num=pPageView->getCurPageIndex();
if (m_pPage_num==0)
{
g_Senior = false;
g_Primary = true;
g_Middle = false;
m_pPrimary->loadTextures("./res/PictureRes/VisibleBg.png","./res/PictureRes/VisibleBg.png");
m_pMiddle->loadTextureNormal("./res/PictureRes/IconCover.png");
m_pSenior->loadTextureNormal("./res/PictureRes/IconCover.png");
m_pPrimary->setTitleColor(Color3B(181,178,111));
m_pSenior->setTitleColor(Color3B(227,224,163));
m_pMiddle->setTitleColor(Color3B(227,224,163));
}
if (m_pPage_num==1)
{
g_Senior = false;
g_Primary = false;
g_Middle = true;
m_pPagetView->getPage(1)->setVisible(true);
m_pMiddle->loadTextures("./res/PictureRes/VisibleBg.png","./res/PictureRes/VisibleBg.png");
m_pPrimary->loadTextureNormal("./res/PictureRes/IconCover.png");
m_pSenior->loadTextureNormal("./res/PictureRes/IconCover.png");
m_pMiddle->setTitleColor(Color3B(181,178,111));
m_pSenior->setTitleColor(Color3B(227,224,163));
m_pPrimary->setTitleColor(Color3B(227,224,163));
}
if (m_pPage_num==2)
{
g_Senior = true;
g_Primary = false;
g_Middle = false;
m_pSenior->loadTextures("./res/PictureRes/VisibleBg.png","./res/PictureRes/VisibleBg.png");
m_pPrimary->loadTextureNormal("./res/PictureRes/IconCover.png");
m_pMiddle->loadTextureNormal("./res/PictureRes/IconCover.png");
m_pSenior->setTitleColor(Color3B(181,178,111));
m_pMiddle->setTitleColor(Color3B(227,224,163));
m_pPrimary->setTitleColor(Color3B(227,224,163));
}
}
}
示例15: switch
void UIPageViewTest::pageViewEvent(Ref *pSender, PageView::EventType type)
{
switch (type)
{
case PageView::EventType::TURNING:
{
PageView* pageView = dynamic_cast<PageView*>(pSender);
_displayValueLabel->setString(CCString::createWithFormat("page = %ld", pageView->getCurPageIndex() + 1)->getCString());
}
break;
default:
break;
}
}