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


C++ LIB_ITEM::GetClass方法代码示例

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


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

示例1: OnLeftDClick

/*
 * Called on a double click:
 *  If an editable item  (field, pin, graphic):
 *      Call the suitable dialog editor.
 */
void LIB_EDIT_FRAME::OnLeftDClick( wxDC* DC, const wxPoint& aPosition )
{
    LIB_PART*      part = GetCurPart();
    LIB_ITEM*      item = GetDrawItem();

    if( !part )
        return;

    if( !item || !item->InEditMode() )
    {   // We can locate an item
        item = LocateItemUsingCursor( aPosition, LIB_COLLECTOR::DoubleClickItems );

        if( item == NULL )
        {
            // The user canceled the disambiguation menu
            if( m_canvas->GetAbortRequest() )
                m_canvas->SetAbortRequest( false );
            else
            {
                // If there is only a random double-click, we allow the use to edit the part
                wxCommandEvent cmd( wxEVT_COMMAND_MENU_SELECTED );

                cmd.SetId( ID_LIBEDIT_GET_FRAME_EDIT_PART );
                GetEventHandler()->ProcessEvent( cmd );
            }
        }
    }

    if( item )
        SetMsgPanel( item );
    else
        return;

    m_canvas->SetIgnoreMouseEvents( true );
    bool not_edited = !item->InEditMode();

    switch( item->Type() )
    {
    case LIB_PIN_T:
        if( not_edited )
        {
            SetDrawItem( item );
            wxCommandEvent cmd( wxEVT_COMMAND_MENU_SELECTED );

            cmd.SetId( ID_LIBEDIT_EDIT_PIN );
            GetEventHandler()->ProcessEvent( cmd );
        }
        break;

    case LIB_ARC_T:
    case LIB_CIRCLE_T:
    case LIB_RECTANGLE_T:
        if( not_edited )
            EditGraphicSymbol( DC, item );
        break;

    case LIB_POLYLINE_T:
        if( not_edited )
            EditGraphicSymbol( DC, item );
        else if( item->IsNew() )
            EndDrawGraphicItem( DC );
        break;

    case LIB_TEXT_T:
        if( not_edited )
            EditSymbolText( DC, item );
        break;

    case LIB_FIELD_T:
        if( not_edited )
            EditField( (LIB_FIELD*) item );
        break;

    default:
        wxFAIL_MSG( wxT( "Unhandled item <" ) + item->GetClass() + wxT( ">" ) );
        break;
    }

    m_canvas->MoveCursorToCrossHair();
    m_canvas->SetIgnoreMouseEvents( false );
}
开发者ID:zhihuitech,项目名称:kicad-source-mirror,代码行数:86,代码来源:libedit_onleftclick.cpp


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