gml_TextRender_cpp.h

Go to the documentation of this file.
00001 /// @file gml_TextRender_cpp.h
00002 ///
00003 ///    C++ interface to text rendering services. @see gml_TextRender.h.
00004 ///
00005 ///  Copyright (c) 2004 CLIPS-IMAG
00006 ///
00007 ///  See the file "gml_LicenseTerms.txt" for information on usage and redistribution
00008 ///  of this file, and for a DISCLAIMER OF ALL WARRANTIES.
00009 ///
00010 ///  Created on February 8, 2004 (FB).
00011 
00012 #ifndef __GML_TEXTRENDER_CPP__
00013 #define __GML_TEXTRENDER_CPP__
00014 
00015 #include "gml/image/gml_Drawable.h"
00016 #include "gml/image/gml_Pixmap.h"
00017 #include "gml/ui/gml_TextRender.h"
00018 
00019 /// @bug this header shouldn't depend on tcl and tk
00020 #include "tcl.h"
00021 #include "tk.h"
00022 
00023 /// @bug doesn't work if the Tk main window hasn't been mapped yet
00024 
00025 struct Tcl_Interp;
00026 
00027 //
00028 // gmlTTextRender --
00029 //   Text-rendering objects (singleton pattern class)
00030 //   @see gml_TextRender.h for documentation.
00031 //
00032 class gmlTTextRender
00033 {
00034 public:
00035 
00036   // See "gml/ui/gml_TextRender.h" for an explanation of text render methods and parameters.
00037 
00038   gml_TError          Init     (Tcl_Interp*               tcl_interp  = (Tcl_Interp*)NULL);
00039   void                Dispose  ();
00040 
00041   gml_TError          Render   (char*                     text        = (char*)NULL,
00042         char*                     font        = (char*)NULL,
00043         int*                      wrapWidth   = (int*)NULL,
00044         gml_TTextRender_Justify*  justify     = (gml_TTextRender_Justify*)NULL,
00045         gml_TRGBColor*            fgColor     = (gml_TRGBColor*)NULL,
00046         gml_TRGBColor*            bgColor     = (gml_TRGBColor*)NULL);
00047 
00048   inline
00049   gml_TBitmap*        Bitmap ()
00050       { return fBitmap; }
00051 
00052 
00053 protected:
00054 
00055   // Static data member management.
00056 
00057   gml_TError          Initialize (Tcl_Interp* interp    = (Tcl_Interp*)NULL);
00058   void                Finalize ();
00059 
00060   static int          fRefCount;
00061   static Tcl_Interp*  fInterp;
00062   static gml_TBoolean fFreeInterp;
00063   static Tk_Window    fMainWindow;
00064   static gml_TDisplay fDisplay;
00065 
00066   // Instance data members.
00067 
00068   gml_TBoolean        fInitialized;
00069 
00070   char*               fText;
00071   char*               fFont;
00072 
00073   gml_TPixmap         fPixmap;
00074   gml_TBitmap*        fBitmap;
00075 
00076   Tk_Font             fTkFont;
00077   Tk_TextLayout       fTextLayout;
00078   GC                  fGC;
00079   XColor              fFgColor;
00080   gml_TRGBColor       fBgColor;
00081 };
00082 
00083 
00084 
00085 
00086 #endif
Generated on Tue Jun 12 14:03:27 2007 for gml by Doxygen 1.5.2.