X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/1e181c7a2c32193fc8138cc32ed07984eadd4a21..3baf235f60c2e924fee2cd2de03e544343c15529:/include/wx/osx/cocoa/private/textimpl.h?ds=sidebyside diff --git a/include/wx/osx/cocoa/private/textimpl.h b/include/wx/osx/cocoa/private/textimpl.h index d052ea8df7..f50d555ca2 100644 --- a/include/wx/osx/cocoa/private/textimpl.h +++ b/include/wx/osx/cocoa/private/textimpl.h @@ -1,10 +1,10 @@ ///////////////////////////////////////////////////////////////////////////// -// Name: textimpl.h +// Name: wx/osx/cocoa/private/textimpl.h // Purpose: textcontrol implementation classes that have to be exposed // Author: Stefan Csomor // Modified by: // Created: 03/02/99 -// RCS-ID: $Id: +// RCS-ID: $Id$ // Copyright: (c) Stefan Csomor // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -12,16 +12,22 @@ #ifndef _WX_OSX_COCOA_PRIVATE_TEXTIMPL_H_ #define _WX_OSX_COCOA_PRIVATE_TEXTIMPL_H_ +#include "wx/combobox.h" #include "wx/osx/private.h" -// implementation exposed, so that search control can pull it +// implementation exposed, so that search control can pull it class wxNSTextFieldControl : public wxWidgetCocoaImpl, public wxTextWidgetImpl { public : - wxNSTextFieldControl( wxTextCtrl *wxPeer, WXWidget w ); + // wxNSTextFieldControl must always be associated with a wxTextEntry. If + // it's associated with a wxTextCtrl then we can get the associated entry + // from it but otherwise the second ctor should be used to explicitly pass + // us the entry. + wxNSTextFieldControl( wxTextCtrl *text, WXWidget w ); + wxNSTextFieldControl( wxWindow *wxPeer, wxTextEntry *entry, WXWidget w ); virtual ~wxNSTextFieldControl(); - + virtual wxString GetStringValue() const ; virtual void SetStringValue( const wxString &str) ; virtual void Copy() ; @@ -32,6 +38,75 @@ public : virtual void GetSelection( long* from, long* to) const ; virtual void SetSelection( long from , long to ); virtual void WriteText(const wxString& str) ; + virtual bool HasOwnContextMenu() const { return true; } + virtual bool SetHint(const wxString& hint); + + virtual void controlAction(WXWidget slf, void* _cmd, void *sender); + +protected : + NSTextField* m_textField; + long m_selStart; + long m_selEnd; + +private: + // Common part of both ctors. + void Init(WXWidget w); +}; + +class wxNSTextViewControl : public wxWidgetCocoaImpl, public wxTextWidgetImpl +{ +public: + wxNSTextViewControl( wxTextCtrl *wxPeer, WXWidget w ); + virtual ~wxNSTextViewControl(); + + virtual wxString GetStringValue() const ; + virtual void SetStringValue( const wxString &str) ; + virtual void Copy() ; + virtual void Cut() ; + virtual void Paste() ; + virtual bool CanPaste() const ; + virtual void SetEditable(bool editable) ; + virtual void GetSelection( long* from, long* to) const ; + virtual void SetSelection( long from , long to ); + virtual void WriteText(const wxString& str) ; + virtual void SetFont( const wxFont & font , const wxColour& foreground , long windowStyle, bool ignoreBlack = true ); + + virtual bool GetStyle(long position, wxTextAttr& style); + virtual void SetStyle(long start, long end, const wxTextAttr& style); + + virtual bool CanFocus() const; + + virtual bool HasOwnContextMenu() const { return true; } + + virtual void CheckSpelling(bool check); + virtual wxSize GetBestSize() const; + +protected: + NSScrollView* m_scrollView; + NSTextView* m_textView; +}; + +class wxNSComboBoxControl : public wxNSTextFieldControl, public wxComboWidgetImpl +{ +public : + wxNSComboBoxControl( wxComboBox *wxPeer, WXWidget w ); + virtual ~wxNSComboBoxControl(); + + virtual int GetSelectedItem() const; + virtual void SetSelectedItem(int item); + + virtual int GetNumberOfItems() const; + + virtual void InsertItem(int pos, const wxString& item); + virtual void RemoveItem(int pos); + + virtual void Clear(); + + virtual wxString GetStringAtIndex(int pos) const; + + virtual int FindString(const wxString& text) const; +private: + NSComboBox* m_comboBox; }; #endif // _WX_OSX_COCOA_PRIVATE_TEXTIMPL_H_