Properties.cpp 75 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763
  1. /*
  2. ** Command & Conquer Generals(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. // //
  20. // (c) 2001-2003 Electronic Arts Inc. //
  21. // //
  22. ////////////////////////////////////////////////////////////////////////////////
  23. // FILE: Properties.cpp ///////////////////////////////////////////////////////
  24. //-----------------------------------------------------------------------------
  25. //
  26. // Westwood Studios Pacific.
  27. //
  28. // Confidential Information
  29. // Copyright (C) 2001 - All Rights Reserved
  30. //
  31. //-----------------------------------------------------------------------------
  32. //
  33. // Project: GUIEdit
  34. //
  35. // File name: Properties.cpp
  36. //
  37. // Created: Colin Day, August 2001
  38. //
  39. // Desc: Initializing property dialogs. This file also contains
  40. // helper functions for loading, populating, and saving
  41. // properties that are common to all the property dialogs
  42. // ranging from the generic window to any of the
  43. // gadget controls.
  44. //
  45. //-----------------------------------------------------------------------------
  46. ///////////////////////////////////////////////////////////////////////////////
  47. // SYSTEM INCLUDES ////////////////////////////////////////////////////////////
  48. #include <stdlib.h>
  49. #include <assert.h>
  50. #include <stdio.h>
  51. // USER INCLUDES //////////////////////////////////////////////////////////////
  52. #include "Common/Debug.h"
  53. #include "GameClient/Gadget.h"
  54. #include "GameClient/GameWindowManager.h"
  55. #include "GameClient/GadgetRadioButton.h"
  56. #include "GameClient/GadgetPushButton.h"
  57. #include "GameClient/GadgetCheckBox.h"
  58. #include "GameClient/GadgetStaticText.h"
  59. #include "GameClient/GadgetTextEntry.h"
  60. #include "GameClient/HeaderTemplate.h"
  61. #include "GUIEdit.h"
  62. #include "Properties.h"
  63. #include "EditWindow.h"
  64. #include "Resource.h"
  65. #include "HierarchyView.h"
  66. #include "GameClient/GameText.h"
  67. // DEFINES ////////////////////////////////////////////////////////////////////
  68. // PRIVATE TYPES //////////////////////////////////////////////////////////////
  69. ///////////////////////////////////////////////////////////////////////////////
  70. // PRIVATE DATA ///////////////////////////////////////////////////////////////
  71. ///////////////////////////////////////////////////////////////////////////////
  72. static TextDrawData textDrawData[ 3 ];
  73. static Int currTextIndex;
  74. static Int enabledTextIndex,
  75. disabledTextIndex,
  76. hiliteTextIndex;
  77. ColorControl colorControlTable[] =
  78. {
  79. { BUTTON_ENABLED_COLOR, { 255, 255, 255, 255 } },
  80. { BUTTON_ENABLED_BORDER_COLOR, { 255, 255, 255, 255 } },
  81. { BUTTON_DISABLED_COLOR, { 255, 255, 255, 255 } },
  82. { BUTTON_DISABLED_BORDER_COLOR, { 255, 255, 255, 255 } },
  83. { BUTTON_HILITE_COLOR, { 255, 255, 255, 255 } },
  84. { BUTTON_HILITE_BORDER_COLOR, { 255, 255, 255, 255 } },
  85. { BUTTON_COLOR, 0, },
  86. { BUTTON_BORDER_COLOR, 0 },
  87. { 0, { 0, 0, 0, 0 } } // keep this last!
  88. };
  89. ImageAndColorInfo imageAndColorTable[] =
  90. {
  91. { GWS_PUSH_BUTTON, BUTTON_ENABLED, "[Button] Enabled (Normal)", NULL, 0, 0 },
  92. { GWS_PUSH_BUTTON, BUTTON_ENABLED_PUSHED, "[Button] Enabled (Pushed)", NULL, 0, 0 },
  93. { GWS_PUSH_BUTTON, BUTTON_DISABLED, "[Button] Disabled (Normal)", NULL, 0, 0 },
  94. { GWS_PUSH_BUTTON, BUTTON_DISABLED_PUSHED, "[Button] Disabled (Pushed)", NULL, 0, 0 },
  95. { GWS_PUSH_BUTTON, BUTTON_HILITE, "[Button] Hilite (Normal)", NULL, 0, 0 },
  96. { GWS_PUSH_BUTTON, BUTTON_HILITE_PUSHED, "[Button] Hilite (Pushed)", NULL, 0, 0 },
  97. { GWS_RADIO_BUTTON, RADIO_ENABLED, "[Radio] Enabled Surface", NULL, 0, 0 },
  98. { GWS_RADIO_BUTTON, RADIO_ENABLED_UNCHECKED_BOX, "[Radio] Enabled Nubbin (Un-checked)", NULL, 0, 0 },
  99. { GWS_RADIO_BUTTON, RADIO_ENABLED_CHECKED_BOX, "[Radio] Enabled Nubbin (Checked)", NULL, 0, 0 },
  100. { GWS_RADIO_BUTTON, RADIO_DISABLED, "[Radio] Disabled Surface", NULL, 0, 0 },
  101. { GWS_RADIO_BUTTON, RADIO_DISABLED_UNCHECKED_BOX, "[Radio] Disabled Nubbin (Un-checked)", NULL, 0, 0 },
  102. { GWS_RADIO_BUTTON, RADIO_DISABLED_CHECKED_BOX, "[Radio] Disabled Nubbin (Checked)", NULL, 0, 0 },
  103. { GWS_RADIO_BUTTON, RADIO_HILITE, "[Radio] Hilite Surface", NULL, 0, 0 },
  104. { GWS_RADIO_BUTTON, RADIO_HILITE_UNCHECKED_BOX, "[Radio] Hilite Nubbin (Un-checked)", NULL, 0, 0 },
  105. { GWS_RADIO_BUTTON, RADIO_HILITE_CHECKED_BOX, "[Radio] Hilite Nubbin (Checked)", NULL, 0, 0 },
  106. { GWS_CHECK_BOX, CHECK_BOX_ENABLED, "[Check Box] Enabled Surface", NULL, 0, 0 },
  107. { GWS_CHECK_BOX, CHECK_BOX_ENABLED_UNCHECKED_BOX, "[Check Box] Enabled Box (Un-checked)", NULL, 0, 0 },
  108. { GWS_CHECK_BOX, CHECK_BOX_ENABLED_CHECKED_BOX, "[Check Box] Enabled Box (Checked)", NULL, 0, 0 },
  109. { GWS_CHECK_BOX, CHECK_BOX_DISABLED, "[Check Box] Disabled Surface", NULL, 0, 0 },
  110. { GWS_CHECK_BOX, CHECK_BOX_DISABLED_UNCHECKED_BOX, "[Check Box] Disabled Box (Un-checked)", NULL, 0, 0 },
  111. { GWS_CHECK_BOX, CHECK_BOX_DISABLED_CHECKED_BOX, "[Check Box] Disabled Box (Checked)", NULL, 0, 0 },
  112. { GWS_CHECK_BOX, CHECK_BOX_HILITE, "[Check Box] Hilite Surface", NULL, 0, 0 },
  113. { GWS_CHECK_BOX, CHECK_BOX_HILITE_UNCHECKED_BOX, "[Check Box] Hilite Box (Un-checked)", NULL, 0, 0 },
  114. { GWS_CHECK_BOX, CHECK_BOX_HILITE_CHECKED_BOX, "[Check Box] Hilite Box (Checked)", NULL, 0, 0 },
  115. { GWS_HORZ_SLIDER, HSLIDER_ENABLED_LEFT, "[HSlider] Enabled Left End (or bar colors for no image)", NULL, 0, 0 },
  116. { GWS_HORZ_SLIDER, HSLIDER_ENABLED_RIGHT, "[HSlider] Enabled Right End", NULL, 0, 0 },
  117. { GWS_HORZ_SLIDER, HSLIDER_ENABLED_CENTER, "[HSlider] Enabled Repeating Center", NULL, 0, 0 },
  118. { GWS_HORZ_SLIDER, HSLIDER_ENABLED_SMALL_CENTER, "[HSlider] Enabled Repeating Small Cener", NULL, 0, 0 },
  119. { GWS_HORZ_SLIDER, HSLIDER_DISABLED_LEFT, "[HSlider] Disabled Left End (or bar colors for no image)", NULL, 0, 0 },
  120. { GWS_HORZ_SLIDER, HSLIDER_DISABLED_RIGHT, "[HSlider] Disabled Right End", NULL, 0, 0 },
  121. { GWS_HORZ_SLIDER, HSLIDER_DISABLED_CENTER, "[HSlider] Disabled Repeating Center", NULL, 0, 0 },
  122. { GWS_HORZ_SLIDER, HSLIDER_DISABLED_SMALL_CENTER, "[HSlider] Disabled Repeating Small Cener", NULL, 0, 0 },
  123. { GWS_HORZ_SLIDER, HSLIDER_HILITE_LEFT, "[HSlider] Hilite Left End (or bar colors for no image)", NULL, 0, 0 },
  124. { GWS_HORZ_SLIDER, HSLIDER_HILITE_RIGHT, "[HSlider] Hilite Right End", NULL, 0, 0 },
  125. { GWS_HORZ_SLIDER, HSLIDER_HILITE_CENTER, "[HSlider] Hilite Repeating Center", NULL, 0, 0 },
  126. { GWS_HORZ_SLIDER, HSLIDER_HILITE_SMALL_CENTER, "[HSlider] Hilite Repeating Small Cener", NULL, 0, 0 },
  127. { GWS_HORZ_SLIDER, HSLIDER_THUMB_ENABLED, "[Thumb [HSlider]] Enabled (Normal)", NULL, 0, 0 },
  128. { GWS_HORZ_SLIDER, HSLIDER_THUMB_ENABLED_PUSHED, "[Thumb [HSlider]] Enabled (Pushed)", NULL, 0, 0 },
  129. { GWS_HORZ_SLIDER, HSLIDER_THUMB_DISABLED, "[Thumb [HSlider]] Disabled (Normal)", NULL, 0, 0 },
  130. { GWS_HORZ_SLIDER, HSLIDER_THUMB_DISABLED_PUSHED, "[Thumb [HSlider]] Disabled (Pushed)", NULL, 0, 0 },
  131. { GWS_HORZ_SLIDER, HSLIDER_THUMB_HILITE, "[Thumb [HSlider]] Hilite (Normal)", NULL, 0, 0 },
  132. { GWS_HORZ_SLIDER, HSLIDER_THUMB_HILITE_PUSHED, "[Thumb [HSlider]] Hilite (Pushed)", NULL, 0, 0 },
  133. { GWS_VERT_SLIDER, VSLIDER_ENABLED_TOP, "[VSlider] Enabled Top End (or bar colors for no image)", NULL, 0, 0 },
  134. { GWS_VERT_SLIDER, VSLIDER_ENABLED_BOTTOM, "[VSlider] Enabled Bottom End", NULL, 0, 0 },
  135. { GWS_VERT_SLIDER, VSLIDER_ENABLED_CENTER, "[VSlider] Enabled Repeating Center", NULL, 0, 0 },
  136. { GWS_VERT_SLIDER, VSLIDER_ENABLED_SMALL_CENTER, "[VSlider] Enabled Repeating Small Cener", NULL, 0, 0 },
  137. { GWS_VERT_SLIDER, VSLIDER_DISABLED_TOP, "[VSlider] Disabled Top End (or bar colors for no image)", NULL, 0, 0 },
  138. { GWS_VERT_SLIDER, VSLIDER_DISABLED_BOTTOM, "[VSlider] Disabled Bottom End", NULL, 0, 0 },
  139. { GWS_VERT_SLIDER, VSLIDER_DISABLED_CENTER, "[VSlider] Disabled Repeating Center", NULL, 0, 0 },
  140. { GWS_VERT_SLIDER, VSLIDER_DISABLED_SMALL_CENTER, "[VSlider] Disabled Repeating Small Cener", NULL, 0, 0 },
  141. { GWS_VERT_SLIDER, VSLIDER_HILITE_TOP, "[VSlider] Hilite Top End (or bar colors for no image)", NULL, 0, 0 },
  142. { GWS_VERT_SLIDER, VSLIDER_HILITE_BOTTOM, "[VSlider] Hilite Bottom End", NULL, 0, 0 },
  143. { GWS_VERT_SLIDER, VSLIDER_HILITE_CENTER, "[VSlider] Hilite Repeating Center", NULL, 0, 0 },
  144. { GWS_VERT_SLIDER, VSLIDER_HILITE_SMALL_CENTER, "[VSlider] Hilite Repeating Small Cener", NULL, 0, 0 },
  145. { GWS_VERT_SLIDER, VSLIDER_THUMB_ENABLED, "[Thumb [VSlider]] Enabled (Normal)", NULL, 0, 0 },
  146. { GWS_VERT_SLIDER, VSLIDER_THUMB_ENABLED_PUSHED, "[Thumb [VSlider]] Enabled (Pushed)", NULL, 0, 0 },
  147. { GWS_VERT_SLIDER, VSLIDER_THUMB_DISABLED, "[Thumb [VSlider]] Disabled (Normal)", NULL, 0, 0 },
  148. { GWS_VERT_SLIDER, VSLIDER_THUMB_DISABLED_PUSHED, "[Thumb [VSlider]] Disabled (Pushed)", NULL, 0, 0 },
  149. { GWS_VERT_SLIDER, VSLIDER_THUMB_HILITE, "[Thumb [VSlider]] Hilite (Normal)", NULL, 0, 0 },
  150. { GWS_VERT_SLIDER, VSLIDER_THUMB_HILITE_PUSHED, "[Thumb [VSlider]] Hilite (Pushed)", NULL, 0, 0 },
  151. { GWS_SCROLL_LISTBOX, LISTBOX_ENABLED, "[Listbox] Enabled Surface", NULL, 0, 0 },
  152. { GWS_SCROLL_LISTBOX, LISTBOX_ENABLED_SELECTED_ITEM_LEFT, "[Listbox] Enabled Selected Item Left End (or colors)", NULL, 0, 0 },
  153. { GWS_SCROLL_LISTBOX, LISTBOX_ENABLED_SELECTED_ITEM_RIGHT, "[Listbox] Enabled Selected Item Right End", NULL, 0, 0 },
  154. { GWS_SCROLL_LISTBOX, LISTBOX_ENABLED_SELECTED_ITEM_CENTER, "[Listbox] Enabled Selected Item Repeating Center", NULL, 0, 0 },
  155. { GWS_SCROLL_LISTBOX, LISTBOX_ENABLED_SELECTED_ITEM_SMALL_CENTER, "[Listbox] Enabled Selected Item Small Repeating Center", NULL, 0, 0 },
  156. { GWS_SCROLL_LISTBOX, LISTBOX_DISABLED, "[Listbox] Disabled Surface", NULL, 0, 0 },
  157. { GWS_SCROLL_LISTBOX, LISTBOX_DISABLED_SELECTED_ITEM_LEFT, "[Listbox] Disabled Selected Item Left End (or colors)", NULL, 0, 0 },
  158. { GWS_SCROLL_LISTBOX, LISTBOX_DISABLED_SELECTED_ITEM_RIGHT, "[Listbox] Disabled Selected Item Right End", NULL, 0, 0 },
  159. { GWS_SCROLL_LISTBOX, LISTBOX_DISABLED_SELECTED_ITEM_CENTER, "[Listbox] Disabled Selected Item Repeating Center", NULL, 0, 0 },
  160. { GWS_SCROLL_LISTBOX, LISTBOX_DISABLED_SELECTED_ITEM_SMALL_CENTER, "[Listbox] Disabled Selected Item Small Repeating Center", NULL, 0, 0 },
  161. { GWS_SCROLL_LISTBOX, LISTBOX_HILITE, "[Listbox] Hilite Surface", NULL, 0, 0 },
  162. { GWS_SCROLL_LISTBOX, LISTBOX_HILITE_SELECTED_ITEM_LEFT, "[Listbox] Hilite Selected Item Left End (or colors)", NULL, 0, 0 },
  163. { GWS_SCROLL_LISTBOX, LISTBOX_HILITE_SELECTED_ITEM_RIGHT, "[Listbox] Hilite Selected Item Right End", NULL, 0, 0 },
  164. { GWS_SCROLL_LISTBOX, LISTBOX_HILITE_SELECTED_ITEM_CENTER, "[Listbox] Hilite Selected Item Repeating Center", NULL, 0, 0 },
  165. { GWS_SCROLL_LISTBOX, LISTBOX_HILITE_SELECTED_ITEM_SMALL_CENTER, "[Listbox] Hilite Selected Item Small Repeating Center", NULL, 0, 0 },
  166. { GWS_SCROLL_LISTBOX, LISTBOX_UP_BUTTON_ENABLED, "[Up Button [Listbox]] Enabled (Normal)", NULL, 0, 0 },
  167. { GWS_SCROLL_LISTBOX, LISTBOX_UP_BUTTON_ENABLED_PUSHED, "[Up Button [Listbox]] Enabled (Pushed)", NULL, 0, 0 },
  168. { GWS_SCROLL_LISTBOX, LISTBOX_UP_BUTTON_DISABLED, "[Up Button [Listbox]] Disabled (Normal)", NULL, 0, 0 },
  169. { GWS_SCROLL_LISTBOX, LISTBOX_UP_BUTTON_DISABLED_PUSHED, "[Up Button [Listbox]] Disabled (Pushed)", NULL, 0, 0 },
  170. { GWS_SCROLL_LISTBOX, LISTBOX_UP_BUTTON_HILITE, "[Up Button [Listbox]] Hilite (Normal)", NULL, 0, 0 },
  171. { GWS_SCROLL_LISTBOX, LISTBOX_UP_BUTTON_HILITE_PUSHED, "[Up Button [Listbox]] Hilite (Pushed)", NULL, 0, 0 },
  172. { GWS_SCROLL_LISTBOX, LISTBOX_DOWN_BUTTON_ENABLED, "[Down Button [Listbox]] Enabled (Normal)", NULL, 0, 0 },
  173. { GWS_SCROLL_LISTBOX, LISTBOX_DOWN_BUTTON_ENABLED_PUSHED, "[Down Button [Listbox]] Enabled (Pushed)", NULL, 0, 0 },
  174. { GWS_SCROLL_LISTBOX, LISTBOX_DOWN_BUTTON_DISABLED, "[Down Button [Listbox]] Disabled (Normal)", NULL, 0, 0 },
  175. { GWS_SCROLL_LISTBOX, LISTBOX_DOWN_BUTTON_DISABLED_PUSHED, "[Down Button [Listbox]] Disabled (Pushed)", NULL, 0, 0 },
  176. { GWS_SCROLL_LISTBOX, LISTBOX_DOWN_BUTTON_HILITE, "[Down Button [Listbox]] Hilite (Normal)", NULL, 0, 0 },
  177. { GWS_SCROLL_LISTBOX, LISTBOX_DOWN_BUTTON_HILITE_PUSHED, "[Down Button [Listbox]] Hilite (Pushed)", NULL, 0, 0 },
  178. { GWS_SCROLL_LISTBOX, LISTBOX_SLIDER_ENABLED_TOP, "[Slider [Listbox]] Enabled Top End (or bar colors for no image)", NULL, 0, 0 },
  179. { GWS_SCROLL_LISTBOX, LISTBOX_SLIDER_ENABLED_BOTTOM, "[Slider [Listbox]] Enabled Bottom End", NULL, 0, 0 },
  180. { GWS_SCROLL_LISTBOX, LISTBOX_SLIDER_ENABLED_CENTER, "[Slider [Listbox]] Enabled Repeating Center", NULL, 0, 0 },
  181. { GWS_SCROLL_LISTBOX, LISTBOX_SLIDER_ENABLED_SMALL_CENTER, "[Slider [Listbox]] Enabled Repeating Small Cener", NULL, 0, 0 },
  182. { GWS_SCROLL_LISTBOX, LISTBOX_SLIDER_DISABLED_TOP, "[Slider [Listbox]] Disabled Top End (or bar colors for no image)", NULL, 0, 0 },
  183. { GWS_SCROLL_LISTBOX, LISTBOX_SLIDER_DISABLED_BOTTOM, "[Slider [Listbox]] Disabled Bottom End", NULL, 0, 0 },
  184. { GWS_SCROLL_LISTBOX, LISTBOX_SLIDER_DISABLED_CENTER, "[Slider [Listbox]] Disabled Repeating Center", NULL, 0, 0 },
  185. { GWS_SCROLL_LISTBOX, LISTBOX_SLIDER_DISABLED_SMALL_CENTER, "[Slider [Listbox]] Disabled Repeating Small Cener", NULL, 0, 0 },
  186. { GWS_SCROLL_LISTBOX, LISTBOX_SLIDER_HILITE_TOP, "[Slider [Listbox]] Hilite Top End (or bar colors for no image)", NULL, 0, 0 },
  187. { GWS_SCROLL_LISTBOX, LISTBOX_SLIDER_HILITE_BOTTOM, "[Slider [Listbox]] Hilite Bottom End", NULL, 0, 0 },
  188. { GWS_SCROLL_LISTBOX, LISTBOX_SLIDER_HILITE_CENTER, "[Slider [Listbox]] Hilite Repeating Center", NULL, 0, 0 },
  189. { GWS_SCROLL_LISTBOX, LISTBOX_SLIDER_HILITE_SMALL_CENTER, "[Slider [Listbox]] Hilite Repeating Small Cener", NULL, 0, 0 },
  190. { GWS_SCROLL_LISTBOX, LISTBOX_SLIDER_THUMB_ENABLED, "[Slider Thumb [Listbox]] Enabled (Normal)", NULL, 0, 0 },
  191. { GWS_SCROLL_LISTBOX, LISTBOX_SLIDER_THUMB_ENABLED_PUSHED, "[Slider Thumb [Listbox]] Enabled (Pushed)", NULL, 0, 0 },
  192. { GWS_SCROLL_LISTBOX, LISTBOX_SLIDER_THUMB_DISABLED, "[Slider Thumb [Listbox]] Disabled (Normal)", NULL, 0, 0 },
  193. { GWS_SCROLL_LISTBOX, LISTBOX_SLIDER_THUMB_DISABLED_PUSHED, "[Slider Thumb [Listbox]] Disabled (Pushed)", NULL, 0, 0 },
  194. { GWS_SCROLL_LISTBOX, LISTBOX_SLIDER_THUMB_HILITE, "[Slider Thumb [Listbox]] Hilite (Normal)", NULL, 0, 0 },
  195. { GWS_SCROLL_LISTBOX, LISTBOX_SLIDER_THUMB_HILITE_PUSHED, "[Slider Thumb [Listbox]] Hilite (Pushed)", NULL, 0, 0 },
  196. { GWS_COMBO_BOX, COMBOBOX_ENABLED, "[ComboBox] Enabled Surface", NULL, 0, 0 },
  197. { GWS_COMBO_BOX, COMBOBOX_ENABLED_SELECTED_ITEM_LEFT, "[ComboBox] Enabled Selected Item Left End (or colors)", NULL, 0, 0 },
  198. { GWS_COMBO_BOX, COMBOBOX_ENABLED_SELECTED_ITEM_RIGHT, "[ComboBox] Enabled Selected Item Right End", NULL, 0, 0 },
  199. { GWS_COMBO_BOX, COMBOBOX_ENABLED_SELECTED_ITEM_CENTER, "[ComboBox] Enabled Selected Item Repeating Center", NULL, 0, 0 },
  200. { GWS_COMBO_BOX, COMBOBOX_ENABLED_SELECTED_ITEM_SMALL_CENTER, "[ComboBox] Enabled Selected Item Small Repeating Center", NULL, 0, 0 },
  201. { GWS_COMBO_BOX, COMBOBOX_DISABLED, "[ComboBox] Disabled Surface", NULL, 0, 0 },
  202. { GWS_COMBO_BOX, COMBOBOX_DISABLED_SELECTED_ITEM_LEFT, "[ComboBox] Disabled Selected Item Left End (or colors)", NULL, 0, 0 },
  203. { GWS_COMBO_BOX, COMBOBOX_DISABLED_SELECTED_ITEM_RIGHT, "[ComboBox] Disabled Selected Item Right End", NULL, 0, 0 },
  204. { GWS_COMBO_BOX, COMBOBOX_DISABLED_SELECTED_ITEM_CENTER, "[ComboBox] Disabled Selected Item Repeating Center", NULL, 0, 0 },
  205. { GWS_COMBO_BOX, COMBOBOX_DISABLED_SELECTED_ITEM_SMALL_CENTER, "[ComboBox] Disabled Selected Item Small Repeating Center", NULL, 0, 0 },
  206. { GWS_COMBO_BOX, COMBOBOX_HILITE, "[ComboBox] Hilite Surface", NULL, 0, 0 },
  207. { GWS_COMBO_BOX, COMBOBOX_HILITE_SELECTED_ITEM_LEFT, "[ComboBox] Hilite Selected Item Left End (or colors)", NULL, 0, 0 },
  208. { GWS_COMBO_BOX, COMBOBOX_HILITE_SELECTED_ITEM_RIGHT, "[ComboBox] Hilite Selected Item Right End", NULL, 0, 0 },
  209. { GWS_COMBO_BOX, COMBOBOX_HILITE_SELECTED_ITEM_CENTER, "[ComboBox] Hilite Selected Item Repeating Center", NULL, 0, 0 },
  210. { GWS_COMBO_BOX, COMBOBOX_HILITE_SELECTED_ITEM_SMALL_CENTER, "[ComboBox] Hilite Selected Item Small Repeating Center", NULL, 0, 0 },
  211. { GWS_COMBO_BOX, COMBOBOX_DROP_DOWN_BUTTON_ENABLED, "[Button [ComboBox]] Enabled (Normal)", NULL, 0, 0 },
  212. { GWS_COMBO_BOX, COMBOBOX_DROP_DOWN_BUTTON_ENABLED_PUSHED, "[Button [ComboBox]] Enabled (Pushed)", NULL, 0, 0 },
  213. { GWS_COMBO_BOX, COMBOBOX_DROP_DOWN_BUTTON_DISABLED, "[Button [ComboBox]] Disabled (Normal)", NULL, 0, 0 },
  214. { GWS_COMBO_BOX, COMBOBOX_DROP_DOWN_BUTTON_DISABLED_PUSHED, "[Button [ComboBox]] Disabled (Pushed)", NULL, 0, 0 },
  215. { GWS_COMBO_BOX, COMBOBOX_DROP_DOWN_BUTTON_HILITE, "[Button [ComboBox]] Hilite (Normal)", NULL, 0, 0 },
  216. { GWS_COMBO_BOX, COMBOBOX_DROP_DOWN_BUTTON_HILITE_PUSHED, "[Button [ComboBox]] Hilite (Pushed)", NULL, 0, 0 },
  217. { GWS_COMBO_BOX, COMBOBOX_EDIT_BOX_ENABLED_LEFT, "[Text Entry [ComboBox]] Enabled Left End (Or colors for no image)", NULL, 0, 0 },
  218. { GWS_COMBO_BOX, COMBOBOX_EDIT_BOX_ENABLED_RIGHT, "[Text Entry [ComboBox]] Enabled Right End", NULL, 0, 0 },
  219. { GWS_COMBO_BOX, COMBOBOX_EDIT_BOX_ENABLED_CENTER, "[Text Entry [ComboBox]] Enabled Repeating Center", NULL, 0, 0 },
  220. { GWS_COMBO_BOX, COMBOBOX_EDIT_BOX_ENABLED_SMALL_CENTER, "[Text Entry [ComboBox]] Enabled Small Repeating Center", NULL, 0, 0 },
  221. { GWS_COMBO_BOX, COMBOBOX_EDIT_BOX_DISABLED_LEFT, "[Text Entry [ComboBox]] Disabled Left End (Or colors for no image)", NULL, 0, 0 },
  222. { GWS_COMBO_BOX, COMBOBOX_EDIT_BOX_DISABLED_RIGHT, "[Text Entry [ComboBox]] Disabled Right End", NULL, 0, 0 },
  223. { GWS_COMBO_BOX, COMBOBOX_EDIT_BOX_DISABLED_CENTER, "[Text Entry [ComboBox]] Disabled Repeating Center", NULL, 0, 0 },
  224. { GWS_COMBO_BOX, COMBOBOX_EDIT_BOX_DISABLED_SMALL_CENTER, "[Text Entry [ComboBox]] Disabled Small Repeating Center", NULL, 0, 0 },
  225. { GWS_COMBO_BOX, COMBOBOX_EDIT_BOX_HILITE_LEFT, "[Text Entry [ComboBox]] Hilite Left End (Or colors for no image)", NULL, 0, 0 },
  226. { GWS_COMBO_BOX, COMBOBOX_EDIT_BOX_HILITE_RIGHT, "[Text Entry [ComboBox]] Hilite Right End", NULL, 0, 0 },
  227. { GWS_COMBO_BOX, COMBOBOX_EDIT_BOX_HILITE_CENTER, "[Text Entry [ComboBox]] Hilite Repeating Center", NULL, 0, 0 },
  228. { GWS_COMBO_BOX, COMBOBOX_EDIT_BOX_HILITE_SMALL_CENTER, "[Text Entry [ComboBox]] Hilite Small Repeating Center", NULL, 0, 0 },
  229. { GWS_COMBO_BOX, COMBOBOX_LISTBOX_ENABLED, "[Listbox [ComboBox]] Enabled Surface", NULL, 0, 0 },
  230. { GWS_COMBO_BOX, COMBOBOX_LISTBOX_ENABLED_SELECTED_ITEM_LEFT, "[Listbox [ComboBox]] Enabled Selected Item Left End (or colors)", NULL, 0, 0 },
  231. { GWS_COMBO_BOX, COMBOBOX_LISTBOX_ENABLED_SELECTED_ITEM_RIGHT, "[Listbox [ComboBox]] Enabled Selected Item Right End", NULL, 0, 0 },
  232. { GWS_COMBO_BOX, COMBOBOX_LISTBOX_ENABLED_SELECTED_ITEM_CENTER, "[Listbox [ComboBox]] Enabled Selected Item Repeating Center", NULL, 0, 0 },
  233. { GWS_COMBO_BOX, COMBOBOX_LISTBOX_ENABLED_SELECTED_ITEM_SMALL_CENTER, "[Listbox [ComboBox]] Enabled Selected Item Small Repeating Center", NULL, 0, 0 },
  234. { GWS_COMBO_BOX, COMBOBOX_LISTBOX_DISABLED, "[Listbox [ComboBox]] Disabled Surface", NULL, 0, 0 },
  235. { GWS_COMBO_BOX, COMBOBOX_LISTBOX_DISABLED_SELECTED_ITEM_LEFT, "[Listbox [ComboBox]] Disabled Selected Item Left End (or colors)", NULL, 0, 0 },
  236. { GWS_COMBO_BOX, COMBOBOX_LISTBOX_DISABLED_SELECTED_ITEM_RIGHT, "[Listbox [ComboBox]] Disabled Selected Item Right End", NULL, 0, 0 },
  237. { GWS_COMBO_BOX, COMBOBOX_LISTBOX_DISABLED_SELECTED_ITEM_CENTER, "[Listbox [ComboBox]] Disabled Selected Item Repeating Center", NULL, 0, 0 },
  238. { GWS_COMBO_BOX, COMBOBOX_LISTBOX_DISABLED_SELECTED_ITEM_SMALL_CENTER, "[Listbox [ComboBox]] Disabled Selected Item Small Repeating Center", NULL, 0, 0 },
  239. { GWS_COMBO_BOX, COMBOBOX_LISTBOX_HILITE, "[Listbox [ComboBox]] Hilite Surface", NULL, 0, 0 },
  240. { GWS_COMBO_BOX, COMBOBOX_LISTBOX_HILITE_SELECTED_ITEM_LEFT, "[Listbox [ComboBox]] Hilite Selected Item Left End (or colors)", NULL, 0, 0 },
  241. { GWS_COMBO_BOX, COMBOBOX_LISTBOX_HILITE_SELECTED_ITEM_RIGHT, "[Listbox [ComboBox]] Hilite Selected Item Right End", NULL, 0, 0 },
  242. { GWS_COMBO_BOX, COMBOBOX_LISTBOX_HILITE_SELECTED_ITEM_CENTER, "[Listbox [ComboBox]] Hilite Selected Item Repeating Center", NULL, 0, 0 },
  243. { GWS_COMBO_BOX, COMBOBOX_LISTBOX_HILITE_SELECTED_ITEM_SMALL_CENTER, "[Listbox [ComboBox]] Hilite Selected Item Small Repeating Center", NULL, 0, 0 },
  244. { GWS_COMBO_BOX, COMBOBOX_LISTBOX_UP_BUTTON_ENABLED, "[Up Button [Listbox]] Enabled (Normal)", NULL, 0, 0 },
  245. { GWS_COMBO_BOX, COMBOBOX_LISTBOX_UP_BUTTON_ENABLED_PUSHED, "[Up Button [Listbox [ComboBox]]] Enabled (Pushed)", NULL, 0, 0 },
  246. { GWS_COMBO_BOX, COMBOBOX_LISTBOX_UP_BUTTON_DISABLED, "[Up Button [Listbox [ComboBox]]] Disabled (Normal)", NULL, 0, 0 },
  247. { GWS_COMBO_BOX, COMBOBOX_LISTBOX_UP_BUTTON_DISABLED_PUSHED, "[Up Button [Listbox [ComboBox]]] Disabled (Pushed)", NULL, 0, 0 },
  248. { GWS_COMBO_BOX, COMBOBOX_LISTBOX_UP_BUTTON_HILITE, "[Up Button [Listbox [ComboBox]]] Hilite (Normal)", NULL, 0, 0 },
  249. { GWS_COMBO_BOX, COMBOBOX_LISTBOX_UP_BUTTON_HILITE_PUSHED, "[Up Button [Listbox [ComboBox]]] Hilite (Pushed)", NULL, 0, 0 },
  250. { GWS_COMBO_BOX, COMBOBOX_LISTBOX_DOWN_BUTTON_ENABLED, "[Down Button [Listbox [ComboBox]]] Enabled (Normal)", NULL, 0, 0 },
  251. { GWS_COMBO_BOX, COMBOBOX_LISTBOX_DOWN_BUTTON_ENABLED_PUSHED, "[Down Button [Listbox [ComboBox]]] Enabled (Pushed)", NULL, 0, 0 },
  252. { GWS_COMBO_BOX, COMBOBOX_LISTBOX_DOWN_BUTTON_DISABLED, "[Down Button [Listbox [ComboBox]]] Disabled (Normal)", NULL, 0, 0 },
  253. { GWS_COMBO_BOX, COMBOBOX_LISTBOX_DOWN_BUTTON_DISABLED_PUSHED, "[Down Button [Listbox [ComboBox]]] Disabled (Pushed)", NULL, 0, 0 },
  254. { GWS_COMBO_BOX, COMBOBOX_LISTBOX_DOWN_BUTTON_HILITE, "[Down Button [Listbox [ComboBox]]] Hilite (Normal)", NULL, 0, 0 },
  255. { GWS_COMBO_BOX, COMBOBOX_LISTBOX_DOWN_BUTTON_HILITE_PUSHED, "[Down Button [Listbox [ComboBox]]] Hilite (Pushed)", NULL, 0, 0 },
  256. { GWS_COMBO_BOX, COMBOBOX_LISTBOX_SLIDER_ENABLED_TOP, "[Slider [Listbox [ComboBox]]] Enabled Top End (or bar colors for no image)", NULL, 0, 0 },
  257. { GWS_COMBO_BOX, COMBOBOX_LISTBOX_SLIDER_ENABLED_BOTTOM, "[Slider [Listbox [ComboBox]]] Enabled Bottom End", NULL, 0, 0 },
  258. { GWS_COMBO_BOX, COMBOBOX_LISTBOX_SLIDER_ENABLED_CENTER, "[Slider [Listbox [ComboBox]]] Enabled Repeating Center", NULL, 0, 0 },
  259. { GWS_COMBO_BOX, COMBOBOX_LISTBOX_SLIDER_ENABLED_SMALL_CENTER, "[Slider [Listbox [ComboBox]]] Enabled Repeating Small Cener", NULL, 0, 0 },
  260. { GWS_COMBO_BOX, COMBOBOX_LISTBOX_SLIDER_DISABLED_TOP, "[Slider [Listbox [ComboBox]]] Disabled Top End (or bar colors for no image)", NULL, 0, 0 },
  261. { GWS_COMBO_BOX, COMBOBOX_LISTBOX_SLIDER_DISABLED_BOTTOM, "[Slider [Listbox [ComboBox]]] Disabled Bottom End", NULL, 0, 0 },
  262. { GWS_COMBO_BOX, COMBOBOX_LISTBOX_SLIDER_DISABLED_CENTER, "[Slider [Listbox [ComboBox]]] Disabled Repeating Center", NULL, 0, 0 },
  263. { GWS_COMBO_BOX, COMBOBOX_LISTBOX_SLIDER_DISABLED_SMALL_CENTER, "[Slider [Listbox [ComboBox]]] Disabled Repeating Small Cener", NULL, 0, 0 },
  264. { GWS_COMBO_BOX, COMBOBOX_LISTBOX_SLIDER_HILITE_TOP, "[Slider [Listbox [ComboBox]]] Hilite Top End (or bar colors for no image)", NULL, 0, 0 },
  265. { GWS_COMBO_BOX, COMBOBOX_LISTBOX_SLIDER_HILITE_BOTTOM, "[Slider [Listbox [ComboBox]]] Hilite Bottom End", NULL, 0, 0 },
  266. { GWS_COMBO_BOX, COMBOBOX_LISTBOX_SLIDER_HILITE_CENTER, "[Slider [Listbox [ComboBox]]] Hilite Repeating Center", NULL, 0, 0 },
  267. { GWS_COMBO_BOX, COMBOBOX_LISTBOX_SLIDER_HILITE_SMALL_CENTER, "[Slider [Listbox [ComboBox]]] Hilite Repeating Small Cener", NULL, 0, 0 },
  268. { GWS_COMBO_BOX, COMBOBOX_LISTBOX_SLIDER_THUMB_ENABLED, "[Slider Thumb [Listbox [ComboBox]]] Enabled (Normal)", NULL, 0, 0 },
  269. { GWS_COMBO_BOX, COMBOBOX_LISTBOX_SLIDER_THUMB_ENABLED_PUSHED, "[Slider Thumb [Listbox [ComboBox]]] Enabled (Pushed)", NULL, 0, 0 },
  270. { GWS_COMBO_BOX, COMBOBOX_LISTBOX_SLIDER_THUMB_DISABLED, "[Slider Thumb [Listbox [ComboBox]]] Disabled (Normal)", NULL, 0, 0 },
  271. { GWS_COMBO_BOX, COMBOBOX_LISTBOX_SLIDER_THUMB_DISABLED_PUSHED, "[Slider Thumb [Listbox [ComboBox]]] Disabled (Pushed)", NULL, 0, 0 },
  272. { GWS_COMBO_BOX, COMBOBOX_LISTBOX_SLIDER_THUMB_HILITE, "[Slider Thumb [Listbox [ComboBox]]] Hilite (Normal)", NULL, 0, 0 },
  273. { GWS_COMBO_BOX, COMBOBOX_LISTBOX_SLIDER_THUMB_HILITE_PUSHED, "[Slider Thumb [Listbox [ComboBox]]] Hilite (Pushed)", NULL, 0, 0 },
  274. { GWS_PROGRESS_BAR, PROGRESS_BAR_ENABLED_LEFT, "[Bar] Enabled Left End (or color for no images)", NULL, 0, 0 },
  275. { GWS_PROGRESS_BAR, PROGRESS_BAR_ENABLED_RIGHT, "[Bar] Enabled Right End", NULL, 0, 0 },
  276. { GWS_PROGRESS_BAR, PROGRESS_BAR_ENABLED_CENTER, "[Bar] Enabled Repeating Center End", NULL, 0, 0 },
  277. { GWS_PROGRESS_BAR, PROGRESS_BAR_ENABLED_SMALL_CENTER, "[Bar] Enabled Small Repeating Center", NULL, 0, 0 },
  278. { GWS_PROGRESS_BAR, PROGRESS_BAR_ENABLED_BAR_LEFT, "[Bar] Enabled Fill Bar Left End (or color for no images)", NULL, 0, 0 },
  279. { GWS_PROGRESS_BAR, PROGRESS_BAR_ENABLED_BAR_RIGHT, "[Bar] Enabled Fill Bar Right End", NULL, 0, 0 },
  280. { GWS_PROGRESS_BAR, PROGRESS_BAR_ENABLED_BAR_CENTER, "[Bar] Enabled Fill Bar Repeating Center", NULL, 0, 0 },
  281. { GWS_PROGRESS_BAR, PROGRESS_BAR_ENABLED_BAR_SMALL_CENTER, "[Bar] Enabled Fill Bar Small Repeating Center", NULL, 0, 0 },
  282. { GWS_PROGRESS_BAR, PROGRESS_BAR_DISABLED_LEFT, "[Bar] Disabled Left End (or color for no images)", NULL, 0, 0 },
  283. { GWS_PROGRESS_BAR, PROGRESS_BAR_DISABLED_RIGHT, "[Bar] Disabled Right End", NULL, 0, 0 },
  284. { GWS_PROGRESS_BAR, PROGRESS_BAR_DISABLED_CENTER, "[Bar] Disabled Repeating Center End", NULL, 0, 0 },
  285. { GWS_PROGRESS_BAR, PROGRESS_BAR_DISABLED_SMALL_CENTER, "[Bar] Disabled Small Repeating Center", NULL, 0, 0 },
  286. { GWS_PROGRESS_BAR, PROGRESS_BAR_DISABLED_BAR_LEFT, "[Bar] Disabled Fill Bar Left End (or color for no images)", NULL, 0, 0 },
  287. { GWS_PROGRESS_BAR, PROGRESS_BAR_DISABLED_BAR_RIGHT, "[Bar] Disabled Fill Bar Right End", NULL, 0, 0 },
  288. { GWS_PROGRESS_BAR, PROGRESS_BAR_DISABLED_BAR_CENTER, "[Bar] Disabled Fill Bar Repeating Center", NULL, 0, 0 },
  289. { GWS_PROGRESS_BAR, PROGRESS_BAR_DISABLED_BAR_SMALL_CENTER, "[Bar] Disabled Fill Bar Small Repeating Center", NULL, 0, 0 },
  290. { GWS_PROGRESS_BAR, PROGRESS_BAR_HILITE_LEFT, "[Bar] Hilite Left End (or color for no images)", NULL, 0, 0 },
  291. { GWS_PROGRESS_BAR, PROGRESS_BAR_HILITE_RIGHT, "[Bar] Hilite Right End", NULL, 0, 0 },
  292. { GWS_PROGRESS_BAR, PROGRESS_BAR_HILITE_CENTER, "[Bar] Hilite Repeating Center End", NULL, 0, 0 },
  293. { GWS_PROGRESS_BAR, PROGRESS_BAR_HILITE_SMALL_CENTER, "[Bar] Hilite Small Repeating Center", NULL, 0, 0 },
  294. { GWS_PROGRESS_BAR, PROGRESS_BAR_HILITE_BAR_LEFT, "[Bar] Hilite Fill Bar Left End (or color for no images)", NULL, 0, 0 },
  295. { GWS_PROGRESS_BAR, PROGRESS_BAR_HILITE_BAR_RIGHT, "[Bar] Hilite Fill Bar Right End", NULL, 0, 0 },
  296. { GWS_PROGRESS_BAR, PROGRESS_BAR_HILITE_BAR_CENTER, "[Bar] Hilite Fill Bar Repeating Center", NULL, 0, 0 },
  297. { GWS_PROGRESS_BAR, PROGRESS_BAR_HILITE_BAR_SMALL_CENTER, "[Bar] Hilite Fill Bar Small Repeating Center", NULL, 0, 0 },
  298. { GWS_STATIC_TEXT, STATIC_TEXT_ENABLED, "[Static Text] Enabled", NULL, 0, 0 },
  299. { GWS_STATIC_TEXT, STATIC_TEXT_DISABLED, "[Static Text] Disabled", NULL, 0, 0 },
  300. { GWS_STATIC_TEXT, STATIC_TEXT_HILITE, "[Static Text] Hilite", NULL, 0, 0 },
  301. { GWS_ENTRY_FIELD, TEXT_ENTRY_ENABLED_LEFT, "[Text Entry] Enabled Left End (Or colors for no image)", NULL, 0, 0 },
  302. { GWS_ENTRY_FIELD, TEXT_ENTRY_ENABLED_RIGHT, "[Text Entry] Enabled Right End", NULL, 0, 0 },
  303. { GWS_ENTRY_FIELD, TEXT_ENTRY_ENABLED_CENTER, "[Text Entry] Enabled Repeating Center", NULL, 0, 0 },
  304. { GWS_ENTRY_FIELD, TEXT_ENTRY_ENABLED_SMALL_CENTER, "[Text Entry] Enabled Small Repeating Center", NULL, 0, 0 },
  305. { GWS_ENTRY_FIELD, TEXT_ENTRY_DISABLED_LEFT, "[Text Entry] Disabled Left End (Or colors for no image)", NULL, 0, 0 },
  306. { GWS_ENTRY_FIELD, TEXT_ENTRY_DISABLED_RIGHT, "[Text Entry] Disabled Right End", NULL, 0, 0 },
  307. { GWS_ENTRY_FIELD, TEXT_ENTRY_DISABLED_CENTER, "[Text Entry] Disabled Repeating Center", NULL, 0, 0 },
  308. { GWS_ENTRY_FIELD, TEXT_ENTRY_DISABLED_SMALL_CENTER, "[Text Entry] Disabled Small Repeating Center", NULL, 0, 0 },
  309. { GWS_ENTRY_FIELD, TEXT_ENTRY_HILITE_LEFT, "[Text Entry] Hilite Left End (Or colors for no image)", NULL, 0, 0 },
  310. { GWS_ENTRY_FIELD, TEXT_ENTRY_HILITE_RIGHT, "[Text Entry] Hilite Right End", NULL, 0, 0 },
  311. { GWS_ENTRY_FIELD, TEXT_ENTRY_HILITE_CENTER, "[Text Entry] Hilite Repeating Center", NULL, 0, 0 },
  312. { GWS_ENTRY_FIELD, TEXT_ENTRY_HILITE_SMALL_CENTER, "[Text Entry] Hilite Small Repeating Center", NULL, 0, 0 },
  313. { GWS_TAB_CONTROL, TC_TAB_0_ENABLED, "[Tab Control] Tab 0 Enabled", NULL, 0, 0 },
  314. { GWS_TAB_CONTROL, TC_TAB_0_DISABLED, "[Tab Control] Tab 0 Disabled", NULL, 0, 0 },
  315. { GWS_TAB_CONTROL, TC_TAB_0_HILITE, "[Tab Control] Tab 0 Hilite", NULL, 0, 0 },
  316. { GWS_TAB_CONTROL, TC_TAB_1_ENABLED, "[Tab Control] Tab 1 Enabled", NULL, 0, 0 },
  317. { GWS_TAB_CONTROL, TC_TAB_1_DISABLED, "[Tab Control] Tab 1 Disabled", NULL, 0, 0 },
  318. { GWS_TAB_CONTROL, TC_TAB_1_HILITE, "[Tab Control] Tab 1 Hilite", NULL, 0, 0 },
  319. { GWS_TAB_CONTROL, TC_TAB_2_ENABLED, "[Tab Control] Tab 2 Enabled", NULL, 0, 0 },
  320. { GWS_TAB_CONTROL, TC_TAB_2_DISABLED, "[Tab Control] Tab 2 Disabled", NULL, 0, 0 },
  321. { GWS_TAB_CONTROL, TC_TAB_2_HILITE, "[Tab Control] Tab 2 Hilite", NULL, 0, 0 },
  322. { GWS_TAB_CONTROL, TC_TAB_3_ENABLED, "[Tab Control] Tab 3 Enabled", NULL, 0, 0 },
  323. { GWS_TAB_CONTROL, TC_TAB_3_DISABLED, "[Tab Control] Tab 3 Disabled", NULL, 0, 0 },
  324. { GWS_TAB_CONTROL, TC_TAB_3_HILITE, "[Tab Control] Tab 3 Hilite", NULL, 0, 0 },
  325. { GWS_TAB_CONTROL, TC_TAB_4_ENABLED, "[Tab Control] Tab 4 Enabled", NULL, 0, 0 },
  326. { GWS_TAB_CONTROL, TC_TAB_4_DISABLED, "[Tab Control] Tab 4 Disabled", NULL, 0, 0 },
  327. { GWS_TAB_CONTROL, TC_TAB_4_HILITE, "[Tab Control] Tab 4 Hilite", NULL, 0, 0 },
  328. { GWS_TAB_CONTROL, TC_TAB_5_ENABLED, "[Tab Control] Tab 5 Enabled", NULL, 0, 0 },
  329. { GWS_TAB_CONTROL, TC_TAB_5_DISABLED, "[Tab Control] Tab 5 Disabled", NULL, 0, 0 },
  330. { GWS_TAB_CONTROL, TC_TAB_5_HILITE, "[Tab Control] Tab 5 Hilite", NULL, 0, 0 },
  331. { GWS_TAB_CONTROL, TC_TAB_6_ENABLED, "[Tab Control] Tab 6 Enabled", NULL, 0, 0 },
  332. { GWS_TAB_CONTROL, TC_TAB_6_DISABLED, "[Tab Control] Tab 6 Disabled", NULL, 0, 0 },
  333. { GWS_TAB_CONTROL, TC_TAB_6_HILITE, "[Tab Control] Tab 6 Hilite", NULL, 0, 0 },
  334. { GWS_TAB_CONTROL, TC_TAB_7_ENABLED, "[Tab Control] Tab 7 Enabled", NULL, 0, 0 },
  335. { GWS_TAB_CONTROL, TC_TAB_7_DISABLED, "[Tab Control] Tab 7 Disabled", NULL, 0, 0 },
  336. { GWS_TAB_CONTROL, TC_TAB_7_HILITE, "[Tab Control] Tab 7 Hilite", NULL, 0, 0 },
  337. { GWS_TAB_CONTROL, TAB_CONTROL_ENABLED, "[Tab Control] Background Surface Enabled", NULL, 0, 0 },
  338. { GWS_TAB_CONTROL, TAB_CONTROL_DISABLED, "[Tab Control] Background Surface Disabled", NULL, 0, 0 },
  339. { GWS_TAB_CONTROL, TAB_CONTROL_HILITE, "[Tab Control] Background Surface Hilite", NULL, 0, 0 },
  340. { GWS_USER_WINDOW, GENERIC_ENABLED, "[User]Enabled Surface", NULL, 0, 0 },
  341. { GWS_USER_WINDOW, GENERIC_DISABLED, "[User]Disabled Surface", NULL, 0, 0 },
  342. { GWS_USER_WINDOW, GENERIC_HILITE, "[User]Hilite Surface", NULL, 0, 0 },
  343. { 0, IDENTIFIER_INVALID, NULL, NULL, 0, 0 } // keep this last!
  344. };
  345. // PUBLIC DATA ////////////////////////////////////////////////////////////////
  346. // PRIVATE PROTOTYPES /////////////////////////////////////////////////////////
  347. // PRIVATE FUNCTIONS //////////////////////////////////////////////////////////
  348. ///////////////////////////////////////////////////////////////////////////////
  349. // PUBLIC FUNCTIONS ///////////////////////////////////////////////////////////
  350. ///////////////////////////////////////////////////////////////////////////////
  351. // InitPropertiesDialog =======================================================
  352. /** Bring up the correct properties dialog for the window in question */
  353. //=============================================================================
  354. void InitPropertiesDialog( GameWindow *window, Int x, Int y )
  355. {
  356. HWND dialog;
  357. POINT screen;
  358. // sanity
  359. if( window == NULL )
  360. return;
  361. // translate client position to screen coords of menu
  362. screen.x = x;
  363. screen.y = y;
  364. ClientToScreen( TheEditWindow->getWindowHandle(), &screen );
  365. // bring up the right dialog
  366. if( BitTest( window->winGetStyle(), GWS_PUSH_BUTTON ) )
  367. dialog = InitPushButtonPropertiesDialog( window );
  368. else if( BitTest( window->winGetStyle(), GWS_RADIO_BUTTON ) )
  369. dialog = InitRadioButtonPropertiesDialog( window );
  370. else if( BitTest( window->winGetStyle(), GWS_TAB_CONTROL ) )
  371. dialog = InitTabControlPropertiesDialog( window );
  372. else if( BitTest( window->winGetStyle(), GWS_CHECK_BOX ) )
  373. dialog = InitCheckBoxPropertiesDialog( window );
  374. else if( BitTest( window->winGetStyle(), GWS_SCROLL_LISTBOX ) )
  375. dialog = InitListboxPropertiesDialog( window );
  376. else if( BitTest( window->winGetStyle(), GWS_PROGRESS_BAR ) )
  377. dialog = InitProgressBarPropertiesDialog( window );
  378. else if( BitTest( window->winGetStyle(), GWS_STATIC_TEXT ) )
  379. dialog = InitStaticTextPropertiesDialog( window );
  380. else if( BitTest( window->winGetStyle(), GWS_ENTRY_FIELD ) )
  381. dialog = InitTextEntryPropertiesDialog( window );
  382. else if( BitTest( window->winGetStyle(), GWS_ALL_SLIDER ) )
  383. dialog = InitSliderPropertiesDialog( window );
  384. else if( BitTest( window->winGetStyle(), GWS_COMBO_BOX ) )
  385. dialog = InitComboBoxPropertiesDialog( window );
  386. else
  387. dialog = InitUserWinPropertiesDialog( window );
  388. // sanity check dialog
  389. if( dialog == NULL )
  390. {
  391. DEBUG_LOG(( "Error creating properties dialog\n" ));
  392. MessageBox( TheEditor->getWindowHandle(), "Error creating property dialog!", "Error", MB_OK );
  393. assert( 0 );
  394. return;
  395. } // end if
  396. // save the window we're working with
  397. TheEditor->setPropertyTarget( window );
  398. //
  399. // position the dialog with the upper left at the mouse position or as
  400. // close as possible
  401. //
  402. PositionWindowOnScreen( dialog, screen.x, screen.y );
  403. } // end InitPropertiesDialog
  404. // LoadFontCombo ==============================================================
  405. /** Load the font combo with fonts currently available */
  406. //=============================================================================
  407. void LoadFontCombo( HWND comboBox, GameFont *currFont )
  408. {
  409. GameFont *font;
  410. char buffer[ 256 ];
  411. Int index;
  412. // sanity
  413. if( comboBox == NULL || TheFontLibrary == NULL )
  414. return;
  415. // reset the combo box
  416. //
  417. // load string representations of each font and attach the font data
  418. // pointer to the entry
  419. //
  420. for( font = TheFontLibrary->firstFont();
  421. font;
  422. font = TheFontLibrary->nextFont( font ) )
  423. {
  424. // construct name
  425. if( font->bold )
  426. sprintf( buffer, "%s - Size: %d [Bold]", font->nameString.str(), font->pointSize );
  427. else
  428. sprintf( buffer, "%s - Size: %d", font->nameString.str(), font->pointSize );
  429. // add to combo box
  430. index = SendMessage( comboBox, CB_ADDSTRING, 0, (LPARAM)buffer );
  431. // attach pointer to font at combo index
  432. SendMessage( comboBox, CB_SETITEMDATA, index, (DWORD)font );
  433. } // end for font
  434. // add a "[None]" at the top index
  435. SendMessage( comboBox, CB_INSERTSTRING, 0, (LPARAM)"[None]" );
  436. // if no font select the top index
  437. if( currFont == NULL )
  438. {
  439. SendMessage( comboBox, CB_SETCURSEL, 0, 0 );
  440. } // end if
  441. else
  442. {
  443. Int count;
  444. // how many entries in the combo box
  445. count = SendMessage( comboBox, CB_GETCOUNT, 0, 0 );
  446. // find the entry with the matching item data and select it
  447. for( Int i = 0; i < count; i++ )
  448. {
  449. // get the item data here
  450. font = (GameFont *)SendMessage( comboBox, CB_GETITEMDATA, i, 0 );
  451. if( currFont == font )
  452. {
  453. // select this item in the combo box
  454. SendMessage( comboBox, CB_SETCURSEL, i, 0 );
  455. break; // exit for i
  456. } // end if
  457. } // end for i
  458. } // end else
  459. } // end LoadFontCombo
  460. // GetSelectedFontFromCombo ===================================================
  461. /** Based on the combo box selection return the game font associated
  462. * with that selection */
  463. //=============================================================================
  464. GameFont *GetSelectedFontFromCombo( HWND combo )
  465. {
  466. // santiy
  467. if( combo == NULL )
  468. return NULL;
  469. // get the selected item
  470. Int selected;
  471. selected = SendMessage( combo, CB_GETCURSEL, 0, 0 );
  472. // index 0 is the "none" selector
  473. if( selected == 0 )
  474. return NULL;
  475. // get the font from the selected item
  476. return (GameFont *)SendMessage( combo, CB_GETITEMDATA, selected, 0 );
  477. } // end GetSelectedFontFromCombo
  478. // saveFontSelection ==========================================================
  479. /** Save the font from the currently selected item in the font dialog */
  480. //=============================================================================
  481. static void saveFontSelection( HWND combo, GameWindow *window )
  482. {
  483. GameFont *font;
  484. // sanity
  485. if( combo == NULL || window == NULL )
  486. return;
  487. // get the font
  488. font = GetSelectedFontFromCombo( combo );
  489. window->winSetFont( font );
  490. } // end saveFontSelection
  491. // saveHeaderSelection ========================================================
  492. /** Save the Header from the currently selected item in the font dialog */
  493. //=============================================================================
  494. static void saveHeaderSelection( HWND comboBox, GameWindow *window )
  495. {
  496. Int selected;
  497. char buffer[ 512 ];
  498. // santiy
  499. if( comboBox == NULL )
  500. return;
  501. // get the selected index
  502. selected = SendMessage( comboBox, CB_GETCURSEL, 0, 0 );
  503. // do nothing if index 0 is selected (contains the string "[NONE]")
  504. if( selected == CB_ERR || selected == 0 )
  505. window->winGetInstanceData()->m_headerTemplateName.clear();
  506. // get the text of the selected item
  507. SendMessage( comboBox, CB_GETLBTEXT, selected, (LPARAM)buffer );
  508. // return the image loc that matches the string
  509. window->winGetInstanceData()->m_headerTemplateName.set(buffer);
  510. } // end ComboBoxSelectionToImage
  511. // loadTooltipTextLabel ==============================================================
  512. /** Load the edit control with the window text label */
  513. //=============================================================================
  514. static void loadTooltipTextLabel( HWND edit, GameWindow *window )
  515. {
  516. // sanity
  517. if( edit == NULL || window == NULL )
  518. return;
  519. // limit the text entry field in size
  520. SendMessage( edit, EM_LIMITTEXT, MAX_TEXT_LABEL - 1, 0 );
  521. // load the text
  522. WinInstanceData *instData = window->winGetInstanceData();
  523. SendMessage( edit, WM_SETTEXT, 0, (LPARAM)instData->m_tooltipString.str() );
  524. } // end loadTooltipTextLabel
  525. // loadTooltipDelayTextLabel ==============================================================
  526. /** Load the edit control with the window text label */
  527. //=============================================================================
  528. static void loadTooltipDelayTextLabel( HWND dialog, HWND edit, GameWindow *window )
  529. {
  530. // sanity
  531. if( dialog == NULL || edit == NULL || window == NULL )
  532. return;
  533. // limit the text entry field in size
  534. SendMessage( edit, EM_LIMITTEXT, 6, 0 );
  535. // load the text
  536. // WinInstanceData *instData = window->winGetInstanceData();
  537. // SetDlgItemInt( dialog, edit, instData->m_tooltipDelay, TRUE );
  538. } // end loadTooltipDelayTextLabel
  539. // saveTooltipTextLabel ==============================================================
  540. /** Save the text label entry */
  541. //=============================================================================
  542. static void saveTooltipTextLabel( HWND edit, GameWindow *window )
  543. {
  544. // sanity
  545. if( edit == NULL || window == NULL )
  546. return;
  547. // get the text from the edit control into the label buffer
  548. char buffer[ MAX_TEXT_LABEL ];
  549. WinInstanceData *instData = window->winGetInstanceData();
  550. SendMessage( edit, WM_GETTEXT, MAX_TEXT_LABEL - 1, (LPARAM)buffer );
  551. instData->m_tooltipString.set(buffer);
  552. instData->setTooltipText(TheGameText->fetch(buffer) );
  553. } // end saveTooltipTextLabel
  554. // saveTooltipTextLabel ==============================================================
  555. /** Save the text label entry */
  556. //=============================================================================
  557. static void saveTooltipDelayTextLabel(HWND dialog, HWND edit, GameWindow *window )
  558. {
  559. // sanity
  560. if( dialog == NULL || edit == NULL || window == NULL )
  561. return;
  562. // WinInstanceData *instData = window->winGetInstanceData();
  563. // instData->m_tooltipDelay = GetDlgItemInt( dialog, edit, NULL, TRUE );
  564. } // end saveTooltipDelayTextLabel
  565. // loadTextLabel ==============================================================
  566. /** Load the edit control with the window text label */
  567. //=============================================================================
  568. static void loadTextLabel( HWND edit, GameWindow *window )
  569. {
  570. // sanity
  571. if( edit == NULL || window == NULL )
  572. return;
  573. // limit the text entry field in size
  574. SendMessage( edit, EM_LIMITTEXT, MAX_TEXT_LABEL - 1, 0 );
  575. // load the text
  576. WinInstanceData *instData = window->winGetInstanceData();
  577. SendMessage( edit, WM_SETTEXT, 0, (LPARAM)instData->m_textLabelString.str() );
  578. } // end loadTextLabel
  579. // saveTextLabel ==============================================================
  580. /** Save the text label entry */
  581. //=============================================================================
  582. static void saveTextLabel( HWND edit, GameWindow *window )
  583. {
  584. // sanity
  585. if( edit == NULL || window == NULL )
  586. return;
  587. // get the text from the edit control into the label buffer
  588. char buffer[ MAX_TEXT_LABEL ];
  589. WinInstanceData *instData = window->winGetInstanceData();
  590. SendMessage( edit, WM_GETTEXT, MAX_TEXT_LABEL - 1, (LPARAM)buffer );
  591. instData->m_textLabelString.set( buffer );
  592. //
  593. // set the text into the window so we can see it
  594. // The localization String Manger is here
  595. //
  596. UnicodeString text;
  597. text = TheGameText->fetch( (char *)instData->m_textLabelString.str()); //TheWindowManager->winTextLabelToText( instData->m_textLabelString );
  598. UnsignedInt style = window->winGetStyle();
  599. if( BitTest( style, GWS_PUSH_BUTTON ) )
  600. GadgetButtonSetText( window, text );
  601. else if( BitTest( style, GWS_CHECK_BOX ) )
  602. GadgetCheckBoxSetText( window, text );
  603. else if( BitTest( style, GWS_RADIO_BUTTON ) )
  604. GadgetRadioSetText( window, text );
  605. else if( BitTest( style, GWS_STATIC_TEXT ) )
  606. GadgetStaticTextSetText( window, text );
  607. else if( BitTest( style, GWS_ENTRY_FIELD ) )
  608. GadgetTextEntrySetText( window, text );
  609. else
  610. window->winSetText( text );
  611. } // end saveTextLavel
  612. // LoadTextStateCombo =========================================================
  613. /** Load the text state combo */
  614. //=============================================================================
  615. void LoadTextStateCombo( HWND comboBox,
  616. Color enabled, Color enabledBorder,
  617. Color disabled, Color disabledBorder,
  618. Color hilite, Color hiliteBorder )
  619. {
  620. // sanity
  621. if( comboBox == NULL )
  622. return;
  623. //
  624. // add the three text states to the combo box and put the draw data colors
  625. // as the user data for each combo index
  626. //
  627. enabledTextIndex = SendMessage( comboBox, CB_INSERTSTRING, -1, (LPARAM)"Enabled Text" );
  628. disabledTextIndex = SendMessage( comboBox, CB_INSERTSTRING, -1, (LPARAM)"Disabled Text" );
  629. hiliteTextIndex = SendMessage( comboBox, CB_INSERTSTRING, -1, (LPARAM)"Hilite Text" );
  630. textDrawData[ enabledTextIndex ].color = enabled;
  631. textDrawData[ enabledTextIndex ].borderColor = enabledBorder;
  632. textDrawData[ disabledTextIndex ].color = disabled;
  633. textDrawData[ disabledTextIndex ].borderColor = disabledBorder;
  634. textDrawData[ hiliteTextIndex ].color = hilite;
  635. textDrawData[ hiliteTextIndex ].borderColor = hiliteBorder;
  636. // select the enabled state
  637. currTextIndex = 0;
  638. SendMessage( comboBox, CB_SETCURSEL, currTextIndex, 0 );
  639. } // end LoadTextStateCombo
  640. // LoadStateCombo =============================================================
  641. /** Load the state combo box passed in based on the window type
  642. * provided. This will look through the image and color table for
  643. * which state entries to add as strings to the combobox */
  644. //=============================================================================
  645. void LoadStateCombo( UnsignedInt style, HWND comboBox )
  646. {
  647. Int index;
  648. // sanity
  649. if( comboBox == NULL )
  650. return;
  651. // load the combo box with matching bit fields
  652. ImageAndColorInfo *entry;
  653. for( entry = imageAndColorTable; entry->stateName; entry++ )
  654. {
  655. if( BitTest( entry->windowType, style ) )
  656. {
  657. // add string
  658. index = SendMessage( comboBox, CB_ADDSTRING, 0, (LPARAM)entry->stateName );
  659. // set the state identifier as the item data of this entry
  660. SendMessage( comboBox, CB_SETITEMDATA, index, entry->stateID );
  661. } // end if
  662. } // end for entry
  663. } // end LoadStateCombo
  664. // CommonDialogInitialize =====================================================
  665. /** Called from all dialog initializations */
  666. //=============================================================================
  667. void CommonDialogInitialize( GameWindow *window, HWND dialog )
  668. {
  669. WinInstanceData *instData;
  670. // sanity
  671. if( window == NULL || dialog == NULL )
  672. return;
  673. // get instance data
  674. instData = window->winGetInstanceData();
  675. // populate common properties
  676. if( BitTest( window->winGetStatus(), WIN_STATUS_ENABLED ) )
  677. CheckDlgButton( dialog, CHECK_ENABLED, BST_CHECKED );
  678. if( BitTest( window->winGetStatus(), WIN_STATUS_DRAGABLE ) )
  679. CheckDlgButton( dialog, CHECK_DRAGABLE, BST_CHECKED );
  680. if( BitTest( window->winGetStatus(), WIN_STATUS_HIDDEN ) )
  681. CheckDlgButton( dialog, CHECK_HIDDEN, BST_CHECKED );
  682. if( BitTest( window->winGetStatus(), WIN_STATUS_NO_INPUT ) )
  683. CheckDlgButton( dialog, CHECK_NO_INPUT, BST_CHECKED );
  684. if( BitTest( window->winGetStatus(), WIN_STATUS_NO_FOCUS ) )
  685. CheckDlgButton( dialog, CHECK_NO_FOCUS, BST_CHECKED );
  686. if( BitTest( window->winGetStatus(), WIN_STATUS_BORDER ) )
  687. CheckDlgButton( dialog, CHECK_BORDER, BST_CHECKED );
  688. if( BitTest( window->winGetStatus(), WIN_STATUS_IMAGE ) )
  689. CheckDlgButton( dialog, CHECK_IMAGE, BST_CHECKED );
  690. if( BitTest( window->winGetStatus(), WIN_STATUS_SEE_THRU ) )
  691. CheckDlgButton( dialog, CHECK_SEE_THRU, BST_CHECKED );
  692. if( BitTest( window->winGetStatus(), WIN_STATUS_WRAP_CENTERED ) )
  693. CheckDlgButton( dialog, CHECK_WRAP_CENTERED, BST_CHECKED );
  694. if( BitTest( window->winGetStatus(), WIN_STATUS_CHECK_LIKE ) )
  695. CheckDlgButton( dialog, CHECK_CHECK_LIKE, BST_CHECKED );
  696. //
  697. // limit the window name box to the max name size minus some breathing
  698. // room for the filename
  699. //
  700. SendMessage( GetDlgItem( dialog, EDIT_NAME ), EM_SETLIMITTEXT,
  701. MAX_WINDOW_NAME_LEN - 16, 0 );
  702. // set the text explaining the name size limit to the user
  703. char buffer[ 128 ];
  704. sprintf( buffer, "Name length + layout filename length (.wnd) must not exceed %d characters.",
  705. MAX_WINDOW_NAME_LEN );
  706. SetDlgItemText( dialog, STATIC_NAME_MAX, buffer );
  707. // set name
  708. SetDlgItemText( dialog, EDIT_NAME, instData->m_decoratedNameString.str() );
  709. // load listbox with image names
  710. LoadImageListComboBox( GetDlgItem( dialog, COMBO_IMAGE ) );
  711. // load listbox with image names
  712. LoadHeaderTemplateListComboBox( GetDlgItem( dialog, COMBO_HEADER ), instData->m_headerTemplateName);
  713. // load the combo box for available properties
  714. LoadStateCombo( window->winGetStyle(), GetDlgItem( dialog, COMBO_STATE ) );
  715. // load the text state combo box
  716. LoadTextStateCombo( GetDlgItem( dialog, COMBO_TEXT_STATE ),
  717. instData->m_enabledText.color,
  718. instData->m_enabledText.borderColor,
  719. instData->m_disabledText.color,
  720. instData->m_disabledText.borderColor,
  721. instData->m_hiliteText.color,
  722. instData->m_hiliteText.borderColor );
  723. // load the font combo if present
  724. HWND combo = GetDlgItem( dialog, COMBO_FONT );
  725. if( combo )
  726. LoadFontCombo( combo, window->winGetFont() );
  727. // load text edit control if present
  728. HWND edit = GetDlgItem( dialog, EDIT_TEXT_LABEL );
  729. if( edit )
  730. loadTextLabel( edit, window );
  731. // load text edit control if present
  732. HWND tooltipEdit = GetDlgItem( dialog, EDIT_TOOLTIP_TEXT );
  733. if( tooltipEdit )
  734. loadTooltipTextLabel( tooltipEdit, window );
  735. // load text edit control if present
  736. HWND tooltipDelay = GetDlgItem( dialog, EDIT_TOOLTIP_DELAY );
  737. if( tooltipDelay )
  738. SetDlgItemInt( dialog, EDIT_TOOLTIP_DELAY, instData->m_tooltipDelay, TRUE );
  739. } // end CommonDialogInitialize
  740. // validateName ===============================================================
  741. /** Validate a name before saving it into a window. All window names
  742. * loaded from the current layout must have unique names */
  743. //=============================================================================
  744. static Bool validateName( GameWindow *root, GameWindow *exception, char *name )
  745. {
  746. // end recursion, note that "" is always a valid name
  747. if( root == NULL || name == NULL || strlen( name ) == 0 )
  748. return TRUE;
  749. // a name cannot have a colon in it cause we use it for decoration
  750. if( strchr( name, ':' ) != NULL )
  751. {
  752. char buffer[ 1024 ];
  753. sprintf( buffer, "Names cannot have any colons (:) in them ... sorry." );
  754. MessageBox( TheEditor->getWindowHandle(), buffer, "Illegal Character", MB_OK );
  755. return FALSE;
  756. } // end if
  757. // if this root window is not the exception window compare name
  758. if( root != exception )
  759. {
  760. WinInstanceData *instData = root->winGetInstanceData();
  761. if( strcmp( instData->m_decoratedNameString.str(), name ) == 0 )
  762. {
  763. char buffer[ 1024 ];
  764. sprintf( buffer, "Another window already has the name '%s'. Duplicates are not allowed, sorry.", name );
  765. MessageBox( TheEditor->getWindowHandle(), buffer, "Duplicate Name", MB_OK );
  766. return FALSE;
  767. } // end if
  768. } // end if
  769. // check our children
  770. GameWindow *child;
  771. for( child = root->winGetChild(); child; child = child->winGetNext() )
  772. if( validateName( child, exception, name ) == FALSE )
  773. return FALSE;
  774. // check the next window in the list
  775. return validateName( root->winGetNext(), exception, name );
  776. } // end validateName
  777. // adjustGadgetDrawMethods ====================================================
  778. /** Based on the WIN_STATUS_IMAGE, set the draw callbacks to the
  779. * functions that will either draw images or that will draw plain */
  780. //=============================================================================
  781. static void adjustGadgetDrawMethods( Bool useImages, GameWindow *window )
  782. {
  783. // sanity
  784. if( window == NULL )
  785. return;
  786. // get style of window
  787. UnsignedInt style = window->winGetStyle();
  788. if( TheEditor->windowIsGadget( window ) )//The below only applies to gadgets.
  789. {
  790. // check image or normal
  791. if( useImages )
  792. {
  793. if( BitTest( style, GWS_PUSH_BUTTON ) )
  794. window->winSetDrawFunc( TheWindowManager->getPushButtonImageDrawFunc() );
  795. else if( BitTest( style, GWS_RADIO_BUTTON ) )
  796. window->winSetDrawFunc( TheWindowManager->getRadioButtonImageDrawFunc() );
  797. else if( BitTest( style, GWS_TAB_CONTROL ) )
  798. window->winSetDrawFunc( TheWindowManager->getTabControlImageDrawFunc() );
  799. else if( BitTest( style, GWS_CHECK_BOX ) )
  800. window->winSetDrawFunc( TheWindowManager->getCheckBoxImageDrawFunc() );
  801. else if( BitTest( style, GWS_SCROLL_LISTBOX ) )
  802. window->winSetDrawFunc( TheWindowManager->getListBoxImageDrawFunc() );
  803. else if( BitTest( style, GWS_COMBO_BOX ) )
  804. window->winSetDrawFunc( TheWindowManager->getComboBoxImageDrawFunc() );
  805. else if( BitTest( style, GWS_PROGRESS_BAR ) )
  806. window->winSetDrawFunc( TheWindowManager->getProgressBarImageDrawFunc() );
  807. else if( BitTest( style, GWS_HORZ_SLIDER ) )
  808. window->winSetDrawFunc( TheWindowManager->getHorizontalSliderImageDrawFunc() );
  809. else if( BitTest( style, GWS_VERT_SLIDER ) )
  810. window->winSetDrawFunc( TheWindowManager->getVerticalSliderImageDrawFunc() );
  811. else if( BitTest( style, GWS_STATIC_TEXT ) )
  812. window->winSetDrawFunc( TheWindowManager->getStaticTextImageDrawFunc() );
  813. else if( BitTest( style, GWS_ENTRY_FIELD ) )
  814. window->winSetDrawFunc( TheWindowManager->getTextEntryImageDrawFunc() );
  815. else
  816. {
  817. DEBUG_LOG(( "Unable to adjust draw method, undefined gadget\n" ));
  818. assert( 0 );
  819. return;
  820. } // end else
  821. // set the image status bit
  822. window->winSetStatus( WIN_STATUS_IMAGE );
  823. } // end if, image set
  824. else
  825. {
  826. if( BitTest( style, GWS_PUSH_BUTTON ) )
  827. window->winSetDrawFunc( TheWindowManager->getPushButtonDrawFunc() );
  828. else if( BitTest( style, GWS_RADIO_BUTTON ) )
  829. window->winSetDrawFunc( TheWindowManager->getRadioButtonDrawFunc() );
  830. else if( BitTest( style, GWS_TAB_CONTROL ) )
  831. window->winSetDrawFunc( TheWindowManager->getTabControlDrawFunc() );
  832. else if( BitTest( style, GWS_CHECK_BOX ) )
  833. window->winSetDrawFunc( TheWindowManager->getCheckBoxDrawFunc() );
  834. else if( BitTest( style, GWS_SCROLL_LISTBOX ) )
  835. window->winSetDrawFunc( TheWindowManager->getListBoxDrawFunc() );
  836. else if( BitTest( style, GWS_COMBO_BOX ) )
  837. window->winSetDrawFunc( TheWindowManager->getComboBoxDrawFunc() );
  838. else if( BitTest( style, GWS_PROGRESS_BAR ) )
  839. window->winSetDrawFunc( TheWindowManager->getProgressBarDrawFunc() );
  840. else if( BitTest( style, GWS_HORZ_SLIDER ) )
  841. window->winSetDrawFunc( TheWindowManager->getHorizontalSliderDrawFunc() );
  842. else if( BitTest( style, GWS_VERT_SLIDER ) )
  843. window->winSetDrawFunc( TheWindowManager->getVerticalSliderDrawFunc() );
  844. else if( BitTest( style, GWS_STATIC_TEXT ) )
  845. window->winSetDrawFunc( TheWindowManager->getStaticTextDrawFunc() );
  846. else if( BitTest( style, GWS_ENTRY_FIELD ) )
  847. window->winSetDrawFunc( TheWindowManager->getTextEntryDrawFunc() );
  848. else
  849. {
  850. DEBUG_LOG(( "Unable to adjust draw method, undefined gadget\n" ));
  851. assert( 0 );
  852. return;
  853. } // end else
  854. // clear the image bit
  855. window->winClearStatus( WIN_STATUS_IMAGE );
  856. } // end else, image not set
  857. }//end if window is gadget
  858. // adjust any child gadgets
  859. GameWindow *child;
  860. for( child = window->winGetChild(); child; child = child->winGetNext() )
  861. adjustGadgetDrawMethods( useImages, child );
  862. } // end adjustGadgetDrawMethods
  863. // SaveCommonDialogProperties =================================================
  864. /** Save properties common on all dialogs for all windows */
  865. //=============================================================================
  866. Bool SaveCommonDialogProperties( HWND dialog, GameWindow *window )
  867. {
  868. UnsignedInt bit;
  869. // sanity
  870. if( dialog == NULL || window == NULL )
  871. return FALSE;
  872. // get name in the name edit box
  873. char name[ MAX_WINDOW_NAME_LEN ];
  874. strcpy( name, "" );
  875. GetDlgItemText( dialog, EDIT_NAME, name, MAX_WINDOW_NAME_LEN );
  876. if( validateName( TheWindowManager->winGetWindowList(),
  877. window, name ) == FALSE )
  878. return FALSE;
  879. // assign the name to the window
  880. WinInstanceData *instData = window->winGetInstanceData();
  881. instData->m_decoratedNameString = name;
  882. // notify the hierarchy view of the change in window name
  883. TheHierarchyView->updateWindowName( window );
  884. // save bits
  885. window->winEnable( IsDlgButtonChecked( dialog, CHECK_ENABLED ) );
  886. bit = WIN_STATUS_DRAGABLE;
  887. window->winClearStatus( bit );
  888. if( IsDlgButtonChecked( dialog, CHECK_DRAGABLE ) )
  889. window->winSetStatus( bit );
  890. bit = WIN_STATUS_HIDDEN;
  891. window->winClearStatus( bit );
  892. if( IsDlgButtonChecked( dialog, CHECK_HIDDEN ) )
  893. window->winSetStatus( bit );
  894. bit = WIN_STATUS_NO_INPUT;
  895. window->winClearStatus( bit );
  896. if( IsDlgButtonChecked( dialog, CHECK_NO_INPUT ) )
  897. window->winSetStatus( bit );
  898. bit = WIN_STATUS_NO_FOCUS;
  899. window->winClearStatus( bit );
  900. if( IsDlgButtonChecked( dialog, CHECK_NO_FOCUS ) )
  901. window->winSetStatus( bit );
  902. bit = WIN_STATUS_BORDER;
  903. window->winClearStatus( bit );
  904. if( IsDlgButtonChecked( dialog, CHECK_BORDER ) )
  905. window->winSetStatus( bit );
  906. bit = WIN_STATUS_IMAGE;
  907. window->winClearStatus( bit );
  908. if( IsDlgButtonChecked( dialog, CHECK_IMAGE ) )
  909. window->winSetStatus( bit );
  910. bit = WIN_STATUS_SEE_THRU;
  911. window->winClearStatus( bit );
  912. if( IsDlgButtonChecked( dialog, CHECK_SEE_THRU ) )
  913. window->winSetStatus( bit );
  914. bit = WIN_STATUS_WRAP_CENTERED;
  915. window->winClearStatus( bit );
  916. if( IsDlgButtonChecked( dialog, CHECK_WRAP_CENTERED ) )
  917. window->winSetStatus( bit );
  918. bit = WIN_STATUS_CHECK_LIKE;
  919. window->winClearStatus( bit );
  920. if( IsDlgButtonChecked( dialog, CHECK_CHECK_LIKE ) )
  921. window->winSetStatus( bit );
  922. //
  923. // adjust the window callbacks for gadgets based on image status
  924. // or not
  925. //
  926. if( TheEditor->windowIsGadget( window ) )
  927. adjustGadgetDrawMethods( BitTest( window->winGetStatus(), WIN_STATUS_IMAGE ),
  928. window );
  929. // save colors
  930. window->winSetEnabledTextColors( textDrawData[ enabledTextIndex ].color,
  931. textDrawData[ enabledTextIndex ].borderColor );
  932. window->winSetDisabledTextColors( textDrawData[ disabledTextIndex ].color,
  933. textDrawData[ disabledTextIndex ].borderColor );
  934. window->winSetHiliteTextColors( textDrawData[ hiliteTextIndex ].color,
  935. textDrawData[ hiliteTextIndex ].borderColor );
  936. // save font data if present
  937. HWND fontCombo = GetDlgItem( dialog, COMBO_FONT );
  938. if( fontCombo )
  939. saveFontSelection( fontCombo, window );
  940. // save text label data if present
  941. HWND editText = GetDlgItem( dialog, EDIT_TEXT_LABEL );
  942. if( editText )
  943. saveTextLabel( editText, window );
  944. // save text label data if present
  945. HWND editTooltipText = GetDlgItem( dialog, EDIT_TOOLTIP_TEXT );
  946. if( editTooltipText )
  947. saveTooltipTextLabel( editTooltipText, window );
  948. // save delay text label data if present
  949. HWND editTooltipDelayText = GetDlgItem( dialog, EDIT_TOOLTIP_DELAY );
  950. if( editTooltipDelayText )
  951. instData->m_tooltipDelay = GetDlgItemInt( dialog, EDIT_TOOLTIP_DELAY, NULL, TRUE );
  952. HWND headerCombo = GetDlgItem( dialog, COMBO_HEADER );
  953. if( headerCombo )
  954. saveHeaderSelection( headerCombo, window );
  955. // contents of the editor have now changed
  956. TheEditor->setUnsaved( TRUE );
  957. return TRUE;
  958. } // end SaveCommonDialogProperties
  959. // LoadImageListComboBox ======================================================
  960. /** Load a combo box with image names from the GUI image collection
  961. * including a [NONE] at the top that is selected */
  962. //=============================================================================
  963. void LoadImageListComboBox( HWND comboBox )
  964. {
  965. Image *image;
  966. // sanity
  967. if( comboBox == NULL )
  968. return;
  969. // clear the content of the box
  970. SendMessage( comboBox, CB_RESETCONTENT, 0, 0 );
  971. // load the combo box with string names from the GUI image collection
  972. for( image = TheMappedImageCollection->firstImage();
  973. image;
  974. image = TheMappedImageCollection->nextImage( image ) )
  975. {
  976. SendMessage( comboBox, CB_ADDSTRING, 0, (LPARAM)image->getName().str() );
  977. } // end for image
  978. // add a [NONE] at the top of the image lists
  979. SendMessage( comboBox, CB_INSERTSTRING, 0, (LPARAM)"[NONE]" );
  980. // select the [NONE] label
  981. SendMessage( comboBox, CB_SETCURSEL, 0, 0 );
  982. } // end LoadImageListComboBox
  983. // LoadHeaderTemplateListComboBox =============================================
  984. /** Load a combo box with header template names
  985. * including a [NONE] at the top that is selected */
  986. //=============================================================================
  987. void LoadHeaderTemplateListComboBox( HWND comboBox, AsciiString selected )
  988. {
  989. HeaderTemplate *ht;
  990. // sanity
  991. if( comboBox == NULL )
  992. return;
  993. // clear the content of the box
  994. SendMessage( comboBox, CB_RESETCONTENT, 0, 0 );
  995. // load the combo box with string names from the Header Templates
  996. for( ht = TheHeaderTemplateManager->getFirstHeader();
  997. ht;
  998. ht = TheHeaderTemplateManager->getNextHeader(ht) )
  999. {
  1000. SendMessage( comboBox, CB_ADDSTRING, 0, (LPARAM)ht->m_name.str());
  1001. } // end for image
  1002. // add a [NONE] at the top of the image lists
  1003. SendMessage( comboBox, CB_INSERTSTRING, 0, (LPARAM)"[NONE]" );
  1004. // select the [NONE] label
  1005. if(selected.isEmpty())
  1006. SendMessage( comboBox, CB_SETCURSEL, 0, 0 );
  1007. else
  1008. SendMessage( comboBox, CB_SELECTSTRING, -1, (LPARAM)selected.str() );
  1009. } // end LoadHeaderTemplateListComboBox
  1010. // ComboBoxSelectionToImage ===================================================
  1011. /** Given a combo box assumed to be loaded with a list of image names,
  1012. * if there is a selection, translate that selection into an
  1013. * image Loc from the GUI collection
  1014. *
  1015. * NOTE: The image list combo boxes have a [NONE] at index 0, if that
  1016. * is selected NULL will be returned
  1017. */
  1018. //=============================================================================
  1019. const Image *ComboBoxSelectionToImage( HWND comboBox )
  1020. {
  1021. Int selected;
  1022. char buffer[ 512 ];
  1023. // santiy
  1024. if( comboBox == NULL )
  1025. return NULL;
  1026. // get the selected index
  1027. selected = SendMessage( comboBox, CB_GETCURSEL, 0, 0 );
  1028. // do nothing if index 0 is selected (contains the string "[NONE]")
  1029. if( selected == CB_ERR || selected == 0 )
  1030. return NULL;
  1031. // get the text of the selected item
  1032. SendMessage( comboBox, CB_GETLBTEXT, selected, (LPARAM)buffer );
  1033. // return the image loc that matches the string
  1034. return TheMappedImageCollection->findImageByName( AsciiString( buffer ) );
  1035. } // end ComboBoxSelectionToImage
  1036. // GetControlColor ============================================================
  1037. /** Search the control color table and return the color for the
  1038. * matching ID */
  1039. //=============================================================================
  1040. RGBColorInt *GetControlColor( UnsignedInt controlID )
  1041. {
  1042. ColorControl *entry;
  1043. for( entry = colorControlTable; entry->controlID; entry++ )
  1044. {
  1045. if( entry->controlID == controlID )
  1046. return &entry->color;
  1047. } // end for
  1048. // not found
  1049. return NULL;
  1050. } // end GetControlColor
  1051. // SetControlColor ============================================================
  1052. /** Set the color in the table with the matching control ID */
  1053. //=============================================================================
  1054. void SetControlColor( UnsignedInt controlID, Color color )
  1055. {
  1056. ColorControl *entry;
  1057. UnsignedByte red, green, blue, alpha;
  1058. // get the color components
  1059. GameGetColorComponents( color, &red, &green, &blue, &alpha );
  1060. for( entry = colorControlTable; entry->controlID; entry++ )
  1061. {
  1062. if( entry->controlID == controlID )
  1063. {
  1064. entry->color.alpha = alpha;
  1065. entry->color.red = red;
  1066. entry->color.green = green;
  1067. entry->color.blue = blue;
  1068. break;
  1069. } // end if
  1070. } // end for
  1071. } // end SetControlColor
  1072. // GetStateInfo ===============================================================
  1073. /** Get a image and color state entry */
  1074. //=============================================================================
  1075. ImageAndColorInfo *GetStateInfo( StateIdentifier id )
  1076. {
  1077. ImageAndColorInfo *entry;
  1078. for( entry = imageAndColorTable; entry->stateName; entry++ )
  1079. {
  1080. if( entry->stateID == id )
  1081. return entry;
  1082. } // end for entry
  1083. return NULL;
  1084. } // end GetStateInfo
  1085. // SwitchToState ==============================================================
  1086. /** Switch the image and color combo box to specified state, invalidate
  1087. * the color previews and select the correct image for the new state */
  1088. //=============================================================================
  1089. void SwitchToState( StateIdentifier id, HWND dialog )
  1090. {
  1091. HWND stateBox = GetDlgItem( dialog, COMBO_STATE );
  1092. HWND imageBox = GetDlgItem( dialog, COMBO_IMAGE );
  1093. HWND colorButton = GetDlgItem( dialog, BUTTON_COLOR );
  1094. HWND borderColorButton = GetDlgItem( dialog, BUTTON_BORDER_COLOR );
  1095. ImageAndColorInfo *info;
  1096. // get the data for the new state
  1097. info = GetStateInfo( id );
  1098. if( info == NULL )
  1099. {
  1100. DEBUG_LOG(( "Invalid state request\n" ));
  1101. assert( 0 );
  1102. return;
  1103. } // end if
  1104. // select the string in the state combo box
  1105. SendMessage( stateBox, CB_SELECTSTRING, -1, (LPARAM)info->stateName );
  1106. // select the image in the image combo box
  1107. if( info->image )
  1108. SendMessage( imageBox, CB_SELECTSTRING, -1, (LPARAM)info->image->getName().str() );
  1109. else
  1110. SendMessage( imageBox, CB_SETCURSEL, 0, 0 );
  1111. //
  1112. // invalidate the color previews, they will redraw with the new
  1113. // state automatically
  1114. //
  1115. InvalidateRect( colorButton, NULL, TRUE );
  1116. InvalidateRect( borderColorButton, NULL, TRUE );
  1117. } // end SwitchToState
  1118. // StoreImageAndColor =========================================================
  1119. /** Store the image and colors in the table */
  1120. //=============================================================================
  1121. void StoreImageAndColor( StateIdentifier id, const Image *image,
  1122. Color color, Color borderColor )
  1123. {
  1124. ImageAndColorInfo *entry;
  1125. for( entry = imageAndColorTable; entry->stateName; entry++ )
  1126. {
  1127. if( entry->stateID == id )
  1128. {
  1129. entry->image = image;
  1130. entry->color = color;
  1131. entry->borderColor = borderColor;
  1132. break; // exit for
  1133. } // end if
  1134. } // end for
  1135. } // end StoreImageAndColor
  1136. // StoreColor =================================================================
  1137. /** Store the colors in the table */
  1138. //=============================================================================
  1139. void StoreColor( StateIdentifier id, Color color, Color borderColor )
  1140. {
  1141. ImageAndColorInfo *entry;
  1142. for( entry = imageAndColorTable; entry->stateName; entry++ )
  1143. {
  1144. if( entry->stateID == id )
  1145. {
  1146. entry->color = color;
  1147. entry->borderColor = borderColor;
  1148. break; // exit for
  1149. } // end if
  1150. } // end for
  1151. } // end StoreColor
  1152. // GetCurrentStateInfo ========================================================
  1153. /** Get the info on the current state selected in the state combo */
  1154. //=============================================================================
  1155. ImageAndColorInfo *GetCurrentStateInfo( HWND dialog )
  1156. {
  1157. HWND stateCombo = GetDlgItem( dialog, COMBO_STATE );
  1158. Int selected;
  1159. StateIdentifier stateID;
  1160. // get selected state
  1161. selected = SendMessage( stateCombo, CB_GETCURSEL, 0, 0 );
  1162. if( selected == CB_ERR )
  1163. return NULL;
  1164. // get the state ID of the selected item (stored in the item data)
  1165. stateID = (StateIdentifier)SendMessage( stateCombo, CB_GETITEMDATA, selected, 0 );
  1166. return GetStateInfo( stateID );
  1167. } // end GetCurrentStateInfo
  1168. // PositionWindowOnScreen =====================================================
  1169. /** Position the window on the screen, but keep the window completely
  1170. * on-screen. Position passed in should be in screen coordinates */
  1171. //=============================================================================
  1172. void PositionWindowOnScreen( HWND window, Int x, Int y )
  1173. {
  1174. RECT windowRect;
  1175. ICoord2D windowPos;
  1176. ICoord2D windowSize;
  1177. // get the window rectangle
  1178. GetWindowRect( window, &windowRect );
  1179. windowSize.x = windowRect.right - windowRect.left;
  1180. windowSize.y = windowRect.bottom - windowRect.top;
  1181. // get screen size not obscured by taskbar and toolbars
  1182. RECT screenRect;
  1183. SystemParametersInfo( SPI_GETWORKAREA, 0, &screenRect, 0 );
  1184. // find window position, but dont let it go outside of the screen
  1185. if( x < screenRect.left )
  1186. x = screenRect.left;
  1187. if( y < screenRect.top )
  1188. y = screenRect.top;
  1189. windowPos.x = x;
  1190. windowPos.y = y;
  1191. if( windowPos.x + windowSize.x > screenRect.right )
  1192. windowPos.x = screenRect.right - windowSize.x;
  1193. if( windowPos.y + windowSize.y > screenRect.bottom )
  1194. windowPos.y = screenRect.bottom - windowSize.y;
  1195. // place the window
  1196. MoveWindow( window, windowPos.x, windowPos.y,
  1197. windowSize.x, windowSize.y, TRUE );
  1198. // show the window
  1199. ShowWindow( window, SW_SHOW );
  1200. } // end PositionWindowOnScreen
  1201. // HandleCommonDialogMessages =================================================
  1202. /** Handle any messages common to all controls on all property dialogs */
  1203. //=============================================================================
  1204. Bool HandleCommonDialogMessages( HWND hWndDialog, UINT message,
  1205. WPARAM wParam, LPARAM lParam,
  1206. Int *returnCode )
  1207. {
  1208. Bool used = FALSE;
  1209. switch( message )
  1210. {
  1211. // ------------------------------------------------------------------------
  1212. case WM_DRAWITEM:
  1213. {
  1214. UINT controlID = (UINT)wParam; // control identifier
  1215. LPDRAWITEMSTRUCT drawItem = (LPDRAWITEMSTRUCT)lParam; // item drawing
  1216. Color color = GAME_COLOR_UNDEFINED;
  1217. // ImageAndColorInfo *info = GetCurrentStateInfo( hWndDialog );
  1218. // we only care about color button controls
  1219. if( controlID == BUTTON_COLOR || controlID == BUTTON_BORDER_COLOR )
  1220. {
  1221. ImageAndColorInfo *info = GetCurrentStateInfo( hWndDialog );
  1222. if( info )
  1223. if( controlID == BUTTON_COLOR )
  1224. color = info->color;
  1225. else
  1226. color = info->borderColor;
  1227. } // end if
  1228. else if( controlID == BUTTON_TEXT_COLOR || controlID == BUTTON_TEXT_BORDER_COLOR )
  1229. {
  1230. TextDrawData textDraw = textDrawData[ currTextIndex ];
  1231. if( controlID == BUTTON_TEXT_COLOR )
  1232. color = textDraw.color;
  1233. else
  1234. color = textDraw.borderColor;
  1235. } // end else if
  1236. if( color != GAME_COLOR_UNDEFINED )
  1237. {
  1238. HBRUSH hBrushNew, hBrushOld;
  1239. RECT rect;
  1240. HWND hWndControl = GetDlgItem( hWndDialog, controlID );
  1241. UnsignedByte r, g, b, a;
  1242. // if this control is disabled just let windows handle drawing
  1243. if( IsWindowEnabled( hWndControl ) == FALSE )
  1244. {
  1245. *returnCode = FALSE;
  1246. break;
  1247. } // end if
  1248. // get the color info
  1249. GameGetColorComponents( color, &r, &g, &b, &a );
  1250. // Get the area we have to draw in
  1251. GetClientRect( hWndControl, &rect );
  1252. // create a new brush and select it into DC
  1253. hBrushNew = CreateSolidBrush( RGB ( r, g, b ) );
  1254. hBrushOld = (HBRUSH)SelectObject( drawItem->hDC, hBrushNew );
  1255. // draw the rectangle
  1256. Rectangle( drawItem->hDC, rect.left, rect.top, rect.right, rect.bottom );
  1257. // put the old brush back and delete the new one
  1258. SelectObject( drawItem->hDC, hBrushOld );
  1259. DeleteObject( hBrushNew );
  1260. // validate this new area
  1261. ValidateRect( hWndControl, NULL );
  1262. // we have taken care of it
  1263. *returnCode = TRUE;
  1264. used = TRUE;
  1265. break;
  1266. } // end if
  1267. *returnCode = FALSE;
  1268. break;
  1269. } // end draw item
  1270. // ------------------------------------------------------------------------
  1271. case WM_COMMAND:
  1272. {
  1273. Int notifyCode = HIWORD( wParam ); // notification code
  1274. Int controlID = LOWORD( wParam ); // control ID
  1275. HWND hWndControl = (HWND)lParam; // control window handle
  1276. switch( controlID )
  1277. {
  1278. // --------------------------------------------------------------------
  1279. case COMBO_STATE:
  1280. {
  1281. // property switch to the new state
  1282. if( notifyCode == CBN_SELCHANGE )
  1283. {
  1284. Int selected;
  1285. StateIdentifier newState;
  1286. // get new state selected
  1287. selected = SendMessage( hWndControl, CB_GETCURSEL, 0, 0 );
  1288. newState = (StateIdentifier)SendMessage( hWndControl, CB_GETITEMDATA, selected, 0 );
  1289. SwitchToState( newState, hWndDialog );
  1290. } // end if
  1291. used = TRUE;
  1292. break;
  1293. } // end state
  1294. // --------------------------------------------------------------------
  1295. case COMBO_TEXT_STATE:
  1296. {
  1297. // invalidate text color preview boxes
  1298. if( notifyCode == CBN_SELCHANGE )
  1299. {
  1300. // get the selected index as the current text data
  1301. currTextIndex = SendMessage( hWndControl, CB_GETCURSEL, 0, 0 );
  1302. // invalidate each of the preview windows for text colors
  1303. InvalidateRect( GetDlgItem( hWndDialog, BUTTON_TEXT_COLOR ), NULL, TRUE );
  1304. InvalidateRect( GetDlgItem( hWndDialog, BUTTON_TEXT_BORDER_COLOR ), NULL, TRUE );
  1305. } // end if
  1306. used = TRUE;
  1307. break;
  1308. } // end text state
  1309. // --------------------------------------------------------------------
  1310. case COMBO_IMAGE:
  1311. {
  1312. // store image selection changes
  1313. if( notifyCode == CBN_SELCHANGE )
  1314. {
  1315. ImageAndColorInfo *info = GetCurrentStateInfo( hWndDialog );
  1316. const Image *newImage = ComboBoxSelectionToImage( hWndControl );
  1317. StoreImageAndColor( info->stateID, newImage,
  1318. info->color, info->borderColor );
  1319. } // end if
  1320. used = TRUE;
  1321. break;
  1322. } // end image
  1323. // --------------------------------------------------------------------
  1324. case BUTTON_COLOR:
  1325. case BUTTON_BORDER_COLOR:
  1326. case BUTTON_TEXT_COLOR:
  1327. case BUTTON_TEXT_BORDER_COLOR:
  1328. {
  1329. Color oldColor = GAME_COLOR_UNDEFINED;
  1330. UnsignedByte r, g, b, a;
  1331. ImageAndColorInfo *info = GetCurrentStateInfo( hWndDialog );
  1332. // get the old color
  1333. if( controlID == BUTTON_COLOR && info )
  1334. oldColor = info->color;
  1335. else if( controlID == BUTTON_BORDER_COLOR && info )
  1336. oldColor = info->borderColor;
  1337. else if( controlID == BUTTON_TEXT_COLOR )
  1338. oldColor = textDrawData[ currTextIndex ].color;
  1339. else if( controlID == BUTTON_TEXT_BORDER_COLOR )
  1340. oldColor = textDrawData[ currTextIndex ].borderColor;
  1341. else
  1342. assert( 0 );
  1343. GameGetColorComponents( oldColor, &r, &g, &b, &a );
  1344. // get the mouse position for color dialog placement
  1345. POINT mouse;
  1346. GetCursorPos( &mouse );
  1347. // open the color selector
  1348. RGBColorInt *selectedColor = SelectColor( r, g, b, a, mouse.x, mouse.y );
  1349. // store the new color
  1350. if( selectedColor )
  1351. {
  1352. Color newColor = GameMakeColor( selectedColor->red,
  1353. selectedColor->green,
  1354. selectedColor->blue,
  1355. selectedColor->alpha );
  1356. if( controlID == BUTTON_COLOR && info )
  1357. StoreImageAndColor( info->stateID, info->image, newColor, info->borderColor );
  1358. else if( controlID == BUTTON_BORDER_COLOR && info )
  1359. StoreImageAndColor( info->stateID, info->image, info->color, newColor );
  1360. else if( controlID == BUTTON_TEXT_COLOR )
  1361. textDrawData[ currTextIndex ].color = newColor;
  1362. else if( controlID == BUTTON_TEXT_BORDER_COLOR )
  1363. textDrawData[ currTextIndex ].borderColor = newColor;
  1364. else
  1365. assert( 0 );
  1366. // invalidate the color preview
  1367. InvalidateRect( hWndControl, NULL, TRUE );
  1368. } // end if
  1369. used = TRUE;
  1370. break;
  1371. } // end color buttons
  1372. } // end switch( LOWORD( wParam ) )
  1373. *returnCode = 0;
  1374. break;
  1375. } // end of WM_COMMAND
  1376. } // end of switch
  1377. return used;
  1378. } // end HandleCommonDialogMessages
  1379. // GetProprsEnabledTextColor ==================================================
  1380. //=============================================================================
  1381. Color GetPropsEnabledTextColor( void )
  1382. {
  1383. return textDrawData[ enabledTextIndex ].color;
  1384. }
  1385. // GetPropsEnabledTextBorderColor =============================================
  1386. //=============================================================================
  1387. Color GetPropsEnabledTextBorderColor( void )
  1388. {
  1389. return textDrawData[ enabledTextIndex ].borderColor;
  1390. }
  1391. // GetProprsDisabledTextColor =================================================
  1392. //=============================================================================
  1393. Color GetPropsDisabledTextColor( void )
  1394. {
  1395. return textDrawData[ disabledTextIndex ].color;
  1396. }
  1397. // GetPropsDisabledTextBorderColor ============================================
  1398. //=============================================================================
  1399. Color GetPropsDisabledTextBorderColor( void )
  1400. {
  1401. return textDrawData[ disabledTextIndex ].borderColor;
  1402. }
  1403. // GetProprsHiliteTextColor ===================================================
  1404. //=============================================================================
  1405. Color GetPropsHiliteTextColor( void )
  1406. {
  1407. return textDrawData[ hiliteTextIndex ].color;
  1408. }
  1409. // GetPropsHiliteTextBorderColor ==============================================
  1410. //=============================================================================
  1411. Color GetPropsHiliteTextBorderColor( void )
  1412. {
  1413. return textDrawData[ hiliteTextIndex ].borderColor;
  1414. }