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.

365 lines
12 KiB

  1. /******************************************************************************
  2. ** I M E S H A R E . H **
  3. ** KentU,KotaroY/MSKK **
  4. ** **
  5. ** With this piece of code, the client Applications will be able to refer **
  6. ** the same TrueInline style described in the Registry. **
  7. ** This library should allow clients to get decoration style (either color **
  8. ** and various underlines) **
  9. ** For underlines, applications are allowed to substitute some of **
  10. ** predefined underlines to other predefined one. **
  11. ** **
  12. ** Oct./23/1995 : Start writing. **
  13. ** Jun./19/1997 : Add new CPP interface. [KotaroY] **
  14. ** Sep./02/1997 : Rewrite. True object-based architecture. [KotaroY] **
  15. ** **
  16. ******************************************************************************/
  17. #ifndef __IMESHARE_H__
  18. #define __IMESHARE_H__
  19. #include <windows.h>
  20. #ifdef IMESHARE_CPL
  21. #include "resource.h"
  22. #endif
  23. #define IMECDECL __cdecl
  24. #define IMESHAREAPI __declspec( dllimport )
  25. typedef WORD LID;
  26. #define UINTIMEBOGUS 0xffffffff
  27. #define IMESATTR_MIN 0
  28. #define IMESATTR_INPUT ATTR_INPUT
  29. #define IMESATTR_TARGET_CONVERTED ATTR_TARGET_CONVERTED
  30. #define IMESATTR_CONVERTED ATTR_CONVERTED
  31. #define IMESATTR_TARGET_NOTCONVERTED ATTR_TARGET_NOTCONVERTED
  32. #define IMESATTR_INPUT_ERROR ATTR_INPUT_ERROR
  33. #define IMESATTR_FIXEDCONVERTED 5
  34. #define IMESATTR_MAX 5
  35. #define CATR (IMESATTR_MAX - IMESATTR_MIN + 1)
  36. #define IMESTY_UL_MIN 2002
  37. #define IMESTY_UL_NONE 2002
  38. #define IMESTY_UL_SINGLE 2003
  39. //OLD #define IMESTY_UL_DOUBLE 2004
  40. #define IMESTY_UL_DOTTED 2005
  41. #define IMESTY_UL_THICK 2006
  42. //OLD #define IMESTY_UL_DASHLINE 2007
  43. //OLD #define IMESTY_UL_DOTDASH 2008
  44. //OLD #define IMESTY_UL_DOTDOTDASH 2009
  45. //OLD #define IMESTY_UL_WAVE 2010
  46. #define IMESTY_UL_LOWER 2011
  47. #define IMESTY_UL_THICKLOWER 2012
  48. #define IMESTY_UL_THICKDITHLOWER 2013
  49. #define IMESTY_UL_DITHLOWER 2014
  50. #define IMESTY_UL_MAX 2014
  51. #define CIMEUL (IMESTY_UL_MAX - IMESTY_UL_MIN + 1)
  52. //WARNING: Based on an assumption that all IDSsty definitions id are consecutive.
  53. //Naming convention IdstyIMEShare[return type][property][subgrouping]
  54. #define IdstyIMEShareSubText 0x0000
  55. #define IdstyIMEShareSubBack 0x0001
  56. #define IdstyIMEShareSubUl 0x0002
  57. #define IdstyIMEShareFBold 0x0100
  58. #define IdstyIMEShareFItalic 0x0200
  59. #define IdstyIMEShareFUl 0x0300
  60. #define IdstyIMEShareUKul 0x0400
  61. #define IdstyIMEShareFWinCol 0x0500
  62. #define IdstyIMEShareFFundCol 0x0600
  63. #define IdstyIMEShareFRGBCol 0x0700
  64. #define IdstyIMEShareFSpecCol 0x0800
  65. #define IdstyIMEShareRGBCol 0x0900
  66. #define IdstyIMEShareFSpecColText 0x0a00
  67. #define IdstyIMEShareFSpecColWindow 0x0b00
  68. #ifdef IMESHARE_CPL
  69. #define IdstyIMEShareUSpecColId 0x0c00
  70. #define IdstyIMEShareUWinColId 0x0d00
  71. #define IdstyIMEShareUFundColId 0x0e00
  72. #define IdstyIMEShareGrfSty 0x0f00
  73. #endif // IMESHARE_CPL
  74. #define COLOR_RGB 0 //RGB()
  75. #define COLOR_WIN 1 //Windows' color scheme.
  76. #define COLOR_FUND 2 //one of 16 fundamental color
  77. #define COLOR_SPEC 3 //special color.
  78. #ifdef IMESHARE_CPL
  79. #define STY_PLAIN IDS_STYPLAIN
  80. #define STY_BOLD IDS_STYBOLD
  81. #define STY_ITALIC IDS_STYITALIC
  82. #define IMECOL_SPEC_MIN IDS_COLAPPTEXT
  83. #define IMECOL_APPTEXT IDS_COLAPPTEXT
  84. #define IMECOL_APPWINDOW IDS_COLAPPWINDOW
  85. #define IMECOL_SPEC_MAX IDS_COLAPPWINDOW + 1
  86. #define COL_FUND_MIN IDS_COLBLACK
  87. #define COL_BLACK IDS_COLBLACK
  88. #define COL_BLUE IDS_COLBLUE
  89. #define COL_CYAN IDS_COLCYAN
  90. #define COL_GREEN IDS_COLGREEN
  91. #define COL_MAGENTA IDS_COLMAGENTA
  92. #define COL_RED IDS_COLRED
  93. #define COL_YELLOW IDS_COLYELLOW
  94. #define COL_WHITE IDS_COLWHITE
  95. #define COL_DKBLUE IDS_COLDKBLUE
  96. #define COL_DKCYAN IDS_COLDKCYAN
  97. #define COL_DKGREEN IDS_COLDKGREEN
  98. #define COL_DKMAGENTA IDS_COLDKMAGENTA
  99. #define COL_DKRED IDS_COLDKRED
  100. #define COL_DKYELLOW IDS_COLDKYELLOW
  101. #define COL_DKGRAY IDS_COLDKGRAY
  102. #define COL_LTGRAY IDS_COLLTGRAY
  103. #define COL_FUND_MAX IDS_COLLTGRAY + 1
  104. #define COL_WIN_MIN IDS_COLSCROLLBAR
  105. #define COL_WIN_SCROLLBAR IDS_COLSCROLLBAR
  106. #define COL_WIN_BACKGROUND IDS_COLBACKGROUND
  107. #define COL_WIN_ACTIVECAPTION IDS_COLACTIVECAPTION
  108. #define COL_WIN_INACTIVECAPTION IDS_COLINACTIVECAPTION
  109. #define COL_WIN_MENU IDS_COLMENU
  110. #define COL_WIN_WINDOW IDS_COLWINDOW
  111. #define COL_WIN_WINDOWFRAME IDS_COLWINDOWFRAME
  112. #define COL_WIN_MENUTEXT IDS_COLMENUTEXT
  113. #define COL_WIN_WINDOWTEXT IDS_COLWINDOWTEXT
  114. #define COL_WIN_CAPTIONTEXT IDS_COLCAPTIONTEXT
  115. #define COL_WIN_ACTIVEBORDER IDS_COLACTIVEBORDER
  116. #define COL_WIN_INACTIVEBORDER IDS_COLINACTIVEBORDER
  117. #define COL_WIN_APPWORKSPACE IDS_COLAPPWORKSPACE
  118. #define COL_WIN_HIGHLIGHT IDS_COLHIGHLIGHT
  119. #define COL_WIN_HIGHLIGHTTEXT IDS_COLHIGHLIGHTTEXT
  120. #define COL_WIN_BTNFACE IDS_COLBTNFACE
  121. #define COL_WIN_BTNSHADOW IDS_COLBTNSHADOW
  122. #define COL_WIN_GRAYTEXT IDS_COLGRAYTEXT
  123. #define COL_WIN_BTNTEXT IDS_COLBTNTEXT
  124. #define COL_WIN_INACTIVECAPTIONTEXT IDS_COLINACTIVECAPTIONTEXT
  125. #define COL_WIN_SHADOW IDS_COLSHADOW
  126. #define COL_WIN_BTNHIGHLIGHT IDS_COLBTNHIGHLIGHT
  127. #define COL_WIN_BTNDKSHADOW IDS_COLBTNDKSHADOW
  128. #define COL_WIN_BTNLIGHT IDS_COLBTNLIGHT
  129. #define COL_WIN_INFOTEXT IDS_COLINFOTEXT
  130. #define COL_WIN_INFOWINDOW IDS_COLINFOWINDOW
  131. #define COL_WIN_MAC COL_WIN_INFOWINDOW + 1
  132. #define RGB_BLACK (RGB( 0, 0, 0))
  133. #define RGB_BLUE (RGB( 0, 0,255))
  134. #define RGB_CYAN (RGB( 0,255,255))
  135. #define RGB_GREEN (RGB( 0,255, 0))
  136. #define RGB_MAGENTA (RGB(255, 0,255))
  137. #define RGB_RED (RGB(255, 0, 0))
  138. #define RGB_YELLOW (RGB(255,255, 0))
  139. #define RGB_WHITE (RGB(255,255,255))
  140. #define RGB_DKBLUE (RGB( 0, 0,127))
  141. #define RGB_DKCYAN (RGB( 0,127,127))
  142. #define RGB_DKGREEN (RGB( 0,127, 0))
  143. #define RGB_DKMAGENTA (RGB(127, 0,127))
  144. #define RGB_DKRED (RGB(127, 0, 0))
  145. #define RGB_DKYELLOW (RGB(127,127, 0))
  146. #define RGB_DKGRAY (RGB(127,127,127))
  147. #define RGB_LTGRAY (RGB(192,192,192))
  148. #endif // IMESHARE_CPL
  149. typedef struct {
  150. union {
  151. UINT grfsty;
  152. struct {
  153. UINT fBold:1;
  154. UINT fItalic:1;
  155. UINT fUl:1;
  156. UINT idUl:(sizeof(UINT) * 8 - 3);
  157. };
  158. };
  159. } GRFSTY;
  160. #ifdef __cplusplus
  161. class CIMEShare{
  162. public:
  163. virtual void IMECDECL CustomizeIMEShare()=0;
  164. virtual BOOL IMECDECL FSupportSty(UINT sty, UINT styAltered)=0;
  165. virtual LID IMECDECL LidSetLid(LID lid)=0;
  166. virtual LID IMECDECL LidGetLid(void)=0;
  167. virtual DWORD IMECDECL DwGetIMEStyle(const UINT attr, const UINT idsty)=0;
  168. virtual BOOL IMECDECL FDeleteIMEShare(void)=0;
  169. virtual DWORD IMECDECL DwGetIMEStyleCpl(const UINT attr, const UINT idsty)=0;
  170. virtual BOOL IMECDECL FSetIMEStyleCpl(const UINT attr, const UINT idsty, DWORD dwval)=0;
  171. virtual BOOL IMECDECL FSaveIMEShareCpl(void)=0;
  172. };
  173. #else //!__cplusplus
  174. typedef struct _CIMEShare CIMEShare;
  175. typedef struct _CIMEShareVtbl{
  176. void (IMECDECL *CustomizeIMEShare)(CIMEShare *This);
  177. BOOL (IMECDECL *FSupportSty)(CIMEShare *This, UINT sty, UINT styAlered);
  178. unsigned short (IMECDECL *LidSetLid)(CIMEShare *This, unsigned short lid);
  179. unsigned short (IMECDECL *LidGetLid)(CIMEShare *This);
  180. DWORD (IMECDECL *DwGetIMEStyle)(CIMEShare *This, UINT attr, UINT idsty);
  181. BOOL (IMECDECL *FDeleteIMEShare)(CIMEShare *This);
  182. DWORD (IMECDECL *DwGetIMEStyleCpl)(CIMEShare *This, UINT attr, UINT idsty);
  183. BOOL (IMECDECL *FSetIMEStyleCpl)(CIMEShare *This, UINT attr, UINT idsty, DWORD dwVal);
  184. BOOL (IMECDECL *FSaveIMEShareCpl)(CIMEShare *This);
  185. } CIMEShareVtbl;
  186. typedef struct _CIMEShare{
  187. const CIMEShareVtbl *lpVtbl;
  188. } CIMEShare;
  189. #endif //__cplusplus
  190. #ifdef __cplusplus
  191. extern "C"{
  192. #endif
  193. CIMEShare * IMECDECL PIMEShareCreate();
  194. typedef CIMEShare * (IMECDECL FNPIMESHARECREATE)(void);
  195. #ifdef __cplusplus
  196. }
  197. #endif
  198. #ifdef OBSOLETE
  199. typedef struct {
  200. UINT colorId;
  201. union {
  202. COLORREF rgb;
  203. UINT colorWin;
  204. UINT colorSpec;
  205. UINT colorFund;
  206. };
  207. } IMECOLORSTY;
  208. typedef struct {
  209. union {
  210. GRFSTY grfsty;
  211. struct {
  212. UINT fBold:1;
  213. UINT fItalic:1;
  214. UINT fUl:1;
  215. UINT idUl:(sizeof(UINT) * 8 - 3);
  216. };
  217. };
  218. union {
  219. IMECOLORSTY colorstyText;
  220. struct {
  221. UINT colorIdText;
  222. union {
  223. COLORREF rgbText;
  224. UINT colorWinText;
  225. UINT colorSpecText;
  226. UINT colorFundText;
  227. };
  228. };
  229. };
  230. union {
  231. IMECOLORSTY colorstyBack;
  232. struct {
  233. UINT colorIdBack;
  234. union {
  235. COLORREF rgbBack;
  236. UINT colorWinBack;
  237. UINT colorSpecBack;
  238. UINT colorFundBack;
  239. };
  240. };
  241. };
  242. union {
  243. IMECOLORSTY colorstyUl;
  244. struct {
  245. UINT colorIdUl;
  246. union {
  247. COLORREF rgbUl;
  248. UINT colorWinUl;
  249. UINT colorSpecUl;
  250. UINT colorFundUl;
  251. };
  252. };
  253. };
  254. } IMESTYLE;
  255. #ifdef __cplusplus
  256. extern "C"{
  257. #endif
  258. //Functions
  259. #if 0 // no need to redefine DllMain.
  260. #ifndef PEGASUS
  261. IMESHAREAPI BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved);
  262. #endif
  263. #endif
  264. IMESHAREAPI BOOL IMECDECL FInitIMEShare();
  265. IMESHAREAPI void IMECDECL CustomizeIMEShare();
  266. IMESHAREAPI void IMECDECL EndIMEShare();
  267. // Multilingual support
  268. LID IMECDECL LidGetLid(void);
  269. LID IMECDECL LidSetLid(LID NewValue);
  270. //Refresh notify support
  271. IMESHAREAPI BOOL IMECDECL FRefreshStyle();
  272. //substitution
  273. IMESHAREAPI BOOL IMECDECL FSupportSty(UINT sty, UINT styAltered);
  274. //style handling
  275. IMESHAREAPI const IMESTYLE * IMECDECL PIMEStyleFromAttr(const UINT attr);
  276. IMESHAREAPI const IMECOLORSTY * IMECDECL PColorStyleTextFromIMEStyle(const IMESTYLE * pimestyle);
  277. IMESHAREAPI const IMECOLORSTY * IMECDECL PColorStyleBackFromIMEStyle(const IMESTYLE * pimestyle);
  278. #define PIMESTY(x) (PIMEStyleFromAttr(x))
  279. #define PTEXTIMECOL(x) (PColorStyleTextFromIMEStyle(PIMESTY(x)))
  280. #define PBACKIMECOL(x) (PColorStyleBackFromIMEStyle(PIMESTY(x)))
  281. IMESHAREAPI BOOL IMECDECL FBoldIMEStyle(const IMESTYLE *pimestyle);
  282. IMESHAREAPI BOOL IMECDECL FItalicIMEStyle(const IMESTYLE *pimestyle);
  283. IMESHAREAPI BOOL IMECDECL FUlIMEStyle(const IMESTYLE *pimestyle);
  284. IMESHAREAPI UINT IMECDECL IdUlIMEStyle(const IMESTYLE *pimestyle);
  285. //color handling
  286. IMESHAREAPI BOOL IMECDECL FWinIMEColorStyle(const IMECOLORSTY *pcolorstyle);
  287. IMESHAREAPI BOOL IMECDECL FFundamentalIMEColorStyle(const IMECOLORSTY *pcolorstyle);
  288. IMESHAREAPI BOOL IMECDECL FRGBIMEColorStyle(const IMECOLORSTY *pcolorstyle);
  289. IMESHAREAPI BOOL IMECDECL FSpecialIMEColorStyle(const IMECOLORSTY *pcolorstyle);
  290. IMESHAREAPI BOOL IMECDECL FSpecialTextIMEColorStyle(const IMECOLORSTY *pcolorstyle);
  291. IMESHAREAPI BOOL IMECDECL FSpecialWindowIMEColorStyle(const IMECOLORSTY *pcolorstyle);
  292. IMESHAREAPI COLORREF IMECDECL RGBFromIMEColorStyle(const IMECOLORSTY *pcolorstyle);
  293. #ifdef IMESHARE_CPL
  294. IMESHAREAPI UINT IMECDECL IdSpecialFromIMEColorStyle(const IMECOLORSTY *pcolorstyle);
  295. IMESHAREAPI UINT IMECDECL IdWinFromIMEColorStyle(const IMECOLORSTY *pcolorstyle);
  296. IMESHAREAPI UINT IMECDECL IdFundamentalFromIMEColorStyle(const IMECOLORSTY *pcolorstyle);
  297. IMESHAREAPI GRFSTY IMECDECL GrfStyIMEStyle(const IMESTYLE *pimestyle);
  298. IMESHAREAPI BOOL IMECDECL FGetIMEStyleAttr(IMESTYLE *pimestyle, const UINT attr);
  299. IMESHAREAPI BOOL IMECDECL FSetIMEStyleAttr(const IMESTYLE *pimestyle, const UINT attr);
  300. IMESHAREAPI BOOL IMECDECL FSetIMEColorStyle(UINT attr, BOOL fTextCol, UINT id, DWORD col);
  301. IMESHAREAPI BOOL IMECDECL FSetIMEStyle(const UINT attr, BOOL fBold, BOOL fItalic, BOOL fUl, UINT idUl);
  302. IMESHAREAPI BOOL IMECDECL FSaveIMEShareSetting(void);
  303. #endif // IMESHARE_CPL
  304. #ifdef __cplusplus
  305. }
  306. #endif
  307. #endif // OBSOLETE
  308. #endif // __IMESHARE_H__