]>
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 m_statusStrings
[number
] = text
;
112 GetFieldRect(number
, rect
);
117 Refresh( TRUE
, &rect
) ;
121 void wxStatusBarMac::OnPaint(wxPaintEvent
& WXUNUSED(event
) )
127 wxGetOsVersion( &major
, &minor
);
131 if ( MacIsReallyHilited() )
133 wxPen
white( wxWHITE
, 1 , wxSOLID
) ;
136 //Finder statusbar border color: (Project builder similar is 9B9B9B)
137 if ( MacGetTopLevelWindow()->MacGetMetalAppearance() )
138 dc
.SetPen(wxPen(wxColour(0x40,40,40) ,1,wxSOLID
)) ;
140 dc
.SetPen(wxPen(wxColour(0xB1,0xB1,0xB1),1,wxSOLID
));
144 wxPen
black( wxBLACK
, 1 , wxSOLID
) ;
156 //Finder statusbar border color: (Project builder similar is 9B9B9B)
157 dc
.SetPen(wxPen(wxColour(0xB1,0xB1,0xB1),1,wxSOLID
));
159 dc
.SetPen(wxPen(wxColour(0x80,0x80,0x80),1,wxSOLID
));
166 if ( GetFont().Ok() )
167 dc
.SetFont(GetFont());
168 dc
.SetBackgroundMode(wxTRANSPARENT
);
170 for ( i
= 0; i
< m_nFields
; i
++ )
174 void wxStatusBarMac::MacHiliteChanged()