dialpadbutton.cpp

来自「基于sipfoundy 公司开发的sipx协议API」· C++ 代码 · 共 84 行

CPP
84
字号
//// Copyright (C) 2005-2006 SIPez LLC.// Licensed to SIPfoundry under a Contributor Agreement.//// Copyright (C) 2004-2006 SIPfoundry Inc.// Licensed by SIPfoundry under the LGPL license.//// Copyright (C) 2004, 2005 Pingtel Corp.// Licensed to SIPfoundry under a Contributor Agreement.//// $$////////////////////////////////////////////////////////////////////////// SYSTEM INCLUDES// APPLICATION INCLUDES#include "stdwx.h"#include "sipXmgr.h"#include "DialPadButton.h"#include <os/OsCallback.h>#include <os/OsTimer.h>// EXTERNAL FUNCTIONS// EXTERNAL VARIABLES// CONSTANTS// STATIC VARIABLE INITIALIZATIONS// MACROSBEGIN_EVENT_TABLE(DialPadButton, wxBitmapButton)   EVT_LEFT_DOWN(DialPadButton::OnMouseDown)#ifndef __MACH__   /* EVT_LEFT_UP is broken on OS X. Disable it and use a timer instead. */   EVT_LEFT_UP(DialPadButton::OnMouseUp)#endifEND_EVENT_TABLE()// ConstructorDialPadButton::DialPadButton(wxWindow* parent, int id, const wxBitmap& bitmap, const wxPoint& pos, const wxSize& size, const enum TONE_ID toneId, const char charVal) :   wxBitmapButton(parent, id, bitmap, pos, size, 0),   mToneId(toneId),   mCharVal(charVal){}// DestructorDialPadButton::~DialPadButton(){}#ifdef __MACH__static void buttonUpCallback(const int userData, const int eventData){    if (sipXmgr::getInstance().getCurrentCall() > 0)    {        sipxCallStopTone(sipXmgr::getInstance().getCurrentCall());    }}static OsCallback callback(0, buttonUpCallback);static OsTime callbackDelay(350);static OsTimer callbackTimer(callback);#endifvoid DialPadButton::OnMouseDown(wxMouseEvent& event){    if (sipXmgr::getInstance().getCurrentCall() > 0)    {        sipxCallStartTone(sipXmgr::getInstance().getCurrentCall(), mToneId, true, true);    }#ifdef __MACH__    callbackTimer.oneshotAfter(callbackDelay);#endif    event.Skip();}void DialPadButton::OnMouseUp(wxMouseEvent& event){    if (sipXmgr::getInstance().getCurrentCall() > 0)    {        sipxCallStopTone(sipXmgr::getInstance().getCurrentCall());    }    event.Skip();}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?