]>
git.saurik.com Git - wxWidgets.git/blob - src/mac/carbon/statbrma.cpp
1 ///////////////////////////////////////////////////////////////////////////////
3 // Purpose: native implementation of wxStatusBar (optional)
4 // Author: Stefan Csomor
8 // Copyright: (c) 1998 Stefan Csomor
9 // Licence: wxWindows licence
10 ///////////////////////////////////////////////////////////////////////////////
12 // ----------------------------------------------------------------------------
14 // ----------------------------------------------------------------------------
16 #include "wx/wxprec.h"
18 #include "wx/statusbr.h"
20 #include "wx/dcclient.h"
22 BEGIN_EVENT_TABLE(wxStatusBarMac
, wxStatusBarGeneric
)
23 EVT_PAINT(wxStatusBarMac::OnPaint
)
27 #include "wx/mac/private.h"
28 #include "wx/toplevel.h"
31 // ============================================================================
33 // ============================================================================
35 // ----------------------------------------------------------------------------
36 // wxStatusBarMac class
37 // ----------------------------------------------------------------------------
39 wxStatusBarMac::wxStatusBarMac()
44 wxStatusBarMac::~wxStatusBarMac()
48 bool wxStatusBarMac::Create(wxWindow
*parent
, wxWindowID id
,
52 if( !wxStatusBarGeneric::Create( parent
, id
, style
, name
) )
55 if ( parent
->MacGetTopLevelWindow()->MacGetMetalAppearance() )
56 MacSetBackgroundBrush( wxNullBrush
) ;
58 // normal system font is too tall for fitting into the standard height
59 SetWindowVariant( wxWINDOW_VARIANT_SMALL
) ;
64 void wxStatusBarMac::DrawFieldText(wxDC
& dc
, int i
)
70 GetFieldRect(i
, rect
);
72 if ( !MacIsReallyHilited() )
74 dc
.SetTextForeground( wxColour( 0x80 , 0x80 , 0x80 ) ) ;
77 wxString
text(GetStatusText(i
));
81 dc
.GetTextExtent(text
, &x
, &y
);
83 int xpos
= rect
.x
+ leftMargin
+ 1 ;
86 if ( MacGetTopLevelWindow()->MacGetMetalAppearance() )
89 dc
.SetClippingRegion(rect
.x
, 0, rect
.width
, h
);
91 dc
.DrawText(text
, xpos
, ypos
);
93 dc
.DestroyClippingRegion();
96 void wxStatusBarMac::DrawField(wxDC
& dc
, int i
)
101 void wxStatusBarMac::SetStatusText(const wxString
& text
, int number
)
103 wxCHECK_RET( (number
>= 0) && (number
< m_nFields
),
104 _T("invalid status bar field index") );
106 if ( m_statusStrings
[number
] == text
)
109 m_statusStrings
[number
] = text
;
111 GetFieldRect(number
, rect
);
116 Refresh( TRUE
, &rect
) ;
120 void wxStatusBarMac::OnPaint(wxPaintEvent
& WXUNUSED(event
) )
126 wxGetOsVersion( &major
, &minor
);
130 if ( MacIsReallyHilited() )
132 wxPen
white( *wxWHITE
, 1 , wxSOLID
) ;
135 //Finder statusbar border color: (Project builder similar is 9B9B9B)
136 if ( MacGetTopLevelWindow()->MacGetMetalAppearance() )
137 dc
.SetPen(wxPen(wxColour(0x40,40,40) ,1,wxSOLID
)) ;
139 dc
.SetPen(wxPen(wxColour(0xB1,0xB1,0xB1),1,wxSOLID
));
143 wxPen
black( *wxBLACK
, 1 , wxSOLID
) ;
155 //Finder statusbar border color: (Project builder similar is 9B9B9B)
156 dc
.SetPen(wxPen(wxColour(0xB1,0xB1,0xB1),1,wxSOLID
));
158 dc
.SetPen(wxPen(wxColour(0x80,0x80,0x80),1,wxSOLID
));
165 if ( GetFont().Ok() )
166 dc
.SetFont(GetFont());
167 dc
.SetBackgroundMode(wxTRANSPARENT
);
169 for ( i
= 0; i
< m_nFields
; i
++ )
173 void wxStatusBarMac::MacHiliteChanged()