本文整理汇总了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 );
}