]>
Commit | Line | Data |
---|---|---|
1 | ///////////////////////////////////////////////////////////////////////////// | |
2 | // Name: src/palmos/stattext.cpp | |
3 | // Purpose: wxStaticText | |
4 | // Author: William Osborne - minimal working wxPalmOS port | |
5 | // Modified by: Wlodzimierz ABX Skiba - native wxStaticText implementation | |
6 | // Created: 10/13/04 | |
7 | // RCS-ID: $Id$ | |
8 | // Copyright: (c) William Osborne, Wlodzimierz Skiba | |
9 | // Licence: wxWindows licence | |
10 | ///////////////////////////////////////////////////////////////////////////// | |
11 | ||
12 | // For compilers that support precompilation, includes "wx.h". | |
13 | #include "wx/wxprec.h" | |
14 | ||
15 | #ifdef __BORLANDC__ | |
16 | #pragma hdrstop | |
17 | #endif | |
18 | ||
19 | #if wxUSE_STATTEXT | |
20 | ||
21 | #include "wx/stattext.h" | |
22 | ||
23 | #ifndef WX_PRECOMP | |
24 | #include "wx/event.h" | |
25 | #include "wx/app.h" | |
26 | #include "wx/brush.h" | |
27 | #endif | |
28 | ||
29 | #include <Field.h> | |
30 | ||
31 | #if wxUSE_EXTENDED_RTTI | |
32 | WX_DEFINE_FLAGS( wxStaticTextStyle ) | |
33 | ||
34 | wxBEGIN_FLAGS( wxStaticTextStyle ) | |
35 | // new style border flags, we put them first to | |
36 | // use them for streaming out | |
37 | wxFLAGS_MEMBER(wxBORDER_SIMPLE) | |
38 | wxFLAGS_MEMBER(wxBORDER_SUNKEN) | |
39 | wxFLAGS_MEMBER(wxBORDER_DOUBLE) | |
40 | wxFLAGS_MEMBER(wxBORDER_RAISED) | |
41 | wxFLAGS_MEMBER(wxBORDER_STATIC) | |
42 | wxFLAGS_MEMBER(wxBORDER_NONE) | |
43 | ||
44 | // old style border flags | |
45 | wxFLAGS_MEMBER(wxSIMPLE_BORDER) | |
46 | wxFLAGS_MEMBER(wxSUNKEN_BORDER) | |
47 | wxFLAGS_MEMBER(wxDOUBLE_BORDER) | |
48 | wxFLAGS_MEMBER(wxRAISED_BORDER) | |
49 | wxFLAGS_MEMBER(wxSTATIC_BORDER) | |
50 | wxFLAGS_MEMBER(wxBORDER) | |
51 | ||
52 | // standard window styles | |
53 | wxFLAGS_MEMBER(wxTAB_TRAVERSAL) | |
54 | wxFLAGS_MEMBER(wxCLIP_CHILDREN) | |
55 | wxFLAGS_MEMBER(wxTRANSPARENT_WINDOW) | |
56 | wxFLAGS_MEMBER(wxWANTS_CHARS) | |
57 | wxFLAGS_MEMBER(wxFULL_REPAINT_ON_RESIZE) | |
58 | wxFLAGS_MEMBER(wxALWAYS_SHOW_SB ) | |
59 | wxFLAGS_MEMBER(wxVSCROLL) | |
60 | wxFLAGS_MEMBER(wxHSCROLL) | |
61 | ||
62 | wxFLAGS_MEMBER(wxST_NO_AUTORESIZE) | |
63 | wxFLAGS_MEMBER(wxALIGN_LEFT) | |
64 | wxFLAGS_MEMBER(wxALIGN_RIGHT) | |
65 | wxFLAGS_MEMBER(wxALIGN_CENTRE) | |
66 | ||
67 | wxEND_FLAGS( wxStaticTextStyle ) | |
68 | ||
69 | IMPLEMENT_DYNAMIC_CLASS_XTI(wxStaticText, wxControl,"wx/stattext.h") | |
70 | ||
71 | wxBEGIN_PROPERTIES_TABLE(wxStaticText) | |
72 | wxPROPERTY( Label,wxString, SetLabel, GetLabel, wxString() , 0 /*flags*/ , wxT("Helpstring") , wxT("group")) | |
73 | wxPROPERTY_FLAGS( WindowStyle , wxStaticTextStyle , long , SetWindowStyleFlag , GetWindowStyleFlag , EMPTY_MACROVALUE, 0 /*flags*/ , wxT("Helpstring") , wxT("group")) // style | |
74 | wxEND_PROPERTIES_TABLE() | |
75 | ||
76 | wxBEGIN_HANDLERS_TABLE(wxStaticText) | |
77 | wxEND_HANDLERS_TABLE() | |
78 | ||
79 | wxCONSTRUCTOR_6( wxStaticText , wxWindow* , Parent , wxWindowID , Id , wxString , Label , wxPoint , Position , wxSize , Size , long , WindowStyle ) | |
80 | #else | |
81 | IMPLEMENT_DYNAMIC_CLASS(wxStaticText, wxControl) | |
82 | #endif | |
83 | ||
84 | bool wxStaticText::Create(wxWindow *parent, | |
85 | wxWindowID id, | |
86 | const wxString& label, | |
87 | const wxPoint& pos, | |
88 | const wxSize& size, | |
89 | long style, | |
90 | const wxString& name) | |
91 | { | |
92 | if(!wxControl::Create(parent, id, pos, size, style, wxDefaultValidator, name)) | |
93 | return false; | |
94 | ||
95 | // note that wxALIGN_LEFT is equal to 0 so we shouldn't | |
96 | // test for it using & operator | |
97 | ||
98 | JustificationType align = leftAlign; | |
99 | ||
100 | if ( style & wxALIGN_CENTRE ) | |
101 | align = centerAlign ; | |
102 | else if ( style & wxALIGN_RIGHT ) | |
103 | align = rightAlign; | |
104 | ||
105 | return wxControl::PalmCreateField(label, pos, size, false, false, align); | |
106 | } | |
107 | ||
108 | wxBorder wxStaticText::GetDefaultBorder() const | |
109 | { | |
110 | return wxBORDER_NONE; | |
111 | } | |
112 | ||
113 | wxSize wxStaticText::DoGetBestSize() const | |
114 | { | |
115 | return wxSize(0,0); | |
116 | } | |
117 | ||
118 | bool wxStaticText::SetFont(const wxFont& font) | |
119 | { | |
120 | return false; | |
121 | } | |
122 | ||
123 | #endif // wxUSE_STATTEXT |