1999-07-29 01:11:30 -04:00
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
|
|
// Name: textctrl.h
|
|
|
|
// Purpose: wxTextCtrl class
|
1999-10-17 23:30:47 -04:00
|
|
|
// Author: David Webster
|
1999-07-29 01:11:30 -04:00
|
|
|
// Modified by:
|
1999-10-17 23:30:47 -04:00
|
|
|
// Created: 10/17/99
|
1999-07-29 01:11:30 -04:00
|
|
|
// RCS-ID: $Id$
|
1999-10-17 23:30:47 -04:00
|
|
|
// Copyright: (c) David Webster
|
2004-05-23 16:53:33 -04:00
|
|
|
// Licence: wxWindows licence
|
1999-07-29 01:11:30 -04:00
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
#ifndef _WX_TEXTCTRL_H_
|
|
|
|
#define _WX_TEXTCTRL_H_
|
|
|
|
|
2003-01-24 17:31:41 -05:00
|
|
|
typedef int (wxCALLBACK *wxTreeCtrlCompare)(long lItem1, long lItem2, long lSortData);
|
|
|
|
|
1999-10-17 23:30:47 -04:00
|
|
|
class WXDLLEXPORT wxTextCtrl : public wxTextCtrlBase
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
wxTextCtrl();
|
2001-04-16 11:20:36 -04:00
|
|
|
wxTextCtrl( wxWindow* pParent
|
|
|
|
,wxWindowID vId
|
|
|
|
,const wxString& rsValue = wxEmptyString
|
|
|
|
,const wxPoint& rPos = wxDefaultPosition
|
|
|
|
,const wxSize& rSize = wxDefaultSize
|
|
|
|
,long lStyle = 0
|
|
|
|
,const wxValidator& rValidator = wxDefaultValidator
|
|
|
|
,const wxString& rsName = wxTextCtrlNameStr
|
|
|
|
)
|
1999-10-17 23:30:47 -04:00
|
|
|
{
|
2001-04-16 11:20:36 -04:00
|
|
|
Create(pParent, vId, rsValue, rPos, rSize, lStyle, rValidator, rsName);
|
1999-10-17 23:30:47 -04:00
|
|
|
}
|
2002-12-04 09:11:26 -05:00
|
|
|
~wxTextCtrl();
|
1999-10-17 23:30:47 -04:00
|
|
|
|
2001-04-16 11:20:36 -04:00
|
|
|
bool Create( wxWindow* pParent
|
|
|
|
,wxWindowID vId
|
|
|
|
,const wxString& rsValue = wxEmptyString
|
|
|
|
,const wxPoint& rPos = wxDefaultPosition
|
|
|
|
,const wxSize& rSize = wxDefaultSize
|
|
|
|
,long lStyle = 0
|
|
|
|
,const wxValidator& rValidator = wxDefaultValidator
|
|
|
|
,const wxString& rsName = wxTextCtrlNameStr
|
|
|
|
);
|
1999-10-17 23:30:47 -04:00
|
|
|
|
2001-05-29 14:59:17 -04:00
|
|
|
//
|
|
|
|
// Implement base class pure virtuals
|
1999-10-17 23:30:47 -04:00
|
|
|
// ----------------------------------
|
2001-05-29 14:59:17 -04:00
|
|
|
//
|
2001-04-16 11:20:36 -04:00
|
|
|
virtual wxString GetValue(void) const;
|
|
|
|
virtual void SetValue(const wxString& rsValue);
|
1999-10-17 23:30:47 -04:00
|
|
|
|
2001-04-16 11:20:36 -04:00
|
|
|
virtual int GetLineLength(long nLineNo) const;
|
|
|
|
virtual wxString GetLineText(long nLineNo) const;
|
|
|
|
virtual int GetNumberOfLines(void) const;
|
1999-10-17 23:30:47 -04:00
|
|
|
|
2001-04-16 11:20:36 -04:00
|
|
|
virtual bool IsModified(void) const;
|
|
|
|
virtual bool IsEditable(void) const;
|
1999-10-17 23:30:47 -04:00
|
|
|
|
2001-04-16 11:20:36 -04:00
|
|
|
virtual void GetSelection( long* pFrom
|
|
|
|
,long* pTo
|
|
|
|
) const;
|
2001-05-29 14:59:17 -04:00
|
|
|
//
|
|
|
|
// Operations
|
1999-10-17 23:30:47 -04:00
|
|
|
// ----------
|
2001-05-29 14:59:17 -04:00
|
|
|
//
|
2001-04-16 11:20:36 -04:00
|
|
|
virtual void Clear(void);
|
|
|
|
virtual void Replace( long lFrom
|
|
|
|
,long lTo
|
|
|
|
,const wxString& rsValue
|
|
|
|
);
|
|
|
|
virtual void Remove( long lFrom
|
|
|
|
,long lTo
|
|
|
|
);
|
1999-10-17 23:30:47 -04:00
|
|
|
|
2001-04-16 11:20:36 -04:00
|
|
|
virtual bool LoadFile(const wxString& rsFile);
|
1999-10-17 23:30:47 -04:00
|
|
|
|
2003-09-22 20:09:18 -04:00
|
|
|
virtual void MarkDirty();
|
2001-04-16 11:20:36 -04:00
|
|
|
virtual void DiscardEdits(void);
|
1999-10-17 23:30:47 -04:00
|
|
|
|
2001-04-16 11:20:36 -04:00
|
|
|
virtual void WriteText(const wxString& rsText);
|
|
|
|
virtual void AppendText(const wxString& rsText);
|
2002-04-10 00:38:11 -04:00
|
|
|
virtual bool EmulateKeyPress(const wxKeyEvent& rEvent);
|
1999-10-17 23:30:47 -04:00
|
|
|
|
2001-05-29 14:59:17 -04:00
|
|
|
virtual bool SetStyle( long lStart
|
|
|
|
,long lEnd
|
|
|
|
,const wxTextAttr& rStyle
|
|
|
|
);
|
2001-04-16 11:20:36 -04:00
|
|
|
virtual long XYToPosition( long lX
|
|
|
|
,long lY
|
|
|
|
) const;
|
|
|
|
virtual bool PositionToXY( long lPos
|
|
|
|
,long* plX
|
|
|
|
,long* plY
|
|
|
|
) const;
|
1999-10-17 23:30:47 -04:00
|
|
|
|
2001-04-16 11:20:36 -04:00
|
|
|
virtual void ShowPosition(long lPos);
|
1999-10-17 23:30:47 -04:00
|
|
|
|
2001-04-16 11:20:36 -04:00
|
|
|
virtual void Copy(void);
|
|
|
|
virtual void Cut(void);
|
|
|
|
virtual void Paste(void);
|
1999-10-17 23:30:47 -04:00
|
|
|
|
2001-04-16 11:20:36 -04:00
|
|
|
virtual bool CanCopy(void) const;
|
|
|
|
virtual bool CanCut(void) const;
|
|
|
|
virtual bool CanPaste(void) const;
|
1999-10-17 23:30:47 -04:00
|
|
|
|
2001-04-16 11:20:36 -04:00
|
|
|
virtual void Undo(void);
|
|
|
|
virtual void Redo(void);
|
1999-10-17 23:30:47 -04:00
|
|
|
|
2001-04-16 11:20:36 -04:00
|
|
|
virtual bool CanUndo(void) const;
|
|
|
|
virtual bool CanRedo(void) const;
|
1999-10-17 23:30:47 -04:00
|
|
|
|
2001-04-16 11:20:36 -04:00
|
|
|
virtual void SetInsertionPoint(long lPos);
|
|
|
|
virtual void SetInsertionPointEnd(void);
|
|
|
|
virtual long GetInsertionPoint(void) const;
|
2005-01-19 11:25:34 -05:00
|
|
|
virtual wxTextPos GetLastPosition(void) const;
|
1999-10-17 23:30:47 -04:00
|
|
|
|
2001-04-16 11:20:36 -04:00
|
|
|
virtual void SetSelection( long lFrom
|
|
|
|
,long lTo
|
|
|
|
);
|
|
|
|
virtual void SetEditable(bool bEditable);
|
2002-02-22 18:30:31 -05:00
|
|
|
virtual void SetWindowStyleFlag(long lStyle);
|
1999-10-17 23:30:47 -04:00
|
|
|
|
2001-04-16 11:20:36 -04:00
|
|
|
//
|
1999-10-17 23:30:47 -04:00
|
|
|
// Implementation from now on
|
|
|
|
// --------------------------
|
2001-04-16 11:20:36 -04:00
|
|
|
//
|
|
|
|
virtual void Command(wxCommandEvent& rEvent);
|
|
|
|
virtual bool OS2Command( WXUINT uParam
|
|
|
|
,WXWORD wId
|
|
|
|
);
|
1999-10-17 23:30:47 -04:00
|
|
|
|
2001-04-16 11:20:36 -04:00
|
|
|
virtual WXHBRUSH OnCtlColor( WXHDC hDC
|
|
|
|
,WXHWND pWnd
|
|
|
|
,WXUINT nCtlColor
|
|
|
|
,WXUINT message
|
|
|
|
,WXWPARAM wParam
|
|
|
|
,WXLPARAM lParam
|
|
|
|
);
|
1999-10-17 23:30:47 -04:00
|
|
|
|
2001-04-16 11:20:36 -04:00
|
|
|
virtual bool SetBackgroundColour(const wxColour& colour);
|
|
|
|
virtual bool SetForegroundColour(const wxColour& colour);
|
1999-10-17 23:30:47 -04:00
|
|
|
|
2001-04-16 11:20:36 -04:00
|
|
|
virtual void AdoptAttributesFromHWND(void);
|
|
|
|
virtual void SetupColours(void);
|
1999-10-17 23:30:47 -04:00
|
|
|
|
2001-04-16 11:20:36 -04:00
|
|
|
virtual bool AcceptsFocus(void) const;
|
1999-10-17 23:30:47 -04:00
|
|
|
|
|
|
|
// callbacks
|
2001-04-16 11:20:36 -04:00
|
|
|
void OnDropFiles(wxDropFilesEvent& rEvent);
|
|
|
|
void OnChar(wxKeyEvent& rEvent); // Process 'enter' if required
|
1999-07-29 01:11:30 -04:00
|
|
|
|
2001-04-16 11:20:36 -04:00
|
|
|
void OnCut(wxCommandEvent& rEvent);
|
|
|
|
void OnCopy(wxCommandEvent& rEvent);
|
|
|
|
void OnPaste(wxCommandEvent& rEvent);
|
|
|
|
void OnUndo(wxCommandEvent& rEvent);
|
|
|
|
void OnRedo(wxCommandEvent& rEvent);
|
2002-12-04 09:11:26 -05:00
|
|
|
void OnDelete(wxCommandEvent& rEvent);
|
|
|
|
void OnSelectAll(wxCommandEvent& rEvent);
|
1999-07-29 01:11:30 -04:00
|
|
|
|
2001-04-16 11:20:36 -04:00
|
|
|
void OnUpdateCut(wxUpdateUIEvent& rEvent);
|
|
|
|
void OnUpdateCopy(wxUpdateUIEvent& rEvent);
|
|
|
|
void OnUpdatePaste(wxUpdateUIEvent& rEvent);
|
|
|
|
void OnUpdateUndo(wxUpdateUIEvent& rEvent);
|
|
|
|
void OnUpdateRedo(wxUpdateUIEvent& rEvent);
|
2002-12-04 09:11:26 -05:00
|
|
|
void OnUpdateDelete(wxUpdateUIEvent& rEvent);
|
|
|
|
void OnUpdateSelectAll(wxUpdateUIEvent& rEvent);
|
2001-04-16 11:20:36 -04:00
|
|
|
|
|
|
|
inline bool IsMLE(void) {return m_bIsMLE;}
|
|
|
|
inline void SetMLE(bool bIsMLE) {m_bIsMLE = bIsMLE;}
|
1999-07-29 01:11:30 -04:00
|
|
|
|
1999-10-17 23:30:47 -04:00
|
|
|
protected:
|
2001-04-16 11:20:36 -04:00
|
|
|
//
|
1999-10-17 23:30:47 -04:00
|
|
|
// call this to increase the size limit (will do nothing if the current
|
|
|
|
// limit is big enough)
|
2001-04-16 11:20:36 -04:00
|
|
|
//
|
|
|
|
void AdjustSpaceLimit(void);
|
|
|
|
virtual wxSize DoGetBestSize(void) const;
|
2002-01-22 18:17:55 -05:00
|
|
|
virtual bool OS2ShouldPreProcessMessage(WXMSG* pMsg);
|
1999-07-29 01:11:30 -04:00
|
|
|
|
2002-02-22 18:30:31 -05:00
|
|
|
virtual WXDWORD OS2GetStyle( long lStyle
|
|
|
|
,WXDWORD* dwExstyle
|
|
|
|
) const;
|
1999-10-17 23:30:47 -04:00
|
|
|
private:
|
2001-04-16 11:20:36 -04:00
|
|
|
bool m_bIsMLE;
|
1999-10-17 23:30:47 -04:00
|
|
|
DECLARE_EVENT_TABLE()
|
|
|
|
DECLARE_DYNAMIC_CLASS(wxTextCtrl)
|
2001-04-16 11:20:36 -04:00
|
|
|
}; // end of CLASS wxTextCtrl
|
1999-07-29 01:11:30 -04:00
|
|
|
|
|
|
|
#endif
|
|
|
|
// _WX_TEXTCTRL_H_
|