PageRenderTime 55ms CodeModel.GetById 27ms RepoModel.GetById 1ms app.codeStats 0ms

/aplus-fsf-4.22/src/MSGUI/MSWidgetOutput.H

#
C Header | 211 lines | 173 code | 30 blank | 8 comment | 0 complexity | c7e9a11a38ae3350abca39808b2d5ce6 MD5 | raw file
Possible License(s): GPL-2.0
  1. #ifndef MSWidgetOutputHEADER
  2. #define MSWidgetOutputHEADER
  3. ///////////////////////////////////////////////////////////////////////////////
  4. //
  5. // Copyright (c) 1997-2008 Morgan Stanley All rights reserved.
  6. // See .../src/LICENSE for terms of distribution
  7. //
  8. //
  9. ///////////////////////////////////////////////////////////////////////////////
  10. #ifndef MSWidgetHEADER
  11. #include <MSGUI/MSWidget.H>
  12. #endif
  13. #include <MSGUI/MSShadow.H>
  14. #include <MSGUI/MSGC.H>
  15. class MSDisplayPrint;
  16. #if HAVE_IOSTREAM
  17. #include <iostream>
  18. #else
  19. #include <iostream.h>
  20. #endif
  21. #if HAVE_FSTREAM
  22. #include <fstream>
  23. #else
  24. class ofstream;
  25. #endif
  26. class MSPixmap;
  27. class MSGUIExport MSWidgetOutput : public MSWidget
  28. {
  29. public:
  30. class MSGUIExport DisplayPrint
  31. {
  32. public:
  33. MSDisplayPrint *_displayPrint;
  34. DisplayPrint(void);
  35. ~DisplayPrint(void);
  36. };
  37. public:
  38. enum OutputMode {Draw=0,DrawPPM=1,Print=2};
  39. protected:
  40. static OutputMode _outputMode;
  41. static DisplayPrint _displayPrint;
  42. public:
  43. MSWidgetOutput(void);
  44. MSWidgetOutput(MSDisplayServer*);
  45. MSWidgetOutput(MSWidget*);
  46. ~MSWidgetOutput(void);
  47. static MSDisplayPrint *displayPrint(void);
  48. static OutputMode outputMode(void);
  49. static void outputMode(OutputMode mode_);
  50. static MSBoolean displayPrintOpen(void);
  51. static MSBoolean displayPrintOpen(MSWidget *);
  52. static MSBoolean displayPrintClose(void);
  53. static int displayPrintMode(void);
  54. static Window displayPrintPixmap(void);
  55. static void displayPrintOriginInc(MSWidget *);
  56. static void displayPrintOriginDec(MSWidget *);
  57. static void displayPrintFileName(const char *);
  58. static void displayPrintXorigin(int);
  59. static void displayPrintYorigin(int);
  60. static void displayPrintInit(MSWidget *);
  61. static void displayPrintClear(void);
  62. static ofstream& displayPrintStream(void);
  63. void XClearArea(Display *,Window,int,int,int,int,int);
  64. void XCopyArea(Display *,Window,Window,GC,int,int,int,int,int,int);
  65. void XDrawArc(Display *,Window,GC,int,int,int,int,int,int);
  66. void XDrawArcs(Display *,Window,GC,XArc *,int);
  67. void XDrawLine(Display *,Window,GC,int,int,int,int);
  68. void XDrawLines(Display *,Window,GC,XPoint *,int,int);
  69. void XDrawSegments(Display *,Window,GC,XSegment *,int);
  70. void XDrawPoint(Display *,Window,GC,int,int);
  71. void XDrawPoints(Display *,Window,GC,XPoint *,int,int);
  72. void XDrawRectangle(Display *,Window,GC,int,int,int,int);
  73. void XDrawRectangles(Display *,Window,GC,XRectangle *,int);
  74. void XDrawString(Display *,Window,GC,const XFontStruct *,int,int,const char *,int);
  75. void XDrawImageString(Display *,Window,GC,const XFontStruct *,int,int,const char *,int);
  76. void XFillArc(Display *,Window,GC,int,int,int,int,int,int);
  77. void XFillArcs(Display *,Window,GC,XArc *,int);
  78. void XFillPolygon(Display *,Window,GC,XPoint *,int,int,int);
  79. void XFillRectangle(Display *,Window,GC,int,int,int,int);
  80. void XFillRectangles(Display *,Window ,GC,XRectangle *,int);
  81. void XBFillPolygon(Display *,Window ,GC,XPoint *,int,int,int);
  82. void XBFillRectangle(Display *,Window ,GC,int,int,int,int);
  83. void XBFillRectangles(Display *,Window ,GC,XRectangle *,int);
  84. void PFillPolygon(Display *,Window ,GC,XPoint *,int,int,int);
  85. void PFillRectangle(Display *,Window ,GC,int,int,int,int);
  86. void PFillRectangles(Display *,Window ,GC,XRectangle *,int);
  87. int XTextWidth(const XFontStruct *,const char *,int) const;
  88. int XTextExtents(const XFontStruct *,const char *,int,int*,int*,int*,XCharStruct*);
  89. void XSetClipRectangles(Display *,GC,int,int,XRectangle *,int,int);
  90. void XSetDashes(Display *,GC,int,const char *,int);
  91. void XFreeGC(Display *,GC);
  92. int XTextLength(const XFontStruct *,const char *) const;
  93. MSBoolean doubleByte(const XFontStruct *) const;
  94. void drawFlatShadow(Window,const MSRect&,int,GC);
  95. void drawBevelShadow(Window,const MSRect&,int,GC,GC);
  96. void drawEtchedShadow(Window,const MSRect&,MSShadowStyle,int,GC,GC);
  97. void drawDiamondShadow(Window,const MSRect&,MSBoolean,GC,GC,GC,GC);
  98. public:
  99. MSShadow& shadow(void);
  100. const MSShadow& shadow(void) const;
  101. GC highlightGC(void) const;
  102. GC bottomShadowGC(void) const;
  103. GC topShadowGC(void) const;
  104. GC backgroundShadowGC(void) const;
  105. GC selectShadowGC(void) const;
  106. unsigned long selectShadowColor(void) const;
  107. unsigned long topShadowColor(void) const;
  108. unsigned long bottomShadowColor(void) const;
  109. unsigned long highlightColor(void) const;
  110. MSShadowStyle shadowStyle(void) const;
  111. int highlightThickness(void) const;
  112. int shadowThickness(void) const;
  113. void shadowStyle(MSShadowStyle);
  114. void highlightThickness(int);
  115. void shadowThickness(int);
  116. void highlightColor(unsigned long);
  117. void highlightColor(const char *);
  118. virtual void clear(void);
  119. // methods for builder support
  120. virtual void set(MSAttrValueList& avList_);
  121. virtual MSAttrValueList& get(MSAttrValueList& avList_);
  122. protected:
  123. void init(void);
  124. void initColors(void);
  125. void createGCs(void);
  126. MSBoolean highlighted(void) const;
  127. MSGC& highlightMSGC(void);
  128. int topShadowOffset(void) const;
  129. void topShadowOffset(int);
  130. void drawBackground(void);
  131. void drawHighlight(void);
  132. void undrawHighlight(void);
  133. void drawShadow(void);
  134. void drawShadow(MSShadowStyle);
  135. void undrawShadow(void);
  136. void drawRaised(void);
  137. void drawSunken(void);
  138. void drawEtchedIn(void);
  139. void drawEtchedOut(void);
  140. void drawRaised(Window,const MSRect&,int);
  141. void drawSunken(Window,const MSRect&,int);
  142. void drawEtchedIn(Window,const MSRect&,int);
  143. void drawEtchedOut(Window,const MSRect&,int);
  144. void undrawBevel(void);
  145. void undrawBevel(const MSRect&,int);
  146. void undrawBevel(Window,const MSRect&,int);
  147. void drawBevel(void);
  148. void drawBevel(int);
  149. void drawBevel(const MSRect&,MSShadowStyle);
  150. void drawBevel(const MSRect&,MSShadowStyle,int);
  151. void drawBevel(Window,const MSRect&,MSShadowStyle,int);
  152. void drawBevel(Window,const MSRect&,int,GC,GC);
  153. void highlight(void);
  154. void unHighlight(void);
  155. void drawHighlightBorder(int);
  156. void undrawHighlightBorder(int);
  157. void drawHighlightBorder(GC,int,int,int,int,int);
  158. void copyPixmap(Display*,const MSPixmap&,Window,GC,int,int);
  159. void copyPixmap(Display*,const MSPixmap&,Window,GC,int,int,int,int,int,int,int,int);
  160. virtual void updateBackground(unsigned long);
  161. private:
  162. Window windowForDrawing(void);
  163. MSBoolean canDraw(void);
  164. int xDrawingOffset(void);
  165. int yDrawingOffset(void);
  166. protected:
  167. MSShadow _shadow;
  168. MSGC _highlightMSGC;
  169. int _highlightThickness;
  170. MSBoolean _highlighted;
  171. unsigned long _highlightColor;
  172. int _shadowThickness;
  173. MSShadowStyle _shadowStyle;
  174. int _topShadowOffset;
  175. };
  176. #ifndef MS_NO_INLINES
  177. #ifndef MSWidgetOutputINLINES
  178. #include <MSGUI/MSWidgetOutputInlines.C>
  179. #endif
  180. #endif
  181. #endif