]>
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
);
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()->GetExtraStyle() & wxFRAME_EX_METAL
)
137 dc
.SetPen(wxPen(wxColour(0x40, 0x40, 0x40), 1, wxSOLID
));
139 dc
.SetPen(wxPen(wxColour(0xB1, 0xB1, 0xB1), 1, wxSOLID
));
143 wxPen
black( *wxBLACK
, 1 , wxSOLID
);
147 dc
.DrawLine(0, 0, w
, 0);
149 dc
.DrawLine(0, 1, w
, 1);
154 // Finder statusbar border color: (Project Builder similar is 9B9B9B)
155 dc
.SetPen(wxPen(wxColour(0xB1, 0xB1, 0xB1), 1, wxSOLID
));
157 dc
.SetPen(wxPen(wxColour(0x80, 0x80, 0x80), 1, wxSOLID
));
159 dc
.DrawLine(0, 0, w
, 0);
162 if ( GetFont().IsOk() )
163 dc
.SetFont(GetFont());
164 dc
.SetBackgroundMode(wxTRANSPARENT
);
166 // compute char height only once for all panes:
167 int textHeight
= dc
.GetCharHeight();
169 for ( size_t i
= 0; i
< m_panes
.GetCount(); i
++ )
170 DrawField(dc
, i
, textHeight
);
173 void wxStatusBarMac::MacHiliteChanged()
179 #endif // wxUSE_STATUSBAR