MApp_ZUI_CTL_MarqueeTextWinProc字串滚动
///////////////////////////////////////////////////////////////////////////////
/// global MApp_ZUI_CTL_MarqueeTextWinProc
/// Window Proc for "marquee text" control,
/// which display a static text by clipped string with dynamic color
/// if the string content is more than boundary, it will set a timer for text rotation (once)
///
/// rule: if window data == 0, no marquee animation
/// if window is not focus state, no marquee animation
/// if dynamic string content is shorter than boundary, no marquee animation
/// if pData->u8ShowStartPosition==0xFF, animation disabled
/// if pData->u8ShowStartPosition>=strlen, animation disabled
///
///
/// @param [in] hWnd HWND window handle
/// @param [in] pMsg PMSG message type
///
/// @return S32 message execute result
///
/// @author MStarSemi @date 2007/1/25
/////////////////////////////////////////////////////////////////////////////// S32 MApp_ZUI_CTL_MarqueeTextWinProc(HWND hWnd, PMSG pMsg)
{
GUI_DATA_MARQUEE_VARDATA * pData =
(GUI_DATA_MARQUEE_VARDATA*)MApp_ZUI_API_GetWindowData(hWnd); switch(pMsg->message)
{
case MSG_TIMER:
if (pData)
{
if (pData->u8ShowStartPosition == 0)
MApp_ZUI_API_SetTimer(hWnd, pMsg->wParam, ZUI_MARQUEE_ANIMATION_INTERVAL_MS);
pData->u8ShowStartPosition++;
MApp_ZUI_API_InvalidateWindow(hWnd);
}
return 0; case MSG_PAINT:
{
//get buffer GC for offline drawing...
PAINT_PARAM * param = (PAINT_PARAM*)pMsg->wParam;
DRAWSTYLE_TYPE ds_type = DS_NORMAL; if (param->bIsDisable)
{
param->dc.u8ConstantAlpha = MApp_ZUI_API_GetDisableAlpha(hWnd);
ds_type = DS_DISABLE;
}
else if (param->bIsFocus) //the same focus group
{
param->dc.u8ConstantAlpha = MApp_ZUI_API_GetFocusAlpha(hWnd);
ds_type = DS_FOCUS;
}
else
{
param->dc.u8ConstantAlpha = MApp_ZUI_API_GetNormalAlpha(hWnd);
} _MApp_ZUI_API_DefaultOnPaint(hWnd, param, FALSE);
{
U16 u16TxtComponentIndex = _MApp_ZUI_API_FindFirstComponentIndex(hWnd, ds_type, CP_TEXT_OUT);
LPTSTR pStr = MApp_ZUI_ACT_GetDynamicText(hWnd);
if (u16TxtComponentIndex != 0xFFFF && pStr)
{
DRAW_TEXT_OUT_DYNAMIC dyna; _MApp_ZUI_API_ConvertTextComponentToDynamic(u16TxtComponentIndex, &dyna);
dyna.pString = pStr;
dyna.TextColor = MApp_ZUI_ACT_GetDynamicColor(hWnd, ds_type, dyna.TextColor); //marquee animation:
if (ds_type == DS_FOCUS && pData != NULL &&
pData->u8ShowStartPosition != 0xFF)
{
if (pData->u8ShowStartPosition >= MApp_ZUI_API_Strlen(pStr))
{
pData->u8ShowStartPosition = 0xFF;
MApp_ZUI_API_KillTimer(hWnd, 0);
}
else if (pData->u8ShowStartPosition == 0)
{
U16 width;
clrBtn1.Fontfmt.flag = dyna.flag;
clrBtn1.Fontfmt.ifont_gap = dyna.u8dis;
clrBtn1.bStringIndexWidth = CHAR_IDX_2BYTE;
width = msAPI_OSD_GetStrWidth(Font[dyna.eSystemFont].fHandle, (U8*)pStr, &clrBtn1);
//note: add border for a little truncate case..
if (width+BTN_TEXT_GAP*2 <= param->rect->width)
{
pData->u8ShowStartPosition = 0xFF;
MApp_ZUI_API_KillTimer(hWnd, 0);
}
}
else
{
dyna.pString += pData->u8ShowStartPosition;
dyna.u8dots = 0; //note: don't show dots for animation..
}
}
else
{
//note: pData may be shared with others, so don't clear them
// but we need to stop the timer if animation still going
MApp_ZUI_API_KillTimer(hWnd, 0);
} _MApp_ZUI_API_DrawDynamicComponent(CP_TEXT_OUT_DYNAMIC, &dyna, ¶m->dc, param->rect);
}
} }
return 0; default:
break;
} return DEFAULTWINPROC(hWnd, pMsg);
} ///////////////////////////////////////////////////////////////
// methods void MApp_ZUI_CTL_MarqueeTextEnableAnimation(HWND hwnd, BOOLEAN bEnable)
{
//note: if enable, try to check string length is long enough, and then start animation
// if disable, stop and clear to normal status if (hwnd != HWND_INVALID)
{
GUI_DATA_MARQUEE_VARDATA * pData =
(GUI_DATA_MARQUEE_VARDATA*)MApp_ZUI_API_GetWindowData(hwnd); if (pData == NULL)
return; if (bEnable)
{
pData->u8ShowStartPosition = 0;
MApp_ZUI_API_SetTimer(hwnd, 0, ZUI_MARQUEE_INITIAL_INTERVAL_MS);
}
else
{
pData->u8ShowStartPosition = 0xFF;
MApp_ZUI_API_KillTimer(hwnd, 0);
}
MApp_ZUI_API_InvalidateWindow(hwnd);
}
}
MApp_ZUI_CTL_MarqueeTextWinProc字串滚动的更多相关文章
- 【NOIP2015】 Day2 T2 字串 (多维动归)
2018-09-12 原题传送门(洛谷)https://www.luogu.org/problemnew/show/P2679 模拟考试的时候完全没有想到 正确的DP方程呢 本来写了一个大致是对的转移 ...
- 最大公共字串LCS问题(阿里巴巴)
给定两个串,均由最小字母组成.求这两个串的最大公共字串LCS(Longest Common Substring). 使用动态规划解决. #include <iostream> #inclu ...
- 编程:使用递归方式判断某个字串是否回文(Palindrome)
Answer: import java.util.Scanner; public class Palindrome { private static int len;//全局变量整型数据 privat ...
- NOIP2002字串变换[BFS]
题目描述 已知有两个字串 A$, B$ 及一组字串变换的规则(至多6个规则): A1$ -> B1$ A2$ -> B2$ 规则的含义为:在 A$中的子串 A1$ 可以变换为 B1$.A2 ...
- 字串符相关 split() 字串符分隔 substring() 提取字符串 substr()提取指定数目的字符 parseInt() 函数可解析一个字符串,并返回一个整数。
split() 方法将字符串分割为字符串数组,并返回此数组. stringObject.split(separator,limit) 我们将按照不同的方式来分割字符串: 使用指定符号分割字符串,代码如 ...
- mormot 数据集转换为JSON字串
mormot 数据集转换为JSON字串 unit Unit1; interface uses Windows, Messages, SysUtils, Variants, Classes, Graph ...
- 字串变换(codevs 1099)
题目描述 Description 已知有两个字串 A$, B$ 及一组字串变换的规则(至多6个规则): A1$ -> B1$ A2$ -> B2$ 规则的含义为:在 A$中的子串 A1$ ...
- @有两个含义:1,在参数里,以表明该变量为伪参数 ,在本例中下文里将用@name变量代入当前代码中2,在字串中,@的意思就是后面的字串以它原本的含义显示,如果不
@有两个含义:1,在参数里,以表明该变量为伪参数 ,在本例中下文里将用@name变量代入当前代码中 2,在字串中,@的意思就是后面的字串以它原本的含义显示,如果不加@那么需要用一些转义符\来显示一些特 ...
- PHP 中替换若干字符串字串为数组中的值,不用循环,非常高效
替换某个字符串中的一个或若干个字串为数组中某些值 php本身有自带的函数,可以不用循环非常高效的实现其效果: 实例代码: $phrase = "You should eat fruit ...
随机推荐
- CODE FESTIVAL 2016 qual B题解
传送门 \(A\) 什么玩意儿-- const char t[]={"0CODEFESTIVAL2016"}; char s[25];int res; int main(){ sc ...
- linux shell下面的几种proxy方式
设置ALL_PROXY环境变量 export ALL_PROXY=socks5://127.0.0.1:1080 支持socks5 http https 取消 export ALL_PROXY=&qu ...
- Error instantiating class cn.edu.zju.springmvc.pojo.Items with invalid types () or values (). 报错解决方法
org.mybatis.spring.MyBatisSystemException: nested exception is org.apache.ibatis.reflection.Reflecti ...
- Maven 异常 druid jar冲突
异常: 十二月 25, 2017 11:04:41 下午 org.apache.tomcat.util.digester.SetPropertiesRule begin 警告: [SetPropert ...
- gisoracle做windows界面
import tkinter as tk from tkinter import messagebox # 设置窗口居中 def window_info(): ws = window.winfo_sc ...
- LF: 换行,U+000A VT: 垂直定位,U+000B FF: 换页符,U+000C CR: 回车符,U+000D CR+LF:CR(U+000D)后跟LF(U+000A) NEL: 下一行,U+0085 LS: 分行,U+2028 PS: 分段,U+2029
https://zh.wikipedia.org/wiki/換行 换行(英语:newline.line ending.end-of-line (EOL).line Feed (LF).line bre ...
- Python脚本基础运算和算法
原文地址:https://www.cnblogs.com/ailiailan/p/10141741.html 通过关注“常见”脚本,是对代码的一个很好的学习和总结的方式. 1.冒泡排序 lis = [ ...
- Android利用canvas画各种图形
Android利用canvas画各种图形(点.直线.弧.圆.椭圆.文字.矩形.多边形.曲线.圆角矩形) 本文链接:https://blog.csdn.net/rhljiayou/article/det ...
- Python之Pandas操作csv文件dataframe
# -*- coding: utf-8 -*- # author:baoshan import pandas as pd def main(): aqi_data = pd.read_csv('chi ...
- Python3基础 函数 参数为list 使用+=会影响到外部的实参
Python : 3.7.3 OS : Ubuntu 18.04.2 LTS IDE : pycharm-community-2019.1.3 ...