annotate dwtestoo.cpp @ 2873:0bbfb19022e7

C++: GCC prior to 4.7 does not support the override keyword. So if using earlier versions of GCC, just remove override. This allows compilation on ancient GCC and GCC based Xcode. Also remove virtual from the application, I don't think it is needed and old GCC pukes on it when it is there.
author bsmith@81767d24-ef19-dc11-ae90-00e081727c95
date Mon, 19 Dec 2022 07:42:12 +0000
parents 4b7c4cd7a11d
children 99311a9091af
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
2869
c873b6f862b9 C++: Add text widget and packing to the window.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 2868
diff changeset
1 /*
c873b6f862b9 C++: Add text widget and packing to the window.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 2868
diff changeset
2 * Simple C++ Dynamic Windows Example
c873b6f862b9 C++: Add text widget and packing to the window.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 2868
diff changeset
3 */
2871
4b7c4cd7a11d OS2: Fix building the C++ bindings on OS/2 with GCC.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 2869
diff changeset
4 #include "dw.hpp"
2861
ef7a414f9b71 Add initial C++ binding header and example program.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5
2868
5ee1aaa48fc7 C++: The last signal handler change only worked with Clang/LLVM.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 2867
diff changeset
6 class MyWindow : public DW::Window
2861
ef7a414f9b71 Add initial C++ binding header and example program.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7 {
ef7a414f9b71 Add initial C++ binding header and example program.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8 public:
2869
c873b6f862b9 C++: Add text widget and packing to the window.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 2868
diff changeset
9 MyWindow() {
c873b6f862b9 C++: Add text widget and packing to the window.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 2868
diff changeset
10 SetText("Basic application");
c873b6f862b9 C++: Add text widget and packing to the window.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 2868
diff changeset
11 SetSize(200, 200);
c873b6f862b9 C++: Add text widget and packing to the window.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 2868
diff changeset
12 }
2873
0bbfb19022e7 C++: GCC prior to 4.7 does not support the override keyword.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 2871
diff changeset
13 int OnDelete() override { DW::App *app = DW::App::Init(); app->MainQuit(); return FALSE; }
0bbfb19022e7 C++: GCC prior to 4.7 does not support the override keyword.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 2871
diff changeset
14 int OnConfigure(int width, int height) override { return FALSE; }
2861
ef7a414f9b71 Add initial C++ binding header and example program.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
15 };
ef7a414f9b71 Add initial C++ binding header and example program.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
16
2869
c873b6f862b9 C++: Add text widget and packing to the window.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 2868
diff changeset
17 int dwmain(int argc, char* argv[])
2861
ef7a414f9b71 Add initial C++ binding header and example program.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
18 {
2869
c873b6f862b9 C++: Add text widget and packing to the window.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 2868
diff changeset
19 DW::App *app = DW::App::Init(argc, argv, "org.dbsoft.dwindows.dwtestoo");
c873b6f862b9 C++: Add text widget and packing to the window.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 2868
diff changeset
20 MyWindow *window = new MyWindow();
c873b6f862b9 C++: Add text widget and packing to the window.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 2868
diff changeset
21 DW::Text *text = new DW::Text("Test window");
c873b6f862b9 C++: Add text widget and packing to the window.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 2868
diff changeset
22
c873b6f862b9 C++: Add text widget and packing to the window.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 2868
diff changeset
23 window->PackStart(text, DW_SIZE_AUTO, DW_SIZE_AUTO, TRUE, TRUE, 0);
c873b6f862b9 C++: Add text widget and packing to the window.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 2868
diff changeset
24 text->SetStyle(DW_DT_CENTER | DW_DT_VCENTER, DW_DT_CENTER | DW_DT_VCENTER);
c873b6f862b9 C++: Add text widget and packing to the window.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 2868
diff changeset
25 window->Show();
2861
ef7a414f9b71 Add initial C++ binding header and example program.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
26
2869
c873b6f862b9 C++: Add text widget and packing to the window.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 2868
diff changeset
27 app->Main();
c873b6f862b9 C++: Add text widget and packing to the window.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 2868
diff changeset
28 app->Exit(0);
2861
ef7a414f9b71 Add initial C++ binding header and example program.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
29
2869
c873b6f862b9 C++: Add text widget and packing to the window.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 2868
diff changeset
30 return 0;
2861
ef7a414f9b71 Add initial C++ binding header and example program.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
31 }