#include "App.h" #include #include #include #include #include #include #include #include #include #include // quick and dirty function to quickly make text labels BStringView *MakeText(const char* text) { return new BStringView("rstr", text); } App::App(void) : BApplication("application/x-vnd.hex-Renga") { // Initialize BRect frame for window BRect frame(100, 100, 500, 400); // Initialize parent group for all UI elements to sit in. This is so they all get grouped nicely together BGroupLayout *pGroup = new BGroupLayout(B_HORIZONTAL); // Create window BWindow *window = new BWindow(frame, "Hello World!", B_TITLED_WINDOW, B_QUIT_ON_WINDOW_CLOSE); // Set window layout to parent group created earlier window->SetLayout(pGroup); // Initialize special "label" group for all of our labels BGroupLayout *lGroup = new BGroupLayout(B_HORIZONTAL, 100); // Add label group to parent group pGroup->AddItem(lGroup); // Center label group lGroup->SetExplicitAlignment(BAlignment(B_ALIGN_HORIZONTAL_CENTER, B_ALIGN_VERTICAL_CENTER)); // And finally, add allat labels!! lGroup->AddView(MakeText("label 1")); lGroup->AddView(MakeText("label 2")); lGroup->AddView(MakeText("label 3")); window->Show(); } int main(void) { App *app = new App(); app->Run(); delete app; return 0; }