headers/bsd: Add sys/queue.h.
[haiku.git] / src / tests / servers / app / resize_limits / ResizeLimits.cpp
blob170477dfbea98335d618a6101ef512bcb28600f1
1 #include <Application.h>
2 #include <Window.h>
3 #include <Box.h>
6 class View : public BView {
7 public:
8 View(BRect frame);
10 virtual void FrameMoved(BPoint location);
14 View::View(BRect frame)
15 : BView(frame, NULL, B_FOLLOW_NONE, B_FRAME_EVENTS)
17 MoveBy(5, 5);
21 void
22 View::FrameMoved(BPoint point)
24 point.PrintToStream();
28 // #pragma mark -
31 class Window : public BWindow {
32 public:
33 Window();
34 virtual ~Window();
36 virtual bool QuitRequested();
37 virtual void FrameResized(float width, float height);
41 Window::Window()
42 : BWindow(BRect(100, 100, 101, 101), "Test", /*B_TITLED_WINDOW*/ B_DOCUMENT_WINDOW
43 /*B_BORDERED_WINDOW*/, B_NOT_ZOOMABLE /*| B_NOT_RESIZABLE*/)
45 Show();
47 snooze(500000); // .5 secs
49 Bounds().PrintToStream();
50 ResizeTo(55, 55);
51 Bounds().PrintToStream();
53 snooze(500000); // .5 secs
55 SetSizeLimits(5, 500, 5, 500);
56 ResizeTo(5, 5);
57 Bounds().PrintToStream();
59 snooze(500000); // .5 secs
61 SetSizeLimits(80, 500, 80, 500);
62 Bounds().PrintToStream();
66 Window::~Window()
71 void
72 Window::FrameResized(float width, float height)
74 CurrentMessage()->PrintToStream();
78 bool
79 Window::QuitRequested()
81 be_app->PostMessage(B_QUIT_REQUESTED);
82 return true;
86 // #pragma mark -
89 class Application : public BApplication {
90 public:
91 Application();
93 virtual void ReadyToRun(void);
97 Application::Application()
98 : BApplication("application/x-vnd.haiku.resizelimits-test")
100 Window *window = new Window();
101 window->Show();
105 void
106 Application::ReadyToRun(void)
111 int
112 main(int argc, char **argv)
114 Application app;
115 app.Run();
117 return 0;