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


C++ FindFocus函数代码示例

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


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