108cf72ceSDarkWyrm /* 2*e234c034SDarkWyrm * Copyright (c) 2005-2010, Haiku, Inc. 308cf72ceSDarkWyrm * Distributed under the terms of the MIT license. 408cf72ceSDarkWyrm * 508cf72ceSDarkWyrm * Author: 6*e234c034SDarkWyrm * DarkWyrm <darkwyrm@gmail.com> 708cf72ceSDarkWyrm */ 808cf72ceSDarkWyrm #include "ResWindow.h" 908cf72ceSDarkWyrm #include "ResView.h" 1008cf72ceSDarkWyrm #include "App.h" 1108cf72ceSDarkWyrm 12*e234c034SDarkWyrm static int32 sWindowCount = 0; 13*e234c034SDarkWyrm 1408cf72ceSDarkWyrm ResWindow::ResWindow(const BRect &rect, const entry_ref *ref) 1508cf72ceSDarkWyrm : BWindow(rect,"", B_DOCUMENT_WINDOW, B_ASYNCHRONOUS_CONTROLS) 1608cf72ceSDarkWyrm { 17*e234c034SDarkWyrm atomic_add(&sWindowCount,1); 1808cf72ceSDarkWyrm 193c3f84d1SStephan Aßmus ResView *child = new ResView(Bounds(), "resview", B_FOLLOW_ALL, 203c3f84d1SStephan Aßmus B_WILL_DRAW, ref); 2108cf72ceSDarkWyrm AddChild(child); 2208cf72ceSDarkWyrm 2308cf72ceSDarkWyrm SetTitle(child->Filename()); 243c3f84d1SStephan Aßmus 253c3f84d1SStephan Aßmus Show(); 2608cf72ceSDarkWyrm } 2708cf72ceSDarkWyrm 2808cf72ceSDarkWyrm 2908cf72ceSDarkWyrm ResWindow::~ResWindow(void) 3008cf72ceSDarkWyrm { 3108cf72ceSDarkWyrm } 3208cf72ceSDarkWyrm 3308cf72ceSDarkWyrm 3408cf72ceSDarkWyrm bool 3508cf72ceSDarkWyrm ResWindow::QuitRequested(void) 3608cf72ceSDarkWyrm { 37*e234c034SDarkWyrm atomic_add(&sWindowCount,-1); 38*e234c034SDarkWyrm 39*e234c034SDarkWyrm if (sWindowCount == 0) 40*e234c034SDarkWyrm be_app->PostMessage(B_QUIT_REQUESTED); 41*e234c034SDarkWyrm // be_app->PostMessage(M_UNREGISTER_WINDOW); 4208cf72ceSDarkWyrm return true; 4308cf72ceSDarkWyrm } 4408cf72ceSDarkWyrm 4508cf72ceSDarkWyrm 46