2010-05-07 04:47:10 -05:00
|
|
|
/*
|
2021-07-14 13:17:00 -05:00
|
|
|
* Copyright 2021, Jaidyn Levesque <jadedctrl@teknik.io>
|
|
|
|
* All rights reserved. Distributed under the terms of the MIT license.
|
2010-05-07 04:47:10 -05:00
|
|
|
*/
|
|
|
|
|
2021-06-07 13:34:20 -05:00
|
|
|
#include "RunView.h"
|
|
|
|
|
|
|
|
|
2021-07-14 13:17:00 -05:00
|
|
|
RunView::RunView(const char* name)
|
2012-10-18 16:04:45 -05:00
|
|
|
:
|
2021-07-14 13:17:00 -05:00
|
|
|
BTextView(name),
|
|
|
|
fLastStyled(false)
|
2010-05-07 04:47:10 -05:00
|
|
|
{
|
2021-07-14 13:17:00 -05:00
|
|
|
MakeEditable(false);
|
|
|
|
SetStylable(true);
|
|
|
|
AdoptSystemColors();
|
2010-07-10 08:58:15 -05:00
|
|
|
|
2021-07-14 13:17:00 -05:00
|
|
|
text_run run = { 0, BFont(), ui_color(B_PANEL_TEXT_COLOR) };
|
|
|
|
fDefaultRun = { 1, {run} };
|
2010-05-07 04:47:10 -05:00
|
|
|
}
|
|
|
|
|
2021-06-07 13:34:20 -05:00
|
|
|
|
2010-05-07 04:47:10 -05:00
|
|
|
void
|
2021-07-14 13:17:00 -05:00
|
|
|
RunView::Append(const char* text, rgb_color color, uint16 fontFace)
|
2010-05-07 04:47:10 -05:00
|
|
|
{
|
2021-07-14 13:17:00 -05:00
|
|
|
BFont font;
|
|
|
|
font.SetFace(fontFace);
|
|
|
|
text_run run = { 0, font, color };
|
|
|
|
text_run_array array = { 1, {run} };
|
2010-07-10 08:58:15 -05:00
|
|
|
|
2021-07-14 13:17:00 -05:00
|
|
|
Insert(text, &array);
|
|
|
|
fLastStyled = true;
|
2010-05-07 04:47:10 -05:00
|
|
|
}
|
|
|
|
|
2021-06-07 13:34:20 -05:00
|
|
|
|
2010-05-07 04:47:10 -05:00
|
|
|
void
|
2021-07-14 13:17:00 -05:00
|
|
|
RunView::Append(const char* text)
|
2010-05-07 04:47:10 -05:00
|
|
|
{
|
2021-07-14 13:17:00 -05:00
|
|
|
if (fLastStyled == false)
|
|
|
|
Insert(text);
|
|
|
|
else
|
|
|
|
Insert(text, &fDefaultRun);
|
|
|
|
fLastStyled = false;
|
2010-05-07 04:47:10 -05:00
|
|
|
}
|