# SoAsciiText.h

    00001 #ifndef COIN_SOASCIITEXT_H
    00002 #define COIN_SOASCIITEXT_H
    00003
    00004 /**************************************************************************\
    00005  *
    00006  *  This file is part of the Coin 3D visualization library.
    00007  *  Copyright (C) 1998-2003 by Systems in Motion.  All rights reserved.
    00008  *
    00009  *  This library is free software; you can redistribute it and/or
    00010  *  modify it under the terms of the GNU General Public License
    00011  *  ("GPL") version 2 as published by the Free Software Foundation.
    00012  *  See the file LICENSE.GPL at the root directory of this source
    00013  *  distribution for additional information about the GNU GPL.
    00014  *
    00015  *  For using Coin with software that can not be combined with the GNU
    00016  *  GPL, and for taking advantage of the additional benefits of our
    00017  *  support services, please contact Systems in Motion about acquiring
    00018  *  a Coin Professional Edition License.
    00019  *
    00020  *  See <URL:http://www.coin3d.org> for  more information.
    00021  *
    00022  *  Systems in Motion, Teknobyen, Abels Gate 5, 7030 Trondheim, NORWAY.
    00023  *  <URL:http://www.sim.no>.
    00024  *
    00025 \**************************************************************************/
    00026
    00027 #include <Inventor/nodes/SoSubNode.h>
    00028 #include <Inventor/nodes/SoShape.h>
    00029 #include <Inventor/fields/SoMFString.h>
    00030 #include <Inventor/fields/SoSFFloat.h>
    00031 #include <Inventor/fields/SoSFEnum.h>
    00032 #include <Inventor/fields/SoMFFloat.h>
    00033 #include <Inventor/lists/SbList.h>
    00034
    00035 class COIN_DLL_API SoAsciiText : public SoShape {
    00036   typedef SoShape inherited;
    00037
    00038   SO_NODE_HEADER(SoAsciiText);
    00039
    00040 public:
    00041   static void initClass(void);
    00042   SoAsciiText(void);
    00043
    00044   enum Justification {
    00045     LEFT = 1,
    00046     RIGHT,
    00047     CENTER
    00048   };
    00049
    00050   SoMFString string;
    00051   SoSFFloat spacing;
    00052   SoSFEnum justification;
    00053   SoMFFloat width;
    00054
    00055   virtual void GLRender(SoGLRenderAction * action);
    00056   virtual void getPrimitiveCount(SoGetPrimitiveCountAction * action);
    00057
    00058 protected:
    00059   virtual ~SoAsciiText();
    00060
    00061   virtual void computeBBox(SoAction * action, SbBox3f & box, SbVec3f & center);
    00062   virtual void generatePrimitives(SoAction *);
    00063
    00064   virtual SoDetail * createTriangleDetail(SoRayPickAction * action,
    00065                                           const SoPrimitiveVertex * v1,
    00066                                           const SoPrimitiveVertex * v2,
    00067                                           const SoPrimitiveVertex * v3,
    00068                                           SoPickedPoint * pp);
    00069   virtual void notify(SoNotList * list);
    00070
    00071 private:
    00072   class SoAsciiTextP * pimpl;
    00073   friend class SoAsciiTextP;
    00074
    00075   float getWidth(const int idx, const float fontsize);
    00076 };
    00077
    00078 #endif // !COIN_SOASCIITEXT_H