home *** CD-ROM | disk | FTP | other *** search
/ Borland Programmer's Resource / Borland_Programmers_Resource_CD_1995.iso / code / wxwin140 / include / wx_text.h < prev    next >
Encoding:
C/C++ Source or Header  |  1995-05-19  |  2.4 KB  |  76 lines

  1. /*
  2.  * File:     wx_text.h
  3.  * Purpose:  wxTextWindow - simple text subwindow class
  4.  *
  5.  *                       wxWindows 1.40
  6.  * Copyright (c) 1993 Artificial Intelligence Applications Institute,
  7.  *                   The University of Edinburgh
  8.  *
  9.  *                     Author: Julian Smart
  10.  *                       Date: 18-4-93
  11.  *
  12.  * Permission to use, copy, modify, and distribute this software and its
  13.  * documentation for any purpose is hereby granted without fee, provided
  14.  * that the above copyright notice, author statement and this permission
  15.  * notice appear in all copies of this software and related documentation.
  16.  *
  17.  * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, EXPRESS,
  18.  * IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY WARRANTY OF
  19.  * MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.
  20.  *
  21.  * IN NO EVENT SHALL THE ARTIFICIAL INTELLIGENCE APPLICATIONS INSTITUTE OR THE
  22.  * UNIVERSITY OF EDINBURGH BE LIABLE FOR ANY SPECIAL, INCIDENTAL, INDIRECT OR
  23.  * CONSEQUENTIAL DAMAGES OF ANY KIND, OR ANY DAMAGES WHATSOEVER RESULTING FROM
  24.  * LOSS OF USE, DATA OR PROFITS, WHETHER OR NOT ADVISED OF THE POSSIBILITY OF
  25.  * DAMAGE, AND ON ANY THEORY OF LIABILITY, ARISING OUT OF OR IN CONNECTION WITH
  26.  * THE USE OR PERFORMANCE OF THIS SOFTWARE.
  27.  */
  28.  
  29. #ifndef wx_texth
  30. #define wx_texth
  31. #include "common.h"
  32. #include "wx_frame.h"
  33.  
  34. /*
  35.  * I would make this also derived from ostream:
  36.  *
  37.  * class wxTextWindow: public wxWindow, public virtual ostream
  38.  *
  39.  * but weirdly, the operator << isn't declared virtual in (isn't even
  40.  * a member of) ostream, so we can't use a wxTextWindow in place of an ostream.
  41.  *
  42.  */
  43.  
  44. class wxTextWindow: public wxWindow
  45. {
  46.   char *file_name;
  47. #ifdef wx_motif
  48.   long textPosition;
  49.   Bool textModified;
  50. #endif
  51.  public:
  52.   wxTextWindow(wxFrame *frame, int x=-1, int y=-1, int width=-1, int height=-1,
  53.                int style=0);
  54.   ~wxTextWindow(void);
  55.  
  56.   Bool LoadFile(char *file);
  57.   Bool SaveFile(char *file);
  58.   void WriteText(char *text);
  59.   void SetSize(int x, int y, int width, int height);
  60.   void Clear(void);
  61.   void DiscardEdits(void);
  62.   Bool Modified(void);
  63.   char *GetContents(void);
  64.  
  65.   wxTextWindow& operator<<(char *s);
  66.   wxTextWindow& operator<<(int i);
  67.   wxTextWindow& operator<<(long i);
  68.   wxTextWindow& operator<<(float f);
  69.   wxTextWindow& operator<<(double d);
  70.   wxTextWindow& operator<<(char c);
  71. };
  72.  
  73. #define wxTEXT_MAX_LINES 1000
  74.  
  75. #endif // wx_texth
  76.