]>
git.saurik.com Git - wxWidgets.git/blob - src/mac/carbon/statbrma.cpp
ee4fddd4941cad2c16b214b53e7a282940bc1f9d
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()
32 wxStatusBarMac::~wxStatusBarMac()
36 bool wxStatusBarMac::Create(wxWindow
*parent
, wxWindowID id
,
40 if ( !wxStatusBarGeneric::Create( parent
, id
, style
, name
) )
43 if ( parent
->MacGetTopLevelWindow()->MacGetMetalAppearance() )
44 MacSetBackgroundBrush( wxNullBrush
);
46 // normal system font is too tall for fitting into the standard height
47 SetWindowVariant( wxWINDOW_VARIANT_SMALL
);
52 void wxStatusBarMac::DrawFieldText(wxDC
& dc
, int i
)
58 GetFieldRect(i
, rect
);
60 if ( !MacIsReallyHilited() )
61 dc
.SetTextForeground( wxColour( 0x80 , 0x80 , 0x80 ) ) ;
63 wxString
text(GetStatusText(i
));
67 dc
.GetTextExtent(text
, &x
, &y
);
69 int xpos
= rect
.x
+ leftMargin
+ 1 ;
72 if ( MacGetTopLevelWindow()->MacGetMetalAppearance() )
75 dc
.SetClippingRegion(rect
.x
, 0, rect
.width
, h
);
77 dc
.DrawText(text
, xpos
, ypos
);
79 dc
.DestroyClippingRegion();
82 void wxStatusBarMac::DrawField(wxDC
& dc
, int i
)
87 void wxStatusBarMac::SetStatusText(const wxString
& text
, int number
)
89 wxCHECK_RET( (number
>= 0) && (number
< m_nFields
),
90 wxT("invalid status bar field index") );
92 if ( m_statusStrings
[number
] == text
)
95 m_statusStrings
[number
] = text
;
97 GetFieldRect(number
, rect
);
102 Refresh( true, &rect
);
106 void wxStatusBarMac::OnPaint(wxPaintEvent
& WXUNUSED(event
))
112 wxGetOsVersion( &major
, &minor
);
116 if ( MacIsReallyHilited() )
118 wxPen
white( *wxWHITE
, 1 , wxSOLID
);
121 // Finder statusbar border color: (Project Builder similar is 9B9B9B)
122 if ( MacGetTopLevelWindow()->MacGetMetalAppearance() )
123 dc
.SetPen(wxPen(wxColour(0x40, 0x40, 0x40), 1, wxSOLID
));
125 dc
.SetPen(wxPen(wxColour(0xB1, 0xB1, 0xB1), 1, wxSOLID
));
129 wxPen
black( *wxBLACK
, 1 , wxSOLID
);
133 dc
.DrawLine(0, 0, w
, 0);
135 dc
.DrawLine(0, 1, w
, 1);
140 // Finder statusbar border color: (Project Builder similar is 9B9B9B)
141 dc
.SetPen(wxPen(wxColour(0xB1, 0xB1, 0xB1), 1, wxSOLID
));
143 dc
.SetPen(wxPen(wxColour(0x80, 0x80, 0x80), 1, wxSOLID
));
145 dc
.DrawLine(0, 0, w
, 0);
149 if ( GetFont().Ok() )
150 dc
.SetFont(GetFont());
151 dc
.SetBackgroundMode(wxTRANSPARENT
);
153 for ( i
= 0; i
< m_nFields
; i
++ )
157 void wxStatusBarMac::MacHiliteChanged()