⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 dialentrypanel.cpp

📁 基于sipfoundy 公司开发的sipx协议API
💻 CPP
字号:
//// 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 "DialEntryPanel.h"#include "sipXezPhoneSettings.h"#include "sipXmgr.h"#include "DialerThread.h"#include "states/PhoneStateMachine.h"#include "utl/UtlDListIterator.h"// EXTERNAL FUNCTIONS// EXTERNAL VARIABLES// CONSTANTS// STATIC VARIABLE INITIALIZATIONS// MACROSBEGIN_EVENT_TABLE(DialEntryPanel, wxPanel)   EVT_BUTTON(IDR_DIAL_ENTRY_BUTTON, DialEntryPanel::OnButtonClick)   EVT_TEXT_ENTER(wxID_ANY, DialEntryPanel::OnEnter)END_EVENT_TABLE()// ConstructorDialEntryPanel::DialEntryPanel(wxWindow* parent, const wxPoint& pos, const wxSize& size) :   wxPanel(parent, IDR_DIAL_ENTRY_PANEL, pos, size, wxTAB_TRAVERSAL, "DialEntryPanel"),   mpSizer(NULL),   mpComboBox(NULL),   mpOutline(NULL),   mpListener(NULL){    wxColor* pPanelColor = & (sipXezPhoneSettings::getInstance().getBackgroundColor());    SetBackgroundColour(*pPanelColor);    wxPoint origin(0,0);    mpOutline = new wxStaticBox(this, -1, "Dial", origin, size);    mpOutline->SetBackgroundColour(*pPanelColor);    mpSizer = new wxStaticBoxSizer(mpOutline, wxHORIZONTAL);    wxSize controlSize(150, 20);    mpComboBox = new wxComboBox(this, IDR_DIAL_ENTRY_TEXT, "", wxDefaultPosition, controlSize);        mpComboBox->SetBackgroundColour(*pPanelColor);    mpSizer->Add(mpComboBox);    // init the combo    UtlDList& list = sipXezPhoneSettings::getInstance().getRecentNumberList();    UtlDListIterator iterator(list);    UtlString* pTemp;    while (pTemp = (UtlString*)iterator())    {        mpComboBox->Append(pTemp->data());    }    mpSizer->Add(10, 20); // add a spacer    controlSize.SetWidth(30);    controlSize.SetHeight(30);    wxBitmap bitmap("res/dial.bmp", wxBITMAP_TYPE_BMP );    bitmap.SetMask(new wxMask(bitmap, * (wxTheColourDatabase->FindColour("RED"))));    wxColor* wxLightBlue = wxTheColourDatabase->FindColour("LIGHT BLUE");    mpDialButton = new wxBitmapButton(this, IDR_DIAL_ENTRY_BUTTON, bitmap, wxDefaultPosition, controlSize);    mpDialButton->SetBackgroundColour(*wxLightBlue);    mpSizer->Add(mpDialButton);    SetSizer(mpSizer, true);    SetAutoLayout(TRUE);    Layout();    // add a state machine observer    mpListener = new DialEntryPhoneStateMachineObserver(this);    PhoneStateMachine::getInstance().addObserver(mpListener);}// DestructorDialEntryPanel::~DialEntryPanel(){    PhoneStateMachine::getInstance().removeObserver(mpListener);    delete mpListener;    mpListener = NULL;}const wxString DialEntryPanel::getEnteredText(){   wxString phoneNumber;    wxComboBox* pCtrl = dynamic_cast<wxComboBox*>(FindWindowById(IDR_DIAL_ENTRY_TEXT, this));    if (pCtrl)    {        phoneNumber = pCtrl->GetValue();    }    return phoneNumber;}// Event handler for the buttonvoid DialEntryPanel::OnButtonClick(wxCommandEvent& event){   wxString phoneNumber = getEnteredText();    wxComboBox* pCtrl = dynamic_cast<wxComboBox*>(FindWindowById(IDR_DIAL_ENTRY_TEXT, this));    if (phoneNumber != "")    {        PhoneStateMachine::getInstance().OnDial(phoneNumber);    }}void DialEntryPanel::OnEnter(wxCommandEvent& event){    wxString phoneNumber = getEnteredText();    wxComboBox* pCtrl = dynamic_cast<wxComboBox*>(FindWindowById(IDR_DIAL_ENTRY_TEXT, this));    if (phoneNumber != "")    {        PhoneStateMachine::getInstance().OnDial(phoneNumber);    }}PhoneState* DialEntryPanel::DialEntryPhoneStateMachineObserver::OnDial(const wxString phoneNumber){    if (mpOwner->getComboBox().FindString(phoneNumber) == -1)    {        mpOwner->getComboBox().Append(phoneNumber);    }    return NULL;}PhoneState* DialEntryPanel::DialEntryPhoneStateMachineObserver::OnRinging(SIPX_CALL hCall){    char szIncomingNumber[256];    sipxCallGetRemoteID(hCall, szIncomingNumber, 256);    wxString incomingNumber(szIncomingNumber);    if (mpOwner->getComboBox().FindString(incomingNumber) == -1)    {        mpOwner->getComboBox().Append(incomingNumber);    }    return NULL;}

⌨️ 快捷键说明

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