1 /////////////////////////////////////////////////////////////////////////////
2 // Name: wx/motif/textctrl.h
3 // Purpose: wxTextCtrl class
4 // Author: Julian Smart
7 // Copyright: (c) Julian Smart
8 // Licence: wxWindows licence
9 /////////////////////////////////////////////////////////////////////////////
11 #ifndef _WX_TEXTCTRL_H_
12 #define _WX_TEXTCTRL_H_
14 // Single-line text item
15 class WXDLLIMPEXP_CORE wxTextCtrl
: public wxTextCtrlBase
22 wxTextCtrl(wxWindow
*parent
,
24 const wxString
& value
= wxEmptyString
,
25 const wxPoint
& pos
= wxDefaultPosition
,
26 const wxSize
& size
= wxDefaultSize
,
28 const wxValidator
& validator
= wxDefaultValidator
,
29 const wxString
& name
= wxTextCtrlNameStr
)
31 Create(parent
, id
, value
, pos
, size
, style
, validator
, name
);
34 bool Create(wxWindow
*parent
, wxWindowID id
,
35 const wxString
& value
= wxEmptyString
,
36 const wxPoint
& pos
= wxDefaultPosition
,
37 const wxSize
& size
= wxDefaultSize
, long style
= 0,
38 const wxValidator
& validator
= wxDefaultValidator
,
39 const wxString
& name
= wxTextCtrlNameStr
);
43 virtual wxString
GetValue() const;
45 virtual int GetLineLength(long lineNo
) const;
46 virtual wxString
GetLineText(long lineNo
) const;
47 virtual int GetNumberOfLines() const;
52 virtual void MarkDirty();
53 virtual void DiscardEdits();
54 virtual bool IsModified() const;
56 virtual long XYToPosition(long x
, long y
) const;
57 virtual bool PositionToXY(long pos
, long *x
, long *y
) const;
58 virtual void ShowPosition(long pos
);
62 void OnDropFiles(wxDropFilesEvent
& event
);
63 void OnChar(wxKeyEvent
& event
);
64 // void OnEraseBackground(wxEraseEvent& event);
66 void OnCut(wxCommandEvent
& event
);
67 void OnCopy(wxCommandEvent
& event
);
68 void OnPaste(wxCommandEvent
& event
);
69 void OnUndo(wxCommandEvent
& event
);
70 void OnRedo(wxCommandEvent
& event
);
72 void OnUpdateCut(wxUpdateUIEvent
& event
);
73 void OnUpdateCopy(wxUpdateUIEvent
& event
);
74 void OnUpdatePaste(wxUpdateUIEvent
& event
);
75 void OnUpdateUndo(wxUpdateUIEvent
& event
);
76 void OnUpdateRedo(wxUpdateUIEvent
& event
);
78 virtual void Command(wxCommandEvent
& event
);
80 // implementation from here to the end
81 // -----------------------------------
82 virtual void ChangeFont(bool keepOriginalSize
= true);
83 virtual void ChangeBackgroundColour();
84 virtual void ChangeForegroundColour();
85 void SetModified(bool mod
) { m_modified
= mod
; }
86 virtual WXWidget
GetTopWidget() const;
88 // send the CHAR and TEXT_UPDATED events
89 void DoSendEvents(void /* XmTextVerifyCallbackStruct */ *cbs
,
93 virtual wxSize
DoGetBestSize() const;
95 virtual void DoSetValue(const wxString
& value
, int flags
= 0);
97 virtual WXWidget
GetTextWidget() const { return m_mainWidget
; }
101 void* m_tempCallbackStruct
;
103 wxString m_value
; // Required for password text controls
105 // Did we call wxTextCtrl::OnChar? If so, generate a command event.
106 bool m_processedDefault
;
109 DECLARE_EVENT_TABLE()
110 DECLARE_DYNAMIC_CLASS(wxTextCtrl
)