Mercurial > dwindows
annotate dwtestoo.cpp @ 2865:fd32dce7fecd
Initial signal handler support for the C++ bindings.
Need to may App a singleton so we don't require a global "app" variable.
Also need to only attach signal handlers to overloaded callback functions.
author | bsmith@81767d24-ef19-dc11-ae90-00e081727c95 |
---|---|
date | Sat, 17 Dec 2022 09:03:32 +0000 |
parents | 939fbceec13f |
children | 6ea67d0809eb |
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 |
2865
fd32dce7fecd
Initial signal handler support for the C++ bindings.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2864
diff
changeset
|
3 DW::App *app; |
fd32dce7fecd
Initial signal handler support for the C++ bindings.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2864
diff
changeset
|
4 |
2861
ef7a414f9b71
Add initial C++ binding header and example program.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5 class MyWindow : public DW::Window |
ef7a414f9b71
Add initial C++ binding header and example program.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6 { |
ef7a414f9b71
Add initial C++ binding header and example program.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7 public: |
2865
fd32dce7fecd
Initial signal handler support for the C++ bindings.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2864
diff
changeset
|
8 MyWindow() { |
fd32dce7fecd
Initial signal handler support for the C++ bindings.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2864
diff
changeset
|
9 SetText("Basic application"); |
fd32dce7fecd
Initial signal handler support for the C++ bindings.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2864
diff
changeset
|
10 SetSize(200, 200); |
fd32dce7fecd
Initial signal handler support for the C++ bindings.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2864
diff
changeset
|
11 } |
fd32dce7fecd
Initial signal handler support for the C++ bindings.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2864
diff
changeset
|
12 protected: |
fd32dce7fecd
Initial signal handler support for the C++ bindings.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2864
diff
changeset
|
13 virtual int OnDelete() { app->MainQuit(); return FALSE; } |
fd32dce7fecd
Initial signal handler support for the C++ bindings.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2864
diff
changeset
|
14 virtual int OnConfigure(int width, int height) { 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 |
2864
939fbceec13f
Win: Add support for building the C++ dwtestoo with Visual C.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2861
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 { |
2865
fd32dce7fecd
Initial signal handler support for the C++ bindings.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2864
diff
changeset
|
19 app = new DW::App(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
|
20 MyWindow *window = new MyWindow(); |
ef7a414f9b71
Add initial C++ binding header and example program.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
21 |
ef7a414f9b71
Add initial C++ binding header and example program.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
22 window->Show(); |
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 app->Main(); |
ef7a414f9b71
Add initial C++ binding header and example program.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
25 app->Exit(0); |
ef7a414f9b71
Add initial C++ binding header and example program.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
26 |
ef7a414f9b71
Add initial C++ binding header and example program.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
27 return 0; |
ef7a414f9b71
Add initial C++ binding header and example program.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
28 } |