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