fat: Greatly simplify and clean up dosfs_get_file_map().
[haiku.git] / src / preferences / joysticks / MessageWin.cpp
blobc3d7e896e7c5cfe61763118037e1d1ddfe11d7dc
1 /*
2 * Copyright 2007 Haiku.
3 * Distributed under the terms of the MIT License.
5 * Authors:
6 * Oliver Ruiz Dorantes, oliver.ruiz.dorantes_at_gmail.com
7 * Ryan Leavengood, leavengood@gmail.com
8 */
11 #include "MessageWin.h"
13 #include <Box.h>
14 #include <Message.h>
15 #include <TextView.h>
16 #include <View.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);
39 AddChild(fBox);
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)
50 Lock();
51 fText->SetText(str);
52 fText->Flush();
53 Unlock();
57 void MessageWin::MessageReceived(BMessage *message)
59 switch(message->what)
61 default:
62 BWindow::MessageReceived(message);
63 break;
68 bool MessageWin::QuitRequested()
70 return BWindow::QuitRequested();