dialogbase.cpp 35 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640
  1. /*
  2. ** Command & Conquer Renegade(tm)
  3. ** Copyright 2025 Electronic Arts Inc.
  4. **
  5. ** This program is free software: you can redistribute it and/or modify
  6. ** it under the terms of the GNU General Public License as published by
  7. ** the Free Software Foundation, either version 3 of the License, or
  8. ** (at your option) any later version.
  9. **
  10. ** This program is distributed in the hope that it will be useful,
  11. ** but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  13. ** GNU General Public License for more details.
  14. **
  15. ** You should have received a copy of the GNU General Public License
  16. ** along with this program. If not, see <http://www.gnu.org/licenses/>.
  17. */
  18. /***********************************************************************************************
  19. *** C O N F I D E N T I A L --- W E S T W O O D S T U D I O S ***
  20. ***********************************************************************************************
  21. * *
  22. * Project Name : Combat *
  23. * *
  24. * $Archive:: /Commando/Code/wwui/dialogbase.cpp $*
  25. * *
  26. * Author:: Patrick Smith *
  27. * *
  28. * $Modtime:: 1/09/02 5:48p $*
  29. * *
  30. * $Revision:: 38 $*
  31. * *
  32. *---------------------------------------------------------------------------------------------*
  33. * Functions: *
  34. * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
  35. #include "dialogbase.h"
  36. #include "dialogparser.h"
  37. #include "dialogcontrol.h"
  38. #include "buttonctrl.h"
  39. #include "dialogtext.h"
  40. #include "editctrl.h"
  41. #include "dialogmgr.h"
  42. #include "ww3d.h"
  43. #include "vector4.h"
  44. #include "assetmgr.h"
  45. #include "texture.h"
  46. #include "mousemgr.h"
  47. #include "comboboxctrl.h"
  48. #include "checkboxctrl.h"
  49. #include "sliderctrl.h"
  50. #include "scrollbarctrl.h"
  51. #include "menuentryctrl.h"
  52. #include "tabctrl.h"
  53. #include "listctrl.h"
  54. #include "childdialog.h"
  55. #include "mapctrl.h"
  56. #include "viewerctrl.h"
  57. #include "inputctrl.h"
  58. #include "shortcutbarctrl.h"
  59. #include "merchandisectrl.h"
  60. #include "imagectrl.h"
  61. #include "multilinetextctrl.h"
  62. #include "treectrl.h"
  63. #include "textmarqueectrl.h"
  64. #include "ProgressCtrl.h"
  65. #include "healthbarctrl.h"
  66. #include "systimer.h"
  67. #define DIRECTINPUT_VERSION 0x0800
  68. #include <dinput.h>
  69. ////////////////////////////////////////////////////////////////
  70. // Constants
  71. ////////////////////////////////////////////////////////////////
  72. const float RES_SCREEN_WIDTH = 400;
  73. const float RES_SCREEN_HEIGHT = 300;
  74. ////////////////////////////////////////////////////////////////
  75. // Static member initialization
  76. ////////////////////////////////////////////////////////////////
  77. DEFAULT_DLG_CMD_HANDLER DialogBaseClass::DefaultCmdHandler = NULL;
  78. ////////////////////////////////////////////////////////////////
  79. //
  80. // DialogBaseClass
  81. //
  82. ////////////////////////////////////////////////////////////////
  83. DialogBaseClass::DialogBaseClass (int res_id) :
  84. DialogResID (res_id),
  85. AreControlsHidden (false),
  86. LastFocusControl (NULL),
  87. LastMouseClickTime (0),
  88. IsVisible (true),
  89. IsRunning (false)
  90. {
  91. return ;
  92. }
  93. ////////////////////////////////////////////////////////////////
  94. //
  95. // ~DialogBaseClass
  96. //
  97. ////////////////////////////////////////////////////////////////
  98. DialogBaseClass::~DialogBaseClass (void)
  99. {
  100. Free_Controls ();
  101. return ;
  102. }
  103. ////////////////////////////////////////////////////////////////
  104. //
  105. // Start_Dialog
  106. //
  107. ////////////////////////////////////////////////////////////////
  108. void
  109. DialogBaseClass::Start_Dialog (void)
  110. {
  111. int dlg_width = 0;
  112. int dlg_height = 0;
  113. DynamicVectorClass<ControlDefinitionStruct> control_list;
  114. //
  115. // Get all the information about the dialog that we'll need to create
  116. // the dialog and its controls.
  117. //
  118. DialogParserClass::Parse_Template (DialogResID, &dlg_width, &dlg_height,
  119. &Title, &control_list);
  120. //
  121. // Convert the dialog's width and height from dialog units to screen units
  122. //
  123. const RectClass &screen_rect = Render2DClass::Get_Screen_Resolution ();
  124. int dlg_screen_width = int(((float)dlg_width / RES_SCREEN_WIDTH) * screen_rect.Width ());
  125. int dlg_screen_height = int(((float)dlg_height / RES_SCREEN_HEIGHT) * screen_rect.Height ());
  126. //
  127. // Center the dialog on the screen
  128. //
  129. Rect.Left = int(screen_rect.Center ().X - ((float)dlg_screen_width * 0.5F));
  130. Rect.Top = int(screen_rect.Center ().Y - ((float)dlg_screen_height * 0.5F));
  131. Rect.Right = int(Rect.Left + dlg_screen_width);
  132. Rect.Bottom = int(Rect.Top + dlg_screen_height);
  133. //
  134. // Now create the controls
  135. //
  136. for (int index = 0; index < control_list.Count (); index ++) {
  137. ControlDefinitionStruct &info = control_list[index];
  138. DialogControlClass *control = NULL;
  139. switch (info.type)
  140. {
  141. case BUTTON:
  142. if ( (info.style & 0xF) == BS_CHECKBOX ||
  143. (info.style & 0xF) == BS_AUTOCHECKBOX)
  144. {
  145. control = new CheckBoxCtrlClass;
  146. } else if (info.style & BS_FLAT) {
  147. control = new MenuEntryCtrlClass;
  148. } else {
  149. control = new ButtonCtrlClass;
  150. }
  151. break;
  152. case STATIC:
  153. if ((info.style & 0xF) == SS_BITMAP) {
  154. control = new ImageCtrlClass;
  155. } else {
  156. control = new DialogTextClass;
  157. }
  158. break;
  159. case EDIT:
  160. if (info.style & ES_MULTILINE) {
  161. if (info.style & ES_AUTOVSCROLL) {
  162. control = new TextMarqueeCtrlClass;
  163. } else {
  164. control = new MultiLineTextCtrlClass;
  165. }
  166. } else {
  167. control = new EditCtrlClass;
  168. }
  169. break;
  170. case COMBOBOX:
  171. control = new ComboBoxCtrlClass;
  172. break;
  173. case SLIDER:
  174. control = new SliderCtrlClass;
  175. break;
  176. case SCROLL_BAR:
  177. control = new ScrollBarCtrlClass;
  178. break;
  179. case TAB:
  180. control = new TabCtrlClass;
  181. break;
  182. case LIST_CTRL:
  183. control = new ListCtrlClass;
  184. break;
  185. case TREE_CTRL:
  186. control = new TreeCtrlClass;
  187. break;
  188. case MAP:
  189. control = new MapCtrlClass;
  190. break;
  191. case VIEWER:
  192. control = new ViewerCtrlClass;
  193. break;
  194. case HOTKEY:
  195. control = new InputCtrlClass;
  196. break;
  197. case SHORTCUT_BAR:
  198. control = new ShortcutBarCtrlClass;
  199. break;
  200. case MERCHANDISE_CTRL:
  201. control = new MerchandiseCtrlClass;
  202. break;
  203. case PROGRESS_BAR:
  204. control = new ProgressCtrlClass;
  205. break;
  206. case HEALTH_BAR:
  207. control = new HealthBarCtrlClass;
  208. break;
  209. }
  210. //
  211. // Add the control to the list (if necessary)
  212. //
  213. if (control != NULL) {
  214. //
  215. // Set the generic control information
  216. //
  217. control->Set_Parent (this);
  218. control->Set_Text (info.title);
  219. control->Set_Style (info.style);
  220. control->Set_ID (info.id);
  221. int ctrl_width = int((((float)info.cx) / RES_SCREEN_WIDTH) * screen_rect.Width ());
  222. int ctrl_height = int((((float)info.cy) / RES_SCREEN_HEIGHT) * screen_rect.Height ());
  223. //
  224. // Calculate the screen position of the control
  225. //
  226. RectClass rect;
  227. rect.Left = int(Rect.Left + ((((float)info.x) / RES_SCREEN_WIDTH) * screen_rect.Width ()));
  228. rect.Top = int(Rect.Top + ((((float)info.y) / RES_SCREEN_HEIGHT) * screen_rect.Height ()));
  229. rect.Right = int(rect.Left + ctrl_width);
  230. rect.Bottom = int(rect.Top + ctrl_height);
  231. control->Set_Window_Rect (rect);
  232. //
  233. // Let the control know its been created
  234. //
  235. control->On_Create ();
  236. ControlList.Add (control);
  237. //
  238. // Apply the disabled style (if necessary)
  239. //
  240. if (info.style & WS_DISABLED) {
  241. control->Enable (false);
  242. }
  243. }
  244. }
  245. DialogMgrClass::Register_Dialog (this);
  246. IsRunning = true;
  247. DialogEvent dlgEvent(DialogEvent::STARTED, this);
  248. NotifyObservers(dlgEvent);
  249. //
  250. // Allow derived clases to hook into this call
  251. //
  252. On_Init_Dialog ();
  253. return ;
  254. }
  255. ////////////////////////////////////////////////////////////////
  256. //
  257. // End_Dialog
  258. //
  259. ////////////////////////////////////////////////////////////////
  260. void
  261. DialogBaseClass::End_Dialog (void)
  262. {
  263. DialogEvent dlgEvent(DialogEvent::DESTROY, this);
  264. NotifyObservers(dlgEvent);
  265. On_Destroy ();
  266. //
  267. // Noitify all controls
  268. //
  269. for (int index = 0; index < ControlList.Count (); index ++) {
  270. ControlList[index]->On_Destroy ();
  271. }
  272. //
  273. // Release all child dialogs
  274. //
  275. for (index = 0; index < ChildDialogList.Count (); index ++) {
  276. ChildDialogList[index]->End_Dialog ();
  277. ChildDialogList[index]->Set_Parent_Dialog (NULL);
  278. ChildDialogList[index]->Release_Ref ();
  279. }
  280. //
  281. // Free the dialog list
  282. //
  283. ChildDialogList.Delete_All ();
  284. IsRunning = false;
  285. DialogMgrClass::UnRegister_Dialog (this);
  286. return ;
  287. }
  288. ////////////////////////////////////////////////////////////////
  289. //
  290. // On_Frame_Update
  291. //
  292. ////////////////////////////////////////////////////////////////
  293. void
  294. DialogBaseClass::On_Frame_Update (void)
  295. {
  296. Add_Ref ();
  297. if (AreControlsHidden == false) {
  298. //
  299. // Only take input from the mouse or keyboard if this is the
  300. // currently active dialog.
  301. //
  302. if (Is_Active ()) {
  303. Update_Mouse_State ();
  304. }
  305. //
  306. // Let each control "think"
  307. //
  308. for (int index = 0; index < ControlList.Count (); index ++) {
  309. ControlList[index]->On_Frame_Update ();
  310. }
  311. //
  312. // Let each control "think"
  313. //
  314. for (index = 0; index < ChildDialogList.Count (); index ++) {
  315. ChildDialogList[index]->On_Frame_Update ();
  316. }
  317. }
  318. Release_Ref ();
  319. return ;
  320. }
  321. ////////////////////////////////////////////////////////////////
  322. //
  323. // Render
  324. //
  325. ////////////////////////////////////////////////////////////////
  326. void
  327. DialogBaseClass::Render (void)
  328. {
  329. Add_Ref ();
  330. //
  331. // Render each control
  332. //
  333. if (AreControlsHidden == false) {
  334. for (int index = 0; index < ControlList.Count (); index ++) {
  335. if (ControlList[index]->Is_Visible ()) {
  336. ControlList[index]->Render ();
  337. }
  338. }
  339. //
  340. // Render each child - dialog
  341. //
  342. for (index = 0; index < ChildDialogList.Count (); index ++) {
  343. if (ChildDialogList[index]->Is_Visible ()) {
  344. ChildDialogList[index]->Render ();
  345. }
  346. }
  347. }
  348. Release_Ref ();
  349. return ;
  350. }
  351. ////////////////////////////////////////////////////////////////
  352. //
  353. // Enable_Dlg_Item
  354. //
  355. ////////////////////////////////////////////////////////////////
  356. void
  357. DialogBaseClass::Enable_Dlg_Item (int id, bool onoff)
  358. {
  359. //
  360. // Find the control
  361. //
  362. DialogControlClass *control = Get_Dlg_Item (id);
  363. if (control != NULL) {
  364. //
  365. // Change the enable state of hte control
  366. //
  367. control->Enable (onoff);
  368. }
  369. return ;
  370. }
  371. ////////////////////////////////////////////////////////////////
  372. //
  373. // Is_Dlg_Item_Enabled
  374. //
  375. ////////////////////////////////////////////////////////////////
  376. bool
  377. DialogBaseClass::Is_Dlg_Item_Enabled (int id)
  378. {
  379. bool retval = false;
  380. //
  381. // Find the control
  382. //
  383. DialogControlClass *control = Get_Dlg_Item (id);
  384. if (control != NULL) {
  385. //
  386. // Return the state of the control to the caller
  387. //
  388. retval = control->Is_Enabled ();
  389. }
  390. return retval;
  391. }
  392. ////////////////////////////////////////////////////////////////
  393. //
  394. // Get_Dlg_Item
  395. //
  396. ////////////////////////////////////////////////////////////////
  397. DialogControlClass *
  398. DialogBaseClass::Get_Dlg_Item (int id) const
  399. {
  400. DialogControlClass *retval = NULL;
  401. //
  402. // Simply loop over all the controls in our list until we
  403. // find one with the matching ID.
  404. //
  405. for (int index = 0; index < ControlList.Count (); index ++) {
  406. if (id == ControlList[index]->Get_ID ()) {
  407. retval = ControlList[index];
  408. break;
  409. }
  410. }
  411. return retval;
  412. }
  413. ////////////////////////////////////////////////////////////////
  414. //
  415. // Get_Dlg_Item_Text
  416. //
  417. ////////////////////////////////////////////////////////////////
  418. const WCHAR *
  419. DialogBaseClass::Get_Dlg_Item_Text (int id) const
  420. {
  421. const WCHAR *retval = NULL;
  422. //
  423. // Find the control
  424. //
  425. DialogControlClass *control = Get_Dlg_Item (id);
  426. if (control != NULL) {
  427. //
  428. // Return the control's text to the caller
  429. //
  430. retval = control->Get_Text ();
  431. }
  432. return retval;
  433. }
  434. ////////////////////////////////////////////////////////////////
  435. //
  436. // Set_Dlg_Item_Text
  437. //
  438. ////////////////////////////////////////////////////////////////
  439. void
  440. DialogBaseClass::Set_Dlg_Item_Text (int id, const WCHAR *text)
  441. {
  442. //
  443. // Find the control
  444. //
  445. DialogControlClass *control = Get_Dlg_Item (id);
  446. if (control != NULL) {
  447. //
  448. // Set the text of this control
  449. //
  450. control->Set_Text (text);
  451. }
  452. return ;
  453. }
  454. ////////////////////////////////////////////////////////////////
  455. //
  456. // Get_Dlg_Item_Int
  457. //
  458. ////////////////////////////////////////////////////////////////
  459. int
  460. DialogBaseClass::Get_Dlg_Item_Int (int id) const
  461. {
  462. int retval = 0;
  463. //
  464. // Find the control
  465. //
  466. DialogControlClass *control = Get_Dlg_Item (id);
  467. if (control != NULL) {
  468. //
  469. // Get the text from the control
  470. //
  471. const WCHAR *text = control->Get_Text ();
  472. //
  473. // Convert the text to an integer
  474. //
  475. retval = _wtoi (text);
  476. }
  477. return retval;
  478. }
  479. ////////////////////////////////////////////////////////////////
  480. //
  481. // Set_Dlg_Item_Int
  482. //
  483. ////////////////////////////////////////////////////////////////
  484. void
  485. DialogBaseClass::Set_Dlg_Item_Int (int id, int value)
  486. {
  487. //
  488. // Find the control
  489. //
  490. DialogControlClass *control = Get_Dlg_Item (id);
  491. if (control != NULL) {
  492. //
  493. // Convert the value to a string
  494. //
  495. WideStringClass text;
  496. text.Format (L"%d", value);
  497. //
  498. // Set the text of this control
  499. //
  500. control->Set_Text (text);
  501. }
  502. return ;
  503. }
  504. ////////////////////////////////////////////////////////////////
  505. //
  506. // Get_Dlg_Item_Float
  507. //
  508. ////////////////////////////////////////////////////////////////
  509. float
  510. DialogBaseClass::Get_Dlg_Item_Float (int id) const
  511. {
  512. float retval = 0;
  513. //
  514. // Find the control
  515. //
  516. DialogControlClass *control = Get_Dlg_Item (id);
  517. if (control != NULL) {
  518. //
  519. // Get the text from the control
  520. //
  521. const WCHAR *text = control->Get_Text ();
  522. //
  523. // Convert the text to an float
  524. //
  525. swscanf (text, L"%f", &retval);
  526. }
  527. return retval;
  528. }
  529. ////////////////////////////////////////////////////////////////
  530. //
  531. // Set_Dlg_Item_Float
  532. //
  533. ////////////////////////////////////////////////////////////////
  534. void
  535. DialogBaseClass::Set_Dlg_Item_Float (int id, float value)
  536. {
  537. //
  538. // Find the control
  539. //
  540. DialogControlClass *control = Get_Dlg_Item (id);
  541. if (control != NULL) {
  542. //
  543. // Convert the value to a string
  544. //
  545. WideStringClass text;
  546. text.Format (L"%.2f", value);
  547. //
  548. // Set the text of this control
  549. //
  550. control->Set_Text (text);
  551. }
  552. return ;
  553. }
  554. ////////////////////////////////////////////////////////////////
  555. //
  556. // Check_Dlg_Button
  557. //
  558. ////////////////////////////////////////////////////////////////
  559. void
  560. DialogBaseClass::Check_Dlg_Button (int id, bool onoff)
  561. {
  562. //
  563. // Find the control
  564. //
  565. DialogControlClass *control = Get_Dlg_Item (id);
  566. if (control != NULL && control->As_CheckBoxCtrlClass () != NULL) {
  567. //
  568. // Set the check state of this control
  569. //
  570. control->As_CheckBoxCtrlClass ()->Set_Check (onoff);
  571. }
  572. return ;
  573. }
  574. ////////////////////////////////////////////////////////////////
  575. //
  576. // Is_Dlg_Button_Checked
  577. //
  578. ////////////////////////////////////////////////////////////////
  579. bool
  580. DialogBaseClass::Is_Dlg_Button_Checked (int id) const
  581. {
  582. bool retval = false;
  583. //
  584. // Find the control
  585. //
  586. DialogControlClass *control = Get_Dlg_Item (id);
  587. if (control != NULL && control->As_CheckBoxCtrlClass () != NULL) {
  588. //
  589. // Return the check state of this control to the caller
  590. //
  591. retval = control->As_CheckBoxCtrlClass ()->Get_Check ();
  592. }
  593. return retval;
  594. }
  595. ////////////////////////////////////////////////////////////////
  596. //
  597. // Free_Controls
  598. //
  599. ////////////////////////////////////////////////////////////////
  600. void
  601. DialogBaseClass::Free_Controls (void)
  602. {
  603. for (int index = 0; index < ControlList.Count (); index ++) {
  604. if (ControlList[index]->Is_Embedded () == false) {
  605. delete ControlList[index];
  606. }
  607. }
  608. ControlList.Delete_All ();
  609. //
  610. // Reset our pointers
  611. //
  612. //FocusControl = NULL;
  613. LastFocusControl = NULL;
  614. return ;
  615. }
  616. ////////////////////////////////////////////////////////////////
  617. //
  618. // Send_Mouse_Input
  619. //
  620. ////////////////////////////////////////////////////////////////
  621. void
  622. DialogBaseClass::Send_Mouse_Input (DialogControlClass *control, const Vector2 &mouse_pos)
  623. {
  624. //
  625. // Check to see if the mouse is moving or not
  626. //
  627. const Vector3 &last_mouse_pos = DialogMgrClass::Get_Last_Mouse_Pos ();
  628. if (last_mouse_pos.X != mouse_pos.X || last_mouse_pos.Y != mouse_pos.Y) {
  629. control->On_Mouse_Move (mouse_pos);
  630. }
  631. //
  632. // Let the control change the mouse cursor
  633. //
  634. control->On_Set_Cursor (mouse_pos);
  635. //
  636. // Notify the control on button down or up
  637. //
  638. if (DialogMgrClass::Is_Button_Down (VK_LBUTTON) != DialogMgrClass::Was_Button_Down (VK_LBUTTON)) {
  639. if (DialogMgrClass::Is_Button_Down (VK_LBUTTON)) {
  640. int curr_time = TIMEGETTIME ();
  641. //
  642. // Did we just get a double-click?
  643. //
  644. if ((curr_time - LastMouseClickTime) < 300) {
  645. control->On_LButton_DblClk (mouse_pos);
  646. } else {
  647. control->On_LButton_Down (mouse_pos);
  648. }
  649. LastMouseClickTime = TIMEGETTIME ();
  650. } else {
  651. //
  652. // Notify the control
  653. //
  654. control->On_LButton_Up (mouse_pos);
  655. }
  656. }
  657. //
  658. // Notify the control on button down or up
  659. //
  660. if (DialogMgrClass::Is_Button_Down (VK_RBUTTON) != DialogMgrClass::Was_Button_Down (VK_RBUTTON)) {
  661. if (DialogMgrClass::Is_Button_Down (VK_RBUTTON)) {
  662. control->On_RButton_Down (mouse_pos);
  663. } else {
  664. control->On_RButton_Up (mouse_pos);
  665. }
  666. }
  667. //
  668. // Notify the control on button down or up
  669. //
  670. if (DialogMgrClass::Is_Button_Down (VK_MBUTTON) != DialogMgrClass::Was_Button_Down (VK_MBUTTON)) {
  671. if (DialogMgrClass::Is_Button_Down (VK_MBUTTON)) {
  672. control->On_MButton_Down (mouse_pos);
  673. } else {
  674. control->On_MButton_Up (mouse_pos);
  675. }
  676. }
  677. return;
  678. }
  679. ////////////////////////////////////////////////////////////////
  680. //
  681. // Update_Mouse_State
  682. //
  683. ////////////////////////////////////////////////////////////////
  684. void
  685. DialogBaseClass::Update_Mouse_State (void)
  686. {
  687. //
  688. // Get the cursor's position
  689. //
  690. Vector3 cursor_pos = DialogMgrClass::Get_Mouse_Pos ();
  691. Vector2 screen_pos (cursor_pos.X, cursor_pos.Y);
  692. DialogControlClass *current_control = NULL;
  693. //
  694. // Build a complete list of controls
  695. //
  696. CONTROL_LIST control_list;
  697. Build_Control_List (control_list);
  698. //
  699. // Loop over all the controls on the dialog
  700. //
  701. bool mouse_over_control = false;
  702. for (int index = control_list.Count () - 1; index >= 0; index --) {
  703. const RectClass &rect = control_list[index]->Get_Window_Rect ();
  704. //
  705. // Is the mouse point inside this control?
  706. //
  707. if (rect.Contains (screen_pos)) {
  708. //
  709. // Check for "focus" change
  710. //
  711. if (DialogMgrClass::Is_Button_Down (VK_LBUTTON) != DialogMgrClass::Was_Button_Down (VK_LBUTTON)) {
  712. if (DialogMgrClass::Is_Button_Down (VK_LBUTTON)) {
  713. //
  714. // Handle the focus change (if necessary)
  715. //
  716. if ( control_list[index]->Wants_Focus () &&
  717. control_list[index]->Is_Enabled ())
  718. {
  719. DialogMgrClass::Set_Focus (control_list[index]);
  720. }
  721. }
  722. }
  723. current_control = control_list[index];
  724. mouse_over_control = true;
  725. break;
  726. }
  727. }
  728. DialogControlClass *input_capture = DialogMgrClass::Get_Capture ();
  729. DialogControlClass *control = input_capture ? input_capture : current_control;
  730. if (control != NULL && control->Is_Enabled () && control->Is_Visible ()) {
  731. //
  732. // Send mouse input to the control
  733. //
  734. Send_Mouse_Input (control, screen_pos);
  735. } else {
  736. //
  737. // Reset the mouse cursor to an arrow if no control changed it...
  738. //
  739. MouseMgrClass::Set_Cursor (MouseMgrClass::CURSOR_ARROW);
  740. //
  741. // If the user clicked in empty space, then NULL out the focus'd control
  742. //
  743. if ( DialogMgrClass::Is_Button_Down (VK_LBUTTON) &&
  744. DialogMgrClass::Was_Button_Down (VK_LBUTTON))
  745. {
  746. DialogMgrClass::Set_Focus (NULL);
  747. }
  748. }
  749. //
  750. // Check for mouse wheel activity
  751. //
  752. const Vector3 &last_mouse_pos = DialogMgrClass::Get_Last_Mouse_Pos ();
  753. if (last_mouse_pos.Z != cursor_pos.Z && DialogMgrClass::Get_Focus () != NULL) {
  754. DialogMgrClass::Get_Focus ()->On_Mouse_Wheel ((int)(last_mouse_pos.Z - cursor_pos.Z));
  755. }
  756. //
  757. // Store our cached button states
  758. //
  759. DialogMgrClass::Set_Last_Mouse_Pos (cursor_pos);
  760. return ;
  761. }
  762. ////////////////////////////////////////////////////////////////
  763. //
  764. // On_Command
  765. //
  766. ////////////////////////////////////////////////////////////////
  767. void
  768. DialogBaseClass::On_Command (int ctrl_id, int message_id, DWORD param)
  769. {
  770. //
  771. // Allow the default handler to process this command
  772. //
  773. if (DefaultCmdHandler != NULL) {
  774. (*DefaultCmdHandler) (this, ctrl_id, message_id, param);
  775. }
  776. return ;
  777. }
  778. ////////////////////////////////////////////////////////////////
  779. //
  780. // On_Activate
  781. //
  782. ////////////////////////////////////////////////////////////////
  783. void
  784. DialogBaseClass::On_Activate (bool onoff)
  785. {
  786. if (onoff == false) {
  787. //
  788. // Cache the current focus control between dialogs (if possible)
  789. //
  790. for (int index = 0; index < ControlList.Count (); index ++) {
  791. if (ControlList[index] == DialogMgrClass::Get_Focus ()) {
  792. LastFocusControl = ControlList[index];
  793. break;
  794. }
  795. }
  796. //
  797. // Let go of the currently focus'd control
  798. //
  799. DialogMgrClass::Set_Focus (NULL);
  800. DialogEvent dlgEvent(DialogEvent::DEACTIVATED, this);
  801. NotifyObservers(dlgEvent);
  802. } else {
  803. if (LastFocusControl != NULL) {
  804. DialogMgrClass::Set_Focus (LastFocusControl);
  805. } else {
  806. Set_Default_Focus ();
  807. }
  808. DialogEvent dlgEvent(DialogEvent::ACTIVATED, this);
  809. NotifyObservers(dlgEvent);
  810. }
  811. return ;
  812. }
  813. ////////////////////////////////////////////////////////////////
  814. //
  815. // Is_Active
  816. //
  817. ////////////////////////////////////////////////////////////////
  818. bool
  819. DialogBaseClass::Is_Active (void)
  820. {
  821. return (DialogMgrClass::Get_Active_Dialog () == this);
  822. }
  823. ////////////////////////////////////////////////////////////////
  824. //
  825. // On_Key_Down
  826. //
  827. ////////////////////////////////////////////////////////////////
  828. bool
  829. DialogBaseClass::On_Key_Down (uint32 key_id, uint32 key_data)
  830. {
  831. bool handled = false;
  832. Add_Ref ();
  833. //
  834. // Determine what control to send the input to
  835. //
  836. DialogControlClass *input_capture = DialogMgrClass::Get_Capture ();
  837. DialogControlClass *input = input_capture ? input_capture : DialogMgrClass::Get_Focus ();
  838. //
  839. // Special case some of the keys
  840. //
  841. if (key_id == VK_ESCAPE) {
  842. On_Command (IDCANCEL, 0, 0);
  843. handled = true;
  844. } else if (key_id == VK_TAB) {
  845. //
  846. // Determine whether to go forward or backward through the controls
  847. //
  848. int inc = 1;
  849. if ((DialogMgrClass::Get_VKey_State (VK_SHIFT) & VKEY_PRESSED) == VKEY_PRESSED) {
  850. inc = -1;
  851. }
  852. //
  853. // Find the next (or previous) control
  854. //
  855. DialogControlClass *control = Find_Next_Control (DialogMgrClass::Get_Focus (), inc);
  856. //
  857. // Set the new focus control
  858. //
  859. if (control != NULL) {
  860. DialogMgrClass::Set_Focus (control);
  861. handled = true;
  862. }
  863. } else if (input != NULL) {
  864. //
  865. // Send out the standard On_OK notification if the user
  866. // pressed enter
  867. //
  868. if ( input->As_ButtonCtrlClass () == NULL &&
  869. input->As_MenuEntryCtrlClass () == NULL &&
  870. key_id == VK_RETURN)
  871. {
  872. On_Command (IDOK, 0, 0);
  873. handled = true;
  874. }
  875. //
  876. // Pass keyboard input onto the control
  877. //
  878. handled = input->On_Key_Down (key_id, key_data);
  879. }
  880. Release_Ref ();
  881. return handled;
  882. }
  883. ////////////////////////////////////////////////////////////////
  884. //
  885. // On_Key_Up
  886. //
  887. ////////////////////////////////////////////////////////////////
  888. bool
  889. DialogBaseClass::On_Key_Up (uint32 key_id)
  890. {
  891. bool handled = false;
  892. Add_Ref ();
  893. DialogControlClass *input_capture = DialogMgrClass::Get_Capture ();
  894. DialogControlClass *input = input_capture ? input_capture : DialogMgrClass::Get_Focus ();
  895. //
  896. // Pass keyboard input onto the control
  897. //
  898. if (input != NULL) {
  899. handled = input->On_Key_Up (key_id);
  900. }
  901. Release_Ref ();
  902. return handled;
  903. }
  904. ////////////////////////////////////////////////////////////////
  905. //
  906. // On_Unicode_Char
  907. //
  908. ////////////////////////////////////////////////////////////////
  909. void
  910. DialogBaseClass::On_Unicode_Char(uint16 unicode)
  911. {
  912. Add_Ref ();
  913. //
  914. // Determine what control to send the input to
  915. //
  916. DialogControlClass *input_capture = DialogMgrClass::Get_Capture ();
  917. DialogControlClass *input = input_capture ? input_capture : DialogMgrClass::Get_Focus ();
  918. if (input != NULL) {
  919. //
  920. // Pass keyboard input onto the control
  921. //
  922. input->On_Unicode_Char (unicode);
  923. }
  924. Release_Ref ();
  925. return ;
  926. }
  927. ////////////////////////////////////////////////////////////////
  928. //
  929. // Find_Next_Control
  930. //
  931. ////////////////////////////////////////////////////////////////
  932. DialogControlClass *
  933. DialogBaseClass::Find_Next_Control
  934. (
  935. DialogControlClass * control,
  936. int direction
  937. )
  938. {
  939. DialogControlClass *retval = NULL;
  940. //
  941. // Build a complete list of controls
  942. //
  943. CONTROL_LIST control_list;
  944. Build_Control_List (control_list);
  945. //
  946. // Find the index of the control
  947. //
  948. int focus_index = max (control_list.ID (control), 0);
  949. int new_focus_index = -1;
  950. int inc = (direction < 0) ? -1 : 1;
  951. //
  952. // Find the next control in the sequence
  953. //
  954. int count = control_list.Count ();
  955. for (int index = focus_index; index >= 0 && index < count; index += inc) {
  956. //
  957. // Bound the index
  958. //
  959. new_focus_index = index + inc;
  960. if (new_focus_index >= count) {
  961. new_focus_index = 0;
  962. } else if (new_focus_index < 0) {
  963. new_focus_index = count - 1;
  964. }
  965. //
  966. // Does this control want the focus?
  967. //
  968. if ( control_list[new_focus_index]->Wants_Focus () &&
  969. control_list[new_focus_index]->Is_Enabled ())
  970. {
  971. break;
  972. }
  973. }
  974. if (new_focus_index >= 0) {
  975. retval = control_list[new_focus_index];
  976. }
  977. return retval;
  978. }
  979. ////////////////////////////////////////////////////////////////
  980. //
  981. // Find_Next_Group_Control
  982. //
  983. ////////////////////////////////////////////////////////////////
  984. DialogControlClass *
  985. DialogBaseClass::Find_Next_Group_Control
  986. (
  987. DialogControlClass * control,
  988. int direction
  989. )
  990. {
  991. //
  992. // Build a complete list of controls
  993. //
  994. CONTROL_LIST control_list;
  995. Build_Control_List (control_list);
  996. //
  997. // Remove any disabled controls
  998. //
  999. /*for (int index = control_list.Count () - 1; index >= 0; index --) {
  1000. if (control_list[index]->Is_Enabled () == false) {
  1001. control_list.Delete (index);
  1002. }
  1003. }*/
  1004. //
  1005. // Find the index of the control
  1006. //
  1007. int curr_index = max (control_list.ID (control), 0);
  1008. int new_index = -1;
  1009. if (direction < 0) {
  1010. if ( (control_list[curr_index]->Get_Style () & WS_GROUP) ||
  1011. (curr_index == 0))
  1012. {
  1013. //
  1014. // Wrap around to the last control in the group
  1015. //
  1016. for (int index = curr_index + 1; index < control_list.Count (); index ++) {
  1017. //
  1018. // Is this the start of the next group?
  1019. //
  1020. if (control_list[index]->Get_Style () & WS_GROUP) {
  1021. break;
  1022. }
  1023. new_index = index;
  1024. }
  1025. } else {
  1026. //
  1027. // Simply move to the previous control (its in the group)
  1028. //
  1029. new_index = curr_index - 1;
  1030. }
  1031. } else {
  1032. if ( curr_index == (control_list.Count () - 1) ||
  1033. (control_list[curr_index + 1]->Get_Style () & WS_GROUP))
  1034. {
  1035. //
  1036. // Wrap around to the first control in the group
  1037. //
  1038. for (int index = curr_index; index >= 0; index --) {
  1039. new_index = index;
  1040. //
  1041. // Is this the first control in the group?
  1042. //
  1043. if (control_list[index]->Get_Style () & WS_GROUP) {
  1044. break;
  1045. }
  1046. }
  1047. } else {
  1048. //
  1049. // Simply move to the next control (its in the group)
  1050. //
  1051. new_index = curr_index + 1;
  1052. }
  1053. }
  1054. //
  1055. // Index into the list and return the pointer to the caller
  1056. //
  1057. DialogControlClass *retval = NULL;
  1058. if (new_index >= 0) {
  1059. retval = control_list[new_index];
  1060. }
  1061. return retval;
  1062. }
  1063. ////////////////////////////////////////////////////////////////
  1064. //
  1065. // Find_Control_Index
  1066. //
  1067. ////////////////////////////////////////////////////////////////
  1068. int
  1069. DialogBaseClass::Find_Control_Index (DialogControlClass *control)
  1070. {
  1071. return ControlList.ID (control);
  1072. }
  1073. ////////////////////////////////////////////////////////////////
  1074. //
  1075. // Add_Control
  1076. //
  1077. ////////////////////////////////////////////////////////////////
  1078. void
  1079. DialogBaseClass::Add_Control (DialogControlClass *control)
  1080. {
  1081. //
  1082. // Simply add the control to the list
  1083. //
  1084. if (ControlList.ID (control) == -1) {
  1085. ControlList.Add (control);
  1086. control->Set_Parent (this);
  1087. control->On_Add_To_Dialog ();
  1088. }
  1089. return ;
  1090. }
  1091. ////////////////////////////////////////////////////////////////
  1092. //
  1093. // Remove_Control
  1094. //
  1095. ////////////////////////////////////////////////////////////////
  1096. void
  1097. DialogBaseClass::Remove_Control (DialogControlClass *control)
  1098. {
  1099. //
  1100. // Simply remove the control from the list
  1101. //
  1102. int index = ControlList.ID (control);
  1103. if (index != -1) {
  1104. control->On_Remove_From_Dialog ();
  1105. control->Set_Parent (NULL);
  1106. //
  1107. // Remove the control from the list (note: its possible
  1108. // the index might of changed since we last checked)
  1109. //
  1110. index = ControlList.ID (control);
  1111. if (index != -1) {
  1112. ControlList.Delete (index);
  1113. }
  1114. //
  1115. // Remove the capture if we just removed the control
  1116. //
  1117. if (control == DialogMgrClass::Get_Capture ()) {
  1118. DialogMgrClass::Release_Capture ();
  1119. }
  1120. }
  1121. return ;
  1122. }
  1123. ////////////////////////////////////////////////////////////////
  1124. //
  1125. // Find_Control
  1126. //
  1127. ////////////////////////////////////////////////////////////////
  1128. DialogControlClass *
  1129. DialogBaseClass::Find_Control (const Vector2 &mouse_pos)
  1130. {
  1131. DialogControlClass *retval = NULL;
  1132. //
  1133. // Build a complete list of controls
  1134. //
  1135. CONTROL_LIST control_list;
  1136. Build_Control_List (control_list);
  1137. //
  1138. // Loop over all the controls
  1139. //
  1140. for (int index = control_list.Count () - 1; index >= 0; index --) {
  1141. //
  1142. // Is the mouse over this control?
  1143. //
  1144. const RectClass &rect = control_list[index]->Get_Window_Rect ();
  1145. if (rect.Contains (mouse_pos)) {
  1146. //
  1147. // Return the control to the caller
  1148. //
  1149. retval = control_list[index];
  1150. break;
  1151. }
  1152. }
  1153. return retval;
  1154. }
  1155. ////////////////////////////////////////////////////////////////
  1156. //
  1157. // Find_Focus_Control
  1158. //
  1159. ////////////////////////////////////////////////////////////////
  1160. int
  1161. DialogBaseClass::Find_Focus_Control (void)
  1162. {
  1163. int focus_index = -1;
  1164. //
  1165. // Loop over all the controls in the list
  1166. //
  1167. for (int index = 0; index < ControlList.Count (); index ++) {
  1168. if (DialogMgrClass::Get_Focus () == ControlList[index]) {
  1169. focus_index = index;
  1170. break;
  1171. }
  1172. }
  1173. return focus_index;
  1174. }
  1175. ////////////////////////////////////////////////////////////////
  1176. //
  1177. // Add_Child_Dialog
  1178. //
  1179. ////////////////////////////////////////////////////////////////
  1180. void
  1181. DialogBaseClass::Add_Child_Dialog (ChildDialogClass *child)
  1182. {
  1183. //
  1184. // Simply add the dialog to our list
  1185. //
  1186. if (ChildDialogList.ID (child) == -1) {
  1187. ChildDialogList.Add (child);
  1188. child->Set_Parent_Dialog (this);
  1189. child->Add_Ref ();
  1190. }
  1191. return ;
  1192. }
  1193. ////////////////////////////////////////////////////////////////
  1194. //
  1195. // Remove_Child_Dialog
  1196. //
  1197. ////////////////////////////////////////////////////////////////
  1198. void
  1199. DialogBaseClass::Remove_Child_Dialog (ChildDialogClass *child)
  1200. {
  1201. bool reset_focus = false;
  1202. //
  1203. // Simply remove the control from the list
  1204. //
  1205. int index = ChildDialogList.ID (child);
  1206. if (index != -1) {
  1207. //
  1208. // Check to see if the current focus control belongs to this
  1209. // dialog
  1210. //
  1211. if ( DialogMgrClass::Get_Focus () != NULL &&
  1212. DialogMgrClass::Get_Focus ()->Peek_Parent () == child)
  1213. {
  1214. DialogMgrClass::Set_Focus (NULL);
  1215. reset_focus = true;
  1216. }
  1217. //
  1218. // Remove the control from the list
  1219. //
  1220. child->Set_Parent_Dialog (NULL);
  1221. child->Release_Ref ();
  1222. ControlList.Delete (index);
  1223. }
  1224. //
  1225. // Reset the focus to the first control we find that wants it
  1226. //
  1227. if (reset_focus) {
  1228. DialogMgrClass::Set_Focus (Find_Next_Control (NULL));
  1229. }
  1230. return ;
  1231. }
  1232. ////////////////////////////////////////////////////////////////
  1233. //
  1234. // Build_Control_List
  1235. //
  1236. ////////////////////////////////////////////////////////////////
  1237. void
  1238. DialogBaseClass::Build_Control_List (CONTROL_LIST &list)
  1239. {
  1240. //
  1241. // First off add all the controls on this dialog to the list
  1242. //
  1243. for (int index = 0; index < ControlList.Count (); index ++) {
  1244. if (ControlList[index]->Is_Enabled ()) {
  1245. list.Add (ControlList[index]);
  1246. }
  1247. }
  1248. //
  1249. // Next, add in the control from each dialog
  1250. //
  1251. for (index = 0; index < ChildDialogList.Count (); index ++) {
  1252. if (ChildDialogList[index]->Is_Visible ()) {
  1253. ChildDialogList[index]->Build_Control_List (list);
  1254. }
  1255. }
  1256. return ;
  1257. }
  1258. ////////////////////////////////////////////////////////////////
  1259. //
  1260. // Set_Rect
  1261. //
  1262. ////////////////////////////////////////////////////////////////
  1263. void
  1264. DialogBaseClass::Set_Rect (const RectClass &rect)
  1265. {
  1266. if (rect == Rect) {
  1267. return ;
  1268. }
  1269. Vector2 offset = rect.Upper_Left () - Rect.Upper_Left ();
  1270. //
  1271. // Move all the controls
  1272. //
  1273. for (int index = 0; index < ControlList.Count (); index ++) {
  1274. //
  1275. // Offset this control
  1276. //
  1277. if (ControlList[index]->Is_Embedded () == false) {
  1278. Vector2 old_pos = ControlList[index]->Get_Window_Pos ();
  1279. ControlList[index]->Set_Window_Pos (old_pos + offset);
  1280. }
  1281. }
  1282. //
  1283. // Move all the child dialogs
  1284. //
  1285. for (index = 0; index < ChildDialogList.Count (); index ++) {
  1286. //
  1287. // Offset this dialog
  1288. //
  1289. RectClass rect = ChildDialogList[index]->Get_Rect ();
  1290. rect.Left += offset.X;
  1291. rect.Right += offset.X;
  1292. rect.Top += offset.Y;
  1293. rect.Bottom += offset.Y;
  1294. ChildDialogList[index]->Set_Rect (rect);
  1295. }
  1296. Rect = rect;
  1297. return ;
  1298. }
  1299. ////////////////////////////////////////////////////////////////
  1300. //
  1301. // On_Init_Dialog
  1302. //
  1303. ////////////////////////////////////////////////////////////////
  1304. void
  1305. DialogBaseClass::On_Init_Dialog (void)
  1306. {
  1307. if (DialogMgrClass::Get_Focus () == NULL) {
  1308. Set_Default_Focus ();
  1309. } else {
  1310. //DialogMgrClass::Get_Focus ()->Center_Mouse ();
  1311. }
  1312. return ;
  1313. }
  1314. ////////////////////////////////////////////////////////////////
  1315. //
  1316. // Set_Default_Focus
  1317. //
  1318. ////////////////////////////////////////////////////////////////
  1319. void
  1320. DialogBaseClass::Set_Default_Focus (void)
  1321. {
  1322. //
  1323. // Build a complete list of controls
  1324. //
  1325. CONTROL_LIST control_list;
  1326. Build_Control_List (control_list);
  1327. //
  1328. // Set the focus to the first control that wants it
  1329. //
  1330. for (int index = 0; index < control_list.Count (); index ++) {
  1331. if (control_list[index]->Wants_Focus () && control_list[index]->Is_Enabled ()) {
  1332. DialogMgrClass::Set_Focus (control_list[index]);
  1333. //
  1334. // Put the mouse cursor in the middle of this control
  1335. //
  1336. //control_list[index]->Center_Mouse ();
  1337. break;
  1338. }
  1339. }
  1340. return ;
  1341. }
  1342. ////////////////////////////////////////////////////////////////
  1343. //
  1344. // On_Mouse_Wheel
  1345. //
  1346. ////////////////////////////////////////////////////////////////
  1347. void
  1348. DialogBaseClass::On_Mouse_Wheel (int direction)
  1349. {
  1350. if (DialogMgrClass::Get_Focus () != NULL) {
  1351. DialogMgrClass::Get_Focus ()->On_Mouse_Wheel (direction);
  1352. }
  1353. return ;
  1354. }
  1355. void DialogBaseClass::Set_Dirty(bool onoff)
  1356. {
  1357. for (int index = 0; index < ControlList.Count (); index ++) {
  1358. ControlList[index]->Set_Dirty();
  1359. }
  1360. //
  1361. // Render each child - dialog
  1362. //
  1363. for (index = 0; index < ChildDialogList.Count (); index ++) {
  1364. ChildDialogList[index]->Set_Dirty();
  1365. }
  1366. }