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.

287 lines
7.5 KiB

  1. /**********************************************************************/
  2. /** Microsoft Windows/NT **/
  3. /** Copyright(c) Microsoft Corp., 1993 **/
  4. /**********************************************************************/
  5. /*
  6. ellipsis.hxx
  7. Definition for fancy enhanced ellipsis-science edit control
  8. FILE HISTORY:
  9. Congpa You (congpay) 01-April-1993 created.
  10. */
  11. #ifndef _BLT_HXX_
  12. #error "Don't include this file directly; instead, include it through blt.hxx"
  13. #endif // _BLT_HXX_
  14. #ifndef _ELLIPSIS_HXX_
  15. #define _ELLIPSIS_HXX_
  16. #include "bltctrl.hxx"
  17. #include "bltedit.hxx"
  18. #include "string.hxx"
  19. enum ELLIPSIS_STYLE
  20. {
  21. ELLIPSIS_NONE, // no ellipsis text
  22. ELLIPSIS_LEFT, // "dotdot" on the left
  23. ELLIPSIS_RIGHT, // "dotdot" on the right - default
  24. ELLIPSIS_CENTER, // "dotdot" in the middle
  25. ELLIPSIS_PATH // "dotdot" for the directory path
  26. };
  27. /*********************************************************************
  28. NAME: BASE_ELLIPSIS
  29. SYNOPSIS: The base class for all ellipsis classes.
  30. INTERFACE:
  31. Init()
  32. Term()
  33. SetEllipsis(NLS_STR * pnlsStr ) // set the ellipsis text
  34. SetEllipsis(TCHAR * lpStr) // set the ellipsis text
  35. QueryOriginalStr()
  36. SetOriginalStr (const TCHAR * psz)
  37. QueryStyle()
  38. SetStyle( const ELLIPSIS_STYLE nStyle = ELLIPSIS_NONE )
  39. QueryText( NLS_STR * pnls )
  40. QueryText( TCHAR * pszBuffer, UINT cbBufSize )
  41. QueryTextLength()
  42. QueryTextSize()
  43. PARENT: BASE
  44. USES: NLS_STR
  45. NOTES:
  46. HISTORY:
  47. Congpa You (congpay) 01-April-1993 Created.
  48. *********************************************************************/
  49. DLL_CLASS BASE_ELLIPSIS : public BASE
  50. {
  51. private:
  52. NLS_STR _nlsOriginalStr; // original string
  53. ELLIPSIS_STYLE _nStyle; // style of the display method
  54. protected:
  55. BASE_ELLIPSIS(ELLIPSIS_STYLE nStyle = ELLIPSIS_NONE);
  56. virtual INT QueryStrLen (NLS_STR nlsStr) = 0;
  57. virtual INT QueryStrLen (const TCHAR * lpStr, INT nIstr) = 0;
  58. virtual INT QueryLimit () = 0;
  59. virtual INT QueryMaxCharWidth() = 0;
  60. APIERR SetEllipsisLeft(NLS_STR * pnls);
  61. APIERR SetEllipsisCenter(NLS_STR * pnls);
  62. APIERR SetEllipsisRight(NLS_STR * pnls);
  63. APIERR SetEllipsisPath(NLS_STR * pnls);
  64. BOOL IsValidStyle( const ELLIPSIS_STYLE nStyle ) const;
  65. public:
  66. static APIERR Init();
  67. static VOID Term();
  68. APIERR SetEllipsis(NLS_STR * pnlsStr ); // set the ellipsis text
  69. APIERR SetEllipsis(TCHAR * lpStr); // set the ellipsis text
  70. NLS_STR QueryOriginalStr() const;
  71. APIERR SetOriginalStr (const TCHAR * psz);
  72. ELLIPSIS_STYLE QueryStyle() const;
  73. VOID SetStyle( const ELLIPSIS_STYLE nStyle = ELLIPSIS_NONE );
  74. APIERR QueryText( NLS_STR * pnls ) const;
  75. APIERR QueryText( TCHAR * pszBuffer, UINT cbBufSize ) const;
  76. INT QueryTextLength() const;
  77. INT QueryTextSize() const;
  78. };
  79. /*********************************************************************
  80. NAME: CONSOLE_ELLIPSIS
  81. SYNOPSIS: The ellipsis class for all console apps.
  82. INTERFACE:
  83. CONSOLE_ELLIPSIS() - constructor
  84. ~CONSOLE_ELLIPSIS() - destructor
  85. SetSize() - change the size of the object
  86. PARENT: BASE_ELLIPSIS
  87. USES: NLS_STR
  88. NOTES:
  89. HISTORY:
  90. Congpa You (congpay) 01-April-1993 Created.
  91. *********************************************************************/
  92. DLL_CLASS CONSOLE_ELLIPSIS : public BASE_ELLIPSIS
  93. {
  94. private:
  95. INT _nLimit;
  96. protected:
  97. virtual INT QueryStrLen (NLS_STR nlsStr);
  98. virtual INT QueryStrLen (const TCHAR * lpStr, INT nIstr);
  99. virtual INT QueryLimit ();
  100. virtual INT QueryMaxCharWidth();
  101. public:
  102. CONSOLE_ELLIPSIS( ELLIPSIS_STYLE nStyle ,
  103. INT nLimit );
  104. VOID SetSize (INT nLimit);
  105. };
  106. /*********************************************************************
  107. NAME: WIN_ELLIPSIS
  108. SYNOPSIS: The ellipsis base class for all Win aware classes.
  109. INTERFACE:
  110. WIN_ELLIPSIS() - constructor
  111. ~WIN_ELLIPSIS() - destructor
  112. SetSize() - change the size of the window object
  113. PARENT: BASE_ELLIPSIS
  114. USES: NLS_STR
  115. NOTES:
  116. HISTORY:
  117. Congpa You (congpay) 01-April-1993 Created.
  118. *********************************************************************/
  119. DLL_CLASS WIN_ELLIPSIS : public BASE_ELLIPSIS
  120. {
  121. private:
  122. DISPLAY_CONTEXT _dc;
  123. RECT _rect;
  124. protected:
  125. virtual INT QueryStrLen (NLS_STR nlsStr);
  126. virtual INT QueryStrLen (const TCHAR * lpStr, INT nIstr);
  127. virtual INT QueryLimit ();
  128. virtual INT QueryMaxCharWidth();
  129. public:
  130. WIN_ELLIPSIS( WINDOW * pwin, ELLIPSIS_STYLE nStyle = ELLIPSIS_NONE);
  131. WIN_ELLIPSIS( WINDOW * pwin, HDC hdc, const RECT * prect, ELLIPSIS_STYLE nStyle = ELLIPSIS_NONE);
  132. VOID SetSize (INT dxWidth, INT dyHeight);
  133. };
  134. /*********************************************************************
  135. NAME: SLT_ELLIPSIS
  136. SYNOPSIS: The ellipsis class for SLT
  137. INTERFACE:
  138. SLT_ELLIPSIS() - constructor
  139. ~SLT_ELLIPSIS() - destructor
  140. SetText()
  141. ClearText()
  142. ResetStyle()
  143. SetSize()
  144. PARENT: WIN_ELLIPSIS, SLT
  145. USES: NLS_STR
  146. NOTES:
  147. HISTORY:
  148. Congpa You (congpay) 01-April-1993 Created.
  149. *********************************************************************/
  150. DLL_CLASS SLT_ELLIPSIS : public SLT, public WIN_ELLIPSIS
  151. {
  152. DECLARE_MI_NEWBASE (SLT_ELLIPSIS);
  153. protected:
  154. APIERR ConvertAndSetStr();
  155. public:
  156. SLT_ELLIPSIS( OWNER_WINDOW * pownd, CID cid, ELLIPSIS_STYLE nStyle = ELLIPSIS_NONE);
  157. SLT_ELLIPSIS( OWNER_WINDOW * pownd, CID cid,
  158. XYPOINT xy, XYDIMENSION dxy,
  159. ULONG flStyle, const TCHAR * pszClassName = CW_CLASS_STATIC,
  160. ELLIPSIS_STYLE nStyle = ELLIPSIS_NONE);
  161. APIERR QueryText( TCHAR * pszBuffer, UINT cbBufSize ) const;
  162. APIERR QueryText( NLS_STR * pnls ) const;
  163. APIERR SetText (const TCHAR * psz);
  164. APIERR SetText (const NLS_STR & nls);
  165. VOID ClearText();
  166. VOID ResetStyle( const ELLIPSIS_STYLE nStyle = ELLIPSIS_NONE );
  167. VOID SetSize (INT dxWidth, INT dyHeight, BOOL fRepaint = TRUE);
  168. };
  169. /*********************************************************************
  170. NAME: STR_DTE_ELLIPSIS
  171. SYNOPSIS: The ellipsis class for STR_DTE
  172. INTERFACE:
  173. STR_DTE_ELLIPSIS() - constructor
  174. ~STR_DTE_ELLIPSIS() - destructor
  175. Paint()
  176. PARENT: STR_DTE
  177. USES: NLS_STR
  178. NOTES:
  179. HISTORY:
  180. Congpa You (congpay) 01-April-1993 Created.
  181. *********************************************************************/
  182. DLL_CLASS STR_DTE_ELLIPSIS : public STR_DTE
  183. {
  184. private:
  185. LISTBOX * _plb;
  186. ELLIPSIS_STYLE _nStyle;
  187. public:
  188. STR_DTE_ELLIPSIS( const TCHAR * pch, LISTBOX * plb, ELLIPSIS_STYLE nStyle = ELLIPSIS_NONE);
  189. virtual VOID Paint (HDC hdc, const RECT * prect) const;
  190. };
  191. #endif // _ELLIPSIS_HXX_ - end of file