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

#include <dw.hpp>

DW::App *app;

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

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

  window->Show();

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

  return 0;
}