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

? 歡迎來(lái)到蟲(chóng)蟲(chóng)下載站! | ?? 資源下載 ?? 資源專(zhuān)輯 ?? 關(guān)于我們
? 蟲(chóng)蟲(chóng)下載站

?? listbox.c

?? STM32+Grlib
?? C
?? 第 1 頁(yè) / 共 2 頁(yè)
字號(hào):
//*****************************************************************************
//
// listbox.c - A listbox widget.
//
// 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"
#include "grlib/listbox.h"

//*****************************************************************************
//
//! \addtogroup listbox_api
//! @{
//
//*****************************************************************************

//*****************************************************************************
//
// Make sure that the abs() macro is defined.
//
//*****************************************************************************
#ifndef abs
#define abs(a) (((a) >= 0) ? (a) : (-(a)))
#endif

//*****************************************************************************
//
// Make sure min and max are defined.
//
//*****************************************************************************
#ifndef min
#define min(a, b) (((a) < (b)) ? (a) : (b))
#endif

#ifndef max
#define max(a, b) (((a) < (b)) ? (b) : (a))
#endif

//*****************************************************************************
//
//! Draws the contents of a listbox.
//!
//! \param pWidget is a pointer to the listbox widget to be drawn.
//!
//! This function draws the contents of a listbox on the display.  This is
//! called in response to a \b #WIDGET_MSG_PAINT message.
//!
//! \return None.
//
//*****************************************************************************
static void
ListBoxPaint(tWidget *pWidget)
{
    tListBoxWidget *pListBox;
    tContext sCtx;
    tRectangle sWidgetRect, sLineRect;
    short sHeight;
    long lWidth;
    unsigned short usCount, usString;

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

    //
    // Convert the generic widget pointer into a listbox widget pointer.
    //
    pListBox = (tListBoxWidget *)pWidget;

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

    //
    // Initialize the clipping region based on the extents of this listbox.
    //
    sWidgetRect = pWidget->sPosition;
    GrContextClipRegionSet(&sCtx, &sWidgetRect);

    //
    // See if the listbox outline style is selected.
    //
    if(pListBox->ulStyle & LISTBOX_STYLE_OUTLINE)
    {
        //
        // Outline the listbox with the outline color.
        //
        GrContextForegroundSet(&sCtx, pListBox->ulOutlineColor);
        GrRectDraw(&sCtx, &(pWidget->sPosition));

        //
        // Shrink the widget region by one pixel on each side and draw another
        // rectangle, this time in the background color.  This ensures that the
        // text will not interfere with the colored border.
        //
        sWidgetRect.sXMin++;
        sWidgetRect.sYMin++;
        sWidgetRect.sXMax--;
        sWidgetRect.sYMax--;
        GrContextForegroundSet(&sCtx, pListBox->ulBackgroundColor);
        GrRectDraw(&sCtx, &sWidgetRect);

        //
        // Reduce the size of the rectangle by another pixel to get the final
        // area into which we will put the text.
        //
        sWidgetRect.sXMin++;
        sWidgetRect.sYMin++;
        sWidgetRect.sXMax--;
        sWidgetRect.sYMax--;
        GrContextClipRegionSet(&sCtx, &sWidgetRect);
    }

    //
    // Start drawing at the top of the widget.
    //
    sLineRect = sWidgetRect;
    usCount = 0;
    usString = pListBox->usStartEntry;
    sHeight = GrFontHeightGet(pListBox->pFont);

    //
    // Keep drawing until we reach the bottom of the listbox or run out of
    // strings to draw.
    //
    while((sLineRect.sYMin < sWidgetRect.sYMax) &&
          (usCount < pListBox->usPopulated))
    {
        //
        // Calculate the rectangle that will enclose this line of text.
        //
        sLineRect.sYMax = sLineRect.sYMin + sHeight - 1;

        //
        // Set foreground and background colors appropriately.
        //
        GrContextBackgroundSet(&sCtx, ((usString == pListBox->sSelected) ?
                               pListBox->ulSelectedBackgroundColor :
                               pListBox->ulBackgroundColor));
        GrContextForegroundSet(&sCtx, ((usString == pListBox->sSelected) ?
                               pListBox->ulSelectedTextColor :
                               pListBox->ulTextColor));

        //
        // Draw the text.
        //
        GrStringDraw(&sCtx, pListBox->ppcText[usString], -1, sLineRect.sXMin,
                     sLineRect.sYMin, 1);

        //
        // Determine the width of the string we just rendered.
        //
        lWidth = GrStringWidthGet(&sCtx, pListBox->ppcText[usString], -1);

        //
        // Do we need to clear the area to the right of the string?
        //
        if(lWidth < (sLineRect.sXMax - sLineRect.sXMin + 1))
        {
            //
            // Yes - we need to fill the right side of this string with
            // background color.
            //
            GrContextForegroundSet(&sCtx, ((usString == pListBox->sSelected) ?
                                   pListBox->ulSelectedBackgroundColor :
                                   pListBox->ulBackgroundColor));
            sLineRect.sXMin += lWidth;
            GrRectFill(&sCtx, &sLineRect);
            sLineRect.sXMin = sWidgetRect.sXMin;
        }

        //
        // Move on to the next string.
        //
        usCount++;
        usString++;
        if(usString == pListBox->usMaxEntries)
        {
            usString = 0;
        }
        sLineRect.sYMin += sHeight;
    }

    //
    // Fill the remainder of the listbox area with the background color.
    //
    if(sLineRect.sYMin < sWidgetRect.sYMax)
    {
        //
        // Determine the rectangle to be filled.
        //
        sLineRect.sYMax = sWidgetRect.sYMax;

        //
        // Fill the rectangle with the background color.
        //
        GrContextForegroundSet(&sCtx, pListBox->ulBackgroundColor);
        GrRectFill(&sCtx, &sLineRect);
    }
}

//*****************************************************************************
//
// Handles pointer messages for a listbox widget.
//
// \param pListBox is a pointer to the listbox widget.
// \param ulMsg is the message.
// \param lX is the X coordinate of the pointer.
// \param lY is the Y coordinate of the pointer.
//
// This function receives pointer messages intended for this listbox widget
// and processes them accordingly.
//
// \return Returns a value appropriate to the supplied message.
//
//*****************************************************************************
static long
ListBoxPointer(tListBoxWidget *pListBox, unsigned long ulMsg, long lX, long lY)
{
    long lLineNum, lEntry, lVisible, lMaxUp, lMaxDown, lScroll;

    switch(ulMsg)
    {
        //
        // The touchscreen has been pressed.
        //
        case WIDGET_MSG_PTR_DOWN:
        {
            //
            // Is the pointer press within the bounds of this widget?
            //
            if(!GrRectContainsPoint(&(pListBox->sBase.sPosition), lX, lY))
            {
                //
                // This is not a message for us so return 0 to indicate that
                // we did not process it.
                //
                return(0);
            }
            else
            {
                //
                // The pointer was pressed within this control.  Remember the Y
                // coordinate and reset or scrolling flag.
                //
                pListBox->usScrolled = 0;
                pListBox->lPointerY = lY;

                //
                // Return 1 to indicate to the widget manager that we processed
                // the message.  This widget will now receive all pointer move
                // messages until the pointer is released.
                //
                return(1);
            }
        }

        //
        // The touchscreen has been released.
        //
        case WIDGET_MSG_PTR_UP:
        {
            //
            // If the pointer is still within the bounds of the control and
            // we have not scrolled the contents since the last time the
            // pointer was pressed, we assume that this is a tap rather than
            // a drag and select the element that falls beneath the current
            // pointer position.  If the pointer is outside our control, if
            // we have scrolled already or if the control is locked, don't
            // change the selection.
            //
            if((pListBox->usScrolled == 0) &&
               !(pListBox->ulStyle & LISTBOX_STYLE_LOCKED) &&
                GrRectContainsPoint(&(pListBox->sBase.sPosition), lX, lY))
            {
                //
                // It seems we need to change the selected element. What is
                // the display line number that has been clicked on?
                //
                lLineNum = (lY - (long)pListBox->sBase.sPosition.sYMin) /
                           GrFontHeightGet(pListBox->pFont);

                //
                // We now know the location of the click as a number of text
                // lines from the top of the list box.  Now determine what
                // entry is shown there, remembering that the index may wrap.
                //
                lEntry = ((long)pListBox->usStartEntry + lLineNum) %
                         pListBox->usMaxEntries;

                //
                // If this is an unpopulated entry or the current selection,
                // clear the selection.
                //
                if((lEntry >= (long)pListBox->usPopulated) ||
                   (lEntry == (long)pListBox->sSelected))
                {
                    //
                    // Yes - update the selection and force a repaint.
                    //
                    pListBox->sSelected = (short)0xFFFF;
                }
                else
                {
                    //
                    // The pointer was tapped on a valid entry other than the
                    // current selection so change the selection.
                    //
                    pListBox->sSelected = (short)lEntry;
                }

                //
                // Force a repaint of the widget.
                //
                WidgetPaint((tWidget *)pListBox);

                //
                // Tell the client that the selection changed.
                //
                if(pListBox->pfnOnChange)
                {
                    (pListBox->pfnOnChange)((tWidget *)pListBox,
                                            pListBox->sSelected);
                }
            }

            //
            // We process all pointer up messages so return 1 to tell the
            // widget manager this.
            //
            return(1);
        }

        //
        // The pointer is moving while pressed.
        //
        case WIDGET_MSG_PTR_MOVE:
        {
            //
            // How far has the pointer moved vertically from the point where it
            // was pressed or where we last registered a scroll?  lLineNum will
            // be negative for downward scrolling.
            //
            lLineNum = pListBox->lPointerY - lY;

?? 快捷鍵說(shuō)明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號(hào) Ctrl + =
減小字號(hào) Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
日韩一区二区三区观看| 91麻豆swag| 97精品国产露脸对白| 色成年激情久久综合| 欧美麻豆精品久久久久久| 26uuu亚洲| 亚洲欧美另类综合偷拍| 婷婷国产在线综合| 国产精品综合视频| 欧美视频一区在线| 精品国产电影一区二区| 中文字幕综合网| 视频一区视频二区中文字幕| 国产精品一区免费在线观看| 成人激情视频网站| 欧美日韩高清在线| 久久精品视频在线看| 亚洲国产一二三| 丁香五精品蜜臀久久久久99网站| 欧美性受xxxx黑人xyx性爽| 精品国产一区a| 一区二区三区毛片| 国产91富婆露脸刺激对白| 欧美日本一区二区三区四区| 欧美极品aⅴ影院| 日韩成人午夜电影| 99国产精品国产精品毛片| 日韩欧美一级二级| 亚洲一二三四在线观看| 豆国产96在线|亚洲| 欧美一区二区日韩一区二区| 国产精品无人区| 久久99深爱久久99精品| 欧美中文字幕一二三区视频| 中文字幕精品在线不卡| 蜜桃久久久久久| 欧美性淫爽ww久久久久无| 国产精品毛片a∨一区二区三区| 奇米影视一区二区三区| 欧美亚洲动漫另类| 中文字幕日韩一区| 国产成人免费视| 欧美videos中文字幕| 亚洲va国产天堂va久久en| av成人老司机| 国产欧美中文在线| 九九在线精品视频| 日韩一区二区中文字幕| 亚洲香肠在线观看| 色狠狠色狠狠综合| 中文字幕一区二区三中文字幕| 精品无码三级在线观看视频| 欧美精选在线播放| 亚洲一区二区三区四区在线免费观看| 粉嫩av亚洲一区二区图片| 久久久久久久精| 韩国一区二区三区| 精品国产乱码久久久久久图片| 婷婷开心激情综合| 欧美日韩成人一区二区| 亚洲国产毛片aaaaa无费看| 日本道在线观看一区二区| 国产精品久久福利| 99精品在线观看视频| 中文字幕中文字幕中文字幕亚洲无线 | 亚洲国产乱码最新视频| 在线观看国产精品网站| 亚洲精品乱码久久久久久久久| 一本在线高清不卡dvd| 亚洲丝袜另类动漫二区| 91天堂素人约啪| 亚洲乱码中文字幕综合| 91天堂素人约啪| 亚洲男人的天堂av| 色婷婷精品大视频在线蜜桃视频| 亚洲天堂成人网| 色婷婷av一区二区| 亚洲一区成人在线| 91精品国产色综合久久久蜜香臀| 日本亚洲三级在线| 精品久久国产字幕高潮| 麻豆一区二区在线| 久久综合狠狠综合久久激情| 极品少妇一区二区| 久久嫩草精品久久久久| 国产91丝袜在线观看| 国产精品久久久久7777按摩 | 日韩久久一区二区| 91麻豆国产在线观看| 亚洲精品国产品国语在线app| 91九色02白丝porn| 日韩国产高清在线| 久久久久久99久久久精品网站| 成人亚洲一区二区一| 亚洲私人影院在线观看| 欧美午夜视频网站| 美女免费视频一区| 国产欧美中文在线| 色先锋资源久久综合| 首页欧美精品中文字幕| 久久一区二区视频| 91丝袜美腿高跟国产极品老师 | 91福利在线观看| 日韩国产在线观看| 国产亚洲精品7777| 色视频欧美一区二区三区| 日韩国产欧美在线观看| 国产日韩精品一区二区浪潮av | 亚洲超碰精品一区二区| 日韩三级伦理片妻子的秘密按摩| 国产精品一区二区视频| 亚洲日本va在线观看| 5858s免费视频成人| 国产乱色国产精品免费视频| 日韩美女视频19| 欧美不卡一区二区三区四区| 懂色中文一区二区在线播放| 亚洲自拍另类综合| 国产亚洲精品资源在线26u| 在线观看免费亚洲| 精品一区二区三区视频在线观看| 亚洲图片你懂的| 精品国产免费人成在线观看| 91丨九色丨尤物| 久久99精品国产.久久久久| 亚洲天堂中文字幕| 欧美v日韩v国产v| 欧美午夜视频网站| 风间由美性色一区二区三区| 午夜电影网一区| 中文字幕视频一区| 精品国产露脸精彩对白| 欧美午夜精品理论片a级按摩| 国产剧情av麻豆香蕉精品| 亚洲成人动漫一区| 国产精品久线观看视频| 欧美一区二区三区系列电影| 99国产欧美久久久精品| 国产做a爰片久久毛片| 五月婷婷综合激情| 亚洲视频中文字幕| 日本一区二区三级电影在线观看| 欧美群妇大交群中文字幕| www.66久久| 国产成人午夜精品5599| 美女视频黄免费的久久| 亚洲成人精品在线观看| 国产精品不卡一区二区三区| 久久综合色天天久久综合图片| 欧美日韩亚洲综合一区 | 一区二区三区免费| 国产欧美日韩精品在线| 欧美岛国在线观看| 欧美日本在线观看| 欧美在线不卡视频| www.99精品| 国产不卡视频一区二区三区| 久久国产精品免费| 日日欢夜夜爽一区| 亚洲在线视频网站| 亚洲精品日韩一| 国产精品对白交换视频| 欧美激情综合五月色丁香小说| 精品久久国产老人久久综合| 777亚洲妇女| 欧美日韩一区二区三区免费看| 99riav久久精品riav| 成人午夜av在线| 国产精品亚洲专一区二区三区| 经典三级在线一区| 美日韩一区二区三区| 天天色天天爱天天射综合| 亚洲一区二区欧美日韩| 一卡二卡欧美日韩| 亚洲综合一区二区三区| 亚洲精品免费电影| 一区二区三区欧美日| 亚洲综合另类小说| 亚洲一区二区三区自拍| 亚洲综合色区另类av| 亚洲一区二区三区三| 五月婷婷激情综合网| 视频一区二区中文字幕| 午夜精品一区二区三区电影天堂 | 欧美日韩国产美| 欧美人牲a欧美精品| 在线播放国产精品二区一二区四区| 欧美日韩中文国产| 91精品国产综合久久福利软件| 欧美一区二区黄色| 欧美大片在线观看| 欧美不卡一区二区| 国产日韩欧美在线一区| 国产精品久久久久毛片软件| 日韩理论在线观看| 亚洲第一在线综合网站| 日韩电影在线免费观看| 久久99精品久久久久久| 国产成人av影院| 色综合久久综合网欧美综合网|