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


C++ SArray类代码示例

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


在下文中一共展示了SArray类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: Clip

 void Mesh::Clip(const Plane            & plane, 
                 SArray< Vec3<double> > & positivePart, 
                 SArray< Vec3<double> > & negativePart) const
 {
     const size_t nV = GetNPoints();
     if (nV == 0)
     {
         return;
     }       
     double d;
     for (size_t v = 0; v < nV; v++)
     {
         const Vec3<double> & pt =  GetPoint(v);
         d     = plane.m_a * pt[0] + plane.m_b * pt[1] + plane.m_c * pt[2] + plane.m_d;
         if (d > 0.0)
         {
             positivePart.PushBack(pt);
         }
         else if (d < 0.0)
         {
             negativePart.PushBack(pt);
         }
         else
         {
             positivePart.PushBack(pt);
             negativePart.PushBack(pt);
         }
     }
 }
开发者ID:K-Tone,项目名称:v-hacd,代码行数:29,代码来源:vhacdMesh.cpp

示例2: get_toolbar

void
MainWindow::add_toolbar_button(DebuggerCommand* cmd,
                               const string& tip,
                               const char* stock,
                               SArray& pixmap,
                               Properties& prop)
{
    ToolBar* toolbar = get_toolbar(prop);

    if (pixmap.empty())
    {
        pixmap.push_back("");
    }
    SArray noArg;

    Widget* btn =
        CHKPTR(toolbar)->add_button(
            pixmap.cstrings(),
            tip.c_str(),
            Gtk_BIND(Gtk_SLOT(this, &MainWindow::run_macro), cmd, noArg),
            uisAttachedThreadStop, // FIXME: let the caller specify it
            cmd->name(),
            stock);

    btn->show_all();
    commandMap_[cmd] = btn;
}
开发者ID:Panke,项目名称:zerobugs,代码行数:27,代码来源:main_win_toolbar.cpp

示例3: dialog

void
MainWindow::toolbar_entry_dialog(DebuggerCommand* command,
                                 Properties* cmdProperties)
{
    const string msg = cmdProperties->get_string("message", "");
    EntryDialog dialog(msg, debugger().properties(), command->name());

    SArray args;

    string userString = dialog.run();
    if (!userString.empty())
    {
        args.push_back(userString);
        run_macro(command, args);
    }
}
开发者ID:Panke,项目名称:zerobugs,代码行数:16,代码来源:main_win_toolbar.cpp

示例4: insertLeaf

	/**
	* put a leaf in the tree
	*/
	void insertLeaf(SString & fullPubName, SArray<SString> &pathToLeaf, int indexOfChildName){
		if ((unsigned)indexOfChildName == pathToLeaf.size()){
			// we are in the leaf node
			if ((getType() & LEAF) == LEAF){
				// node already leaf - should NEVER happen - we are trying to 
				//insert a leaf where there is already one
				throw BrowseException();
			}
			
			// make the node a leaf (or leaf branch)
			nodeType = (TreeNodeType)(nodeType | LEAF);
			pubName = fullPubName;
			return;
		}


		// make the node a branch (or leaf branch)
		nodeType = (TreeNodeType)(nodeType | BRANCH);

		SString childNameToLookFor = pathToLeaf[indexOfChildName];
		TreeNode * child = children[childNameToLookFor];
		if (child == NULL){
			child = new TreeNode(childNameToLookFor);
			AddChild(child);
		}
		// Insert leaf lower down the tree
		child->insertLeaf(fullPubName, pathToLeaf, indexOfChildName+1);
	}
开发者ID:waqarphd,项目名称:RPCDCS,代码行数:31,代码来源:Browser.cpp

示例5: main

int main () {
  SArray<int>* a = new SArray<int>(5, 7, 0);
  cout << "initialized" << endl;

  a->insert(3, 5, 8);
  cout << "first insert" << endl;
  a->insert(3, 6, 20);
  cout << "second insert" << endl;
  a->insert(1, 2, 40);
  cout << "third insert" << endl;
  cout << "inserted" << endl;

  cout << "accessed: " << a->access(3, 5) << endl;
  cout << "accessed: " << a->access(1, 1) << endl;

  a->remove(3, 6);
  a->remove(1, 1);

  a->print();
  delete a;
  return 0;
}
开发者ID:nickrod518,项目名称:csci333-project2,代码行数:22,代码来源:sarray_tester.cpp

示例6: if

	void MeshDecimator::EdgeCollapse(long v1, long v2)
	{
		long u, w;
		int shift;
		long idTriangle;
		for(size_t itT = 0; itT < m_vertices[v2].m_triangles.Size(); ++itT)
		{
            idTriangle =  m_vertices[v2].m_triangles[itT];
			if (m_triangles[idTriangle].X() == v2)
			{
				shift = 0;
				u = m_triangles[idTriangle].Y();
				w = m_triangles[idTriangle].Z();
			}
			else if (m_triangles[idTriangle].Y() == v2)
			{
				shift = 1;
				u = m_triangles[idTriangle].X();
				w = m_triangles[idTriangle].Z();
			}
			else
			{
				shift = 2;
				u = m_triangles[idTriangle].X();
				w = m_triangles[idTriangle].Y();
			}

			if ((u == v1) || (w == v1))
			{
				m_trianglesTags[idTriangle] = false;
				m_vertices[u].m_triangles.Erase(idTriangle);						
				m_vertices[w].m_triangles.Erase(idTriangle);
				m_nTriangles--;
			}
			else if (GetTriangle(v1, u, w) == -1)
			{
				m_vertices[v1].m_triangles.Insert(idTriangle);
				m_triangles[idTriangle][shift] = v1;
			}
			else
			{
				m_trianglesTags[idTriangle] = false;
				m_vertices[u].m_triangles.Erase(idTriangle);						
				m_vertices[w].m_triangles.Erase(idTriangle);
				m_nTriangles--;
			}
		}
        long idEdge = 0;
		for(size_t itE = 0; itE < m_vertices[v2].m_edges.Size(); ++itE)
		{
            idEdge = m_vertices[v2].m_edges[itE];
			w = (m_edges[idEdge].m_v1 == v2)? m_edges[idEdge].m_v2 : m_edges[idEdge].m_v1;
			if (w==v1)
			{
				m_edges[idEdge].m_tag = false;
				m_vertices[w].m_edges.Erase(idEdge);
				m_nEdges--;
			}
			else if ( GetEdge(v1, w) == -1)
			{
				if (m_edges[idEdge].m_v1 == v2)	m_edges[idEdge].m_v1 = v1;
				else							m_edges[idEdge].m_v2 = v1;
				m_vertices[v1].m_edges.Insert(idEdge);			
			}
			else
			{
				m_edges[idEdge].m_tag = false;
				m_vertices[w].m_edges.Erase(idEdge);
				m_nEdges--;
			}
		}
		m_vertices[v2].m_tag = false;
		m_nVertices--;
		// update boundary edges
		SArray<long, 64> incidentVertices;
		incidentVertices.PushBack(v1);
		for(size_t itE = 0; itE < m_vertices[v1].m_edges.Size(); ++itE)
		{
			incidentVertices.PushBack((m_edges[idEdge].m_v1!= v1)?m_edges[idEdge].m_v1:m_edges[idEdge].m_v2);
            idEdge = m_vertices[v1].m_edges[itE];
			m_edges[idEdge].m_onBoundary = (IsBoundaryEdge(m_edges[idEdge].m_v1, m_edges[idEdge].m_v2) != -1);
		}		
		// update boundary vertices
		long idVertex;
		for(size_t itV = 0; itV < incidentVertices.Size(); ++itV)
		{
			idVertex = incidentVertices[itV];
			m_vertices[idVertex].m_onBoundary = false;
			for(size_t itE = 0; itE < m_vertices[idVertex].m_edges.Size(); ++itE)
			{
				idEdge = m_vertices[idVertex].m_edges[itE];
				if (m_edges[idEdge].m_onBoundary)
				{
					m_vertices[idVertex].m_onBoundary = true;
					break;
				}
			}
		}		
	}
开发者ID:akreshuk,项目名称:sopnet,代码行数:99,代码来源:hacdMeshDecimator.cpp

示例7: ExecuteScript

    VARIANT ExecuteScript(IWebBrowser2 *pWebBrowser, const SStringW & fun,SArray<SStringW> & params)
    {
        VARIANT varErr;
        VariantInit( &varErr );

        //get document dispatch interface
        IDispatch* pDisp = NULL;

        HRESULT hr = pWebBrowser->get_Document( &pDisp );

        if ( FAILED( hr ) || pDisp == NULL )
        {
            return varErr;
        }

        IHTMLDocument2* pDoc = NULL;
        pDisp->QueryInterface( IID_IHTMLDocument2,(void**)&pDoc );
        pDisp->Release();

        IDispatch* pScript = NULL;
        hr = pDoc->get_Script( &pScript );
        pDoc->Release();

        if ( FAILED( hr ) || pScript == NULL )
        {
            return varErr;
        }

        sbstr bstrMember((int)fun.GetLength(),fun );
        DISPID dispid = 0;
        BSTR bstr = (BSTR)bstrMember;
        hr = pScript->GetIDsOfNames( IID_NULL,&(bstr),1,LOCALE_SYSTEM_DEFAULT,&dispid );

        if ( FAILED( hr ) )
        {
            return varErr;
        }

        DISPPARAMS dispparams;
        ::ZeroMemory( &dispparams,sizeof( DISPPARAMS ) );
        dispparams.cArgs = (UINT)params.GetCount();
        dispparams.rgvarg = new VARIANT[dispparams.cArgs];
        dispparams.cNamedArgs = 0;

        for ( size_t i = 0;i < params.GetCount();i++ )
        {
            size_t indx = params.GetCount() - i - 1;
            sbstr bstrParam((int)params[indx].GetLength(),params[indx]);
            dispparams.rgvarg[i].bstrVal = bstrParam.Release();
            dispparams.rgvarg[i].vt = VT_BSTR;
        }

        EXCEPINFO excepinfo;
        ::ZeroMemory( &excepinfo,sizeof( EXCEPINFO ) );
        VARIANT varRet;
        UINT nArgErr = (UINT)-1;	//initialize to invalid arg

        hr = pScript->Invoke( dispid,IID_NULL,0,DISPATCH_METHOD,&dispparams,&varRet,&excepinfo,&nArgErr );

        delete []dispparams.rgvarg;
        pScript->Release();

        if ( FAILED( hr ) )
        {
            return varErr;
        }

        return varRet;
    }
开发者ID:FuckGOV,项目名称:soui,代码行数:69,代码来源:SDocHostUIHandler.cpp

示例8: ComputeEdgeCost

	double MeshDecimator::ComputeEdgeCost(long v1, long v2, Vec3<Float> & newPos) const
	{
		double Q[10];
		double M[12];
		Vec3<double> pos;
		for(int i = 0; i < 10; ++i) Q[i] = m_vertices[v1].m_Q[i] + m_vertices[v2].m_Q[i];
		M[0] = Q[0]; // (0, 0)
		M[1] = Q[1]; // (0, 1) 
		M[2] = Q[2]; // (0, 2)
		M[3] = Q[3]; // (0, 3)
		M[4] = Q[1]; // (1, 0)
		M[5] = Q[4]; // (1, 1)
		M[6] = Q[5]; // (1, 2)
		M[7] = Q[6]; // (1, 3)
		M[8] = Q[2]; // (2, 0)
		M[9] = Q[5]; // (2, 1)
		M[10] = Q[7]; // (2, 2);
		M[11] = Q[8]; // (2, 3);
		double det =   M[0] * M[5] * M[10] + M[1] * M[6] * M[8] + M[2] * M[4] * M[9]   
					 - M[0] * M[6] * M[9]  - M[1] * M[4] * M[10]- M[2] * M[5] * M[8]; 
		if (det != 0.0)
		{
			double d = 1.0 / det;
			pos.X() = d * (M[1]*M[7]*M[10] + M[2]*M[5]*M[11] + M[3]*M[6]*M[9]
						  -M[1]*M[6]*M[11] - M[2]*M[7]*M[9]  - M[3]*M[5]*M[10]);
			pos.Y() = d * (M[0]*M[6]*M[11] + M[2]*M[7]*M[8]  + M[3]*M[4]*M[10]
						  -M[0]*M[7]*M[10] - M[2]*M[4]*M[11] - M[3]*M[6]*M[8]);
			pos.Z() = d * (M[0]*M[7]*M[9]  + M[1]*M[4]*M[11] + M[3]*M[5]*M[8]
						  -M[0]*M[5]*M[11] - M[1]*M[7]*M[8]  - M[3]*M[4]*M[9]);
	  		newPos.X() = static_cast<Float>(pos.X());
			newPos.Y() = static_cast<Float>(pos.Y());
			newPos.Z() = static_cast<Float>(pos.Z());
		}
		else
		{
			const Float w = static_cast<Float>(0.5f);
			newPos = w * m_points[v1] + w * m_points[v2];
	  		pos.X() = static_cast<double>(newPos.X());
			pos.Y() = static_cast<double>(newPos.Y());
			pos.Z() = static_cast<double>(newPos.Z());
		}

		double qem = pos.X()  * (Q[0] * pos.X() + Q[1] * pos.Y() + Q[2] * pos.Z() + Q[3]) +  
					 pos.Y()  * (Q[1] * pos.X() + Q[4] * pos.Y() + Q[5] * pos.Z() + Q[6]) +
					 pos.Z()  * (Q[2] * pos.X() + Q[5] * pos.Y() + Q[7] * pos.Z() + Q[8]) +
								(Q[3] * pos.X() + Q[6] * pos.Y() + Q[8] * pos.Z() + Q[9]) ;

		Vec3<Float> d1;
		Vec3<Float> d2;
		Vec3<Float> n1;
		Vec3<Float> n2;
        Vec3<Float> oldPosV1 =  m_points[v1];
        Vec3<Float> oldPosV2 =  m_points[v2];

		SArray<long, SARRAY_DEFAULT_MIN_SIZE> triangles = m_vertices[v1].m_triangles;
		long idTriangle;
		for(size_t itT = 0; itT < m_vertices[v2].m_triangles.Size(); ++itT)
		{
            idTriangle = m_vertices[v2].m_triangles[itT];
			triangles.Insert(idTriangle);
		}
		long a[3];
        for(size_t itT = 0; itT != triangles.Size(); ++itT)
		{
            idTriangle = triangles[itT];
			a[0] = m_triangles[idTriangle].X();
			a[1] = m_triangles[idTriangle].Y();
			a[2] = m_triangles[idTriangle].Z();

			d1 = m_points[a[1]] - m_points[a[0]];
			d2 = m_points[a[2]] - m_points[a[0]];
			n1 = d1^d2;

            m_points[v1] = newPos;
            m_points[v2] = newPos;

			d1 = m_points[a[1]] - m_points[a[0]];
			d2 = m_points[a[2]] - m_points[a[0]];
            n2 = d1^d2;

            m_points[v1] = oldPosV1;
            m_points[v2] = oldPosV2;

            n1.Normalize();
            n2.Normalize();
			if (n1*n2 < 0.0) 
            {
                return std::numeric_limits<double>::max();
            }
		}
		if ( m_ecolManifoldConstraint && !ManifoldConstraint(v1, v2))
		{
			return std::numeric_limits<double>::max();
		}
		return qem;
	}
开发者ID:akreshuk,项目名称:sopnet,代码行数:96,代码来源:hacdMeshDecimator.cpp

示例9: copy

 // copy values of another array
 void copy (SArray<T> const& orig) {
     assert(size()==orig.size());
     for (size_t idx = 0; idx<size(); ++idx) {
         storage[idx] = orig.storage[idx];
     }
 }
开发者ID:BigR-Lab,项目名称:CodeRes_Cpp,代码行数:7,代码来源:sarray1.hpp

示例10: SArray

 // copy constructor
 SArray (SArray<T> const& orig)
  : storage(new T[orig.size()]), storage_size(orig.size()) {
     copy(orig);
 }
开发者ID:BigR-Lab,项目名称:CodeRes_Cpp,代码行数:5,代码来源:sarray1.hpp

示例11: DoubleTriangle

ICHullError ICHull::Process()
{
    unsigned int addedPoints = 0;
    if (m_mesh.GetNVertices() < 3) {
        return ICHullErrorNotEnoughPoints;
    }
    if (m_mesh.GetNVertices() == 3) {
        m_isFlat = true;
        CircularListElement<TMMTriangle>* t1 = m_mesh.AddTriangle();
        CircularListElement<TMMTriangle>* t2 = m_mesh.AddTriangle();
        CircularListElement<TMMVertex>* v0 = m_mesh.m_vertices.GetHead();
        CircularListElement<TMMVertex>* v1 = v0->GetNext();
        CircularListElement<TMMVertex>* v2 = v1->GetNext();
        // Compute the normal to the plane
        Vec3<double> p0 = v0->GetData().m_pos;
        Vec3<double> p1 = v1->GetData().m_pos;
        Vec3<double> p2 = v2->GetData().m_pos;
        m_normal = (p1 - p0) ^ (p2 - p0);
        m_normal.Normalize();
        t1->GetData().m_vertices[0] = v0;
        t1->GetData().m_vertices[1] = v1;
        t1->GetData().m_vertices[2] = v2;
        t2->GetData().m_vertices[0] = v1;
        t2->GetData().m_vertices[1] = v2;
        t2->GetData().m_vertices[2] = v2;
        return ICHullErrorOK;
    }
    if (m_isFlat) {
        m_mesh.m_edges.Clear();
        m_mesh.m_triangles.Clear();
        m_isFlat = false;
    }
    if (m_mesh.GetNTriangles() == 0) // we have to create the first polyhedron
    {
        ICHullError res = DoubleTriangle();
        if (res != ICHullErrorOK) {
            return res;
        }
        else {
            addedPoints += 3;
        }
    }
    CircularList<TMMVertex>& vertices = m_mesh.GetVertices();
    // go to the first added and not processed vertex
    while (!(vertices.GetHead()->GetPrev()->GetData().m_tag)) {
        vertices.Prev();
    }
    while (!vertices.GetData().m_tag) // not processed
    {
        vertices.GetData().m_tag = true;
        if (ProcessPoint()) {
            addedPoints++;
            CleanUp(addedPoints);
            vertices.Next();
            if (!GetMesh().CheckConsistancy()) {
                size_t nV = m_mesh.GetNVertices();
                CircularList<TMMVertex>& vertices = m_mesh.GetVertices();
                for (size_t v = 0; v < nV; ++v) {
                    if (vertices.GetData().m_name == sc_dummyIndex) {
                        vertices.Delete();
                        break;
                    }
                    vertices.Next();
                }
                return ICHullErrorInconsistent;
            }
        }
    }
    if (m_isFlat) {
        SArray<CircularListElement<TMMTriangle>*> trianglesToDuplicate;
        size_t nT = m_mesh.GetNTriangles();
        for (size_t f = 0; f < nT; f++) {
            TMMTriangle& currentTriangle = m_mesh.m_triangles.GetHead()->GetData();
            if (currentTriangle.m_vertices[0]->GetData().m_name == sc_dummyIndex || currentTriangle.m_vertices[1]->GetData().m_name == sc_dummyIndex || currentTriangle.m_vertices[2]->GetData().m_name == sc_dummyIndex) {
                m_trianglesToDelete.PushBack(m_mesh.m_triangles.GetHead());
                for (int k = 0; k < 3; k++) {
                    for (int h = 0; h < 2; h++) {
                        if (currentTriangle.m_edges[k]->GetData().m_triangles[h] == m_mesh.m_triangles.GetHead()) {
                            currentTriangle.m_edges[k]->GetData().m_triangles[h] = 0;
                            break;
                        }
                    }
                }
            }
            else {
                trianglesToDuplicate.PushBack(m_mesh.m_triangles.GetHead());
            }
            m_mesh.m_triangles.Next();
        }
        size_t nE = m_mesh.GetNEdges();
        for (size_t e = 0; e < nE; e++) {
            TMMEdge& currentEdge = m_mesh.m_edges.GetHead()->GetData();
            if (currentEdge.m_triangles[0] == 0 && currentEdge.m_triangles[1] == 0) {
                m_edgesToDelete.PushBack(m_mesh.m_edges.GetHead());
            }
            m_mesh.m_edges.Next();
        }
        size_t nV = m_mesh.GetNVertices();
        CircularList<TMMVertex>& vertices = m_mesh.GetVertices();
        for (size_t v = 0; v < nV; ++v) {
//.........这里部分代码省略.........
开发者ID:Ochakko,项目名称:MameBake3D,代码行数:101,代码来源:vhacdICHull.cpp

示例12: Search

    int Search(const SStringT & strKey,SStudentSearchAdapter *pSearchAdapter)
    {
        if(strKey.IsEmpty()) return 0;
        for(UINT i=0;i<m_stuCurrent.GetCount();i++)
        {
            SStringT str = SStringT().Format(_T("%s(%u)"),m_stuCurrent[i].strNick,m_stuCurrent[i].imid);
            if(str.Find(strKey)!=-1)
            {
                SStudentSearchAdapter::StudentInfo2 info;
                info.strText = str;
                info.bExpired = FALSE;
                info.nPos = i;
                pSearchAdapter->m_searchResult.Add(info);
            }
        }
        for(UINT i=0;i<m_stuExpired.GetCount();i++)
        {
            SStringT str = SStringT().Format(_T("%s(%u)"),m_stuExpired[i].strNick,m_stuExpired[i].imid);

            if(str.Find(strKey)!=-1)
            {
                SStudentSearchAdapter::StudentInfo2 info;
                info.strText = str;
                info.bExpired = TRUE;
                info.nPos = i;
                pSearchAdapter->m_searchResult.Add(info);
            }
        }
        return pSearchAdapter->m_searchResult.GetCount();
    }
开发者ID:FuckGOV,项目名称:soui,代码行数:30,代码来源:StudentSmsDlg.cpp

示例13: CStudentAdapter

 CStudentAdapter(IStudentCheckChanged * pSelChangedHandler)
 :m_pSelChangedHandler(pSelChangedHandler)
 ,m_bCurrentExpand(TRUE),m_bExpiredExpand(FALSE)
 ,m_bAllCurrentChecked(FALSE),m_bAllExpiredChecked(FALSE)
 {
     StudentInfo data[] =
     {
         {
         L"sb no.1",100,
         SOUI::CTime(2015,9,1,0,0,0),
         SOUI::CTime(2016,9,1,0,0,0),
         10000,0
         },
         {
         L"sb no.2",200,
         SOUI::CTime(2015,9,2,0,0,0),
         SOUI::CTime(2016,9,2,0,0,0),
         100000,0
         },
         {
         L"sb no.3",300,
         SOUI::CTime(2015,9,3,0,0,0),
         SOUI::CTime(2016,9,3,0,0,0),
         100000,0
         },
     };
     for(int i=0;i<ARRAYSIZE(data);i++)
     {
         m_stuCurrent.Add(data[i]);
     }
     
     StudentInfo data2[] =
     {
         {
         L"nb no.1",400,
         SOUI::CTime(2015,9,1,0,0,0),
         SOUI::CTime(2016,9,1,0,0,0),
         0,0
         },
         {
         L"nb no.2",500,
         SOUI::CTime(2015,9,2,0,0,0),
         SOUI::CTime(2016,9,2,0,0,0),
         0,0
         },
         {
         L"nb no.3",600,
         SOUI::CTime(2015,9,3,0,0,0),
         SOUI::CTime(2016,9,3,0,0,0),
         0,0
         },
     };
     for(int i=0;i<ARRAYSIZE(data2);i++)
     {
         m_stuExpired.Add(data2[i]);
     }
 }
开发者ID:FuckGOV,项目名称:soui,代码行数:57,代码来源:StudentSmsDlg.cpp

示例14: getItemViewType

 virtual int getItemViewType(int position)
 {
     if(position == 0 || position == 1+ (m_bCurrentExpand?m_stuCurrent.GetCount():0))
         return VT_GROUP;
     else
         return VT_DATA;
 }
开发者ID:FuckGOV,项目名称:soui,代码行数:7,代码来源:StudentSmsDlg.cpp

示例15: OnStudentCheckChanged

 bool OnStudentCheckChanged(EventArgs *e)
 {
     EventSwndStateChanged *e2 = sobj_cast<EventSwndStateChanged>(e);
     
     if(!e2->CheckState(WndState_Check))
         return false;
         
     SCheckBox *pCheck = sobj_cast<SCheckBox>(e->sender);
     SASSERT(pCheck);
     SItemPanel * pItem = sobj_cast<SItemPanel>(pCheck->GetRoot());
     int position = (int)pItem->GetItemIndex();
     
     int nBaseCurrent = 1;
     int nBaseExpired = 1 + (m_bCurrentExpand?m_stuCurrent.GetCount():0) + 1;
     
     if(position < nBaseExpired)
     {
         m_stuCurrent[position - nBaseCurrent].bChecked = pCheck->IsChecked();
     }else
     {
         m_stuExpired[position - nBaseExpired].bChecked = pCheck->IsChecked();
     }
     
     if(m_pSelChangedHandler)
     {
         int nSelCur = 0, nSelExp=0;
         for(UINT i=0;i<m_stuCurrent.GetCount();i++)
         {
             nSelCur += m_stuCurrent[i].bChecked;
         }
         for(UINT i=0;i<m_stuExpired.GetCount();i++)
         {
             nSelExp += m_stuExpired[i].bChecked;
         }
         BOOL bAllCurrentChecked = nSelCur == m_stuCurrent.GetCount();
         BOOL bAllExpiredChecked = nSelExp == m_stuExpired.GetCount();
         if(bAllCurrentChecked!=m_bAllCurrentChecked || bAllExpiredChecked != m_bAllExpiredChecked)
         {
             m_bAllCurrentChecked = bAllCurrentChecked;
             m_bAllExpiredChecked = bAllExpiredChecked;
             notifyDataSetChanged();
         }
         m_pSelChangedHandler->OnStudentCheckChanged(nSelCur,nSelExp);
     }
     return true;
 }
开发者ID:FuckGOV,项目名称:soui,代码行数:46,代码来源:StudentSmsDlg.cpp


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