annotate dwtestoo.cpp @ 2868:5ee1aaa48fc7

C++: The last signal handler change only worked with Clang/LLVM. Less desirable but cross platform solution, attach all signal handlers on widget creation, when called if not overridden remove the unused handler. Started the work of filling in the widget classes and functions.
author bsmith@81767d24-ef19-dc11-ae90-00e081727c95
date Sun, 18 Dec 2022 11:40:22 +0000
parents ada74f4d3f39
children c873b6f862b9
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
2868
5ee1aaa48fc7 C++: The last signal handler change only worked with Clang/LLVM.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 2867
diff changeset
3 class MyWindow : public DW::Window
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 }