]> git.saurik.com Git - wxWidgets.git/blame - include/wx/motif/textctrl.h
Try to avoid accidental use of wxXmlNode in XRC handlers.
[wxWidgets.git] / include / wx / motif / textctrl.h
CommitLineData
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
7// RCS-ID: $Id$
8// Copyright: (c) Julian Smart
65571936 9// Licence: wxWindows licence
9b6dbb09
JS
10/////////////////////////////////////////////////////////////////////////////
11
12#ifndef _WX_TEXTCTRL_H_
13#define _WX_TEXTCTRL_H_
14
9b6dbb09 15// Single-line text item
53a2db12 16class WXDLLIMPEXP_CORE wxTextCtrl : public wxTextCtrlBase
9b6dbb09 17{
9b6dbb09 18public:
c27eab7e
VZ
19 // creation
20 // --------
978c6e41 21
c27eab7e
VZ
22 wxTextCtrl();
23 wxTextCtrl(wxWindow *parent,
978c6e41
VZ
24 wxWindowID id,
25 const wxString& value = wxEmptyString,
26 const wxPoint& pos = wxDefaultPosition,
27 const wxSize& size = wxDefaultSize,
28 long style = 0,
29 const wxValidator& validator = wxDefaultValidator,
30 const wxString& name = wxTextCtrlNameStr)
83df96d6
JS
31 {
32 Create(parent, id, value, pos, size, style, validator, name);
33 }
7d8268a1 34
c27eab7e 35 bool Create(wxWindow *parent, wxWindowID id,
978c6e41
VZ
36 const wxString& value = wxEmptyString,
37 const wxPoint& pos = wxDefaultPosition,
38 const wxSize& size = wxDefaultSize, long style = 0,
39 const wxValidator& validator = wxDefaultValidator,
40 const wxString& name = wxTextCtrlNameStr);
7d8268a1 41
c27eab7e
VZ
42 // accessors
43 // ---------
44 virtual wxString GetValue() const;
7d8268a1 45
c27eab7e
VZ
46 virtual int GetLineLength(long lineNo) const;
47 virtual wxString GetLineText(long lineNo) const;
48 virtual int GetNumberOfLines() const;
7d8268a1 49
c27eab7e
VZ
50 // operations
51 // ----------
7d8268a1 52
3a9fa0d6 53 virtual void MarkDirty();
c27eab7e
VZ
54 virtual void DiscardEdits();
55 virtual bool IsModified() const;
7d8268a1 56
c27eab7e 57 virtual long XYToPosition(long x, long y) const;
813c20a6 58 virtual bool PositionToXY(long pos, long *x, long *y) const;
c27eab7e 59 virtual void ShowPosition(long pos);
7d8268a1 60
c27eab7e
VZ
61 // callbacks
62 // ---------
63 void OnDropFiles(wxDropFilesEvent& event);
64 void OnChar(wxKeyEvent& event);
65 // void OnEraseBackground(wxEraseEvent& event);
7d8268a1 66
e702ff0f
JS
67 void OnCut(wxCommandEvent& event);
68 void OnCopy(wxCommandEvent& event);
69 void OnPaste(wxCommandEvent& event);
70 void OnUndo(wxCommandEvent& event);
71 void OnRedo(wxCommandEvent& event);
7d8268a1 72
e702ff0f
JS
73 void OnUpdateCut(wxUpdateUIEvent& event);
74 void OnUpdateCopy(wxUpdateUIEvent& event);
75 void OnUpdatePaste(wxUpdateUIEvent& event);
76 void OnUpdateUndo(wxUpdateUIEvent& event);
77 void OnUpdateRedo(wxUpdateUIEvent& event);
7d8268a1 78
c27eab7e 79 virtual void Command(wxCommandEvent& event);
7d8268a1 80
c27eab7e
VZ
81 // implementation from here to the end
82 // -----------------------------------
7d8268a1 83 virtual void ChangeFont(bool keepOriginalSize = true);
c27eab7e
VZ
84 virtual void ChangeBackgroundColour();
85 virtual void ChangeForegroundColour();
86 void SetModified(bool mod) { m_modified = mod; }
87 virtual WXWidget GetTopWidget() const;
7d8268a1 88
c27eab7e
VZ
89 // send the CHAR and TEXT_UPDATED events
90 void DoSendEvents(void /* XmTextVerifyCallbackStruct */ *cbs,
978c6e41 91 long keycode);
7d8268a1 92
9b6dbb09 93protected:
e1aae528 94 virtual wxSize DoGetBestSize() const;
ee2ec18e
VZ
95
96 virtual void DoSetValue(const wxString& value, int flags = 0);
97
978c6e41
VZ
98 virtual WXWidget GetTextWidget() const { return m_mainWidget; }
99
02e8b2f9 100public:
c27eab7e
VZ
101 // Motif-specific
102 void* m_tempCallbackStruct;
103 bool m_modified;
104 wxString m_value; // Required for password text controls
7d8268a1 105
c27eab7e
VZ
106 // Did we call wxTextCtrl::OnChar? If so, generate a command event.
107 bool m_processedDefault;
7d8268a1 108
c27eab7e
VZ
109private:
110 DECLARE_EVENT_TABLE()
978c6e41 111 DECLARE_DYNAMIC_CLASS(wxTextCtrl)
9b6dbb09
JS
112};
113
114#endif
83df96d6 115// _WX_TEXTCTRL_H_