Leaked source code of windows server 2003
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

89 lines
2.3 KiB

  1. //********************************************************************************
  2. // MAKE NOTE:
  3. // =========
  4. // This file is included by parser\comptree
  5. // If you modify this file, please make sure that parser\comptree still builds.
  6. //
  7. // You have been warned.
  8. //********************************************************************************
  9. // String map used when script sets a panel's position
  10. const struct tagPositionMap s_PositionMap[] =
  11. {
  12. { L"Left", PANEL_LEFT },
  13. { L"Right", PANEL_RIGHT },
  14. { L"Top", PANEL_TOP },
  15. { L"Bottom", PANEL_BOTTOM },
  16. { L"Window", PANEL_WINDOW },
  17. { L"Popup", PANEL_POPUP },
  18. { L"Client", PANEL_WINDOW },
  19. { L"Overlapped",PANEL_POPUP }
  20. };
  21. const int c_iPositionMapSize = sizeof(s_PositionMap)/sizeof(s_PositionMap[0]);
  22. HRESULT StringToPanelPosition(LPCWSTR pwszPosition, PANEL_POSITION *pPosition)
  23. {
  24. HRESULT hr = E_FAIL;
  25. ATLASSERT(pPosition);
  26. *pPosition = PANEL_INVALID;
  27. if (pwszPosition)
  28. {
  29. for (int i = 0; i < c_iPositionMapSize; i++)
  30. {
  31. if (0 == StrCmpI(pwszPosition, s_PositionMap[i].pwszName))
  32. {
  33. *pPosition = s_PositionMap[i].Position;
  34. hr = S_OK;
  35. break;
  36. }
  37. }
  38. }
  39. return hr;
  40. }
  41. void StringToPanelFlags(LPCWSTR pwsz, DWORD &dwFlags, long lLen /* =-1 */)
  42. {
  43. if (pwsz)
  44. {
  45. if(lLen == -1) lLen = lstrlenW( pwsz );
  46. if(!StrCmpNIW( pwsz, L"OnStart", lLen ))
  47. {
  48. dwFlags &= ~PANEL_FLAG_ONDEMAND;
  49. }
  50. else if(!StrCmpNIW( pwsz, L"WebBrowser", lLen ))
  51. {
  52. dwFlags |= PANEL_FLAG_WEBBROWSER;
  53. }
  54. else if(!StrCmpNIW( pwsz, L"CustomControl", lLen ))
  55. {
  56. dwFlags |= PANEL_FLAG_CUSTOMCONTROL;
  57. }
  58. }
  59. }
  60. void StringToPersistVisibility(LPCWSTR pwsz, PANEL_PERSIST_VISIBLE &persistVis)
  61. {
  62. if (pwsz)
  63. {
  64. if (0 == StrCmpIW(pwsz, L"Never"))
  65. {
  66. persistVis = PANEL_PERSIST_VISIBLE_NEVER;
  67. }
  68. else if (0 == StrCmpIW(pwsz, L"Always"))
  69. {
  70. persistVis = PANEL_PERSIST_VISIBLE_ALWAYS;
  71. }
  72. else if (0 == StrCmpIW(pwsz, L"DontTouch"))
  73. {
  74. persistVis = PANEL_PERSIST_VISIBLE_DONTTOUCH;
  75. }
  76. }
  77. }