Source code of Windows XP (NT5)
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.

162 lines
5.2 KiB

  1. // XMLDialog.h: interface for the CXMLDialog class.
  2. //
  3. //////////////////////////////////////////////////////////////////////
  4. #if !defined(AFX_XMLDIALOG_H__ADBD45EB_57FA_11D2_A37A_00C04FA31BFB__INCLUDED_)
  5. #define AFX_XMLDIALOG_H__ADBD45EB_57FA_11D2_A37A_00C04FA31BFB__INCLUDED_
  6. #if _MSC_VER > 1000
  7. #pragma once
  8. #endif // _MSC_VER > 1000
  9. #include "XMLBase.h"
  10. #include <winuser.h>
  11. #include "XMLDlgItem.h"
  12. /////////////////////////////////////////////////////////////////////////////
  13. // Defines
  14. const DWORD TYPEID_BUTTON = 0x80;
  15. const DWORD TYPEID_EDIT = 0x81;
  16. const DWORD TYPEID_STATIC = 0x82;
  17. const DWORD TYPEID_LISTBOX = 0x83;
  18. const DWORD TYPEID_SCROLLBAR = 0x84;
  19. const DWORD TYPEID_COMBOBOX = 0x85;
  20. /////////////////////////////////////////////////////////////////////////////
  21. // Forward Declarations
  22. /////////////////////////////////////////////////////////////////////////////
  23. // Typedefs
  24. typedef DLGTEMPLATEEX* LPDLGTEMPLATEEX;
  25. class LTAPIENTRY CXMLDialog : public CXMLBase
  26. {
  27. public:
  28. CXMLDialog();
  29. ~CXMLDialog();
  30. enum
  31. {
  32. DWORD_SIZE = 4,
  33. DWORD_ALIGN = DWORD_SIZE - 1
  34. };
  35. BOOL Init(IXMLDOMNodePtr pDialogNode);
  36. BOOL Init(BYTE *pbyDlg, CLocItemPtrArray * prgLocItem);
  37. BOOL Init(CMemFile *pmfDlg, CLocItemPtrArray * prgLocItem);
  38. void Reset();
  39. void SetFocus();
  40. BOOL Update(IXMLDOMNodePtr pDialogNode);
  41. BOOL HighlightItems(IXMLDOMNodePtr &pDialogItem);
  42. BOOL AddHighlightRect(IXMLDOMNodePtr &pDialogItem);
  43. void AddHighlightRect(RECT& rectToHighlight);
  44. void DisplayDialog(HWND hWndParent = NULL, BOOL fHandleCancel = TRUE);
  45. void CloseDialog();
  46. BOOL IsDialogDisplayed() { return ::IsWindow(m_hWndDlg); }
  47. LPDLGTEMPLATEEX GetDialogTemplate() { return m_pDlgTemplate; }
  48. DWORD GetSizeOfStruct() { return m_nSizeOfStruct; }
  49. WORD GetDialogVersion() { return m_DlgVer; }
  50. WORD GetSignature() { return m_Signature; }
  51. DWORD GetSubDialogMask() { return m_SubDlgMask; }
  52. DWORD GetHelpID() { return m_HelpID; }
  53. DWORD GetExStyle() { return m_ExStyle; }
  54. void SetExStyle(DWORD dwExStyle)
  55. { m_ExStyle = dwExStyle; }
  56. DWORD GetStyle() { return m_Style; }
  57. void SetStyle(DWORD dwStyle)
  58. { m_Style = dwStyle; }
  59. WORD GetItemCount() { return m_CountDlgItems; }
  60. short GetXPos() { return m_xPos; }
  61. void SetXPos(short xPos) { m_xPos = xPos; }
  62. short GetYPos() { return m_yPos; }
  63. void SetYPos(short yPos) { m_yPos = yPos; }
  64. short GetXSize() { return m_xSize; }
  65. void SetXSize(short xSize)
  66. { m_xSize = xSize; }
  67. short GetYSize() { return m_ySize; }
  68. void SetYSize(short ySize)
  69. { m_ySize = ySize; }
  70. const CLocId & GetMenu() { return m_Menu; }
  71. const CLocId & GetWindowClass() { return m_WindowClass; }
  72. CLString GetTitle() { return m_Title; }
  73. void SetTitle(const CLString strNewTitle)
  74. { m_Title = strNewTitle; }
  75. short GetFontPointSize() { return m_FontPointSize; }
  76. void SetFontPointSize(short nSize)
  77. { m_FontPointSize = nSize; }
  78. short GetFontWeight() { return m_FontWeight; }
  79. void SetFontWeight(short nWeight)
  80. { m_FontWeight = nWeight; }
  81. short GetIsFontItalic() { return m_bItalic; }
  82. void SetIsFontItalic(short bItalic)
  83. { m_bItalic = bItalic; }
  84. CLString GetFontName() { return m_FontName; }
  85. void SetFontName(const CLString &strName)
  86. { m_FontName = strName; }
  87. CXMLDlgItemList& GetItemList() { return m_ItemList; }
  88. // JDG - Made this function public
  89. BOOL CreateDlgTemplate(BOOL fUseOrigItemIDs);
  90. protected:
  91. BOOL ReadRes32(CDlgResFile *pDlgResFile, CLocItemPtrArray * prgLocItem);
  92. BOOL ReadRes32(BYTE *pbBuffer, CLocItemPtrArray * prgLocItem);
  93. VOID GetResIDName(CLocItemPtrArray *prgLocItem, int nLocIndex,
  94. CXMLDlgItem* pItem);
  95. DWORD GetSize();
  96. BOOL GetRect(IXMLDOMNodePtr &pDialogNode);
  97. BOOL SetRect(IXMLDOMNodePtr &pDialogNode);
  98. DWORD GetAttribute(IXMLDOMNodePtr &pDomNode);
  99. void SetAttribute(DWORD dwAttr, IXMLDOMNodePtr &pDomNode);
  100. BOOL GetControls(IXMLDOMNodePtr &pDialogNode);
  101. BOOL SetControls(IXMLDOMNodePtr &pDialogNode);
  102. void AddControl(IXMLDOMNodePtr &pControlNode);
  103. BOOL OnInitDialog(HWND hWndDlg);
  104. void CleanRectArray();
  105. static BOOL CALLBACK DialogProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam);
  106. LPDLGTEMPLATEEX m_pDlgTemplate;
  107. HWND m_hWndDlg;
  108. BOOL m_fHandleCancel;
  109. // Members
  110. DWORD m_nSizeOfStruct;
  111. DWORD m_SubDlgMask;
  112. WORD m_DlgVer;
  113. WORD m_Signature;
  114. DWORD m_HelpID;
  115. DWORD m_ExStyle;
  116. DWORD m_Style;
  117. WORD m_CountDlgItems;
  118. short m_xPos;
  119. short m_yPos;
  120. short m_xSize;
  121. short m_ySize;
  122. CLocId m_Menu; // name or ordinal of a menu resource
  123. CLocId m_WindowClass; // name or ordinal of a window class
  124. CLString m_Title; // title string of the dialog box
  125. short m_FontPointSize;// only if DS_SETFONT flag is set
  126. short m_FontWeight; // only if DS_SETFONT flag is set
  127. short m_bItalic; // only if DS_SETFONT flag is set
  128. CLString m_FontName; // typeface name, if DS_SETFONT is set
  129. CXMLDlgItemList m_ItemList; // List of Dialog Items.
  130. DWORD m_dwBaseUnitX;
  131. DWORD m_dwBaseUnitY;
  132. BOOL m_fHighlightItem;
  133. CPtrArray m_hltRectArray;
  134. static CMap<HWND, HWND&, CXMLDialog*, CXMLDialog*&> sm_XMLDialogMap;
  135. private:
  136. };
  137. #endif // !defined(AFX_XMLDIALOG_H__ADBD45EB_57FA_11D2_A37A_00C04FA31BFB__INCLUDED_)