Mercurial > dwindows
view dwtestoo.cpp @ 2869:c873b6f862b9
C++: Add text widget and packing to the window.
Also reformat both files using spaces instead of tabs.
author | bsmith@81767d24-ef19-dc11-ae90-00e081727c95 |
---|---|
date | Sun, 18 Dec 2022 12:13:46 +0000 |
parents | 5ee1aaa48fc7 |
children | 4b7c4cd7a11d |
line wrap: on
line source
/* * Simple C++ Dynamic Windows Example */ #include <dw.hpp> class MyWindow : public DW::Window { public: MyWindow() { SetText("Basic application"); SetSize(200, 200); } virtual int OnDelete() override { DW::App *app = DW::App::Init(); app->MainQuit(); return FALSE; } virtual int OnConfigure(int width, int height) override { return FALSE; } }; int dwmain(int argc, char* argv[]) { DW::App *app = DW::App::Init(argc, argv, "org.dbsoft.dwindows.dwtestoo"); MyWindow *window = new MyWindow(); DW::Text *text = new DW::Text("Test window"); window->PackStart(text, DW_SIZE_AUTO, DW_SIZE_AUTO, TRUE, TRUE, 0); text->SetStyle(DW_DT_CENTER | DW_DT_VCENTER, DW_DT_CENTER | DW_DT_VCENTER); window->Show(); app->Main(); app->Exit(0); return 0; }