home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / yacl-012.zip / ui / label.h < prev    next >
C/C++ Source or Header  |  1995-04-08  |  3KB  |  102 lines

  1.  
  2. #ifndef _label_h_
  3. #define _label_h_
  4.  
  5.  
  6.  
  7.  
  8.  
  9. /*
  10.  *
  11.  *          Copyright (C) 1994, M. A. Sridhar
  12.  *  
  13.  *
  14.  *     This software is Copyright M. A. Sridhar, 1994. You are free
  15.  *     to copy, modify or distribute this software  as you see fit,
  16.  *     and to use  it  for  any  purpose, provided   this copyright
  17.  *     notice and the following   disclaimer are included  with all
  18.  *     copies.
  19.  *
  20.  *                        DISCLAIMER
  21.  *
  22.  *     The author makes no warranties, either expressed or implied,
  23.  *     with respect  to  this  software, its  quality, performance,
  24.  *     merchantability, or fitness for any particular purpose. This
  25.  *     software is distributed  AS IS.  The  user of this  software
  26.  *     assumes all risks  as to its quality  and performance. In no
  27.  *     event shall the author be liable for any direct, indirect or
  28.  *     consequential damages, even if the  author has been  advised
  29.  *     as to the possibility of such damages.
  30.  *
  31.  */
  32.  
  33.  
  34.  
  35. #if defined(__GNUC__)
  36. #pragma interface
  37. #endif
  38.  
  39.  
  40.  
  41. #include "ui/simple.h"
  42.  
  43.   
  44. // This is a simple object that denotes a ``static'' string label, one
  45. // whose contents can be modified by the application but not by the user
  46. // of the application. Its
  47. // title and model are the same entity; 
  48. // modifying either of them modifies the displayed string.
  49.  
  50.  
  51. class CL_EXPORT UI_CompositeVObject;
  52.  
  53. class CL_EXPORT UI_Label: public UI_SimpleVObject {
  54.  
  55. public:
  56.     UI_Label (UI_VObjCollection* parent, 
  57.               const UI_Rectangle& r, UI_ViewID id = -1);
  58.     // Constructor: use this object's own model. The model will be
  59.     // destroyed when this object is destroyed.
  60.  
  61.     UI_Label (UI_VObjCollection* parent, CL_String* model,
  62.               const UI_Rectangle& r, UI_ViewID id = -1);
  63.     // Constructor: use the given string (second parameter) as model. The
  64.     // model string is viewed as ``borrowed'', so it
  65.     // is not this object's responsibility to destroy the model.
  66.  
  67. #if defined(__MS_WINDOWS__)
  68.     UI_Label (UI_CompositeVObject* parent, UI_ViewID id, UI_ViewHandle h);
  69.     // Resource-based constructor (only under MS-Windows).
  70.  
  71. #endif
  72.     
  73.     virtual bool SetTextStyle (UI_TextStyle style);
  74.     // Set the style of text in this label.
  75.  
  76.     virtual UI_TextStyle TextStyle() const;
  77.     // Return the current text style of this label.
  78.     
  79.     virtual UI_WindowClass WindowClass () const;
  80.     
  81.     const char* ClassName() const { return "UI_Label";};
  82.  
  83. protected:
  84.  
  85. #if defined(__X_MOTIF__)
  86.     void _SetupStyle (void*, short&);
  87.     
  88. #endif
  89.     void _PrivateInitialize ();
  90.     
  91.     bool _TitleChanged (CL_Object&, long);
  92.  
  93.     ~UI_Label(){};
  94.     // Protected destructor, to discourage delete operations.
  95.  
  96.     UI_TextStyle _textStyle;
  97. };
  98.  
  99.  
  100.  
  101. #endif
  102.