home *** CD-ROM | disk | FTP | other *** search
/ Tools / WinSN5.0Ver.iso / NETSCAP.50 / WIN1998.ZIP / ns / cmd / winfe / javaio.h < prev    next >
Encoding:
C/C++ Source or Header  |  1998-04-08  |  3.7 KB  |  137 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. #ifndef __JavaConsoleWindow_H
  20. #define __JavaConsoleWindow_H
  21. // javaio.h : header file
  22. //
  23.  
  24. #include "prfile.h"
  25.  
  26.  
  27. /////////////////////////////////////////////////////////////////////////////
  28. // CNSPRStream abstract class
  29.  
  30. class CNSPRStream
  31. {
  32. public:
  33.     CNSPRStream(void);
  34.  
  35.     void MapFileDescriptor( PROSFD fd );
  36.  
  37. protected:
  38.     virtual int32 Init  (PRFileDesc *fd)                                = 0;
  39.     virtual int32 Close (PRFileDesc *fd)                                = 0;
  40.     virtual int32 Read  (PRFileDesc *fd, void *buf, int32 amount)       = 0;
  41.     virtual int32 Write (PRFileDesc *fd, const void *buf, int32 amount) = 0;
  42.  
  43.     static int32 InitMethod  (PRFileDesc * fd);
  44.     static int32 CloseMethod (PRFileDesc * fd);
  45.     static int32 ReadMethod  (PRFileDesc * fd, void *buf, int32 amount);
  46.     static int32 WriteMethod (PRFileDesc * fd, const void *buf, int32 amount);
  47.  
  48. // Member data
  49. protected:
  50.     static PRIOMethods IOMethods;
  51. };
  52.  
  53.  
  54. /////////////////////////////////////////////////////////////////////////////
  55. // CJavaStdError stream
  56.  
  57. class CJavaStdError : public CNSPRStream
  58. {
  59. public:
  60.     CJavaStdError(void);
  61.  
  62. // Overrides
  63. protected:
  64.     virtual int32 Init (PRFileDesc *fd);
  65.     virtual int32 Close(PRFileDesc *fd);
  66.     virtual int32 Read (PRFileDesc *fd, void *buf, int32 amount);
  67.     virtual int32 Write(PRFileDesc *fd, const void *buf, int32 amount);
  68. };
  69.  
  70. class CJavaOutputWnd;
  71. /////////////////////////////////////////////////////////////////////////////
  72. // CJavaStdOutput
  73. class CJavaStdOutput : public CWinThread, public CNSPRStream
  74. {
  75. public:
  76.     CJavaStdOutput(void);
  77.     virtual ~CJavaStdOutput();
  78.  
  79.     BOOL ToggleVisible(void);
  80.     BOOL IsVisible(void);
  81.  
  82. // Overrides
  83.     BOOL PreTranslateMessage(MSG* pMsg);
  84.     BOOL InitInstance(void);
  85.     int ExitInstance(void);
  86.  
  87. // Overrides
  88. protected:
  89.     virtual int32 Init (PRFileDesc *fd);
  90.     virtual int32 Close (PRFileDesc *fd);
  91.     virtual int32 Read  (PRFileDesc *fd, void *buf, int32 amount);
  92.     virtual int32 Write (PRFileDesc *fd, const void *buf, int32 amount);
  93.  
  94. // Member Data
  95.     CJavaOutputWnd *m_pWnd;
  96.     DWORD           m_ThreadId;
  97.     PRThread       *m_pOwnThread;
  98.     PRMonitor      *m_pOutputMon;
  99.  
  100.     UINT            m_msgWrite;
  101. };
  102.  
  103.  
  104. /////////////////////////////////////////////////////////////////////////////
  105. // CJavaStdOutput window
  106.  
  107. class CJavaOutputWnd : public CFrameWnd
  108. {
  109.     DECLARE_DYNCREATE(CJavaOutputWnd)
  110.  
  111. public:
  112.     CJavaOutputWnd(void);
  113.     virtual ~CJavaOutputWnd();
  114.  
  115.     BOOL Initialize(PRMonitor *pOutMon);
  116.     void Display( const char *buf, int32 amount);
  117.  
  118. // Overrides
  119. protected:
  120.     afx_msg void OnSize(UINT type, int cx, int cy);
  121.     afx_msg void OnSysCommand(UINT nId, LPARAM lParam);
  122.     afx_msg void OnKeyUp(UINT nChar, UINT nRep, UINT nFlags);
  123.  
  124. // Member Data
  125.     CGenericEdit     *m_pEdit;
  126.     PRMonitor *m_pOutputMon;
  127.  
  128. protected:
  129.     DECLARE_MESSAGE_MAP()
  130. };
  131.  
  132.  
  133.  
  134. #endif /* __JavaConsoleWindow_H */
  135.  
  136.  
  137.