]> git.saurik.com Git - wxWidgets.git/blob - src/mac/carbon/statbrma.cpp
changed wxSystemSettings::HasFrameDecorations to more general GetCapability(index)
[wxWidgets.git] / src / mac / carbon / statbrma.cpp
1 ///////////////////////////////////////////////////////////////////////////////
2 // Name: statbar.cpp
3 // Purpose: native implementation of wxStatusBar (optional)
4 // Author: AUTHOR
5 // Modified by:
6 // Created: ??/??/98
7 // RCS-ID: $Id$
8 // Copyright: (c) 1998 AUTHOR
9 // Licence: wxWindows licence
10 ///////////////////////////////////////////////////////////////////////////////
11
12 #ifdef __GNUG__
13 #pragma implementation "statbrma.h"
14 #endif
15
16 // ----------------------------------------------------------------------------
17 // headers
18 // ----------------------------------------------------------------------------
19
20 #include "wx/statusbr.h"
21 #include "wx/dc.h"
22 #include "wx/dcclient.h"
23
24 BEGIN_EVENT_TABLE(wxStatusBarMac, wxStatusBarGeneric)
25 EVT_PAINT(wxStatusBarMac::OnPaint)
26 END_EVENT_TABLE()
27
28 // ============================================================================
29 // implementation
30 // ============================================================================
31
32 // ----------------------------------------------------------------------------
33 // wxStatusBarMac class
34 // ----------------------------------------------------------------------------
35
36 wxStatusBarMac::wxStatusBarMac()
37 {
38 SetParent(NULL);
39 }
40
41 wxStatusBarMac::~wxStatusBarMac()
42 {
43 }
44
45 bool wxStatusBarMac::Create(wxWindow *parent, wxWindowID id,
46 long style ,
47 const wxString& name)
48 {
49 return wxStatusBarGeneric::Create( parent , id , style , name ) ;
50 }
51
52 void wxStatusBarMac::DrawFieldText(wxDC& dc, int i)
53 {
54 int leftMargin = 2;
55
56 wxRect rect;
57 GetFieldRect(i, rect);
58
59 wxString text(GetStatusText(i));
60
61 long x, y;
62
63 dc.GetTextExtent(text, &x, &y);
64
65 int xpos = rect.x + leftMargin + 1 ;
66 int ypos = 2 ;
67
68 dc.SetClippingRegion(rect.x, 0, rect.width, m_height);
69
70 dc.DrawText(text, xpos, ypos);
71
72 dc.DestroyClippingRegion();
73 }
74
75 void wxStatusBarMac::DrawField(wxDC& dc, int i)
76 {
77 DrawFieldText(dc, i);
78 }
79
80 void wxStatusBarMac::OnPaint(wxPaintEvent& WXUNUSED(event) )
81 {
82 wxPaintDC dc(this);
83 wxPen black( wxBLACK , 1 , wxSOLID ) ;
84 wxPen white( wxWHITE , 1 , wxSOLID ) ;
85
86 dc.SetPen(black);
87 dc.DrawLine(0, 0 ,
88 m_width , 0);
89 dc.SetPen(white);
90 dc.DrawLine(0, 1 ,
91 m_width , 1);
92
93
94 int i;
95 if ( GetFont().Ok() )
96 dc.SetFont(GetFont());
97 dc.SetBackgroundMode(wxTRANSPARENT);
98
99 for ( i = 0; i < m_nFields; i ++ )
100 DrawField(dc, i);
101
102 # ifdef __WXMSW__
103 dc.SetFont(wxNullFont);
104 # endif // MSW
105 }