tcp: Fix 64 bit build with debugging features enabled.
[haiku.git] / src / preferences / screen / AlertWindow.cpp
blob51943fd4293b6513d6c331d2855881b893d73964
1 /*
2 * Copyright 2001-2006, Haiku.
3 * Distributed under the terms of the MIT License.
5 * Authors:
6 * Rafael Romo
7 * Stefano Ceccherini (burton666@libero.it)
8 * Axel Dörfler, axeld@pinc-software.de
9 */
11 #include "AlertWindow.h"
12 #include "AlertView.h"
13 #include "Constants.h"
15 #include <Catalog.h>
16 #include <Window.h>
17 #include <Screen.h>
20 #undef B_TRANSLATION_CONTEXT
21 #define B_TRANSLATION_CONTEXT "Screen"
24 AlertWindow::AlertWindow(BMessenger target)
25 : BWindow(BRect(100.0, 100.0, 400.0, 193.0), B_TRANSLATE("Undo"),
26 B_MODAL_WINDOW_LOOK, B_MODAL_APP_WINDOW_FEEL,
27 B_NOT_RESIZABLE | B_NOT_ZOOMABLE, B_ALL_WORKSPACES),
28 fTarget(target)
30 fAlertView = new AlertView(Bounds(), "AlertView");
32 ResizeTo(fAlertView->Bounds().Width(), fAlertView->Bounds().Height());
33 AddChild(fAlertView);
35 // center window on screen
36 BScreen screen(this);
37 MoveTo(screen.Frame().left + (screen.Frame().Width() - Frame().Width()) / 2,
38 screen.Frame().top + (screen.Frame().Height() - Frame().Height()) / 2);
42 void
43 AlertWindow::MessageReceived(BMessage *message)
45 switch (message->what) {
46 case BUTTON_KEEP_MSG:
47 fTarget.SendMessage(MAKE_INITIAL_MSG);
48 PostMessage(B_QUIT_REQUESTED);
49 break;
51 case BUTTON_UNDO_MSG:
52 fTarget.SendMessage(BUTTON_UNDO_MSG);
53 PostMessage(B_QUIT_REQUESTED);
54 break;
56 default:
57 BWindow::MessageReceived(message);
58 break;