2012-03-11 10:11:29 -05:00
|
|
|
/*
|
|
|
|
* Copyright 2012, Casalinuovo Dario. All rights reserved.
|
|
|
|
* Distributed under the terms of the MIT License.
|
|
|
|
*
|
|
|
|
* Authors:
|
|
|
|
* Casalinuovo Dario
|
|
|
|
*/
|
|
|
|
|
2021-05-19 16:12:19 -05:00
|
|
|
#include "ContactInfoWindow.h"
|
|
|
|
|
2012-03-11 10:11:29 -05:00
|
|
|
#include <Alert.h>
|
|
|
|
#include <Application.h>
|
|
|
|
#include <Box.h>
|
|
|
|
#include <GridLayout.h>
|
|
|
|
#include <GridLayoutBuilder.h>
|
|
|
|
#include <GroupLayout.h>
|
|
|
|
#include <GroupLayoutBuilder.h>
|
|
|
|
#include <Layout.h>
|
|
|
|
#include <Message.h>
|
|
|
|
#include <SpaceLayoutItem.h>
|
|
|
|
#include <String.h>
|
|
|
|
|
2021-05-19 16:12:19 -05:00
|
|
|
#include <libinterface/BitmapView.h>
|
|
|
|
|
2012-03-11 10:11:29 -05:00
|
|
|
#include "CayaMessages.h"
|
|
|
|
#include "CayaProtocolMessages.h"
|
|
|
|
#include "ContactLinker.h"
|
|
|
|
#include "CayaConstants.h"
|
|
|
|
#include "CayaRenderView.h"
|
2012-05-15 12:20:11 -05:00
|
|
|
#include "CayaUtils.h"
|
2012-03-11 10:11:29 -05:00
|
|
|
#include "NotifyMessage.h"
|
|
|
|
|
|
|
|
|
|
|
|
ContactInfoWindow::ContactInfoWindow(ContactLinker* linker)
|
|
|
|
:
|
|
|
|
BWindow(BRect(200, 200, 500, 400),
|
2012-03-11 19:40:37 -05:00
|
|
|
"Contact Informations", B_FLOATING_WINDOW,
|
|
|
|
B_NOT_ZOOMABLE | B_NOT_RESIZABLE),
|
2012-03-11 10:11:29 -05:00
|
|
|
fContactLinker(linker)
|
|
|
|
{
|
|
|
|
fPersonalMessage = new BTextView("personalMessage", B_WILL_DRAW);
|
2012-03-11 19:40:37 -05:00
|
|
|
fPersonalMessage->SetExplicitAlignment(BAlignment(B_ALIGN_LEFT,
|
|
|
|
B_ALIGN_MIDDLE));
|
|
|
|
|
2012-03-11 10:11:29 -05:00
|
|
|
fPersonalMessage->SetText(fContactLinker->GetNotifyPersonalStatus());
|
|
|
|
fPersonalMessage->SetExplicitMaxSize(BSize(200, 200));
|
|
|
|
fPersonalMessage->MakeEditable(false);
|
|
|
|
fPersonalMessage->SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
|
|
|
|
|
|
|
|
BString status(fContactLinker->GetName());
|
2012-05-15 12:20:11 -05:00
|
|
|
status << CayaStatusToString(fContactLinker->GetNotifyStatus());
|
2012-03-11 10:11:29 -05:00
|
|
|
|
|
|
|
status << "\n\n ID : ";
|
|
|
|
status << fContactLinker->GetId();
|
|
|
|
|
|
|
|
fStatus = new BTextView("status", B_WILL_DRAW);
|
|
|
|
fStatus->SetText(status);
|
|
|
|
fStatus->MakeEditable(false);
|
|
|
|
fStatus->SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
|
|
|
|
|
|
|
|
SetLayout(new BGroupLayout(B_HORIZONTAL));
|
|
|
|
|
|
|
|
fAvatar = new BitmapView("ContactIcon");
|
|
|
|
fAvatar->SetExplicitMaxSize(BSize(70, 70));
|
|
|
|
fAvatar->SetExplicitMinSize(BSize(50, 50));
|
|
|
|
fAvatar->SetExplicitPreferredSize(BSize(50, 50));
|
|
|
|
fAvatar->SetExplicitAlignment(BAlignment(B_ALIGN_RIGHT, B_ALIGN_MIDDLE));
|
|
|
|
fAvatar->SetBitmap(fContactLinker->AvatarBitmap());
|
|
|
|
|
|
|
|
AddChild(BGroupLayoutBuilder(B_VERTICAL, 10)
|
|
|
|
.AddGroup(B_HORIZONTAL)
|
|
|
|
.Add(fStatus)
|
|
|
|
.Add(fAvatar)
|
|
|
|
.End()
|
|
|
|
.AddGroup(B_HORIZONTAL)
|
|
|
|
.Add(fPersonalMessage)
|
|
|
|
.End()
|
|
|
|
.SetInsets(5, 5, 5, 5)
|
|
|
|
);
|
|
|
|
|
|
|
|
MoveTo(BAlert::AlertPosition(Bounds().Width(), Bounds().Height() / 2));
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void
|
|
|
|
ContactInfoWindow::MessageReceived(BMessage* message)
|
|
|
|
{
|
|
|
|
switch (message->what) {
|
|
|
|
default:
|
|
|
|
BWindow::MessageReceived(message);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|