home *** CD-ROM | disk | FTP | other *** search
/ Tools / WinSN5.0Ver.iso / NETSCAP.50 / WIN1998.ZIP / ns / cmd / macfe / gui / CURLEditField.h < prev    next >
Encoding:
C/C++ Source or Header  |  1998-04-08  |  2.4 KB  |  73 lines

  1. /* -*- Mode: C++; tab-width: 4; 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. //    CURLEditField.h
  21. // ╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤
  22. //
  23. //    This is the URL EditField for the browser.
  24. //    It updates the text via broadcasts from a CNSContext, and it broadcasts
  25. //    a message when the user types a key (so that we can change "Location" to "Goto")
  26. //    and when the user hits return or enter
  27.  
  28. #pragma once
  29.  
  30. #include <LListener.h>
  31. #include <LBroadcaster.h>
  32.  
  33. //#include "VEditField.h"
  34. #include "CTSMEditField.h"
  35.  
  36. #include "PascalString.h" // for CString and subclasses
  37.  
  38. // Messages broadcasted by CURLEditField
  39. enum {
  40.     // user hit enter or return
  41.     msg_UserSubmittedURL        =    'USuU',    // CStr255*    url
  42.     // user typed into edit field
  43.     msg_UserChangedURL            =    'UChU'    // <none>
  44. };
  45.  
  46. //    CURLEditField
  47. //
  48. //    This class is similar to CURLText in mviews.cp, but it listens directly for
  49. //    layout new document messages to set it's text
  50.  
  51. class CURLEditField : public CTSMEditField, public LBroadcaster, public LListener
  52. {
  53.     public:
  54.         enum { class_ID = 'UEdF' };
  55.         
  56.                                 CURLEditField(LStream* inStream);
  57.         virtual                    ~CURLEditField() {};
  58.         
  59.         virtual Boolean        HandleKeyPress(const EventRecord& inKeyEvent);
  60.         void                DrawSelf();
  61.         virtual void        ClickSelf(const SMouseDownEvent& inMouseDown);
  62.         virtual void        ListenToMessage(MessageT inMessage, void* ioParam);
  63.  
  64.         virtual Boolean        ObeyCommand(CommandT inCommand,
  65.                                         void *ioParam = nil);
  66.  
  67.     protected:
  68.         virtual Boolean        DisplayURL(CStr255& inURL);
  69.         virtual void        BeTarget();
  70.     
  71.         Boolean                mURLStringInSync;
  72. };
  73.