]>
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 | |
1e181c7a SC |
7 | // Copyright: (c) Stefan Csomor |
8 | // Licence: wxWindows licence | |
9 | ///////////////////////////////////////////////////////////////////////////// | |
10 | ||
11 | #ifndef _WX_OSX_COCOA_PRIVATE_TEXTIMPL_H_ | |
12 | #define _WX_OSX_COCOA_PRIVATE_TEXTIMPL_H_ | |
13 | ||
c84030e0 | 14 | #include "wx/combobox.h" |
1e181c7a SC |
15 | #include "wx/osx/private.h" |
16 | ||
2903e699 | 17 | // implementation exposed, so that search control can pull it |
1e181c7a SC |
18 | |
19 | class wxNSTextFieldControl : public wxWidgetCocoaImpl, public wxTextWidgetImpl | |
20 | { | |
21 | public : | |
c072b9ec VZ |
22 | // wxNSTextFieldControl must always be associated with a wxTextEntry. If |
23 | // it's associated with a wxTextCtrl then we can get the associated entry | |
24 | // from it but otherwise the second ctor should be used to explicitly pass | |
25 | // us the entry. | |
26 | wxNSTextFieldControl( wxTextCtrl *text, WXWidget w ); | |
27 | wxNSTextFieldControl( wxWindow *wxPeer, wxTextEntry *entry, WXWidget w ); | |
1e181c7a | 28 | virtual ~wxNSTextFieldControl(); |
2903e699 | 29 | |
4386db06 SC |
30 | virtual bool CanClipMaxLength() const { return true; } |
31 | virtual void SetMaxLength(unsigned long len); | |
32 | ||
1e181c7a SC |
33 | virtual wxString GetStringValue() const ; |
34 | virtual void SetStringValue( const wxString &str) ; | |
35 | virtual void Copy() ; | |
36 | virtual void Cut() ; | |
37 | virtual void Paste() ; | |
38 | virtual bool CanPaste() const ; | |
39 | virtual void SetEditable(bool editable) ; | |
40 | virtual void GetSelection( long* from, long* to) const ; | |
41 | virtual void SetSelection( long from , long to ); | |
42 | virtual void WriteText(const wxString& str) ; | |
e908dbcc | 43 | virtual bool HasOwnContextMenu() const { return true; } |
99eb484a | 44 | virtual bool SetHint(const wxString& hint); |
03647350 | 45 | |
e32090ba | 46 | virtual void controlAction(WXWidget slf, void* _cmd, void *sender); |
1e70e497 SC |
47 | virtual bool becomeFirstResponder(WXWidget slf, void *_cmd); |
48 | virtual bool resignFirstResponder(WXWidget slf, void *_cmd); | |
c072b9ec | 49 | |
8e64b8fe SC |
50 | virtual void SetInternalSelection( long from , long to ); |
51 | ||
e32090ba SC |
52 | protected : |
53 | NSTextField* m_textField; | |
50b5e38d SC |
54 | long m_selStart; |
55 | long m_selEnd; | |
c072b9ec VZ |
56 | |
57 | private: | |
58 | // Common part of both ctors. | |
59 | void Init(WXWidget w); | |
1e181c7a SC |
60 | }; |
61 | ||
c824c165 KO |
62 | class wxNSTextViewControl : public wxWidgetCocoaImpl, public wxTextWidgetImpl |
63 | { | |
64 | public: | |
65 | wxNSTextViewControl( wxTextCtrl *wxPeer, WXWidget w ); | |
66 | virtual ~wxNSTextViewControl(); | |
67 | ||
68 | virtual wxString GetStringValue() const ; | |
69 | virtual void SetStringValue( const wxString &str) ; | |
70 | virtual void Copy() ; | |
71 | virtual void Cut() ; | |
72 | virtual void Paste() ; | |
73 | virtual bool CanPaste() const ; | |
74 | virtual void SetEditable(bool editable) ; | |
75 | virtual void GetSelection( long* from, long* to) const ; | |
76 | virtual void SetSelection( long from , long to ); | |
77 | virtual void WriteText(const wxString& str) ; | |
f95dd972 | 78 | virtual void SetFont( const wxFont & font , const wxColour& foreground , long windowStyle, bool ignoreBlack = true ); |
ce00f59b | 79 | |
16671f22 KO |
80 | virtual bool GetStyle(long position, wxTextAttr& style); |
81 | virtual void SetStyle(long start, long end, const wxTextAttr& style); | |
ce00f59b | 82 | |
78a17075 | 83 | virtual bool CanFocus() const; |
ce00f59b | 84 | |
e908dbcc | 85 | virtual bool HasOwnContextMenu() const { return true; } |
ce00f59b | 86 | |
b9cf2753 | 87 | virtual void CheckSpelling(bool check); |
9ab7ff53 | 88 | virtual wxSize GetBestSize() const; |
c824c165 KO |
89 | |
90 | protected: | |
91 | NSScrollView* m_scrollView; | |
92 | NSTextView* m_textView; | |
93 | }; | |
94 | ||
c84030e0 KO |
95 | class wxNSComboBoxControl : public wxNSTextFieldControl, public wxComboWidgetImpl |
96 | { | |
97 | public : | |
c072b9ec | 98 | wxNSComboBoxControl( wxComboBox *wxPeer, WXWidget w ); |
c84030e0 | 99 | virtual ~wxNSComboBoxControl(); |
ce00f59b | 100 | |
c84030e0 KO |
101 | virtual int GetSelectedItem() const; |
102 | virtual void SetSelectedItem(int item); | |
ce00f59b | 103 | |
c84030e0 | 104 | virtual int GetNumberOfItems() const; |
ce00f59b | 105 | |
c84030e0 KO |
106 | virtual void InsertItem(int pos, const wxString& item); |
107 | virtual void RemoveItem(int pos); | |
ce00f59b | 108 | |
c84030e0 | 109 | virtual void Clear(); |
ce00f59b | 110 | |
c84030e0 | 111 | virtual wxString GetStringAtIndex(int pos) const; |
ce00f59b | 112 | |
c84030e0 | 113 | virtual int FindString(const wxString& text) const; |
ff8cb900 VZ |
114 | virtual void Popup(); |
115 | virtual void Dismiss(); | |
116 | ||
d4e5c5b9 SC |
117 | virtual void SetEditable(bool editable); |
118 | ||
0afeb753 SC |
119 | virtual void mouseEvent(WX_NSEvent event, WXWidget slf, void *_cmd); |
120 | ||
c84030e0 KO |
121 | private: |
122 | NSComboBox* m_comboBox; | |
123 | }; | |
124 | ||
1e181c7a | 125 | #endif // _WX_OSX_COCOA_PRIVATE_TEXTIMPL_H_ |