]> git.saurik.com Git - wxWidgets.git/blob - include/wx/mac/carbon/private/mactext.h
preparation for allowing to use wxTimer in wxBase (heavily modified patch 1113088):
[wxWidgets.git] / include / wx / mac / carbon / private / mactext.h
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: mactext.h
3 // Purpose: private wxMacTextControl base class
4 // Author: Stefan Csomor
5 // Modified by:
6 // Created: 03/02/99
7 // RCS-ID: $Id:
8 // Copyright: (c) Stefan Csomor
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
11
12 #ifndef _WX_MAC_PRIVATE_MACTEXT_H_
13 #define _WX_MAC_PRIVATE_MACTEXT_H_
14
15 #include "wx/mac/private.h"
16
17 // common interface for all implementations
18 class wxMacTextControl : public wxMacControl
19 {
20 public :
21 wxMacTextControl( wxTextCtrl *peer ) ;
22 virtual ~wxMacTextControl() ;
23
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 ;
29
30 virtual void SetStyle( long start, long end, const wxTextAttr& style ) ;
31 virtual void Copy() ;
32 virtual void Cut() ;
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 ) ;
39
40
41 virtual bool HasOwnContextMenu() const
42 { return false ; }
43
44 virtual bool SetupCursor( const wxPoint& pt )
45 { return false ; }
46
47 virtual void Clear() ;
48 virtual bool CanUndo() const;
49 virtual void Undo() ;
50 virtual bool CanRedo() const;
51 virtual void Redo() ;
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) { }
59
60 #ifndef __WXMAC_OSX__
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 ;
69 #endif
70 } ;
71
72 #if TARGET_API_MAC_OSX
73
74 class wxMacUnicodeTextControl : public wxMacTextControl
75 {
76 public :
77 wxMacUnicodeTextControl( wxTextCtrl *wxPeer ) ;
78 wxMacUnicodeTextControl( wxTextCtrl *wxPeer,
79 const wxString& str,
80 const wxPoint& pos,
81 const wxSize& size, long style ) ;
82 virtual ~wxMacUnicodeTextControl();
83
84 virtual bool Create( wxTextCtrl *wxPeer,
85 const wxString& str,
86 const wxPoint& pos,
87 const wxSize& size, long style ) ;
88 virtual void VisibilityChanged(bool shown);
89 virtual wxString GetStringValue() const ;
90 virtual void SetStringValue( const wxString &str) ;
91 virtual void Copy();
92 virtual void Cut();
93 virtual void Paste();
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) ;
99
100 protected :
101 virtual void CreateControl( wxTextCtrl* peer, const Rect* bounds, CFStringRef cfr );
102
103 // contains the tag for the content (is different for password and non-password controls)
104 OSType m_valueTag ;
105
106 // as the selection tag only works correctly when the control has the focus we have to mirror the
107 // intended value
108 EventHandlerRef m_focusHandlerRef ;
109 public :
110 ControlEditTextSelectionRec m_selection ;
111 };
112
113 #endif // TARGET_API_MAC_OSX
114
115 #endif // _WX_MAC_PRIVATE_MACTEXT_H_