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