]>
git.saurik.com Git - wxWidgets.git/blob - include/wx/motif/textctrl.h
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 WXDLLEXPORT wxTextCtrl
: public wxTextCtrlBase
18 DECLARE_DYNAMIC_CLASS(wxTextCtrl
)
24 wxTextCtrl(wxWindow
*parent
,
26 const wxString
& value
= wxEmptyString
,
27 const wxPoint
& pos
= wxDefaultPosition
,
28 const wxSize
& size
= wxDefaultSize
,
30 const wxValidator
& validator
= wxDefaultValidator
,
31 const wxString
& name
= wxTextCtrlNameStr
)
33 Create(parent
, id
, value
, pos
, size
, style
, validator
, name
);
36 bool Create(wxWindow
*parent
, wxWindowID id
,
37 const wxString
& value
= wxEmptyString
,
38 const wxPoint
& pos
= wxDefaultPosition
,
39 const wxSize
& size
= wxDefaultSize
, long style
= 0,
40 const wxValidator
& validator
= wxDefaultValidator
,
41 const wxString
& name
= wxTextCtrlNameStr
);
45 virtual wxString
GetValue() const;
47 virtual int GetLineLength(long lineNo
) const;
48 virtual wxString
GetLineText(long lineNo
) const;
49 virtual int GetNumberOfLines() const;
54 // Clipboard operations
58 virtual bool CanCopy() const;
59 virtual bool CanCut() const;
60 virtual bool CanPaste() const;
66 virtual bool CanUndo() const;
67 virtual bool CanRedo() const;
69 virtual void SetInsertionPoint(long pos
);
70 virtual void SetInsertionPointEnd();
71 virtual long GetInsertionPoint() const;
72 virtual wxTextPos
GetLastPosition() const;
73 virtual void Replace(long from
, long to
, const wxString
& value
);
74 virtual void Remove(long from
, long to
);
75 virtual void SetSelection(long from
, long to
);
76 virtual void SetEditable(bool editable
);
77 // If the return values from and to are the same, there is no
79 virtual void GetSelection(long* from
, long* to
) const;
80 virtual bool IsEditable() const ;
82 virtual void WriteText(const wxString
& text
);
83 virtual void AppendText(const wxString
& text
);
84 virtual void MarkDirty();
85 virtual void DiscardEdits();
86 virtual bool IsModified() const;
88 virtual long XYToPosition(long x
, long y
) const;
89 virtual bool PositionToXY(long pos
, long *x
, long *y
) const;
90 virtual void ShowPosition(long pos
);
95 void OnDropFiles(wxDropFilesEvent
& event
);
96 void OnChar(wxKeyEvent
& event
);
97 // void OnEraseBackground(wxEraseEvent& event);
99 void OnCut(wxCommandEvent
& event
);
100 void OnCopy(wxCommandEvent
& event
);
101 void OnPaste(wxCommandEvent
& event
);
102 void OnUndo(wxCommandEvent
& event
);
103 void OnRedo(wxCommandEvent
& event
);
105 void OnUpdateCut(wxUpdateUIEvent
& event
);
106 void OnUpdateCopy(wxUpdateUIEvent
& event
);
107 void OnUpdatePaste(wxUpdateUIEvent
& event
);
108 void OnUpdateUndo(wxUpdateUIEvent
& event
);
109 void OnUpdateRedo(wxUpdateUIEvent
& event
);
111 virtual void Command(wxCommandEvent
& event
);
113 // implementation from here to the end
114 // -----------------------------------
115 virtual void ChangeFont(bool keepOriginalSize
= true);
116 virtual void ChangeBackgroundColour();
117 virtual void ChangeForegroundColour();
118 void SetModified(bool mod
) { m_modified
= mod
; }
119 virtual WXWidget
GetTopWidget() const;
121 // send the CHAR and TEXT_UPDATED events
122 void DoSendEvents(void /* XmTextVerifyCallbackStruct */ *cbs
,
128 virtual wxSize
DoGetBestSize() const;
130 virtual void DoSetValue(const wxString
& value
, int flags
= 0);
134 void* m_tempCallbackStruct
;
136 wxString m_value
; // Required for password text controls
138 // Did we call wxTextCtrl::OnChar? If so, generate a command event.
139 bool m_processedDefault
;
142 DECLARE_EVENT_TABLE()