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
{
friend class WXDLLEXPORT wxBrush;
public:
wxBrushRefData();
wxBrushRefData(const wxBrushRefData& data);
@@ -40,6 +41,7 @@ protected:
#define M_BRUSHDATA ((wxBrushRefData *)m_refData)
wxBrushRefData::wxBrushRefData()
: m_style(wxSOLID)
{
@@ -62,7 +64,6 @@ wxBrushRefData::~wxBrushRefData()
{
}
// Brushes
wxBrush::wxBrush()
{
}
@@ -96,7 +97,7 @@ wxBrush::wxBrush(const wxBitmap& stipple)
RealizeResource();
}
wxBrush::wxBrush(ThemeBrush macThemeBrush )
wxBrush::wxBrush( ThemeBrush macThemeBrush )
{
m_refData = new wxBrushRefData;
@@ -105,6 +106,7 @@ wxBrush::wxBrush(ThemeBrush macThemeBrush )
RealizeResource();
}
void wxBrush::Unshare()
{
// Don't change shared data
@@ -165,9 +167,10 @@ void wxBrush::MacSetTheme(ThemeBrush macThemeBrush)
M_BRUSHDATA->m_macBrushKind = kwxMacBrushTheme;
M_BRUSHDATA->m_macThemeBrush = macThemeBrush;
RGBColor 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 );
RealizeResource();
}
@@ -178,7 +181,8 @@ void wxBrush::MacSetThemeBackground(unsigned long macThemeBackground, const WXRE
M_BRUSHDATA->m_macBrushKind = kwxMacBrushThemeBackground;
M_BRUSHDATA->m_macThemeBackground = macThemeBackground;
M_BRUSHDATA->m_macThemeBackgroundExtent = *(Rect*)extent ;
M_BRUSHDATA->m_macThemeBackgroundExtent = *(Rect*)extent;
RealizeResource();
}
@@ -186,24 +190,25 @@ bool wxBrush::RealizeResource()
{
return true;
}
unsigned long wxBrush::MacGetThemeBackground( WXRECTPTR extent) const
unsigned long wxBrush::MacGetThemeBackground( WXRECTPTR extent) const
{
if ( M_BRUSHDATA && M_BRUSHDATA->m_macBrushKind == kwxMacBrushThemeBackground )
{
if ( extent )
*(Rect*)extent = M_BRUSHDATA->m_macThemeBackgroundExtent ;
return M_BRUSHDATA->m_macThemeBackground ;
*(Rect*)extent = M_BRUSHDATA->m_macThemeBackgroundExtent;
return M_BRUSHDATA->m_macThemeBackground;
}
else
{
return 0 ;
return 0;
}
}
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
@@ -225,3 +230,4 @@ wxMacBrushKind wxBrush::MacGetBrushKind() const
{
return (M_BRUSHDATA ? M_BRUSHDATA->m_macBrushKind : kwxMacBrushColour);
}

View File

@@ -14,16 +14,14 @@
#include "wx/gdicmn.h"
#include "wx/colour.h"
IMPLEMENT_DYNAMIC_CLASS(wxColour, wxObject)
// Colour
#include "wx/mac/private.h"
static void wxComposeRGBColor( WXCOLORREF* color , int red, int blue, int green ) ;
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 )
{
RGBColor* col = (RGBColor*) color ;
RGBColor* col = (RGBColor*) color;
col->red = (red << 8) + red;
col->blue = (blue << 8) + blue;
col->green = (green << 8) + green;
@@ -36,7 +34,7 @@ void wxColour::Init()
m_blue =
m_green = 0;
wxComposeRGBColor( &m_pixel , m_red , m_blue , m_green ) ;
wxComposeRGBColor( &m_pixel, m_red, m_blue, m_green );
}
wxColour::wxColour (const wxColour& col)
@@ -47,7 +45,7 @@ wxColour::wxColour (const wxColour& col)
m_blue = col.m_blue;
m_isInit = col.m_isInit;
memcpy( &m_pixel , &col.m_pixel , 6 ) ;
memcpy( &m_pixel, &col.m_pixel, 6 );
}
wxColour& wxColour::operator =(const wxColour& col)
@@ -57,7 +55,7 @@ wxColour& wxColour::operator =(const wxColour& col)
m_blue = col.m_blue;
m_isInit = col.m_isInit;
memcpy( &m_pixel , &col.m_pixel , 6 ) ;
memcpy( &m_pixel, &col.m_pixel, 6 );
return *this;
}
@@ -66,7 +64,7 @@ void wxColour::InitFromName(const wxString& name)
{
if ( wxTheColourDatabase )
{
wxColour col = wxTheColourDatabase->Find(name);
wxColour col = wxTheColourDatabase->Find( name );
if ( col.Ok() )
{
*this = col;
@@ -89,14 +87,14 @@ void wxColour::Set (unsigned char r, unsigned char g, unsigned char b)
m_blue = b;
m_isInit = true;
wxComposeRGBColor( &m_pixel , m_red , m_blue , m_green ) ;
wxComposeRGBColor( &m_pixel , m_red , m_blue , m_green );
}
void wxColour::Set( const WXCOLORREF* color )
{
RGBColor* col = (RGBColor*) color ;
memcpy( &m_pixel , color , 6 ) ;
m_red = col->red>>8 ;
m_blue = col->blue>>8 ;
m_green = col->green>>8 ;
RGBColor* col = (RGBColor*) color;
memcpy( &m_pixel, color, 6 );
m_red = col->red >> 8;
m_blue = col->blue >> 8;
m_green = col->green >> 8;
}

View File

@@ -19,44 +19,47 @@ IMPLEMENT_DYNAMIC_CLASS(wxGauge, wxControl)
#include "wx/mac/uma.h"
bool wxGauge::Create(wxWindow *parent, wxWindowID id,
bool wxGauge::Create( wxWindow *parent,
wxWindowID id,
int range,
const wxPoint& pos,
const wxSize& s,
long style,
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;
wxSize size = s ;
/*
if ( size.x == wxDefaultCoord && size.y == wxDefaultCoord)
{
size = wxSize( 200 , 16 ) ;
}
*/
Rect bounds = wxMacGetBoundsForControl( this , pos , size ) ;
m_peer = new wxMacControl(this) ;
verify_noerr ( CreateProgressBarControl( MAC_WXHWND(parent->MacGetTopLevelWindowRef()) , &bounds ,
GetValue() , 0 , GetRange() , false /* not indeterminate */ , m_peer->GetControlRefAddr() ) );
wxSize size = s;
#if 0
if (size.x == wxDefaultCoord && size.y == wxDefaultCoord)
size = wxSize( 200 , 16 );
#endif
Rect bounds = wxMacGetBoundsForControl( this, pos, size );
m_peer = new wxMacControl( this );
OSStatus err = CreateProgressBarControl(
MAC_WXHWND(parent->MacGetTopLevelWindowRef()), &bounds,
GetValue(), 0, GetRange(), false /* not indeterminate */, m_peer->GetControlRefAddr() );
verify_noerr( err );
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)
{
// we are going via the base class in case there is
// some change behind the values by it
wxGaugeBase::SetRange(r) ;
wxGaugeBase::SetRange( r ) ;
if ( m_peer && m_peer->Ok() )
m_peer->SetMaximum( GetRange() ) ;
}
@@ -65,29 +68,30 @@ void wxGauge::SetValue(int pos)
{
// we are going via the base class in case there is
// some change behind the values by it
wxGaugeBase::SetValue(pos) ;
wxGaugeBase::SetValue( pos ) ;
if ( m_peer && m_peer->Ok() )
{
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() ) ;
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 )
{
Refresh() ;
}
}
}
}
int wxGauge::GetValue() const
{
/*
#if 0
if ( m_peer && m_peer->Ok() )
return m_peer->GetValue() ;
*/
#endif
return m_gaugePos ;
}

File diff suppressed because it is too large Load Diff

View File

@@ -1446,14 +1446,14 @@ bool wxTopLevelWindowMac::ShowFullScreen(bool show, long style)
}
SetSize( x , y , w, h ) ;
if( data->m_wasResizable )
if ( data->m_wasResizable )
MacChangeWindowAttributes( kWindowNoAttributes , kWindowResizableAttribute ) ;
}
else
{
ShowMenuBar() ;
FullScreenData *data = (FullScreenData *) m_macFullScreenData ;
if( data->m_wasResizable )
if ( data->m_wasResizable )
MacChangeWindowAttributes( kWindowResizableAttribute , kWindowNoAttributes ) ;
SetPosition( data->m_position ) ;
SetSize( data->m_size ) ;