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

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

?? listbox.c

?? STM32+Grlib
?? C
?? 第 1 頁 / 共 2 頁
字號:
//*****************************************************************************
//
// 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;

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
91精品国产一区二区三区蜜臀| 国产精品麻豆欧美日韩ww| 精品女同一区二区| 亚洲欧美视频在线观看| 精品一区二区在线看| 在线观看精品一区| 国产亚洲精品久| 美女看a上一区| 欧美三级在线视频| 亚洲精选免费视频| 成人手机在线视频| 久久久久久99精品| 久久国产精品99精品国产| 欧美日韩二区三区| 中文字幕色av一区二区三区| 国产一区欧美一区| 欧美精品一区男女天堂| 免费人成网站在线观看欧美高清| 色激情天天射综合网| 亚洲欧洲综合另类| youjizz久久| 综合色中文字幕| 成人免费观看av| 国产精品国产三级国产aⅴ无密码| 国产在线一区二区| 久久综合久久鬼色中文字| 麻豆精品一区二区综合av| 91精品国产高清一区二区三区 | 国产精品99久久不卡二区| 日韩欧美一区二区视频| 日韩电影免费在线观看网站| 欧美日韩一区二区三区视频| 亚洲自拍偷拍图区| 欧美午夜寂寞影院| 日韩成人av影视| 日韩三区在线观看| 精品一区二区三区的国产在线播放 | 91色.com| 亚洲欧美一区二区三区孕妇| 99久久婷婷国产| 樱桃视频在线观看一区| 欧美日韩综合在线免费观看| 午夜精品久久久久久久久| 欧美福利一区二区| 青青青伊人色综合久久| 日韩欧美国产综合一区| 国产乱子轮精品视频| 日本一区二区三区免费乱视频| 成人美女视频在线观看| 一卡二卡欧美日韩| 91精品国产色综合久久| 精品一区二区三区在线播放| 国产精品视频yy9299一区| 91同城在线观看| 日韩中文字幕区一区有砖一区| 日韩你懂的在线观看| 成人国产在线观看| 亚洲成av人片www| 日韩一区二区三免费高清| 高清不卡在线观看| 亚洲国产视频网站| 久久尤物电影视频在线观看| 色婷婷综合视频在线观看| 奇米在线7777在线精品| 欧美极品xxx| 欧美放荡的少妇| 成人av网站在线| 日韩成人免费看| 中文字幕免费一区| 欧美一区二区三区思思人| 成人激情综合网站| 欧美a一区二区| 亚洲欧美一区二区久久 | 欧美日韩一级二级| 国产成a人亚洲精品| 午夜亚洲国产au精品一区二区 | 欧美高清视频一二三区| 国产91精品免费| 五月天激情综合| 1区2区3区欧美| 精品国产一区二区三区av性色| 91尤物视频在线观看| 国产一区欧美一区| 日韩av一区二区在线影视| 国产精品短视频| 久久久久久久av麻豆果冻| 正在播放亚洲一区| 波多野结衣91| 国产成人在线免费| 另类综合日韩欧美亚洲| 亚洲国产欧美日韩另类综合| 亚洲国产精品激情在线观看 | 久久99久久久久| 亚洲第一福利视频在线| 一区在线中文字幕| 国产精品视频免费| 欧美国产精品劲爆| 久久久高清一区二区三区| 日韩欧美的一区二区| 欧美日韩国产免费一区二区| 91福利在线导航| 91香蕉视频黄| 日韩一区二区三区在线观看| 欧美日韩国产中文| 欧美亚洲动漫精品| 91成人在线精品| 欧美在线观看视频一区二区| 91尤物视频在线观看| 99久久国产免费看| 色久综合一二码| 在线观看成人小视频| 在线观看亚洲精品视频| 欧美在线999| 欧美精品乱码久久久久久| 欧美视频自拍偷拍| 91麻豆精品国产综合久久久久久| 欧美视频完全免费看| 欧美理论在线播放| 欧美大度的电影原声| 久久在线免费观看| 国产欧美综合在线| 亚洲免费观看高清完整版在线| 亚洲欧美激情插 | 国产精品久久久久久久午夜片 | 99久久国产综合精品女不卡| 一本色道**综合亚洲精品蜜桃冫| 99久久国产综合精品色伊| 色综合天天性综合| 欧美网站一区二区| 日韩一区二区三免费高清| 精品国产三级电影在线观看| 欧美激情综合五月色丁香小说| 亚洲欧洲三级电影| 亚洲一区二区高清| 国产原创一区二区| 97久久精品人人做人人爽 | 精品精品欲导航| 国产欧美精品国产国产专区 | 中文字幕在线观看不卡视频| 亚洲激情自拍视频| 美女脱光内衣内裤视频久久网站 | 亚洲欧美色综合| 亚洲成人先锋电影| 国产一区二区三区av电影| 99热精品国产| 欧美日韩精品一区视频| 精品国产1区2区3区| 亚洲视频在线观看一区| 日本成人在线看| 国产 日韩 欧美大片| 欧美精选一区二区| 国产欧美日韩综合精品一区二区| 亚洲精品一二三区| 激情欧美日韩一区二区| 91福利在线观看| 久久久久99精品一区| 亚洲一线二线三线久久久| 国内精品伊人久久久久影院对白| 91亚洲精品一区二区乱码| 日韩精品一区二区三区四区视频| 国产精品久久久久毛片软件| 蜜桃视频在线观看一区二区| 99久久亚洲一区二区三区青草| 日韩一区二区在线免费观看| 国产精品成人午夜| 久久成人久久鬼色| 欧美日本韩国一区| 亚洲精品视频在线看| 国产成人亚洲综合a∨猫咪| 欧美乱熟臀69xxxxxx| 亚洲三级免费观看| 福利一区福利二区| 精品精品国产高清a毛片牛牛| 亚洲自拍与偷拍| 色综合天天综合网国产成人综合天 | 美女被吸乳得到大胸91| 色噜噜狠狠成人中文综合| 亚洲国产成人午夜在线一区| 国产真实乱偷精品视频免| 91精品麻豆日日躁夜夜躁| 一区二区三区成人| 91蜜桃婷婷狠狠久久综合9色| 久久久99免费| 久久精品国产**网站演员| 欧美日韩第一区日日骚| 亚洲制服丝袜av| 欧美亚洲综合色| 日韩一区在线看| 94-欧美-setu| 最新日韩在线视频| 99久久er热在这里只有精品66| 久久久亚洲精华液精华液精华液| 老司机精品视频在线| 91精品国产麻豆| 美美哒免费高清在线观看视频一区二区 | 亚洲欧美一区二区三区国产精品 | 日韩精品福利网| 欧美一区二区三区在| 日韩精品电影在线| 欧美成人一区二区三区在线观看|