]>
git.saurik.com Git - wxWidgets.git/blob - src/mac/carbon/statbrma.cpp
1 ///////////////////////////////////////////////////////////////////////////////
3 // Purpose: native implementation of wxStatusBar (optional)
4 // Author: Stefan Csomor
8 // Copyright: (c) 1998 Stefan Csomor
9 // Licence: wxWindows licence
10 ///////////////////////////////////////////////////////////////////////////////
12 #if defined(__GNUG__) && !defined(NO_GCC_PRAGMA)
13 #pragma implementation "statbrma.h"
16 // ----------------------------------------------------------------------------
18 // ----------------------------------------------------------------------------
20 #include "wx/wxprec.h"
22 #include "wx/statusbr.h"
24 #include "wx/dcclient.h"
26 BEGIN_EVENT_TABLE(wxStatusBarMac
, wxStatusBarGeneric
)
27 EVT_PAINT(wxStatusBarMac::OnPaint
)
31 #include "wx/mac/private.h"
32 #include "wx/toplevel.h"
35 // ============================================================================
37 // ============================================================================
39 // ----------------------------------------------------------------------------
40 // wxStatusBarMac class
41 // ----------------------------------------------------------------------------
43 wxStatusBarMac::wxStatusBarMac()
48 wxStatusBarMac::~wxStatusBarMac()
52 bool wxStatusBarMac::Create(wxWindow
*parent
, wxWindowID id
,
56 if( !wxStatusBarGeneric::Create( parent
, id
, style
, name
) )
59 if ( parent
->MacGetTopLevelWindow()->MacGetMetalAppearance() )
60 MacSetBackgroundBrush( wxNullBrush
) ;
62 // normal system font is too tall for fitting into the standard height
63 SetWindowVariant( wxWINDOW_VARIANT_SMALL
) ;
68 void wxStatusBarMac::DrawFieldText(wxDC
& dc
, int i
)
74 GetFieldRect(i
, rect
);
76 if ( !MacIsReallyHilited() )
78 dc
.SetTextForeground( wxColour( 0x80 , 0x80 , 0x80 ) ) ;
81 wxString
text(GetStatusText(i
));
85 dc
.GetTextExtent(text
, &x
, &y
);
87 int xpos
= rect
.x
+ leftMargin
+ 1 ;
90 if ( MacGetTopLevelWindow()->MacGetMetalAppearance() )
93 dc
.SetClippingRegion(rect
.x
, 0, rect
.width
, h
);
95 dc
.DrawText(text
, xpos
, ypos
);
97 dc
.DestroyClippingRegion();
100 void wxStatusBarMac::DrawField(wxDC
& dc
, int i
)
102 DrawFieldText(dc
, i
);
105 void wxStatusBarMac::SetStatusText(const wxString
& text
, int number
)
107 wxCHECK_RET( (number
>= 0) && (number
< m_nFields
),
108 _T("invalid status bar field index") );
110 if ( m_statusStrings
[number
] == text
)
113 m_statusStrings
[number
] = text
;
115 GetFieldRect(number
, rect
);
120 Refresh( TRUE
, &rect
) ;
124 void wxStatusBarMac::OnPaint(wxPaintEvent
& WXUNUSED(event
) )
130 wxGetOsVersion( &major
, &minor
);
134 if ( MacIsReallyHilited() )
136 wxPen
white( wxWHITE
, 1 , wxSOLID
) ;
139 //Finder statusbar border color: (Project builder similar is 9B9B9B)
140 if ( MacGetTopLevelWindow()->MacGetMetalAppearance() )
141 dc
.SetPen(wxPen(wxColour(0x40,40,40) ,1,wxSOLID
)) ;
143 dc
.SetPen(wxPen(wxColour(0xB1,0xB1,0xB1),1,wxSOLID
));
147 wxPen
black( wxBLACK
, 1 , wxSOLID
) ;
159 //Finder statusbar border color: (Project builder similar is 9B9B9B)
160 dc
.SetPen(wxPen(wxColour(0xB1,0xB1,0xB1),1,wxSOLID
));
162 dc
.SetPen(wxPen(wxColour(0x80,0x80,0x80),1,wxSOLID
));
169 if ( GetFont().Ok() )
170 dc
.SetFont(GetFont());
171 dc
.SetBackgroundMode(wxTRANSPARENT
);
173 for ( i
= 0; i
< m_nFields
; i
++ )
177 void wxStatusBarMac::MacHiliteChanged()