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.

220 lines
7.8 KiB

  1. #ifndef __XMLDlgItem_H__
  2. #define __XMLDlgItem_H__
  3. /////////////////////////////////////////////////////////////////////////////
  4. // Includes
  5. #include "XMLBase.h"
  6. // This is to disable the UnReferenced Local Vars in STL
  7. #pragma warning( disable : 4100 4245 4786)
  8. #define __PLACEMENT_NEW_INLINE
  9. #include <list>
  10. using namespace std;
  11. #pragma warning( default : 4100 4245 )
  12. /////////////////////////////////////////////////////////////////////////////
  13. // Structure Declaration
  14. // Although the structure is documented, It is not declared in Windows headers??
  15. #if 0
  16. #pragma pack(push, 1)
  17. struct DLGITEMTEMPLATEEX
  18. {
  19. DWORD helpID;
  20. DWORD exStyle;
  21. DWORD style;
  22. short x;
  23. short y;
  24. short cx;
  25. short cy;
  26. DWORD id; // PAT According to the help, this should be a WORD but when I took
  27. // it from ATLWin declaration, it was a DWORD. This could present
  28. // serious problems! As MFC also declares this as a DWORD, I have
  29. // made a majarity rules decision.
  30. // Everything else in this structure is variable length,
  31. // and therefore must be determined dynamically
  32. // sz_Or_Ord windowClass; // name or ordinal of a window class
  33. // sz_Or_Ord title; // title string or ordinal of a resource
  34. // WORD extraCount; // bytes following creation data
  35. };
  36. #pragma pack(pop)
  37. #endif
  38. typedef DLGITEMTEMPLATEEX *LPDLGITEMTEMPLATEEX;
  39. class LTAPIENTRY CXMLDlgItem : public CXMLBase
  40. {
  41. public:
  42. friend class CXMLDialog;
  43. enum EDlgItemType
  44. {
  45. DIT_CONTROL, // generic control (unknown)
  46. DIT_STATIC, // static control
  47. DIT_ICON, // icon
  48. DIT_RECT, // rectangle
  49. DIT_FRAME, // frame
  50. DIT_BITMAP, // bitmap
  51. DIT_METAFILE, // metafile
  52. DIT_OWNERDRAWBUTTON, // owner draw button
  53. DIT_PUSHBUTTON, // pushbutton
  54. DIT_CHECKBOX, // checkbox
  55. DIT_RADIOBUTTON, // radio button
  56. DIT_GROUPBOX, // group box
  57. DIT_EDIT, // edit box
  58. DIT_COMBOBOX, // combo box
  59. DIT_LISTBOX, // listbox
  60. DIT_SCROLLBAR, // scroll bar
  61. DIT_LISTVIEW, // list view control
  62. DIT_TREEVIEW, // tree view control
  63. DIT_TABCONTROL, // tab control
  64. DIT_TABCONTROL16, // tab control (16 bit)
  65. DIT_ANIMATE, // animate control
  66. DIT_HOTKEY, // hotkey control
  67. DIT_TRACKBAR, // trackbar
  68. DIT_PROGRESS, // progress bar
  69. DIT_UPDOWN, // up-down control
  70. DIT_RICHEDIT, // rich edit control
  71. DIT_IPADDRESS, // ip address control
  72. DIT_HEADER, // header control
  73. DIT_PAGER, // pager control
  74. DIT_TOOLBAR, // toolbar control
  75. DIT_DIALOG, // dialog (nested)
  76. DIT_MENUITEM, // menu item
  77. DIT_RICHEDIT20, // rich edit 2.0 (Windows NT 4.0)
  78. DIT_COOLBAR, // cool bar (IE 3.0)
  79. DIT_COMBOBOXEX, // combo box Ex (IE 3.0)
  80. DIT_DATETIMEPICKER, // date time picker (IE 3.0)
  81. DIT_MONTHCAL, // month calendar (IE 3.0)
  82. DIT_OWNERDRAW, // static control: owner-draw (fix)
  83. DIT_USERITEM, // static control: user item (fix)
  84. DIT_SDM_CONTROL, // SDM generic control (unknown)
  85. DIT_SDM_STATICTEXT, // SDM static text
  86. DIT_SDM_PUSHBUTTON, // SDM push button
  87. DIT_SDM_CHECKBOX, // SDM check box
  88. DIT_SDM_RADIOBUTTON, // SDM radio button
  89. DIT_SDM_GROUPBOX, // SDM group box
  90. DIT_SDM_EDIT, // SDM edit
  91. DIT_SDM_FORMATTEDTEXT, // SDM formatted text
  92. DIT_SDM_LISTBOX, // SDM list box
  93. DIT_SDM_DROPLIST, // SDM drop list
  94. DIT_SDM_BITMAP, // SDM bitmap
  95. DIT_SDM_GENERALPICTURE, // SDM general picture
  96. DIT_SDM_SCROLL, // SDM scroll bar
  97. DIT_SDM_COMBO_EDIT, // SDM combo edit
  98. DIT_SDM_SPIN_EDIT, // SDM spin edit
  99. DIT_SDM_CONTROL_TITLE, // SDM control title
  100. DIT_SDM_TAB_CONTROL, // SDM tab control
  101. DIT_UNKNOWN // unknown control
  102. };
  103. enum
  104. {
  105. WORD_SIZE = 2,
  106. WORD_ALIGN = WORD_SIZE - 1
  107. };
  108. // Construction
  109. CXMLDlgItem();
  110. // Destruction
  111. ~CXMLDlgItem();
  112. public:
  113. BOOL Init(IXMLDOMNodePtr &pControlNode);
  114. BOOL Update(IXMLDOMNodePtr &pControlNode);
  115. // Get/Set
  116. DWORD GetSize() { return m_nSizeOfStruct; }
  117. DWORD GetHelpID() { return m_HelpID; }
  118. DWORD GetExStyle() { return m_ExStyle; }
  119. void SetExStyle(DWORD dwExStyle)
  120. { m_ExStyle = dwExStyle; }
  121. DWORD GetStyle() { return m_Style; }
  122. void SetStyle(DWORD dwStyle)
  123. { m_Style = dwStyle; }
  124. short GetXPos() { return m_xPos; }
  125. void SetXPos(short xPos) { m_xPos = xPos; }
  126. short GetYPos() { return m_yPos; }
  127. void SetYPos(short yPos) { m_yPos = yPos; }
  128. short GetXSize() { return m_xSize; }
  129. void SetXSize(short xSize)
  130. { m_xSize = xSize; }
  131. short GetYSize() { return m_ySize; }
  132. void SetYSize(short ySize)
  133. { m_ySize = ySize; }
  134. DWORD GetItemID() { return m_ItemID; }
  135. VOID SetItemID(DWORD dwNewID);
  136. DWORD GetOrigItemID() { return m_OrigItemID; }
  137. CLString GetItemName() { return m_ItemName; }
  138. EDlgItemType GetItemType() { return m_DlgItemType; }
  139. DWORD GetTabOrder() { return m_TabOrder; }
  140. const CLocId & GetWindowClass() { return m_WindowClass; }
  141. void SetWindowClass(const CLocId &lidClass);
  142. CLString GetTitle() { return m_Title; }
  143. void SetTitle(const CLString strNewTitle) { m_Title = strNewTitle; }
  144. CLString GetText() { return m_ControlText; }
  145. WORD GetCountExtraBytes(){ return m_CountExtraBytes; }
  146. BYTE* GetExtraBytes() { return m_pExtraBytes; }
  147. CLString GetCurrInfo() { return m_szCurrInfo; }
  148. LPDLGITEMTEMPLATEEX GetDlgItemTemplate() { return m_pDlgItemTemplate; }
  149. BOOL SetText(HWND hWndControl);
  150. protected:
  151. BOOL GetRect(IXMLDOMNodePtr &pControlNode);
  152. BOOL SetRect(IXMLDOMNodePtr &pControlNode);
  153. DWORD GetAttribute(IXMLDOMNodePtr &pDomNode);
  154. void SetAttribute(DWORD dwAttr, IXMLDOMNodePtr &pDomNode);
  155. BOOL GetControlText(IXMLDOMNodePtr &pControlNode);
  156. void SetControlText(IXMLDOMNodePtr &pControlNode);
  157. BOOL CreateDlgItemTemplate(BOOL fUseOrigItemIDs);
  158. DWORD CalculateSize();
  159. BOOL GetControlClass(IXMLDOMNodePtr &pControlNode);
  160. void GetControlType(IXMLDOMNodePtr &pControlNode);
  161. void ChangeControlStyle();
  162. BOOL SetListBoxOrComboBoxText(HWND hWndControl, UINT uMsg, int nErr);
  163. BOOL SetTabControlText(HWND hWndControl);
  164. void SetButtonState(HWND hWndControl);
  165. DWORD m_nSizeOfStruct;
  166. DWORD m_HelpID;
  167. DWORD m_ExStyle;
  168. DWORD m_Style;
  169. short m_xPos;
  170. short m_yPos;
  171. short m_xSize;
  172. short m_ySize;
  173. DWORD m_ItemID;
  174. DWORD m_OrigItemID; // Original ItemID
  175. CLString m_ItemName; // Unique name ID
  176. DWORD m_TabOrder; // tab order of this control
  177. CLocId m_WindowClass; // name or ordinal of a window class
  178. CLString m_Title; // title string of the dialog box
  179. CLString m_ControlText; // Additional text
  180. CLString m_szCurrInfo; // Current info
  181. WORD m_CountExtraBytes; // bytes of following creation data
  182. BYTE* m_pExtraBytes; // Pointer to extra bytes
  183. EDlgItemType m_DlgItemType; // Dialog item type
  184. LPDLGITEMTEMPLATEEX m_pDlgItemTemplate;
  185. };
  186. // Global routines for serialing data
  187. DWORD DWordFromHexString (const char *psz);
  188. DWORD Write(LPBYTE pByte, DWORD Count, LPBYTE& lpOut);
  189. DWORD WriteNameOrd(const CLocId &lid, LPBYTE& lpOut);
  190. typedef list<CXMLDlgItem*> CXMLDlgItemList;
  191. #endif