]>
Commit | Line | Data |
---|---|---|
2bda0e17 | 1 | ///////////////////////////////////////////////////////////////////////////// |
3f2711d5 | 2 | // Name: msw/statbox.cpp |
2bda0e17 KB |
3 | // Purpose: wxStaticBox |
4 | // Author: Julian Smart | |
5 | // Modified by: | |
6 | // Created: 04/01/98 | |
7 | // RCS-ID: $Id$ | |
6c9a19aa | 8 | // Copyright: (c) Julian Smart |
65571936 | 9 | // Licence: wxWindows licence |
2bda0e17 KB |
10 | ///////////////////////////////////////////////////////////////////////////// |
11 | ||
3f2711d5 VZ |
12 | // ============================================================================ |
13 | // declarations | |
14 | // ============================================================================ | |
15 | ||
16 | // ---------------------------------------------------------------------------- | |
17 | // headers | |
18 | // ---------------------------------------------------------------------------- | |
19 | ||
14f355c2 | 20 | #if defined(__GNUG__) && !defined(NO_GCC_PRAGMA) |
3f2711d5 | 21 | #pragma implementation "statbox.h" |
2bda0e17 KB |
22 | #endif |
23 | ||
24 | // For compilers that support precompilation, includes "wx.h". | |
25 | #include "wx/wxprec.h" | |
26 | ||
27 | #ifdef __BORLANDC__ | |
3f2711d5 | 28 | #pragma hdrstop |
2bda0e17 KB |
29 | #endif |
30 | ||
1e6feb95 VZ |
31 | #if wxUSE_STATBOX |
32 | ||
2bda0e17 | 33 | #ifndef WX_PRECOMP |
3f2711d5 VZ |
34 | #include "wx/app.h" |
35 | #include "wx/dcclient.h" | |
2bda0e17 KB |
36 | #endif |
37 | ||
38 | #include "wx/statbox.h" | |
3ad70d31 | 39 | #include "wx/notebook.h" |
2bda0e17 | 40 | |
3f2711d5 VZ |
41 | #include "wx/msw/private.h" |
42 | ||
e31e6ea7 VZ |
43 | // under CE this style is not defined but we don't need to make static boxes |
44 | // transparent there neither | |
301e257b VZ |
45 | #ifndef WS_EX_TRANSPARENT |
46 | #define WS_EX_TRANSPARENT 0 | |
47 | #endif | |
48 | ||
3f2711d5 VZ |
49 | // ---------------------------------------------------------------------------- |
50 | // wxWin macros | |
51 | // ---------------------------------------------------------------------------- | |
52 | ||
51741307 | 53 | #if wxUSE_EXTENDED_RTTI |
bc9fb572 JS |
54 | WX_DEFINE_FLAGS( wxStaticBoxStyle ) |
55 | ||
3ff066a4 | 56 | wxBEGIN_FLAGS( wxStaticBoxStyle ) |
bc9fb572 JS |
57 | // new style border flags, we put them first to |
58 | // use them for streaming out | |
3ff066a4 SC |
59 | wxFLAGS_MEMBER(wxBORDER_SIMPLE) |
60 | wxFLAGS_MEMBER(wxBORDER_SUNKEN) | |
61 | wxFLAGS_MEMBER(wxBORDER_DOUBLE) | |
62 | wxFLAGS_MEMBER(wxBORDER_RAISED) | |
63 | wxFLAGS_MEMBER(wxBORDER_STATIC) | |
64 | wxFLAGS_MEMBER(wxBORDER_NONE) | |
57f4f925 | 65 | |
bc9fb572 | 66 | // old style border flags |
3ff066a4 SC |
67 | wxFLAGS_MEMBER(wxSIMPLE_BORDER) |
68 | wxFLAGS_MEMBER(wxSUNKEN_BORDER) | |
69 | wxFLAGS_MEMBER(wxDOUBLE_BORDER) | |
70 | wxFLAGS_MEMBER(wxRAISED_BORDER) | |
71 | wxFLAGS_MEMBER(wxSTATIC_BORDER) | |
cb0afb26 | 72 | wxFLAGS_MEMBER(wxBORDER) |
bc9fb572 JS |
73 | |
74 | // standard window styles | |
3ff066a4 SC |
75 | wxFLAGS_MEMBER(wxTAB_TRAVERSAL) |
76 | wxFLAGS_MEMBER(wxCLIP_CHILDREN) | |
77 | wxFLAGS_MEMBER(wxTRANSPARENT_WINDOW) | |
78 | wxFLAGS_MEMBER(wxWANTS_CHARS) | |
cb0afb26 | 79 | wxFLAGS_MEMBER(wxFULL_REPAINT_ON_RESIZE) |
3ff066a4 SC |
80 | wxFLAGS_MEMBER(wxALWAYS_SHOW_SB ) |
81 | wxFLAGS_MEMBER(wxVSCROLL) | |
82 | wxFLAGS_MEMBER(wxHSCROLL) | |
bc9fb572 | 83 | |
3ff066a4 | 84 | wxEND_FLAGS( wxStaticBoxStyle ) |
bc9fb572 | 85 | |
51741307 SC |
86 | IMPLEMENT_DYNAMIC_CLASS_XTI(wxStaticBox, wxControl,"wx/statbox.h") |
87 | ||
3ff066a4 | 88 | wxBEGIN_PROPERTIES_TABLE(wxStaticBox) |
57f4f925 | 89 | wxPROPERTY( Label,wxString, SetLabel, GetLabel, wxString() , 0 /*flags*/ , wxT("Helpstring") , wxT("group")) |
af498247 | 90 | wxPROPERTY_FLAGS( WindowStyle , wxStaticBoxStyle , long , SetWindowStyleFlag , GetWindowStyleFlag , EMPTY_MACROVALUE, 0 /*flags*/ , wxT("Helpstring") , wxT("group")) // style |
066f1b7a | 91 | /* |
57f4f925 WS |
92 | TODO PROPERTIES : |
93 | label | |
066f1b7a | 94 | */ |
3ff066a4 | 95 | wxEND_PROPERTIES_TABLE() |
51741307 | 96 | |
3ff066a4 SC |
97 | wxBEGIN_HANDLERS_TABLE(wxStaticBox) |
98 | wxEND_HANDLERS_TABLE() | |
51741307 | 99 | |
57f4f925 | 100 | wxCONSTRUCTOR_6( wxStaticBox , wxWindow* , Parent , wxWindowID , Id , wxString , Label , wxPoint , Position , wxSize , Size , long , WindowStyle ) |
51741307 SC |
101 | #else |
102 | IMPLEMENT_DYNAMIC_CLASS(wxStaticBox, wxControl) | |
103 | #endif | |
2bda0e17 | 104 | |
3f2711d5 VZ |
105 | // ============================================================================ |
106 | // implementation | |
107 | // ============================================================================ | |
108 | ||
109 | // ---------------------------------------------------------------------------- | |
110 | // wxStaticBox | |
111 | // ---------------------------------------------------------------------------- | |
112 | ||
113 | bool wxStaticBox::Create(wxWindow *parent, | |
114 | wxWindowID id, | |
115 | const wxString& label, | |
116 | const wxPoint& pos, | |
117 | const wxSize& size, | |
118 | long style, | |
119 | const wxString& name) | |
2bda0e17 | 120 | { |
11b6a93b | 121 | if ( !CreateControl(parent, id, pos, size, style, wxDefaultValidator, name) ) |
57f4f925 | 122 | return false; |
2bda0e17 | 123 | |
e31e6ea7 | 124 | if ( !MSWCreateControl(wxT("BUTTON"), label, pos, size) ) |
57f4f925 | 125 | return false; |
2bda0e17 | 126 | |
57f4f925 | 127 | return true; |
2bda0e17 KB |
128 | } |
129 | ||
e31e6ea7 VZ |
130 | WXDWORD wxStaticBox::MSWGetStyle(long style, WXDWORD *exstyle) const |
131 | { | |
132 | long styleWin = wxStaticBoxBase::MSWGetStyle(style, exstyle); | |
133 | ||
134 | if ( exstyle ) | |
135 | *exstyle = WS_EX_TRANSPARENT; | |
136 | ||
137 | return styleWin | BS_GROUPBOX; | |
138 | } | |
139 | ||
f68586e5 | 140 | wxSize wxStaticBox::DoGetBestSize() const |
2bda0e17 | 141 | { |
4438caf4 | 142 | int cx, cy; |
7a5e53ab | 143 | wxGetCharSize(GetHWND(), &cx, &cy, GetFont()); |
2bda0e17 | 144 | |
4438caf4 VZ |
145 | int wBox; |
146 | GetTextExtent(wxGetWindowText(m_hWnd), &wBox, &cy); | |
2bda0e17 | 147 | |
4438caf4 VZ |
148 | wBox += 3*cx; |
149 | int hBox = EDIT_HEIGHT_FROM_CHAR_HEIGHT(cy); | |
2bda0e17 | 150 | |
4438caf4 VZ |
151 | return wxSize(wBox, hBox); |
152 | } | |
2bda0e17 | 153 | |
1e6feb95 | 154 | #endif // wxUSE_STATBOX |