]> git.saurik.com Git - wxWidgets.git/blame - src/mac/stattext.cpp
virtualized m_row/col height/widths arrays
[wxWidgets.git] / src / mac / stattext.cpp
CommitLineData
e9576ca5
SC
1/////////////////////////////////////////////////////////////////////////////
2// Name: stattext.cpp
3// Purpose: wxStaticText
4// Author: AUTHOR
5// Modified by:
6// Created: 04/01/98
7// RCS-ID: $Id$
8// Copyright: (c) AUTHOR
9// Licence: wxWindows licence
10/////////////////////////////////////////////////////////////////////////////
11
12#ifdef __GNUG__
13#pragma implementation "stattext.h"
14#endif
15
16#include "wx/app.h"
17#include "wx/stattext.h"
18
19#include <stdio.h>
20
e9576ca5 21IMPLEMENT_DYNAMIC_CLASS(wxStaticText, wxControl)
e9576ca5 22
519cb848
SC
23#include <wx/mac/uma.h>
24
8208e181
SC
25BEGIN_EVENT_TABLE(wxStaticText, wxControl)
26 EVT_PAINT(wxStaticText::OnPaint)
27END_EVENT_TABLE()
28
29bool wxStaticText::Create(wxWindow *parent, wxWindowID id,
30 const wxString& label,
31 const wxPoint& pos,
32 const wxSize& size,
33 long style,
34 const wxString& name)
35{
36 SetName(name);
37 m_backgroundColour = parent->GetBackgroundColour() ;
38 m_foregroundColour = parent->GetForegroundColour() ;
39
40 if ( id == -1 )
41 m_windowId = (int)NewControlId();
42 else
43 m_windowId = id;
44
45 m_windowStyle = style;
46 m_label = label ;
47
48 bool ret = wxControl::Create( parent, id, pos, size, style , wxDefaultValidator , name );
49 SetSizeOrDefault( size ) ;
50
51 return ret;
52}
53
54void wxStaticText::OnPaint( wxPaintEvent &event )
55{
56 wxPaintDC dc(this);
57 PrepareDC(dc);
58 dc.Clear() ;
59 dc.DrawText( m_label , 0 , 0 ) ;
60}
61
62wxSize wxStaticText::DoGetBestSize() const
63{
64 int x , y ;
65 GetTextExtent( m_label , &x , &y ) ;
66 return wxSize( x , y ) ;
67}
68
69void wxStaticText::SetLabel(const wxString& st , bool resize )
70{
71 SetTitle( st ) ;
72 m_label = st ;
73 if ( resize )
74 SetSizeOrDefault() ;
75 else
76 Refresh() ;
77}
78/*
79void wxStaticText::SetSize(int x, int y, int width, int height, int sizeFlags)
80{
81 wxControl::SetSize( x , y , width , height , sizeFlags ) ;
82}
83
e9576ca5
SC
84bool wxStaticText::Create(wxWindow *parent, wxWindowID id,
85 const wxString& label,
86 const wxPoint& pos,
87 const wxSize& size,
88 long style,
89 const wxString& name)
90{
519cb848
SC
91 Rect bounds ;
92 Str255 title ;
93
94 MacPreControlCreate( parent , id , label , pos , size ,style, *((wxValidator*)NULL) , name , &bounds , title ) ;
95
96 m_macControl = UMANewControl( parent->GetMacRootWindow() , &bounds , "\p" , true , 0 , 0 , 1,
97 kControlStaticTextProc , (long) this ) ;
98 ::UMASetControlData( m_macControl, kControlLabelPart, kControlStaticTextTextTag , (long) title[0] , (char*) &title[1] ) ;
99
100 MacPostControlCreate() ;
101
102 return TRUE;
e9576ca5
SC
103}
104
519cb848 105void wxStaticText::SetLabel(const wxString& st , bool resize )
e9576ca5 106{
e7549107 107 SetTitle( st ) ;
519cb848
SC
108 wxString label ;
109
110 if( wxApp::s_macDefaultEncodingIsPC )
111 label = wxMacMakeMacStringFromPC( st ) ;
112 else
113 label = st ;
114
115 ::UMASetControlData( m_macControl, kControlLabelPart, kControlStaticTextTextTag , (long) label.Length() , (char*)(const char*) label ) ;
116 Refresh() ;
e9576ca5 117}
8208e181 118*/
e9576ca5 119