]>
git.saurik.com Git - wxWidgets.git/blob - include/wx/msw/textctrl.h
1 /////////////////////////////////////////////////////////////////////////////
3 // Purpose: wxTextCtrl class
4 // Author: Julian Smart
8 // Copyright: (c) Julian Smart
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
12 #ifndef _WX_TEXTCTRL_H_
13 #define _WX_TEXTCTRL_H_
16 #pragma interface "textctrl.h"
19 #include "wx/control.h"
27 WXDLLEXPORT_DATA(extern const char*) wxTextCtrlNameStr
;
28 WXDLLEXPORT_DATA(extern const char*) wxEmptyString
;
30 // Single-line text item
31 class WXDLLEXPORT wxTextCtrl
: public wxControl
33 // 16-bit Borland 4.0 doesn't seem to allow multiple inheritance with wxWindow and streambuf:
34 // it complains about deriving a huge class from the huge class streambuf. !!
35 // Also, can't use streambuf if making or using a DLL :-(
37 #if (defined(__BORLANDC__) && !defined(__WIN32__)) || defined(__MWERKS__) || defined(_WINDLL) || defined(WXUSINGDLL) || defined(WXMAKINGDLL)
38 #define NO_TEXT_WINDOW_STREAM
41 #ifndef NO_TEXT_WINDOW_STREAM
46 DECLARE_DYNAMIC_CLASS(wxTextCtrl
)
52 inline wxTextCtrl(wxWindow
*parent
, wxWindowID id
,
53 const wxString
& value
= wxEmptyString
,
54 const wxPoint
& pos
= wxDefaultPosition
,
55 const wxSize
& size
= wxDefaultSize
, long style
= 0,
56 const wxValidator
& validator
= wxDefaultValidator
,
57 const wxString
& name
= wxTextCtrlNameStr
)
58 #ifndef NO_TEXT_WINDOW_STREAM
62 Create(parent
, id
, value
, pos
, size
, style
, validator
, name
);
65 bool Create(wxWindow
*parent
, wxWindowID id
,
66 const wxString
& value
= wxEmptyString
,
67 const wxPoint
& pos
= wxDefaultPosition
,
68 const wxSize
& size
= wxDefaultSize
, long style
= 0,
69 const wxValidator
& validator
= wxDefaultValidator
,
70 const wxString
& name
= wxTextCtrlNameStr
);
74 virtual wxString
GetValue() const ;
75 virtual void SetValue(const wxString
& value
);
77 virtual int GetLineLength(long lineNo
) const;
78 virtual wxString
GetLineText(long lineNo
) const;
79 virtual int GetNumberOfLines() const;
83 virtual void SetSize(int x
, int y
, int width
, int height
, int sizeFlags
= wxSIZE_AUTO
);
85 // Clipboard operations
90 virtual void SetInsertionPoint(long pos
);
91 virtual void SetInsertionPointEnd();
92 virtual long GetInsertionPoint() const ;
93 virtual long GetLastPosition() const ;
94 virtual void Replace(long from
, long to
, const wxString
& value
);
95 virtual void Remove(long from
, long to
);
96 virtual void SetSelection(long from
, long to
);
97 virtual void SetEditable(bool editable
);
99 // streambuf implementation
100 #ifndef NO_TEXT_WINDOW_STREAM
106 wxTextCtrl
& operator<<(const wxString
& s
);
107 wxTextCtrl
& operator<<(int i
);
108 wxTextCtrl
& operator<<(long i
);
109 wxTextCtrl
& operator<<(float f
);
110 wxTextCtrl
& operator<<(double d
);
111 wxTextCtrl
& operator<<(const char c
);
113 virtual bool LoadFile(const wxString
& file
);
114 virtual bool SaveFile(const wxString
& file
);
115 virtual void WriteText(const wxString
& text
);
116 virtual void DiscardEdits();
117 virtual bool IsModified() const;
119 #if WXWIN_COMPATIBILITY
120 inline bool Modified() const { return IsModified(); }
123 virtual long XYToPosition(long x
, long y
) const ;
124 virtual void PositionToXY(long pos
, long *x
, long *y
) const ;
125 virtual void ShowPosition(long pos
);
126 virtual void Clear();
130 void OnDropFiles(wxDropFilesEvent
& event
);
131 void OnChar(wxKeyEvent
& event
); // Process 'enter' if required
132 void OnEraseBackground(wxEraseEvent
& event
);
136 virtual void Command(wxCommandEvent
& event
);
137 virtual bool MSWCommand(WXUINT param
, WXWORD id
);
138 inline bool IsRich() const { return m_isRich
; }
139 inline void SetRichEdit(bool isRich
) { m_isRich
= isRich
; }
140 virtual WXHBRUSH
OnCtlColor(WXHDC pDC
, WXHWND pWnd
, WXUINT nCtlColor
,
141 WXUINT message
, WXWPARAM wParam
,
144 virtual void AdoptAttributesFromHWND();
145 virtual void SetupColours();
146 virtual long MSWGetDlgCode();
149 bool m_isRich
; // Are we using rich text edit to implement this?
152 DECLARE_EVENT_TABLE()