]> git.saurik.com Git - wxWidgets.git/blob - include/wx/osx/cocoa/private/textimpl.h
93c3ab85d4ee672659eba16c34b15cca73152340
[wxWidgets.git] / include / wx / osx / cocoa / private / textimpl.h
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: wx/osx/cocoa/private/textimpl.h
3 // Purpose: textcontrol implementation classes that have to be exposed
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_OSX_COCOA_PRIVATE_TEXTIMPL_H_
13 #define _WX_OSX_COCOA_PRIVATE_TEXTIMPL_H_
14
15 #include "wx/combobox.h"
16 #include "wx/osx/private.h"
17
18 // implementation exposed, so that search control can pull it
19
20 class wxNSTextFieldControl : public wxWidgetCocoaImpl, public wxTextWidgetImpl
21 {
22 public :
23 // wxNSTextFieldControl must always be associated with a wxTextEntry. If
24 // it's associated with a wxTextCtrl then we can get the associated entry
25 // from it but otherwise the second ctor should be used to explicitly pass
26 // us the entry.
27 wxNSTextFieldControl( wxTextCtrl *text, WXWidget w );
28 wxNSTextFieldControl( wxWindow *wxPeer, wxTextEntry *entry, WXWidget w );
29 virtual ~wxNSTextFieldControl();
30
31 virtual bool CanClipMaxLength() const { return true; }
32 virtual void SetMaxLength(unsigned long len);
33
34 virtual wxString GetStringValue() const ;
35 virtual void SetStringValue( const wxString &str) ;
36 virtual void Copy() ;
37 virtual void Cut() ;
38 virtual void Paste() ;
39 virtual bool CanPaste() const ;
40 virtual void SetEditable(bool editable) ;
41 virtual void GetSelection( long* from, long* to) const ;
42 virtual void SetSelection( long from , long to );
43 virtual void WriteText(const wxString& str) ;
44 virtual bool HasOwnContextMenu() const { return true; }
45 virtual bool SetHint(const wxString& hint);
46
47 virtual void controlAction(WXWidget slf, void* _cmd, void *sender);
48 virtual bool becomeFirstResponder(WXWidget slf, void *_cmd);
49 virtual bool resignFirstResponder(WXWidget slf, void *_cmd);
50
51 protected :
52 NSTextField* m_textField;
53 long m_selStart;
54 long m_selEnd;
55
56 private:
57 // Common part of both ctors.
58 void Init(WXWidget w);
59 };
60
61 class wxNSTextViewControl : public wxWidgetCocoaImpl, public wxTextWidgetImpl
62 {
63 public:
64 wxNSTextViewControl( wxTextCtrl *wxPeer, WXWidget w );
65 virtual ~wxNSTextViewControl();
66
67 virtual wxString GetStringValue() const ;
68 virtual void SetStringValue( const wxString &str) ;
69 virtual void Copy() ;
70 virtual void Cut() ;
71 virtual void Paste() ;
72 virtual bool CanPaste() const ;
73 virtual void SetEditable(bool editable) ;
74 virtual void GetSelection( long* from, long* to) const ;
75 virtual void SetSelection( long from , long to );
76 virtual void WriteText(const wxString& str) ;
77 virtual void SetFont( const wxFont & font , const wxColour& foreground , long windowStyle, bool ignoreBlack = true );
78
79 virtual bool GetStyle(long position, wxTextAttr& style);
80 virtual void SetStyle(long start, long end, const wxTextAttr& style);
81
82 virtual bool CanFocus() const;
83
84 virtual bool HasOwnContextMenu() const { return true; }
85
86 virtual void CheckSpelling(bool check);
87 virtual wxSize GetBestSize() const;
88
89 protected:
90 NSScrollView* m_scrollView;
91 NSTextView* m_textView;
92 };
93
94 class wxNSComboBoxControl : public wxNSTextFieldControl, public wxComboWidgetImpl
95 {
96 public :
97 wxNSComboBoxControl( wxComboBox *wxPeer, WXWidget w );
98 virtual ~wxNSComboBoxControl();
99
100 virtual int GetSelectedItem() const;
101 virtual void SetSelectedItem(int item);
102
103 virtual int GetNumberOfItems() const;
104
105 virtual void InsertItem(int pos, const wxString& item);
106 virtual void RemoveItem(int pos);
107
108 virtual void Clear();
109
110 virtual wxString GetStringAtIndex(int pos) const;
111
112 virtual int FindString(const wxString& text) const;
113 virtual void Popup();
114 virtual void Dismiss();
115
116 private:
117 NSComboBox* m_comboBox;
118 };
119
120 #endif // _WX_OSX_COCOA_PRIVATE_TEXTIMPL_H_