]> git.saurik.com Git - wxWidgets.git/blame - include/wx/motif/textctrl.h
Fixed typo.
[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
813c20a6 16class WXDLLEXPORT wxTextCtrl : public wxTextCtrlBase
9b6dbb09 17{
c27eab7e 18 DECLARE_DYNAMIC_CLASS(wxTextCtrl)
7d8268a1 19
9b6dbb09 20public:
c27eab7e
VZ
21 // creation
22 // --------
23 wxTextCtrl();
24 wxTextCtrl(wxWindow *parent,
83df96d6
JS
25 wxWindowID id,
26 const wxString& value = wxEmptyString,
27 const wxPoint& pos = wxDefaultPosition,
28 const wxSize& size = wxDefaultSize,
29 long style = 0,
30 const wxValidator& validator = wxDefaultValidator,
31 const wxString& name = wxTextCtrlNameStr)
32 {
33 Create(parent, id, value, pos, size, style, validator, name);
34 }
7d8268a1 35
c27eab7e 36 bool Create(wxWindow *parent, wxWindowID id,
83df96d6
JS
37 const wxString& value = wxEmptyString,
38 const wxPoint& pos = wxDefaultPosition,
39 const wxSize& size = wxDefaultSize, long style = 0,
40 const wxValidator& validator = wxDefaultValidator,
41 const wxString& name = wxTextCtrlNameStr);
7d8268a1 42
c27eab7e
VZ
43 // accessors
44 // ---------
45 virtual wxString GetValue() const;
7d8268a1 46
c27eab7e
VZ
47 virtual int GetLineLength(long lineNo) const;
48 virtual wxString GetLineText(long lineNo) const;
49 virtual int GetNumberOfLines() const;
7d8268a1 50
c27eab7e
VZ
51 // operations
52 // ----------
7d8268a1 53
c27eab7e
VZ
54 // Clipboard operations
55 virtual void Copy();
56 virtual void Cut();
57 virtual void Paste();
ca8b28f2
JS
58 virtual bool CanCopy() const;
59 virtual bool CanCut() const;
60 virtual bool CanPaste() const;
7d8268a1 61
ca8b28f2
JS
62 // Undo/redo
63 virtual void Undo();
64 virtual void Redo();
7d8268a1 65
ca8b28f2
JS
66 virtual bool CanUndo() const;
67 virtual bool CanRedo() const;
7d8268a1 68
c27eab7e
VZ
69 virtual void SetInsertionPoint(long pos);
70 virtual void SetInsertionPointEnd();
71 virtual long GetInsertionPoint() const;
7d8268a1 72 virtual wxTextPos GetLastPosition() const;
c27eab7e
VZ
73 virtual void Replace(long from, long to, const wxString& value);
74 virtual void Remove(long from, long to);
75 virtual void SetSelection(long from, long to);
76 virtual void SetEditable(bool editable);
ca8b28f2
JS
77 // If the return values from and to are the same, there is no
78 // selection.
79 virtual void GetSelection(long* from, long* to) const;
80 virtual bool IsEditable() const ;
7d8268a1 81
c27eab7e
VZ
82 virtual void WriteText(const wxString& text);
83 virtual void AppendText(const wxString& text);
3a9fa0d6 84 virtual void MarkDirty();
c27eab7e
VZ
85 virtual void DiscardEdits();
86 virtual bool IsModified() const;
7d8268a1 87
c27eab7e 88 virtual long XYToPosition(long x, long y) const;
813c20a6 89 virtual bool PositionToXY(long pos, long *x, long *y) const;
c27eab7e
VZ
90 virtual void ShowPosition(long pos);
91 virtual void Clear();
7d8268a1 92
c27eab7e
VZ
93 // callbacks
94 // ---------
95 void OnDropFiles(wxDropFilesEvent& event);
96 void OnChar(wxKeyEvent& event);
97 // void OnEraseBackground(wxEraseEvent& event);
7d8268a1 98
e702ff0f
JS
99 void OnCut(wxCommandEvent& event);
100 void OnCopy(wxCommandEvent& event);
101 void OnPaste(wxCommandEvent& event);
102 void OnUndo(wxCommandEvent& event);
103 void OnRedo(wxCommandEvent& event);
7d8268a1 104
e702ff0f
JS
105 void OnUpdateCut(wxUpdateUIEvent& event);
106 void OnUpdateCopy(wxUpdateUIEvent& event);
107 void OnUpdatePaste(wxUpdateUIEvent& event);
108 void OnUpdateUndo(wxUpdateUIEvent& event);
109 void OnUpdateRedo(wxUpdateUIEvent& event);
7d8268a1 110
c27eab7e 111 virtual void Command(wxCommandEvent& event);
7d8268a1 112
c27eab7e
VZ
113 // implementation from here to the end
114 // -----------------------------------
7d8268a1 115 virtual void ChangeFont(bool keepOriginalSize = true);
c27eab7e
VZ
116 virtual void ChangeBackgroundColour();
117 virtual void ChangeForegroundColour();
118 void SetModified(bool mod) { m_modified = mod; }
119 virtual WXWidget GetTopWidget() const;
7d8268a1 120
c27eab7e
VZ
121 // send the CHAR and TEXT_UPDATED events
122 void DoSendEvents(void /* XmTextVerifyCallbackStruct */ *cbs,
83df96d6 123 long keycode);
7d8268a1 124
9b6dbb09 125protected:
c27eab7e 126 wxString m_fileName;
e1aae528
MB
127
128 virtual wxSize DoGetBestSize() const;
ee2ec18e
VZ
129
130 virtual void DoSetValue(const wxString& value, int flags = 0);
131
02e8b2f9 132public:
c27eab7e
VZ
133 // Motif-specific
134 void* m_tempCallbackStruct;
135 bool m_modified;
136 wxString m_value; // Required for password text controls
7d8268a1 137
c27eab7e
VZ
138 // Did we call wxTextCtrl::OnChar? If so, generate a command event.
139 bool m_processedDefault;
7d8268a1 140
c27eab7e
VZ
141private:
142 DECLARE_EVENT_TABLE()
9b6dbb09
JS
143};
144
145#endif
83df96d6 146// _WX_TEXTCTRL_H_