// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
IMPLEMENT_ABSTRACT_CLASS(wxControl, wxWindow)
BEGIN_EVENT_TABLE(wxControl, wxWindow)
IMPLEMENT_ABSTRACT_CLASS(wxControl, wxWindow)
BEGIN_EVENT_TABLE(wxControl, wxWindow)
pascal SInt32 wxMacControlDefinition(SInt16 varCode, ControlRef theControl, ControlDefProcMessage message, SInt32 param)
{
pascal SInt32 wxMacControlDefinition(SInt16 varCode, ControlRef theControl, ControlDefProcMessage message, SInt32 param)
{
wxControl* wx = (wxControl*) wxFindControlFromMacControl( theControl ) ;
if ( wx != NULL && wx->IsKindOf( CLASSINFO( wxControl ) ) )
{
wxControl* wx = (wxControl*) wxFindControlFromMacControl( theControl ) ;
if ( wx != NULL && wx->IsKindOf( CLASSINFO( wxControl ) ) )
{
bool rval = wxWindow::Create(parent, id, pos, size, style, name);
if ( parent )
{
bool rval = wxWindow::Create(parent, id, pos, size, style, name);
if ( parent )
{
wxRemoveMacControlAssociation( this ) ;
// If we delete an item, we should initialize the parent panel,
// because it could now be invalid.
wxRemoveMacControlAssociation( this ) ;
// If we delete an item, we should initialize the parent panel,
// because it could now be invalid.
Rect bestsize = { 0 , 0 , 0 , 0 } ;
short baselineoffset ;
int bestWidth, bestHeight ;
Rect bestsize = { 0 , 0 , 0 , 0 } ;
short baselineoffset ;
int bestWidth, bestHeight ;
-void wxControl::MacPreControlCreate( wxWindow *parent, wxWindowID id, wxString label ,
+void wxControl::MacPreControlCreate( wxWindow *parent, wxWindowID id, wxString label ,
const wxPoint& pos,
const wxSize& size, long style,
const wxValidator& validator,
const wxPoint& pos,
const wxSize& size, long style,
const wxValidator& validator,
((Rect*)outBounds)->top = -10;
((Rect*)outBounds)->left = -10;
((Rect*)outBounds)->bottom = 0;
((Rect*)outBounds)->top = -10;
((Rect*)outBounds)->left = -10;
((Rect*)outBounds)->bottom = 0;
{
wxASSERT_MSG( (ControlHandle) m_macControl != NULL , wxT("No valid mac control") ) ;
DoSetWindowVariant( m_windowVariant ) ;
{
wxASSERT_MSG( (ControlHandle) m_macControl != NULL , wxT("No valid mac control") ) ;
DoSetWindowVariant( m_windowVariant ) ;
ControlFontStyleRec controlstyle ;
controlstyle.flags = kControlUseFontMask ;
controlstyle.font = kControlFontSmallBoldSystemFont ;
ControlFontStyleRec controlstyle ;
controlstyle.flags = kControlUseFontMask ;
controlstyle.font = kControlFontSmallBoldSystemFont ;
::SetControlFontStyle( (ControlHandle) m_macControl , &controlstyle ) ;
}
else
{
ControlFontStyleRec controlstyle ;
controlstyle.flags = kControlUseFontMask ;
::SetControlFontStyle( (ControlHandle) m_macControl , &controlstyle ) ;
}
else
{
ControlFontStyleRec controlstyle ;
controlstyle.flags = kControlUseFontMask ;
if (IsKindOf( CLASSINFO( wxButton ) ) )
controlstyle.font = kControlFontBigSystemFont ; // eventually kControlFontBigSystemFont ;
else
controlstyle.font = kControlFontSmallSystemFont ;
if (IsKindOf( CLASSINFO( wxButton ) ) )
controlstyle.font = kControlFontBigSystemFont ; // eventually kControlFontBigSystemFont ;
else
controlstyle.font = kControlFontSmallSystemFont ;
// Adjust the controls size and position
wxPoint pos(m_x, m_y);
wxSize best_size( DoGetBestSize() );
wxSize new_size( m_width, m_height );
// Adjust the controls size and position
wxPoint pos(m_x, m_y);
wxSize best_size( DoGetBestSize() );
wxSize new_size( m_width, m_height );
SetSize(pos.x, pos.y, new_size.x, new_size.y);
SetSize(pos.x, pos.y, new_size.x, new_size.y);
#if wxUSE_UNICODE
UMASetControlTitle( (ControlHandle) m_macControl , wxStripMenuCodes(m_label) , m_font.GetEncoding() ) ;
#endif
if ( m_macControlIsShown )
UMAShowControl( (ControlHandle) m_macControl ) ;
#if wxUSE_UNICODE
UMASetControlTitle( (ControlHandle) m_macControl , wxStripMenuCodes(m_label) , m_font.GetEncoding() ) ;
#endif
if ( m_macControlIsShown )
UMAShowControl( (ControlHandle) m_macControl ) ;
{
wxASSERT_MSG( (ControlHandle) m_macControl != NULL , wxT("No valid mac control") ) ;
if ( m_width == -1 || m_height == -1 )
{
Rect bestsize = { 0 , 0 , 0 , 0 } ;
short baselineoffset ;
{
wxASSERT_MSG( (ControlHandle) m_macControl != NULL , wxT("No valid mac control") ) ;
if ( m_width == -1 || m_height == -1 )
{
Rect bestsize = { 0 , 0 , 0 , 0 } ;
short baselineoffset ;
::GetBestControlRect( (ControlHandle) m_macControl , &bestsize , &baselineoffset ) ;
if ( EmptyRect( &bestsize ) )
::GetBestControlRect( (ControlHandle) m_macControl , &bestsize , &baselineoffset ) ;
if ( EmptyRect( &bestsize ) )
int new_x = m_x + MacGetLeftBorderSize() + m_macHorizontalBorder ;
int new_y = m_y + MacGetTopBorderSize() + m_macVerticalBorder ;
int new_width = m_width - MacGetLeftBorderSize() - MacGetRightBorderSize() - 2 * m_macHorizontalBorder ;
int new_height = m_height - MacGetTopBorderSize() - MacGetBottomBorderSize() - 2 * m_macVerticalBorder ;
int new_x = m_x + MacGetLeftBorderSize() + m_macHorizontalBorder ;
int new_y = m_y + MacGetTopBorderSize() + m_macVerticalBorder ;
int new_width = m_width - MacGetLeftBorderSize() - MacGetRightBorderSize() - 2 * m_macHorizontalBorder ;
int new_height = m_height - MacGetTopBorderSize() - MacGetBottomBorderSize() - 2 * m_macVerticalBorder ;
GetParent()->MacWindowToRootWindow( & new_x , & new_y ) ;
bool doMove = new_x != oldBounds.left || new_y != oldBounds.top ;
bool doResize = ( oldBounds.right - oldBounds.left ) != new_width || (oldBounds.bottom - oldBounds.top ) != new_height ;
GetParent()->MacWindowToRootWindow( & new_x , & new_y ) ;
bool doMove = new_x != oldBounds.left || new_y != oldBounds.top ;
bool doResize = ( oldBounds.right - oldBounds.left ) != new_width || (oldBounds.bottom - oldBounds.top ) != new_height ;
UInt32 modifiers ;
GetEventParameter( (EventRef) wxTheApp->MacGetCurrentEvent(), kEventParamKeyMacCharCodes, typeChar, NULL,sizeof(char), NULL,&charCode );
UInt32 modifiers ;
GetEventParameter( (EventRef) wxTheApp->MacGetCurrentEvent(), kEventParamKeyMacCharCodes, typeChar, NULL,sizeof(char), NULL,&charCode );
GetEventParameter((EventRef) wxTheApp->MacGetCurrentEvent(), kEventParamKeyModifiers, typeUInt32, NULL, sizeof(UInt32), NULL, &modifiers);
::HandleControlKey( (ControlHandle) m_macControl , keyCode , charCode , modifiers ) ;
GetEventParameter((EventRef) wxTheApp->MacGetCurrentEvent(), kEventParamKeyModifiers, typeUInt32, NULL, sizeof(UInt32), NULL, &modifiers);
::HandleControlKey( (ControlHandle) m_macControl , keyCode , charCode , modifiers ) ;
{
controlpart = ::HandleControlClick( control , localwhere , modifiers , (ControlActionUPP) -1 ) ;
wxTheApp->s_lastMouseDown = 0 ;
{
controlpart = ::HandleControlClick( control , localwhere , modifiers , (ControlActionUPP) -1 ) ;
wxTheApp->s_lastMouseDown = 0 ;
-void wxControl::MacHandleControlClick( WXWidget control , wxInt16 controlpart , bool WXUNUSED( mouseStillDown ) )
+void wxControl::MacHandleControlClick( WXWidget control , wxInt16 controlpart , bool WXUNUSED( mouseStillDown ) )
{
if ( IsKindOf( CLASSINFO( wxScrollBar ) ) )
variant = wxWINDOW_VARIANT_NORMAL ;
else
variant = wxWINDOW_VARIANT_SMALL ;
}
{
if ( IsKindOf( CLASSINFO( wxScrollBar ) ) )
variant = wxWINDOW_VARIANT_NORMAL ;
else
variant = wxWINDOW_VARIANT_SMALL ;
}
- size = 3 ; // not always defined in the header
- fontStyle.font = -5 ; // not always defined in the header
+ size = 3 ; // not always defined in the header
+ fontStyle.font = -5 ; // not always defined in the header
- ::SetControlData( (ControlHandle) m_macControl , kControlEntireControl, kControlSizeTag, sizeof( ControlSize ), &size );
- ::SetControlFontStyle( (ControlHandle) m_macControl , &fontStyle );
+ ::SetControlData( (ControlHandle) m_macControl , kControlEntireControl, kControlSizeTag, sizeof( ControlSize ), &size );
+ ::SetControlFontStyle( (ControlHandle) m_macControl , &fontStyle );