]>
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"
16 #include "wx/statusbr.h"
20 #include "wx/dcclient.h"
21 #include "wx/toplevel.h"
24 #include "wx/mac/private.h"
27 BEGIN_EVENT_TABLE(wxStatusBarMac
, wxStatusBarGeneric
)
28 EVT_PAINT(wxStatusBarMac::OnPaint
)
32 wxStatusBarMac::wxStatusBarMac(wxWindow
*parent
,
40 Create( parent
, id
, style
, name
);
43 wxStatusBarMac::wxStatusBarMac()
50 wxStatusBarMac::~wxStatusBarMac()
54 bool wxStatusBarMac::Create(wxWindow
*parent
, wxWindowID id
,
58 if ( !wxStatusBarGeneric::Create( parent
, id
, style
, name
) )
61 if ( parent
->MacGetTopLevelWindow()->MacGetMetalAppearance() )
62 MacSetBackgroundBrush( wxNullBrush
);
64 // normal system font is too tall for fitting into the standard height
65 SetWindowVariant( wxWINDOW_VARIANT_SMALL
);
70 void wxStatusBarMac::DrawFieldText(wxDC
& dc
, int i
)
75 GetFieldRect( i
, rect
);
77 if ( !MacIsReallyHilited() )
78 dc
.SetTextForeground( wxColour( 0x80, 0x80, 0x80 ) );
80 wxString
text(GetStatusText( i
));
84 dc
.GetTextExtent(text
, &x
, &y
);
87 int xpos
= rect
.x
+ leftMargin
+ 1;
90 if ( MacGetTopLevelWindow()->MacGetMetalAppearance() )
93 dc
.SetClippingRegion(rect
.x
, 0, rect
.width
, h
);
95 dc
.DrawText(text
, xpos
, ypos
);
97 dc
.DestroyClippingRegion();
100 void wxStatusBarMac::DrawField(wxDC
& dc
, int i
)
102 DrawFieldText(dc
, i
);
105 void wxStatusBarMac::SetStatusText(const wxString
& text
, int number
)
107 wxCHECK_RET( (number
>= 0) && (number
< m_nFields
),
108 wxT("invalid status bar field index") );
110 if ( m_statusStrings
[number
] == text
)
113 m_statusStrings
[number
] = text
;
115 GetFieldRect(number
, rect
);
120 Refresh( true, &rect
);
124 void wxStatusBarMac::OnPaint(wxPaintEvent
& WXUNUSED(event
))
130 wxGetOsVersion( &major
, &minor
);
134 if ( MacIsReallyHilited() )
136 wxPen
white( *wxWHITE
, 1 , wxSOLID
);
139 // Finder statusbar border color: (Project Builder similar is 9B9B9B)
140 if ( MacGetTopLevelWindow()->MacGetMetalAppearance() )
141 dc
.SetPen(wxPen(wxColour(0x40, 0x40, 0x40), 1, wxSOLID
));
143 dc
.SetPen(wxPen(wxColour(0xB1, 0xB1, 0xB1), 1, wxSOLID
));
147 wxPen
black( *wxBLACK
, 1 , wxSOLID
);
151 dc
.DrawLine(0, 0, w
, 0);
153 dc
.DrawLine(0, 1, w
, 1);
158 // Finder statusbar border color: (Project Builder similar is 9B9B9B)
159 dc
.SetPen(wxPen(wxColour(0xB1, 0xB1, 0xB1), 1, wxSOLID
));
161 dc
.SetPen(wxPen(wxColour(0x80, 0x80, 0x80), 1, wxSOLID
));
163 dc
.DrawLine(0, 0, w
, 0);
167 if ( GetFont().Ok() )
168 dc
.SetFont(GetFont());
169 dc
.SetBackgroundMode(wxTRANSPARENT
);
171 for ( i
= 0; i
< m_nFields
; i
++ )
175 void wxStatusBarMac::MacHiliteChanged()
181 #endif // wxUSE_STATUSBAR