#endif
#include "wx/control.h"
+#include "wx/panel.h"
+#include "wx/app.h"
+#include "wx/dc.h"
#include "wx/notebook.h"
#include "wx/tabctrl.h"
#include "wx/radiobox.h"
#include "wx/spinbutt.h"
+#include "wx/scrolbar.h"
+#include "wx/button.h"
+#include "wx/dialog.h"
+#include "wx/statbox.h"
+#include "wx/sizer.h"
+#include "wx/stattext.h"
#if !USE_SHARED_LIBRARY
IMPLEMENT_ABSTRACT_CLASS(wxControl, wxWindow)
if ( wxMacLiveScrollbarActionUPP == NULL )
{
+#if defined(UNIVERSAL_INTERFACES_VERSION) && (UNIVERSAL_INTERFACES_VERSION >= 0x0340)
+ wxMacLiveScrollbarActionUPP = NewControlActionUPP( wxMacLiveScrollbarActionProc );
+#else
wxMacLiveScrollbarActionUPP = NewControlActionProc( wxMacLiveScrollbarActionProc ) ;
+#endif
}
}
else
label = title ;
- strcpy( (char*) maclabel , label ) ;
- c2pstr( (char*) maclabel ) ;
-
+#if TARGET_CARBON
+ c2pstrcpy( (StringPtr) maclabel , label ) ;
+#else
+ strcpy( (char *) maclabel , label ) ;
+ c2pstr( (char *) maclabel ) ;
+#endif
::SetControlTitle( m_macControl , maclabel ) ;
}
+ Refresh() ;
}
wxSize wxControl::DoGetBestSize() const
m_y = y ;
- Point localOrigin ;
- Rect clipRect ;
-
parent->MacClientToRootWindow( &x , &y ) ;
outBounds->top = y + m_macVerticalBorder ;
outBounds->left = x + m_macHorizontalBorder ;
outBounds->bottom = outBounds->top + m_height - 2 * m_macVerticalBorder;
outBounds->right = outBounds->left + m_width - 2 * m_macHorizontalBorder ;
- strcpy( (char*) maclabel , label ) ;
+ char c_text[255];
+ strcpy( c_text , label ) ;
if( wxApp::s_macDefaultEncodingIsPC )
{
- wxMacConvertFromPCForControls( (char*) maclabel ) ;
+ wxMacConvertFromPCForControls( c_text ) ;
}
- c2pstr( (char*) maclabel ) ;
+#if TARGET_CARBON
+ c2pstrcpy( (StringPtr) maclabel , c_text ) ;
+#else
+ strcpy( (char *) maclabel , c_text ) ;
+ c2pstr( (char *) maclabel ) ;
+#endif
}
void wxControl::MacPostControlCreate()
ControlHandle container = GetParent()->MacGetContainerForEmbedding() ;
wxASSERT_MSG( container != NULL , "No valid mac container control" ) ;
::UMAEmbedControl( m_macControl , container ) ;
+ m_macControlIsShown = true ;
MacAdjustControlRect() ;
wxAssociateControlWithMacControl( m_macControl , this ) ;
+ UMAShowControl( m_macControl ) ;
}
void wxControl::MacAdjustControlRect()
if ( IsKindOf( CLASSINFO( wxButton ) ) )
{
m_width = m_label.Length() * 8 + 12 ;
+ if ( m_width < 70 )
+ m_width = 70 ;
}
else if ( IsKindOf( CLASSINFO( wxStaticText ) ) )
{
if ( mac_x != former_mac_x || mac_y != former_mac_y )
{
- {
- Rect inval = { former_mac_y , former_mac_x , former_mac_y + m_height , former_mac_x + m_width } ;
- InvalWindowRect( rootwindow , &inval ) ;
- }
+ {
+ Rect inval = { former_mac_y , former_mac_x , former_mac_y + m_height , former_mac_x + m_width } ;
+ InvalWindowRect( rootwindow , &inval ) ;
+ }
UMAMoveControl( m_macControl , mac_x + m_macHorizontalBorder , mac_y + m_macVerticalBorder ) ;
- {
- Rect inval = { mac_y , mac_x , mac_y + m_height , mac_x + m_width } ;
- InvalWindowRect( rootwindow , &inval ) ;
- }
+ {
+ Rect inval = { mac_y , mac_x , mac_y + m_height , mac_x + m_width } ;
+ InvalWindowRect( rootwindow , &inval ) ;
+ }
}
if ( wxrootwindow->IsKindOf( CLASSINFO( wxDialog ) ) )
{
{
if ( !show )
{
- ::UMAHideControl( m_macControl ) ;
+ if ( m_macControlIsShown )
+ {
+ ::UMAHideControl( m_macControl ) ;
+ m_macControlIsShown = false ;
+ }
}
else
{
- if ( m_isShown )
+ if ( MacIsReallyShown() && !m_macControlIsShown )
+ {
::UMAShowControl( m_macControl ) ;
+ m_macControlIsShown = true ;
+ }
}
}
if ( mac_x != former_mac_x || mac_y != former_mac_y )
{
- {
- Rect inval = { former_mac_y , former_mac_x , former_mac_y + m_height , former_mac_x + m_width } ;
- InvalWindowRect( macrootwindow, &inval ) ;
- }
+ {
+ Rect inval = { former_mac_y , former_mac_x , former_mac_y + m_height , former_mac_x + m_width } ;
+ InvalWindowRect( macrootwindow, &inval ) ;
+ }
UMAMoveControl( m_macControl , mac_x + m_macHorizontalBorder , mac_y + m_macVerticalBorder ) ;
- {
- Rect inval = { mac_y , mac_x , mac_y + m_height , mac_x + m_width } ;
- InvalWindowRect(macrootwindow, &inval ) ;
- }
+ {
+ Rect inval = { mac_y , mac_x , mac_y + m_height , mac_x + m_width } ;
+ InvalWindowRect(macrootwindow, &inval ) ;
+ }
}
if ( actualX != former_x || actualY != former_y )
MacRepositionScrollBars() ;
// To consider -> should the parameters be the effective or the virtual coordinates (AdjustForParent..)
- wxMoveEvent event(wxPoint(m_x, m_y), m_windowId);
- event.SetEventObject(this);
- GetEventHandler()->ProcessEvent(event);
+ wxMoveEvent event(wxPoint(m_x, m_y), m_windowId);
+ event.SetEventObject(this);
+ GetEventHandler()->ProcessEvent(event);
}
if ( actualWidth != former_w || actualHeight != former_h )
{
}
MacRepositionScrollBars() ;
- wxSizeEvent event(wxSize(m_width, m_height), m_windowId);
- event.SetEventObject(this);
- GetEventHandler()->ProcessEvent(event);
+ wxSizeEvent event(wxSize(m_width, m_height), m_windowId);
+ event.SetEventObject(this);
+ GetEventHandler()->ProcessEvent(event);
}
if ( wxrootwindow->IsKindOf( CLASSINFO( wxDialog ) ) )
{
if ( m_macControl )
{
- if ( show )
- ::UMAShowControl( m_macControl ) ;
+ if ( !show )
+ {
+ if ( m_macControlIsShown )
+ {
+ ::UMAHideControl( m_macControl ) ;
+ m_macControlIsShown = false ;
+ }
+ }
else
- ::UMAHideControl( m_macControl ) ;
+ {
+ if ( MacIsReallyShown() && !m_macControlIsShown )
+ {
+ ::UMAShowControl( m_macControl ) ;
+ m_macControlIsShown = true ;
+ }
+ }
}
return TRUE ;
}
if ( m_macControl )
{
-
- if ( UMAHasAppearance() )
- {
- if ( enable )
- ::ActivateControl( m_macControl ) ;
- else
- ::DeactivateControl( m_macControl ) ;
- }
+ if ( enable )
+ UMAActivateControl( m_macControl ) ;
else
- {
- if ( enable )
- ::HiliteControl( m_macControl , 0 ) ;
- else
- ::HiliteControl( m_macControl , 255 ) ;
- }
+ UMADeactivateControl( m_macControl ) ;
}
return TRUE ;
}
wxMacDrawingHelper help( win ) ;
// the mac control manager always assumes to have the origin at 0,0
SetOrigin( 0 , 0 ) ;
+
- bool hasTabBehind = false ;
+ bool hasTabBehind = false ;
wxWindow* parent = GetParent() ;
while ( parent )
{
parent = parent->GetParent() ;
}
-
+
UMADrawControl( m_macControl ) ;
UMASetThemeWindowBackground( win->MacGetWindowData()->m_macWindow , win->MacGetWindowData()->m_macWindowBackgroundTheme , false ) ;
}
controlpart = FindControl( localwhere , window , &control ) ;
{
+ /*
if ( AcceptsFocus() && FindFocus() != this )
{
SetFocus() ;
}
+ */
if ( control && UMAIsControlActive( control ) )
{
{