git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@28333
c3d73ce0-8a6f-49c7-b76d-
6d57e0e08775
virtual void Flash( ControlPartCode part , UInt32 ticks = 8 ) ;
virtual void VisibilityChanged( bool shown ) ;
virtual void SetFont( const wxFont & font , const wxColour& foreground , long windowStyle ) ;
virtual void Flash( ControlPartCode part , UInt32 ticks = 8 ) ;
virtual void VisibilityChanged( bool shown ) ;
virtual void SetFont( const wxFont & font , const wxColour& foreground , long windowStyle ) ;
+ virtual void SetBackground( const wxBrush &brush ) ;
virtual ControlPartCode HandleKey( SInt16 keyCode, SInt16 charCode, EventModifiers modifiers ) ;
void SetActionProc( ControlActionUPP actionProc ) ;
void SetViewSize( SInt32 viewSize ) ;
virtual ControlPartCode HandleKey( SInt16 keyCode, SInt16 charCode, EventModifiers modifiers ) ;
void SetActionProc( ControlActionUPP actionProc ) ;
void SetViewSize( SInt32 viewSize ) ;
void OnUpdatePaste(wxUpdateUIEvent& event);
void OnUpdateUndo(wxUpdateUIEvent& event);
void OnUpdateRedo(wxUpdateUIEvent& event);
void OnUpdatePaste(wxUpdateUIEvent& event);
void OnUpdateUndo(wxUpdateUIEvent& event);
void OnUpdateRedo(wxUpdateUIEvent& event);
+
+ void OnEraseBackground(wxEraseEvent& event) ;
virtual bool MacCanFocus() const { return true ; }
virtual bool MacSetupCursor( const wxPoint& pt ) ;
virtual bool MacCanFocus() const { return true ; }
virtual bool MacSetupCursor( const wxPoint& pt ) ;
virtual void Update() ;
virtual bool MacSetupCursor( const wxPoint& pt ) ;
virtual void Update() ;
virtual bool MacSetupCursor( const wxPoint& pt ) ;
- virtual void MacSetBackgroundBrush( const wxBrush &brush ) { m_macBackgroundBrush = brush ; }
+ virtual void MacSetBackgroundBrush( const wxBrush &brush ) ;
const wxBrush& MacGetBackgroundBrush() const { return m_macBackgroundBrush ; }
// returns the visible region of this control in window ie non-client coordinates
const wxBrush& MacGetBackgroundBrush() const { return m_macBackgroundBrush ; }
// returns the visible region of this control in window ie non-client coordinates
void AdjustCreationAttributes( const wxColour& background , bool visible ) ;
virtual void SetFont( const wxFont & font , const wxColour& foreground , long windowStyle ) ;
void AdjustCreationAttributes( const wxColour& background , bool visible ) ;
virtual void SetFont( const wxFont & font , const wxColour& foreground , long windowStyle ) ;
+ virtual void SetBackground( const wxBrush &brush) ;
virtual void SetStyle(long start, long end, const wxTextAttr& style) ;
virtual void Copy() ;
virtual void Cut() ;
virtual void SetStyle(long start, long end, const wxTextAttr& style) ;
virtual void Copy() ;
virtual void Cut() ;
IMPLEMENT_DYNAMIC_CLASS(wxTextCtrl, wxControl)
BEGIN_EVENT_TABLE(wxTextCtrl, wxControl)
IMPLEMENT_DYNAMIC_CLASS(wxTextCtrl, wxControl)
BEGIN_EVENT_TABLE(wxTextCtrl, wxControl)
+ EVT_ERASE_BACKGROUND( wxTextCtrl::OnEraseBackground )
EVT_DROP_FILES(wxTextCtrl::OnDropFiles)
EVT_CHAR(wxTextCtrl::OnChar)
EVT_MENU(wxID_CUT, wxTextCtrl::OnCut)
EVT_DROP_FILES(wxTextCtrl::OnDropFiles)
EVT_CHAR(wxTextCtrl::OnChar)
EVT_MENU(wxID_CUT, wxTextCtrl::OnCut)
+void wxTextCtrl::OnEraseBackground(wxEraseEvent& event)
+{
+ // all erasing should be done by the real mac control implementation
+ // while this is true for MLTE under classic, the HITextView is somehow
+ // transparent but background erase is not working correctly, so intercept
+ // things while we can...
+}
+
void wxTextCtrl::OnChar(wxKeyEvent& event)
{
int key = event.GetKeyCode() ;
void wxTextCtrl::OnChar(wxKeyEvent& event)
{
int key = event.GetKeyCode() ;
val.Remove( start , end - start ) ;
val.insert( start , str ) ;
SetStringValue( val ) ;
val.Remove( start , end - start ) ;
val.insert( start , str ) ;
SetStringValue( val ) ;
- SetInsertionPoint( start + str.Length() ) ;
+ SetSelection( start + str.Length() , start + str.Length() ) ;
TXNSetBackground( m_txn , &tback);
}
TXNSetBackground( m_txn , &tback);
}
+void wxMacMLTEControl::SetBackground( const wxBrush &brush )
+{
+ // currently only solid background are supported
+ TXNBackground tback;
+ tback.bgType = kTXNBackgroundTypeRGB;
+ tback.bg.color = MAC_WXCOLORREF( brush.GetColour().GetPixel() );
+ TXNSetBackground( m_txn , &tback);
+}
+
int wxMacMLTEControl::ConvertAttribute( const wxTextAttr& style , TXNTypeAttributes typeAttr[] )
{
Str255 fontName = "\pMonaco" ;
int wxMacMLTEControl::ConvertAttribute( const wxTextAttr& style , TXNTypeAttributes typeAttr[] )
{
Str255 fontName = "\pMonaco" ;
typeAttr[attrCounter+2].size = kTXNQDFontStyleAttributeSize ;
typeAttr[attrCounter+2].data.dataValue = fontStyle ;
attrCounter += 3 ;
typeAttr[attrCounter+2].size = kTXNQDFontStyleAttributeSize ;
typeAttr[attrCounter+2].data.dataValue = fontStyle ;
attrCounter += 3 ;
}
if ( style.HasTextColour() )
{
}
if ( style.HasTextColour() )
{
void wxMacMLTEControl::SetFont( const wxFont & font , const wxColour& foreground , long windowStyle )
{
EditHelper help(m_txn) ;
void wxMacMLTEControl::SetFont( const wxFont & font , const wxColour& foreground , long windowStyle )
{
EditHelper help(m_txn) ;
- wxTextAttr style(wxNullColour,wxNullColour,font) ;
+ wxTextAttr style(foreground,wxNullColour,font) ;
TXNTypeAttributes typeAttr[4] ;
int attrCounter = ConvertAttribute( style , typeAttr ) ;
if ( attrCounter > 0 )
TXNTypeAttributes typeAttr[4] ;
int attrCounter = ConvertAttribute( style , typeAttr ) ;
if ( attrCounter > 0 )
::SetControlFontStyle( m_controlRef , &fontStyle );
}
::SetControlFontStyle( m_controlRef , &fontStyle );
}
+void wxMacControl::SetBackground( const wxBrush &WXUNUSED(brush) )
+{
+ // TODO
+ // setting up a color proc is not recommended anymore
+}
+
void wxMacControl::SetRange( SInt32 minimum , SInt32 maximum )
{
::SetControl32BitMinimum( m_controlRef , minimum ) ;
void wxMacControl::SetRange( SInt32 minimum , SInt32 maximum )
{
::SetControl32BitMinimum( m_controlRef , minimum ) ;
}
MacSetBackgroundBrush( brush ) ;
}
MacSetBackgroundBrush( brush ) ;
- MacUpdateControlFont() ;
-
+void wxWindowMac::MacSetBackgroundBrush( const wxBrush &brush )
+{
+ m_macBackgroundBrush = brush ;
+ m_peer->SetBackground( brush ) ;
+}
bool wxWindowMac::MacCanFocus() const
{
bool wxWindowMac::MacCanFocus() const
{