]>
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
)
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 if ( !IsWindowHilited( MacGetRootWindow() ) )
61 dc
.SetTextForeground( wxColour( 0x80 , 0x80 , 0x80 ) ) ;
64 wxString
text(GetStatusText(i
));
68 dc
.GetTextExtent(text
, &x
, &y
);
70 int xpos
= rect
.x
+ leftMargin
+ 1 ;
73 dc
.SetClippingRegion(rect
.x
, 0, rect
.width
, m_height
);
75 dc
.DrawText(text
, xpos
, ypos
);
77 dc
.DestroyClippingRegion();
80 void wxStatusBarMac::DrawField(wxDC
& dc
, int i
)
85 void wxStatusBarMac::SetStatusText(const wxString
& text
, int number
)
87 wxCHECK_RET( (number
>= 0) && (number
< m_nFields
),
88 _T("invalid status bar field index") );
90 m_statusStrings
[number
] = text
;
92 GetFieldRect(number
, rect
);
93 Refresh( TRUE
, &rect
) ;
95 // TODO make clear work again also when using themes
97 dc.SetBackground( wxBrush(GetBackgroundColour(), wxSOLID) );
98 dc.SetClippingRegion( rect.x+1, rect.y+1, rect.width-1, rect.height-1 );
100 dc.DestroyClippingRegion();
101 DrawFieldText( dc, number );
106 void wxStatusBarMac::OnPaint(wxPaintEvent
& WXUNUSED(event
) )
110 if ( IsWindowHilited( MacGetRootWindow() ) )
112 wxPen
black( wxBLACK
, 1 , wxSOLID
) ;
113 wxPen
white( wxWHITE
, 1 , wxSOLID
) ;
124 dc
.SetPen(wxPen(wxColour(0x80,0x80,0x80),1,wxSOLID
));
130 if ( GetFont().Ok() )
131 dc
.SetFont(GetFont());
132 dc
.SetBackgroundMode(wxTRANSPARENT
);
134 for ( i
= 0; i
< m_nFields
; i
++ )
138 dc
.SetFont(wxNullFont
);
142 void wxStatusBarMac::MacSuperEnabled( bool enabled
)
145 wxWindow::MacSuperEnabled( enabled
) ;