2008-09-05 10:41:11 -04:00
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
2011-03-19 20:14:35 -04:00
|
|
|
// Name: wx/osx/cocoa/private/textimpl.h
|
2008-09-05 10:41:11 -04:00
|
|
|
// Purpose: textcontrol implementation classes that have to be exposed
|
|
|
|
// Author: Stefan Csomor
|
|
|
|
// Modified by:
|
|
|
|
// Created: 03/02/99
|
2009-01-11 06:58:34 -05:00
|
|
|
// RCS-ID: $Id$
|
2008-09-05 10:41:11 -04:00
|
|
|
// Copyright: (c) Stefan Csomor
|
|
|
|
// Licence: wxWindows licence
|
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
#ifndef _WX_OSX_COCOA_PRIVATE_TEXTIMPL_H_
|
|
|
|
#define _WX_OSX_COCOA_PRIVATE_TEXTIMPL_H_
|
|
|
|
|
2010-01-09 14:50:55 -05:00
|
|
|
#include "wx/combobox.h"
|
2008-09-05 10:41:11 -04:00
|
|
|
#include "wx/osx/private.h"
|
|
|
|
|
2009-01-11 06:58:34 -05:00
|
|
|
// implementation exposed, so that search control can pull it
|
2008-09-05 10:41:11 -04:00
|
|
|
|
|
|
|
class wxNSTextFieldControl : public wxWidgetCocoaImpl, public wxTextWidgetImpl
|
|
|
|
{
|
|
|
|
public :
|
2010-07-28 07:27:01 -04:00
|
|
|
// 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 );
|
2008-09-05 10:41:11 -04:00
|
|
|
virtual ~wxNSTextFieldControl();
|
2009-01-11 06:58:34 -05:00
|
|
|
|
2008-09-05 10:41:11 -04:00
|
|
|
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) ;
|
2010-02-21 20:56:42 -05:00
|
|
|
virtual bool HasOwnContextMenu() const { return true; }
|
2011-01-26 10:51:39 -05:00
|
|
|
virtual bool SetHint(const wxString& hint);
|
2009-08-21 06:41:26 -04:00
|
|
|
|
2009-02-12 02:17:46 -05:00
|
|
|
virtual void controlAction(WXWidget slf, void* _cmd, void *sender);
|
2010-07-28 07:27:01 -04:00
|
|
|
|
2009-02-12 02:17:46 -05:00
|
|
|
protected :
|
|
|
|
NSTextField* m_textField;
|
2009-04-15 15:44:51 -04:00
|
|
|
long m_selStart;
|
|
|
|
long m_selEnd;
|
2010-07-28 07:27:01 -04:00
|
|
|
|
|
|
|
private:
|
|
|
|
// Common part of both ctors.
|
|
|
|
void Init(WXWidget w);
|
2008-09-05 10:41:11 -04:00
|
|
|
};
|
|
|
|
|
2009-02-14 03:06:34 -05:00
|
|
|
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) ;
|
2009-05-27 05:52:23 -04:00
|
|
|
virtual void SetFont( const wxFont & font , const wxColour& foreground , long windowStyle, bool ignoreBlack = true );
|
2010-09-30 07:44:45 -04:00
|
|
|
|
2009-10-31 20:58:04 -04:00
|
|
|
virtual bool GetStyle(long position, wxTextAttr& style);
|
|
|
|
virtual void SetStyle(long start, long end, const wxTextAttr& style);
|
2010-09-30 07:44:45 -04:00
|
|
|
|
2010-02-26 21:51:45 -05:00
|
|
|
virtual bool CanFocus() const;
|
2010-09-30 07:44:45 -04:00
|
|
|
|
2010-02-21 20:56:42 -05:00
|
|
|
virtual bool HasOwnContextMenu() const { return true; }
|
2010-09-30 07:44:45 -04:00
|
|
|
|
2009-11-26 16:52:42 -05:00
|
|
|
virtual void CheckSpelling(bool check);
|
2009-11-26 18:11:27 -05:00
|
|
|
virtual wxSize GetBestSize() const;
|
2009-02-14 03:06:34 -05:00
|
|
|
|
|
|
|
protected:
|
|
|
|
NSScrollView* m_scrollView;
|
|
|
|
NSTextView* m_textView;
|
|
|
|
};
|
|
|
|
|
2010-01-09 14:50:55 -05:00
|
|
|
class wxNSComboBoxControl : public wxNSTextFieldControl, public wxComboWidgetImpl
|
|
|
|
{
|
|
|
|
public :
|
2010-07-28 07:27:01 -04:00
|
|
|
wxNSComboBoxControl( wxComboBox *wxPeer, WXWidget w );
|
2010-01-09 14:50:55 -05:00
|
|
|
virtual ~wxNSComboBoxControl();
|
2010-09-30 07:44:45 -04:00
|
|
|
|
2010-01-09 14:50:55 -05:00
|
|
|
virtual int GetSelectedItem() const;
|
|
|
|
virtual void SetSelectedItem(int item);
|
2010-09-30 07:44:45 -04:00
|
|
|
|
2010-01-09 14:50:55 -05:00
|
|
|
virtual int GetNumberOfItems() const;
|
2010-09-30 07:44:45 -04:00
|
|
|
|
2010-01-09 14:50:55 -05:00
|
|
|
virtual void InsertItem(int pos, const wxString& item);
|
|
|
|
virtual void RemoveItem(int pos);
|
2010-09-30 07:44:45 -04:00
|
|
|
|
2010-01-09 14:50:55 -05:00
|
|
|
virtual void Clear();
|
2010-09-30 07:44:45 -04:00
|
|
|
|
2010-01-09 14:50:55 -05:00
|
|
|
virtual wxString GetStringAtIndex(int pos) const;
|
2010-09-30 07:44:45 -04:00
|
|
|
|
2010-01-09 14:50:55 -05:00
|
|
|
virtual int FindString(const wxString& text) const;
|
|
|
|
private:
|
|
|
|
NSComboBox* m_comboBox;
|
|
|
|
};
|
|
|
|
|
2008-09-05 10:41:11 -04:00
|
|
|
#endif // _WX_OSX_COCOA_PRIVATE_TEXTIMPL_H_
|