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

📄 uimanager.hpp

📁 一个WinCE6。0下的IP phone的源代码
💻 HPP
字号:
//
// Copyright (c) Microsoft Corporation.  All rights reserved.
//
//
// Use of this sample source code is subject to the terms of the Microsoft
// license agreement under which you licensed this sample source code. If
// you did not accept the terms of the license agreement, you are not
// authorized to use this sample source code. For the terms of the license,
// please see the license agreement between you and Microsoft or, if applicable,
// see the LICENSE.RTF on your install media or the root of your tools installation.
// THE SAMPLE SOURCE CODE IS PROVIDED "AS IS", WITH NO WARRANTIES.
//
#pragma once

#include "CommonFunctions.hpp"
#include "ControlDefinitions.h"
#include "Controls.hpp"
#include "Phone.hpp"
#include "Timers.hpp"
#include <string.hxx>

class Call_t; 
class CallDisplayItem_t; 

class UIManager_t : public ITimerHandler_t
{
public:
    UIManager_t();
    ~UIManager_t();
    
public:
    HRESULT 
    Initialize(
        bool IsVisible
        );
    
    static 
    LRESULT WINAPI
    s_ListenerWindowProc(
        HWND    WindowHandle, 
        UINT    Message,            
        WPARAM  wParam,             
        LPARAM  lParam
        ); 

    HRESULT
    OnHookModeChange(
        bool    IsOnHook
        ); 

    HRESULT 
    OnCallEvent(
        __in Call_t* pCall
        ); 

    HRESULT 
    OnPressAndHold(
        UINT VirtualKey
        ); 

    void
    OnHookDialing(
        WCHAR CurrentChar
        ); 

    HRESULT
    SendDTMF(
        RTC_DTMF DTMFCode
        ); 
    
    //call functions
    HRESULT
    OnHold(
        __out_opt bool* pHandled = NULL
        ); 

    HRESULT
    OnTransfer(
        __out_opt bool* pHandled = NULL
        ); 

    //ITimerHandler_t implementation
    void 
    OnTimerExpires(
        UINT    TimerID
        ); 


    void
    GetAlreadyDialedString(
        __out_ecount(BufferSize) WCHAR* pBuffer, 
        unsigned int    BufferSize
        ); 

    HRESULT
    UpdateMenuBar(
        void
        ); 

    void
    OnFailedMakingACall(
        void
        ); 

    bool
    IsEmpty(
        void
        ); 

    static
    UINT 
    GetStringIdForErrorCode(
        LONG    ErrorCode
        ); 
    
private:

    //window related
    HRESULT 
    Uninitialize(
        void
        );

    HRESULT
    CreateListenerWindow(
        void
        ); 

    HRESULT
    CreateMainDialog(
        bool IsVisible
        ); 

    HRESULT
    CreateIncomingCallMessageBox(
        void
        );     
    
    LRESULT
    ListenerWindowProc(
        HWND    WindowHandle, 
        UINT    Message, 
        WPARAM  wParam, 
        LPARAM  lParam
        ); 

    HRESULT
    ForceCloseCurrentMessageBox(
        void
        ); 

    //controls related
    HRESULT
    UpdateStatusHeader(
        void
        ); 

    HRESULT
    UpdateSelection(
        void
        ); 

    //on notifications
    void
    OnCommand(
        WPARAM wParam
        ); 

    void
    OnListboxNotify(
        DWORD   Notification
        ); 

    HRESULT
    OnEditControlUpdate(
        void
        ); 
    
    void
    OnHelp(
        void
        ); 

    //call functions
    HRESULT
    OnHangup(
        void
        ); 

    HRESULT
    OnBackSpace(
        void
        ); 

    HRESULT
    OnDial(
        void
        ); 

    HRESULT
    OnCancel(
        void
        ); 

    HRESULT
    OnAddToSpeedDial(
        void
        ); 

    HRESULT
    OnAnswer(
        void
        ); 

    HRESULT
    OnReject(
        void
        ); 

    HRESULT
    StopTransferring(
        void
        ); 

    HRESULT
    Transfer(
        void
        ); 

    HRESULT
    OnCloseHelp(
        void
        ); 

    //listbox notifcations
    HRESULT
    OnNotifySelectChanged(
        void
        ); 

    HRESULT
    OnNotifyDoubleClicked(
        void
        ); 

    //oncall event related
    HRESULT
    UpdateIncomingCall(
        __in Call_t*  pCall
        ); 

    HRESULT
    UpdateExistingCalls(
        __in Call_t* pCall
        ); 

    HRESULT 
    OnCallStatusChanged(
        __in Call_t*        pCall,
        RTC_SESSION_STATE   CallStatus,
        int                 ItemIndex
        );


    //misc    
    HRESULT 
    UpdateDialBand(
        void
        ); 

    bool
    ShouldShowDialBand(
        void
        ); 

    bool
    IsShowingDialBand(
        void
        ); 

    void 
    FindDisplayItem(
        __in Call_t*                    pCall,
        __deref_out CallDisplayItem_t** ppCallDisplayItem, 
        __out_opt int*                  pItemIndex = NULL
        ); 

    void
    GetSelectedDisplayItem(
        __deref_out CallDisplayItem_t** ppCallDisplayItem, 
        __out_opt   int*                pItemIndex = NULL
        ); 


    HRESULT
    RefreshCallDisplayItems(
        void
        ); 

    HRESULT
    RedrawItem(
        int Index
        ); 

    HRESULT
    AddStatusNotification(
        __in STATUS_HEADER_PARAMETERS*   pParameters
        ); 

    void
    HandleError(
        HRESULT hr
        ); 

    HRESULT
    CreateHelpMessageBox(
        unsigned int TextStringId
        ); 

    //inlines
    BOOL    
    ThereIsCurrentMessageBox(
        void
        )
    { 
        return IsWindow(m_MessageBox); 
    };

    bool
    NeedToUpdateSelection(
        RTC_SESSION_STATE  CallStatus
        )
    {
        return (CallStatus == RTCSS_CONNECTED || CallStatus == RTCSS_HOLD || CallStatus == RTCSS_ANSWERING); 
    }; 

private:

    static const WCHAR  sc_ListenerWindowClassName[]; 
    static const WCHAR  sc_ListenerWindowName[]; 
    static const UINT   sc_RefreshUITimeout; 
    static const UINT   sc_DisconnectLag; 
    static const DWORD  sc_StatusHeaderCookie; 
    static const DWORD  sc_ErrorNotificationTimeOut; 
    
    CComPtr<Call_t>     m_cpIncomingCall;
    
    HWND                m_ListenerWindow; 
    HWND                m_MainDialog; 
    HWND                m_MessageBox; 

    bool                m_Initialized; 

    ListBox_t           m_ListBox; 
    StatusHeader_t      m_StatusHeader; 
    MenuBar_t           m_MenuBar; 

    UINT                m_RefreshUITimerId; 

    ce::wstring         m_AlreadyDialedString; 
    
    
};

⌨️ 快捷键说明

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