void WeatherGuesserApp::createWeatherPage()
{
    QmlDocument *qml = QmlDocument::create().load("WeatherPage.qml");

    if (!qml->hasErrors()) {

        mWeatherPage = qml->createRootNode<Page>();

        if (mWeatherPage) {

            // Set up a weather model the list, the model will load weather data
            ListView *weatherList = mWeatherPage->findChild<ListView*>("weatherList");
            WeatherModel *weatherModel = new WeatherModel(this);
            weatherList->setDataModel(weatherModel);

            // Connect the weather model to page signals that updates city for which model should be shown.
            connect(mContinentCitiesPage, SIGNAL(showWeather(QString)), weatherModel,
                    SLOT(onUpdateWeatherCity(QString)));

            Page *favorites = mNavigation->findChild<Page*>("favorites");
            connect(favorites, SIGNAL(showWeather(QString)), weatherModel,
                    SLOT(onUpdateWeatherCity(QString)));

            qml->documentContext()->setContextProperty("_navigation", mNavigation);
        }
    }
}
void WeatherGuesserApp::createCitiesPage()
{
    QmlDocument *qml = QmlDocument::create().load("ContinentCitiesPage.qml");

    if (!qml->hasErrors()) {

        mContinentCitiesPage = qml->createRootNode<Page>();

        if (mContinentCitiesPage) {

            // Set up a cities model for the page, this model will load different cities depending
            // on which continent is selected.
            ListView *citiesList = mContinentCitiesPage->findChild<ListView*>("citiesList");
            CityModel *cityModel = new CityModel(QStringList() << "name", "continents_connection",
                    this);
            citiesList->setDataModel(cityModel);

            // Connect to the continents page custom signal.
            Page *continents = mNavigation->findChild<Page*>("continents");
            connect(continents, SIGNAL(showContinentCities(QString)), cityModel,
                    SLOT(onChangeContinent(QString)));

            qml->documentContext()->setContextProperty("_navigation", mNavigation);
        }
    }
}
ListView *QuotesApp::setUpQuotesList()
{
    ListView *listView = 0;

    // Load the quotes table from the database.
    QVariantList sqlData = mQuotesDbHelper->loadDataBase("quotes.db", "quotes");

    if (!sqlData.isEmpty()) {

        // A GroupDataModel is used for creating a sorted list.
        mDataModel = new GroupDataModel(QStringList() << "lastname" << "firstname");
        mDataModel->setParent(this);
        mDataModel->setGrouping(ItemGrouping::ByFirstChar);
        mDataModel->insert(sqlData);

        // The list view is set up in QML, here we retrieve it to connect it to
        // a data model.
        listView = mNav->findChild<ListView*>("quotesList");
        listView->setDataModel(mDataModel);

        // By connecting to the selectionChanged signal we can find out when selection has
        // changed and update the content pane information based on the selected item.
        QObject::connect(listView, SIGNAL(selectionChanged(const QVariantList, bool)), this,
                SLOT(onListSelectionChanged(const QVariantList, bool)));

        // Connect to the models item added and updated signals, since we want to 
        // select the item in the list if it has been manipulated.
        QObject::connect(mDataModel, SIGNAL(itemAdded(QVariantList)), this,
            SLOT(onModelUpdate(QVariantList)));

        QObject::connect(mDataModel, SIGNAL(itemUpdated(QVariantList)), this,
            SLOT(onModelUpdate(QVariantList)));
        
    }
void TrialPanel::selectedItemEvent(Ref *pSender, ListView::EventType type)
{
    switch (type)
    {
    case cocos2d::ui::ListView::EventType::ON_SELECTED_ITEM_START:
    {
        ListView* listView = static_cast<ListView*>(pSender);
        CC_UNUSED_PARAM(listView);
        CCLOG("select child start index = %ld", listView->getCurSelectedIndex());
        //auto tag = listView->getItem(listView->getCurSelectedIndex())->getTag();
        //auto endStatUnit = _endStatsUnit.at(listView->getCurSelectedIndex());
        break;
    }
    case cocos2d::ui::ListView::EventType::ON_SELECTED_ITEM_END:
    {
        ListView* listView = static_cast<ListView*>(pSender);
        CC_UNUSED_PARAM(listView);
        CCLOG("select child end index = %ld", listView->getCurSelectedIndex());

        /*auto unit = listView->getItem(listView->getCurSelectedIndex());
        auto achieve = static_cast<Achievement*>(unit->getUserData());*/
        break;
    }
    default:
        break;
    }
}
  void create() {
    setTitle("Test Application");
    setGeometry(Geometry(128, 128, 640, 480 ));

    layout.append(bProcess);
    layout.append(lvOutput);
    layout.append(baseN);
    layout.append(baseR);

    unsigned bn = integer(baseN.text()), br = integer(baseR.text());
    if (br>=0 && br<=bn) {
       lstring hdr;
       for (unsigned i = 0; i < br; ++i) {
     	  hdr.append((string){i>0?",":"","B",i+1});
       }
       lvOutput.setHeaderText(hdr);
    }

    bProcess.setText("Draw!");
    bProcess.onActivate = [&]() {
       lvOutput.reset();

    };

    //Hook it all up
    append(layout);

    onClose = [&layout] {
    //	layout.setSkipGeomUpdates(true); //Example of skipping pointless update calculations.
    	OS::quit();
    };

    setVisible();
  }
void WeatherGuesserApp::setUpHomePage()
{
    mHomeCityPage = mNavigation->findChild<Page*>("homeCityPage");

    // Set a weather model
    ListView *weatherList = mHomeCityPage->findChild<ListView*>("weatherList");
    WeatherModel *homeWeatherModel = new WeatherModel(this);
    weatherList->setDataModel(homeWeatherModel);

    // The home town can be set from two different lists, so we have to connect to
    // their signals
    ListView *favList = mNavigation->findChild<ListView*>("favoritesList");
    connect(favList, SIGNAL(updateHomeCity(QString)), homeWeatherModel,
            SLOT(onUpdateWeatherCity(QString)));

    ListView *citiesList = mContinentCitiesPage->findChild<ListView*>("citiesList");
    connect(citiesList, SIGNAL(updateHomeCity(QString)), homeWeatherModel,
            SLOT(onUpdateWeatherCity(QString)));

    // In addition we connect the application to the same signals so we can store the home town in the app settings.
    connect(favList, SIGNAL(updateHomeCity(QString)), this, SLOT(onUpdateHomeCity(QString)));
    connect(citiesList, SIGNAL(updateHomeCity(QString)), this, SLOT(onUpdateHomeCity(QString)));

    // Start loading weather data for the home page, if no home town is stored in
    // the application settings London is loaded as the home town.
    QSettings settings;
    QString homeTown = "London";
    if (!settings.value("homeCity").isNull()) {
        homeTown = settings.value("homeCity").toString();
    }
    homeWeatherModel->onUpdateWeatherCity(homeTown);
    mHomeCityPage->setProperty("city", QVariant(homeTown));
}
Example #7
0
/**
 * Creates and adds main layout to the screen.
 */
void SettingsScreen::createMainLayout()
{

    VerticalLayout* mainLayout = new VerticalLayout();
    Screen::setMainWidget(mainLayout);

    ListView* listView = new ListView();
    listView->fillSpaceHorizontally();
    listView->fillSpaceVertically();
    mainLayout->addChild(listView);

    ListViewItem* listItem;

    // Add IP label and edit box
    mIPEditBox = new EditBox();
    mIPEditBox->setInputMode(EDIT_BOX_INPUT_MODE_NUMERIC);
    listView->addChild(this->createListViewItem(IP_LABEL_TEXT, mIPEditBox));

    // Add port label and edit box
    mPortEditBox = new EditBox();
    mPortEditBox->setInputMode(EDIT_BOX_INPUT_MODE_NUMERIC);
    listView->addChild(this->createListViewItem(PORT_LABEL_TEXT, mPortEditBox));

    if ( isAndroid() )
    {
        mShowOnlyIfInBackground = new CheckBox();
        mShowOnlyIfInBackground->setState(true);
        listView->addChild(createListViewItem(SHOW_ONLY_IF_NOT_RUNNING, mShowOnlyIfInBackground));

        mTickerText = new EditBox();
        mTickerText->setText(TICKER_DEFAULT);
        listView->addChild(createListViewItem(TICKER_LABEL, mTickerText));

        mContentTitle = new EditBox();
        mContentTitle->setText(TITLE_DEFAULT);
        listView->addChild(createListViewItem(TITLE_LABEL, mContentTitle));
    }

    // Android: If the registrationID was already saved from previous launches,
    // do not connect again.
    MAHandle myStore = maOpenStore("MyStore", 0);
    if ( isAndroid() && myStore == STERR_NONEXISTENT
            ||
            !isAndroid() )
    {
        // Add connection status label.
        listItem = new ListViewItem;
        listView->addChild(listItem);
        mConnectionStatusLabel = new Label();
        mConnectionStatusLabel->setText(CONNECTION_NOT_ESTABLISHED);
        listItem->addChild(mConnectionStatusLabel);

        listItem = new ListViewItem;
        listView->addChild(listItem);
        mConnectButton = new Button();
        mConnectButton->setText(CONNECT_BUTTON_TEXT);
        listItem->addChild(mConnectButton);
    }
}
static int lua_cocos2dx_ListView_addEventListenerListView(lua_State* L)
{
    if (nullptr == L)
        return 0;
    
    int argc = 0;
    ListView* self = nullptr;
    
#if COCOS2D_DEBUG >= 1
    tolua_Error tolua_err;
	if (!tolua_isusertype(L,1,"ccui.ListView",0,&tolua_err)) goto tolua_lerror;
#endif
    
    self = static_cast<ListView*>(tolua_tousertype(L,1,0));
    
#if COCOS2D_DEBUG >= 1
	if (nullptr == self) {
		tolua_error(L,"invalid 'self' in function 'lua_cocos2dx_ListView_addEventListenerListView'\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* listern = LuaCocoStudioEventListener::create();
        if (nullptr == listern)
        {
            tolua_error(L,"LuaCocoStudioEventListener create fail\n", NULL);
            return 0;
        }
        
        LUA_FUNCTION handler = (  toluafix_ref_function(L,2,0));
        
        ScriptHandlerMgr::getInstance()->addObjectHandler((void*)listern, handler, ScriptHandlerMgr::HandlerType::STUDIO_EVENT_LISTENER);
        
        self->setUserObject(listern);
        self->addEventListenerListView(listern, listvieweventselector(LuaCocoStudioEventListener::eventCallbackFunc));
        
        return 0;
    }
    
    CCLOG("'addEventListenerListView' function of ListView 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 'addEventListenerListView'.",&tolua_err);
    return 0;
#endif
}
Example #9
0
int main(int argc, char **argv) {
    QApplication app(argc, argv);

    ListView *piv = new ListView();
    app.setMainWidget(piv);
    piv->show();

    return app.exec();
}
Example #10
0
static void Application_processMessageQueue() {
  while(!messageQueue.empty()) {
    Message message = messageQueue.takeFirst();
    if(message.type == Message::Type::ListView_OnActivate) {
      ListView* listView = (ListView*)message.object;
      if(listView->onActivate) listView->onActivate();
    }
  }
}
Example #11
0
/**
 * Creates and adds main layout to the screen.
 */
void SettingsScreen::createMainLayout() {
	// Create and add the main layout to the screen.
	VerticalLayout* mainLayout = new VerticalLayout();
	Screen::setMainWidget(mainLayout);

	ListView* listView = new ListView();
	mainLayout->addChild(listView);

	// Add set duration option row.
	this->addSetDurationRow(listView);

	// Add get duration option row.
	this->addGetDurationRow(listView);

	// Add options for setting and getting the video quality value.
	this->addVideoQualityRows(listView);

	if ( isIOS())
	{
		// Add options for setting and getting the flash mode value.
		this->addFlashModeRows(listView);

		// Add option for setting the camera roll flag.
		this->addCameraRollFlagRow(listView);

		// Add option for setting the camera controls flag.
		this->addCameraControlsFlagRow(listView);
	}

	// Add take picture button.
	mTakePictureBtn = new Button();
	mTakePictureBtn->setText(TAKE_PICTURE_BTN_TEXT);
	this->addButtonToListView(mTakePictureBtn, listView);

	if (isAndroid())
	{
		mTakenPicturePath = new Label();
		ListViewItem* listItem = new ListViewItem();
		listItem->addChild(mTakenPicturePath);
		listView->addChild(listItem);
	}

	// Add record video button.
	mRecordVideoBtn = new Button();
	mRecordVideoBtn->setText(RECORD_VIDEO_BTN_TEXT);
	this->addButtonToListView(mRecordVideoBtn, listView);

	// Add show image button.
	mShowImageScreen = new Button();
	mShowImageScreen->setText(SHOW_IMAGE_SCREEN_TEXT);
	this->addButtonToListView(mShowImageScreen, listView);

	// Add show video screen button.
	mShowVideoScreen = new Button();
	mShowVideoScreen->setText(SHOW_VIDEO_SCREEN_TEXT);
	this->addButtonToListView(mShowVideoScreen, listView);
}
Example #12
0
// ListView触摸监听
void TujiLayer::selectedItemEvent(Ref* pSender, ListViewEventType  type)//ListView触摸事件
{
	ListView* listView = static_cast<ListView*>(pSender);
	CC_UNUSED_PARAM(listView);

// 	if (m_iBeforeSel == listView->getCurSelectedIndex())
// 	{
// 		return;
// 	}
// 	String *normalBtn = String::createWithFormat("Cell_%d.png", m_iBeforeSel);
// 	String *SelctBtn = String::createWithFormat("CellSel_%d.png", listView->getCurSelectedIndex());

	m_iBeforeSel = listView->getCurSelectedIndex();

	switch (m_iBeforeSel)
	{
	case 0:
		m_pMZ_Pic->setVisible(true);
		m_pMZ_Txt->setVisible(true);
		m_pMZLabel->setVisible(true);
		m_pLion_Pic->setVisible(false);
		m_pLionLabel->setVisible(false);
		m_pStone_Pic->setVisible(false);
		m_pStoneLabel->setVisible(false);
		break;
	case 1:
		m_pMZ_Pic->setVisible(false);
		m_pMZLabel->setVisible(false);
		m_pMZ_Txt->setVisible(false);
		m_pLionLabel->setVisible(true);
		m_pLion_Pic->setVisible(true);
		m_pStoneLabel->setVisible(false);
		m_pStone_Pic->setVisible(false);
		break;
	case 2:
		m_pMZ_Pic->setVisible(false);
		m_pMZ_Txt->setVisible(false);
		m_pMZLabel->setVisible(false);
		m_pLion_Pic->setVisible(false);
		m_pLionLabel->setVisible(false);
		m_pStone_Pic->setVisible(true);
		m_pStoneLabel->setVisible(true);
		break;
	case 3:
		m_pMZ_Pic->setVisible(false);
		m_pMZ_Txt->setVisible(false);
		m_pLion_Pic->setVisible(false);
		m_pStone_Pic->setVisible(false);
		m_pLionLabel->setVisible(false);
		m_pStoneLabel->setVisible(false);
		m_pMZLabel->setVisible(false);
		break;
	default:
		break;
	}
}
Example #13
0
int main(int argc, char **argv)
{
  QApplication app(argc,argv);
  ListView *window = new ListView();

  app.setMainWidget(window);
  window->show();

  return app.exec();
}
Example #14
0
void MainMenu::onListSelectionChanged(const QVariantList indexPath) {

	if (sender()) {
		ListView* menuList = dynamic_cast<ListView*>(sender());
		DataModel* menuModel = menuList->dataModel();

		QVariantMap map = menuModel->data(indexPath).toMap();
		if (map["itemName"].canConvert(QVariant::String)) {
			QString item = map["itemName"].toString();

			qDebug() << "XXXX selected item name=" << item;

			if (item.compare("item_read") == 0) {
				qDebug() << "XXXX Read Tag was selected!";
				StateManager* state_mgr = StateManager::getInstance();
				state_mgr->setEventLogShowing(true);
				_eventLog->setMessage("Bring a tag close");
				emit read_selected();

			} else if (item.compare("item_uri") == 0) {
				qDebug() << "XXXX Write URI was selected!";
				emit write_uri();

			} else if (item.compare("item_sp") == 0) {
				qDebug() << "XXXX Write SP was selected!";
				emit write_sp();

			} else if (item.compare("item_text") == 0) {
				qDebug() << "XXXX Write Text was selected!";
				emit write_text();

			} else if (item.compare("item_custom") == 0) {
				qDebug() << "XXXX Write Custom was selected!";
				emit write_custom();

			} else if (item.compare("item_about") == 0) {
				qDebug() << "XXXX About was selected!";
				emit about_selected();

			} else if (item.compare("item_snep_vcard") == 0) {
				qDebug() << "XXXX Send vCard (SNEP) was selected!";
				emit send_vcard_selected();

			} else if (item.compare("item_emulate_tag") == 0) {
				qDebug() << "XXXX Emulate Tag was selected!";
				emit emulate_tag_selected();
			} else if (item.compare("item_iso7816") == 0) {
				qDebug() << "XXXX ISO7816 APDU was selected!";
				StateManager* state_mgr = StateManager::getInstance();
				state_mgr->setEventLogShowing(true);
				emit iso7816_selected();
			}
		}
	}
}
Example #15
0
void
ReportList::slotView()
{
    ListView* list = (ListView*)_stack->visibleWidget();
    if (list == NULL) return;
    ListViewItem* item = list->currentItem();
    if (item == NULL) return;

    QApplication::setOverrideCursor(waitCursor);
    qApp->processEvents();

    QString fileName = item->extra[0].toString();
    QString filePath;
    if (!_quasar->resourceFetch("reports", fileName, filePath)) {
	QApplication::restoreOverrideCursor();

	QString message = tr("Error fetching report '%1'").arg(fileName);
	qApp->beep();
	QMessageBox::critical(this, tr("Error"), message);
	return;
    }

    ReportDefn report;
    if (!report.load(filePath)) {
	QApplication::restoreOverrideCursor();

	QString message = tr("Report '%1' is invalid").arg(fileName);
	qApp->beep();
	QMessageBox::critical(this, tr("Error"), message);
	return;
    }

    QApplication::restoreOverrideCursor();

    ParamMap params;
    if (!report.getParams(this, params))
	return;

    QApplication::setOverrideCursor(waitCursor);
    qApp->processEvents();

    ReportOutput* output = new ReportOutput();
    if (!report.generate(params, *output)) {
	QApplication::restoreOverrideCursor();
	delete output;
	QString message = tr("Report '%1' failed").arg(fileName);
	qApp->beep();
	QMessageBox::critical(this, tr("Error"), message);
	return;
    }

    QApplication::restoreOverrideCursor();
    ReportViewer* view = new ReportViewer(report, params, output);
    view->show();
}
Example #16
0
  void select() {
    videoPanel.setVisible(false);
    audioPanel.setVisible(false);
    inputPanel.setVisible(false);

    if(list.selected()) switch(list.selection()) {
    case 0: return videoPanel.setVisible();
    case 1: return audioPanel.setVisible();
    case 2: return inputPanel.setVisible();
    }
  }
Example #17
0
ListView* ListView::create()
{
    ListView* widget = new ListView();
    if (widget && widget->init())
    {
        widget->autorelease();
        return widget;
    }
    CC_SAFE_DELETE(widget);
    return nullptr;
}
Example #18
0
void RocknRoll::parseJSON() {
	GroupDataModel *model = new GroupDataModel(QStringList() << "artist" << "song" << "genre" << "year");

	JsonDataAccess jda;
	QVariant list = jda.load("dummy.json");

	model->insertList(list.value<QVariantList>());

	ListView *listView = new ListView();
	listView->setDataModel(model);
}
Example #19
0
	ListView* ListView::create(CCSize size, CCNode* container/* = NULL*/)
	{
		ListView* pRet = new ListView();
		if (pRet && pRet->initWithViewSize(size, container))
		{
			pRet->autorelease();
		}
		else
		{
			CC_SAFE_DELETE(pRet);
		}
		return pRet;
	}
Example #20
0
const Rev* ListViewDelegate::revLookup(int row, FileHistory** fhPtr) const {

	ListView* lv = static_cast<ListView*>(parent());
	FileHistory* fh = static_cast<FileHistory*>(lv->model());

	if (lp->sourceModel())
		fh = static_cast<FileHistory*>(lp->sourceModel());

	if (fhPtr)
		*fhPtr = fh;

	return git->revLookup(lv->sha(row), fh);
}
Example #21
0
	ListView* ListView::create()
	{
		ListView* pRet = new ListView();
		if (pRet && pRet->init())
		{
			pRet->autorelease();
		}
		else
		{
			CC_SAFE_DELETE(pRet);
		}
		return pRet;
	}
Example #22
0
ContactDragObject::~ContactDragObject()
{
    ListView *view = static_cast<ListView*>(parent());
    if (view && view->m_pressedItem){
        //ListViewItem *item = view->m_pressedItem;
        view->m_pressedItem = NULL;
        //view->update(view->model()->index(item->row(), item->column()));
        view->update();
    }
    Contact *contact = getContacts()->contact(m_id);
    if (contact && (contact->getFlags() & CONTACT_DRAG))
        delete contact;
}
static int lua_cocos2dx_ListView_addScrollViewEventListener(lua_State* L)
{
    if (nullptr == L)
        return 0;
    
    int argc = 0;
    ListView* self = nullptr;
    
#if COCOS2D_DEBUG >= 1
    tolua_Error tolua_err;
	if (!tolua_isusertype(L,1,"ccui.ListView",0,&tolua_err)) goto tolua_lerror;
#endif
    
    self = static_cast<ListView*>(tolua_tousertype(L,1,0));
    
#if COCOS2D_DEBUG >= 1
	if (nullptr == self) {
		tolua_error(L,"invalid 'self' in function 'lua_cocos2dx_ListView_addScrollViewEventListener'\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));
        
        auto scrollViewCallback = [=](cocos2d::Ref* ref, ui::ScrollView::EventType eventType){
            handleUIEvent(handler, ref, (int)eventType);
        };
        self->addEventListener((ui::ScrollView::ccScrollViewCallback)scrollViewCallback);
        
        ScriptHandlerMgr::getInstance()->addCustomHandler((void*)self, handler);
        return 0;
    }
    
    luaL_error(L, "'addScrollViewEventListener' function of ListView 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 'addScrollViewEventListener'.",&tolua_err);
    return 0;
#endif
}
Example #24
0
void BMCategoriesForm::UpdateState()
{
  ListView * pList = static_cast<ListView *>(GetControl(IDC_LISTVIEW, true));
  pList->UpdateList();

  Header* pHeader = GetHeader();

  ButtonItem buttonItem;
  buttonItem.Construct(BUTTON_ITEM_STYLE_TEXT, ID_EDIT);
  buttonItem.SetText(m_bEditState ? GetString(IDS_DONE): GetString(IDS_EDIT));

  pHeader->SetButton(BUTTON_POSITION_RIGHT, buttonItem);
  Invalidate(true);
}
void PhotoSelectSence::selectedPhotoEvent(Ref *pSender, ListViewEventType type)
{
    switch (type)
    {
        case LISTVIEW_ONSELECTEDITEM_START:
        {
            ListView* listView = static_cast<ListView*>(pSender);
            CC_UNUSED_PARAM(listView);
            CCLOG("select child start index = %ld", listView->getCurSelectedIndex());
			_selectPhotoStarted = true;
			_selectPhotoStartIndex = listView->getCurSelectedIndex();
            break;
        }
        case LISTVIEW_ONSELECTEDITEM_END:
        {
            ListView* listView = static_cast<ListView*>(pSender);
            CC_UNUSED_PARAM(listView);
            CCLOG("select child end index = %ld", listView->getCurSelectedIndex());
			// 点击起始的Index和点击结束的Index一致才能为有效选择
			if (_selectPhotoStartIndex == listView->getCurSelectedIndex())
			{
				// 先原来的照片停止闪
				((ImageViewWithSelectBox*)listView->getItem(_selectedPhotoIndex))->stopBlink();
				// 再选中的照片开始闪
				((ImageViewWithSelectBox*)listView->getItem(_selectPhotoStartIndex))->startBlink();
				// 更新索引
				_selectedPhotoIndex = _selectPhotoStartIndex;
				_selectPhotoStartIndex = -1;
			}
            break;
        }
        default:
            break;
    }
}
Example #26
0
result BMCategoriesForm::OnInitializing(void)
{
  m_bEditState = false;
  m_categoryToDelete = -1;

  ListView * pList = static_cast<ListView *>(GetControl(IDC_LISTVIEW, true));
  pList->SetItemProvider(*this);
  pList->AddListViewItemEventListener(*this);

  GetHeader()->AddActionEventListener(*this);

  SetFormBackEventListener(this);
  UpdateState();
  return E_SUCCESS;
}
 void ListViewReader::setPropsFromJsonDictionary(Widget *widget, const rapidjson::Value &options)
 {
     ScrollViewReader::setPropsFromJsonDictionary(widget, options);
     
     
     ListView* listView = static_cast<ListView*>(widget);
             
     int direction = DICTOOL->getFloatValue_json(options, P_Direction,2);
     listView->setDirection((ScrollView::Direction)direction);
     
     ListView::Gravity gravity = (ListView::Gravity)DICTOOL->getIntValue_json(options, P_Gravity,3);
     listView->setGravity(gravity);
     
     float itemMargin = DICTOOL->getFloatValue_json(options, P_ItemMargin);
     listView->setItemsMargin(itemMargin);
 }        
void MainScene2::Up_answer_ClickCallback(Ref * pSender)
{
	ListView * answerlist = static_cast<ListView*>(rootNode->getChildByName("ListView"));
	//获取回答的内容
	TextField * answer_content_TF = static_cast<TextField *>
		(answerlist->getItem(1 + this_page_answer_num)->getChildByTag(0)->getChildByName("TextField_answer"));
	answerContent = answer_content_TF->getString();

	kind_of_serve = UP_ANSWER;
	connectServer();

	Text * text_tag = static_cast<Text *>
		(answerlist->getItem(1 + this_page_answer_num)->getChildByTag(0)->getChildByName("Text_tag"));
	text_tag->setText("Answer successful!");//提示回答成功
	refresh_view();
}
void StampCollectorApp::onSelectionChanged(const QVariantList indexPath, bool selected)
{
    if (selected) {
        // We use the sender to get the list view for accessing the data model and then the actual data.
        if(sender()) {
            ListView* stampList = dynamic_cast<ListView*>(sender());
            DataModel* stampModel = stampList->dataModel();

            // Update the content view context property so that it corresponds to
            // the selected item and navigate to the page.
            QVariantMap map = stampModel->data(indexPath).toMap();
            mQmlContext->setContextProperty("_contentView", map);
            mNav->push(mContentPage);
        }
    }
}
Example #30
0
  AudioPanel() {
    setMargin(5);
    append(spacer, 120, ~0, 5);
    append(layout, ~0, ~0);
    label.setFont("Sans, 16, Bold");
    label.setText("Audio");
    list.setCheckable();
    list.append("Item");
    list.append("Item");
    list.append("Item");
    list.append("Item");
    list.append("Item");
    layout.append(label, ~0, 0, 5);
    layout.append(list, ~0, ~0);

    list.onTick = [&](unsigned n) { print("Row ", n, "\n"); };
  }