]>
Commit | Line | Data |
---|---|---|
9b6dbb09 | 1 | ///////////////////////////////////////////////////////////////////////////// |
925f7740 | 2 | // Name: wx/motif/textctrl.h |
9b6dbb09 JS |
3 | // Purpose: wxTextCtrl class |
4 | // Author: Julian Smart | |
5 | // Modified by: | |
6 | // Created: 17/09/98 | |
9b6dbb09 | 7 | // Copyright: (c) Julian Smart |
65571936 | 8 | // Licence: wxWindows licence |
9b6dbb09 JS |
9 | ///////////////////////////////////////////////////////////////////////////// |
10 | ||
11 | #ifndef _WX_TEXTCTRL_H_ | |
12 | #define _WX_TEXTCTRL_H_ | |
13 | ||
9b6dbb09 | 14 | // Single-line text item |
53a2db12 | 15 | class WXDLLIMPEXP_CORE wxTextCtrl : public wxTextCtrlBase |
9b6dbb09 | 16 | { |
9b6dbb09 | 17 | public: |
c27eab7e VZ |
18 | // creation |
19 | // -------- | |
978c6e41 | 20 | |
c27eab7e VZ |
21 | wxTextCtrl(); |
22 | wxTextCtrl(wxWindow *parent, | |
978c6e41 VZ |
23 | wxWindowID id, |
24 | const wxString& value = wxEmptyString, | |
25 | const wxPoint& pos = wxDefaultPosition, | |
26 | const wxSize& size = wxDefaultSize, | |
27 | long style = 0, | |
28 | const wxValidator& validator = wxDefaultValidator, | |
29 | const wxString& name = wxTextCtrlNameStr) | |
83df96d6 JS |
30 | { |
31 | Create(parent, id, value, pos, size, style, validator, name); | |
32 | } | |
7d8268a1 | 33 | |
c27eab7e | 34 | bool Create(wxWindow *parent, wxWindowID id, |
978c6e41 VZ |
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); | |
7d8268a1 | 40 | |
c27eab7e VZ |
41 | // accessors |
42 | // --------- | |
43 | virtual wxString GetValue() const; | |
7d8268a1 | 44 | |
c27eab7e VZ |
45 | virtual int GetLineLength(long lineNo) const; |
46 | virtual wxString GetLineText(long lineNo) const; | |
47 | virtual int GetNumberOfLines() const; | |
7d8268a1 | 48 | |
c27eab7e VZ |
49 | // operations |
50 | // ---------- | |
7d8268a1 | 51 | |
3a9fa0d6 | 52 | virtual void MarkDirty(); |
c27eab7e VZ |
53 | virtual void DiscardEdits(); |
54 | virtual bool IsModified() const; | |
7d8268a1 | 55 | |
c27eab7e | 56 | virtual long XYToPosition(long x, long y) const; |
813c20a6 | 57 | virtual bool PositionToXY(long pos, long *x, long *y) const; |
c27eab7e | 58 | virtual void ShowPosition(long pos); |
7d8268a1 | 59 | |
c27eab7e VZ |
60 | // callbacks |
61 | // --------- | |
62 | void OnDropFiles(wxDropFilesEvent& event); | |
63 | void OnChar(wxKeyEvent& event); | |
64 | // void OnEraseBackground(wxEraseEvent& event); | |
7d8268a1 | 65 | |
e702ff0f JS |
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); | |
7d8268a1 | 71 | |
e702ff0f JS |
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); | |
7d8268a1 | 77 | |
c27eab7e | 78 | virtual void Command(wxCommandEvent& event); |
7d8268a1 | 79 | |
c27eab7e VZ |
80 | // implementation from here to the end |
81 | // ----------------------------------- | |
7d8268a1 | 82 | virtual void ChangeFont(bool keepOriginalSize = true); |
c27eab7e VZ |
83 | virtual void ChangeBackgroundColour(); |
84 | virtual void ChangeForegroundColour(); | |
85 | void SetModified(bool mod) { m_modified = mod; } | |
86 | virtual WXWidget GetTopWidget() const; | |
7d8268a1 | 87 | |
c27eab7e VZ |
88 | // send the CHAR and TEXT_UPDATED events |
89 | void DoSendEvents(void /* XmTextVerifyCallbackStruct */ *cbs, | |
978c6e41 | 90 | long keycode); |
7d8268a1 | 91 | |
9b6dbb09 | 92 | protected: |
e1aae528 | 93 | virtual wxSize DoGetBestSize() const; |
ee2ec18e VZ |
94 | |
95 | virtual void DoSetValue(const wxString& value, int flags = 0); | |
96 | ||
978c6e41 VZ |
97 | virtual WXWidget GetTextWidget() const { return m_mainWidget; } |
98 | ||
02e8b2f9 | 99 | public: |
c27eab7e VZ |
100 | // Motif-specific |
101 | void* m_tempCallbackStruct; | |
102 | bool m_modified; | |
103 | wxString m_value; // Required for password text controls | |
7d8268a1 | 104 | |
c27eab7e VZ |
105 | // Did we call wxTextCtrl::OnChar? If so, generate a command event. |
106 | bool m_processedDefault; | |
7d8268a1 | 107 | |
c27eab7e VZ |
108 | private: |
109 | DECLARE_EVENT_TABLE() | |
978c6e41 | 110 | DECLARE_DYNAMIC_CLASS(wxTextCtrl) |
9b6dbb09 JS |
111 | }; |
112 | ||
113 | #endif | |
83df96d6 | 114 | // _WX_TEXTCTRL_H_ |