]>
Commit | Line | Data |
---|---|---|
1e181c7a | 1 | ///////////////////////////////////////////////////////////////////////////// |
80fdcdb9 | 2 | // Name: wx/osx/cocoa/private/textimpl.h |
1e181c7a SC |
3 | // Purpose: textcontrol implementation classes that have to be exposed |
4 | // Author: Stefan Csomor | |
5 | // Modified by: | |
6 | // Created: 03/02/99 | |
2903e699 | 7 | // RCS-ID: $Id$ |
1e181c7a SC |
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 | ||
c84030e0 | 15 | #include "wx/combobox.h" |
1e181c7a SC |
16 | #include "wx/osx/private.h" |
17 | ||
2903e699 | 18 | // implementation exposed, so that search control can pull it |
1e181c7a SC |
19 | |
20 | class wxNSTextFieldControl : public wxWidgetCocoaImpl, public wxTextWidgetImpl | |
21 | { | |
22 | public : | |
c072b9ec VZ |
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 ); | |
1e181c7a | 29 | virtual ~wxNSTextFieldControl(); |
2903e699 | 30 | |
4386db06 SC |
31 | virtual bool CanClipMaxLength() const { return true; } |
32 | virtual void SetMaxLength(unsigned long len); | |
33 | ||
1e181c7a SC |
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) ; | |
e908dbcc | 44 | virtual bool HasOwnContextMenu() const { return true; } |
99eb484a | 45 | virtual bool SetHint(const wxString& hint); |
03647350 | 46 | |
e32090ba | 47 | virtual void controlAction(WXWidget slf, void* _cmd, void *sender); |
1e70e497 SC |
48 | virtual bool becomeFirstResponder(WXWidget slf, void *_cmd); |
49 | virtual bool resignFirstResponder(WXWidget slf, void *_cmd); | |
c072b9ec | 50 | |
8e64b8fe SC |
51 | virtual void SetInternalSelection( long from , long to ); |
52 | ||
e32090ba SC |
53 | protected : |
54 | NSTextField* m_textField; | |
50b5e38d SC |
55 | long m_selStart; |
56 | long m_selEnd; | |
c072b9ec VZ |
57 | |
58 | private: | |
59 | // Common part of both ctors. | |
60 | void Init(WXWidget w); | |
1e181c7a SC |
61 | }; |
62 | ||
c824c165 KO |
63 | class wxNSTextViewControl : public wxWidgetCocoaImpl, public wxTextWidgetImpl |
64 | { | |
65 | public: | |
66 | wxNSTextViewControl( wxTextCtrl *wxPeer, WXWidget w ); | |
67 | virtual ~wxNSTextViewControl(); | |
68 | ||
69 | virtual wxString GetStringValue() const ; | |
70 | virtual void SetStringValue( const wxString &str) ; | |
71 | virtual void Copy() ; | |
72 | virtual void Cut() ; | |
73 | virtual void Paste() ; | |
74 | virtual bool CanPaste() const ; | |
75 | virtual void SetEditable(bool editable) ; | |
76 | virtual void GetSelection( long* from, long* to) const ; | |
77 | virtual void SetSelection( long from , long to ); | |
78 | virtual void WriteText(const wxString& str) ; | |
f95dd972 | 79 | virtual void SetFont( const wxFont & font , const wxColour& foreground , long windowStyle, bool ignoreBlack = true ); |
ce00f59b | 80 | |
16671f22 KO |
81 | virtual bool GetStyle(long position, wxTextAttr& style); |
82 | virtual void SetStyle(long start, long end, const wxTextAttr& style); | |
ce00f59b | 83 | |
78a17075 | 84 | virtual bool CanFocus() const; |
ce00f59b | 85 | |
e908dbcc | 86 | virtual bool HasOwnContextMenu() const { return true; } |
ce00f59b | 87 | |
b9cf2753 | 88 | virtual void CheckSpelling(bool check); |
9ab7ff53 | 89 | virtual wxSize GetBestSize() const; |
c824c165 KO |
90 | |
91 | protected: | |
92 | NSScrollView* m_scrollView; | |
93 | NSTextView* m_textView; | |
94 | }; | |
95 | ||
c84030e0 KO |
96 | class wxNSComboBoxControl : public wxNSTextFieldControl, public wxComboWidgetImpl |
97 | { | |
98 | public : | |
c072b9ec | 99 | wxNSComboBoxControl( wxComboBox *wxPeer, WXWidget w ); |
c84030e0 | 100 | virtual ~wxNSComboBoxControl(); |
ce00f59b | 101 | |
c84030e0 KO |
102 | virtual int GetSelectedItem() const; |
103 | virtual void SetSelectedItem(int item); | |
ce00f59b | 104 | |
c84030e0 | 105 | virtual int GetNumberOfItems() const; |
ce00f59b | 106 | |
c84030e0 KO |
107 | virtual void InsertItem(int pos, const wxString& item); |
108 | virtual void RemoveItem(int pos); | |
ce00f59b | 109 | |
c84030e0 | 110 | virtual void Clear(); |
ce00f59b | 111 | |
c84030e0 | 112 | virtual wxString GetStringAtIndex(int pos) const; |
ce00f59b | 113 | |
c84030e0 | 114 | virtual int FindString(const wxString& text) const; |
ff8cb900 VZ |
115 | virtual void Popup(); |
116 | virtual void Dismiss(); | |
117 | ||
c84030e0 KO |
118 | private: |
119 | NSComboBox* m_comboBox; | |
120 | }; | |
121 | ||
1e181c7a | 122 | #endif // _WX_OSX_COCOA_PRIVATE_TEXTIMPL_H_ |