1 /////////////////////////////////////////////////////////////////////////////
3 // Purpose: private wxMacTextControl base class
4 // Author: Stefan Csomor
8 // Copyright: (c) Stefan Csomor
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
12 #ifndef _WX_MAC_PRIVATE_MACTEXT_H_
13 #define _WX_MAC_PRIVATE_MACTEXT_H_
15 #include "wx/mac/private.h"
17 // common interface for all implementations
18 class wxMacTextControl
: public wxMacControl
21 wxMacTextControl( wxTextCtrl
*peer
) ;
22 virtual ~wxMacTextControl() ;
24 virtual wxString
GetStringValue() const = 0 ;
25 virtual void SetStringValue( const wxString
&val
) = 0 ;
26 virtual void SetSelection( long from
, long to
) = 0 ;
27 virtual void GetSelection( long* from
, long* to
) const = 0 ;
28 virtual void WriteText( const wxString
& str
) = 0 ;
30 virtual void SetStyle( long start
, long end
, const wxTextAttr
& style
) ;
33 virtual void Paste() ;
34 virtual bool CanPaste() const ;
35 virtual void SetEditable( bool editable
) ;
36 virtual wxTextPos
GetLastPosition() const ;
37 virtual void Replace( long from
, long to
, const wxString
&str
) ;
38 virtual void Remove( long from
, long to
) ;
41 virtual bool HasOwnContextMenu() const
44 virtual bool SetupCursor( const wxPoint
& pt
)
47 virtual void Clear() ;
48 virtual bool CanUndo() const;
50 virtual bool CanRedo() const;
52 virtual int GetNumberOfLines() const ;
53 virtual long XYToPosition(long x
, long y
) const;
54 virtual bool PositionToXY(long pos
, long *x
, long *y
) const ;
55 virtual void ShowPosition(long WXUNUSED(pos
)) ;
56 virtual int GetLineLength(long lineNo
) const ;
57 virtual wxString
GetLineText(long lineNo
) const ;
58 virtual void CheckSpelling(bool check
) { }
61 virtual void MacControlUserPaneDrawProc(wxInt16 part
) = 0 ;
62 virtual wxInt16
MacControlUserPaneHitTestProc(wxInt16 x
, wxInt16 y
) = 0 ;
63 virtual wxInt16
MacControlUserPaneTrackingProc(wxInt16 x
, wxInt16 y
, void* actionProc
) = 0 ;
64 virtual void MacControlUserPaneIdleProc() = 0 ;
65 virtual wxInt16
MacControlUserPaneKeyDownProc(wxInt16 keyCode
, wxInt16 charCode
, wxInt16 modifiers
) = 0 ;
66 virtual void MacControlUserPaneActivateProc(bool activating
) = 0 ;
67 virtual wxInt16
MacControlUserPaneFocusProc(wxInt16 action
) = 0 ;
68 virtual void MacControlUserPaneBackgroundProc(void* info
) = 0 ;
72 #if TARGET_API_MAC_OSX
74 class wxMacUnicodeTextControl
: public wxMacTextControl
77 wxMacUnicodeTextControl( wxTextCtrl
*wxPeer
) ;
78 wxMacUnicodeTextControl( wxTextCtrl
*wxPeer
,
81 const wxSize
& size
, long style
) ;
82 virtual ~wxMacUnicodeTextControl();
84 virtual bool Create( wxTextCtrl
*wxPeer
,
87 const wxSize
& size
, long style
) ;
88 virtual void VisibilityChanged(bool shown
);
89 virtual wxString
GetStringValue() const ;
90 virtual void SetStringValue( const wxString
&str
) ;
94 virtual bool CanPaste() const;
95 virtual void SetEditable(bool editable
) ;
96 virtual void GetSelection( long* from
, long* to
) const ;
97 virtual void SetSelection( long from
, long to
) ;
98 virtual void WriteText(const wxString
& str
) ;
101 virtual void CreateControl( wxTextCtrl
* peer
, const Rect
* bounds
, CFStringRef cfr
);
103 // contains the tag for the content (is different for password and non-password controls)
106 // as the selection tag only works correctly when the control has the focus we have to mirror the
108 EventHandlerRef m_focusHandlerRef
;
110 ControlEditTextSelectionRec m_selection
;
113 #endif // TARGET_API_MAC_OSX
115 #endif // _WX_MAC_PRIVATE_MACTEXT_H_