2 * Copyright 2007 Haiku.
3 * Distributed under the terms of the MIT License.
6 * Oliver Ruiz Dorantes, oliver.ruiz.dorantes_at_gmail.com
7 * Ryan Leavengood, leavengood@gmail.com
11 #include "MessageWin.h"
18 /* frame will be the frame of the parent window as*/
19 MessageWin::MessageWin(BRect parentFrame
, const char *title
,
20 window_look look
, window_feel feel
, uint32 flags
, uint32 workspace
)
21 : BWindow(parentFrame
,title
,look
,feel
, flags
, workspace
)
23 fBox
= new BBox(Bounds(), "", B_FOLLOW_ALL
, B_WILL_DRAW
, B_PLAIN_BORDER
);
24 fBox
->SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR
));
25 fBox
->SetLowColor(fBox
->ViewColor());
27 // Rects for the text view
28 BRect
outside(fBox
->Bounds());
29 outside
.InsetBy(10, 10);
30 BRect
insider(outside
);
31 insider
.OffsetTo(B_ORIGIN
);
33 fText
= new BTextView(outside
, "message", insider
, B_FOLLOW_NONE
, B_WILL_DRAW
);
34 fText
->MakeEditable(false);
35 fText
->SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR
));
36 fText
->SetLowColor(fText
->ViewColor());
38 fBox
->AddChild(fText
);
41 /* Relocate the window to the center of what its being given */
42 ResizeTo(parentFrame
.Width(), floor(parentFrame
.Height() / 3));
43 MoveBy(0, floor(parentFrame
.Height() / 2 - (parentFrame
.Height()/3) / 2 ));
48 void MessageWin::SetText(const char* str
)
57 void MessageWin::MessageReceived(BMessage
*message
)
62 BWindow::MessageReceived(message
);
68 bool MessageWin::QuitRequested()
70 return BWindow::QuitRequested();