xref: /haiku/src/tests/kits/interface/ChannelSliderTest.cpp (revision 508f54795f39c3e7552d87c95aae9dd8ec6f505b)
1 #include <Application.h>
2 #include <ChannelSlider.h>
3 #include <Window.h>
4 
5 class MainWindow : public BWindow {
6 public:
7 	MainWindow()
8 		:BWindow(BRect(50, 50, 250, 360), "window", B_TITLED_WINDOW, B_ASYNCHRONOUS_CONTROLS)
9 	{
10 		BChannelSlider *slider = new BChannelSlider(BRect(10, 10, 20, 20),
11 			"vertical slider", "Verticalp", new BMessage('test'), 4);
12 		slider->SetOrientation(B_VERTICAL);
13 		AddChild(slider);
14 		slider->ResizeToPreferred();
15 
16 		slider = new BChannelSlider(BRect(10, 10, 20, 20), "vertical slider",
17 			"Verticalp", new BMessage('test'), B_VERTICAL,  4);
18 		AddChild(slider);
19 		slider->SetLimitLabels("Wminp", "Wmaxp");
20 		slider->ResizeToPreferred();
21 		slider->MoveBy(slider->Bounds().Width() + 10.0, 0.0);
22 
23 		BChannelSlider *horizontal = new BChannelSlider(BRect(150, 10, 160, 20),
24 			 "horizontal slider", "Horizontal", new BMessage('test'), 3);
25 		AddChild(horizontal);
26 		horizontal->ResizeToPreferred();
27 
28 		horizontal = new BChannelSlider(BRect(150, 10, 160, 20),
29 			 "horizontal slider", "Horizontalp", new BMessage('test'),
30 			 B_HORIZONTAL, 3);
31 		AddChild(horizontal);
32 		horizontal->SetLimitLabels("Wminp", "Wmaxp");
33 		horizontal->ResizeToPreferred();
34 		horizontal->MoveBy(0.0, horizontal->Bounds().Height() + 10.0);
35 
36 		ResizeTo(horizontal->Frame().right + 10, slider->Frame().bottom + 10);
37 	}
38 
39 	virtual bool QuitRequested() { be_app->PostMessage(B_QUIT_REQUESTED); return BWindow::QuitRequested() ; }
40 };
41 
42 
43 class App : public BApplication {
44 public:
45 	App() : BApplication("application/x-vnd.channelslidertest")
46 	{
47 	}
48 
49 	virtual void ReadyToRun()
50 	{
51 		(new MainWindow())->Show();
52 	}
53 
54 };
55 
56 int main()
57 {
58 	App app;
59 
60 	app.Run();
61 
62 	return 0;
63 }
64