]> git.saurik.com Git - wxWidgets.git/blob - include/wx/motif/textctrl.h
Unselect all wxDataViewCtrl items when clicking outside of the item area.
[wxWidgets.git] / include / wx / motif / textctrl.h
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: wx/motif/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
16 class WXDLLIMPEXP_CORE wxTextCtrl : public wxTextCtrlBase
17 {
18 public:
19 // creation
20 // --------
21
22 wxTextCtrl();
23 wxTextCtrl(wxWindow *parent,
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)
31 {
32 Create(parent, id, value, pos, size, style, validator, name);
33 }
34
35 bool Create(wxWindow *parent, wxWindowID id,
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);
41
42 // accessors
43 // ---------
44 virtual wxString GetValue() const;
45
46 virtual int GetLineLength(long lineNo) const;
47 virtual wxString GetLineText(long lineNo) const;
48 virtual int GetNumberOfLines() const;
49
50 // operations
51 // ----------
52
53 virtual void MarkDirty();
54 virtual void DiscardEdits();
55 virtual bool IsModified() const;
56
57 virtual long XYToPosition(long x, long y) const;
58 virtual bool PositionToXY(long pos, long *x, long *y) const;
59 virtual void ShowPosition(long pos);
60
61 // callbacks
62 // ---------
63 void OnDropFiles(wxDropFilesEvent& event);
64 void OnChar(wxKeyEvent& event);
65 // void OnEraseBackground(wxEraseEvent& event);
66
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);
72
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);
78
79 virtual void Command(wxCommandEvent& event);
80
81 // implementation from here to the end
82 // -----------------------------------
83 virtual void ChangeFont(bool keepOriginalSize = true);
84 virtual void ChangeBackgroundColour();
85 virtual void ChangeForegroundColour();
86 void SetModified(bool mod) { m_modified = mod; }
87 virtual WXWidget GetTopWidget() const;
88
89 // send the CHAR and TEXT_UPDATED events
90 void DoSendEvents(void /* XmTextVerifyCallbackStruct */ *cbs,
91 long keycode);
92
93 protected:
94 virtual wxSize DoGetBestSize() const;
95
96 virtual void DoSetValue(const wxString& value, int flags = 0);
97
98 virtual WXWidget GetTextWidget() const { return m_mainWidget; }
99
100 public:
101 // Motif-specific
102 void* m_tempCallbackStruct;
103 bool m_modified;
104 wxString m_value; // Required for password text controls
105
106 // Did we call wxTextCtrl::OnChar? If so, generate a command event.
107 bool m_processedDefault;
108
109 private:
110 DECLARE_EVENT_TABLE()
111 DECLARE_DYNAMIC_CLASS(wxTextCtrl)
112 };
113
114 #endif
115 // _WX_TEXTCTRL_H_