-
Notifications
You must be signed in to change notification settings - Fork 0
/
LatexListItem.cpp
54 lines (45 loc) · 1.34 KB
/
LatexListItem.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
#include "LatexListItem.h"
LatexListItem::LatexListItem(LView* latex) :
BListItem(),
fLatex(latex)
{
SetHeight(fLatex->GetBitmap()->Bounds().Height());
SetWidth(fLatex->GetBitmap()->Bounds().Width());
}
void LatexListItem::DrawItem(BView *owner, BRect frame, bool complete) {
//TODO use standard colors
rgb_color selected_background ={216,216,216,255};
rgb_color draw_color={0,0,0,255};
rgb_color color = draw_color;//TODO remove draw_color
if (IsSelected() || complete) {
color = selected_background;
}
else {
color = owner->ViewColor();
}
owner->SetHighColor(color);
owner->FillRect(frame);
owner->MovePenTo(frame.left+4, frame.top);
owner->SetHighColor(draw_color);
owner->DrawBitmap(fLatex->GetBitmap());
//Copied from QuickLaunch
owner->SetHighColor(tint_color(ui_color(B_CONTROL_BACKGROUND_COLOR),
B_DARKEN_1_TINT));
owner->StrokeLine(frame.LeftBottom(), frame.RightBottom());
}
void LatexListItem::Update(BView* owner, const BFont* font)
{
BListItem::Update(owner, font);
SetHeight(fLatex->GetBitmap()->Bounds().Height()+2);//TODO why +2
SetWidth(fLatex->GetBitmap()->Bounds().Width());
}
void LatexListItem::PrintToStream()
{
BMessage* archive = new BMessage();
BListItem::Archive(archive,true);
fLatex->Archive(archive,true);
archive->PrintToStream();
}
LView* LatexListItem::GetLView() {
return fLatex;
}