home *** CD-ROM | disk | FTP | other *** search
/ Enigma Amiga Life 110 / EnigmaAmiga110CD.iso / indispensabili / utility / apdf / xpdf-0.80 / ltk / ltklabel.h < prev    next >
C/C++ Source or Header  |  1998-11-27  |  2KB  |  75 lines

  1. //========================================================================
  2. //
  3. // LTKLabel.h
  4. //
  5. // Copyright 1996 Derek B. Noonburg
  6. //
  7. //========================================================================
  8.  
  9. #ifndef LTKLABEL_H
  10. #define LTKLABEL_H
  11.  
  12. #ifdef __GNUC__
  13. #pragma interface
  14. #endif
  15.  
  16. #include <stddef.h>
  17. #include <X11/Xlib.h>
  18. #include "GString.h"
  19. #include "LTKWidget.h"
  20.  
  21. //------------------------------------------------------------------------
  22. // label size constraint
  23. //------------------------------------------------------------------------
  24.  
  25. enum LTKLabelSize {
  26.   ltkLabelStatic,        // static text (maxLength is ignored)
  27.   ltkLabelFixedWidth,        // fixed width, set by layout
  28.                 //   (maxLength is ignored)
  29.   ltkLabelMaxLength        // width is set to accomodate up
  30.                 //   to maxLength chars
  31. };
  32.  
  33. //------------------------------------------------------------------------
  34. // LTKLabel
  35. //------------------------------------------------------------------------
  36.  
  37. class LTKLabel: public LTKWidget {
  38. public:
  39.  
  40.   //---------- constructor and destructor ----------
  41.  
  42.   LTKLabel(char *name1, int widgetNum1,
  43.        LTKLabelSize size1, int maxLength1,
  44.        char *fontName1, char *text1);
  45.  
  46.   virtual ~LTKLabel();
  47.  
  48.   //---------- special access ----------
  49.  
  50.   void setText(char *text1);
  51.  
  52.   //---------- layout ----------
  53.  
  54.   virtual void layout1();
  55.  
  56.   //---------- drawing ----------
  57.  
  58.   virtual void redraw();
  59.  
  60. protected:
  61.  
  62.   LTKLabelSize size;        // size constraint
  63.   int maxLength;        // max label length
  64.   GString *text;        // the label text
  65.   int length;            // displayed length
  66.   int textHeight;        // size of text
  67.   int textBase;            // baseline offset
  68.  
  69.   char *fontName;        // non-NULL if using a custom font
  70.   XFontStruct *fontStruct;    // font info
  71.   GC textGC;            // GC with text font
  72. };
  73.  
  74. #endif
  75.