]>
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
));
83 dc
.GetTextExtent(text
, &x
, &y
);
86 int xpos
= rect
.x
+ leftMargin
+ 1;
89 if ( MacGetTopLevelWindow()->MacGetMetalAppearance() )
92 dc
.SetClippingRegion(rect
.x
, 0, rect
.width
, h
);
94 dc
.DrawText(text
, xpos
, ypos
);
96 dc
.DestroyClippingRegion();
99 void wxStatusBarMac::DrawField(wxDC
& dc
, int i
)
101 DrawFieldText(dc
, i
);
104 void wxStatusBarMac::SetStatusText(const wxString
& text
, int number
)
106 wxCHECK_RET( (number
>= 0) && (number
< m_nFields
),
107 wxT("invalid status bar field index") );
109 if ( m_statusStrings
[number
] == text
)
112 m_statusStrings
[number
] = text
;
114 GetFieldRect(number
, rect
);
119 Refresh( true, &rect
);
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()->MacGetMetalAppearance() )
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);
166 if ( GetFont().Ok() )
167 dc
.SetFont(GetFont());
168 dc
.SetBackgroundMode(wxTRANSPARENT
);
170 for ( i
= 0; i
< m_nFields
; i
++ )
174 void wxStatusBarMac::MacHiliteChanged()
180 #endif // wxUSE_STATUSBAR