Wnds.cpp
上传用户:dzyhzl
上传日期:2019-04-29
资源大小:56270k
文件大小:18k
源码类别:

模拟服务器

开发平台:

C/C++

  1. /*****************************************************************************************
  2. // 剑侠引擎,界面窗口体系结构的最基本窗口对象
  3. // Copyright : Kingsoft 2002
  4. // Author :   Wooy(Wu yue)
  5. // CreateTime: 2002-7-9
  6. *****************************************************************************************/
  7. #include "KWin32.h"
  8. #include "KEngine.h"
  9. #include "KWin32Wnd.h"
  10. #include "../Elem/WndMessage.h"
  11. #include "Wnds.h"
  12. #include "WndWindow.h"
  13. #include "UiCursor.h"
  14. #include "WndGameSpace.h"
  15. #include "MouseHover.h"
  16. #include "PopupMenu.h"
  17. #include "../UiBase.h"
  18. #include "../ShortcutKey.h"
  19. #include "CommCtrl.h"
  20. int WND_SHOW_MOUSE_OVER_WND = false;
  21. //=================
  22. // 窗口站
  23. //=================
  24. static struct KWndStation
  25. {
  26. KWndWindow LowLayerRoot;
  27. KWndWindow NormalLayerRoot;
  28. KWndWindow TopLayerRoot;
  29. KWndWindow* pFocusWnd;
  30. KWndWindow* pMouseOverWnd;
  31. KWndWindow* pCaptureMouseWnd;
  32. KWndWindow* pExclusiveWnd[4];
  33. KUiCursor Cursor;
  34. SIZE ScreenSize;
  35. struct KDragInfo
  36. {
  37. int bDragging;
  38. KUiDraggedObject DraggedObj;
  39. fnDrawDraggedObj fnDrawObjFnc;
  40. int nDropQeuryRsult;
  41. } DragInfo;
  42. KWndWindow* pGameSpaceWnd;
  43. unsigned char bGameSpaceNotHandleInput;
  44. bool bPaintGameSpace;
  45. KWndStation()
  46. {
  47. pFocusWnd        = NULL;
  48. pMouseOverWnd    = NULL;
  49. pCaptureMouseWnd = NULL;
  50. pExclusiveWnd[0] = NULL;
  51. pExclusiveWnd[1] = NULL;
  52. pExclusiveWnd[2] = NULL;
  53. pExclusiveWnd[3] = NULL;
  54. pGameSpaceWnd  = NULL;
  55. bGameSpaceNotHandleInput = 1;
  56. bPaintGameSpace = false;
  57. LowLayerRoot.Hide();
  58. NormalLayerRoot.Hide();
  59. TopLayerRoot.Hide();
  60. DragInfo.bDragging = false;
  61. DragInfo.DraggedObj.uGenre = 0;
  62. DragInfo.DraggedObj.uId = 0;
  63. ScreenSize.cx = 0;
  64. ScreenSize.cy = 0;
  65. }
  66. } s_WndStation;
  67. static KWndWindow* Wnd_GetActive(int x, int y, bool bBringToTop);
  68. //--------------------------------------------------------------------------
  69. // 功能:清除工作,销毁全部的窗口
  70. //--------------------------------------------------------------------------
  71. void Wnd_Cleanup()
  72. {
  73. Wnd_Heartbeat();
  74. s_WndStation.pFocusWnd = NULL;
  75. s_WndStation.pMouseOverWnd = NULL;
  76. s_WndStation.pCaptureMouseWnd = NULL;
  77. s_WndStation.pExclusiveWnd[0] = NULL;
  78. s_WndStation.pExclusiveWnd[1] = NULL;
  79. s_WndStation.pExclusiveWnd[2] = NULL;
  80. s_WndStation.pExclusiveWnd[3] = NULL;
  81. s_WndStation.pGameSpaceWnd = NULL;
  82. s_WndStation.Cursor.Cleanup();
  83. s_WndStation.DragInfo.bDragging = false;
  84. }
  85. //--------------------------------------------------------------------------
  86. // 功能:绘制窗口
  87. //--------------------------------------------------------------------------
  88. void Wnd_RenderWindows()
  89. {
  90. int bShowCursor = true;
  91. if (s_WndStation.pGameSpaceWnd && s_WndStation.bPaintGameSpace)
  92. s_WndStation.pGameSpaceWnd->Paint();
  93. s_WndStation.LowLayerRoot.Paint();
  94. s_WndStation.NormalLayerRoot.Paint();
  95. s_WndStation.TopLayerRoot.Paint();
  96. if (s_WndStation.DragInfo.bDragging &&
  97. s_WndStation.DragInfo.fnDrawObjFnc)
  98. {
  99. int h, v;
  100. s_WndStation.Cursor.GetPosition(h, v);
  101. if (s_WndStation.DragInfo.fnDrawObjFnc(h, v,
  102. s_WndStation.DragInfo.DraggedObj,
  103. s_WndStation.DragInfo.nDropQeuryRsult) == 0)
  104. bShowCursor = false;
  105. }
  106. KPopupMenu::PaintMenu();
  107. g_MouseOver.PaintMouseHoverInfo();
  108. if (WND_SHOW_MOUSE_OVER_WND && s_WndStation.pMouseOverWnd)
  109. s_WndStation.pMouseOverWnd->PaintDebugInfo();
  110. if (bShowCursor)
  111. s_WndStation.Cursor.Paint();
  112. }
  113. //--------------------------------------------------------------------------
  114. // 功能:让窗口活动
  115. //--------------------------------------------------------------------------
  116. void Wnd_Heartbeat()
  117. {
  118. s_WndStation.LowLayerRoot.LetMeBreathe();
  119. s_WndStation.NormalLayerRoot.LetMeBreathe();
  120. s_WndStation.TopLayerRoot.LetMeBreathe();
  121. if (s_WndStation.pExclusiveWnd[0])
  122. s_WndStation.pExclusiveWnd[0]->BringToTop();
  123. }
  124. //--------------------------------------------------------------------------
  125. // 功能:添加窗口
  126. //--------------------------------------------------------------------------
  127. void Wnd_AddWindow(KWndWindow* pWnd, WND_LAYER_LIST eLayer/* = WL_NORMAL*/)
  128. {
  129. if (eLayer == WL_LOWEST)
  130. s_WndStation.LowLayerRoot.AddBrother(pWnd);
  131. else if (eLayer == WL_TOPMOST)
  132. s_WndStation.TopLayerRoot.AddBrother(pWnd);
  133. else
  134. s_WndStation.NormalLayerRoot.AddBrother(pWnd);
  135. }
  136. //--------------------------------------------------------------------------
  137. // 功能:设置运行游戏窗口
  138. //--------------------------------------------------------------------------
  139. void Wnd_SetGameSpaceWnd(KWndWindow* pWnd)
  140. {
  141. s_WndStation.pGameSpaceWnd = pWnd;
  142. }
  143. void Wnd_GameSpaceHandleInput(bool bHandle)
  144. {
  145. /* if (bHandle)
  146. {
  147. if (s_WndStation.bGameSpaceNotHandleInput)
  148. s_WndStation.bGameSpaceNotHandleInput --;
  149. }
  150. else
  151. s_WndStation.bGameSpaceNotHandleInput ++;
  152. */
  153. s_WndStation.bGameSpaceNotHandleInput = !bHandle;
  154. }
  155. void Wnd_ShowHideGameSpace(bool bShow)
  156. {
  157. s_WndStation.bPaintGameSpace = bShow;
  158. }
  159. //--------------------------------------------------------------------------
  160. // 功能:响应窗口析构
  161. //--------------------------------------------------------------------------
  162. void Wnd_OnWindowDelete(KWndWindow* pWnd)
  163. {
  164. if (pWnd)
  165. {
  166. if (s_WndStation.pMouseOverWnd == pWnd)
  167. s_WndStation.pMouseOverWnd = NULL;
  168. if (s_WndStation.pCaptureMouseWnd == pWnd)
  169. s_WndStation.pCaptureMouseWnd = NULL;
  170. if (s_WndStation.pFocusWnd == pWnd)
  171. s_WndStation.pFocusWnd = NULL;
  172. if (s_WndStation.pExclusiveWnd[0] == pWnd)
  173. {
  174. s_WndStation.pExclusiveWnd[0] = s_WndStation.pExclusiveWnd[1];
  175. s_WndStation.pExclusiveWnd[1] = s_WndStation.pExclusiveWnd[2];
  176. s_WndStation.pExclusiveWnd[2] = s_WndStation.pExclusiveWnd[3];
  177. s_WndStation.pExclusiveWnd[3] = NULL;
  178. }
  179. else if (s_WndStation.pExclusiveWnd[1] == pWnd)
  180. {
  181. s_WndStation.pExclusiveWnd[1] = s_WndStation.pExclusiveWnd[2];
  182. s_WndStation.pExclusiveWnd[2] = s_WndStation.pExclusiveWnd[3];
  183. s_WndStation.pExclusiveWnd[3] = NULL;
  184. }
  185. else if (s_WndStation.pExclusiveWnd[2] == pWnd)
  186. {
  187. s_WndStation.pExclusiveWnd[2] = s_WndStation.pExclusiveWnd[3];
  188. s_WndStation.pExclusiveWnd[3] = NULL;
  189. }
  190. else if (s_WndStation.pExclusiveWnd[3] == pWnd)
  191. s_WndStation.pExclusiveWnd[3] = NULL;
  192. else
  193. KPopupMenu::OnWndDelete(pWnd);
  194. }
  195. }
  196. //--------------------------------------------------------------------------
  197. // 功能:开始拖动物体
  198. //--------------------------------------------------------------------------
  199. int Wnd_DragBegin(const KUiDraggedObject* pObj, fnDrawDraggedObj fnDrawObjFunc)
  200. {
  201. //原来有个对象正在被拖动
  202. if (s_WndStation.DragInfo.bDragging == false && pObj && pObj->uGenre)
  203. {
  204. s_WndStation.DragInfo.DraggedObj = *pObj;
  205. s_WndStation.DragInfo.fnDrawObjFnc = fnDrawObjFunc;
  206. s_WndStation.DragInfo.bDragging = true;
  207. return true;
  208. }
  209. return false;
  210. }
  211. int Wnd_GetDragObj(KUiDraggedObject* pObj)
  212. {
  213. if (pObj)
  214. {
  215. if (s_WndStation.DragInfo.bDragging)
  216. memcpy(pObj, &s_WndStation.DragInfo.DraggedObj, sizeof(KUiDraggedObject));
  217. else
  218. memset(pObj, 0, sizeof(KUiDraggedObject));
  219. }
  220. return s_WndStation.DragInfo.bDragging;
  221. }
  222. //--------------------------------------------------------------------------
  223. // 功能:结束拖动状态
  224. //--------------------------------------------------------------------------
  225. void Wnd_DragFinished()
  226. {
  227. s_WndStation.DragInfo.bDragging = false;
  228. }
  229. //--------------------------------------------------------------------------
  230. // 功能:处理输入
  231. //--------------------------------------------------------------------------
  232. void Wnd_ProcessInput(unsigned int uMsg, unsigned int uParam, int nParam)
  233. {
  234. KWndWindow* pActiveWnd = NULL;
  235. static bool bLastCursorEventProcessedByGameSpace = false;
  236. //====鼠标指针消息====
  237. if ((uMsg >= WM_MOUSEFIRST && uMsg <= WM_MOUSELAST) || uMsg == WM_MOUSEHOVER)
  238. {
  239. int x = 0;
  240. int y = 0;
  241. if (uMsg != WM_MOUSEWHEEL)
  242. {
  243. x = LOWORD(nParam);
  244. y = HIWORD(nParam);
  245. }
  246. else
  247. {
  248. s_WndStation.Cursor.GetPosition(x, y);
  249. }
  250. //====设置鼠标指针图形位置====
  251. s_WndStation.Cursor.SetPosition(x, y);
  252. if (KPopupMenu::HandleInput(uMsg, uParam, nParam))
  253. {
  254. if (bLastCursorEventProcessedByGameSpace)
  255. {
  256. bLastCursorEventProcessedByGameSpace = false;
  257. g_UiBase.SetCurrentCursor();
  258. }
  259. return;
  260. }
  261. g_MouseOver.UpdateCursorPos(x, y);
  262. if (s_WndStation.pCaptureMouseWnd)
  263. pActiveWnd = s_WndStation.pCaptureMouseWnd;
  264. else if (s_WndStation.pExclusiveWnd[0] == NULL)
  265. {
  266. //====取得鼠标所指的最上层窗口面板====
  267. //====让被鼠标点击的窗口成为最上层窗口面板====
  268. if ((uMsg == WM_LBUTTONDOWN || uMsg == WM_RBUTTONDOWN || uMsg == WM_MBUTTONDOWN) &&
  269. s_WndStation.DragInfo.bDragging == 0)
  270. pActiveWnd = Wnd_GetActive(x, y, true);
  271. else
  272. pActiveWnd = Wnd_GetActive(x, y, false);
  273. }
  274. else //有独占窗口时,Active窗口就是它了
  275. pActiveWnd = s_WndStation.pExclusiveWnd[0];
  276. {
  277. KWndWindow* pTopWnd = NULL;
  278. if (pActiveWnd)
  279. pTopWnd = pActiveWnd->TopChildFromPoint(x, y); //只传给位于鼠标指针下方的最上层的窗口
  280. if (pTopWnd != s_WndStation.pMouseOverWnd)
  281. {
  282. g_MouseOver.CancelMouseHoverInfo();
  283. KWndWindow* pOverParent = NULL;
  284. if (s_WndStation.pMouseOverWnd)
  285. {
  286. s_WndStation.pMouseOverWnd->WndProc(WND_M_MOUSE_LEAVE, 0, 0);
  287. pOverParent = s_WndStation.pMouseOverWnd->GetParent();
  288. if (pOverParent)
  289. {
  290. pOverParent->WndProc(WND_N_MOUSE_LEAVE_CHILD,
  291. (unsigned int)s_WndStation.pMouseOverWnd, 0);
  292. }
  293. }
  294. if (pTopWnd)
  295. {
  296. pTopWnd->WndProc(WND_M_MOUSE_ENTER, 0, 0);
  297. pOverParent = pTopWnd->GetParent();
  298. if (pOverParent)
  299. {
  300. pOverParent->WndProc(WND_N_MOUSE_ENTER_CHILD,
  301. (unsigned int)pTopWnd, 0);
  302. }
  303. }
  304. s_WndStation.pMouseOverWnd = pTopWnd;
  305. }
  306. if (s_WndStation.pFocusWnd && pTopWnd != s_WndStation.pFocusWnd &&
  307. (uMsg == WM_LBUTTONDOWN || uMsg == WM_RBUTTONDOWN || uMsg == WM_MBUTTONDOWN))
  308. {
  309. Wnd_SetFocusWnd(NULL);
  310. }
  311. }
  312. bool bPrecessedByGameSpace = false;
  313. if (s_WndStation.pMouseOverWnd)
  314. s_WndStation.pMouseOverWnd->WndProc(uMsg, uParam, nParam);
  315. else if (s_WndStation.pCaptureMouseWnd)
  316. s_WndStation.pCaptureMouseWnd->WndProc(uMsg, uParam, nParam);
  317. else if (s_WndStation.pExclusiveWnd[0] == NULL &&
  318. s_WndStation.bGameSpaceNotHandleInput == false && s_WndStation.pGameSpaceWnd)
  319. {
  320. s_WndStation.pGameSpaceWnd->WndProc(uMsg, uParam, nParam);
  321. bLastCursorEventProcessedByGameSpace = true;
  322. bPrecessedByGameSpace = true;
  323. }
  324. if (bPrecessedByGameSpace == false && bLastCursorEventProcessedByGameSpace)
  325. {
  326. bLastCursorEventProcessedByGameSpace = false;
  327. g_UiBase.SetCurrentCursor();
  328. }
  329. }
  330. else
  331. {//====处理其他消息(其实都是键盘输入消息)====
  332. if (KPopupMenu::HandleInput(uMsg, uParam, nParam))
  333. return;
  334. if (s_WndStation.pFocusWnd && s_WndStation.pFocusWnd->WndProc(uMsg, uParam, nParam))
  335. return;
  336. if (s_WndStation.pExclusiveWnd[0])
  337. {
  338. s_WndStation.pExclusiveWnd[0]->WndProc(uMsg, uParam, nParam);
  339. return;
  340. }
  341. if (uMsg == WM_KEYDOWN || (uMsg == WM_KEYUP && uParam == VK_SNAPSHOT))
  342. {
  343. int nModifier = 0;
  344. if (GetKeyState(VK_CONTROL) & 0x8000)
  345. nModifier |= HOTKEYF_CONTROL;
  346. if (GetKeyState(VK_SHIFT) & 0x8000)
  347. nModifier |= HOTKEYF_SHIFT;
  348. if (GetKeyState(VK_MENU) & 0x8000)
  349. nModifier |= HOTKEYF_ALT;
  350. if (KShortcutKeyCentre::HandleKeyInput(uParam, nModifier))
  351. return;
  352. }
  353. else if (uMsg == WM_SYSKEYDOWN)
  354. {
  355. int nModifier = 0;
  356. if (GetKeyState(VK_CONTROL) & 0x8000)
  357. nModifier |= HOTKEYF_CONTROL;
  358. if (GetKeyState(VK_SHIFT) & 0x8000)
  359. nModifier |= HOTKEYF_SHIFT;
  360. if (GetKeyState(VK_MENU) & 0x8000)
  361. nModifier |= HOTKEYF_ALT;
  362. if (KShortcutKeyCentre::HandleKeyInput(uParam, nModifier))
  363. return;
  364. }
  365. int bHandle = false;
  366. for (int i = 0; i < 3 && bHandle == false; i++)
  367. {
  368. if (i == 0)
  369. pActiveWnd = s_WndStation.TopLayerRoot.GetNextWnd();
  370. else if (i == 1)
  371. pActiveWnd = s_WndStation.NormalLayerRoot.GetNextWnd();
  372. else
  373. pActiveWnd = s_WndStation.LowLayerRoot.GetNextWnd();
  374. while(pActiveWnd)
  375. {
  376. KWndWindow* pNextWnd = pActiveWnd->GetNextWnd();
  377. if (pActiveWnd->IsVisible() &&
  378. pActiveWnd->WndProc(uMsg, uParam, nParam))
  379. {
  380. bHandle = true;
  381. break;
  382. }
  383. pActiveWnd = pNextWnd;
  384. }
  385. }
  386. if (bHandle == false && s_WndStation.pGameSpaceWnd &&
  387. s_WndStation.bGameSpaceNotHandleInput == false)
  388. {
  389. s_WndStation.pGameSpaceWnd->WndProc(uMsg, uParam, nParam);
  390. }
  391. }
  392. }
  393. void Wnd_TransmitInputToGameSpace(unsigned int uMsg, unsigned int uParam, int nParam)
  394. {
  395. s_WndStation.pGameSpaceWnd->WndProc(uMsg, uParam, nParam);
  396. }
  397. //--------------------------------------------------------------------------
  398. // 功能:把处于某个位置的窗口带到最上层
  399. // 返回:最上层窗口的指针
  400. //--------------------------------------------------------------------------
  401. KWndWindow* Wnd_GetActive(int x, int y, bool bBringToTop)
  402. {
  403. KWndWindow* pActive = NULL;
  404. for (int i = 0; i < 3; i++)
  405. {
  406. KWndWindow* pWnd = NULL;
  407. if (i == 0)
  408. pWnd = &s_WndStation.TopLayerRoot;
  409. else if (i == 1)
  410. pWnd = &s_WndStation.NormalLayerRoot;
  411. else
  412. pWnd = &s_WndStation.LowLayerRoot;
  413. while(pWnd = pWnd->GetNextWnd())
  414. {
  415. if (pWnd->IsVisible())
  416. pActive = pWnd;
  417. }
  418. while(pActive)
  419. {
  420. if (pActive->PtInWindow(x, y))
  421. {
  422. if (i == 1 && bBringToTop)
  423. pActive->BringToTop();
  424. break;
  425. }
  426. pActive = pActive->GetPreWnd();
  427. }
  428. if (pActive)
  429. break;
  430. }
  431. return pActive;
  432. }
  433. //改变鼠标指针显示状态
  434. void Wnd_ShowCursor(int bShow)
  435. {
  436. s_WndStation.Cursor.Show(bShow);
  437. }
  438. //--------------------------------------------------------------------------
  439. // 功能:设置鼠标指针位置
  440. //--------------------------------------------------------------------------
  441. void Wnd_SetCursorPos(int x, int y)
  442. {
  443. s_WndStation.Cursor.SetPosition(x, y);
  444. HWND hWnd = g_GetMainHWnd();
  445. POINT Pos;
  446. Pos.x = x;
  447. Pos.y = y;
  448. ::ClientToScreen(hWnd, &Pos);
  449. ::SetCursorPos(Pos.x, Pos.y);
  450. }
  451. //--------------------------------------------------------------------------
  452. // 功能:获取鼠标指针位置
  453. //--------------------------------------------------------------------------
  454. void Wnd_GetCursorPos(int* px, int* py)
  455. {
  456. int h, v;
  457. s_WndStation.Cursor.GetPosition(h, v);
  458. if (px)
  459. *px = h;
  460. if (py)
  461. *py = v;
  462. }
  463. //--------------------------------------------------------------------------
  464. // 功能:获取当前挂接的输入焦点窗口
  465. //--------------------------------------------------------------------------
  466. KWndWindow* Wnd_GetFocusWnd()
  467. {
  468. return s_WndStation.pFocusWnd;
  469. }
  470. //--------------------------------------------------------------------------
  471. // 功能:挂接输入焦点窗口
  472. //--------------------------------------------------------------------------
  473. void Wnd_SetFocusWnd(KWndWindow* pWnd)
  474. {
  475. if (s_WndStation.pFocusWnd != pWnd)
  476. {
  477. if (s_WndStation.pFocusWnd)
  478. s_WndStation.pFocusWnd->WndProc(WND_M_KILL_FOCUS, (unsigned int)pWnd, 0);
  479. if (pWnd)
  480. pWnd->WndProc(WND_M_SET_FOCUS, (unsigned int)s_WndStation.pFocusWnd, 0);
  481. s_WndStation.pFocusWnd = pWnd;
  482. }
  483. }
  484. //--------------------------------------------------------------------------
  485. // 功能:设置跟踪鼠标动作窗口
  486. //--------------------------------------------------------------------------
  487. void Wnd_SetCapture(KWndWindow* pWnd)
  488. {
  489. if (s_WndStation.pCaptureMouseWnd != pWnd)
  490. {
  491. Wnd_ReleaseCapture();
  492. s_WndStation.pCaptureMouseWnd = pWnd;
  493. }
  494. }
  495. //--------------------------------------------------------------------------
  496. // 功能:释放窗口对鼠标动作的跟踪
  497. //--------------------------------------------------------------------------
  498. void Wnd_ReleaseCapture()
  499. {
  500. if (s_WndStation.pCaptureMouseWnd)
  501. {
  502. s_WndStation.pCaptureMouseWnd->WndProc(WND_M_CAPTURECHANGED, 0, 0);
  503. s_WndStation.pCaptureMouseWnd = NULL;
  504. }
  505. }
  506. //--------------------------------------------------------------------------
  507. // 功能:设置独占窗口
  508. //--------------------------------------------------------------------------
  509. void Wnd_SetExclusive(KWndWindow* pWnd)
  510. {
  511. int i;
  512. if (pWnd)
  513. {
  514. if (s_WndStation.pFocusWnd && s_WndStation.pFocusWnd->GetOwner() != pWnd->GetOwner())
  515. Wnd_SetFocusWnd(NULL);
  516. for (i = 0; i < 4; i++)
  517. {
  518. if (s_WndStation.pExclusiveWnd[i] == pWnd)
  519. {
  520. for (int j = i; j > 0; j--)
  521. s_WndStation.pExclusiveWnd[j] = s_WndStation.pExclusiveWnd[j - 1];
  522. s_WndStation.pExclusiveWnd[0] = pWnd;
  523. return;
  524. }
  525. }
  526. s_WndStation.pExclusiveWnd[3] = s_WndStation.pExclusiveWnd[2];
  527. s_WndStation.pExclusiveWnd[2] = s_WndStation.pExclusiveWnd[1];
  528. s_WndStation.pExclusiveWnd[1] = s_WndStation.pExclusiveWnd[0];
  529. s_WndStation.pExclusiveWnd[0] = pWnd;
  530. }
  531. }
  532. //--------------------------------------------------------------------------
  533. // 功能:取消独占窗口
  534. //--------------------------------------------------------------------------
  535. void Wnd_ReleaseExclusive(KWndWindow* pWnd)
  536. {
  537. if (pWnd)
  538. {
  539. for (int i = 0; i < 4; i++)
  540. {
  541. if (s_WndStation.pExclusiveWnd[i] == pWnd)
  542. {
  543. for (int j = i; j < 3; j++)
  544. s_WndStation.pExclusiveWnd[j] = s_WndStation.pExclusiveWnd[j + 1];
  545. s_WndStation.pExclusiveWnd[3] = NULL;
  546. }
  547. }
  548. }
  549. }
  550. //--------------------------------------------------------------------------
  551. // 功能:载入鼠标指针资源
  552. //--------------------------------------------------------------------------
  553. void Wnd_LoadCursor(int nIndex, const char* pImgFile)
  554. {
  555. s_WndStation.Cursor.SetImage(nIndex, pImgFile);
  556. }
  557. //--------------------------------------------------------------------------
  558. // 功能:切换当前鼠标指针图形
  559. //--------------------------------------------------------------------------
  560. int Wnd_SwitchCursor(int nIndex)
  561. {
  562. return s_WndStation.Cursor.SwitchImage(nIndex);
  563. }
  564. //设置屏幕范围大小
  565. void Wnd_SetScreenSize(int nWidth, int nHeight)
  566. {
  567. s_WndStation.ScreenSize.cx = nWidth;
  568. s_WndStation.ScreenSize.cy = nHeight;
  569. }
  570. //获取屏幕范围大小
  571. void Wnd_GetScreenSize(int& nWidth, int& nHeight)
  572. {
  573. nWidth = s_WndStation.ScreenSize.cx;
  574. nHeight = s_WndStation.ScreenSize.cy;
  575. }
  576. //还原鼠标图形
  577. void Wnd_RestoreCursor()
  578. {
  579. s_WndStation.Cursor.RestoreCursor();
  580. }