]>
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
7 // Copyright: (c) 1998 Stefan Csomor
8 // Licence: wxWindows licence
9 ///////////////////////////////////////////////////////////////////////////////
11 #include "wx/wxprec.h"
15 #include "wx/statusbr.h"
19 #include "wx/dcclient.h"
20 #include "wx/toplevel.h"
23 #include "wx/osx/private.h"
25 // Margin between the field text and the field rect
26 #define wxFIELD_TEXT_MARGIN 2
29 BEGIN_EVENT_TABLE(wxStatusBarMac
, wxStatusBarGeneric
)
30 EVT_PAINT(wxStatusBarMac::OnPaint
)
34 wxStatusBarMac::wxStatusBarMac(wxWindow
*parent
,
42 Create( parent
, id
, style
, name
);
45 wxStatusBarMac::wxStatusBarMac()
52 wxStatusBarMac::~wxStatusBarMac()
56 bool wxStatusBarMac::Create(wxWindow
*parent
, wxWindowID id
,
60 if ( !wxStatusBarGeneric::Create( parent
, id
, style
, name
) )
63 if ( parent
->MacGetTopLevelWindow()->GetExtraStyle() & wxFRAME_EX_METAL
)
64 SetBackgroundStyle( wxBG_STYLE_TRANSPARENT
);
66 // normal system font is too tall for fitting into the standard height
67 SetWindowVariant( wxWINDOW_VARIANT_SMALL
);
72 void wxStatusBarMac::DrawFieldText(wxDC
& dc
, const wxRect
& rect
, int i
, int WXUNUSED(textHeight
))
77 if ( !MacIsReallyHilited() )
78 dc
.SetTextForeground( wxColour( 0x80, 0x80, 0x80 ) );
80 wxString
text(GetStatusText( i
));
83 dc.GetTextExtent(text, &x, &y); -- seems unused (FM)*/
85 int xpos
= rect
.x
+ wxFIELD_TEXT_MARGIN
+ 1;
88 if ( MacGetTopLevelWindow()->GetExtraStyle() & wxFRAME_EX_METAL
)
91 dc
.SetClippingRegion(rect
.x
, 0, rect
.width
, h
);
92 dc
.DrawText(text
, xpos
, ypos
);
93 dc
.DestroyClippingRegion();
96 void wxStatusBarMac::DrawField(wxDC
& dc
, int i
, int textHeight
)
99 GetFieldRect(i
, rect
);
101 DrawFieldText(dc
, rect
, i
, textHeight
);
104 void wxStatusBarMac::DoUpdateStatusText(int number
)
107 GetFieldRect(number
, rect
);
115 Refresh( true, &rect
);
116 // we should have to force the update here
117 // TODO Remove if no regressions occur
123 void wxStatusBarMac::OnPaint(wxPaintEvent
& WXUNUSED(event
))
129 wxGetOsVersion( &major
, &minor
);
133 if ( MacIsReallyHilited() )
135 wxPen
white( *wxWHITE
, 1 , wxSOLID
);
138 // Finder statusbar border color: (Project Builder similar is 9B9B9B)
139 if ( MacGetTopLevelWindow()->GetExtraStyle() & wxFRAME_EX_METAL
)
140 dc
.SetPen(wxPen(wxColour(0x40, 0x40, 0x40), 1, wxSOLID
));
142 dc
.SetPen(wxPen(wxColour(0xB1, 0xB1, 0xB1), 1, wxSOLID
));
146 wxPen
black( *wxBLACK
, 1 , wxSOLID
);
150 dc
.DrawLine(0, 0, w
, 0);
152 dc
.DrawLine(0, 1, w
, 1);
157 // Finder statusbar border color: (Project Builder similar is 9B9B9B)
158 dc
.SetPen(wxPen(wxColour(0xB1, 0xB1, 0xB1), 1, wxSOLID
));
160 dc
.SetPen(wxPen(wxColour(0x80, 0x80, 0x80), 1, wxSOLID
));
162 dc
.DrawLine(0, 0, w
, 0);
165 if ( GetFont().IsOk() )
166 dc
.SetFont(GetFont());
167 dc
.SetBackgroundMode(wxTRANSPARENT
);
169 // compute char height only once for all panes:
170 int textHeight
= dc
.GetCharHeight();
172 for ( size_t i
= 0; i
< m_panes
.GetCount(); i
++ )
173 DrawField(dc
, i
, textHeight
);
176 void wxStatusBarMac::MacHiliteChanged()
182 #endif // wxUSE_STATUSBAR