]>
git.saurik.com Git - wxWidgets.git/blob - include/wx/motif/textctrl.h
1 /////////////////////////////////////////////////////////////////////////////
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 #if defined(__GNUG__) && !defined(__APPLE__)
16 #pragma interface "textctrl.h"
19 WXDLLEXPORT_DATA(extern const char*) wxEmptyString
;
21 // Single-line text item
22 class WXDLLEXPORT wxTextCtrl
: public wxTextCtrlBase
24 DECLARE_DYNAMIC_CLASS(wxTextCtrl
)
30 wxTextCtrl(wxWindow
*parent
,
32 const wxString
& value
= wxEmptyString
,
33 const wxPoint
& pos
= wxDefaultPosition
,
34 const wxSize
& size
= wxDefaultSize
,
36 const wxValidator
& validator
= wxDefaultValidator
,
37 const wxString
& name
= wxTextCtrlNameStr
)
39 Create(parent
, id
, value
, pos
, size
, style
, validator
, name
);
42 bool Create(wxWindow
*parent
, wxWindowID id
,
43 const wxString
& value
= wxEmptyString
,
44 const wxPoint
& pos
= wxDefaultPosition
,
45 const wxSize
& size
= wxDefaultSize
, long style
= 0,
46 const wxValidator
& validator
= wxDefaultValidator
,
47 const wxString
& name
= wxTextCtrlNameStr
);
51 virtual wxString
GetValue() const;
52 virtual void SetValue(const wxString
& value
);
54 virtual int GetLineLength(long lineNo
) const;
55 virtual wxString
GetLineText(long lineNo
) const;
56 virtual int GetNumberOfLines() const;
61 // Clipboard operations
65 virtual bool CanCopy() const;
66 virtual bool CanCut() const;
67 virtual bool CanPaste() const;
73 virtual bool CanUndo() const;
74 virtual bool CanRedo() const;
76 virtual void SetInsertionPoint(long pos
);
77 virtual void SetInsertionPointEnd();
78 virtual long GetInsertionPoint() const;
79 virtual long GetLastPosition() const;
80 virtual void Replace(long from
, long to
, const wxString
& value
);
81 virtual void Remove(long from
, long to
);
82 virtual void SetSelection(long from
, long to
);
83 virtual void SetEditable(bool editable
);
84 // If the return values from and to are the same, there is no
86 virtual void GetSelection(long* from
, long* to
) const;
87 virtual bool IsEditable() const ;
89 virtual void WriteText(const wxString
& text
);
90 virtual void AppendText(const wxString
& text
);
91 virtual void DiscardEdits();
92 virtual bool IsModified() const;
94 virtual long XYToPosition(long x
, long y
) const;
95 virtual bool PositionToXY(long pos
, long *x
, long *y
) const;
96 virtual void ShowPosition(long pos
);
101 void OnDropFiles(wxDropFilesEvent
& event
);
102 void OnChar(wxKeyEvent
& event
);
103 // void OnEraseBackground(wxEraseEvent& event);
105 void OnCut(wxCommandEvent
& event
);
106 void OnCopy(wxCommandEvent
& event
);
107 void OnPaste(wxCommandEvent
& event
);
108 void OnUndo(wxCommandEvent
& event
);
109 void OnRedo(wxCommandEvent
& event
);
111 void OnUpdateCut(wxUpdateUIEvent
& event
);
112 void OnUpdateCopy(wxUpdateUIEvent
& event
);
113 void OnUpdatePaste(wxUpdateUIEvent
& event
);
114 void OnUpdateUndo(wxUpdateUIEvent
& event
);
115 void OnUpdateRedo(wxUpdateUIEvent
& event
);
117 virtual void Command(wxCommandEvent
& event
);
119 // implementation from here to the end
120 // -----------------------------------
121 virtual void ChangeFont(bool keepOriginalSize
= TRUE
);
122 virtual void ChangeBackgroundColour();
123 virtual void ChangeForegroundColour();
124 void SetModified(bool mod
) { m_modified
= mod
; }
125 virtual WXWidget
GetTopWidget() const;
127 // send the CHAR and TEXT_UPDATED events
128 void DoSendEvents(void /* XmTextVerifyCallbackStruct */ *cbs
,
134 virtual wxSize
DoGetBestSize() const;
137 void* m_tempCallbackStruct
;
139 wxString m_value
; // Required for password text controls
141 // Did we call wxTextCtrl::OnChar? If so, generate a command event.
142 bool m_processedDefault
;
145 DECLARE_EVENT_TABLE()