2 * Copyright 2001-2010, Haiku.
3 * Distributed under the terms of the MIT License.
6 * Marc Flerackers (mflerackers@androme.be)
13 #include <SystemCatalog.h>
15 #include "ZombieReplicantView.h"
22 using BPrivate::gSystemCatalog
;
24 #undef B_TRANSLATION_CONTEXT
25 #define B_TRANSLATION_CONTEXT "ZombieReplicantView"
28 #define B_TRANSLATE(str) \
29 gSystemCatalog.GetString(B_TRANSLATE_MARK(str), "ZombieReplicantView")
32 _BZombieReplicantView_::_BZombieReplicantView_(BRect frame
, status_t error
)
34 BBox(frame
, "<Zombie>", B_FOLLOW_NONE
, B_WILL_DRAW
),
37 BFont
font(be_bold_font
);
38 font
.SetSize(9.0f
); // TODO
40 SetViewColor(kZombieColor
);
44 _BZombieReplicantView_::~_BZombieReplicantView_()
50 _BZombieReplicantView_::MessageReceived(BMessage
* msg
)
53 case B_ABOUT_REQUESTED
:
55 const char* addOn
= NULL
;
57 if (fArchive
->FindString("add_on", &addOn
) == B_OK
) {
58 char description
[B_MIME_TYPE_LENGTH
] = "";
59 BMimeType
type(addOn
);
60 type
.GetShortDescription(description
);
61 error
= B_TRANSLATE("Cannot create the replicant for "
62 "\"%description\".\n%error");
63 error
.ReplaceFirst("%description", description
);
65 error
= B_TRANSLATE("Cannot locate the application for the "
66 "replicant. No application signature supplied.\n%error");
68 error
.ReplaceFirst("%error", strerror(fError
));
70 BAlert
* alert
= new (std::nothrow
) BAlert(B_TRANSLATE("Error"),
71 error
.String(), B_TRANSLATE("OK"), NULL
, NULL
,
72 B_WIDTH_AS_USUAL
, B_STOP_ALERT
);
74 alert
->SetFlags(alert
->Flags() | B_CLOSE_ON_ESCAPE
);
81 BView::MessageReceived(msg
);
87 _BZombieReplicantView_::Draw(BRect updateRect
)
89 BRect
bounds(Bounds());
94 DrawChar('?', BPoint(bounds
.Width() / 2.0f
- StringWidth("?") / 2.0f
,
95 bounds
.Height() / 2.0f
- fh
.ascent
/ 2.0f
));
97 BBox::Draw(updateRect
);
102 _BZombieReplicantView_::MouseDown(BPoint
)
108 _BZombieReplicantView_::Archive(BMessage
* archive
, bool) const
110 *archive
= *fArchive
;
117 _BZombieReplicantView_::SetArchive(BMessage
* archive
)