Patch from Rene Gollent that add a split in the ChatWindow to resize the send and receive views. Thanks!!

This commit is contained in:
barrett 2012-11-28 15:20:17 +00:00
parent dd5c5cada0
commit 101006a459
2 changed files with 11 additions and 8 deletions

View File

@ -16,6 +16,7 @@
#include <GroupLayout.h> #include <GroupLayout.h>
#include <GroupLayoutBuilder.h> #include <GroupLayoutBuilder.h>
#include <Layout.h> #include <Layout.h>
#include <LayoutBuilder.h>
#include <ListView.h> #include <ListView.h>
#include <Message.h> #include <Message.h>
#include <SpaceLayoutItem.h> #include <SpaceLayoutItem.h>
@ -65,8 +66,6 @@ ChatWindow::ChatWindow(ContactLinker* cl)
fStatus = new BStringView("status", ""); fStatus = new BStringView("status", "");
fStatus->SetExplicitAlignment(BAlignment(B_ALIGN_LEFT, B_ALIGN_MIDDLE)); fStatus->SetExplicitAlignment(BAlignment(B_ALIGN_LEFT, B_ALIGN_MIDDLE));
SetLayout(new BGroupLayout(B_HORIZONTAL));
fAvatar = new BitmapView("ContactIcon"); fAvatar = new BitmapView("ContactIcon");
fAvatar->SetExplicitMaxSize(BSize(50, 50)); fAvatar->SetExplicitMaxSize(BSize(50, 50));
fAvatar->SetExplicitMinSize(BSize(50, 50)); fAvatar->SetExplicitMinSize(BSize(50, 50));
@ -78,17 +77,18 @@ ChatWindow::ChatWindow(ContactLinker* cl)
BitmapView* protocolView = new BitmapView("protocolView"); BitmapView* protocolView = new BitmapView("protocolView");
protocolView->SetBitmap(protocolBitmap); protocolView->SetBitmap(protocolBitmap);
AddChild(BGroupLayoutBuilder(B_VERTICAL, 10) BLayoutBuilder::Group<>(this, B_VERTICAL, 10)
.AddGroup(B_HORIZONTAL) .AddGroup(B_HORIZONTAL)
.Add(protocolView) .Add(protocolView)
.Add(fPersonalMessage) .Add(fPersonalMessage)
.Add(fAvatar) .Add(fAvatar)
.End() .End()
.AddSplit(B_VERTICAL)
.Add(scrollViewReceive, 2) .Add(scrollViewReceive, 2)
.Add(scrollViewSend, 3) .Add(scrollViewSend, 3)
.End()
.Add(fStatus, 4) .Add(fStatus, 4)
.SetInsets(5, 5, 5, 5) .SetInsets(5, 5, 5, 5);
);
MoveTo(BAlert::AlertPosition(Bounds().Width(), Bounds().Height() / 2)); MoveTo(BAlert::AlertPosition(Bounds().Width(), Bounds().Height() / 2));

View File

@ -39,7 +39,10 @@ void
BitmapView::AttachedToWindow() BitmapView::AttachedToWindow()
{ {
// Set view color to parent's view color // Set view color to parent's view color
if (Parent() != NULL)
SetViewColor(Parent()->ViewColor()); SetViewColor(Parent()->ViewColor());
else
SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
} }