]>
git.saurik.com Git - wxWidgets.git/blob - include/wx/motif/textctrl.h
3eaef48ab72793870a9a83677ee6457c46fd0b71
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(NO_GCC_PRAGMA)
16 #pragma interface "textctrl.h"
19 // Single-line text item
20 class WXDLLEXPORT wxTextCtrl
: public wxTextCtrlBase
22 DECLARE_DYNAMIC_CLASS(wxTextCtrl
)
28 wxTextCtrl(wxWindow
*parent
,
30 const wxString
& value
= wxEmptyString
,
31 const wxPoint
& pos
= wxDefaultPosition
,
32 const wxSize
& size
= wxDefaultSize
,
34 const wxValidator
& validator
= wxDefaultValidator
,
35 const wxString
& name
= wxTextCtrlNameStr
)
37 Create(parent
, id
, value
, pos
, size
, style
, validator
, name
);
40 bool Create(wxWindow
*parent
, wxWindowID id
,
41 const wxString
& value
= wxEmptyString
,
42 const wxPoint
& pos
= wxDefaultPosition
,
43 const wxSize
& size
= wxDefaultSize
, long style
= 0,
44 const wxValidator
& validator
= wxDefaultValidator
,
45 const wxString
& name
= wxTextCtrlNameStr
);
49 virtual wxString
GetValue() const;
50 virtual void SetValue(const wxString
& value
);
52 virtual int GetLineLength(long lineNo
) const;
53 virtual wxString
GetLineText(long lineNo
) const;
54 virtual int GetNumberOfLines() const;
59 // Clipboard operations
63 virtual bool CanCopy() const;
64 virtual bool CanCut() const;
65 virtual bool CanPaste() const;
71 virtual bool CanUndo() const;
72 virtual bool CanRedo() const;
74 virtual void SetInsertionPoint(long pos
);
75 virtual void SetInsertionPointEnd();
76 virtual long GetInsertionPoint() const;
77 virtual wxTextPos
GetLastPosition() const;
78 virtual void Replace(long from
, long to
, const wxString
& value
);
79 virtual void Remove(long from
, long to
);
80 virtual void SetSelection(long from
, long to
);
81 virtual void SetEditable(bool editable
);
82 // If the return values from and to are the same, there is no
84 virtual void GetSelection(long* from
, long* to
) const;
85 virtual bool IsEditable() const ;
87 virtual void WriteText(const wxString
& text
);
88 virtual void AppendText(const wxString
& text
);
89 virtual void MarkDirty();
90 virtual void DiscardEdits();
91 virtual bool IsModified() const;
93 virtual long XYToPosition(long x
, long y
) const;
94 virtual bool PositionToXY(long pos
, long *x
, long *y
) const;
95 virtual void ShowPosition(long pos
);
100 void OnDropFiles(wxDropFilesEvent
& event
);
101 void OnChar(wxKeyEvent
& event
);
102 // void OnEraseBackground(wxEraseEvent& event);
104 void OnCut(wxCommandEvent
& event
);
105 void OnCopy(wxCommandEvent
& event
);
106 void OnPaste(wxCommandEvent
& event
);
107 void OnUndo(wxCommandEvent
& event
);
108 void OnRedo(wxCommandEvent
& event
);
110 void OnUpdateCut(wxUpdateUIEvent
& event
);
111 void OnUpdateCopy(wxUpdateUIEvent
& event
);
112 void OnUpdatePaste(wxUpdateUIEvent
& event
);
113 void OnUpdateUndo(wxUpdateUIEvent
& event
);
114 void OnUpdateRedo(wxUpdateUIEvent
& event
);
116 virtual void Command(wxCommandEvent
& event
);
118 // implementation from here to the end
119 // -----------------------------------
120 virtual void ChangeFont(bool keepOriginalSize
= true);
121 virtual void ChangeBackgroundColour();
122 virtual void ChangeForegroundColour();
123 void SetModified(bool mod
) { m_modified
= mod
; }
124 virtual WXWidget
GetTopWidget() const;
126 // send the CHAR and TEXT_UPDATED events
127 void DoSendEvents(void /* XmTextVerifyCallbackStruct */ *cbs
,
133 virtual wxSize
DoGetBestSize() const;
136 void* m_tempCallbackStruct
;
138 wxString m_value
; // Required for password text controls
140 // Did we call wxTextCtrl::OnChar? If so, generate a command event.
141 bool m_processedDefault
;
144 DECLARE_EVENT_TABLE()