Mercurial > dwindows
annotate dwtestoo.cpp @ 2866:6ea67d0809eb
Convert DW::App class into a singleton so subsequent DW::App::Init() calls
will return a handle to our instance once it is already initialized.
author | bsmith@81767d24-ef19-dc11-ae90-00e081727c95 |
---|---|
date | Sat, 17 Dec 2022 11:51:22 +0000 |
parents | fd32dce7fecd |
children | ada74f4d3f39 |
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 |
ef7a414f9b71
Add initial C++ binding header and example program.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3 class MyWindow : public DW::Window |
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 } |
fd32dce7fecd
Initial signal handler support for the C++ bindings.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2864
diff
changeset
|
10 protected: |
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
|
11 virtual int OnDelete() { DW::App *app = DW::App::Init(); app->MainQuit(); return FALSE; } |
2865
fd32dce7fecd
Initial signal handler support for the C++ bindings.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2864
diff
changeset
|
12 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
|
13 }; |
ef7a414f9b71
Add initial C++ binding header and example program.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
14 |
2864
939fbceec13f
Win: Add support for building the C++ dwtestoo with Visual C.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2861
diff
changeset
|
15 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
|
16 { |
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
|
17 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
|
18 MyWindow *window = new MyWindow(); |
ef7a414f9b71
Add initial C++ binding header and example program.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
19 |
ef7a414f9b71
Add initial C++ binding header and example program.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
20 window->Show(); |
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 app->Main(); |
ef7a414f9b71
Add initial C++ binding header and example program.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
23 app->Exit(0); |
ef7a414f9b71
Add initial C++ binding header and example program.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
24 |
ef7a414f9b71
Add initial C++ binding header and example program.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
25 return 0; |
ef7a414f9b71
Add initial C++ binding header and example program.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
26 } |