]> git.saurik.com Git - wxWidgets.git/blob - contrib/samples/foldbar/foldpanelbar/test.cpp
Applied [ 1283696 ] wxDC::GetPartialTextExtents crashes on empty strings
[wxWidgets.git] / contrib / samples / foldbar / foldpanelbar / test.cpp
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: test.cpp
3 // Purpose:
4 // Author: Jorgen Bodde
5 // Modified by:
6 // Created: 27/06/2004
7 // RCS-ID: $Id$
8 // Copyright: (c) Jorgen Bodde
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
11
12 #if defined(__GNUG__) && !defined(__APPLE__)
13 #pragma implementation "test.h"
14 #endif
15
16 // For compilers that support precompilation, includes "wx/wx.h".
17 #include "wx/wxprec.h"
18
19 #ifdef __BORLANDC__
20 #pragma hdrstop
21 #endif
22
23 #ifndef WX_PRECOMP
24 #include "wx/wx.h"
25 #endif
26
27 ////@begin includes
28 ////@end includes
29
30 #include "test.h"
31
32 ////@begin XPM images
33 ////@end XPM images
34
35 /*!
36 * TestTest type definition
37 */
38
39 IMPLEMENT_CLASS( TestTest, wxDialog )
40
41 /*!
42 * TestTest event table definition
43 */
44
45 BEGIN_EVENT_TABLE( TestTest, wxDialog )
46
47 ////@begin TestTest event table entries
48 ////@end TestTest event table entries
49
50 END_EVENT_TABLE()
51
52 /*!
53 * TestTest constructors
54 */
55
56 TestTest::TestTest( )
57 {
58 }
59
60 TestTest::TestTest( wxWindow* parent, wxWindowID id, const wxString& caption, const wxPoint& pos, const wxSize& size, long style )
61 {
62 Create(parent, id, caption, pos, size, style);
63 }
64
65 /*!
66 * TestTest creator
67 */
68
69 bool TestTest::Create( wxWindow* parent, wxWindowID id, const wxString& caption, const wxPoint& pos, const wxSize& size, long style )
70 {
71 ////@begin TestTest member initialisation
72 blaat = NULL;
73 blaat = NULL;
74 ////@end TestTest member initialisation
75
76 ////@begin TestTest creation
77 SetExtraStyle(GetExtraStyle()|wxWS_EX_BLOCK_EVENTS);
78 wxDialog::Create( parent, id, caption, pos, size, style );
79
80 CreateControls();
81 GetSizer()->Fit(this);
82 GetSizer()->SetSizeHints(this);
83 Centre();
84 ////@end TestTest creation
85 return true;
86 }
87
88 /*!
89 * Control creation for TestTest
90 */
91
92 void TestTest::CreateControls()
93 {
94 ////@begin TestTest content construction
95
96 TestTest* item1 = this;
97
98 wxFlexGridSizer* item2 = new wxFlexGridSizer(2, 1, 0, 0);
99 item2->AddGrowableRow(0);
100 item2->AddGrowableCol(0);
101 item1->SetSizer(item2);
102 item1->SetAutoLayout(true);
103 wxPanel* item3 = new wxPanel( item1, ID_PANEL7, wxDefaultPosition, wxSize(100, 50), wxNO_BORDER|wxTAB_TRAVERSAL );
104 item2->Add(item3, 1, wxGROW|wxGROW|wxADJUST_MINSIZE, 5);
105 wxBoxSizer* item4 = new wxBoxSizer(wxVERTICAL);
106 item3->SetSizer(item4);
107 item3->SetAutoLayout(true);
108 wxPanel* item5 = new wxPanel( item3, ID_PANEL6, wxDefaultPosition, wxSize(100, 80), wxSUNKEN_BORDER|wxNO_FULL_REPAINT_ON_RESIZE|wxTAB_TRAVERSAL );
109 item4->Add(item5, 1, wxGROW|wxALL|wxADJUST_MINSIZE, 5);
110 wxFlexGridSizer* item6 = new wxFlexGridSizer(2, 1, 0, 0);
111 item6->AddGrowableRow(1);
112 item6->AddGrowableCol(0);
113 item5->SetSizer(item6);
114 item5->SetAutoLayout(true);
115 wxStaticText* item7 = new wxStaticText( item5, wxID_STATIC, _("Static text"), wxDefaultPosition, wxDefaultSize, 0 );
116 item6->Add(item7, 0, wxALIGN_CENTER_HORIZONTAL|wxGROW|wxALL|wxADJUST_MINSIZE, 5);
117 wxPanel* item8 = new wxPanel( item5, ID_PANEL3, wxDefaultPosition, wxSize(100, 80), wxSUNKEN_BORDER|wxTAB_TRAVERSAL );
118 item6->Add(item8, 1, wxGROW|wxGROW|wxALL, 5);
119 wxBoxSizer* item9 = new wxBoxSizer(wxVERTICAL);
120 blaat = item9;
121 item8->SetSizer(item9);
122 item8->SetAutoLayout(true);
123 wxPanel* item10 = new wxPanel( item8, ID_PANEL, wxDefaultPosition, wxDefaultSize, wxNO_BORDER|wxFULL_REPAINT_ON_RESIZE|wxTAB_TRAVERSAL );
124 item9->Add(item10, 1, wxGROW, 5);
125 wxBoxSizer* item11 = new wxBoxSizer(wxVERTICAL);
126 item10->SetSizer(item11);
127 item10->SetAutoLayout(true);
128 wxString item12Strings[] = {
129 _("One"),
130 _("Two"),
131 _("Three")
132 };
133 wxChoice* item12 = new wxChoice( item10, ID_CHOICE, wxDefaultPosition, wxDefaultSize, 3, item12Strings, 0 );
134 item11->Add(item12, 0, wxGROW|wxALL, 5);
135 wxRadioButton* item13 = new wxRadioButton( item10, ID_RADIOBUTTON, _("I like this"), wxDefaultPosition, wxDefaultSize, 0 );
136 item13->SetValue(true);
137 item11->Add(item13, 0, wxALIGN_LEFT|wxALL, 5);
138 wxRadioButton* item14 = new wxRadioButton( item10, ID_RADIOBUTTON1, _("I hate it"), wxDefaultPosition, wxDefaultSize, 0 );
139 item14->SetValue(false);
140 item11->Add(item14, 0, wxALIGN_LEFT|wxALL, 5);
141 wxPanel* item15 = new wxPanel( item3, ID_PANEL2, wxDefaultPosition, wxSize(100, 80), wxSUNKEN_BORDER|wxNO_FULL_REPAINT_ON_RESIZE|wxTAB_TRAVERSAL );
142 item4->Add(item15, 1, wxGROW|wxALL|wxADJUST_MINSIZE, 5);
143 wxFlexGridSizer* item16 = new wxFlexGridSizer(2, 1, 0, 0);
144 item16->AddGrowableRow(1);
145 item16->AddGrowableCol(0);
146 item15->SetSizer(item16);
147 item15->SetAutoLayout(true);
148 wxStaticText* item17 = new wxStaticText( item15, wxID_STATIC, _("Static text"), wxDefaultPosition, wxDefaultSize, 0 );
149 item16->Add(item17, 0, wxALIGN_CENTER_HORIZONTAL|wxGROW|wxALL|wxADJUST_MINSIZE|wxFIXED_MINSIZE, 5);
150 wxPanel* item18 = new wxPanel( item15, ID_PANEL4, wxDefaultPosition, wxSize(100, 80), wxSUNKEN_BORDER|wxTAB_TRAVERSAL );
151 item16->Add(item18, 0, wxGROW|wxGROW|wxALL, 5);
152 wxBoxSizer* item19 = new wxBoxSizer(wxVERTICAL);
153 blaat = item19;
154 item18->SetSizer(item19);
155 item18->SetAutoLayout(true);
156 wxPanel* item20 = new wxPanel( item18, ID_PANEL5, wxDefaultPosition, wxDefaultSize, wxNO_BORDER|wxFULL_REPAINT_ON_RESIZE|wxTAB_TRAVERSAL );
157 item19->Add(item20, 1, wxGROW, 5);
158 wxBoxSizer* item21 = new wxBoxSizer(wxVERTICAL);
159 item20->SetSizer(item21);
160 item20->SetAutoLayout(true);
161 wxString item22Strings[] = {
162 _("One"),
163 _("Two"),
164 _("Three")
165 };
166 wxChoice* item22 = new wxChoice( item20, ID_CHOICE1, wxDefaultPosition, wxDefaultSize, 3, item22Strings, 0 );
167 item21->Add(item22, 0, wxGROW|wxALL, 5);
168 wxRadioButton* item23 = new wxRadioButton( item20, ID_RADIOBUTTON2, _("I like this"), wxDefaultPosition, wxDefaultSize, 0 );
169 item23->SetValue(true);
170 item21->Add(item23, 0, wxALIGN_LEFT|wxALL, 5);
171 wxRadioButton* item24 = new wxRadioButton( item20, ID_RADIOBUTTON3, _("I hate it"), wxDefaultPosition, wxDefaultSize, 0 );
172 item24->SetValue(false);
173 item21->Add(item24, 0, wxALIGN_LEFT|wxALL, 5);
174 wxPanel* item25 = new wxPanel( item1, ID_PANEL1, wxDefaultPosition, wxSize(100, 20), wxNO_BORDER|wxTAB_TRAVERSAL );
175 item25->SetBackgroundColour(wxColour(98, 98, 98));
176 item2->Add(item25, 0, wxGROW|wxGROW|wxFIXED_MINSIZE, 5);
177 ////@end TestTest content construction
178 }
179
180 /*!
181 * Should we show tooltips?
182 */
183
184 bool TestTest::ShowToolTips()
185 {
186 return true;
187 }
188
189 /*!
190 * Get bitmap resources
191 */
192
193 wxBitmap TestTest::GetBitmapResource( const wxString& WXUNUSED(name) )
194 {
195 // Bitmap retrieval
196 ////@begin TestTest bitmap retrieval
197 return wxNullBitmap;
198 ////@end TestTest bitmap retrieval
199 }
200
201 /*!
202 * Get icon resources
203 */
204
205 wxIcon TestTest::GetIconResource( const wxString& WXUNUSED(name) )
206 {
207 // Icon retrieval
208 ////@begin TestTest icon retrieval
209 return wxNullIcon;
210 ////@end TestTest icon retrieval
211 }