本文整理汇总了C++中GetEventHandler函数的典型用法代码示例。如果您正苦于以下问题:C++ GetEventHandler函数的具体用法?C++ GetEventHandler怎么用?C++ GetEventHandler使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了GetEventHandler函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: wxBoxSizer
//.........这里部分代码省略.........
CSafeCombinationEntry* itemDialog1 = this;
wxBoxSizer* itemBoxSizer2 = new wxBoxSizer(wxHORIZONTAL);
itemDialog1->SetSizer(itemBoxSizer2);
wxStaticBitmap* itemStaticBitmap3 = new wxStaticBitmap( itemDialog1, wxID_STATIC, itemDialog1->GetBitmapResource(wxT("graphics/cpane.xpm")), wxDefaultPosition, itemDialog1->ConvertDialogToPixels(wxSize(49, 46)), 0 );
itemBoxSizer2->Add(itemStaticBitmap3, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
wxBoxSizer* itemBoxSizer4 = new wxBoxSizer(wxVERTICAL);
itemBoxSizer2->Add(itemBoxSizer4, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
wxBoxSizer* itemBoxSizer5 = new wxBoxSizer(wxHORIZONTAL);
itemBoxSizer4->Add(itemBoxSizer5, 0, wxALIGN_CENTER_HORIZONTAL|wxALL, 5);
wxStaticBitmap* itemStaticBitmap6 = new wxStaticBitmap( itemDialog1, wxID_STATIC, itemDialog1->GetBitmapResource(wxT("graphics/psafetxt.xpm")), wxDefaultPosition, wxDefaultSize, 0 );
itemBoxSizer5->Add(itemStaticBitmap6, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
m_version = new wxStaticText( itemDialog1, wxID_STATIC, _("VX.YY"), wxDefaultPosition, wxDefaultSize, 0 );
itemBoxSizer5->Add(m_version, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
wxStaticText* itemStaticText8 = new wxStaticText( itemDialog1, wxID_STATIC, _("Open Password Database:"), wxDefaultPosition, wxDefaultSize, 0 );
itemBoxSizer4->Add(itemStaticText8, 0, wxALIGN_LEFT|wxALL, 3);
wxBoxSizer* itemBoxSizer9 = new wxBoxSizer(wxHORIZONTAL);
itemBoxSizer4->Add(itemBoxSizer9, 50, wxGROW|wxALL, 5);
wxArrayString m_filenameCBStrings;
m_filenameCB = new wxComboBox( itemDialog1, ID_DBASECOMBOBOX, wxEmptyString, wxDefaultPosition, wxSize(itemDialog1->ConvertDialogToPixels(wxSize(140, -1)).x, -1), m_filenameCBStrings, wxCB_DROPDOWN );
itemBoxSizer9->Add(m_filenameCB, 0, wxALIGN_CENTER_VERTICAL|wxLEFT|wxRIGHT|wxBOTTOM, 0);
wxButton* itemButton11 = new wxButton( itemDialog1, ID_ELLIPSIS, wxT("..."), wxDefaultPosition, wxDefaultSize, wxBU_EXACTFIT );
itemBoxSizer9->Add(itemButton11, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
wxStaticText* itemStaticText12 = new wxStaticText( itemDialog1, wxID_STATIC, _("Safe Combination:"), wxDefaultPosition, wxDefaultSize, 0 );
itemBoxSizer4->Add(itemStaticText12, 0, wxALIGN_LEFT|wxALL, 3);
m_combinationEntry = new CSafeCombinationCtrl( itemDialog1, ID_COMBINATION, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
itemBoxSizer4->Add(m_combinationEntry, 0, wxGROW|wxRIGHT|wxTOP|wxBOTTOM, 5);
wxBoxSizer* itemBoxSizer14 = new wxBoxSizer(wxHORIZONTAL);
itemBoxSizer4->Add(itemBoxSizer14, 0, wxGROW|wxALL, 5);
wxCheckBox* itemCheckBox15 = new wxCheckBox( itemDialog1, ID_READONLY, _("Open as read-only"), wxDefaultPosition, wxDefaultSize, 0 );
itemCheckBox15->SetValue(false);
itemBoxSizer14->Add(itemCheckBox15, 0, wxALIGN_CENTER_VERTICAL|wxALL, 0);
itemBoxSizer14->Add(120, 10, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
wxButton* itemButton17 = new wxButton( itemDialog1, ID_NEWDB, _("New..."), wxDefaultPosition, wxDefaultSize, wxBU_EXACTFIT );
itemBoxSizer14->Add(itemButton17, 0, wxALIGN_CENTER_VERTICAL|wxLEFT|wxTOP|wxBOTTOM, 5);
wxBoxSizer* itemBoxSizer18 = new wxBoxSizer(wxHORIZONTAL);
itemBoxSizer4->Add(itemBoxSizer18, 0, wxGROW|wxALL, 5);
#ifndef NO_YUBI
m_YubiBtn = new wxBitmapButton( itemDialog1, ID_YUBIBTN, itemDialog1->GetBitmapResource(wxT("graphics/Yubikey-button.xpm")), wxDefaultPosition, itemDialog1->ConvertDialogToPixels(wxSize(40, 15)), wxBU_AUTODRAW );
itemBoxSizer18->Add(m_YubiBtn, 0, wxALIGN_CENTER_VERTICAL|wxLEFT|wxRIGHT|wxBOTTOM|wxSHAPED, 5);
m_yubiStatusCtrl = new wxStaticText( itemDialog1, ID_YUBISTATUS, _("Please insert your YubiKey"), wxDefaultPosition, wxDefaultSize, 0 );
itemBoxSizer18->Add(m_yubiStatusCtrl, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
#endif
wxStdDialogButtonSizer* itemStdDialogButtonSizer21 = new wxStdDialogButtonSizer;
itemBoxSizer4->Add(itemStdDialogButtonSizer21, 0, wxGROW|wxALL, 0);
wxButton* itemButton22 = new wxButton( itemDialog1, wxID_OK, _("OK"), wxDefaultPosition, wxDefaultSize, 0 );
itemButton22->SetDefault();
itemStdDialogButtonSizer21->AddButton(itemButton22);
wxButton* itemButton23 = new wxButton( itemDialog1, wxID_CANCEL, _("Cancel"), wxDefaultPosition, wxDefaultSize, 0 );
itemStdDialogButtonSizer21->AddButton(itemButton23);
wxButton* itemButton24 = new wxButton( itemDialog1, wxID_HELP, _("&Help"), wxDefaultPosition, wxDefaultSize, 0 );
itemStdDialogButtonSizer21->AddButton(itemButton24);
itemStdDialogButtonSizer21->Realize();
// Set validators
m_filenameCB->SetValidator( wxGenericValidator(& m_filename) );
itemCheckBox15->SetValidator( wxGenericValidator(& m_readOnly) );
////@end CSafeCombinationEntry content construction
m_combinationEntry->SetValidatorTarget(& m_password);
#if (REVISION == 0)
m_version->SetLabel(wxString::Format(wxT("V%d.%d %ls"),
MAJORVERSION, MINORVERSION, SPECIALBUILD));
#else
m_version->SetLabel(wxString::Format(wxT("V%d.%d.%d %ls"),
MAJORVERSION, MINORVERSION,
REVISION, SPECIALBUILD));
#endif
wxArrayString recentFiles;
wxGetApp().recentDatabases().GetAll(recentFiles);
m_filenameCB->Append(recentFiles);
// The underlying native combobox widget might not yet be ready
// to hand back the string we just added
wxCommandEvent cmdEvent(wxEVT_COMMAND_COMBOBOX_SELECTED, m_filenameCB->GetId());
GetEventHandler()->AddPendingEvent(cmdEvent);
SetIcons(wxGetApp().GetAppIcons());
}
开发者ID:ByteRisc,项目名称:pwsafe,代码行数:101,代码来源:safecombinationentry.cpp
示例2: GetScreen
/* OnHotKey.
* ** Commands are case insensitive **
* Some commands are relative to the item under the mouse cursor
* aDC = current device context
* aHotkeyCode = hotkey code (ascii or wxWidget code for special keys)
* aPosition The cursor position in logical (drawing) units.
* aItem = NULL or pointer on a EDA_ITEM under the mouse cursor
*/
void PL_EDITOR_FRAME::OnHotKey( wxDC* aDC, int aHotkeyCode,
const wxPoint& aPosition, EDA_ITEM* aItem )
{
bool busy = GetScreen()->GetCurItem() != NULL;
wxCommandEvent cmd( wxEVT_COMMAND_MENU_SELECTED );
cmd.SetEventObject( this );
/* Convert lower to upper case (the usual toupper function has problem with non ascii
* codes like function keys */
if( (aHotkeyCode >= 'a') && (aHotkeyCode <= 'z') )
aHotkeyCode += 'A' - 'a';
EDA_HOTKEY * HK_Descr = GetDescriptorFromHotkey( aHotkeyCode, s_PlEditor_Hotkey_List );
if( HK_Descr == NULL )
HK_Descr = GetDescriptorFromHotkey( aHotkeyCode, s_Common_Hotkey_List );
if( HK_Descr == NULL )
return;
WORKSHEET_DATAITEM* item;
switch( HK_Descr->m_Idcommand )
{
case HK_NOT_FOUND:
return;
case HK_LEFT_CLICK:
OnLeftClick( aDC, aPosition );
break;
case HK_LEFT_DCLICK: // Simulate a double left click: generate 2 events
OnLeftClick( aDC, aPosition );
OnLeftDClick( aDC, aPosition );
break;
case HK_HELP: // Display Current hotkey list
DisplayHotkeyList( this, s_PlEditor_Hokeys_Descr );
break;
case HK_UNDO:
case HK_REDO:
if( busy )
break;
cmd.SetId( HK_Descr->m_IdMenuEvent );
GetEventHandler()->ProcessEvent( cmd );
break;
case HK_ZOOM_IN:
cmd.SetId( ID_POPUP_ZOOM_IN );
GetEventHandler()->ProcessEvent( cmd );
break;
case HK_ZOOM_OUT:
cmd.SetId( ID_POPUP_ZOOM_OUT );
GetEventHandler()->ProcessEvent( cmd );
break;
case HK_ZOOM_REDRAW:
cmd.SetId( ID_ZOOM_REDRAW );
GetEventHandler()->ProcessEvent( cmd );
break;
case HK_ZOOM_CENTER:
cmd.SetId( ID_POPUP_ZOOM_CENTER );
GetEventHandler()->ProcessEvent( cmd );
break;
case HK_ZOOM_AUTO:
cmd.SetId( ID_ZOOM_PAGE );
GetEventHandler()->ProcessEvent( cmd );
break;
case HK_RESET_LOCAL_COORD: // Reset the relative coord
GetScreen()->m_O_Curseur = GetCrossHairPosition();
break;
case HK_SET_GRID_ORIGIN:
SetGridOrigin( GetCrossHairPosition() );
break;
case HK_MOVE_ITEM:
case HK_MOVE_START_POINT:
case HK_MOVE_END_POINT:
case HK_DELETE_ITEM:
if( busy )
break;
if( (item = Locate( aPosition )) == NULL )
break;
// Only rect and lines have a end point.
//.........这里部分代码省略.........
开发者ID:johnbeard,项目名称:kicad-source-mirror,代码行数:101,代码来源:hotkeys.cpp
示例3: clientSize
void wxSashLayoutWindow::OnCalculateLayout(wxCalculateLayoutEvent& event)
{
wxRect clientSize(event.GetRect());
int flags = event.GetFlags();
if (!IsShown())
return;
// Let's assume that all windows stretch the full extent of the window in
// the direction of that window orientation. This will work for non-docking toolbars,
// and the status bar. Note that the windows have to have been created in a certain
// order to work, else you might get a left-aligned window going to the bottom
// of the window, and the status bar appearing to the right of it. The
// status bar would have to be created after or before the toolbar(s).
wxRect thisRect;
// Try to stretch
int length = (GetOrientation() == wxLAYOUT_HORIZONTAL) ? clientSize.width : clientSize.height;
wxLayoutOrientation orient = GetOrientation();
// We assume that a window that says it's horizontal, wants to be stretched in that
// direction. Is this distinction too fine? Do we assume that any horizontal
// window needs to be stretched in that direction? Possibly.
int whichDimension = (GetOrientation() == wxLAYOUT_HORIZONTAL) ? wxLAYOUT_LENGTH_X : wxLAYOUT_LENGTH_Y;
wxQueryLayoutInfoEvent infoEvent(GetId());
infoEvent.SetEventObject(this);
infoEvent.SetRequestedLength(length);
infoEvent.SetFlags(orient | whichDimension);
if (!GetEventHandler()->ProcessEvent(infoEvent))
return;
wxSize sz = infoEvent.GetSize();
if (sz.x == 0 && sz.y == 0) // Assume it's invisible
return;
// Now we know the size it wants to be. We wish to decide where to place it, i.e.
// how it's aligned.
switch (GetAlignment())
{
case wxLAYOUT_TOP:
{
thisRect.x = clientSize.x; thisRect.y = clientSize.y;
thisRect.width = sz.x; thisRect.height = sz.y;
clientSize.y += thisRect.height;
clientSize.height -= thisRect.height;
break;
}
case wxLAYOUT_LEFT:
{
thisRect.x = clientSize.x; thisRect.y = clientSize.y;
thisRect.width = sz.x; thisRect.height = sz.y;
clientSize.x += thisRect.width;
clientSize.width -= thisRect.width;
break;
}
case wxLAYOUT_RIGHT:
{
thisRect.x = clientSize.x + (clientSize.width - sz.x); thisRect.y = clientSize.y;
thisRect.width = sz.x; thisRect.height = sz.y;
clientSize.width -= thisRect.width;
break;
}
case wxLAYOUT_BOTTOM:
{
thisRect.x = clientSize.x; thisRect.y = clientSize.y + (clientSize.height - sz.y);
thisRect.width = sz.x; thisRect.height = sz.y;
clientSize.height -= thisRect.height;
break;
}
case wxLAYOUT_NONE:
{
break;
}
}
if ((flags & wxLAYOUT_QUERY) == 0)
{
// If not in query mode, resize the window.
// TODO: add wxRect& form to wxWindow::SetSize
wxSize sz2 = GetSize();
wxPoint pos = GetPosition();
SetSize(thisRect.x, thisRect.y, thisRect.width, thisRect.height);
// Make sure the sash is erased when the window is resized
if ((pos.x != thisRect.x || pos.y != thisRect.y || sz2.x != thisRect.width || sz2.y != thisRect.height) &&
(GetSashVisible(wxSASH_TOP) || GetSashVisible(wxSASH_RIGHT) || GetSashVisible(wxSASH_BOTTOM) || GetSashVisible(wxSASH_LEFT)))
Refresh(true);
}
event.SetRect(clientSize);
}
开发者ID:BauerBox,项目名称:wxWidgets,代码行数:98,代码来源:laywin.cpp
示例4: GetCurItem
bool PCB_EDIT_FRAME::OnHotkeyEditItem( int aIdCommand )
{
BOARD_ITEM* item = GetCurItem();
bool itemCurrentlyEdited = item && item->GetFlags();
if( itemCurrentlyEdited )
return false;
item = PcbGeneralLocateAndDisplay();
if( item == NULL )
return false;
SetCurItem( item );
int evt_type = 0; //Used to post a wxCommandEvent on demand
switch( item->Type() )
{
case PCB_TRACE_T:
case PCB_VIA_T:
if( aIdCommand == HK_EDIT_ITEM )
{
// Be sure the corresponding netclass is selected before edit:
SetCurrentNetClass( ( (BOARD_CONNECTED_ITEM*)item )->GetNetClassName() );
evt_type = ID_POPUP_PCB_EDIT_TRACKSEG;
}
break;
case PCB_TEXT_T:
if( aIdCommand == HK_EDIT_ITEM )
evt_type = ID_POPUP_PCB_EDIT_TEXTEPCB;
break;
case PCB_MODULE_T:
if( aIdCommand == HK_EDIT_ITEM )
evt_type = ID_POPUP_PCB_EDIT_MODULE_PRMS;
else if( aIdCommand == HK_EDIT_MODULE_WITH_MODEDIT )
evt_type = ID_POPUP_PCB_EDIT_MODULE_WITH_MODEDIT;
break;
case PCB_PAD_T:
// Until dec 2012 a EDIT_MODULE event is posted here to prevent pads
// from being edited by hotkeys.
// Process_Special_Functions takes care of finding the parent.
// After dec 2012 a EDIT_PAD event is posted, because there is no
// reason to not allow pad edit by hotkey
// (pad coordinates are no more modified by rounding, in nanometer version
// when using inches or mm in dialog)
if( aIdCommand == HK_EDIT_ITEM )
evt_type = ID_POPUP_PCB_EDIT_PAD;
break;
case PCB_TARGET_T:
if( aIdCommand == HK_EDIT_ITEM )
evt_type = ID_POPUP_PCB_EDIT_MIRE;
break;
case PCB_DIMENSION_T:
if( aIdCommand == HK_EDIT_ITEM )
evt_type = ID_POPUP_PCB_EDIT_DIMENSION;
break;
case PCB_MODULE_TEXT_T:
if( aIdCommand == HK_EDIT_ITEM )
evt_type = ID_POPUP_PCB_EDIT_TEXTMODULE;
break;
case PCB_LINE_T:
if( aIdCommand == HK_EDIT_ITEM )
evt_type = ID_POPUP_PCB_EDIT_DRAWING;
break;
case PCB_ZONE_AREA_T:
if( aIdCommand == HK_EDIT_ITEM )
evt_type = ID_POPUP_PCB_EDIT_ZONE_PARAMS;
break;
default:
break;
}
if( evt_type != 0 )
{
wxCommandEvent evt( wxEVT_COMMAND_MENU_SELECTED );
evt.SetEventObject( this );
evt.SetId( evt_type );
GetEventHandler()->ProcessEvent( evt );
return true;
}
//.........这里部分代码省略.........
开发者ID:grtwall,项目名称:kicad-source-mirror,代码行数:101,代码来源:hotkeys_board_editor.cpp
示例5: GetCurPart
/*
* 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();
if( !part )
return;
if( !m_drawItem || !m_drawItem->InEditMode() )
{ // We can locate an item
m_drawItem = LocateItemUsingCursor( aPosition );
if( m_drawItem == NULL )
{
wxCommandEvent cmd( wxEVT_COMMAND_MENU_SELECTED );
cmd.SetId( ID_LIBEDIT_GET_FRAME_EDIT_PART );
GetEventHandler()->ProcessEvent( cmd );
}
}
if( m_drawItem )
SetMsgPanel( m_drawItem );
else
return;
m_canvas->SetIgnoreMouseEvents( true );
bool not_edited = !m_drawItem->InEditMode();
switch( m_drawItem->Type() )
{
case LIB_PIN_T:
if( not_edited )
{
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, m_drawItem );
break;
case LIB_POLYLINE_T:
if( not_edited )
EditGraphicSymbol( DC, m_drawItem );
else if( m_drawItem->IsNew() )
EndDrawGraphicItem( DC );
break;
case LIB_TEXT_T:
if( not_edited )
EditSymbolText( DC, m_drawItem );
break;
case LIB_FIELD_T:
if( not_edited )
EditField( (LIB_FIELD*) m_drawItem );
break;
default:
wxFAIL_MSG( wxT( "Unhandled item <" ) + m_drawItem->GetClass() + wxT( ">" ) );
break;
}
m_canvas->MoveCursorToCrossHair();
m_canvas->SetIgnoreMouseEvents( false );
}
开发者ID:Caerbannog,项目名称:kicad-git-bzr,代码行数:77,代码来源:libedit_onleftclick.cpp
示例6: GetSelection
//.........这里部分代码省略.........
// eat it
return ;
}
// Check if we have reached the max # of chars (if it is set), but still
// allow navigation and deletion
GetSelection( &from, &to );
if ( !IsMultiLine() && m_maxLength && GetValue().length() >= m_maxLength &&
!event.IsKeyInCategory(WXK_CATEGORY_ARROW | WXK_CATEGORY_TAB | WXK_CATEGORY_CUT) &&
!( key == WXK_RETURN && (m_windowStyle & wxTE_PROCESS_ENTER) ) &&
from == to )
{
// eat it, we don't want to add more than allowed # of characters
// TODO: generate EVT_TEXT_MAXLEN()
return;
}
// assume that any key not processed yet is going to modify the control
m_dirty = true;
switch ( key )
{
case WXK_RETURN:
if (m_windowStyle & wxTE_PROCESS_ENTER)
{
wxCommandEvent event(wxEVT_COMMAND_TEXT_ENTER, m_windowId);
event.SetEventObject( this );
event.SetString( GetValue() );
if ( HandleWindowEvent(event) )
return;
}
if ( !(m_windowStyle & wxTE_MULTILINE) )
{
wxTopLevelWindow *tlw = wxDynamicCast(wxGetTopLevelParent(this), wxTopLevelWindow);
if ( tlw && tlw->GetDefaultItem() )
{
wxButton *def = wxDynamicCast(tlw->GetDefaultItem(), wxButton);
if ( def && def->IsEnabled() )
{
wxCommandEvent event(wxEVT_COMMAND_BUTTON_CLICKED, def->GetId() );
event.SetEventObject(def);
def->Command(event);
return ;
}
}
// this will make wxWidgets eat the ENTER key so that
// we actually prevent line wrapping in a single line text control
eat_key = true;
}
break;
case WXK_TAB:
if ( !(m_windowStyle & wxTE_PROCESS_TAB))
{
int flags = 0;
if (!event.ShiftDown())
flags |= wxNavigationKeyEvent::IsForward ;
if (event.ControlDown())
flags |= wxNavigationKeyEvent::WinChange ;
Navigate(flags);
return;
}
else
{
// This is necessary (don't know why);
// otherwise the tab will not be inserted.
WriteText(wxT("\t"));
eat_key = true;
}
break;
default:
break;
}
if (!eat_key)
{
// perform keystroke handling
event.Skip(true) ;
}
// osx_cocoa sends its event upon insertText
#if wxOSX_USE_CARBON
if ( ( key >= 0x20 && key < WXK_START ) ||
( key >= WXK_NUMPAD0 && key <= WXK_DIVIDE ) ||
key == WXK_RETURN ||
key == WXK_DELETE ||
key == WXK_BACK)
{
wxCommandEvent event1(wxEVT_COMMAND_TEXT_UPDATED, m_windowId);
event1.SetEventObject( this );
wxPostEvent( GetEventHandler(), event1 );
}
#endif
}
开发者ID:mark711,项目名称:Cafu,代码行数:101,代码来源:textctrl_osx.cpp
示例7: e
void FreqWindow::SendRecalcEvent()
{
wxCommandEvent e(EVT_FREQWINDOW_RECALC, wxID_ANY);
GetEventHandler()->AddPendingEvent(e);
}
开发者ID:LarryPAC,项目名称:audacity,代码行数:5,代码来源:FreqWindow.cpp
示例8: event
bool wxMenu::HandleCommandUpdateStatus( wxMenuItem* item, wxWindow* senderWindow )
{
int menuid = item ? item->GetId() : 0;
wxUpdateUIEvent event(menuid);
event.SetEventObject( this );
bool processed = false;
// Try the menu's event handler
{
wxEvtHandler *handler = GetEventHandler();
if ( handler )
processed = handler->ProcessEvent(event);
}
// Try the window the menu was popped up from
// (and up through the hierarchy)
if ( !processed )
{
wxWindow *win = GetWindow();
if ( win )
processed = win->HandleWindowEvent(event);
}
if ( !processed && senderWindow != NULL)
{
processed = senderWindow->HandleWindowEvent(event);
}
if ( processed )
{
// if anything changed, update the changed attribute
if (event.GetSetText())
SetLabel(menuid, event.GetText());
if (event.GetSetChecked())
Check(menuid, event.GetChecked());
if (event.GetSetEnabled())
Enable(menuid, event.GetEnabled());
}
else
{
#if wxOSX_USE_CARBON
// these two items are also managed by the Carbon Menu Manager, therefore we must
// always reset them ourselves
UInt32 cmd = 0;
if ( menuid == wxApp::s_macExitMenuItemId )
{
cmd = kHICommandQuit;
}
else if (menuid == wxApp::s_macPreferencesMenuItemId )
{
cmd = kHICommandPreferences;
}
if ( cmd != 0 )
{
if ( !item->IsEnabled() || wxDialog::OSXHasModalDialogsOpen() )
DisableMenuCommand( NULL , cmd ) ;
else
EnableMenuCommand( NULL , cmd ) ;
}
#endif
}
return processed;
}
开发者ID:CustomCardsOnline,项目名称:wxWidgets,代码行数:68,代码来源:menu_osx.cpp
示例9: eventCancel
void Wizard::OnCancel(wxCommandEvent&) {
WizardEvent eventCancel( wxFB_EVT_WIZARD_CANCEL, GetId(), false, m_page );
GetEventHandler()->ProcessEvent( eventCancel );
}
开发者ID:chtheis,项目名称:wxFormBuilder,代码行数:4,代码来源:wizard.cpp
示例10: switch
//.........这里部分代码省略.........
if(lWindow)
{
// keep a pointer to it
lData->iFinder = lWindow;
// and show the window
lWindow->Show(true);
if(lData->iCtrl)
lData->iCtrl->Notify(kEvnLiveOpened,lWindow,true);
}
}
else
{
wxMessageBox(L"Sorry, the camera couldn't be open.",
L"Ooops ...",
wxOK | wxICON_ERROR,this);
}
}
else
lData->iFinder->Raise();
break;
}
case ID_SEEK:
{
wxTextEntryDialog lDialog(this,L"Please enter the IP address of the camera",L"Seek a camera ...",L"0.0.0.0");
if(lDialog.ShowModal() == wxID_OK)
{
unsigned long lAddr = inet_addr(lDialog.GetValue().mb_str(wxConvUTF8));
if(lAddr)
{
iSeeking = new CSeeker(dSEEKER,GetEventHandler(),lAddr);
if(iSeeking)
if(!iSeeking->Start())
{
delete iSeeking;
iSeeking = NULL;
}
}
else
wxMessageBox(L"You need to enter a valid IP address",
L"Ooops ...",
wxOK | wxICON_ERROR,this);
}
break;
}
case ID_EXPO:
{
bool lClose = false;
if(!lData->iHandle)
{
lData->iHandle = OpenCamera(lData->iData.UniqueId,lData->iOwner);
lClose = true;
}
if(lData->iHandle)
{
wxFileDialog lDialog(NULL,wxT("Select an output file"),wxT(""),
wxString(lData->iData.SerialNumber,wxConvUTF8),
wxT("Text files (*.txt)|*.txt"),wxSAVE | wxOVERWRITE_PROMPT);
if(lDialog.ShowModal() == wxID_OK)
开发者ID:AIRLab-POLIMI,项目名称:iDrive,代码行数:67,代码来源:MainWindow.cpp
示例11: wxFrame
/*
* Method: CMainWindow()
* Purpose: constructor
* Comments: none
*/
CMainWindow::CMainWindow()
: wxFrame(NULL,dMAINWINDOW,gMainWindowTitle,wxDefaultPosition,wxSize(250,350),
wxMINIMIZE_BOX | wxSYSTEM_MENU | wxCAPTION | wxCLOSE_BOX | wxCLIP_CHILDREN)
{
// Give it an icon
SetIcon(wxIcon(SampleViewer));
iSeeking = NULL;
iMenuBar = new wxMenuBar;
if(iMenuBar)
{
#ifndef __WXMAC__
wxMenu* lMenu = new wxMenu;
if(lMenu)
{
lMenu->Append(ID_QUIT,L"E&xit");
iMenuBar->Append(lMenu,L"&File");
}
iMenuWin = new wxMenu;
if(iMenuWin)
{
iMenuWin->Append(ID_RAISE,L"&Show all");
iMenuWin->Append(ID_CLOSE,L"&Close all");
iMenuWin->AppendSeparator();
iMenuBar->Append(iMenuWin,L"&Windows");
iMenuWin->Enable(ID_RAISE,false);
iMenuWin->Enable(ID_CLOSE,false);
}
iMenuHelp = new wxMenu;
if(iMenuHelp)
{
iMenuHelp->Append(ID_ABOUT,L"&About ...");
iMenuBar->Append(iMenuHelp,L"&Help");
}
#endif
iMenuHelp = new wxMenu;
if(iMenuHelp)
{
iMenuHelp->Append(wxID_ABOUT,L"&About ...");
iMenuHelp->Append(ID_ABOUT,L"&About ...");
iMenuBar->Append(iMenuHelp,L"&Help");
}
SetMenuBar(iMenuBar);
CreateStatusBar();
// create the tool barCTreeItemData
iToolBar = CreateToolBar();
if(iToolBar)
{
// fill the toolbar
iToolBar->AddTool(ID_INFO,_T("info"),wxBitmap(bitmap1),_T("Information"));
iToolBar->AddTool(ID_CTRL,_T("ctrl"),wxBitmap(bitmap2),_T("Controls"));
iToolBar->AddTool(ID_LIVE,_T("live"),wxBitmap(bitmap3),_T("Live view"));
iToolBar->AddTool(ID_SEEK,_T("seek"),wxBitmap(bitmap7),_T("Seek a camera"));
iToolBar->AddTool(ID_EXPO,_T("expo"),wxBitmap(bitmap8),_T("Export camera's setup"));
iToolBar->AddTool(ID_EVNT,_T("evnt"),wxBitmap(bitmap9),_T("Events view"));
iToolBar->AddTool(ID_SRIO,_T("evnt"),wxBitmap(bitmap10),_T("Serial IO shell"));
iToolBar->Realize();
}
// creat the cameras tree
iTree = new wxTreeCtrl(this,wxID_ANY,wxDefaultPosition,wxDefaultSize,wxTR_HAS_BUTTONS | wxTR_SINGLE);
if(iTree)
iRoot = iTree->AddRoot(_T("Host"));
// append a custom event to simuate a post-on-screen event
wxCommandEvent lEvent(dOPENING,GetId());
lEvent.SetEventObject(this);
GetEventHandler()->AddPendingEvent(lEvent);
}
}
开发者ID:AIRLab-POLIMI,项目名称:iDrive,代码行数:85,代码来源:MainWindow.cpp
示例12: event
bool wxCheckListBox::MSWOnNotify(int idCtrl, WXLPARAM lParam, WXLPARAM *result)
{
// prepare the event
// -----------------
wxCommandEvent event(wxEVT_NULL, m_windowId);
event.SetEventObject(this);
wxEventType eventType = wxEVT_NULL;
NMHDR *nmhdr = (NMHDR *)lParam;
if ( nmhdr->hwndFrom == GetHwnd() )
{
// almost all messages use NM_LISTVIEW
NM_LISTVIEW *nmLV = (NM_LISTVIEW *)nmhdr;
const int iItem = nmLV->iItem;
bool processed = true;
switch ( nmhdr->code )
{
case LVN_ITEMCHANGED:
// we translate this catch all message into more interesting
// (and more easy to process) wxWidgets events
// first of all, we deal with the state change events only and
// only for valid items (item == -1 for the virtual list
// control)
if ( nmLV->uChanged & LVIF_STATE && iItem != -1 )
{
// temp vars for readability
const UINT stOld = nmLV->uOldState;
const UINT stNew = nmLV->uNewState;
// Check image changed
if ((stOld & LVIS_STATEIMAGEMASK) != (stNew & LVIS_STATEIMAGEMASK))
{
event.SetEventType(wxEVT_CHECKLISTBOX);
event.SetInt(IsChecked(iItem));
(void) GetEventHandler()->ProcessEvent(event);
}
if ( (stNew & LVIS_SELECTED) != (stOld & LVIS_SELECTED) )
{
eventType = wxEVT_LISTBOX;
event.SetExtraLong( (stNew & LVIS_SELECTED) != 0 ); // is a selection
event.SetInt(iItem);
}
}
if ( eventType == wxEVT_NULL )
{
// not an interesting event for us
return false;
}
break;
default:
processed = false;
}
if ( !processed )
return wxControl::MSWOnNotify(idCtrl, lParam, result);
}
else
{
// where did this one come from?
return false;
}
// process the event
// -----------------
event.SetEventType(eventType);
bool processed = GetEventHandler()->ProcessEvent(event);
if ( processed )
*result = 0;
return processed;
}
开发者ID:0ryuO,项目名称:dolphin-avsync,代码行数:84,代码来源:checklst.cpp
示例13: DoSetThumb
bool wxScrollBar::PerformAction(const wxControlAction& action,
long numArg,
const wxString& strArg)
{
int thumbOld = m_thumbPos;
bool notify = false; // send an event about the change?
wxEventType scrollType;
// test for thumb move first as these events happen in quick succession
if ( action == wxACTION_SCROLL_THUMB_MOVE )
{
DoSetThumb(numArg);
// VS: we have to force redraw here, otherwise the thumb will lack
// behind mouse cursor
UpdateThumb();
scrollType = wxEVT_SCROLLWIN_THUMBTRACK;
}
else if ( action == wxACTION_SCROLL_LINE_UP )
{
scrollType = wxEVT_SCROLLWIN_LINEUP;
ScrollLines(-1);
}
else if ( action == wxACTION_SCROLL_LINE_DOWN )
{
scrollType = wxEVT_SCROLLWIN_LINEDOWN;
ScrollLines(1);
}
else if ( action == wxACTION_SCROLL_PAGE_UP )
{
scrollType = wxEVT_SCROLLWIN_PAGEUP;
ScrollPages(-1);
}
else if ( action == wxACTION_SCROLL_PAGE_DOWN )
{
scrollType = wxEVT_SCROLLWIN_PAGEDOWN;
ScrollPages(1);
}
else if ( action == wxACTION_SCROLL_START )
{
scrollType = wxEVT_SCROLLWIN_THUMBRELEASE; // anything better?
ScrollToStart();
}
else if ( action == wxACTION_SCROLL_END )
{
scrollType = wxEVT_SCROLLWIN_THUMBRELEASE; // anything better?
ScrollToEnd();
}
else if ( action == wxACTION_SCROLL_THUMB_DRAG )
{
// we won't use it but this line suppresses the compiler
// warning about "variable may be used without having been
// initialized"
scrollType = wxEVT_NULL;
}
else if ( action == wxACTION_SCROLL_THUMB_RELEASE )
{
// always notify about this
notify = true;
scrollType = wxEVT_SCROLLWIN_THUMBRELEASE;
}
else
return wxControl::PerformAction(action, numArg, strArg);
// has scrollbar position changed?
bool changed = m_thumbPos != thumbOld;
if ( notify || changed )
{
if ( IsStandalone() )
{
// we should generate EVT_SCROLL events for the standalone
// scrollbars and not the EVT_SCROLLWIN ones
//
// NB: we assume that scrollbar events are sequentially numbered
// but this should be ok as other code relies on this as well
scrollType += wxEVT_SCROLL_TOP - wxEVT_SCROLLWIN_TOP;
wxScrollEvent event(scrollType, this->GetId(), m_thumbPos,
IsVertical() ? wxVERTICAL : wxHORIZONTAL);
event.SetEventObject(this);
GetEventHandler()->ProcessEvent(event);
}
else // part of the window
{
wxScrollWinEvent event(scrollType, m_thumbPos,
IsVertical() ? wxVERTICAL : wxHORIZONTAL);
event.SetEventObject(this);
GetParent()->GetEventHandler()->ProcessEvent(event);
}
}
return true;
}
开发者ID:esrrhs,项目名称:fuck-music-player,代码行数:95,代码来源:scrolbar.cpp
示例14: wxCHECK_MSG
int wxTreebook::DoSetSelection(size_t pagePos, int flags)
{
wxCHECK_MSG( IS_VALID_PAGE(pagePos), wxNOT_FOUND,
wxT("invalid page index in wxListbook::DoSetSelection()") );
wxASSERT_MSG( GetPageCount() == DoInternalGetPageCount(),
wxT("wxTreebook logic error: m_treeIds and m_pages not in sync!"));
wxBookCtrlEvent event(wxEVT_COMMAND_TREEBOOK_PAGE_CHANGING, m_windowId);
const int oldSel = m_selection;
wxTreeCtrl *tree = GetTreeCtrl();
bool allowed = false;
if (flags & SetSelection_SendEvent)
{
event.SetEventObject(this);
event.SetSelection(pagePos);
event.SetOldSelection(m_selection);
// don't send the event if the old and new pages are the same; do send it
// otherwise and be prepared for it to be vetoed
allowed = (int)pagePos == m_selection ||
!GetEventHandler()->ProcessEvent(event) ||
event.IsAllowed();
}
if ( !(flags & SetSelection_SendEvent) || allowed )
{
// hide the previously shown page
wxTreebookPage * const oldPage = DoGetCurrentPage();
if ( oldPage )
oldPage->Hide();
// then show the new one
m_selection = pagePos;
wxTreebookPage *page = wxBookCtrlBase::GetPage(m_selection);
if ( !page )
{
// find the next page suitable to be shown: the first (grand)child
// of this one with a non-NULL associated page
wxTreeItemId childId = m_treeIds[pagePos];
int actualPagePos = pagePos;
while ( !page && childId.IsOk() )
{
wxTreeItemIdValue cookie;
childId = tree->GetFirstChild( childId, cookie );
if ( childId.IsOk() )
{
page = wxBookCtrlBase::GetPage(++actualPagePos);
}
}
m_actualSelection = page ? actualPagePos : m_selection;
}
if ( page )
page->Show();
tree->SelectItem(DoInternalGetPage(pagePos));
if (flags & SetSelection_SendEvent)
{
// notify about the (now completed) page change
event.SetEventType(wxEVT_COMMAND_TREEBOOK_PAGE_CHANGED);
(void)GetEventHandler()->ProcessEvent(event);
}
}
else if ( (flags & SetSelection_SendEvent) && !allowed) // page change vetoed
{
// tree selection might have already had changed
if ( oldSel != wxNOT_FOUND )
tree->SelectItem(DoInternalGetPage(oldSel));
}
return oldSel;
}
开发者ID:czxxjtu,项目名称:wxPython-1,代码行数:75,代码来源:treebkg.cpp
示例15: GetScreen
bool FOOTPRINT_EDIT_FRAME::OnHotKey( wxDC* aDC, int aHotKey, const wxPoint& aPosition,
EDA_ITEM* aItem )
{
if( aHotKey == 0 )
return false;
bool blockActive = GetScreen()->m_BlockLocate.GetCommand() != BLOCK_IDLE;
BOARD_ITEM* item = GetCurItem();
bool ItemFree = (item == 0) || (item->GetFlags() == 0);
wxCommandEvent cmd( wxEVT_COMMAND_MENU_SELECTED );
cmd.SetEventObject( this );
/* Convert lower to upper case (the usual toupper function has problem with non ascii
* codes like function keys */
if( (aHotKey >= 'a') && (aHotKey <= 'z') )
aHotKey += 'A' - 'a';
EDA_HOTKEY* HK_Descr = GetDescriptorFromHotkey( aHotKey, common_Hotkey_List );
if( HK_Descr == NULL )
HK_Descr = GetDescriptorFromHotkey( aHotKey, module_edit_Hotkey_List );
if( HK_Descr == NULL )
return false;
switch( HK_Descr->m_Idcommand )
{
default:
case HK_NOT_FOUND:
return false;
case HK_HELP: // Display Current hotkey list
DisplayHotkeyList( this, g_Module_Editor_Hokeys_Descr );
break;
case HK_RESET_LOCAL_COORD: // set local (relative) coordinate origin
GetScreen()->m_O_Curseur = GetCrossHairPosition();
break;
case HK_LEFT_CLICK:
OnLeftClick( aDC, aPosition );
break;
case HK_LEFT_DCLICK: // Simulate a double left click: generate 2 events
OnLeftClick( aDC, aPosition );
OnLeftDClick( aDC, aPosition );
break;
case HK_SET_GRID_ORIGIN:
SetGridOrigin( GetCrossHairPosition() );
m_canvas->Refresh();
break;
case HK_RESET_GRID_ORIGIN:
SetGridOrigin( wxPoint(0,0) );
m_canvas->Refresh();
break;
case HK_SWITCH_UNITS:
cmd.SetId( (g_UserUnit == INCHES) ?
ID_TB_OPTIONS_SELECT_UNIT_MM : ID_TB_OPTIONS_SELECT_UNIT_INCH );
GetEventHandler()->ProcessEvent( cmd );
break;
case HK_ZOOM_IN:
cmd.SetId( ID_POPUP_ZOOM_IN );
GetEventHandler()->ProcessEvent( cmd );
break;
case HK_ZOOM_OUT:
cmd.SetId( ID_POPUP_ZOOM_OUT );
GetEventHandler()->ProcessEvent( cmd );
break;
case HK_ZOOM_REDRAW:
cmd.SetId( ID_ZOOM_REDRAW );
GetEventHandler()->ProcessEvent( cmd );
break;
case HK_ZOOM_CENTER:
cmd.SetId( ID_POPUP_ZOOM_CENTER );
GetEventHandler()->ProcessEvent( cmd );
break;
case HK_UNDO:
case HK_REDO:
if( ItemFree && !blockActive )
{
wxCommandEvent event( wxEVT_COMMAND_TOOL_CLICKED, HK_Descr->m_IdMenuEvent );
wxPostEvent( this, event );
}
break;
case HK_ZOOM_AUTO:
cmd.SetId( ID_ZOOM_PAGE );
GetEventHandler()->ProcessEvent( cmd );
break;
case HK_EDIT_ITEM:
OnHotkeyEditItem( HK_EDIT_ITEM );
//.........这里部分代码省略.........
开发者ID:LDavis4559,项目名称:kicad-source-mirror,代码行数:101,代码来源:hotkeys_module_editor.cpp
示例16: help
void wxTopLevelWindowMac::DoMoveWindow(int x, int y, int width, int height)
{
wxMacPortStateHelper help( (GrafPtr) GetWindowPort( (WindowRef) m_macWindow) ) ;
wxMacWindowClipper clip (this);
int former_x = m_x ;
int former_y = m_y ;
int former_w = m_width ;
int former_h = m_height ;
int actualWidth = width;
int actualHeight = height;
int actualX = x;
int actualY = y;
if ((m_minWidth != -1) && (actualWidth < m_minWidth))
actualWidth = m_minWidth;
if ((m_minHeight != -1) && (actualHeight < m_minHeight))
actualHeight = m_minHeight;
if ((m_maxWidth != -1) && (actualWidth > m_maxWidth))
actualWidth = m_maxWidth;
if ((m_maxHeight != -1) && (actualHeight > m_maxHeight))
actualHeight = m_maxHeight;
bool doMove = false ;
bool doResize = false ;
if ( actualX != former_x || actualY != former_y )
{
doMove = true ;
}
if ( actualWidth != former_w || actualHeight != former_h )
{
doResize = true ;
}
if ( doMove || doResize )
{
m_x = actualX ;
m_y = actualY ;
if ( doMove )
::MoveWindow((WindowRef)m_macWindow, m_x, m_y , false); // don't make frontmost
m_width = actualWidth ;
m_height = actualHeight ;
if ( doResize )
::SizeWindow((WindowRef)m_macWindow, m_width, m_height , true);
// the OS takes care of invalidating and erasing the new area so we only have to
// take care of refreshing for full repaints
if ( doResize && HasFlag(wxFULL_REPAINT_ON_RESIZE) )
Refresh() ;
if ( IsKindOf( CLASSINFO( wxFrame ) ) )
{
wxFrame* frame = (wxFrame*) this ;
#if wxUSE_STATUSBAR
frame->PositionStatusBar();
#endif
#if wxUSE_TOOLBAR
frame->PositionToolBar();
#endif
}
if ( doMove )
wxWindowMac::MacTopLevelWindowChangedPosition() ; // like this only children will be notified
MacRepositionScrollBars() ;
if ( doMove )
{
wxPoint point(m_x, m_y);
wxMoveEvent event(point, m_windowId);
event.SetEventObject(this)
|
请发表评论