summaryrefslogtreecommitdiffstats
path: root/Source/WXDialog/wxCMakeSetup.cxx
diff options
context:
space:
mode:
authorAndy Cedilnik <andy.cedilnik@kitware.com>2002-09-19 13:47:18 (GMT)
committerAndy Cedilnik <andy.cedilnik@kitware.com>2002-09-19 13:47:18 (GMT)
commitf1d40eef93220d502fca94667a64188f7f9fe094 (patch)
tree6c480cc04fce7b1706ba87c848eb129ae5288e14 /Source/WXDialog/wxCMakeSetup.cxx
parent0dafd886fc719b5fbb0d56f30262ba09c76a160b (diff)
downloadCMake-f1d40eef93220d502fca94667a64188f7f9fe094.zip
CMake-f1d40eef93220d502fca94667a64188f7f9fe094.tar.gz
CMake-f1d40eef93220d502fca94667a64188f7f9fe094.tar.bz2
Initial import of wxWindows dialog
Diffstat (limited to 'Source/WXDialog/wxCMakeSetup.cxx')
-rw-r--r--Source/WXDialog/wxCMakeSetup.cxx174
1 files changed, 174 insertions, 0 deletions
diff --git a/Source/WXDialog/wxCMakeSetup.cxx b/Source/WXDialog/wxCMakeSetup.cxx
new file mode 100644
index 0000000..6097681
--- /dev/null
+++ b/Source/WXDialog/wxCMakeSetup.cxx
@@ -0,0 +1,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)