1 /* 2 * Copyright 2009, Haiku Inc. All rights reserved. 3 * Distributed under the terms of the MIT License. 4 * 5 * Authors: 6 * Alexandre Deckner <alex@zappotek.com> 7 */ 8 9 #include "MainWindow.h" 10 #include "RenderView.h" 11 12 #include <Application.h> 13 #include <MenuBar.h> 14 #include <MenuItem.h> 15 16 #include <stdio.h> 17 18 MainWindow::MainWindow(BRect frame, const char* title) 19 : 20 BDirectWindow(frame, title, B_TITLED_WINDOW_LOOK, B_NORMAL_WINDOW_FEEL, 0) 21 { 22 fRenderView = new RenderView(Bounds()); 23 fRenderView->SetViewColor(0, 0, 0); 24 25 AddChild(fRenderView); 26 Show(); 27 } 28 29 30 MainWindow::~MainWindow() 31 { 32 } 33 34 35 bool 36 MainWindow::QuitRequested() 37 { 38 be_app->Lock(); 39 if (be_app->CountWindows() < 2) 40 be_app_messenger.SendMessage(B_QUIT_REQUESTED); 41 be_app->Unlock(); 42 return true; 43 } 44 45 46 void 47 MainWindow::MessageReceived(BMessage *message) 48 { 49 switch (message->what) { 50 default: 51 BDirectWindow::MessageReceived(message); 52 } 53 } 54 55 56 void 57 MainWindow::DirectConnected(direct_buffer_info* info) 58 { 59 fRenderView->DirectConnected(info); 60 } 61