1998-05-20 14:01:55 +00:00
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
|
|
// Name: textctrl.h
|
|
|
|
// Purpose:
|
|
|
|
// Author: Robert Roebling
|
|
|
|
// Created: 01/02/97
|
1998-07-23 16:07:55 +00:00
|
|
|
// Id: $Id$
|
1998-05-20 14:01:55 +00:00
|
|
|
// Copyright: (c) 1998 Robert Roebling, Julian Smart and Markus Holzem
|
1998-07-23 16:07:55 +00:00
|
|
|
// Licence: wxWindows licence
|
1998-05-20 14:01:55 +00:00
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
|
|
|
|
#ifndef __GTKTEXTCTRLH__
|
|
|
|
#define __GTKTEXTCTRLH__
|
|
|
|
|
|
|
|
#ifdef __GNUG__
|
|
|
|
#pragma interface
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#include "wx/defs.h"
|
|
|
|
#include "wx/object.h"
|
|
|
|
#include "wx/string.h"
|
|
|
|
#include "wx/control.h"
|
|
|
|
|
1998-09-25 13:28:52 +00:00
|
|
|
#if wxUSE_IOSTREAMH
|
1998-05-20 14:01:55 +00:00
|
|
|
#include <iostream.h>
|
|
|
|
#else
|
|
|
|
#include <iostream>
|
|
|
|
#endif
|
|
|
|
|
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
// classes
|
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
|
|
|
|
class wxTextCtrl;
|
|
|
|
|
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
// global data
|
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
|
|
|
|
extern const char *wxTextCtrlNameStr;
|
|
|
|
|
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
// wxTextCtrl
|
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
|
|
|
|
class wxTextCtrl: public wxControl, public streambuf
|
|
|
|
{
|
1998-07-23 16:07:55 +00:00
|
|
|
DECLARE_EVENT_TABLE()
|
1998-05-20 14:01:55 +00:00
|
|
|
DECLARE_DYNAMIC_CLASS(wxTextCtrl);
|
|
|
|
|
1998-08-14 22:53:21 +00:00
|
|
|
public:
|
1998-07-23 16:07:55 +00:00
|
|
|
wxTextCtrl();
|
|
|
|
wxTextCtrl( wxWindow *parent, wxWindowID id, const wxString &value = "",
|
1998-07-04 15:17:59 +00:00
|
|
|
const wxPoint &pos = wxDefaultPosition, const wxSize &size = wxDefaultSize,
|
1998-08-14 10:07:38 +00:00
|
|
|
int style = 0, const wxValidator& validator = wxDefaultValidator,
|
|
|
|
const wxString &name = wxTextCtrlNameStr );
|
1998-07-04 15:17:59 +00:00
|
|
|
bool Create( wxWindow *parent, wxWindowID id, const wxString &value = "",
|
|
|
|
const wxPoint &pos = wxDefaultPosition, const wxSize &size = wxDefaultSize,
|
1998-08-14 10:07:38 +00:00
|
|
|
int style = 0, const wxValidator& validator = wxDefaultValidator,
|
|
|
|
const wxString &name = wxTextCtrlNameStr );
|
1998-07-23 16:07:55 +00:00
|
|
|
wxString GetValue() const;
|
1998-05-20 14:01:55 +00:00
|
|
|
void SetValue( const wxString &value );
|
|
|
|
void WriteText( const wxString &text );
|
1998-07-23 16:07:55 +00:00
|
|
|
|
1998-05-20 14:01:55 +00:00
|
|
|
bool LoadFile( const wxString &file );
|
|
|
|
bool SaveFile( const wxString &file );
|
1998-07-23 16:07:55 +00:00
|
|
|
bool IsModified() const { return m_modified; }
|
|
|
|
void SetModified() { m_modified = TRUE; }
|
|
|
|
void DiscardEdits() { m_modified = FALSE; }
|
1998-06-04 16:08:47 +00:00
|
|
|
/*
|
1998-07-04 15:17:59 +00:00
|
|
|
wxString GetLineText( long lineNo ) const;
|
1998-05-20 14:01:55 +00:00
|
|
|
void OnDropFiles( wxDropFilesEvent &event );
|
1998-07-04 15:17:59 +00:00
|
|
|
long PositionToXY( long pos, long *x, long *y ) const;
|
|
|
|
long XYToPosition( long x, long y );
|
1998-07-23 16:07:55 +00:00
|
|
|
int GetNumberOfLines();
|
1998-05-20 14:01:55 +00:00
|
|
|
*/
|
1998-07-04 15:17:59 +00:00
|
|
|
virtual void SetInsertionPoint( long pos );
|
1998-07-23 16:07:55 +00:00
|
|
|
virtual void SetInsertionPointEnd();
|
1998-07-04 15:17:59 +00:00
|
|
|
virtual void SetEditable( bool editable );
|
|
|
|
virtual void SetSelection( long from, long to );
|
|
|
|
void ShowPosition( long pos );
|
1998-07-23 16:07:55 +00:00
|
|
|
virtual long GetInsertionPoint() const;
|
|
|
|
virtual long GetLastPosition() const;
|
1998-07-04 15:17:59 +00:00
|
|
|
virtual void Remove( long from, long to );
|
|
|
|
virtual void Replace( long from, long to, const wxString &value );
|
1998-07-23 16:07:55 +00:00
|
|
|
void Cut();
|
|
|
|
void Copy();
|
|
|
|
void Paste();
|
1998-10-12 13:09:15 +00:00
|
|
|
void Clear();
|
1998-07-23 16:07:55 +00:00
|
|
|
|
1998-05-20 14:01:55 +00:00
|
|
|
void OnChar( wxKeyEvent &event );
|
1998-07-23 16:07:55 +00:00
|
|
|
|
1998-05-20 14:01:55 +00:00
|
|
|
int overflow(int i);
|
1998-07-23 16:07:55 +00:00
|
|
|
int sync();
|
|
|
|
int underflow();
|
1998-05-20 14:01:55 +00:00
|
|
|
|
|
|
|
wxTextCtrl& operator<<(const wxString& s);
|
1998-07-04 15:17:59 +00:00
|
|
|
wxTextCtrl& operator<<(int i);
|
|
|
|
wxTextCtrl& operator<<(long i);
|
|
|
|
wxTextCtrl& operator<<(float f);
|
|
|
|
wxTextCtrl& operator<<(double d);
|
1998-05-20 14:01:55 +00:00
|
|
|
wxTextCtrl& operator<<(const char c);
|
|
|
|
|
1998-09-06 13:46:50 +00:00
|
|
|
void SetFont( const wxFont &font );
|
1998-10-19 14:18:56 +00:00
|
|
|
virtual void SetBackgroundColour(const wxColour &colour);
|
|
|
|
|
1998-09-06 13:46:50 +00:00
|
|
|
// implementation
|
|
|
|
|
1998-09-07 12:29:07 +00:00
|
|
|
GtkWidget* GetConnectWidget(void);
|
|
|
|
bool IsOwnGtkWindow( GdkWindow *window );
|
1998-07-27 20:50:48 +00:00
|
|
|
|
1998-08-14 22:53:21 +00:00
|
|
|
private:
|
|
|
|
|
|
|
|
bool m_modified;
|
|
|
|
GtkWidget *m_text;
|
1998-05-20 14:01:55 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif // __GTKTEXTCTRLH__
|
|
|
|
|
|
|
|
|