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 ...
随机推荐
- leetcode解题报告(25):Reverse Words in a String III
描述 Given a string, you need to reverse the order of characters in each word within a sentence while ...
- SpringMVC从Session域中获取值
SpringMVC从Session域中获取值 SpringMVC环境自行搭建 第一步:前端页面 第二步.后台代码 第三步.响应视图 第四步.在当前处理器所在的类设置@SessionAttributes ...
- 页面截取字段和转码,页面截取字段时候需要进入JS
截取字段 ${fn:substring(info.cpflmc,0,20)}${fn:length(info.cpflmc)>40?'...':''} 表头list ...
- 常用spaceclaim脚本(二)
#创建一个草图 #第一个参数传入一个Frame对象 #通过一个点和两个向量创建Frame #Frame的类成员函数Create被重载 #重载函数1:Frame.Create(Point, Direct ...
- python 的小技巧之统计list里面元素的个数
一般写法 def count_list(std:list,tongji): i=0 for item in std: if item==tongji: i+=1 print(i) if __name_ ...
- C#求任意两整数之和
2019.9.11 作业要求: 求出任意两整数之和 解决方案: using System; using System.Collections.Generic; using System.Linq; u ...
- 随机森林算法OOB_SCORE最佳特征选择
RandomForest算法(有监督学习),可以根据输入数据,选择最佳特征组合,减少特征冗余:原理:由于随机决策树生成过程采用的Boostrap,所以在一棵树的生成过程并不会使用所有的样本,未使用的样 ...
- comparison of truncate vs delete in mysql/sqlserver
comparison of truncate vs delete in mysql/sqlserver [duplicate] DELETE DELETE is a DML Command. DE ...
- RK3399 pro 开发记录
RK3399有三种启动模式:1.Normal模式:2.Loader模式:3.MaskRom模式. Normal模式是正常的启动过程,各个组件依次加载,直到正常进入系统. Loade ...
- gitlab 默认端口修改文件
vim /var/opt/gitlab/nginx/conf/gitlab-http.conf listen *:80;