1 /////////////////////////////////////////////////////////////////////////////
2 // Name: wx/motif/textctrl.h
3 // Purpose: wxTextCtrl class
4 // Author: Julian Smart
8 // Copyright: (c) Julian Smart
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
12 #ifndef _WX_TEXTCTRL_H_
13 #define _WX_TEXTCTRL_H_
15 // Single-line text item
16 class WXDLLIMPEXP_CORE wxTextCtrl
: public wxTextCtrlBase
23 wxTextCtrl(wxWindow
*parent
,
25 const wxString
& value
= wxEmptyString
,
26 const wxPoint
& pos
= wxDefaultPosition
,
27 const wxSize
& size
= wxDefaultSize
,
29 const wxValidator
& validator
= wxDefaultValidator
,
30 const wxString
& name
= wxTextCtrlNameStr
)
32 Create(parent
, id
, value
, pos
, size
, style
, validator
, name
);
35 bool Create(wxWindow
*parent
, wxWindowID id
,
36 const wxString
& value
= wxEmptyString
,
37 const wxPoint
& pos
= wxDefaultPosition
,
38 const wxSize
& size
= wxDefaultSize
, long style
= 0,
39 const wxValidator
& validator
= wxDefaultValidator
,
40 const wxString
& name
= wxTextCtrlNameStr
);
44 virtual wxString
GetValue() const;
46 virtual int GetLineLength(long lineNo
) const;
47 virtual wxString
GetLineText(long lineNo
) const;
48 virtual int GetNumberOfLines() const;
53 virtual void MarkDirty();
54 virtual void DiscardEdits();
55 virtual bool IsModified() const;
57 virtual long XYToPosition(long x
, long y
) const;
58 virtual bool PositionToXY(long pos
, long *x
, long *y
) const;
59 virtual void ShowPosition(long pos
);
63 void OnDropFiles(wxDropFilesEvent
& event
);
64 void OnChar(wxKeyEvent
& event
);
65 // void OnEraseBackground(wxEraseEvent& event);
67 void OnCut(wxCommandEvent
& event
);
68 void OnCopy(wxCommandEvent
& event
);
69 void OnPaste(wxCommandEvent
& event
);
70 void OnUndo(wxCommandEvent
& event
);
71 void OnRedo(wxCommandEvent
& event
);
73 void OnUpdateCut(wxUpdateUIEvent
& event
);
74 void OnUpdateCopy(wxUpdateUIEvent
& event
);
75 void OnUpdatePaste(wxUpdateUIEvent
& event
);
76 void OnUpdateUndo(wxUpdateUIEvent
& event
);
77 void OnUpdateRedo(wxUpdateUIEvent
& event
);
79 virtual void Command(wxCommandEvent
& event
);
81 // implementation from here to the end
82 // -----------------------------------
83 virtual void ChangeFont(bool keepOriginalSize
= true);
84 virtual void ChangeBackgroundColour();
85 virtual void ChangeForegroundColour();
86 void SetModified(bool mod
) { m_modified
= mod
; }
87 virtual WXWidget
GetTopWidget() const;
89 // send the CHAR and TEXT_UPDATED events
90 void DoSendEvents(void /* XmTextVerifyCallbackStruct */ *cbs
,
94 virtual wxSize
DoGetBestSize() const;
96 virtual void DoSetValue(const wxString
& value
, int flags
= 0);
98 virtual WXWidget
GetTextWidget() const { return m_mainWidget
; }
102 void* m_tempCallbackStruct
;
104 wxString m_value
; // Required for password text controls
106 // Did we call wxTextCtrl::OnChar? If so, generate a command event.
107 bool m_processedDefault
;
110 DECLARE_EVENT_TABLE()
111 DECLARE_DYNAMIC_CLASS(wxTextCtrl
)