]>
git.saurik.com Git - wxWidgets.git/blob - src/mac/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
)
29 #include "wx/mac/private.h"
32 // ============================================================================
34 // ============================================================================
36 // ----------------------------------------------------------------------------
37 // wxStatusBarMac class
38 // ----------------------------------------------------------------------------
40 wxStatusBarMac::wxStatusBarMac()
45 wxStatusBarMac::~wxStatusBarMac()
49 bool wxStatusBarMac::Create(wxWindow
*parent
, wxWindowID id
,
53 return wxStatusBarGeneric::Create( parent
, id
, style
, name
) ;
56 void wxStatusBarMac::DrawFieldText(wxDC
& dc
, int i
)
61 GetFieldRect(i
, rect
);
63 if ( !IsWindowHilited( MAC_WXHWND( MacGetRootWindow() ) ) )
65 dc
.SetTextForeground( wxColour( 0x80 , 0x80 , 0x80 ) ) ;
68 wxString
text(GetStatusText(i
));
72 dc
.GetTextExtent(text
, &x
, &y
);
74 int xpos
= rect
.x
+ leftMargin
+ 1 ;
77 dc
.SetClippingRegion(rect
.x
, 0, rect
.width
, m_height
);
79 dc
.DrawText(text
, xpos
, ypos
);
81 dc
.DestroyClippingRegion();
84 void wxStatusBarMac::DrawField(wxDC
& dc
, int i
)
89 void wxStatusBarMac::SetStatusText(const wxString
& text
, int number
)
91 wxCHECK_RET( (number
>= 0) && (number
< m_nFields
),
92 _T("invalid status bar field index") );
94 m_statusStrings
[number
] = text
;
96 GetFieldRect(number
, rect
);
97 Refresh( TRUE
, &rect
) ;
99 // TODO make clear work again also when using themes
101 dc.SetBackground( wxBrush(GetBackgroundColour(), wxSOLID) );
102 dc.SetClippingRegion( rect.x+1, rect.y+1, rect.width-1, rect.height-1 );
104 dc.DestroyClippingRegion();
105 DrawFieldText( dc, number );
110 void wxStatusBarMac::OnPaint(wxPaintEvent
& WXUNUSED(event
) )
114 if ( IsWindowHilited( MAC_WXHWND( MacGetRootWindow() ) ) )
116 wxPen
black( wxBLACK
, 1 , wxSOLID
) ;
117 wxPen
white( wxWHITE
, 1 , wxSOLID
) ;
128 dc
.SetPen(wxPen(wxColour(0x80,0x80,0x80),1,wxSOLID
));
134 if ( GetFont().Ok() )
135 dc
.SetFont(GetFont());
136 dc
.SetBackgroundMode(wxTRANSPARENT
);
138 for ( i
= 0; i
< m_nFields
; i
++ )
142 dc
.SetFont(wxNullFont
);
146 void wxStatusBarMac::MacSuperEnabled( bool enabled
)
149 wxWindow::MacSuperEnabled( enabled
) ;