]>
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 and Markus Holzem
9 // Licence: wxWindows license
10 /////////////////////////////////////////////////////////////////////////////
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
, const wxWindowID id
,
53 const wxString
& value
= wxEmptyString
,
54 const wxPoint
& pos
= wxDefaultPosition
,
55 const wxSize
& size
= wxDefaultSize
, const 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
, const wxWindowID id
,
66 const wxString
& value
= wxEmptyString
,
67 const wxPoint
& pos
= wxDefaultPosition
,
68 const wxSize
& size
= wxDefaultSize
, const long style
= 0,
69 const wxValidator
& validator
= wxDefaultValidator
,
70 const wxString
& name
= wxTextCtrlNameStr
);
72 virtual wxString
GetValue(void) const ;
73 virtual void SetValue(const wxString
& value
);
74 virtual void SetSize(const int x
, const int y
, const int width
, const int height
, const int sizeFlags
= wxSIZE_AUTO
);
76 // Clipboard operations
77 virtual void Copy(void);
78 virtual void Cut(void);
79 virtual void Paste(void);
81 virtual void SetInsertionPoint(const long pos
);
82 virtual void SetInsertionPointEnd(void);
83 virtual long GetInsertionPoint(void) const ;
84 virtual long GetLastPosition(void) const ;
85 virtual void Replace(const long from
, const long to
, const wxString
& value
);
86 virtual void Remove(const long from
, const long to
);
87 virtual void SetSelection(const long from
, const long to
);
89 virtual void Command(wxCommandEvent
& event
);
91 virtual void SetEditable(const bool editable
);
93 #ifndef NO_TEXT_WINDOW_STREAM
99 void OnDropFiles(wxDropFilesEvent
& event
);
101 wxTextCtrl
& operator<<(const wxString
& s
);
102 wxTextCtrl
& operator<<(const int i
);
103 wxTextCtrl
& operator<<(const long i
);
104 wxTextCtrl
& operator<<(const float f
);
105 wxTextCtrl
& operator<<(const double d
);
106 wxTextCtrl
& operator<<(const char c
);
108 virtual bool LoadFile(const wxString
& file
);
109 virtual bool SaveFile(const wxString
& file
);
110 virtual void WriteText(const wxString
& text
);
111 virtual void DiscardEdits(void);
112 virtual bool IsModified(void) const;
114 #if WXWIN_COMPATIBILITY
115 inline bool Modified(void) const { return IsModified(); }
118 virtual long XYToPosition(const long x
, const long y
) const ;
119 virtual void PositionToXY(const long pos
, long *x
, long *y
) const ;
120 virtual void ShowPosition(const long pos
);
121 virtual int GetLineLength(const long lineNo
) const ;
122 virtual wxString
GetLineText(const long lineNo
) const ;
123 virtual int GetNumberOfLines(void) const ;
124 virtual void Clear(void);
126 // Process special keys e.g. 'enter' and process as if it were a command, if required
127 void OnChar(wxKeyEvent
& event
);
129 void OnEraseBackground(wxEraseEvent
& event
);
132 virtual bool MSWCommand(const WXUINT param
, const WXWORD id
);
133 inline bool IsRich(void) { return m_isRich
; }
134 inline void SetRichEdit(const bool isRich
) { m_isRich
= isRich
; }
135 virtual WXHBRUSH
OnCtlColor(const WXHDC pDC
, const WXHWND pWnd
, const WXUINT nCtlColor
,
136 WXUINT message
, WXWPARAM wParam
, WXLPARAM lParam
);
138 virtual long MSWWindowProc(WXUINT nMsg
, WXWPARAM wParam
, WXLPARAM lParam
);
139 virtual void AdoptAttributesFromHWND(void);
140 virtual void SetupColours(void);
143 bool m_isRich
; // Are we using rich text edit to implement this?
145 DECLARE_EVENT_TABLE()