1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
|
/*=========================================================================
Program: Insight Segmentation & Registration Toolkit
Module: $RCSfile$
Language: C++
Date: $Date$
Version: $Revision$
Copyright (c) 2002 Insight Consortium. All rights reserved.
See ITKCopyright.txt or http://www.itk.org/HTML/Copyright.htm for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notices for more information.
=========================================================================*/
// wxCMakeSetup.cxx : implementation file
//
#include "cmSystemTools.h"
#include "cmWXCommandLineInfo.h"
#include "cmWXMainFrame.h"
class wxCMakeSetup : public wxApp
{
public:
virtual bool OnInit();
virtual int OnExit();
};
class testFrame : public wxFrame
{
public:
testFrame(const wxString& title, const wxSize& size)
: wxFrame((wxFrame*)NULL, 0, title, wxDefaultPosition, size)
{
wxPanel *panel = new wxPanel(this, -1);
wxSizer *sizer = new wxBoxSizer(wxHORIZONTAL);
wxWindow *value = new wxStaticText(panel, -1, "Some label");
sizer->Add(value, 1, wxALIGN_CENTER_VERTICAL );
value = new wxButton(panel, -1, "Button", wxDefaultPosition, wxSize(25, 0));
sizer->Add(value, 0, wxALIGN_RIGHT);
panel->SetAutoLayout( TRUE );
panel->SetSizer(sizer);
sizer->Fit(panel);
sizer->SetSizeHints(panel);
sizer->Layout();
}
};
class testFrame1 : public wxFrame
{
public:
testFrame1(const wxString& title, const wxSize& size)
: wxFrame((wxFrame*)NULL, 0, title, wxDefaultPosition, size)
{
wxPanel *panel = new wxPanel(this, -1);
panel->SetBackgroundColour(*wxRED);
wxSizer *sizer = new wxFlexGridSizer(2, 5, 5);
wxWindow *value = 0;
int cc;
for ( cc = 0; cc < 4; cc ++ )
{
char buffer[200];
sprintf(buffer, "Long, Long Label; this label should be "
"bigger than button %d",cc);
value = new wxStaticText(panel, -1, buffer);
sizer->Add(value, 1, wxGROW | wxALL );
sprintf(buffer, "Button %d", cc);
value = new wxButton(panel, -1, buffer);
sizer->Add(value, 1, wxGROW | wxALL );
}
panel->SetAutoLayout( TRUE );
panel->SetSizer(sizer);
sizer->Fit(panel);
sizer->SetSizeHints(panel);
sizer->Layout();
}
};
class testFrame2 : public wxFrame
{
public:
testFrame2(const wxString& title, const wxSize& size)
: wxFrame((wxFrame*)NULL, 0, title, wxDefaultPosition, size)
{
wxPanel *panel = new wxPanel(this, -1);
panel->SetBackgroundColour(*wxRED);
wxTextCtrl * text = new wxTextCtrl(panel, -1, "Test", wxPoint(40, 5));
wxButton * bt = new wxButton(panel, -1, "Test", wxPoint(-1, 5));
}
};
class testFrame3 : public wxFrame
{
public:
testFrame3(const wxString& title, const wxSize& size)
: wxFrame((wxFrame*)NULL, 0, title, wxDefaultPosition, size)
{
this->CreateStatusBar();
this->SetSizeHints(300, 300);
wxPanel *panel = new wxPanel(this, -1);
wxSizer *sizer = new wxFlexGridSizer(2, 5, 5);
wxWindow *value = 0;
int cc;
for ( cc = 0; cc < 10; cc ++ )
{
char buffer[200];
sprintf(buffer, "Label %d",cc);
value = new wxStaticText(panel, -1, buffer);
sizer->Add(value, 1, wxGROW | wxALL );
sprintf(buffer, "Button %d", cc);
value = new wxButton(panel, -1, buffer);
sizer->Add(value, 1, wxGROW | wxALL );
value->SetClientData(this);
value->Connect(-1, wxEVT_MOTION,
(wxObjectEventFunction) &testFrame3::OnStatusBar);
}
panel->SetAutoLayout( TRUE );
panel->SetSizer(sizer);
sizer->Fit(panel);
sizer->SetSizeHints(panel);
sizer->Layout();
}
void OnStatusBar(wxEvent& event)
{
wxControl* eobject = static_cast<wxControl*>(event.GetEventObject());
testFrame3* self = static_cast<testFrame3*>(eobject->GetClientData());
wxString str;
const char* chars = "|-\\/jg@_^";
char ch = chars[((int)eobject)/1024 % strlen(chars)];
int cc;
for ( cc = 0; cc < 10; cc ++ )
{
str += ch;
}
self->SetStatusText(str);
}
};
bool wxCMakeSetup::OnInit()
{
cmSystemTools::DisableRunCommandOutput();
cmCommandLineInfo cm;
cm.SetValidArguments("ABGH");
cm.ParseCommandLine(wxApp::argc, wxApp::argv);
this->SetVendorName("Andy");
this->SetAppName("CMakeSetup");
cmMainFrame *frame = new cmMainFrame("CMake", wxSize(200, 100));
frame->Initialize(&cm);
//wxFrame *frame = new testFrame("CMake", wxSize(200, 100));
//wxFrame *frame = new testFrame1("Frame", wxSize(200, 100));
//wxFrame *frame = new testFrame2("Frame", wxSize(200, 100));
//wxFrame *frame = new testFrame3("Frame", wxSize(200, 100));
frame->Show(TRUE);
this->SetTopWindow(frame);
return TRUE;
}
int wxCMakeSetup::OnExit()
{
// clean up: Set() returns the active config object as Get() does, but unlike
// Get() it doesn't try to create one if there is none (definitely not what
// we want here!)
//delete wxConfigBase::Set((wxConfigBase *) NULL);
return 0;
}
IMPLEMENT_APP(wxCMakeSetup)
|