cleanup - reformat

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@36755 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
David Surovell
2006-01-07 17:29:16 +00:00
parent 93a2b888fc
commit 172da31f53
5 changed files with 618 additions and 561 deletions

View File

@@ -21,6 +21,7 @@ IMPLEMENT_DYNAMIC_CLASS(wxBrush, wxGDIObject)
class WXDLLEXPORT wxBrushRefData: public wxGDIRefData class WXDLLEXPORT wxBrushRefData: public wxGDIRefData
{ {
friend class WXDLLEXPORT wxBrush; friend class WXDLLEXPORT wxBrush;
public: public:
wxBrushRefData(); wxBrushRefData();
wxBrushRefData(const wxBrushRefData& data); wxBrushRefData(const wxBrushRefData& data);
@@ -40,6 +41,7 @@ protected:
#define M_BRUSHDATA ((wxBrushRefData *)m_refData) #define M_BRUSHDATA ((wxBrushRefData *)m_refData)
wxBrushRefData::wxBrushRefData() wxBrushRefData::wxBrushRefData()
: m_style(wxSOLID) : m_style(wxSOLID)
{ {
@@ -62,7 +64,6 @@ wxBrushRefData::~wxBrushRefData()
{ {
} }
// Brushes
wxBrush::wxBrush() wxBrush::wxBrush()
{ {
} }
@@ -105,6 +106,7 @@ wxBrush::wxBrush(ThemeBrush macThemeBrush )
RealizeResource(); RealizeResource();
} }
void wxBrush::Unshare() void wxBrush::Unshare()
{ {
// Don't change shared data // Don't change shared data
@@ -165,6 +167,7 @@ void wxBrush::MacSetTheme(ThemeBrush macThemeBrush)
M_BRUSHDATA->m_macBrushKind = kwxMacBrushTheme; M_BRUSHDATA->m_macBrushKind = kwxMacBrushTheme;
M_BRUSHDATA->m_macThemeBrush = macThemeBrush; M_BRUSHDATA->m_macThemeBrush = macThemeBrush;
RGBColor color ; RGBColor color ;
GetThemeBrushAsColor( macThemeBrush , 32, true, &color ); GetThemeBrushAsColor( macThemeBrush , 32, true, &color );
M_BRUSHDATA->m_colour.Set( color.red >> 8 , color.green >> 8 , color.blue >> 8 ); M_BRUSHDATA->m_colour.Set( color.red >> 8 , color.green >> 8 , color.blue >> 8 );
@@ -179,6 +182,7 @@ void wxBrush::MacSetThemeBackground(unsigned long macThemeBackground, const WXRE
M_BRUSHDATA->m_macBrushKind = kwxMacBrushThemeBackground; M_BRUSHDATA->m_macBrushKind = kwxMacBrushThemeBackground;
M_BRUSHDATA->m_macThemeBackground = macThemeBackground; M_BRUSHDATA->m_macThemeBackground = macThemeBackground;
M_BRUSHDATA->m_macThemeBackgroundExtent = *(Rect*)extent; M_BRUSHDATA->m_macThemeBackgroundExtent = *(Rect*)extent;
RealizeResource(); RealizeResource();
} }
@@ -186,13 +190,14 @@ bool wxBrush::RealizeResource()
{ {
return true; return true;
} }
unsigned long wxBrush::MacGetThemeBackground( WXRECTPTR extent) const
unsigned long wxBrush::MacGetThemeBackground( WXRECTPTR extent) const unsigned long wxBrush::MacGetThemeBackground( WXRECTPTR extent) const
{ {
if ( M_BRUSHDATA && M_BRUSHDATA->m_macBrushKind == kwxMacBrushThemeBackground ) if ( M_BRUSHDATA && M_BRUSHDATA->m_macBrushKind == kwxMacBrushThemeBackground )
{ {
if ( extent ) if ( extent )
*(Rect*)extent = M_BRUSHDATA->m_macThemeBackgroundExtent; *(Rect*)extent = M_BRUSHDATA->m_macThemeBackgroundExtent;
return M_BRUSHDATA->m_macThemeBackground; return M_BRUSHDATA->m_macThemeBackground;
} }
else else
@@ -203,7 +208,7 @@ unsigned long wxBrush::MacGetThemeBackground( WXRECTPTR extent) const
short wxBrush::MacGetTheme() const short wxBrush::MacGetTheme() const
{ {
return (M_BRUSHDATA ? ( M_BRUSHDATA->m_macBrushKind == kwxMacBrushTheme ? M_BRUSHDATA->m_macThemeBrush : kThemeBrushBlack) : kThemeBrushBlack); return (M_BRUSHDATA ? ((M_BRUSHDATA->m_macBrushKind == kwxMacBrushTheme) ? M_BRUSHDATA->m_macThemeBrush : kThemeBrushBlack) : kThemeBrushBlack);
} }
wxColour& wxBrush::GetColour() const wxColour& wxBrush::GetColour() const
@@ -225,3 +230,4 @@ wxMacBrushKind wxBrush::MacGetBrushKind() const
{ {
return (M_BRUSHDATA ? M_BRUSHDATA->m_macBrushKind : kwxMacBrushColour); return (M_BRUSHDATA ? M_BRUSHDATA->m_macBrushKind : kwxMacBrushColour);
} }

View File

@@ -14,12 +14,10 @@
#include "wx/gdicmn.h" #include "wx/gdicmn.h"
#include "wx/colour.h" #include "wx/colour.h"
IMPLEMENT_DYNAMIC_CLASS(wxColour, wxObject)
// Colour
#include "wx/mac/private.h" #include "wx/mac/private.h"
IMPLEMENT_DYNAMIC_CLASS(wxColour, wxObject)
static void wxComposeRGBColor( WXCOLORREF* color , int red, int blue, int green ); static void wxComposeRGBColor( WXCOLORREF* color , int red, int blue, int green );
static void wxComposeRGBColor( WXCOLORREF* color , int red, int blue, int green ) static void wxComposeRGBColor( WXCOLORREF* color , int red, int blue, int green )
{ {

View File

@@ -19,7 +19,8 @@ IMPLEMENT_DYNAMIC_CLASS(wxGauge, wxControl)
#include "wx/mac/uma.h" #include "wx/mac/uma.h"
bool wxGauge::Create(wxWindow *parent, wxWindowID id, bool wxGauge::Create( wxWindow *parent,
wxWindowID id,
int range, int range,
const wxPoint& pos, const wxPoint& pos,
const wxSize& s, const wxSize& s,
@@ -27,29 +28,31 @@ bool wxGauge::Create(wxWindow *parent, wxWindowID id,
const wxValidator& validator, const wxValidator& validator,
const wxString& name ) const wxString& name )
{ {
m_macIsUserPane = FALSE ; m_macIsUserPane = false;
if ( !wxGaugeBase::Create( parent, id, range, pos, s, style & 0xE0FFFFFF, validator, name ) ) if ( !wxGaugeBase::Create( parent, id, range, pos, s, style & 0xE0FFFFFF, validator, name ) )
return false; return false;
wxSize size = s; wxSize size = s;
/*
#if 0
if (size.x == wxDefaultCoord && size.y == wxDefaultCoord) if (size.x == wxDefaultCoord && size.y == wxDefaultCoord)
{
size = wxSize( 200 , 16 ); size = wxSize( 200 , 16 );
} #endif
*/
Rect bounds = wxMacGetBoundsForControl( this, pos, size ); Rect bounds = wxMacGetBoundsForControl( this, pos, size );
m_peer = new wxMacControl( this ); m_peer = new wxMacControl( this );
verify_noerr ( CreateProgressBarControl( MAC_WXHWND(parent->MacGetTopLevelWindowRef()) , &bounds , OSStatus err = CreateProgressBarControl(
GetValue() , 0 , GetRange() , false /* not indeterminate */ , m_peer->GetControlRefAddr() ) ); MAC_WXHWND(parent->MacGetTopLevelWindowRef()), &bounds,
GetValue(), 0, GetRange(), false /* not indeterminate */, m_peer->GetControlRefAddr() );
verify_noerr( err );
if ( GetValue() == 0 ) if ( GetValue() == 0 )
m_peer->SetData<Boolean>( kControlEntireControl, kControlProgressBarAnimatingTag, (Boolean)false ); m_peer->SetData<Boolean>( kControlEntireControl, kControlProgressBarAnimatingTag, (Boolean)false );
MacPostControlCreate( pos, size ); MacPostControlCreate( pos, size );
return TRUE; return true;
} }
void wxGauge::SetRange(int r) void wxGauge::SetRange(int r)
@@ -66,28 +69,29 @@ void wxGauge::SetValue(int pos)
// we are going via the base class in case there is // we are going via the base class in case there is
// some change behind the values by it // some change behind the values by it
wxGaugeBase::SetValue( pos ) ; wxGaugeBase::SetValue( pos ) ;
if ( m_peer && m_peer->Ok() ) if ( m_peer && m_peer->Ok() )
{ {
m_peer->SetValue( GetValue() ) ; m_peer->SetValue( GetValue() ) ;
// we turn off animation in the unnecessary situations as this is eating a lot of CPU otherwise
// turn off animation in the unnecessary situations as this is consuming a lot of CPU otherwise
Boolean shouldAnimate = ( GetValue() > 0 && GetValue() < GetRange() ) ; Boolean shouldAnimate = ( GetValue() > 0 && GetValue() < GetRange() ) ;
if ( m_peer->GetData<Boolean>( kControlEntireControl, kControlProgressBarAnimatingTag ) != shouldAnimate ) if ( m_peer->GetData<Boolean>( kControlEntireControl, kControlProgressBarAnimatingTag ) != shouldAnimate )
{ {
m_peer->SetData<Boolean>( kControlEntireControl, kControlProgressBarAnimatingTag, shouldAnimate ) ; m_peer->SetData<Boolean>( kControlEntireControl, kControlProgressBarAnimatingTag, shouldAnimate ) ;
if ( !shouldAnimate ) if ( !shouldAnimate )
{
Refresh() ; Refresh() ;
} }
} }
} }
}
int wxGauge::GetValue() const int wxGauge::GetValue() const
{ {
/* #if 0
if ( m_peer && m_peer->Ok() ) if ( m_peer && m_peer->Ok() )
return m_peer->GetValue() ; return m_peer->GetValue() ;
*/ #endif
return m_gaugePos ; return m_gaugePos ;
} }

File diff suppressed because it is too large Load Diff