]>
git.saurik.com Git - wxWidgets.git/blob - src/mac/carbon/statbrma.cpp
1 ///////////////////////////////////////////////////////////////////////////////
2 // Name: src/mac/carbon/statbarma.cpp
3 // Purpose: native implementation of wxStatusBar (optional)
4 // Author: Stefan Csomor
8 // Copyright: (c) 1998 Stefan Csomor
9 // Licence: wxWindows licence
10 ///////////////////////////////////////////////////////////////////////////////
12 #include "wx/wxprec.h"
14 #include "wx/statusbr.h"
18 #include "wx/dcclient.h"
19 #include "wx/toplevel.h"
22 #include "wx/mac/private.h"
25 BEGIN_EVENT_TABLE(wxStatusBarMac
, wxStatusBarGeneric
)
26 EVT_PAINT(wxStatusBarMac::OnPaint
)
30 wxStatusBarMac::wxStatusBarMac(wxWindow
*parent
,
38 Create( parent
, id
, style
, name
);
41 wxStatusBarMac::wxStatusBarMac()
48 wxStatusBarMac::~wxStatusBarMac()
52 bool wxStatusBarMac::Create(wxWindow
*parent
, wxWindowID id
,
56 if ( !wxStatusBarGeneric::Create( parent
, id
, style
, name
) )
59 if ( parent
->MacGetTopLevelWindow()->MacGetMetalAppearance() )
60 MacSetBackgroundBrush( wxNullBrush
);
62 // normal system font is too tall for fitting into the standard height
63 SetWindowVariant( wxWINDOW_VARIANT_SMALL
);
68 void wxStatusBarMac::DrawFieldText(wxDC
& dc
, int i
)
73 GetFieldRect( i
, rect
);
75 if ( !MacIsReallyHilited() )
76 dc
.SetTextForeground( wxColour( 0x80, 0x80, 0x80 ) );
78 wxString
text(GetStatusText( i
));
82 dc
.GetTextExtent(text
, &x
, &y
);
85 int xpos
= rect
.x
+ leftMargin
+ 1;
88 if ( MacGetTopLevelWindow()->MacGetMetalAppearance() )
91 dc
.SetClippingRegion(rect
.x
, 0, rect
.width
, h
);
93 dc
.DrawText(text
, xpos
, ypos
);
95 dc
.DestroyClippingRegion();
98 void wxStatusBarMac::DrawField(wxDC
& dc
, int i
)
100 DrawFieldText(dc
, i
);
103 void wxStatusBarMac::SetStatusText(const wxString
& text
, int number
)
105 wxCHECK_RET( (number
>= 0) && (number
< m_nFields
),
106 wxT("invalid status bar field index") );
108 if ( m_statusStrings
[number
] == text
)
111 m_statusStrings
[number
] = text
;
113 GetFieldRect(number
, rect
);
118 Refresh( true, &rect
);
122 void wxStatusBarMac::OnPaint(wxPaintEvent
& WXUNUSED(event
))
128 wxGetOsVersion( &major
, &minor
);
132 if ( MacIsReallyHilited() )
134 wxPen
white( *wxWHITE
, 1 , wxSOLID
);
137 // Finder statusbar border color: (Project Builder similar is 9B9B9B)
138 if ( MacGetTopLevelWindow()->MacGetMetalAppearance() )
139 dc
.SetPen(wxPen(wxColour(0x40, 0x40, 0x40), 1, wxSOLID
));
141 dc
.SetPen(wxPen(wxColour(0xB1, 0xB1, 0xB1), 1, wxSOLID
));
145 wxPen
black( *wxBLACK
, 1 , wxSOLID
);
149 dc
.DrawLine(0, 0, w
, 0);
151 dc
.DrawLine(0, 1, w
, 1);
156 // Finder statusbar border color: (Project Builder similar is 9B9B9B)
157 dc
.SetPen(wxPen(wxColour(0xB1, 0xB1, 0xB1), 1, wxSOLID
));
159 dc
.SetPen(wxPen(wxColour(0x80, 0x80, 0x80), 1, wxSOLID
));
161 dc
.DrawLine(0, 0, w
, 0);
165 if ( GetFont().Ok() )
166 dc
.SetFont(GetFont());
167 dc
.SetBackgroundMode(wxTRANSPARENT
);
169 for ( i
= 0; i
< m_nFields
; i
++ )
173 void wxStatusBarMac::MacHiliteChanged()