]>
git.saurik.com Git - wxWidgets.git/blob - src/mac/carbon/statbrma.cpp
1 ///////////////////////////////////////////////////////////////////////////////
3 // Purpose: native implementation of wxStatusBar (optional)
8 // Copyright: (c) 1998 AUTHOR
9 // Licence: wxWindows licence
10 ///////////////////////////////////////////////////////////////////////////////
13 #pragma implementation "statbrma.h"
16 // ----------------------------------------------------------------------------
18 // ----------------------------------------------------------------------------
20 #include "wx/statusbr.h"
22 #include "wx/dcclient.h"
24 BEGIN_EVENT_TABLE(wxStatusBarMac
, wxStatusBarGeneric
)
25 EVT_PAINT(wxStatusBarMac::OnPaint
)
28 // ============================================================================
30 // ============================================================================
32 // ----------------------------------------------------------------------------
33 // wxStatusBarMac class
34 // ----------------------------------------------------------------------------
36 wxStatusBarMac::wxStatusBarMac()
41 wxStatusBarMac::~wxStatusBarMac()
45 bool wxStatusBarMac::Create(wxWindow
*parent
, wxWindowID id
,
49 return wxStatusBarGeneric::Create( parent
, id
, style
, name
) ;
52 void wxStatusBarMac::DrawFieldText(wxDC
& dc
, int i
)
57 GetFieldRect(i
, rect
);
59 wxString
text(GetStatusText(i
));
63 dc
.GetTextExtent(text
, &x
, &y
);
65 int xpos
= rect
.x
+ leftMargin
+ 1 ;
68 dc
.SetClippingRegion(rect
.x
, 0, rect
.width
, m_height
);
70 dc
.DrawText(text
, xpos
, ypos
);
72 dc
.DestroyClippingRegion();
75 void wxStatusBarMac::DrawField(wxDC
& dc
, int i
)
80 void wxStatusBarMac::SetStatusText(const wxString
& text
, int number
)
82 wxCHECK_RET( (number
>= 0) && (number
< m_nFields
),
83 _T("invalid status bar field index") );
85 m_statusStrings
[number
] = text
;
87 GetFieldRect(number
, rect
);
88 Refresh( TRUE
, &rect
) ;
90 // TODO make clear work again also when using themes
92 dc.SetBackground( wxBrush(GetBackgroundColour(), wxSOLID) );
93 dc.SetClippingRegion( rect.x+1, rect.y+1, rect.width-1, rect.height-1 );
95 dc.DestroyClippingRegion();
96 DrawFieldText( dc, number );
101 void wxStatusBarMac::OnPaint(wxPaintEvent
& WXUNUSED(event
) )
104 wxPen
black( wxBLACK
, 1 , wxSOLID
) ;
105 wxPen
white( wxWHITE
, 1 , wxSOLID
) ;
116 if ( GetFont().Ok() )
117 dc
.SetFont(GetFont());
118 dc
.SetBackgroundMode(wxTRANSPARENT
);
120 for ( i
= 0; i
< m_nFields
; i
++ )
124 dc
.SetFont(wxNullFont
);