1 | /***************************************************************
|
2 | * Name: rs232_plotterMain.cpp
|
3 | * Purpose: Code for Application Frame
|
4 | * Author: goaran (baer@dyyyh.de)
|
5 | * Created: 2009-07-21
|
6 | * Copyright: goaran (robotik.dyyyh.de)
|
7 | * License:
|
8 | **************************************************************/
|
9 |
|
10 | #include "rs232_plotterMain.h"
|
11 | #include "rs232.c"
|
12 | #include <wx/msgdlg.h>
|
13 | //(*InternalHeaders(rs232_plotterDialog)
|
14 | #include <wx/string.h>
|
15 | #include <wx/intl.h>
|
16 | //*)
|
17 |
|
18 | //helper functions
|
19 | enum wxbuildinfoformat {
|
20 | short_f, long_f };
|
21 |
|
22 | wxString wxbuildinfo(wxbuildinfoformat format)
|
23 | {
|
24 | wxString wxbuild(wxVERSION_STRING);
|
25 |
|
26 | if (format == long_f )
|
27 | {
|
28 | #if defined(__WXMSW__)
|
29 | wxbuild << _T("-Windows");
|
30 | #elif defined(__UNIX__)
|
31 | wxbuild << _T("-Linux");
|
32 | #endif
|
33 |
|
34 | #if wxUSE_UNICODE
|
35 | wxbuild << _T("-Unicode build");
|
36 | #else
|
37 | wxbuild << _T("-ANSI build");
|
38 | #endif // wxUSE_UNICODE
|
39 | }
|
40 |
|
41 | return wxbuild;
|
42 | }
|
43 |
|
44 | //(*IdInit(rs232_plotterDialog)
|
45 | const long rs232_plotterDialog::ID_BUTTON1 = wxNewId();
|
46 | const long rs232_plotterDialog::ID_TEXTCTRL1 = wxNewId();
|
47 | const long rs232_plotterDialog::text1 = wxNewId();
|
48 | //*)
|
49 |
|
50 | BEGIN_EVENT_TABLE(rs232_plotterDialog,wxDialog)
|
51 | //(*EventTable(rs232_plotterDialog)
|
52 | //*)
|
53 | END_EVENT_TABLE()
|
54 |
|
55 | rs232_plotterDialog::rs232_plotterDialog(wxWindow* parent,wxWindowID id)
|
56 | {
|
57 | //(*Initialize(rs232_plotterDialog)
|
58 | wxGridSizer* GridSizer1;
|
59 |
|
60 | Create(parent, wxID_ANY, _("wxWidgets app"), wxDefaultPosition, wxDefaultSize, wxDEFAULT_DIALOG_STYLE, _T("wxID_ANY"));
|
61 | GridSizer1 = new wxGridSizer(0, 3, 0, 0);
|
62 | Button1 = new wxButton(this, ID_BUTTON1, _("Open Port"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator, _T("ID_BUTTON1"));
|
63 | GridSizer1->Add(Button1, 1, wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5);
|
64 | TextCtrl1 = new wxTextCtrl(this, ID_TEXTCTRL1, _("Text"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator, _T("ID_TEXTCTRL1"));
|
65 | GridSizer1->Add(TextCtrl1, 1, wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5);
|
66 | StaticText1 = new wxStaticText(this, text1, _("Label"), wxDefaultPosition, wxDefaultSize, 0, _T("text1"));
|
67 | GridSizer1->Add(StaticText1, 1, wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5);
|
68 | SetSizer(GridSizer1);
|
69 | GridSizer1->Fit(this);
|
70 | GridSizer1->SetSizeHints(this);
|
71 |
|
72 | Connect(ID_BUTTON1,wxEVT_COMMAND_BUTTON_CLICKED,(wxObjectEventFunction)&rs232_plotterDialog::OnButton1Click);
|
73 | //*)
|
74 | }
|
75 |
|
76 | rs232_plotterDialog::~rs232_plotterDialog()
|
77 | {
|
78 | //(*Destroy(rs232_plotterDialog)
|
79 | //*)
|
80 | }
|
81 |
|
82 | void rs232_plotterDialog::OnQuit(wxCommandEvent& event)
|
83 | {
|
84 | Close();
|
85 | }
|
86 |
|
87 | void rs232_plotterDialog::OnAbout(wxCommandEvent& event)
|
88 | {
|
89 | wxString msg = wxbuildinfo(long_f);
|
90 | wxMessageBox(msg, _("Welcome to..."));
|
91 | }
|
92 |
|
93 | void rs232_plotterDialog::OnButton1Click(wxCommandEvent& event)
|
94 | {
|
95 | open_port();
|
96 | }
|