view 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
line wrap: on
line source

#include <dw.hpp>

class MyWindow : public DW::Window
{
public:
  MyWindow() {
	SetText("Basic application");
	SetSize(200, 200);
	}
protected:
	virtual int OnDelete() { DW::App *app = DW::App::Init(); app->MainQuit(); return FALSE; }
	virtual int OnConfigure(int width, int height)  { return FALSE; }
};

int dwmain(int argc, char* argv[])
{
  DW::App *app = DW::App::Init(argc, argv, "org.dbsoft.dwindows.dwtestoo");
  MyWindow *window = new MyWindow();

  window->Show();

  app->Main();
  app->Exit(0);

  return 0;
}