statusregion.hpp

来自「一个WinCE6。0下的IP phone的源代码」· HPP 代码 · 共 109 行

HPP
109
字号
//
// 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

#ifndef __STATUSHEADER_HPP__
#define __STATUSHEADER_HPP__

#include "Controls.hpp"
#include "CommonControl.hpp"
#include "PaintHelper.hpp"


struct StatusHeaderMessage_t
{
    BOOL m_IsValid;         //is this a valid Message?
    WCHAR* m_pDisplay;      //the string to display
    DWORD m_Priority;       //numeric priority (0 has highest priority)
    DWORD m_TimeoutTick;    //timeout (number of timer messages) before the message goes away
    DWORD m_CurrentTick;    //How long has elapsed since the item became visible
    DWORD m_Cookie;         //Cookie associated with this message
};

/*------------------------------------------------------------------------------
    StatusHeaderImpl_t

    Status Header control.
------------------------------------------------------------------------------*/
class StatusHeaderImpl_t :
    public CommonControlImpl_t<StatusHeaderImpl_t, StatusHeader_t>
{
public:
    // Constructor/destructor
    StatusHeaderImpl_t();
    ~StatusHeaderImpl_t();

    DECLARE_NO_SUPERCLASS();

    LRESULT
    ControlWindowProc(
        UINT Message,
        WPARAM wParam,
        LPARAM lParam,
        bool& Handled
        );

private:
    //Internal member functions
    void
    ClearEntry(
        __in StatusHeaderMessage_t* pnbmCurrent
        );

    inline
    bool
    IsValidIndex(
        int Index
        );

    LRESULT
    UpdateActiveMessage(
        void
        );

    // Message handlers
    LRESULT
    OnAddNotification(
        __in_bcount(SizeInBytes) STATUS_HEADER_PARAMETERS* pParameters,
        UINT SizeInBytes
        );

    LRESULT
    OnGetCookie(
        void
        );

    LRESULT
    OnPaint(
        HDC hdc
        );

    LRESULT
    OnRemoveNotification(
        DWORD Cookie
        );

    LRESULT
    OnTimer(
        UINT TimerId,
        __in_opt TIMERPROC* pTimerProc
        );

private:
    Bitmap_t                m_Background;
    StatusHeaderMessage_t   m_Messages[StatusHeaderPriorities];
    int                     m_IndexActiveMessage;
};

#endif //!defined __STATUSHEADER_HPP__

⌨️ 快捷键说明

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