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

📄 widget.h

📁 基于TI公司Cortex-M3的uart超级通信开发
💻 H
字号:
//*****************************************************************************
//
// widget.h - Prototypes for the widget base "class".
//
// Copyright (c) 2008-2009 Luminary Micro, Inc.  All rights reserved.
// Software License Agreement
// 
// Luminary Micro, Inc. (LMI) is supplying this software for use solely and
// exclusively on LMI's microcontroller products.
// 
// The software is owned by LMI and/or its suppliers, and is protected under
// applicable copyright laws.  All rights are reserved.  You may not combine
// this software with "viral" open-source software in order to form a larger
// program.  Any use in violation of the foregoing restrictions may subject
// the user to criminal sanctions under applicable laws, as well as to civil
// liability for the breach of the terms and conditions of this license.
// 
// THIS SOFTWARE IS PROVIDED "AS IS".  NO WARRANTIES, WHETHER EXPRESS, IMPLIED
// OR STATUTORY, INCLUDING, BUT NOT LIMITED TO, IMPLIED WARRANTIES OF
// MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE.
// LMI SHALL NOT, IN ANY CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, OR
// CONSEQUENTIAL DAMAGES, FOR ANY REASON WHATSOEVER.
// 
// This is part of revision 5228 of the Stellaris Graphics Library.
//
//*****************************************************************************

#ifndef __WIDGET_H__
#define __WIDGET_H__

//*****************************************************************************
//
//! \addtogroup widget_api
//! @{
//
//*****************************************************************************

//*****************************************************************************
//
// If building with a C++ compiler, make all of the definitions in this header
// have a C binding.
//
//*****************************************************************************
#ifdef __cplusplus
extern "C"
{
#endif

//*****************************************************************************
//
//! The structure that describes a generic widget.  This structure is the base
//! ``class'' for all other widgets.
//定义一个一般控件结构体
//*****************************************************************************
typedef struct __Widget
{
    //
    //! The size of this structure.  This will be the size of the full
    //! structure, not just the generic widget subset.
    //大小
    long lSize;

    //
    //! A pointer to this widget's parent widget.
    //父控件
    struct __Widget *pParent;

    //
    //! A pointer to this widget's first sibling widget.
    //兄弟控件
    struct __Widget *pNext;

    //
    //! A pointer to this widget's first child widget.
    //子控件
    struct __Widget *pChild;

    //
    //! A pointer to the display on which this widget resides.
    //显示驱动
    const tDisplay *pDisplay;

    //
    //! The rectangle that encloses this widget.
    //控件区域形状
    tRectangle sPosition;

    //
    //! The procedure that handles messages sent to this widget.
    //相应控件的函数指针
    long (*pfnMsgProc)(struct __Widget *pWidget, unsigned long ulMessage,
                       unsigned long ulParam1, unsigned long ulParam2);
}
tWidget;

//*****************************************************************************
//
//! The widget at the root of the widget tree.  This can be used when
//! constructing a widget tree at compile time (used as the pParent argument to
//! a widget declaration) or as the pWidget argument to an API (such as
//! WidgetPaint() to paint the entire widget tree).
//根控件
//*****************************************************************************
#define WIDGET_ROOT             &g_sRoot

//*****************************************************************************
//
//! This message is sent to indicate that the widget should draw itself on the
//! display.  Neither \e ulParam1 nor \e ulParam2 are used by this message.
//! This message is delivered in top-down order.
//显示该控件自身
//*****************************************************************************
#define WIDGET_MSG_PAINT        0x00000001

//*****************************************************************************
//
//! This message is sent to indicate that the pointer is now down.  \e ulParam1
//! is the X coordinate of the location where the pointer down event occurred,
//! and \e ulParam2 is the Y coordinate.  This message is delivered in
//! bottom-up order.
//表明此控件此刻已经被按下
//*****************************************************************************
#define WIDGET_MSG_PTR_DOWN     0x00000002

//*****************************************************************************
//
//! This message is sent to indicate that the pointer has moved while being
//! down.  \e ulParam1 is the X coordinate of the new pointer location, and
//! \e ulParam2 is the Y coordinate.  This message is delivered in bottom-up
//! order.
//按键被拖动
//*****************************************************************************
#define WIDGET_MSG_PTR_MOVE     0x00000003

//*****************************************************************************
//
//! This message is sent to indicate that the pointer is now up.  \e ulParam1
//! is the X coordinate of the location where the pointer up event occurred,
//! and \e ulParam2 is the Y coordinate.  This message is delivered in
//! bottom-up order.
//按键被抬起
//*****************************************************************************
#define WIDGET_MSG_PTR_UP       0x00000004

//*****************************************************************************
//
//! Requests a redraw of the widget tree.
//!
//! \param pWidget is a pointer to the widget tree to paint.
//!
//! This function sends a \b #WIDGET_MSG_PAINT message to the given widgets,
//! and all of the widget beneath it, so that they will draw or redraw
//! themselves on the display.  The actual drawing will occur when this message
//! is retrieved from the message queue and processed.
//!
//! \return Returns 1 if the message was added to the message queue and 0 if it
//! cound not be added (due to the queue being full).
//新建一个控件树
//pWidget:控件树的根
//*****************************************************************************
#define WidgetPaint(pWidget)                                         \
        WidgetMessageQueueAdd(pWidget, WIDGET_MSG_PAINT, 0, 0, 0, 0)

//*****************************************************************************
//
// Prototypes for the generic widget handling functions.
//
//*****************************************************************************
extern tWidget g_sRoot;
extern long WidgetDefaultMsgProc(tWidget *pWidget, unsigned long ulMessage,
                                 unsigned long ulParam1,
                                 unsigned long ulParam2);
extern void WidgetAdd(tWidget *pParent, tWidget *pWidget);
extern void WidgetRemove(tWidget *pWidget);
extern unsigned long WidgetMessageSendPreOrder(tWidget *pWidget,
                                               unsigned long ulMessage,
                                               unsigned long ulParam1,
                                               unsigned long ulParam2,
                                               unsigned long bStopOnSuccess);
extern unsigned long WidgetMessageSendPostOrder(tWidget *pWidget,
                                                unsigned long ulMessage,
                                                unsigned long ulParam1,
                                                unsigned long ulParam2,
                                                unsigned long bStopOnSuccess);
extern long WidgetMessageQueueAdd(tWidget *pWidget, unsigned long ulMessage,
                                  unsigned long ulParam1,
                                  unsigned long ulParam2,
                                  unsigned long bPostOrder,
                                  unsigned long bStopOnSuccess);
extern void WidgetMessageQueueProcess(void);
extern long WidgetPointerMessage(unsigned long ulMessage, long lX, long lY);
extern void WidgetMutexInit(unsigned char *pcMutex);
extern unsigned long WidgetMutexGet(unsigned char *pcMutex);
extern void WidgetMutexPut(unsigned char *pcMutex);

//*****************************************************************************
//
// Mark the end of the C bindings section for C++ compilers.
//
//*****************************************************************************
#ifdef __cplusplus
}
#endif

//*****************************************************************************
//
// Close the Doxygen group.
//! @}
//
//*****************************************************************************

#endif // __WIDGET_H__

⌨️ 快捷键说明

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