]>
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"
16 #include "wx/dcclient.h"
18 #include "wx/mac/private.h"
19 #include "wx/toplevel.h"
22 BEGIN_EVENT_TABLE(wxStatusBarMac
, wxStatusBarGeneric
)
23 EVT_PAINT(wxStatusBarMac::OnPaint
)
27 wxStatusBarMac::wxStatusBarMac(wxWindow
*parent
,
35 Create( parent
, id
, style
, name
);
38 wxStatusBarMac::wxStatusBarMac()
45 wxStatusBarMac::~wxStatusBarMac()
49 bool wxStatusBarMac::Create(wxWindow
*parent
, wxWindowID id
,
53 if ( !wxStatusBarGeneric::Create( parent
, id
, style
, name
) )
56 if ( parent
->MacGetTopLevelWindow()->MacGetMetalAppearance() )
57 MacSetBackgroundBrush( wxNullBrush
);
59 // normal system font is too tall for fitting into the standard height
60 SetWindowVariant( wxWINDOW_VARIANT_SMALL
);
65 void wxStatusBarMac::DrawFieldText(wxDC
& dc
, int i
)
70 GetFieldRect( i
, rect
);
72 if ( !MacIsReallyHilited() )
73 dc
.SetTextForeground( wxColour( 0x80, 0x80, 0x80 ) );
75 wxString
text(GetStatusText( i
));
79 dc
.GetTextExtent(text
, &x
, &y
);
82 int xpos
= rect
.x
+ leftMargin
+ 1;
85 if ( MacGetTopLevelWindow()->MacGetMetalAppearance() )
88 dc
.SetClippingRegion(rect
.x
, 0, rect
.width
, h
);
90 dc
.DrawText(text
, xpos
, ypos
);
92 dc
.DestroyClippingRegion();
95 void wxStatusBarMac::DrawField(wxDC
& dc
, int i
)
100 void wxStatusBarMac::SetStatusText(const wxString
& text
, int number
)
102 wxCHECK_RET( (number
>= 0) && (number
< m_nFields
),
103 wxT("invalid status bar field index") );
105 if ( m_statusStrings
[number
] == text
)
108 m_statusStrings
[number
] = text
;
110 GetFieldRect(number
, rect
);
115 Refresh( true, &rect
);
119 void wxStatusBarMac::OnPaint(wxPaintEvent
& WXUNUSED(event
))
125 wxGetOsVersion( &major
, &minor
);
129 if ( MacIsReallyHilited() )
131 wxPen
white( *wxWHITE
, 1 , wxSOLID
);
134 // Finder statusbar border color: (Project Builder similar is 9B9B9B)
135 if ( MacGetTopLevelWindow()->MacGetMetalAppearance() )
136 dc
.SetPen(wxPen(wxColour(0x40, 0x40, 0x40), 1, wxSOLID
));
138 dc
.SetPen(wxPen(wxColour(0xB1, 0xB1, 0xB1), 1, wxSOLID
));
142 wxPen
black( *wxBLACK
, 1 , wxSOLID
);
146 dc
.DrawLine(0, 0, w
, 0);
148 dc
.DrawLine(0, 1, w
, 1);
153 // Finder statusbar border color: (Project Builder similar is 9B9B9B)
154 dc
.SetPen(wxPen(wxColour(0xB1, 0xB1, 0xB1), 1, wxSOLID
));
156 dc
.SetPen(wxPen(wxColour(0x80, 0x80, 0x80), 1, wxSOLID
));
158 dc
.DrawLine(0, 0, w
, 0);
162 if ( GetFont().Ok() )
163 dc
.SetFont(GetFont());
164 dc
.SetBackgroundMode(wxTRANSPARENT
);
166 for ( i
= 0; i
< m_nFields
; i
++ )
170 void wxStatusBarMac::MacHiliteChanged()