本文整理汇总了C++中FindFocus函数的典型用法代码示例。如果您正苦于以下问题:C++ FindFocus函数的具体用法?C++ FindFocus怎么用?C++ FindFocus使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了FindFocus函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: OnCaptureKey
void DeviceToolBar::OnCaptureKey(wxCommandEvent &event)
{
wxKeyEvent *kevent = (wxKeyEvent *)event.GetEventObject();
int keyCode = kevent->GetKeyCode();
// Pass UP/DOWN/LEFT/RIGHT through for input/output choice
if (FindFocus() == mInput && (keyCode == WXK_LEFT || keyCode == WXK_RIGHT
|| keyCode == WXK_UP || keyCode == WXK_DOWN)) {
return;
}
if (FindFocus() == mOutput && (keyCode == WXK_LEFT || keyCode == WXK_RIGHT
|| keyCode == WXK_UP || keyCode == WXK_DOWN)) {
return;
}
event.Skip();
return;
}
开发者ID:jozsefmezei,项目名称:audacity,代码行数:19,代码来源:DeviceToolBar.cpp
示例2: FindFocus
void wxTopLevelWindowMSW::DoSaveLastFocus()
{
if ( m_iconized )
return;
// remember the last focused child if it is our child
wxWindow* const winFocus = FindFocus();
m_winLastFocused = IsDescendant(winFocus) ? winFocus : NULL;
}
开发者ID:vdm113,项目名称:wxWidgets-ICC-patch,代码行数:10,代码来源:toplevel.cpp
示例3: FindFocus
void SelectionBar::OnUpdate(wxCommandEvent &evt)
{
int index = evt.GetInt();
wxWindow *w = FindFocus();
bool leftFocus = (w == mLeftTime);
bool rightFocus = (w == mRightTime);
bool audioFocus = (w == mAudioTime);
evt.Skip(false);
/* we don't actually need a TimeTextCtrl, but need it's
* translations which are done at runtime */
TimeTextCtrl *ttc = new TimeTextCtrl(this, wxID_ANY, wxT(""), 0.0, mRate);
wxString formatName(ttc->GetBuiltinName(index));
gPrefs->Write(wxT("/SelectionFormat"), formatName);
gPrefs->Flush();
#if wxUSE_TOOLTIPS
mSnapTo->SetToolTip(wxString::Format(_("Snap Clicks/Selections to %s"), formatName.c_str()));
#endif
delete ttc;
// ToolBar::ReCreateButtons() will get rid of our sizers and controls
// so reset pointers first.
mLeftTime =
mRightTime =
mAudioTime = NULL;
mRightEndButton =
mRightLengthButton = NULL;
mRateBox = NULL;
mRateText = NULL;
ToolBar::ReCreateButtons();
ValuesToControls();
wxString formatString = mLeftTime->GetBuiltinFormat(index);
mLeftTime->SetFormatString(formatString);
mRightTime->SetFormatString(formatString);
mAudioTime->SetFormatString(formatString);
if (leftFocus) {
mLeftTime->SetFocus();
}
else if (rightFocus) {
mRightTime->SetFocus();
}
else if (audioFocus) {
mAudioTime->SetFocus();
}
Updated();
}
开发者ID:tuanmasterit,项目名称:audacity,代码行数:55,代码来源:SelectionBar.cpp
示例4: FindFocus
// Default activation behaviour - set the focus for the first child
// subwindow found.
void wxFrame::OnActivate(wxActivateEvent& event)
{
if ( !event.GetActive() )
{
// remember the last focused child if it is our child
m_winLastFocused = FindFocus();
// so we NULL it out if it's a child from some other frame
wxWindow *win = m_winLastFocused;
while ( win )
{
if ( win->IsTopLevel() )
{
if ( win != this )
m_winLastFocused = NULL;
break;
}
win = win->GetParent();
}
event.Skip();
}
else
{
// restore focus to the child which was last focused
wxWindow *parent = m_winLastFocused
? m_winLastFocused->GetParent()
: NULL;
if (parent == NULL)
parent = this;
wxSetFocusToChild(parent, &m_winLastFocused);
#if wxUSE_MENUS
if (m_frameMenuBar != NULL)
{
m_frameMenuBar->MacInstallMenuBar();
}
else
{
wxFrame *tlf = wxDynamicCast( wxTheApp->GetTopWindow(), wxFrame );
if (tlf != NULL)
{
// Trying top-level frame membar
if (tlf->GetMenuBar())
tlf->GetMenuBar()->MacInstallMenuBar();
}
}
#endif
}
}
开发者ID:mark711,项目名称:Cafu,代码行数:56,代码来源:frame.cpp
示例5: OnOutputUpdate
void NyqBench::OnOutputUpdate(wxUpdateUIEvent & e)
{
if (mOutputBox && mOutput && FindFocus() == mOutput) {
wxString label = mOutputBox->GetLabel();
if (label == _("Output")) {
label += wxT("*");
mOutputBox->SetLabel(label);
mScriptBox->SetLabel(_("Script"));
}
}
}
开发者ID:finefin,项目名称:audacity,代码行数:11,代码来源:NyqBench.cpp
示例6: FindFocus
void MvcController::UponChildFocus(wxChildFocusEvent& event)
{
event.Skip();
wxWindow* new_focused_window = FindFocus();
// A wxChildFocusEvent is sent for every window in the hierarchy,
// from new_focused_window up to this MvcController. Ignore all
// but the "deepest" one--see:
// http://lists.nongnu.org/archive/html/lmi/2009-01/msg00001.html
if(event.GetWindow() != new_focused_window)
{
return;
}
// Do nothing if focus hasn't changed. This case arises when
// another application is activated, and then this application
// is reactivated.
if(last_focused_window_ == new_focused_window)
{
return;
}
if
( wxID_CANCEL == new_focused_window->GetId()
|| wxID_HELP == new_focused_window->GetId()
)
{
return;
}
if(Validate())
{
if(new_focused_window)
{
last_focused_window_ = new_focused_window;
}
else
{
warning() << "Keyboard focus was lost." << LMI_FLUSH;
RefocusLastFocusedWindow();
}
}
else
{
LMI_ASSERT(!unit_test_refocus_event_pending_);
if(!unit_test_under_way_)
{
wxCommandEvent event0(wxEVT_REFOCUS_INVALID_CONTROL);
wxPostEvent(this, event0);
}
unit_test_refocus_event_pending_ = true;
}
}
开发者ID:vadz,项目名称:lmi,代码行数:54,代码来源:mvc_controller.cpp
示例7: SetStop
void ControlToolBar::SetStop(bool down)
{
if (down)
mStop->PushDown();
else {
if(FindFocus() == mStop)
mPlay->SetFocus();
mStop->PopUp();
}
EnableDisableButtons();
}
开发者ID:PhilSee,项目名称:audacity,代码行数:11,代码来源:ControlToolBar.cpp
示例8: FindFocus
/*---------------------------------------------------------------------------*/
void wxSQLBook::OnClearAllClick(wxCommandEvent& event)
{
wxWindow* window = FindFocus();
if (window)
{
if (window == m_SQLEdit)
m_SQLEdit->ClearAll();
else if (window == m_LogResult)
m_LogResult->SetValue(wxEmptyString);
}
}
开发者ID:4silvertooth,项目名称:wxSqlitePlus,代码行数:12,代码来源:sqlbook.cpp
示例9: wxCHECK_RET
void wxNonOwnedWindow::SetDfbFocus()
{
wxCHECK_RET( IsShown(), "cannot set focus to hidden window" );
wxASSERT_MSG( FindFocus() && FindFocus()->GetTLW() == this,
"setting DirectFB focus to unexpected window" );
// Don't set DirectFB focus if we're called from HandleFocusEvent() on
// this window, because we already have the focus in that case. Not only
// would it be unnecessary, it would be harmful: RequestFocus() adds
// an event to DirectFB event queue and calling it when in
// HandleFocusEvent() could result in a window being focused when it
// should not be. Consider this example:
//
// tlw1->SetFocus(); // (1)
// tlw2->SetFocus(); // (2)
//
// This results in adding these events to DFB queue:
//
// DWET_GOTFOCUS(tlw1)
// DWET_LOSTFOCUS(tlw1)
// DWET_GOTFOCUS(tlw2)
//
// Note that the events are processed by event loop, i.e. not between
// execution of lines (1) and (2) above. So by the time the first
// DWET_GOTFOCUS event is handled, tlw2->SetFocus() was already executed.
// If we onconditionally called RequestFocus() from here, handling the
// first event would result in this change to the event queue:
//
// DWET_LOSTFOCUS(tlw1)
// DWET_GOTFOCUS(tlw2) // (3)
// DWET_LOSTFOCUS(tlw2)
// DWET_GOTFOCUS(tlw1)
//
// And the focus would get back to tlw1 even though that's not what we
// wanted.
if ( gs_insideDFBFocusHandlerOf == this )
return;
GetDirectFBWindow()->RequestFocus();
}
开发者ID:beanhome,项目名称:dev,代码行数:41,代码来源:nonownedwnd.cpp
示例10: OnCaptureKey
void MixerToolBar::OnCaptureKey(wxCommandEvent &event)
{
wxKeyEvent *kevent = (wxKeyEvent *)event.GetEventObject();
int keyCode = kevent->GetKeyCode();
// Pass LEFT/RIGHT/UP/DOWN/PAGEUP/PAGEDOWN through for input/output sliders
if (FindFocus() == mOutputSlider && (keyCode == WXK_LEFT || keyCode == WXK_RIGHT
|| keyCode == WXK_UP || keyCode == WXK_DOWN
|| keyCode == WXK_PAGEUP || keyCode == WXK_PAGEDOWN)) {
return;
}
if (FindFocus() == mInputSlider && (keyCode == WXK_LEFT || keyCode == WXK_RIGHT
|| keyCode == WXK_UP || keyCode == WXK_DOWN
|| keyCode == WXK_PAGEUP || keyCode == WXK_PAGEDOWN)) {
return;
}
event.Skip();
return;
}
开发者ID:GYGit,项目名称:Audacity,代码行数:21,代码来源:MixerToolBar.cpp
示例11: FindFocus
void SelectionBar::OnUpdate(wxCommandEvent &evt)
{
int index = evt.GetInt();
wxWindow *w = FindFocus();
bool leftFocus = (w == mLeftTime);
bool rightFocus = (w == mRightTime);
bool audioFocus = (w == mAudioTime);
evt.Skip(false);
wxString format;
// Save format name before recreating the controls so they resize properly
format = mLeftTime->GetBuiltinName(index);
mListener->AS_SetSelectionFormat(format);
#if wxUSE_TOOLTIPS
mSnapTo->SetToolTip(wxString::Format(_("Snap Clicks/Selections to %s"), format.c_str()));
#endif
// ToolBar::ReCreateButtons() will get rid of our sizers and controls
// so reset pointers first.
mLeftTime =
mRightTime =
mAudioTime = NULL;
mRightEndButton =
mRightLengthButton = NULL;
mRateBox = NULL;
mRateText = NULL;
ToolBar::ReCreateButtons();
ValuesToControls();
format = mLeftTime->GetBuiltinFormat(index);
mLeftTime->SetFormatString(format);
mRightTime->SetFormatString(format);
mAudioTime->SetFormatString(format);
if (leftFocus) {
mLeftTime->SetFocus();
}
else if (rightFocus) {
mRightTime->SetFocus();
}
else if (audioFocus) {
mAudioTime->SetFocus();
}
Updated();
}
开发者ID:Grunji,项目名称:audacity,代码行数:53,代码来源:SelectionBar.cpp
示例12: FindFocus
/*---------------------------------------------------------------------------*/
void wxTableBook::OnCopyClick(wxCommandEvent& event)
{
wxWindow* window = FindFocus();
if (window && ((window == m_PageDdl)||
(m_PageColumns && m_PageColumns->HasFocus())||
(m_PageData && m_PageData->HasFocus())||
(m_PageForeignKey && m_PageForeignKey->HasFocus())||
(m_PageTriggers && m_PageTriggers->HasFocus())||
(m_PageIndexes && m_PageIndexes->HasFocus())))
window->GetEventHandler()->ProcessEvent(event);
}
开发者ID:4silvertooth,项目名称:wxSqlitePlus,代码行数:13,代码来源:tablebook.cpp
示例13: HitTest
void wxCheckListBox::OnLeftClick(wxMouseEvent& event)
{
// clicking on the item selects it, clicking on the checkmark toggles
int nItem = HitTest(event.GetX(), event.GetY());
if ( nItem != wxNOT_FOUND )
{
wxRect rect;
GetItemRect(nItem, rect);
// convert item rect to check mark rect
wxSize size = wxRendererNative::Get().GetCheckBoxSize(this);
rect.x += CHECKMARK_EXTRA_SPACE;
rect.y += (rect.GetHeight() - size.GetHeight()) / 2;
rect.SetSize(size);
if ( rect.Contains(event.GetX(), event.GetY()) )
{
// people expect to get "kill focus" event for the currently
// focused control before getting events from the other controls
// and, equally importantly, they may prevent the focus change from
// taking place at all (e.g. because the old control contents is
// invalid and needs to be corrected) in which case we shouldn't
// generate this event at all
SetFocus();
if ( FindFocus() == this )
{
Toggle(nItem);
SendEvent(nItem);
// scroll one item down if the item is the last one
// and isn't visible at all
int h;
GetClientSize(NULL, &h);
if ( rect.GetBottom() > h )
ScrollLines(1);
}
}
else
{
// implement default behaviour: clicking on the item selects it
event.Skip();
}
}
else
{
// implement default behaviour on click outside of client zone
event.Skip();
}
}
开发者ID:AdmiralCurtiss,项目名称:pcsx2,代码行数:51,代码来源:checklst.cpp
示例14: FindFocus
// Default activation behaviour - set the focus for the first child
// subwindow found.
void wxFrame::OnActivate(wxActivateEvent& event)
{
if ( !event.GetActive() )
{
// remember the last focused child if it is our child
m_winLastFocused = FindFocus();
// so we NULL it out if it's a child from some other frame
wxWindow *win = m_winLastFocused;
while ( win )
{
if ( win->IsTopLevel() )
{
if ( win != this )
{
m_winLastFocused = NULL;
}
break;
}
win = win->GetParent();
}
event.Skip();
}
else
{
// restore focus to the child which was last focused
wxWindow *parent = m_winLastFocused ? m_winLastFocused->GetParent()
: NULL;
if ( !parent )
{
parent = this;
}
wxSetFocusToChild(parent, &m_winLastFocused);
if ( m_frameMenuBar != NULL )
{
m_frameMenuBar->MacInstallMenuBar() ;
}
else if (wxTheApp->GetTopWindow() && wxTheApp->GetTopWindow()->IsKindOf(CLASSINFO(wxFrame)))
{
// Trying toplevel frame menbar
if( ((wxFrame*)wxTheApp->GetTopWindow())->GetMenuBar() )
((wxFrame*)wxTheApp->GetTopWindow())->GetMenuBar()->MacInstallMenuBar();
}
}
}
开发者ID:gitrider,项目名称:wxsj2,代码行数:52,代码来源:frame.cpp
示例15: FindFocus
void SelectionBar::OnUpdate(wxCommandEvent &evt)
{
int index = evt.GetInt();
wxWindow *w = FindFocus();
bool leftFocus = (w == mLeftTime);
bool rightFocus = (w == mRightTime);
bool audioFocus = (w == mAudioTime);
evt.Skip(false);
/* we need an object to call these methods on. It actually doesn't matter
* which as they have no effect on the object state, so we just use the first
* one to hand */
wxString formatName = mLeftTime->GetBuiltinName(index);
wxString formatString = mLeftTime->GetBuiltinFormat(index);
gPrefs->Write(wxT("/SelectionFormat"), formatName);
// ToolBar::ReCreateButtons() will get rid of our sizers and controls
// so reset pointers first.
mLeftTime =
mRightTime =
mAudioTime = NULL;
mRightEndButton =
mRightLengthButton = NULL;
mRateBox = NULL;
ToolBar::ReCreateButtons();
ValuesToControls();
mLeftTime->SetFormatString(formatString);
mRightTime->SetFormatString(formatString);
mAudioTime->SetFormatString(formatString);
if (leftFocus) {
mLeftTime->SetFocus();
}
else if (rightFocus) {
mRightTime->SetFocus();
}
else if (audioFocus) {
mAudioTime->SetFocus();
}
Updated();
}
开发者ID:ruthmagnus,项目名称:audacity,代码行数:49,代码来源:SelectionBar.cpp
示例16: FindFocus
bool SearchPanel::IsActive() const {
if (!IsShown()) return false;
// Check if any local control has focus
wxWindow* focused = FindFocus();
if (focused == (wxWindow*)searchbox) return true;
if (focused == (wxWindow*)replaceBox) return true;
if (focused == (wxWindow*)nextButton) return true;
if (focused == (wxWindow*)prevButton) return true;
if (focused == (wxWindow*)replaceButton) return true;
if (focused == (wxWindow*)allButton) return true;
if (focused == (wxWindow*)closeButton) return true;
return false; // no focus
}
开发者ID:dxtravi,项目名称:e,代码行数:15,代码来源:SearchPanel.cpp
示例17: FindFocus
void wxSTEditorFindReplacePanel::OnIdle(wxIdleEvent &event)
{
if (IsShown())
{
// This is a really ugly hack because the combo forgets it's insertion
// point in MSW whenever it loses focus
wxWindow* focus = FindFocus();
if (m_findCombo && (focus == m_findCombo))
m_find_insert_pos = m_findCombo->GetInsertionPoint();
if (m_replaceCombo && (focus == m_replaceCombo))
m_replace_insert_pos = m_replaceCombo->GetInsertionPoint();
}
event.Skip();
}
开发者ID:Slulego,项目名称:GD,代码行数:15,代码来源:stefindr.cpp
示例18: wxMax
//
// Draw the background for a given line
//
// This is called by the listbox when it needs to redraw the view.
//
void
KeyView::OnDrawBackground(wxDC & dc, const wxRect & rect, size_t line) const
{
const KeyNode *node = mLines[line];
wxRect r = rect;
wxCoord indent = 0;
// When in tree view mode, each younger branch gets indented by the
// width of the open/close bitmaps
if (mViewType == ViewByTree)
{
indent += node->depth * KV_BITMAP_SIZE;
}
// Offset left side by the indentation (if any) and scroll amounts
r.x = indent - mScrollX;
// If the line width is less than the client width, then we want to
// extend the background to the right edge of the client view. Otherwise,
// go all the way to the end of the line width...this will draw past the
// right edge, but that's what we want.
r.width = wxMax(mWidth, r.width);
// Selected lines get a solid background
if (IsSelected(line))
{
if (FindFocus() == this)
{
// Focused lines get highlighted background
dc.SetBrush(wxBrush(wxSystemSettings::GetColour(wxSYS_COLOUR_HIGHLIGHT)));
AColor::DrawFocus(dc, r);
dc.DrawRectangle(r);
}
else
{
// Non ocused lines get a light background
dc.SetBrush(wxBrush(wxSystemSettings::GetColour(wxSYS_COLOUR_BTNFACE)));
dc.SetPen(*wxTRANSPARENT_PEN);
dc.DrawRectangle(r);
}
}
else
{
// Non-selected lines get a thin bottom border
dc.SetPen(wxColour(240, 240, 240));
dc.DrawLine(r.GetLeft(), r.GetBottom(), r.GetRight(), r.GetBottom());
}
}
开发者ID:tuanmasterit,项目名称:audacity,代码行数:53,代码来源:KeyView.cpp
示例19: FindFocus
void SpectralSelectionBar::OnUpdate(wxCommandEvent &evt)
{
int index = evt.GetInt();
wxWindow *w = FindFocus();
bool centerFocus = (w && w == mCenterCtrl);
bool widthFocus = (w && w == mWidthCtrl);
bool lowFocus = (w && w == mLowCtrl);
bool highFocus = (w && w == mHighCtrl);
evt.Skip(false);
// Save formats before recreating the controls so they resize properly
wxEventType type = evt.GetEventType();
if (type == EVT_FREQUENCYTEXTCTRL_UPDATED) {
NumericTextCtrl *frequencyCtrl = (mbCenterAndWidth ? mCenterCtrl : mLowCtrl);
wxString frequencyFormatName = frequencyCtrl->GetBuiltinName(index);
mListener->SSBL_SetFrequencySelectionFormatName(frequencyFormatName);
}
else if (mbCenterAndWidth &&
type == EVT_BANDWIDTHTEXTCTRL_UPDATED) {
wxString bandwidthFormatName = mWidthCtrl->GetBuiltinName(index);
mListener->SSBL_SetBandwidthSelectionFormatName(bandwidthFormatName);
}
// ToolBar::ReCreateButtons() will get rid of our sizers and controls
// so reset pointers first.
mCenterCtrl = mWidthCtrl = NULL;
mLowCtrl = mHighCtrl = NULL;
ToolBar::ReCreateButtons();
ValuesToControls();
if (centerFocus) {
mCenterCtrl->SetFocus();
}
else if (widthFocus) {
mWidthCtrl->SetFocus();
}
else if (lowFocus) {
mLowCtrl->SetFocus();
}
else if (highFocus) {
mHighCtrl->SetFocus();
}
Updated();
}
开发者ID:AthiVarathan,项目名称:audacity,代码行数:48,代码来源:SpectralSelectionBar.cpp
示例20: FindFocus
void LogFinderFrame::OnTabKeyPress(wxKeyEvent& Event)
{
wxWindow *Window = FindFocus();
if(Event.GetKeyCode() == WXK_TAB)
{
bool Backward = Event.ShiftDown();
switch (Window->GetId())
{
case ID_TEXT_FILE_PATH:
if(Backward)
FindWindow(ID_EXPORT_BUTTON)->SetFocus();
else
FindWindow(ID_FILE_BUTTON)->SetFocus();
break;
case ID_FILE_BUTTON:
if(Backward)
FindWindow(ID_TEXT_FILE_PATH)->SetFocus();
else
FindWindow(ID_WORD_SEARCH)->SetFocus();
break;
case ID_WORD_SEARCH:
if(Backward)
FindWindow(ID_FILE_BUTTON)->SetFocus();
else
FindWindow(ID_SEARCH_BUTTON)->SetFocus();
break;
case ID_SEARCH_BUTTON:
if(Backward)
FindWindow(ID_WORD_SEARCH)->SetFocus();
else
FindWindow(ID_EXPORT_BUTTON)->SetFocus();
break;
case ID_EXPORT_BUTTON:
if(Backward)
FindWindow(ID_SEARCH_BUTTON)->SetFocus();
else
FindWindow(ID_TEXT_FILE_PATH)->SetFocus();
break;
default:
if(Backward)
FindWindow(ID_EXPORT_BUTTON)->SetFocus();
else
FindWindow(ID_TEXT_FILE_PATH)->SetFocus();
}
}
}
开发者ID:rodrigoavalente,项目名称:LogFinder,代码行数:47,代码来源:LogFinderFrame.cpp
注:本文中的FindFocus函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论