⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 wm_sample.c

📁 ucgui3.90a
💻 C
📖 第 1 页 / 共 2 页
字号:
  GUI_Delay(SPEED);  WM_InvalidateWindow(_hWindow1);  GUI_Delay(SPEED);}/*********************************************************************       _DemoBringToTop  Demonstrates the use of WM_BringToTop*/static void _DemoBringToTop(void) {  _ChangeInfoText("WM_BringToTop()");  GUI_Delay(SPEED);  WM_BringToTop(_hWindow1);      GUI_Delay(SPEED);}/*********************************************************************       _DemoMoveTo  Demonstrates the use of WM_MoveTo*/static void _DemoMoveTo(void) {  int i, tm, tDiff;  _ChangeInfoText("WM_MoveTo()");  GUI_Delay(SPEED);  for (i = 1; i < 56; i++) {    tm = GUI_GetTime();    WM_MoveTo(_hWindow1,  50 + i,  70 + i);    WM_MoveTo(_hWindow2, 105 - i, 125 - i);    tDiff = 15 - (GUI_GetTime() - tm);    GUI_Delay(tDiff);  }  for (i = 1; i < 56; i++) {    tm = GUI_GetTime();    WM_MoveTo(_hWindow1, 105 - i, 125 - i);    WM_MoveTo(_hWindow2,  50 + i,  70 + i);    tDiff = 15 - (GUI_GetTime() - tm);    GUI_Delay(tDiff);  }  GUI_Delay(SPEED);}/*********************************************************************       _DemoBringToBottom  Demonstrates the use of WM_BringToBottom*/static void _DemoBringToBottom(void) {  _ChangeInfoText("WM_BringToBottom()");  GUI_Delay(SPEED);  WM_BringToBottom(_hWindow1);  GUI_Delay(SPEED);}/*********************************************************************       _DemoMoveWindow  Demonstrates the use of WM_MoveWindow*/static void _DemoMoveWindow(void) {  int i, tm, tDiff;  _ChangeInfoText("WM_MoveWindow()");  GUI_Delay(SPEED);  for (i = 0; i < 55; i++) {    tm = GUI_GetTime();    WM_MoveWindow(_hWindow1,  1,  1);    WM_MoveWindow(_hWindow2, -1, -1);    tDiff = 15 - (GUI_GetTime() - tm);    GUI_Delay(tDiff);  }  for (i = 0; i < 55; i++) {    tm = GUI_GetTime();    WM_MoveWindow(_hWindow1, -1, -1);    WM_MoveWindow(_hWindow2,  1,  1);    tDiff = 15 - (GUI_GetTime() - tm);    GUI_Delay(tDiff);  }  GUI_Delay(SPEED);}/*********************************************************************       _DemoHideShowParent  Demonstrates the use of WM_HideWindow and WM_ShowWindow*/static void _DemoHideShowParent(void) {  _ChangeInfoText("WM_HideWindow(Parent)");  GUI_Delay(SPEED);  WM_HideWindow(_hWindow2);  GUI_Delay(SPEED/3);  WM_HideWindow(_hWindow1);  GUI_Delay(SPEED);  _ChangeInfoText("WM_ShowWindow(Parent)");  GUI_Delay(SPEED);  WM_ShowWindow(_hWindow1);  GUI_Delay(SPEED/3);  WM_ShowWindow(_hWindow2);  GUI_Delay(SPEED);}/*********************************************************************       _DemoHideShowChild  Demonstrates the use of WM_HideWindow and WM_ShowWindow*/static void _DemoHideShowChild(void) {  _ChangeInfoText("WM_HideWindow(Child)");  GUI_Delay(SPEED);  WM_HideWindow(_hChild);  GUI_Delay(SPEED);  _ChangeInfoText("WM_ShowWindow(Child)");  GUI_Delay(SPEED);  WM_ShowWindow(_hChild);  GUI_Delay(SPEED);}/*********************************************************************       _DemoClipping  Demonstrates clipping at parent borders*/static void _DemoClipping(void) {  int i, tm, tDiff;  _ChangeInfoText("Demonstrating clipping of child");  GUI_Delay(SPEED);  for (i = 0; i < 25; i++) {    tm = GUI_GetTime();    WM_MoveWindow(_hChild,  1,  0);    tDiff = 15 - (GUI_GetTime() - tm);    GUI_Delay(tDiff);  }  for (i = 0; i < 25; i++) {    tm = GUI_GetTime();    WM_MoveWindow(_hChild,  0,  1);    tDiff = 15 - (GUI_GetTime() - tm);    GUI_Delay(tDiff);  }  for (i = 0; i < 50; i++) {    tm = GUI_GetTime();    WM_MoveWindow(_hChild, -1,  0);    tDiff = 15 - (GUI_GetTime() - tm);    GUI_Delay(tDiff);  }  for (i = 0; i < 25; i++) {    tm = GUI_GetTime();    WM_MoveWindow(_hChild,  0, -1);    tDiff = 15 - (GUI_GetTime() - tm);    GUI_Delay(tDiff);  }  for (i = 0; i < 25; i++) {    tm = GUI_GetTime();    WM_MoveWindow(_hChild,  1,  0);    tDiff = 15 - (GUI_GetTime() - tm);    GUI_Delay(tDiff);  }  GUI_Delay(SPEED);}/*********************************************************************       _DemoRedrawing  Demonstrates how useful can be a callback*/static void _DemoRedrawing(void) {  int i, tm, tDiff;  _ChangeInfoText("Demonstrating redrawing");  GUI_Delay(SPEED);  _LiftUp(40);  GUI_Delay(SPEED/3);  _ChangeInfoText("Using a callback for redrawing");  GUI_Delay(SPEED/3);  for (i = 0; i < 55; i++) {    tm = GUI_GetTime();    WM_MoveWindow(_hWindow1,  1,  1);    WM_MoveWindow(_hWindow2, -1, -1);    tDiff = 15 - (GUI_GetTime() - tm);    GUI_Delay(tDiff);  }  for (i = 0; i < 55; i++) {    tm = GUI_GetTime();    WM_MoveWindow(_hWindow1, -1, -1);    WM_MoveWindow(_hWindow2,  1,  1);    tDiff = 15 - (GUI_GetTime() - tm);    GUI_Delay(tDiff);  }  GUI_Delay(SPEED/4);  _LiftDown(30);  GUI_Delay(SPEED/2);  _ChangeInfoText("Without redrawing");  GUI_Delay(SPEED);  _LiftUp(30);  GUI_Delay(SPEED/4);  WM_SetCallback(WM_HBKWIN, _cbBkWindowOld);  for (i = 0; i < 55; i++) {    tm = GUI_GetTime();    WM_MoveWindow(_hWindow1,  1,  1);    WM_MoveWindow(_hWindow2, -1, -1);    tDiff = 15 - (GUI_GetTime() - tm);    GUI_Delay(tDiff);  }  for (i = 0; i < 55; i++) {    tm = GUI_GetTime();    WM_MoveWindow(_hWindow1, -1, -1);    WM_MoveWindow(_hWindow2,  1,  1);    tDiff = 15 - (GUI_GetTime() - tm);    GUI_Delay(tDiff);  }  GUI_Delay(SPEED/3);  WM_SetCallback(WM_HBKWIN, _cbBkWindow);  _LiftDown(40);  GUI_Delay(SPEED);}/*********************************************************************       _DemoResizeWindow  Demonstrates the use of WM_ResizeWindow*/static void _DemoResizeWindow(void) {  int i, tm,tDiff;  _ChangeInfoText("WM_ResizeWindow()");  GUI_Delay(SPEED);  _LiftUp(30);  for (i = 0; i < 20; i++) {    tm = GUI_GetTime();    WM_ResizeWindow(_hWindow1,  1,  1);    WM_ResizeWindow(_hWindow2, -1, -1);    tDiff = 15 - (GUI_GetTime() - tm);    GUI_Delay(tDiff);  }  for (i = 0; i < 40; i++) {    tm = GUI_GetTime();    WM_ResizeWindow(_hWindow1, -1, -1);    WM_ResizeWindow(_hWindow2,  1,  1);    tDiff = 15 - (GUI_GetTime() - tm);    GUI_Delay(tDiff);  }  for (i = 0; i < 20; i++) {    tm = GUI_GetTime();    WM_ResizeWindow(_hWindow1,  1,  1);    WM_ResizeWindow(_hWindow2, -1, -1);    tDiff = 15 - (GUI_GetTime() - tm);    GUI_Delay(tDiff);  }  _LiftDown(30);  GUI_Delay(SPEED);}/*********************************************************************       _DemoSetCallback  Demonstrates the use of WM_SetCallback*/static void _DemoSetCallback(void) {  _ChangeInfoText("WM_SetCallback()");  GUI_Delay(SPEED);  WM_SetCallback(_hWindow1, _cbDemoCallback1);  WM_InvalidateWindow(_hWindow1);  GUI_Delay(SPEED/2);  WM_SetCallback(_hWindow2, _cbDemoCallback2);  WM_InvalidateWindow(_hWindow2);  GUI_Delay(SPEED*3);  WM_SetCallback(_hWindow1, _cbWindow1);  WM_InvalidateWindow(_hWindow1);  GUI_Delay(SPEED/2);  WM_SetCallback(_hWindow2, _cbWindow2);  WM_InvalidateWindow(_hWindow2);  GUI_Delay(SPEED);}/*********************************************************************       _DemoDeleteWindow  Demonstrates the use of WM_DeleteWindow*/static void _DemoDeleteWindow(void) {  _ChangeInfoText("WM_DeleteWindow()");  GUI_Delay(SPEED);  WM_DeleteWindow(_hWindow2);  GUI_Delay(SPEED/3);  WM_DeleteWindow(_hWindow1);  GUI_Delay(SPEED);  _ChangeInfoText("");  GUI_Delay(SPEED);  /* Restore background callback and window colors */  WM_SetCallback(WM_HBKWIN, _cbBkWindowOld);  _WindowColor1 = GUI_GREEN;  _WindowColor2 = GUI_RED;}/*********************************************************************       MainTask**       Demonstrates the use of the window manager**********************************************************************/void MainTask(void) {  GUI_Init();  GUI_SetBkColor(GUI_BLACK);  WM_SetCreateFlags(WM_CF_MEMDEV);  WM_EnableMemdev(WM_HBKWIN);  while (1) {    _DemoSetDesktopColor();    _DemoCreateWindow();    _DemoCreateWindowAsChild();    _DemoInvalidateWindow();    _DemoBringToTop();    _DemoMoveTo();    _DemoBringToBottom();    _DemoMoveWindow();    _DemoHideShowParent();    _DemoHideShowChild();    _DemoClipping();    _DemoRedrawing();    _DemoResizeWindow();    _DemoSetCallback();    _DemoDeleteWindow();  }}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -