]> git.saurik.com Git - wxWidgets.git/blame_incremental - src/mac/statbrma.cpp
updated mac sources (CW 5.3 working , CW6 still having code gen problems)
[wxWidgets.git] / src / mac / statbrma.cpp
... / ...
CommitLineData
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 "statusbr.h"
14#endif
15
16// ----------------------------------------------------------------------------
17// headers
18// ----------------------------------------------------------------------------
19
20#include "wx/mac/statusbr.h"
21
22#if !USE_SHARED_LIBRARY
23IMPLEMENT_DYNAMIC_CLASS(wxStatusBarMac, wxStatusBarGeneric);
24
25BEGIN_EVENT_TABLE(wxStatusBarMac, wxStatusBarGeneric)
26 EVT_PAINT(wxStatusBarMac::OnPaint)
27END_EVENT_TABLE()
28#endif //USE_SHARED_LIBRARY
29
30
31// ============================================================================
32// implementation
33// ============================================================================
34
35// ----------------------------------------------------------------------------
36// wxStatusBarXX class
37// ----------------------------------------------------------------------------
38
39wxStatusBarMac::wxStatusBarMac()
40{
41 SetParent(NULL);
42}
43
44wxStatusBarMac::~wxStatusBarMac()
45{
46}
47
48bool wxStatusBarMac::Create(wxWindow *parent, wxWindowID id,
49 long style ,
50 const wxString& name)
51{
52 return wxStatusBarGeneric::Create( parent , id , style , name ) ;
53}
54
55void wxStatusBarMac::DrawFieldText(wxDC& dc, int i)
56{
57 int leftMargin = 2;
58
59 wxRect rect;
60 GetFieldRect(i, rect);
61
62 wxString text(GetStatusText(i));
63
64 long x, y;
65
66 dc.GetTextExtent(text, &x, &y);
67
68 int xpos = rect.x + leftMargin + 1 ;
69 int ypos = 2 ;
70
71 dc.SetClippingRegion(rect.x, 0, rect.width, m_height);
72
73 dc.DrawText(text, xpos, ypos);
74
75 dc.DestroyClippingRegion();
76}
77
78void wxStatusBarMac::DrawField(wxDC& dc, int i)
79{
80 DrawFieldText(dc, i);
81}
82
83void wxStatusBarMac::OnPaint(wxPaintEvent& WXUNUSED(event) )
84{
85 wxPaintDC dc(this);
86 wxPen black( wxBLACK , 1 , wxSOLID ) ;
87 wxPen white( wxWHITE , 1 , wxSOLID ) ;
88
89 dc.SetPen(black);
90 dc.DrawLine(0, 0 ,
91 m_width , 0);
92 dc.SetPen(white);
93 dc.DrawLine(0, 1 ,
94 m_width , 1);
95
96
97 int i;
98 if ( GetFont().Ok() )
99 dc.SetFont(GetFont());
100 dc.SetBackgroundMode(wxTRANSPARENT);
101
102 for ( i = 0; i < m_nFields; i ++ )
103 DrawField(dc, i);
104
105# ifdef __WXMSW__
106 dc.SetFont(wxNullFont);
107# endif // MSW
108}