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

📄 calldisplayitem.h

📁 一个WinCE6。0下的IP phone的源代码
💻 H
字号:
//
// 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.
//

#include "CommonFunctions.hpp"
#include "DisplayItem.hpp"
#include "Phone.hpp"
#include "string.hxx"

#include "ControlDefinitions.h"
#include "Controls.hpp"

class Call_t; 

/*------------------------------------------------------------------------------
    CallDisplayItemState
    
    Contextually, a calldisplayitem can have global state. 
    This enum represents the possible values
------------------------------------------------------------------------------*/
enum CallDisplayItemState
{
    e_csIdle            = RTCSS_IDLE,
    e_csIncoming        = RTCSS_INCOMING,
    e_csAnswering       = RTCSS_ANSWERING,
    e_csInProgress      = RTCSS_INPROGRESS,
    e_csConnected       = RTCSS_CONNECTED,
    e_csDisconnected    = RTCSS_DISCONNECTED,
    e_csHolding         = RTCSS_HOLD,
    e_csReferring       = RTCSS_REFER,
    e_csDialing         = -1,                   //The item is collecting digits for dialing
    e_csTransferring    = -2,                   //The item is collecting digits for transfer
};

/*------------------------------------------------------------------------------
    CVoIPChannelDisplayItem
    
    Implements a display item that contains a channel in channel (Today) view.
------------------------------------------------------------------------------*/
class CallDisplayItem_t :
    public CVoIPDisplayItem,
    public IVoIPDisplayControl
{
public:
    CallDisplayItem_t(
        __in_opt Call_t* pCall = NULL
        );

   ~CallDisplayItem_t();
   
public:
    enum TextItem
    {
        DisplayName  = 0,
        URI          = 1,
        Duration     = 2,
        Glyph        = 3,

        DialLabel    = 0,
        DialEdit     = 1,

        TransferLabel = 0,
        TransferText  = 1,
        TransferEdit  = 2,
    };

    // IVoIPDisplayItem   
    HRESULT
    QueryInterface(
        __in        REFIID riid,
        __deref_out void** ppvObject
        );

    HRESULT Draw(
        HDC                 hdc, 
        __in const RECT*    pRECT,
        BOOL                fSelected, 
        BOOL                fTopItem = FALSE
        );

    HRESULT GetText(
        __out_ecount(BufferSize) WCHAR* pBuffer,
        INT                             BufferSize
        );

    HRESULT GetSubItemText(
        int     SubItemIndex,        
        __out_ecount(BufferSize) WCHAR* pBuffer,       
        UINT                            BufferSize        
        );

    BOOL    GetHeight(
        __out UINT* pHeight
        );

    // IVoIPDisplayControl
    HRESULT PositionControls(
        HWND        VirtualListbox,
        __in RECT*  pRECT
        );

    HRESULT ShowControls(
        BOOL   IsVisible
        );

    HRESULT RemoveControls(
        void
        );

    BOOL   SetFocus();

    HRESULT
    OnBackspace(
        void
        ); 
    
public:
    //Gets the call object associated with this displayitem
    HRESULT GetCall(
        __deref_out Call_t** ppCall
        );

    VOID SetTickCount(INT tk)    { m_tk = tk;    }
    INT  GetTickCount()          { return m_tk;  }

    //Gets the state of this item
    CallDisplayItemState GetState();

    //Returns true if the item needs to be redrawn on timer events
    BOOL IsAnimated();

    //Transitions the item into a new state
    HRESULT AssignCall(
        __in Call_t* pCall
        );
    
    HRESULT StartTransferring();
    HRESULT StopTransferring();

private:
    //Three possible drawing states

    //Draw the internal call's info
    HRESULT DrawCallInfo(
        HDC                 hdc,
        __in const RECT*    pRECT,
        BOOL                Selected
        );

    //Draw the dialing state
    HRESULT DrawDialing(
        HDC                 hdc,
        __in const RECT*    pRECT,
        BOOL                Selected
        );

    //Draw the transferring state
    HRESULT DrawTransferring(
        HDC                 hdc,
        __in const RECT*    pRECT,
        BOOL                Selected
        );

    HRESULT DrawGlyph(
        HDC                 hdc, 
        __in RECT*          pRECT, 
        RTC_SESSION_STATE   vcs
        );
    
private:

    CallDisplayItemState        m_State;            //The internal state of this item
    ce::wstring                 m_wstrCallerId;     //The caller id of this item
    CComPtr<Call_t>             m_cpCall;           //The internal call item

    //The edit control for dialing/transferring
    Edit_t                      m_EditControl;
    bool                        m_RemovingEditControl; 

    //The rect that the control was last placed at
    RECT                        m_rcControl;

    //current tick count (for animation purposes)
    INT                         m_tk;
};

⌨️ 快捷键说明

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