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


C++ ShapeList::empty方法代码示例

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


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

示例1: OnRightDown

void DatabaseCanvas::OnRightDown(wxMouseEvent &event)
{
    FieldShape *erdField = NULL;
    MyErdTable *erdTable = NULL;
    ConstraintSign *erdSign = NULL;
    wxPoint pt = event.GetPosition();
    ShapeList selection;
    this->GetSelectedShapes( selection );
    for( ShapeList::iterator it = selection.begin(); it != selection.end(); ++it )
    {
        MyErdTable *table = wxDynamicCast( (*it), MyErdTable );
        if( table )
            m_realSelectedShape = table;
    }
    wxMenu mnu;
    int allSelected = 0;
    mnu.Bind( wxEVT_COMMAND_MENU_SELECTED, &DatabaseCanvas::OnDropTable, this, wxID_DROPOBJECT );
    mnu.Bind( wxEVT_COMMAND_MENU_SELECTED, &DatabaseCanvas::OnDropTable, this, wxID_TABLECLOSE );
    m_selectedShape = GetShapeUnderCursor();
    ViewType type = dynamic_cast<DrawingView *>( m_view )->GetViewType();
    if( m_selectedShape )
    {
        ShapeList list;
        GetShapesAtPosition( pt, list );
        if( type == DatabaseView )
            if( m_selectedShape->IsKindOf( CLASSINFO( MyErdTable ) ) )
                DeselectAll();
        wxRect tableRect;
        bool fieldSelected = false;
        bool signSelected = false;
        for( ShapeList::iterator it = list.begin(); it != list.end(); ++it )
        {
            MyErdTable *table = wxDynamicCast( (*it), MyErdTable );
            if( table )
            {
                if( type == DatabaseView )
                    table->Select( true );
                tableRect = table->GetBoundingBox();
                erdTable = table;
            }
            else
            {
                FieldShape *field = wxDynamicCast( (*it), FieldShape );
                if( field )
                {
                    if( type == DatabaseView )
                        field->Select( true );
                    field->SetParentRect( tableRect );
                    fieldSelected = true;
                    erdField = field;
                }
                else
                {
                    ConstraintSign *sign = wxDynamicCast( (*it), ConstraintSign );
                    if( sign )
                    {
                        if( type == DatabaseView )
                            sign->Select( true );
                        signSelected = true;
                        erdSign = sign;
                    }
                }
            }
        }
        if( type == DatabaseView && list.empty() )
        {
            MyErdTable *table = wxDynamicCast( m_selectedShape, MyErdTable );
            if( table )
            {
                table->Select( true );
            }
            else
            {
                table = wxDynamicCast( m_selectedShape->GetParentShape()->GetParentShape(), MyErdTable );
                table->Select( true );
            }
        }
        if( type == QueryView )
        {
            size_t selectedCount = 0;
            SerializableList tableFields;
			if( erdTable )
			{
                erdTable->GetChildrenRecursively( CLASSINFO( FieldShape ), tableFields );
                SerializableList::compatibility_iterator node = tableFields.GetFirst();
                while( node )
                {
                    FieldShape *shape = dynamic_cast<FieldShape *>( node->GetData() );
                    if( shape->IsSelected() )
                        selectedCount++;
                    node = node->GetNext();
                }
                if( selectedCount == const_cast<DatabaseTable &>( erdTable->GetTable() ).GetFields().size() )
                    allSelected = 1;
                else
                    allSelected = -1;
			}
        }
        Refresh();
        if( type == DatabaseView )
//.........这里部分代码省略.........
开发者ID:,项目名称:,代码行数:101,代码来源:


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