]>
git.saurik.com Git - wxWidgets.git/blob - 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
8 // Copyright: (c) Stefan Csomor
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
12 #ifndef _WX_OSX_COCOA_PRIVATE_TEXTIMPL_H_
13 #define _WX_OSX_COCOA_PRIVATE_TEXTIMPL_H_
15 #include "wx/combobox.h"
16 #include "wx/osx/private.h"
18 // implementation exposed, so that search control can pull it
20 class wxNSTextFieldControl
: public wxWidgetCocoaImpl
, public wxTextWidgetImpl
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
27 wxNSTextFieldControl( wxTextCtrl
*text
, WXWidget w
);
28 wxNSTextFieldControl( wxWindow
*wxPeer
, wxTextEntry
*entry
, WXWidget w
);
29 virtual ~wxNSTextFieldControl();
31 virtual bool CanClipMaxLength() const { return true; }
32 virtual void SetMaxLength(unsigned long len
);
34 virtual wxString
GetStringValue() const ;
35 virtual void SetStringValue( const wxString
&str
) ;
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
);
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
);
51 virtual void SetInternalSelection( long from
, long to
);
54 NSTextField
* m_textField
;
59 // Common part of both ctors.
60 void Init(WXWidget w
);
63 class wxNSTextViewControl
: public wxWidgetCocoaImpl
, public wxTextWidgetImpl
66 wxNSTextViewControl( wxTextCtrl
*wxPeer
, WXWidget w
);
67 virtual ~wxNSTextViewControl();
69 virtual wxString
GetStringValue() const ;
70 virtual void SetStringValue( const wxString
&str
) ;
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
) ;
79 virtual void SetFont( const wxFont
& font
, const wxColour
& foreground
, long windowStyle
, bool ignoreBlack
= true );
81 virtual bool GetStyle(long position
, wxTextAttr
& style
);
82 virtual void SetStyle(long start
, long end
, const wxTextAttr
& style
);
84 virtual bool CanFocus() const;
86 virtual bool HasOwnContextMenu() const { return true; }
88 virtual void CheckSpelling(bool check
);
89 virtual wxSize
GetBestSize() const;
92 NSScrollView
* m_scrollView
;
93 NSTextView
* m_textView
;
96 class wxNSComboBoxControl
: public wxNSTextFieldControl
, public wxComboWidgetImpl
99 wxNSComboBoxControl( wxComboBox
*wxPeer
, WXWidget w
);
100 virtual ~wxNSComboBoxControl();
102 virtual int GetSelectedItem() const;
103 virtual void SetSelectedItem(int item
);
105 virtual int GetNumberOfItems() const;
107 virtual void InsertItem(int pos
, const wxString
& item
);
108 virtual void RemoveItem(int pos
);
110 virtual void Clear();
112 virtual wxString
GetStringAtIndex(int pos
) const;
114 virtual int FindString(const wxString
& text
) const;
115 virtual void Popup();
116 virtual void Dismiss();
119 NSComboBox
* m_comboBox
;
122 #endif // _WX_OSX_COCOA_PRIVATE_TEXTIMPL_H_