]>
Commit | Line | Data |
---|---|---|
1 | ///////////////////////////////////////////////////////////////////////////// | |
2 | // Name: wx/motif/textctrl.h | |
3 | // Purpose: wxTextCtrl class | |
4 | // Author: Julian Smart | |
5 | // Modified by: | |
6 | // Created: 17/09/98 | |
7 | // Copyright: (c) Julian Smart | |
8 | // Licence: wxWindows licence | |
9 | ///////////////////////////////////////////////////////////////////////////// | |
10 | ||
11 | #ifndef _WX_TEXTCTRL_H_ | |
12 | #define _WX_TEXTCTRL_H_ | |
13 | ||
14 | // Single-line text item | |
15 | class WXDLLIMPEXP_CORE wxTextCtrl : public wxTextCtrlBase | |
16 | { | |
17 | public: | |
18 | // creation | |
19 | // -------- | |
20 | ||
21 | wxTextCtrl(); | |
22 | wxTextCtrl(wxWindow *parent, | |
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) | |
30 | { | |
31 | Create(parent, id, value, pos, size, style, validator, name); | |
32 | } | |
33 | ||
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); | |
40 | ||
41 | // accessors | |
42 | // --------- | |
43 | virtual wxString GetValue() const; | |
44 | ||
45 | virtual int GetLineLength(long lineNo) const; | |
46 | virtual wxString GetLineText(long lineNo) const; | |
47 | virtual int GetNumberOfLines() const; | |
48 | ||
49 | // operations | |
50 | // ---------- | |
51 | ||
52 | virtual void MarkDirty(); | |
53 | virtual void DiscardEdits(); | |
54 | virtual bool IsModified() const; | |
55 | ||
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); | |
59 | ||
60 | // callbacks | |
61 | // --------- | |
62 | void OnDropFiles(wxDropFilesEvent& event); | |
63 | void OnChar(wxKeyEvent& event); | |
64 | // void OnEraseBackground(wxEraseEvent& event); | |
65 | ||
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); | |
71 | ||
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); | |
77 | ||
78 | virtual void Command(wxCommandEvent& event); | |
79 | ||
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; | |
87 | ||
88 | // send the CHAR and TEXT_UPDATED events | |
89 | void DoSendEvents(void /* XmTextVerifyCallbackStruct */ *cbs, | |
90 | long keycode); | |
91 | ||
92 | protected: | |
93 | virtual wxSize DoGetBestSize() const; | |
94 | ||
95 | virtual void DoSetValue(const wxString& value, int flags = 0); | |
96 | ||
97 | virtual WXWidget GetTextWidget() const { return m_mainWidget; } | |
98 | ||
99 | public: | |
100 | // Motif-specific | |
101 | void* m_tempCallbackStruct; | |
102 | bool m_modified; | |
103 | wxString m_value; // Required for password text controls | |
104 | ||
105 | // Did we call wxTextCtrl::OnChar? If so, generate a command event. | |
106 | bool m_processedDefault; | |
107 | ||
108 | private: | |
109 | DECLARE_EVENT_TABLE() | |
110 | DECLARE_DYNAMIC_CLASS(wxTextCtrl) | |
111 | }; | |
112 | ||
113 | #endif | |
114 | // _WX_TEXTCTRL_H_ |