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

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

?? imgbutton.c

?? STM32+Grlib
?? C
字號:
//*****************************************************************************
//
// imgbutton.c - An image-based button widget.
//
// Copyright (c) 2009-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"
#include "grlib/imgbutton.h"

//*****************************************************************************
//
//! \addtogroup imgbutton_api
//! @{
//
//*****************************************************************************

//*****************************************************************************
//
//! Draws an image button.
//!
//! \param pWidget is a pointer to the image button widget to be drawn.
//!
//! This function draws a rectangular image button on the display.  This is
//! called in response to a \b #WIDGET_MSG_PAINT message.
//!
//! \return None.
//
//*****************************************************************************
static void
ImageButtonPaint(tWidget *pWidget)
{
    const unsigned char *pucImage;
    tImageButtonWidget *pPush;
    tContext sCtx;
    long lX, lY;

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

    //
    // Convert the generic widget pointer into a image button widget pointer.
    //
    pPush = (tImageButtonWidget *)pWidget;

    //
    // Initialize a drawing context.
    //
    GrContextInit(&sCtx, pWidget->pDisplay);

    //
    // Initialize the clipping region based on the extents of this rectangular
    // image button.
    //
    GrContextClipRegionSet(&sCtx, &(pWidget->sPosition));

    //
    // Compute the center of the image button.
    //
    lX = (pWidget->sPosition.sXMin +
          ((pWidget->sPosition.sXMax - pWidget->sPosition.sXMin + 1) / 2));
    lY = (pWidget->sPosition.sYMin +
          ((pWidget->sPosition.sYMax - pWidget->sPosition.sYMin + 1) / 2));

    //
    // Do we need to fill the widget background with a color?
    //
    if(pPush->ulStyle & IB_STYLE_FILL)
    {
        //
        // Yes. Set the appropriate color depending upon whether or not
        // the widget is currently pressed.
        //
        GrContextForegroundSet(&sCtx,
                               ((pPush->ulStyle & IB_STYLE_PRESSED) ?
                                pPush->ulPressedColor :
                                pPush->ulBackgroundColor));
        GrRectFill(&sCtx, &(pWidget->sPosition));
    }

    //
    // Set the foreground and background colors to use for 1 BPP
    // images and text
    //
    GrContextForegroundSet(&sCtx, pPush->ulForegroundColor);
    GrContextBackgroundSet(&sCtx,
                           ((pPush->ulStyle & IB_STYLE_PRESSED) ?
                            pPush->ulPressedColor :
                            pPush->ulBackgroundColor));

    //
    // Do we need to draw the background image?
    //
    if(!(pPush->ulStyle & IB_STYLE_IMAGE_OFF))
    {
        //
        // Get the background image to be drawn.
        //
        pucImage = ((pPush->ulStyle & IB_STYLE_PRESSED) ?
                    pPush->pucPressImage : pPush->pucImage);

        //
        // Draw the image centered in the image button.
        //
        GrImageDraw(&sCtx, pucImage, lX - (GrImageWidthGet(pucImage) / 2),
                    lY - (GrImageHeightGet(pucImage) / 2));
    }

    //
    // Adjust the drawing position if the button is pressed.
    //
    lX += ((pPush->ulStyle & IB_STYLE_PRESSED) ? pPush->sXOffset : 0);
    lY += ((pPush->ulStyle & IB_STYLE_PRESSED) ? pPush->sYOffset : 0);

    //
    // If there is a keycap image and it is not disabled, center this on the
    // top of the button, applying any offset defined if the button is
    // currently pressed.
    //
    if(pPush->pucKeycapImage && !(pPush->ulStyle & IB_STYLE_KEYCAP_OFF))
    {
        //
        // Draw the keycap image.
        //
        GrImageDraw(&sCtx, pPush->pucKeycapImage,
                    lX - (GrImageWidthGet(pPush->pucKeycapImage) / 2),
                    lY - (GrImageHeightGet(pPush->pucKeycapImage) / 2));
    }

    //
    // See if the button text style is selected.
    //
    if(pPush->ulStyle & IB_STYLE_TEXT)
    {
        //
        // Draw the text centered in the middle of the button with offset
        // applied if the button is currently pressed.
        //
        GrContextFontSet(&sCtx, pPush->pFont);
        GrStringDrawCentered(&sCtx, pPush->pcText, -1, lX, lY, 0);
    }
}

//*****************************************************************************
//
//! Handles pointer events for a rectangular image button.
//!
//! \param pWidget is a pointer to the image button widget.
//! \param ulMsg is the pointer event message.
//! \param lX is the X coordinate of the pointer event.
//! \param lY is the Y coordinate of the pointer event.
//!
//! This function processes pointer event messages for a rectangular push
//! button.  This is called in response to a \b #WIDGET_MSG_PTR_DOWN,
//! \b #WIDGET_MSG_PTR_MOVE, and \b #WIDGET_MSG_PTR_UP messages.
//!
//! If the \b #WIDGET_MSG_PTR_UP message is received with a position within the
//! extents of the image button, the image button's OnClick callback function is
//! called.
//!
//! \return Returns 1 if the coordinates are within the extents of the push
//! button and 0 otherwise.
//
//*****************************************************************************
static long
ImageButtonClick(tWidget *pWidget, unsigned long ulMsg, long lX, long lY)
{
    tImageButtonWidget *pPush;

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

    //
    // Convert the generic widget pointer into a image button widget pointer.
    //
    pPush = (tImageButtonWidget *)pWidget;

    //
    // See if this is a pointer up message.
    //
    if(ulMsg == WIDGET_MSG_PTR_UP)
    {
        //
        // Indicate that this image button is no longer pressed.
        //
        pPush->ulStyle &= ~(IB_STYLE_PRESSED);

        //
        // Redraw the button in the released state.
        //
        ImageButtonPaint(pWidget);

        //
        // If the pointer is still within the button bounds, and it is a
        // release notify button, call the notification function here.
        //
        if(GrRectContainsPoint(&pWidget->sPosition, lX, lY) &&
           (pPush->ulStyle & IB_STYLE_RELEASE_NOTIFY) && pPush->pfnOnClick)
        {
            pPush->pfnOnClick(pWidget);
        }
    }

    //
    // See if the given coordinates are within the extents of the image button.
    //
    if(GrRectContainsPoint(&pWidget->sPosition, lX, lY))
    {
        //
        // See if this is a pointer down message.
        //
        if(ulMsg == WIDGET_MSG_PTR_DOWN)
        {
            //
            // Indicate that this image button is pressed.
            //
            pPush->ulStyle |= IB_STYLE_PRESSED;

            //
            // Draw the button in the pressed state.
            //
            ImageButtonPaint(pWidget);
        }

        //
        // See if there is an OnClick callback for this widget.
        //
        if(pPush->pfnOnClick)
        {
            //
            // If the pointer was just pressed then call the callback.
            //
            if((ulMsg == WIDGET_MSG_PTR_DOWN) &&
               !(pPush->ulStyle & IB_STYLE_RELEASE_NOTIFY))
            {
                pPush->pfnOnClick(pWidget);
            }

            //
            // See if auto-repeat is enabled for this widget.
            //
            if(pPush->ulStyle & IB_STYLE_AUTO_REPEAT)
            {
                //
                // If the pointer was just pressed, reset the auto-repeat
                // count.
                //
                if(ulMsg == WIDGET_MSG_PTR_DOWN)
                {
                    pPush->ulAutoRepeatCount = 0;
                }

                //
                // See if the pointer was moved.
                //
                else if(ulMsg == WIDGET_MSG_PTR_MOVE)
                {
                    //
                    // Increment the auto-repeat count.
                    //
                    pPush->ulAutoRepeatCount++;

                    //
                    // If the auto-repeat count exceeds the auto-repeat delay,
                    // and it is a multiple of the auto-repeat rate, then
                    // call the callback.
                    //
                    if((pPush->ulAutoRepeatCount >=
                        pPush->usAutoRepeatDelay) &&
                       (((pPush->ulAutoRepeatCount -
                          pPush->usAutoRepeatDelay) %
                         pPush->usAutoRepeatRate) == 0))
                    {
                        pPush->pfnOnClick(pWidget);
                    }
                }
            }
        }

        //
        // These coordinates are within the extents of the image button widget.
        //
        return(1);
    }

    //
    // These coordinates are not within the extents of the image button widget.
    //
    return(0);
}

//*****************************************************************************
//
//! Handles messages for an image button widget.
//!
//! \param pWidget is a pointer to the image button widget.
//! \param ulMsg is the message.
//! \param ulParam1 is the first parameter to the message.
//! \param ulParam2 is the second parameter to the message.
//!
//! This function receives messages intended for this image button widget and
//! processes them accordingly.  The processing of the message varies based on
//! the message in question.
//!
//! Unrecognized messages are handled by calling WidgetDefaultMsgProc().
//!
//! \return Returns a value appropriate to the supplied message.
//
//*****************************************************************************
long
ImageButtonMsgProc(tWidget *pWidget, unsigned long ulMsg,
                   unsigned long ulParam1, unsigned long ulParam2)
{
    //
    // Check the arguments.
    //
    ASSERT(pWidget);

    //
    // Determine which message is being sent.
    //
    switch(ulMsg)
    {
        //
        // The widget paint request has been sent.
        //
        case WIDGET_MSG_PAINT:
        {
            //
            // Handle the widget paint request.
            //
            ImageButtonPaint(pWidget);

            //
            // Return one to indicate that the message was successfully
            // processed.
            //
            return(1);
        }

        //
        // One of the pointer requests has been sent.
        //
        case WIDGET_MSG_PTR_DOWN:
        case WIDGET_MSG_PTR_MOVE:
        case WIDGET_MSG_PTR_UP:
        {
            //
            // Handle the pointer request, returning the appropriate value.
            //
            return(ImageButtonClick(pWidget, ulMsg, ulParam1, ulParam2));
        }

        //
        // An unknown request has been sent.
        //
        default:
        {
            //
            // Let the default message handler process this message.
            //
            return(WidgetDefaultMsgProc(pWidget, ulMsg, ulParam1, ulParam2));
        }
    }
}

//*****************************************************************************
//
//! Initializes an image button widget.
//!
//! \param pWidget is a pointer to the image button widget to initialize.
//! \param pDisplay is a pointer to the display on which to draw the push
//! button.
//! \param lX is the X coordinate of the upper left corner of the image button.
//! \param lY is the Y coordinate of the upper left corner of the image button.
//! \param lWidth is the width of the image button.
//! \param lHeight is the height of the image button.
//!
//! This function initializes the provided image button widget.
//!
//! \return None.
//
//*****************************************************************************
void
ImageButtonInit(tImageButtonWidget *pWidget, const tDisplay *pDisplay,
                long lX, long lY, long lWidth, long lHeight)
{
    unsigned long ulIdx;

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

    //
    // Clear out the widget structure.
    //
    for(ulIdx = 0; ulIdx < sizeof(tImageButtonWidget); ulIdx += 4)
    {
        ((unsigned long *)pWidget)[ulIdx / 4] = 0;
    }

    //
    // Set the size of the image button widget structure.
    //
    pWidget->sBase.lSize = sizeof(tImageButtonWidget);

    //
    // Mark this widget as fully disconnected.
    //
    pWidget->sBase.pParent = 0;
    pWidget->sBase.pNext = 0;
    pWidget->sBase.pChild = 0;

    //
    // Save the display pointer.
    //
    pWidget->sBase.pDisplay = pDisplay;

    //
    // Set the extents of this rectangular image button.
    //
    pWidget->sBase.sPosition.sXMin = lX;
    pWidget->sBase.sPosition.sYMin = lY;
    pWidget->sBase.sPosition.sXMax = lX + lWidth - 1;
    pWidget->sBase.sPosition.sYMax = lY + lHeight - 1;

    //
    // Use the rectangular image button message handler to process messages to
    // this image button.
    //
    pWidget->sBase.pfnMsgProc = ImageButtonMsgProc;
}

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

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
国产精品中文字幕一区二区三区| 色狠狠色狠狠综合| 91丨porny丨在线| 欧美一区二区三区白人| 久久精品噜噜噜成人88aⅴ | 99久久精品免费观看| 欧美一级欧美三级在线观看| 亚洲欧美日韩小说| 国产成人欧美日韩在线电影| 日韩一级高清毛片| 香蕉成人啪国产精品视频综合网| 暴力调教一区二区三区| 久久久综合精品| 日本不卡一区二区三区高清视频| 色呦呦国产精品| 成人欧美一区二区三区白人| 国产大片一区二区| 日本一区二区三区在线不卡| 美腿丝袜亚洲三区| 欧美电影免费提供在线观看| 亚洲国产精品一区二区久久恐怖片| 99视频精品在线| 综合久久一区二区三区| av在线播放一区二区三区| 国产欧美日韩精品在线| 国产91丝袜在线播放0| 国产亚洲一区二区在线观看| 国产传媒欧美日韩成人| 久久亚洲一级片| 成人综合婷婷国产精品久久免费| 日韩精品电影一区亚洲| 欧美日韩dvd在线观看| 婷婷开心久久网| 欧美精品v国产精品v日韩精品| 亚洲成人久久影院| 日韩三级精品电影久久久| 免费三级欧美电影| 久久精品欧美一区二区三区不卡| 国产盗摄一区二区| 亚洲欧洲国产日韩| 91精品办公室少妇高潮对白| 午夜成人在线视频| 欧美成人aa大片| 国产成人综合网| 18欧美亚洲精品| 欧美老女人在线| 蜜桃视频在线观看一区| 久久精品一区二区三区不卡| 97se亚洲国产综合自在线不卡| 亚洲男同性视频| 91精品国产手机| 国产精品一区二区男女羞羞无遮挡| 国产精品免费aⅴ片在线观看| 91在线观看污| 午夜精品福利一区二区三区蜜桃| 欧美电影免费观看高清完整版在线 | 精品不卡在线视频| 国产sm精品调教视频网站| 亚洲精品高清视频在线观看| 日韩欧美中文字幕精品| 国产乱码精品一区二区三区av| 亚洲欧美日韩国产一区二区三区| 91精品中文字幕一区二区三区| 国产一区二区免费在线| 一区二区三区在线观看动漫| 精品国产自在久精品国产| 99riav一区二区三区| 日韩av一区二| 中文字幕一区二区三区四区| 日韩午夜在线观看视频| www.成人在线| 老鸭窝一区二区久久精品| 伊人开心综合网| 国产欧美一区二区精品性| 欧美一区二区在线视频| a级高清视频欧美日韩| 久久成人羞羞网站| 一二三区精品视频| 中文字幕第一页久久| 欧美一区二区三级| 欧洲视频一区二区| 国产成人综合亚洲91猫咪| 欧美aⅴ一区二区三区视频| 亚洲天堂免费在线观看视频| 久久久久久久国产精品影院| 欧美日韩国产小视频在线观看| 成人av网站大全| 国产精品白丝av| 久久成人av少妇免费| 亚洲成人动漫一区| 一区二区三区色| 17c精品麻豆一区二区免费| 国产目拍亚洲精品99久久精品| 51精品国自产在线| 欧美日韩专区在线| 91在线云播放| av电影一区二区| 国产黄色精品网站| 狠狠色丁香婷综合久久| 美女免费视频一区二区| 视频一区在线视频| 亚洲中国最大av网站| 亚洲特黄一级片| 国产精品美女久久久久aⅴ | 日韩午夜在线播放| 555夜色666亚洲国产免| 欧美亚洲国产bt| 欧美亚洲高清一区| 在线视频国产一区| 成人精品视频一区二区三区尤物| 国产在线精品国自产拍免费| 国产一区二区三区免费观看| 蜜桃av噜噜一区| 精品一区在线看| 精品一区二区综合| 国产剧情一区二区| 成人天堂资源www在线| av一区二区三区| 色综合久久久久| 欧美美女激情18p| 欧美一区二区三区的| 精品人在线二区三区| 国产日韩欧美在线一区| 国产女人aaa级久久久级 | 亚洲欧洲一区二区三区| 亚洲欧洲av在线| 亚洲精品免费在线观看| 一区二区三区高清不卡| 日韩成人av影视| 国产在线一区二区综合免费视频| 国产九色sp调教91| 99国产精品久久久| 色综合天天综合| 欧美一区二区三区免费大片 | 欧美日韩大陆一区二区| 91精品国产乱码| 国产女人18水真多18精品一级做| 国产精品国产三级国产三级人妇| 亚洲伦理在线精品| 日韩av一二三| 丁香婷婷综合激情五月色| 在线精品视频一区二区三四| 欧美一区午夜视频在线观看| 久久久久久久久久久久久久久99| 国产精品人成在线观看免费| 亚洲成a天堂v人片| 国产一区二区三区美女| 色综合久久天天| 精品国产乱子伦一区| 亚洲欧美偷拍另类a∨色屁股| 日本欧美一区二区| 99精品欧美一区二区三区综合在线| 欧美日高清视频| 国产精品美女久久久久久久网站| 性感美女久久精品| 成人av中文字幕| 欧美一卡2卡3卡4卡| 综合在线观看色| 国产在线精品一区二区夜色 | 91看片淫黄大片一级在线观看| 欧美日韩大陆在线| 亚洲欧美在线观看| 久久成人羞羞网站| 欧美伊人久久久久久久久影院| 久久精品在线免费观看| 日本亚洲天堂网| 99国产欧美久久久精品| 精品国产乱码久久久久久老虎| 亚洲综合999| 91丝袜美腿高跟国产极品老师| 久久先锋影音av| 免费久久精品视频| 欧美日韩一区二区三区四区| 成人免费在线视频| 福利一区二区在线| 欧美成人伊人久久综合网| 洋洋成人永久网站入口| 成人午夜视频网站| 精品国产免费人成电影在线观看四季| 亚洲成av人片一区二区| 色哟哟日韩精品| 亚洲同性gay激情无套| 成人手机电影网| 精品久久一区二区| 美女视频黄久久| 91麻豆精品国产自产在线观看一区 | 蜜臀精品久久久久久蜜臀 | www.亚洲人| 日本一区二区三区国色天香 | 在线观看视频欧美| 亚洲免费看黄网站| 91视视频在线直接观看在线看网页在线看 | 亚洲你懂的在线视频| 91香蕉视频污在线| 亚洲欧洲国产专区| 91网站在线观看视频| 国产精品国产三级国产a| 不卡欧美aaaaa| 亚洲色图在线播放| 日本伦理一区二区|