亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? widget.c

?? STM32+Grlib
?? C
?? 第 1 頁 / 共 3 頁
字號:
//*****************************************************************************
//
// widget.c - Generic widget tree handling code.
//
// Copyright (c) 2008-2010 Texas Instruments Incorporated.  All rights reserved.
// Software License Agreement
// 
// Texas Instruments (TI) is supplying this software for use solely and
// exclusively on TI's microcontroller products. The software is owned by
// TI and/or its suppliers, and is protected under applicable copyright
// laws. You may not combine this software with "viral" open-source
// software in order to form a larger program.
// 
// THIS SOFTWARE IS PROVIDED "AS IS" AND WITH ALL FAULTS.
// 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. TI SHALL NOT, UNDER ANY
// CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, OR CONSEQUENTIAL
// DAMAGES, FOR ANY REASON WHATSOEVER.
// 
// This is part of revision 5821 of the Stellaris Graphics Library.
//
//*****************************************************************************

#include "driverlib/debug.h"
#include "grlib/grlib.h"
#include "grlib/widget.h"

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

//*****************************************************************************
//
// Flags that indicate how messages from the message queue are processed.  They
// can be sent via either a pre-order or post-order search, and can optionally
// be sent to no other widgets once one accepts the message.
//
//*****************************************************************************
#define MQ_FLAG_POST_ORDER      1
#define MQ_FLAG_STOP_ON_SUCCESS 2

//*****************************************************************************
//
// The size of the message queue.  In order to make the queue pointer
// arithmetic more efficient, this should be a power of two.
//
//*****************************************************************************
#define QUEUE_SIZE              16

#ifdef DEBUG_MSGQ
//*****************************************************************************
//
// In debug builds, keep track of the number of cases where a message was
// lost due to the queue being full.  We count the following occurrences:
//
// 1. All messages discarded due to queue overflow (g_ulMQOverflow)
// 2. Messages other than WIDGET_MSG_PTR_MOVE discarded due to queue
//    overflow (g_ulMQNonMouseOverflow).  In this case, we also remember the
//    last message that was discarded (g_ulMQLastLostMsg).
// 3. The number of calls to WidgetMessageQueueAdd that fail due to the queue
//    mutex already being held.
// 4. The number of cases where WidgetMessageQueueAdd reused an unread
//    WIDGET_MSG_PTR_MOVE message when a second one arrived before the previous
//    one had been processed.
//
//*****************************************************************************
unsigned long g_ulMQOverflow = 0;
unsigned long g_ulMQNonMouseOverflow = 0;
unsigned long g_ulMQLastLostMsg = 0;
unsigned long g_ulMQMutexClash = 0;
unsigned long g_ulMQMoveOverwrite = 0;
#endif

//*****************************************************************************
//
// This structure describes the message queue used to hold widget messages.
//
//*****************************************************************************
typedef struct
{
    //
    // The flags that describe how this message should be processed; this is
    // defined by the MQ_FLAG_xxx flags.
    //
    unsigned long ulFlags;

    //
    // The widget (or widget tree) to which the message should be sent.
    //
    tWidget *pWidget;

    //
    // The message to be sent.
    //
    unsigned long ulMessage;

    //
    // The first parameter to the message.
    //
    unsigned long ulParam1;

    //
    // The second parameter to the message.
    //
    unsigned long ulParam2;
}
tWidgetMessageQueue;

//*****************************************************************************
//
// The root of the widget tree.  This is the widget used when no parent is
// specified when adding a widget, or when no widget is specified when sending
// a message.  The parent and sibling of this widget are always zero.  This
// should not be directly referenced by applications; WIDGET_ROOT should be
// used instead.
//
//*****************************************************************************
tWidget g_sRoot =
{
    sizeof(tWidget),
    0,
    0,
    0,
    0,
    {
        0,
        0,
        0,
        0,
    },
    WidgetDefaultMsgProc
};

//*****************************************************************************
//
// The widget that has captured pointer messages.  When a pointer down message
// is accepted by a widget, that widget is saved in this variable and all
// subsequent pointer move and pointer up messages are sent directly to this
// widget.
//
//*****************************************************************************
static tWidget *g_pPointerWidget = 0;

//*****************************************************************************
//
// The message queue that holds messages that are waiting to be processed.
//
//*****************************************************************************
static volatile tWidgetMessageQueue g_pMQ[QUEUE_SIZE];

//*****************************************************************************
//
// The offset to the next message to be read from the message queue.  The
// message queue is empty when this has the same value as g_ulMQWrite.
//
//*****************************************************************************
static unsigned long g_ulMQRead = 0;

//*****************************************************************************
//
// The offset to the next message to be written to the message queue.  The
// message queue is full when this value is one less than g_ulMQRead (modulo
// the queue size).
//
//*****************************************************************************
static volatile unsigned long g_ulMQWrite = 0;

//*****************************************************************************
//
// The mutex used to protect access to the message queue.
//
//*****************************************************************************
static unsigned char g_ucMQMutex = 0;

//*****************************************************************************
//
//! Initializes a mutex to the unowned state.
//!
//! \param pcMutex is a pointer to mutex that is to be initialized.
//!
//! This function initializes a mutual exclusion semaphore (mutex) to its
//! unowned state in preparation for use with WidgetMutexGet() and
//! WidgetMutexPut().  A mutex is a two state object typically used to
//! serialize access to a shared resource.  An application will call
//! WidgetMutexGet() to request ownership of the mutex.  If ownership is
//! granted, the caller may safely access the resource then release the mutex
//! using WidgetMutexPut() once it is finished.  If ownership is not granted,
//! the caller knows that some other context is currently modifying the shared
//! resource and it must not access the resource at that time.
//!
//! Note that this function must not be called if the mutex passed in \e pcMutex
//! is already in use since this will have the effect of releasing the lock even
//! if some caller currently owns it.
//!
//! \return None.
//
//*****************************************************************************
void
WidgetMutexInit(unsigned char *pcMutex)
{
    //
    // Catch NULL pointers in a debug build.
    //
    ASSERT(pcMutex);

    //
    // Clear the mutex location to set it to the unowned state.
    //
    *pcMutex = 0;
}

//*****************************************************************************
//
//! Attempts to acquire a mutex.
//!
//! \param pcMutex is a pointer to mutex that is to be acquired.
//!
//! This function attempts to acquire a mutual exclusion semaphore (mutex) on
//! behalf of the caller.  If the mutex is not already held, 0 is returned to
//! indicate that the caller may safely access whichever resource the mutex is
//! protecting.  If the mutex is already held, 1 is returned and the caller
//! must not access the shared resource.
//!
//! When access to the shared resource is complete, the mutex owner should call
//! WidgetMutexPut() to release the mutex and relinquish ownership of the
//! shared resource.
//!
//! \return Returns 0 if the mutex is acquired successfully or 1 if it is
//! already held by another caller.
//
//*****************************************************************************
#if defined(ewarm) || defined(DOXYGEN)
unsigned long
WidgetMutexGet(unsigned char *pcMutex)
{
    //
    // Acquire the mutex if possible.
    //
    __asm("    mov     r1, #1\n"
          "    ldrexb  r2, [r0]\n"
          "    cmp     r2, #0\n"
          "    it      eq\n"
          "    strexb  r2, r1, [r0]\n"
          "    mov     r0, r2\n");

    //
    // "Warning[Pe940]: missing return statement at end of non-void function"
    // is suppressed here to avoid putting a "bx lr" in the inline assembly
    // above and a superfluous return statement here.
    //
#pragma diag_suppress=Pe940
}
#pragma diag_default=Pe940
#endif
#if defined(codered) || defined(gcc) || defined(sourcerygxx)
unsigned long __attribute__((naked))
WidgetMutexGet(unsigned char *pcMutex)
{
    unsigned long ulRet;

    //
    // Acquire the mutex if possible.
    //
    __asm("    mov      r1, #1\n"
          "    ldrexb   r2, [r0]\n"
          "    cmp      r2, #0\n"
          "    it       eq\n"
          "    strexbeq r2, r1, [r0]\n"
          "    mov      r0, r2\n"
          "    bx       lr\n"
          : "=r" (ulRet));

    //
    // The return is handled in the inline assembly, but the compiler will
    // still complain if there is not an explicit return here (despite the fact
    // that this does not result in any code being produced because of the
    // naked attribute).
    //
    return(ulRet);
}
#endif
#if defined(rvmdk) || defined(__ARMCC_VERSION)
__asm unsigned long
WidgetMutexGet(unsigned char *pcMutex)
{
    mov         r1, #1
    ldrexb      r2, [r0]
    cmp         r2, #0
    it          eq
    strexbeq    r2, r1, [r0]
    mov         r0, r2
    bx          lr
}
#endif
#if defined(ccs)
unsigned long
WidgetMutexGet(unsigned char *pcMutex)
{
    //
    // Acquire the mutex if possible.
    //
    __asm("    mov         r1, #1\n"
          "    ldrexb      r2, [r0]\n"
          "    cmp         r2, #0\n"
          "    it          EQ\n" // TI assembler requires upper case cond
          "    strexbeq    r2, r1, [r0]\n"
          "    mov         r0, r2\n"
          "    bx          lr\n");

    //
    // The following keeps the TI compiler from optimizing away the code.
    //
    return((unsigned long)pcMutex + 1);
}
#endif

//*****************************************************************************
//
//! Release a mutex.
//!
//! \param pcMutex is a pointer to mutex that is to be released.
//!
//! This function releases a mutual exclusion semaphore (mutex), leaving it in
//! the unowned state.
//!
//! \return None.
//
//*****************************************************************************
void
WidgetMutexPut(unsigned char *pcMutex)
{
    //
    // Release the mutex.
    //
    *pcMutex = 0;
}

//*****************************************************************************
//
// Determines if a widget exists in the tree below a given point.
//
// \param pWidget is a pointer to the widget tree.
// \param pFind is a pointer to the widget that is being searched for.
//
// This function searches the widget tree below pWidget to determine whether
// or not the widget pointed to by \e pFind exists in the subtree.
//
// \return Returns 1 if \e pFind exists in the subtree or 0 if it does not.
//
//*****************************************************************************
static long
WidgetIsInTree(tWidget *pWidget, tWidget *pFind)
{
    tWidget *pTemp;

    //
    // Check the arguments.
    //
    ASSERT(pWidget);
    ASSERT(pFind);

    //
    // Loop through the tree under the widget until every widget is searched.
    //
    for(pTemp = pWidget; pTemp != pWidget->pParent; )
    {
        //
        // See if this widget has a child.
        //
        if(pTemp->pChild)
        {
            //
            // Go to this widget's child first.
            //
            pTemp = pTemp->pChild;
        }

        //
        // This widget does not have a child, so either a sibling or a parent
        // must be checked.  When moving back to the parent, another move must
        // be performed as well to avoid getting stuck in a loop (since the
        // parent's children have already been searched.
        //
        else
        {
            //
            // Loop until returning to the parent of the starting widget.  This
            // loop will be explicitly broken out of if an intervening widget
            // is encountered that has not been searched.
            //
            while(pTemp != pWidget->pParent)
            {
                if(pTemp == pFind)
                {
                    return(1);
                }

                //
                // See if this widget has a sibling.
                //
                if(pTemp->pNext)
                {
                    //

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
日韩亚洲国产中文字幕欧美| 亚洲成a人v欧美综合天堂| 亚洲一级在线观看| 亚洲视频在线一区观看| 免费观看日韩av| 亚洲国产成人高清精品| 麻豆精品新av中文字幕| 欧美性猛交xxxxxx富婆| 91精品国产91综合久久蜜臀| 欧美tickling网站挠脚心| 亚洲一区二区三区视频在线 | 亚洲人成网站在线| 国产精品69久久久久水密桃| 日韩欧美国产一区在线观看| 同产精品九九九| 免费三级欧美电影| 正在播放亚洲一区| 日韩精品中文字幕在线不卡尤物| 亚洲国产cao| 欧美在线观看视频一区二区| 亚洲欧美一区二区三区久本道91| 成人一级视频在线观看| 国产亚洲一区二区三区在线观看 | 国产精品久久久久久久裸模| 国产精品色在线观看| 国产成人综合网| 欧美性大战久久久久久久蜜臀| 亚洲美女视频一区| 91亚洲国产成人精品一区二区三| 国产精品乱人伦一区二区| 成人丝袜18视频在线观看| 国产免费观看久久| 樱花影视一区二区| 色94色欧美sute亚洲线路二| 亚洲欧美成aⅴ人在线观看| 91麻豆免费看| 一区二区三区四区国产精品| aaa亚洲精品| 欧美在线一区二区| 亚洲成在人线免费| 日本道精品一区二区三区| 亚洲精品国产无天堂网2021| 91精品福利视频| 亚洲成人午夜电影| 69堂精品视频| 韩日精品视频一区| 国产日韩精品一区二区三区在线| 成人毛片在线观看| 亚洲精品老司机| 精品视频一区二区不卡| 日韩av网站免费在线| 欧美一区二区久久| 国产在线乱码一区二区三区| 国产亚洲精品福利| 91视频免费播放| 亚洲成a人v欧美综合天堂下载 | 国产suv精品一区二区883| 日本高清不卡aⅴ免费网站| 亚洲综合色噜噜狠狠| 欧美人妇做爰xxxⅹ性高电影| 天天综合天天综合色| 精品国偷自产国产一区| 丁香桃色午夜亚洲一区二区三区| 亚洲三级小视频| 欧美久久一区二区| 国产精品三级视频| 欧美亚洲高清一区二区三区不卡| 亚洲大片精品永久免费| 欧美va日韩va| 成人爽a毛片一区二区免费| 亚洲免费观看高清完整版在线观看| 欧美日韩午夜精品| 狠狠色综合色综合网络| 亚洲欧美在线aaa| 欧美另类久久久品| 国产成人h网站| 亚洲午夜影视影院在线观看| 2017欧美狠狠色| 91社区在线播放| 久久国产精品色婷婷| 中文字幕中文字幕一区二区| 欧美精三区欧美精三区| 国产激情一区二区三区桃花岛亚洲| 一区二区三区在线不卡| www精品美女久久久tv| 色视频欧美一区二区三区| 精品亚洲欧美一区| 一区二区欧美国产| 久久久www成人免费毛片麻豆| 色悠悠亚洲一区二区| 极品少妇一区二区三区精品视频| 日韩一区欧美小说| 欧美电影免费观看完整版| 91在线一区二区| 精品综合久久久久久8888| 亚洲男人的天堂网| 欧美日本视频在线| 国产不卡在线播放| 天堂成人国产精品一区| 中文字幕在线一区二区三区| 日韩一卡二卡三卡| 日本电影亚洲天堂一区| 国产精品1024久久| 美女精品一区二区| 亚洲伊人伊色伊影伊综合网| 国产日本欧美一区二区| 欧美一级高清片在线观看| 一本色道a无线码一区v| 国产美女精品一区二区三区| 日韩精品成人一区二区三区| 亚洲视频一区在线| 久久这里只有精品视频网| 欧美日本精品一区二区三区| 91偷拍与自偷拍精品| 国产精品一区久久久久| 日本亚洲三级在线| 亚洲午夜激情网页| 国产精品久久久久国产精品日日| 日韩欧美的一区二区| 欧美色国产精品| 91国产精品成人| eeuss鲁片一区二区三区| 国精产品一区一区三区mba桃花 | 亚洲午夜视频在线观看| 国产精品乱码一区二区三区软件 | 亚洲国产视频直播| 亚洲天堂精品在线观看| 国产喷白浆一区二区三区| 日韩免费电影网站| 91精品国产乱码久久蜜臀| 色欧美片视频在线观看 | 午夜精品久久久久久久99水蜜桃 | 伦理电影国产精品| 视频一区免费在线观看| 一区二区三区.www| 亚洲精品国产第一综合99久久| 国产精品毛片久久久久久久| 国产亚洲精品超碰| 久久久久97国产精华液好用吗| 日韩精品中文字幕一区二区三区| 欧美日韩大陆一区二区| 91成人免费在线视频| 色综合咪咪久久| 91捆绑美女网站| 91亚洲精品一区二区乱码| 99视频在线精品| 91在线观看成人| 一本久久综合亚洲鲁鲁五月天| 91在线porny国产在线看| 99久久婷婷国产综合精品电影| 成人性生交大合| 成人av在线资源| 99久久精品国产一区| 91女厕偷拍女厕偷拍高清| 99re8在线精品视频免费播放| 成人免费毛片a| av中文一区二区三区| 风间由美性色一区二区三区| 成人美女视频在线看| 99视频国产精品| 91精品91久久久中77777| 欧美亚洲日本国产| 欧美丰满高潮xxxx喷水动漫| 91麻豆精品久久久久蜜臀| 91麻豆精品国产自产在线观看一区| 欧美高清性hdvideosex| 欧美高清一级片在线| 欧美喷潮久久久xxxxx| 制服丝袜亚洲色图| 成人毛片视频在线观看| 日日欢夜夜爽一区| 亚洲在线视频免费观看| 午夜欧美在线一二页| 麻豆成人久久精品二区三区红| 国产精选一区二区三区| 91在线观看高清| 这里只有精品电影| 国产视频视频一区| 亚洲成a人片综合在线| 国产精品99久久久久久久vr| 91麻豆swag| 精品理论电影在线| 亚洲欧美日韩国产另类专区| 日韩电影免费一区| 国产不卡视频在线播放| 欧美日本在线观看| 久久午夜色播影院免费高清| 亚洲免费av在线| 久久91精品国产91久久小草| 一本大道久久a久久综合婷婷| 欧美大片一区二区| 亚洲免费在线观看| 国产在线精品一区二区夜色 | 国产精品久久久久久久久免费樱桃| 一区二区三区电影在线播| 国产在线播精品第三| 在线观看日韩av先锋影音电影院| 久久综合精品国产一区二区三区| 亚洲国产你懂的| 成人午夜精品一区二区三区|