本文整理汇总了C++中FindFocus函数的典型用法代码示例。如果您正苦于以下问题:C++ FindFocus函数的具体用法?C++ FindFocus怎么用?C++ FindFocus使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了FindFocus函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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;
}
示例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;
}
示例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();
}
示例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
}
}
示例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"));
}
}
}
示例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;
}
}
示例7: SetStop
void ControlToolBar::SetStop(bool down)
{
if (down)
mStop->PushDown();
else {
if(FindFocus() == mStop)
mPlay->SetFocus();
mStop->PopUp();
}
EnableDisableButtons();
}
示例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);
}
}
示例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();
}
示例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;
}
示例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();
}
示例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);
}
示例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();
}
}
示例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();
}
}
}
示例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();
}