2 * Copyright (c) 2005-2010, Haiku, Inc.
3 * Distributed under the terms of the MIT license.
6 * DarkWyrm <darkwyrm@gmail.com>
15 static int32 sWindowCount
= 0;
17 ResWindow::ResWindow(const BRect
&rect
, const entry_ref
*ref
)
18 : BWindow(rect
, "", B_DOCUMENT_WINDOW
, B_ASYNCHRONOUS_CONTROLS
)
20 atomic_add(&sWindowCount
, 1);
22 fView
= new ResView(Bounds(), "resview", B_FOLLOW_ALL
, B_WILL_DRAW
, ref
);
28 ResWindow::~ResWindow(void)
34 ResWindow::QuitRequested(void)
36 if (fView
->GetSaveStatus() == FILE_DIRTY
) {
37 BAlert
*alert
= new BAlert("ResEdit", "Save changes before closing?",
38 "Cancel", "Don't save", "Save",
39 B_WIDTH_AS_USUAL
, B_OFFSET_SPACING
, B_WARNING_ALERT
);
40 alert
->SetShortcut(0, B_ESCAPE
);
41 alert
->SetShortcut(1, 'd');
42 alert
->SetShortcut(2, 's');
44 switch (alert
->Go()) {
56 atomic_add(&sWindowCount
, -1);
58 if (sWindowCount
== 0)
59 be_app
->PostMessage(B_QUIT_REQUESTED
);