1#include <Application.h> 2#include <Window.h> 3#include <Box.h> 4 5 6class View : public BView { 7 public: 8 View(BRect frame); 9 10 virtual void FrameMoved(BPoint location); 11}; 12 13 14View::View(BRect frame) 15 : BView(frame, NULL, B_FOLLOW_NONE, B_FRAME_EVENTS) 16{ 17 MoveBy(5, 5); 18} 19 20 21void 22View::FrameMoved(BPoint point) 23{ 24 point.PrintToStream(); 25} 26 27 28// #pragma mark - 29 30 31class Window : public BWindow { 32 public: 33 Window(); 34 virtual ~Window(); 35 36 virtual bool QuitRequested(); 37 virtual void FrameResized(float width, float height); 38}; 39 40 41Window::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*/) 44{ 45 Show(); 46 47 snooze(500000); // .5 secs 48 49 Bounds().PrintToStream(); 50 ResizeTo(55, 55); 51 Bounds().PrintToStream(); 52 53 snooze(500000); // .5 secs 54 55 SetSizeLimits(5, 500, 5, 500); 56 ResizeTo(5, 5); 57 Bounds().PrintToStream(); 58 59 snooze(500000); // .5 secs 60 61 SetSizeLimits(80, 500, 80, 500); 62 Bounds().PrintToStream(); 63} 64 65 66Window::~Window() 67{ 68} 69 70 71void 72Window::FrameResized(float width, float height) 73{ 74 CurrentMessage()->PrintToStream(); 75} 76 77 78bool 79Window::QuitRequested() 80{ 81 be_app->PostMessage(B_QUIT_REQUESTED); 82 return true; 83} 84 85 86// #pragma mark - 87 88 89class Application : public BApplication { 90 public: 91 Application(); 92 93 virtual void ReadyToRun(void); 94}; 95 96 97Application::Application() 98 : BApplication("application/x-vnd.haiku.resizelimits-test") 99{ 100 Window *window = new Window(); 101 window->Show(); 102} 103 104 105void 106Application::ReadyToRun(void) 107{ 108} 109 110 111int 112main(int argc, char **argv) 113{ 114 Application app; 115 app.Run(); 116 117 return 0; 118} 119