]> git.saurik.com Git - wxWidgets.git/blame - src/mac/carbon/statbrma.cpp
corrected dynamic class implementation
[wxWidgets.git] / src / mac / carbon / statbrma.cpp
CommitLineData
ee6b1d97
SC
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__
b142515e 13#pragma implementation "statbrma.h"
ee6b1d97
SC
14#endif
15
16// ----------------------------------------------------------------------------
17// headers
18// ----------------------------------------------------------------------------
19
03e11df5
GD
20#include "wx/statusbr.h"
21#include "wx/dc.h"
22#include "wx/dcclient.h"
ee6b1d97 23
ee6b1d97
SC
24BEGIN_EVENT_TABLE(wxStatusBarMac, wxStatusBarGeneric)
25 EVT_PAINT(wxStatusBarMac::OnPaint)
26END_EVENT_TABLE()
ee6b1d97
SC
27
28// ============================================================================
29// implementation
30// ============================================================================
31
32// ----------------------------------------------------------------------------
03e11df5 33// wxStatusBarMac class
ee6b1d97
SC
34// ----------------------------------------------------------------------------
35
36wxStatusBarMac::wxStatusBarMac()
37{
38 SetParent(NULL);
39}
40
41wxStatusBarMac::~wxStatusBarMac()
42{
43}
44
45bool wxStatusBarMac::Create(wxWindow *parent, wxWindowID id,
46 long style ,
47 const wxString& name)
48{
49 return wxStatusBarGeneric::Create( parent , id , style , name ) ;
50}
51
52void 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
75void wxStatusBarMac::DrawField(wxDC& dc, int i)
76{
77 DrawFieldText(dc, i);
78}
79
80void 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
03e11df5 105}