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