Properties.cpp 75 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761
  1. /*
  2. ** Command & Conquer Generals Zero Hour(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 (unsigned index=0;(image=TheMappedImageCollection->Enum(index))!=NULL;index++)
  973. {
  974. SendMessage( comboBox, CB_ADDSTRING, 0, (LPARAM)image->getName().str() );
  975. } // end for image
  976. // add a [NONE] at the top of the image lists
  977. SendMessage( comboBox, CB_INSERTSTRING, 0, (LPARAM)"[NONE]" );
  978. // select the [NONE] label
  979. SendMessage( comboBox, CB_SETCURSEL, 0, 0 );
  980. } // end LoadImageListComboBox
  981. // LoadHeaderTemplateListComboBox =============================================
  982. /** Load a combo box with header template names
  983. * including a [NONE] at the top that is selected */
  984. //=============================================================================
  985. void LoadHeaderTemplateListComboBox( HWND comboBox, AsciiString selected )
  986. {
  987. HeaderTemplate *ht;
  988. // sanity
  989. if( comboBox == NULL )
  990. return;
  991. // clear the content of the box
  992. SendMessage( comboBox, CB_RESETCONTENT, 0, 0 );
  993. // load the combo box with string names from the Header Templates
  994. for( ht = TheHeaderTemplateManager->getFirstHeader();
  995. ht;
  996. ht = TheHeaderTemplateManager->getNextHeader(ht) )
  997. {
  998. SendMessage( comboBox, CB_ADDSTRING, 0, (LPARAM)ht->m_name.str());
  999. } // end for image
  1000. // add a [NONE] at the top of the image lists
  1001. SendMessage( comboBox, CB_INSERTSTRING, 0, (LPARAM)"[NONE]" );
  1002. // select the [NONE] label
  1003. if(selected.isEmpty())
  1004. SendMessage( comboBox, CB_SETCURSEL, 0, 0 );
  1005. else
  1006. SendMessage( comboBox, CB_SELECTSTRING, -1, (LPARAM)selected.str() );
  1007. } // end LoadHeaderTemplateListComboBox
  1008. // ComboBoxSelectionToImage ===================================================
  1009. /** Given a combo box assumed to be loaded with a list of image names,
  1010. * if there is a selection, translate that selection into an
  1011. * image Loc from the GUI collection
  1012. *
  1013. * NOTE: The image list combo boxes have a [NONE] at index 0, if that
  1014. * is selected NULL will be returned
  1015. */
  1016. //=============================================================================
  1017. const Image *ComboBoxSelectionToImage( HWND comboBox )
  1018. {
  1019. Int selected;
  1020. char buffer[ 512 ];
  1021. // santiy
  1022. if( comboBox == NULL )
  1023. return NULL;
  1024. // get the selected index
  1025. selected = SendMessage( comboBox, CB_GETCURSEL, 0, 0 );
  1026. // do nothing if index 0 is selected (contains the string "[NONE]")
  1027. if( selected == CB_ERR || selected == 0 )
  1028. return NULL;
  1029. // get the text of the selected item
  1030. SendMessage( comboBox, CB_GETLBTEXT, selected, (LPARAM)buffer );
  1031. // return the image loc that matches the string
  1032. return TheMappedImageCollection->findImageByName( AsciiString( buffer ) );
  1033. } // end ComboBoxSelectionToImage
  1034. // GetControlColor ============================================================
  1035. /** Search the control color table and return the color for the
  1036. * matching ID */
  1037. //=============================================================================
  1038. RGBColorInt *GetControlColor( UnsignedInt controlID )
  1039. {
  1040. ColorControl *entry;
  1041. for( entry = colorControlTable; entry->controlID; entry++ )
  1042. {
  1043. if( entry->controlID == controlID )
  1044. return &entry->color;
  1045. } // end for
  1046. // not found
  1047. return NULL;
  1048. } // end GetControlColor
  1049. // SetControlColor ============================================================
  1050. /** Set the color in the table with the matching control ID */
  1051. //=============================================================================
  1052. void SetControlColor( UnsignedInt controlID, Color color )
  1053. {
  1054. ColorControl *entry;
  1055. UnsignedByte red, green, blue, alpha;
  1056. // get the color components
  1057. GameGetColorComponents( color, &red, &green, &blue, &alpha );
  1058. for( entry = colorControlTable; entry->controlID; entry++ )
  1059. {
  1060. if( entry->controlID == controlID )
  1061. {
  1062. entry->color.alpha = alpha;
  1063. entry->color.red = red;
  1064. entry->color.green = green;
  1065. entry->color.blue = blue;
  1066. break;
  1067. } // end if
  1068. } // end for
  1069. } // end SetControlColor
  1070. // GetStateInfo ===============================================================
  1071. /** Get a image and color state entry */
  1072. //=============================================================================
  1073. ImageAndColorInfo *GetStateInfo( StateIdentifier id )
  1074. {
  1075. ImageAndColorInfo *entry;
  1076. for( entry = imageAndColorTable; entry->stateName; entry++ )
  1077. {
  1078. if( entry->stateID == id )
  1079. return entry;
  1080. } // end for entry
  1081. return NULL;
  1082. } // end GetStateInfo
  1083. // SwitchToState ==============================================================
  1084. /** Switch the image and color combo box to specified state, invalidate
  1085. * the color previews and select the correct image for the new state */
  1086. //=============================================================================
  1087. void SwitchToState( StateIdentifier id, HWND dialog )
  1088. {
  1089. HWND stateBox = GetDlgItem( dialog, COMBO_STATE );
  1090. HWND imageBox = GetDlgItem( dialog, COMBO_IMAGE );
  1091. HWND colorButton = GetDlgItem( dialog, BUTTON_COLOR );
  1092. HWND borderColorButton = GetDlgItem( dialog, BUTTON_BORDER_COLOR );
  1093. ImageAndColorInfo *info;
  1094. // get the data for the new state
  1095. info = GetStateInfo( id );
  1096. if( info == NULL )
  1097. {
  1098. DEBUG_LOG(( "Invalid state request\n" ));
  1099. assert( 0 );
  1100. return;
  1101. } // end if
  1102. // select the string in the state combo box
  1103. SendMessage( stateBox, CB_SELECTSTRING, -1, (LPARAM)info->stateName );
  1104. // select the image in the image combo box
  1105. if( info->image )
  1106. SendMessage( imageBox, CB_SELECTSTRING, -1, (LPARAM)info->image->getName().str() );
  1107. else
  1108. SendMessage( imageBox, CB_SETCURSEL, 0, 0 );
  1109. //
  1110. // invalidate the color previews, they will redraw with the new
  1111. // state automatically
  1112. //
  1113. InvalidateRect( colorButton, NULL, TRUE );
  1114. InvalidateRect( borderColorButton, NULL, TRUE );
  1115. } // end SwitchToState
  1116. // StoreImageAndColor =========================================================
  1117. /** Store the image and colors in the table */
  1118. //=============================================================================
  1119. void StoreImageAndColor( StateIdentifier id, const Image *image,
  1120. Color color, Color borderColor )
  1121. {
  1122. ImageAndColorInfo *entry;
  1123. for( entry = imageAndColorTable; entry->stateName; entry++ )
  1124. {
  1125. if( entry->stateID == id )
  1126. {
  1127. entry->image = image;
  1128. entry->color = color;
  1129. entry->borderColor = borderColor;
  1130. break; // exit for
  1131. } // end if
  1132. } // end for
  1133. } // end StoreImageAndColor
  1134. // StoreColor =================================================================
  1135. /** Store the colors in the table */
  1136. //=============================================================================
  1137. void StoreColor( StateIdentifier id, Color color, Color borderColor )
  1138. {
  1139. ImageAndColorInfo *entry;
  1140. for( entry = imageAndColorTable; entry->stateName; entry++ )
  1141. {
  1142. if( entry->stateID == id )
  1143. {
  1144. entry->color = color;
  1145. entry->borderColor = borderColor;
  1146. break; // exit for
  1147. } // end if
  1148. } // end for
  1149. } // end StoreColor
  1150. // GetCurrentStateInfo ========================================================
  1151. /** Get the info on the current state selected in the state combo */
  1152. //=============================================================================
  1153. ImageAndColorInfo *GetCurrentStateInfo( HWND dialog )
  1154. {
  1155. HWND stateCombo = GetDlgItem( dialog, COMBO_STATE );
  1156. Int selected;
  1157. StateIdentifier stateID;
  1158. // get selected state
  1159. selected = SendMessage( stateCombo, CB_GETCURSEL, 0, 0 );
  1160. if( selected == CB_ERR )
  1161. return NULL;
  1162. // get the state ID of the selected item (stored in the item data)
  1163. stateID = (StateIdentifier)SendMessage( stateCombo, CB_GETITEMDATA, selected, 0 );
  1164. return GetStateInfo( stateID );
  1165. } // end GetCurrentStateInfo
  1166. // PositionWindowOnScreen =====================================================
  1167. /** Position the window on the screen, but keep the window completely
  1168. * on-screen. Position passed in should be in screen coordinates */
  1169. //=============================================================================
  1170. void PositionWindowOnScreen( HWND window, Int x, Int y )
  1171. {
  1172. RECT windowRect;
  1173. ICoord2D windowPos;
  1174. ICoord2D windowSize;
  1175. // get the window rectangle
  1176. GetWindowRect( window, &windowRect );
  1177. windowSize.x = windowRect.right - windowRect.left;
  1178. windowSize.y = windowRect.bottom - windowRect.top;
  1179. // get screen size not obscured by taskbar and toolbars
  1180. RECT screenRect;
  1181. SystemParametersInfo( SPI_GETWORKAREA, 0, &screenRect, 0 );
  1182. // find window position, but dont let it go outside of the screen
  1183. if( x < screenRect.left )
  1184. x = screenRect.left;
  1185. if( y < screenRect.top )
  1186. y = screenRect.top;
  1187. windowPos.x = x;
  1188. windowPos.y = y;
  1189. if( windowPos.x + windowSize.x > screenRect.right )
  1190. windowPos.x = screenRect.right - windowSize.x;
  1191. if( windowPos.y + windowSize.y > screenRect.bottom )
  1192. windowPos.y = screenRect.bottom - windowSize.y;
  1193. // place the window
  1194. MoveWindow( window, windowPos.x, windowPos.y,
  1195. windowSize.x, windowSize.y, TRUE );
  1196. // show the window
  1197. ShowWindow( window, SW_SHOW );
  1198. } // end PositionWindowOnScreen
  1199. // HandleCommonDialogMessages =================================================
  1200. /** Handle any messages common to all controls on all property dialogs */
  1201. //=============================================================================
  1202. Bool HandleCommonDialogMessages( HWND hWndDialog, UINT message,
  1203. WPARAM wParam, LPARAM lParam,
  1204. Int *returnCode )
  1205. {
  1206. Bool used = FALSE;
  1207. switch( message )
  1208. {
  1209. // ------------------------------------------------------------------------
  1210. case WM_DRAWITEM:
  1211. {
  1212. UINT controlID = (UINT)wParam; // control identifier
  1213. LPDRAWITEMSTRUCT drawItem = (LPDRAWITEMSTRUCT)lParam; // item drawing
  1214. Color color = GAME_COLOR_UNDEFINED;
  1215. // ImageAndColorInfo *info = GetCurrentStateInfo( hWndDialog );
  1216. // we only care about color button controls
  1217. if( controlID == BUTTON_COLOR || controlID == BUTTON_BORDER_COLOR )
  1218. {
  1219. ImageAndColorInfo *info = GetCurrentStateInfo( hWndDialog );
  1220. if( info )
  1221. if( controlID == BUTTON_COLOR )
  1222. color = info->color;
  1223. else
  1224. color = info->borderColor;
  1225. } // end if
  1226. else if( controlID == BUTTON_TEXT_COLOR || controlID == BUTTON_TEXT_BORDER_COLOR )
  1227. {
  1228. TextDrawData textDraw = textDrawData[ currTextIndex ];
  1229. if( controlID == BUTTON_TEXT_COLOR )
  1230. color = textDraw.color;
  1231. else
  1232. color = textDraw.borderColor;
  1233. } // end else if
  1234. if( color != GAME_COLOR_UNDEFINED )
  1235. {
  1236. HBRUSH hBrushNew, hBrushOld;
  1237. RECT rect;
  1238. HWND hWndControl = GetDlgItem( hWndDialog, controlID );
  1239. UnsignedByte r, g, b, a;
  1240. // if this control is disabled just let windows handle drawing
  1241. if( IsWindowEnabled( hWndControl ) == FALSE )
  1242. {
  1243. *returnCode = FALSE;
  1244. break;
  1245. } // end if
  1246. // get the color info
  1247. GameGetColorComponents( color, &r, &g, &b, &a );
  1248. // Get the area we have to draw in
  1249. GetClientRect( hWndControl, &rect );
  1250. // create a new brush and select it into DC
  1251. hBrushNew = CreateSolidBrush( RGB ( r, g, b ) );
  1252. hBrushOld = (HBRUSH)SelectObject( drawItem->hDC, hBrushNew );
  1253. // draw the rectangle
  1254. Rectangle( drawItem->hDC, rect.left, rect.top, rect.right, rect.bottom );
  1255. // put the old brush back and delete the new one
  1256. SelectObject( drawItem->hDC, hBrushOld );
  1257. DeleteObject( hBrushNew );
  1258. // validate this new area
  1259. ValidateRect( hWndControl, NULL );
  1260. // we have taken care of it
  1261. *returnCode = TRUE;
  1262. used = TRUE;
  1263. break;
  1264. } // end if
  1265. *returnCode = FALSE;
  1266. break;
  1267. } // end draw item
  1268. // ------------------------------------------------------------------------
  1269. case WM_COMMAND:
  1270. {
  1271. Int notifyCode = HIWORD( wParam ); // notification code
  1272. Int controlID = LOWORD( wParam ); // control ID
  1273. HWND hWndControl = (HWND)lParam; // control window handle
  1274. switch( controlID )
  1275. {
  1276. // --------------------------------------------------------------------
  1277. case COMBO_STATE:
  1278. {
  1279. // property switch to the new state
  1280. if( notifyCode == CBN_SELCHANGE )
  1281. {
  1282. Int selected;
  1283. StateIdentifier newState;
  1284. // get new state selected
  1285. selected = SendMessage( hWndControl, CB_GETCURSEL, 0, 0 );
  1286. newState = (StateIdentifier)SendMessage( hWndControl, CB_GETITEMDATA, selected, 0 );
  1287. SwitchToState( newState, hWndDialog );
  1288. } // end if
  1289. used = TRUE;
  1290. break;
  1291. } // end state
  1292. // --------------------------------------------------------------------
  1293. case COMBO_TEXT_STATE:
  1294. {
  1295. // invalidate text color preview boxes
  1296. if( notifyCode == CBN_SELCHANGE )
  1297. {
  1298. // get the selected index as the current text data
  1299. currTextIndex = SendMessage( hWndControl, CB_GETCURSEL, 0, 0 );
  1300. // invalidate each of the preview windows for text colors
  1301. InvalidateRect( GetDlgItem( hWndDialog, BUTTON_TEXT_COLOR ), NULL, TRUE );
  1302. InvalidateRect( GetDlgItem( hWndDialog, BUTTON_TEXT_BORDER_COLOR ), NULL, TRUE );
  1303. } // end if
  1304. used = TRUE;
  1305. break;
  1306. } // end text state
  1307. // --------------------------------------------------------------------
  1308. case COMBO_IMAGE:
  1309. {
  1310. // store image selection changes
  1311. if( notifyCode == CBN_SELCHANGE )
  1312. {
  1313. ImageAndColorInfo *info = GetCurrentStateInfo( hWndDialog );
  1314. const Image *newImage = ComboBoxSelectionToImage( hWndControl );
  1315. StoreImageAndColor( info->stateID, newImage,
  1316. info->color, info->borderColor );
  1317. } // end if
  1318. used = TRUE;
  1319. break;
  1320. } // end image
  1321. // --------------------------------------------------------------------
  1322. case BUTTON_COLOR:
  1323. case BUTTON_BORDER_COLOR:
  1324. case BUTTON_TEXT_COLOR:
  1325. case BUTTON_TEXT_BORDER_COLOR:
  1326. {
  1327. Color oldColor = GAME_COLOR_UNDEFINED;
  1328. UnsignedByte r, g, b, a;
  1329. ImageAndColorInfo *info = GetCurrentStateInfo( hWndDialog );
  1330. // get the old color
  1331. if( controlID == BUTTON_COLOR && info )
  1332. oldColor = info->color;
  1333. else if( controlID == BUTTON_BORDER_COLOR && info )
  1334. oldColor = info->borderColor;
  1335. else if( controlID == BUTTON_TEXT_COLOR )
  1336. oldColor = textDrawData[ currTextIndex ].color;
  1337. else if( controlID == BUTTON_TEXT_BORDER_COLOR )
  1338. oldColor = textDrawData[ currTextIndex ].borderColor;
  1339. else
  1340. assert( 0 );
  1341. GameGetColorComponents( oldColor, &r, &g, &b, &a );
  1342. // get the mouse position for color dialog placement
  1343. POINT mouse;
  1344. GetCursorPos( &mouse );
  1345. // open the color selector
  1346. RGBColorInt *selectedColor = SelectColor( r, g, b, a, mouse.x, mouse.y );
  1347. // store the new color
  1348. if( selectedColor )
  1349. {
  1350. Color newColor = GameMakeColor( selectedColor->red,
  1351. selectedColor->green,
  1352. selectedColor->blue,
  1353. selectedColor->alpha );
  1354. if( controlID == BUTTON_COLOR && info )
  1355. StoreImageAndColor( info->stateID, info->image, newColor, info->borderColor );
  1356. else if( controlID == BUTTON_BORDER_COLOR && info )
  1357. StoreImageAndColor( info->stateID, info->image, info->color, newColor );
  1358. else if( controlID == BUTTON_TEXT_COLOR )
  1359. textDrawData[ currTextIndex ].color = newColor;
  1360. else if( controlID == BUTTON_TEXT_BORDER_COLOR )
  1361. textDrawData[ currTextIndex ].borderColor = newColor;
  1362. else
  1363. assert( 0 );
  1364. // invalidate the color preview
  1365. InvalidateRect( hWndControl, NULL, TRUE );
  1366. } // end if
  1367. used = TRUE;
  1368. break;
  1369. } // end color buttons
  1370. } // end switch( LOWORD( wParam ) )
  1371. *returnCode = 0;
  1372. break;
  1373. } // end of WM_COMMAND
  1374. } // end of switch
  1375. return used;
  1376. } // end HandleCommonDialogMessages
  1377. // GetProprsEnabledTextColor ==================================================
  1378. //=============================================================================
  1379. Color GetPropsEnabledTextColor( void )
  1380. {
  1381. return textDrawData[ enabledTextIndex ].color;
  1382. }
  1383. // GetPropsEnabledTextBorderColor =============================================
  1384. //=============================================================================
  1385. Color GetPropsEnabledTextBorderColor( void )
  1386. {
  1387. return textDrawData[ enabledTextIndex ].borderColor;
  1388. }
  1389. // GetProprsDisabledTextColor =================================================
  1390. //=============================================================================
  1391. Color GetPropsDisabledTextColor( void )
  1392. {
  1393. return textDrawData[ disabledTextIndex ].color;
  1394. }
  1395. // GetPropsDisabledTextBorderColor ============================================
  1396. //=============================================================================
  1397. Color GetPropsDisabledTextBorderColor( void )
  1398. {
  1399. return textDrawData[ disabledTextIndex ].borderColor;
  1400. }
  1401. // GetProprsHiliteTextColor ===================================================
  1402. //=============================================================================
  1403. Color GetPropsHiliteTextColor( void )
  1404. {
  1405. return textDrawData[ hiliteTextIndex ].color;
  1406. }
  1407. // GetPropsHiliteTextBorderColor ==============================================
  1408. //=============================================================================
  1409. Color GetPropsHiliteTextBorderColor( void )
  1410. {
  1411. return textDrawData[ hiliteTextIndex ].borderColor;
  1412. }