annotate dwtestoo.cpp @ 2867:ada74f4d3f39

C++: Implement conditional signal handlers based on overrides. This uses templates in a sort of hacky way to determine if our virtual functions have been overridden. Leaving some debug code in for the moment to make sure it works on all platforms. OS/2 will require using GCC for the C++ bindings, since VisualAge only supports C++99 and Watcom doesn't even support that as far as I know.
author bsmith@81767d24-ef19-dc11-ae90-00e081727c95
date Sat, 17 Dec 2022 21:39:00 +0000
parents 6ea67d0809eb
children 5ee1aaa48fc7
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
2861
ef7a414f9b71 Add initial C++ binding header and example program.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1 #include <dw.hpp>
ef7a414f9b71 Add initial C++ binding header and example program.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2
2867
ada74f4d3f39 C++: Implement conditional signal handlers based on overrides.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 2866
diff changeset
3 class MyWindow : public DW::Window<MyWindow>
2861
ef7a414f9b71 Add initial C++ binding header and example program.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4 {
ef7a414f9b71 Add initial C++ binding header and example program.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5 public:
2865
fd32dce7fecd Initial signal handler support for the C++ bindings.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 2864
diff changeset
6 MyWindow() {
fd32dce7fecd Initial signal handler support for the C++ bindings.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 2864
diff changeset
7 SetText("Basic application");
fd32dce7fecd Initial signal handler support for the C++ bindings.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 2864
diff changeset
8 SetSize(200, 200);
fd32dce7fecd Initial signal handler support for the C++ bindings.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 2864
diff changeset
9 }
2867
ada74f4d3f39 C++: Implement conditional signal handlers based on overrides.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 2866
diff changeset
10 virtual int OnDelete() override { DW::App *app = DW::App::Init(); app->MainQuit(); return FALSE; }
ada74f4d3f39 C++: Implement conditional signal handlers based on overrides.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 2866
diff changeset
11 virtual 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
12 };
ef7a414f9b71 Add initial C++ binding header and example program.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
13
2864
939fbceec13f Win: Add support for building the C++ dwtestoo with Visual C.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 2861
diff changeset
14 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
15 {
2866
6ea67d0809eb Convert DW::App class into a singleton so subsequent DW::App::Init() calls
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 2865
diff changeset
16 DW::App *app = DW::App::Init(argc, argv, "org.dbsoft.dwindows.dwtestoo");
2861
ef7a414f9b71 Add initial C++ binding header and example program.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
17 MyWindow *window = new MyWindow();
ef7a414f9b71 Add initial C++ binding header and example program.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
18
ef7a414f9b71 Add initial C++ binding header and example program.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
19 window->Show();
ef7a414f9b71 Add initial C++ binding header and example program.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
20
ef7a414f9b71 Add initial C++ binding header and example program.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
21 app->Main();
ef7a414f9b71 Add initial C++ binding header and example program.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
22 app->Exit(0);
ef7a414f9b71 Add initial C++ binding header and example program.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
23
ef7a414f9b71 Add initial C++ binding header and example program.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
24 return 0;
ef7a414f9b71 Add initial C++ binding header and example program.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
25 }