]>
git.saurik.com Git - wxWidgets.git/blob - src/osx/carbon/statbrma.cpp
1 ///////////////////////////////////////////////////////////////////////////////
2 // Name: src/osx/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/osx/private.h"
26 // Margin between the field text and the field rect
27 #define wxFIELD_TEXT_MARGIN 2
30 BEGIN_EVENT_TABLE(wxStatusBarMac
, wxStatusBarGeneric
)
31 EVT_PAINT(wxStatusBarMac::OnPaint
)
35 wxStatusBarMac::wxStatusBarMac(wxWindow
*parent
,
43 Create( parent
, id
, style
, name
);
46 wxStatusBarMac::wxStatusBarMac()
53 wxStatusBarMac::~wxStatusBarMac()
57 bool wxStatusBarMac::Create(wxWindow
*parent
, wxWindowID id
,
61 if ( !wxStatusBarGeneric::Create( parent
, id
, style
, name
) )
64 if ( parent
->MacGetTopLevelWindow()->GetExtraStyle() & wxFRAME_EX_METAL
)
65 SetBackgroundStyle( wxBG_STYLE_TRANSPARENT
);
67 // normal system font is too tall for fitting into the standard height
68 SetWindowVariant( wxWINDOW_VARIANT_SMALL
);
73 void wxStatusBarMac::DrawFieldText(wxDC
& dc
, const wxRect
& rect
, int i
, int WXUNUSED(textHeight
))
78 if ( !MacIsReallyHilited() )
79 dc
.SetTextForeground( wxColour( 0x80, 0x80, 0x80 ) );
81 wxString
text(GetStatusText( i
));
84 dc.GetTextExtent(text, &x, &y); -- seems unused (FM)*/
86 int xpos
= rect
.x
+ wxFIELD_TEXT_MARGIN
+ 1;
89 if ( MacGetTopLevelWindow()->GetExtraStyle() & wxFRAME_EX_METAL
)
92 dc
.SetClippingRegion(rect
.x
, 0, rect
.width
, h
);
93 dc
.DrawText(text
, xpos
, ypos
);
94 dc
.DestroyClippingRegion();
97 void wxStatusBarMac::DrawField(wxDC
& dc
, int i
, int textHeight
)
100 GetFieldRect(i
, rect
);
102 DrawFieldText(dc
, rect
, i
, textHeight
);
105 void wxStatusBarMac::DoUpdateStatusText(int number
)
108 GetFieldRect(number
, rect
);
116 Refresh( true, &rect
);
117 // we should have to force the update here
118 // TODO Remove if no regressions occur
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()->GetExtraStyle() & wxFRAME_EX_METAL
)
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);
166 if ( GetFont().IsOk() )
167 dc
.SetFont(GetFont());
168 dc
.SetBackgroundMode(wxTRANSPARENT
);
170 // compute char height only once for all panes:
171 int textHeight
= dc
.GetCharHeight();
173 for ( size_t i
= 0; i
< m_panes
.GetCount(); i
++ )
174 DrawField(dc
, i
, textHeight
);
177 void wxStatusBarMac::MacHiliteChanged()
183 #endif // wxUSE_STATUSBAR