]> git.saurik.com Git - wxWidgets.git/blob - include/wx/osx/cocoa/private/textimpl.h
Convert wxFSW_EVENT_{WARNING,ERROR} to string correctly.
[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
49 protected :
50 NSTextField* m_textField;
51 long m_selStart;
52 long m_selEnd;
53
54 private:
55 // Common part of both ctors.
56 void Init(WXWidget w);
57 };
58
59 class wxNSTextViewControl : public wxWidgetCocoaImpl, public wxTextWidgetImpl
60 {
61 public:
62 wxNSTextViewControl( wxTextCtrl *wxPeer, WXWidget w );
63 virtual ~wxNSTextViewControl();
64
65 virtual wxString GetStringValue() const ;
66 virtual void SetStringValue( const wxString &str) ;
67 virtual void Copy() ;
68 virtual void Cut() ;
69 virtual void Paste() ;
70 virtual bool CanPaste() const ;
71 virtual void SetEditable(bool editable) ;
72 virtual void GetSelection( long* from, long* to) const ;
73 virtual void SetSelection( long from , long to );
74 virtual void WriteText(const wxString& str) ;
75 virtual void SetFont( const wxFont & font , const wxColour& foreground , long windowStyle, bool ignoreBlack = true );
76
77 virtual bool GetStyle(long position, wxTextAttr& style);
78 virtual void SetStyle(long start, long end, const wxTextAttr& style);
79
80 virtual bool CanFocus() const;
81
82 virtual bool HasOwnContextMenu() const { return true; }
83
84 virtual void CheckSpelling(bool check);
85 virtual wxSize GetBestSize() const;
86
87 protected:
88 NSScrollView* m_scrollView;
89 NSTextView* m_textView;
90 };
91
92 class wxNSComboBoxControl : public wxNSTextFieldControl, public wxComboWidgetImpl
93 {
94 public :
95 wxNSComboBoxControl( wxComboBox *wxPeer, WXWidget w );
96 virtual ~wxNSComboBoxControl();
97
98 virtual int GetSelectedItem() const;
99 virtual void SetSelectedItem(int item);
100
101 virtual int GetNumberOfItems() const;
102
103 virtual void InsertItem(int pos, const wxString& item);
104 virtual void RemoveItem(int pos);
105
106 virtual void Clear();
107
108 virtual wxString GetStringAtIndex(int pos) const;
109
110 virtual int FindString(const wxString& text) const;
111 virtual void Popup();
112 virtual void Dismiss();
113
114 private:
115 NSComboBox* m_comboBox;
116 };
117
118 #endif // _WX_OSX_COCOA_PRIVATE_TEXTIMPL_H_