2 * Copyright 2008-2011, Haiku, Inc. All rights reserved.
3 * Distributed under the terms of the MIT License.
6 * Michael Pfeiffer <laplace@users.sourceforge.net>
10 #include "WizardPageView.h"
18 WizardPageView::WizardPageView(BMessage
* settings
, BRect frame
,
19 const char* name
, uint32 resizingMode
, uint32 flags
)
21 BView(frame
, name
, resizingMode
, flags
),
24 SetViewUIColor(B_PANEL_BACKGROUND_COLOR
);
28 WizardPageView::WizardPageView(BMessage
* settings
, const char* name
)
30 BView(name
, B_WILL_DRAW
),
33 SetViewUIColor(B_PANEL_BACKGROUND_COLOR
);
37 WizardPageView::~WizardPageView()
43 WizardPageView::PageCompleted()
49 WizardPageView::CreateDescription(BRect frame
, const char* name
,
50 const char* description
)
52 BTextView
* view
= new BTextView(frame
, "text",
53 frame
.OffsetToCopy(0, 0),
54 B_FOLLOW_LEFT_RIGHT
| B_FOLLOW_TOP
,
55 B_WILL_DRAW
| B_PULSE_NEEDED
| B_FRAME_EVENTS
);
56 view
->MakeEditable(false);
57 view
->SetViewUIColor(ViewUIColor());
58 view
->SetStylable(true);
59 view
->SetText(description
);
66 WizardPageView::CreateDescription(const char* name
,
67 const char* description
)
69 BTextView
* view
= new BTextView("text");
70 view
->MakeEditable(false);
71 view
->SetViewUIColor(ViewUIColor());
72 view
->SetStylable(true);
73 view
->SetText(description
);
80 WizardPageView::MakeHeading(BTextView
* view
)
82 const char* text
= view
->Text();
83 const char* firstLineEnd
= strchr(text
, '\n');
84 if (firstLineEnd
!= NULL
) {
85 int indexFirstLineEnd
= firstLineEnd
- text
;
88 font
.SetFace(B_BOLD_FACE
);
89 font
.SetSize(font
.Size() + 1);
90 rgb_color color
= ui_color(B_PANEL_TEXT_COLOR
);
91 view
->SetFontAndColor(0, indexFirstLineEnd
, &font
, B_FONT_ALL
,
94 font
.SetFace(B_REGULAR_FACE
);
95 font
.SetSize(font
.Size() - 1);
96 view
->SetFontAndColor(indexFirstLineEnd
+ 1, view
->TextLength(),
97 &font
, B_FONT_ALL
, &color
);
103 WizardPageView::LayoutDescriptionVertically(BTextView
* view
)
105 view
->SetTextRect(view
->Bounds());
107 float height
= view
->TextHeight(0, 32000);
108 float width
= view
->Bounds().Width();
110 view
->ResizeTo(width
, height
);
111 view
->SetTextRect(view
->Bounds());