vfs: check userland buffers before reading them.
[haiku.git] / src / tests / servers / app / desktop_window / DesktopWindow.cpp
blob5f144ec0a4a647562081af3b7dee96e68b2100db
1 /*
2 * Copyright 2005, Haiku Inc.
3 * Distributed under the terms of the MIT License.
5 * Authors:
6 * Axel Dörfler, axeld@pinc-software.de
7 */
10 #include <Application.h>
11 #include <Window.h>
12 #include <View.h>
14 #include <WindowPrivate.h>
16 #include <stdio.h>
19 class View : public BView {
20 public:
21 View(BRect rect);
22 virtual ~View();
24 virtual void Draw(BRect updateRect);
28 View::View(BRect rect)
29 : BView(rect, "desktop view", B_FOLLOW_ALL, B_WILL_DRAW)
31 SetViewColor(100, 100, 100);
32 SetHighColor(0, 0, 0);
33 SetLowColor(ViewColor());
37 View::~View()
42 void
43 View::Draw(BRect updateRect)
45 MovePenTo(20, 30);
46 DrawString("Desktop Window");
50 // #pragma mark -
53 class Window : public BWindow {
54 public:
55 Window();
56 virtual ~Window();
58 virtual bool QuitRequested();
62 Window::Window()
63 : BWindow(BRect(100, 100, 400, 400), "DesktopWindow-Test",
64 (window_look)kDesktopWindowLook, (window_feel)kDesktopWindowFeel,
65 B_ASYNCHRONOUS_CONTROLS)
67 BView *view = new View(Bounds());
68 AddChild(view);
72 Window::~Window()
77 bool
78 Window::QuitRequested()
80 be_app->PostMessage(B_QUIT_REQUESTED);
81 return true;
85 // #pragma mark -
88 class Application : public BApplication {
89 public:
90 Application();
92 virtual void ReadyToRun();
96 Application::Application()
97 : BApplication("application/x-vnd.haiku-desktop_window")
102 void
103 Application::ReadyToRun()
105 Window *window = new Window();
106 window->Show();
110 // #pragma mark -
113 int
114 main(int argc, char **argv)
116 Application app;// app;
118 app.Run();
119 return 0;