From a4ef4a49150f118d47324242917a596a3f8f8bd5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stephan=20A=C3=9Fmus?= Date: Tue, 20 Jan 2009 09:27:41 +0000 Subject: [PATCH] Beginnings of a test app that shows all Interface Kit controls in various configurations so that one can work better on the look. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@28966 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/tests/kits/interface/Jamfile | 1 + src/tests/kits/interface/look/Jamfile | 6 ++ src/tests/kits/interface/look/Look.cpp | 78 ++++++++++++++++++++++++++ 3 files changed, 85 insertions(+) create mode 100644 src/tests/kits/interface/look/Jamfile create mode 100644 src/tests/kits/interface/look/Look.cpp diff --git a/src/tests/kits/interface/Jamfile b/src/tests/kits/interface/Jamfile index 6790b05604..23ed910c2c 100644 --- a/src/tests/kits/interface/Jamfile +++ b/src/tests/kits/interface/Jamfile @@ -150,6 +150,7 @@ SubInclude HAIKU_TOP src tests kits interface bfont ; SubInclude HAIKU_TOP src tests kits interface bshelf ; SubInclude HAIKU_TOP src tests kits interface flatten_picture ; SubInclude HAIKU_TOP src tests kits interface layout ; +SubInclude HAIKU_TOP src tests kits interface look ; SubInclude HAIKU_TOP src tests kits interface picture ; SubInclude HAIKU_TOP src tests kits interface pictureprint ; diff --git a/src/tests/kits/interface/look/Jamfile b/src/tests/kits/interface/look/Jamfile new file mode 100644 index 0000000000..f7c82f9f8e --- /dev/null +++ b/src/tests/kits/interface/look/Jamfile @@ -0,0 +1,6 @@ +SubDir HAIKU_TOP src tests kits interface look ; + +SimpleTest LookTest : + Look.cpp + : be + ; diff --git a/src/tests/kits/interface/look/Look.cpp b/src/tests/kits/interface/look/Look.cpp new file mode 100644 index 0000000000..83377615c1 --- /dev/null +++ b/src/tests/kits/interface/look/Look.cpp @@ -0,0 +1,78 @@ +/* + * Copyright 2009, Stephan Aßmus . All rights reserved. + * Distributed under the terms of the MIT License. + */ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + + +template +void +add_controls(BGridLayout* layout, int32& row) +{ + ControlType* control1 = new ControlType("Enabled", NULL); + ControlType* control2 = new ControlType("Disabled", NULL); + control2->SetEnabled(false); + ControlType* control3 = new ControlType("On", NULL); + control3->SetValue(B_CONTROL_ON); + + layout->AddView(control1, 0, row); + layout->AddView(control2, 1, row); + layout->AddView(control3, 2, row); + + row++; +} + + +int +main(int argc, char** argv) +{ + BApplication app("application/x-vnd.haiku-look"); + + BWindow* window = new BWindow(BRect(50, 50, 100, 100), + "Look at these pretty controls!", B_TITLED_WINDOW, + B_ASYNCHRONOUS_CONTROLS | B_AUTO_UPDATE_SIZE_LIMITS + | B_QUIT_ON_WINDOW_CLOSE); + + window->SetLayout(new BGroupLayout(B_HORIZONTAL)); + + // create some controls + + BGridView* view = new BGridView(5.0f, 5.0f); + BGridLayout* layout = view->GridLayout(); + layout->SetInsets(5, 5, 5, 5); + view->SetExplicitMaxSize(BSize(B_SIZE_UNLIMITED, B_SIZE_UNLIMITED)); + + int32 row = 0; + add_controls(layout, row); + add_controls(layout, row); + add_controls(layout, row); + + window->AddChild(view); + + window->Show(); + app.Run(); + return 0; +} +