home *** CD-ROM | disk | FTP | other *** search
/ Tools / WinSN5.0Ver.iso / NETSCAP.50 / WIN1998.ZIP / ns / lib / mac / UserInterface / CCaption.h < prev    next >
Encoding:
C/C++ Source or Header  |  1998-04-08  |  2.3 KB  |  86 lines

  1. /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
  2.  *
  3.  * The contents of this file are subject to the Netscape Public License
  4.  * Version 1.0 (the "NPL"); you may not use this file except in
  5.  * compliance with the NPL.  You may obtain a copy of the NPL at
  6.  * http://www.mozilla.org/NPL/
  7.  *
  8.  * Software distributed under the NPL is distributed on an "AS IS" basis,
  9.  * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
  10.  * for the specific language governing rights and limitations under the
  11.  * NPL.
  12.  *
  13.  * The Initial Developer of this code under the NPL is Netscape
  14.  * Communications Corporation.  Portions created by Netscape are
  15.  * Copyright (C) 1998 Netscape Communications Corporation.  All Rights
  16.  * Reserved.
  17.  */
  18.  
  19.  
  20. // CCaption.h
  21.  
  22. #pragma once
  23.  
  24. #include <LCaption.h>
  25. #include <LListener.h>
  26.  
  27. class LStream;
  28.  
  29. typedef Int32 LabelNum;
  30.  
  31. //    CCaption
  32. //
  33. //     Moved from meditdlg.cp to be used as base class for the Listener/Lcaption derived 
  34. //    class ( CListenerCaption ).
  35. //
  36. // ----
  37. // 
  38. //     this class is draw a caption in a disabled state if appropriate
  39. //
  40.  
  41. class CCaption : public LCaption
  42. {
  43.     public:
  44.         enum { class_ID = 'CapD' };
  45.  
  46.                         CCaption( LStream* inStream ) : LCaption ( inStream ) {};
  47.     
  48.         virtual void    DrawSelf();
  49.         virtual void    EnableSelf();
  50.         virtual void    DisableSelf();
  51. };
  52.  
  53. //    CListenerCaption
  54. //
  55. //    A simple label class that is also a listener. It listens to 
  56. //    messages and changes its content (i.e. text ). 
  57. //
  58. //    *** The Init method needs to be called before this class can be used.
  59. //
  60. //     *** Needs exceptions support
  61.  
  62. class CListenerCaption : public CCaption, public LListener
  63. {
  64.     public:
  65.         enum { class_ID = 'CCap' };                         // class id 
  66.         enum { default_menu_item = 1 };                        // initial defualt menu item
  67.                                         
  68.                             CListenerCaption( LStream *inStream );
  69.         virtual                ~CListenerCaption();
  70.         
  71.         virtual void        Init( const short strResID, const MessageT& getNew_msg ); 
  72.         
  73.         virtual void         ChangeText(  const LabelNum& newLabelNum  );
  74.         virtual void        ListenToMessage( MessageT inMessage, void *ioParam );        
  75.         
  76.             LabelNum        GetLabelNum() const;
  77.             void            SetLabelNum(  const LabelNum& newLabelNum  );
  78.             
  79.     protected:
  80.     
  81.     private:
  82.         LabelNum            labelNum;
  83.         short                resourceID;
  84.         MessageT            mMsg_changeText;
  85. };
  86.