本文整理汇总了C++中CellParser::GetColor方法的典型用法代码示例。如果您正苦于以下问题:C++ CellParser::GetColor方法的具体用法?C++ CellParser::GetColor怎么用?C++ CellParser::GetColor使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CellParser
的用法示例。
在下文中一共展示了CellParser::GetColor方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: SetForeground
void MathCell::SetForeground(CellParser& parser)
{
wxColour color;
wxDC& dc = parser.GetDC();
if (m_highlight)
{
color = parser.GetColor(TS_HIGHLIGHT);
}
else {
switch (m_type)
{
case MC_TYPE_PROMPT:
color = parser.GetColor(TS_OTHER_PROMPT);
break;
case MC_TYPE_MAIN_PROMPT:
color = parser.GetColor(TS_MAIN_PROMPT);
break;
case MC_TYPE_ERROR:
color = wxColour(wxT("red"));
break;
case MC_TYPE_LABEL:
color = parser.GetColor(TS_LABEL);
break;
default:
color = parser.GetColor(m_textStyle);
break;
}
}
dc.SetTextForeground(color);
}
示例2: UnsetPen
/***
* Reset the pen in the device context.
*/
void MathCell::UnsetPen(CellParser& parser)
{
wxDC& dc = parser.GetDC();
if (m_type == MC_TYPE_PROMPT || m_type == MC_TYPE_INPUT || m_highlight)
dc.SetPen(*(wxThePenList->FindOrCreatePen(parser.GetColor(TS_DEFAULT),
1, wxPENSTYLE_SOLID)));
}
示例3: Draw
void SlideShow::Draw(wxPoint point, int fontsize)
{
MathCell::Draw(point, fontsize);
// TODO: Enable this when unselecting text updates the right region.
//if (!InUpdateRegion()) return;
CellParser *parser = CellParser::Get();
wxDC& dc = parser->GetDC();
if (DrawThisCell(point) && (m_images[m_displayed] != NULL))
{
wxMemoryDC bitmapDC;
double scale = parser->GetScale();
m_images[m_displayed]->ViewportSize(m_canvasSize.x,m_canvasSize.y,scale);
m_height = (m_images[m_displayed]->m_height) + 2 * m_imageBorderWidth;
m_width = (m_images[m_displayed]->m_width) + 2 * m_imageBorderWidth;
m_center = m_height / 2;
// Slide show cells have a red border except if they are selected
if(m_drawBoundingBox)
dc.SetBrush( *(wxTheBrushList->FindOrCreateBrush(parser->GetColor(TS_SELECTION))));
else
dc.SetPen(*wxRED_PEN);
// If we need a selection border on another redraw we will be informed by OnPaint() again.
m_drawBoundingBox = false;
dc.DrawRectangle(wxRect(point.x, point.y - m_center, m_width, m_height));
wxBitmap bitmap = m_images[m_displayed]->GetBitmap();
bitmapDC.SelectObject(bitmap);
dc.Blit(point.x + m_imageBorderWidth, point.y - m_center + m_imageBorderWidth, m_width - 2 * m_imageBorderWidth, m_height - 2 * m_imageBorderWidth, &bitmapDC, 0, 0);
}
else
// The cell isn't drawn => No need to keep it's image cache for now.
ClearCache();
}
示例4: Draw
void ImgCell::Draw(wxPoint point, int fontsize)
{
MathCell::Draw(point, fontsize);
// TODO: Enable this when unselecting text updates the right region.
//if (!InUpdateRegion()) return;
CellParser *parser = CellParser::Get();
wxDC& dc = parser->GetDC();
if (DrawThisCell(point) && (m_image != NULL))
{
wxMemoryDC bitmapDC;
if(m_drawBoundingBox)
dc.SetBrush( *(wxTheBrushList->FindOrCreateBrush(parser->GetColor(TS_SELECTION))));
else
SetPen();
if (m_drawRectangle || m_drawBoundingBox)
dc.DrawRectangle(wxRect(point.x, point.y - m_center, m_width, m_height));
wxBitmap bitmap = m_image->GetBitmap();
bitmapDC.SelectObject(bitmap);
if ((m_drawBoundingBox == false) || (m_imageBorderWidth > 0))
dc.Blit(point.x + m_imageBorderWidth, point.y - m_center + m_imageBorderWidth, m_width - 2 * m_imageBorderWidth, m_height - 2 * m_imageBorderWidth, &bitmapDC, 0, 0);
else
dc.StretchBlit(point.x + 5, point.y - m_center + 5, m_width - 2 * 5, m_height - 2 * 5, &bitmapDC, 0, 0, m_width, m_height);
}
else
// The cell isn't drawn => No need to keep it's image cache for now.
ClearCache();
// The next time we need to draw a bounding box we will be informed again.
m_drawBoundingBox = false;
}
示例5: Draw
void GroupCell::Draw(CellParser& parser, wxPoint point, int fontsize)
{
double scale = parser.GetScale();
wxDC& dc = parser.GetDC();
if (m_width == -1 || m_height == -1) {
RecalculateWidths(parser, fontsize);
RecalculateSize(parser, fontsize);
}
if (DrawThisCell(parser, point))
{
// draw a thick line for 'page break'
// and return
if (m_groupType == GC_TYPE_PAGEBREAK) {
wxRect rect = GetRect(false);
int y = rect.GetY();
wxPen pen(parser.GetColor(TS_CURSOR), 1, wxPENSTYLE_DOT);
dc.SetPen(pen);
dc.DrawLine(0, y , 10000, y);
MathCell::Draw(parser, point, fontsize);
return;
}
//
// Paint background if we have a text cell
//
if (m_groupType == GC_TYPE_TEXT) {
wxRect rect = GetRect(false);
int y = rect.GetY();
if (m_height > 0 && m_width > 0 && y>=0) {
wxBrush br(parser.GetColor(TS_TEXT_BACKGROUND));
dc.SetBrush(br);
wxPen pen(parser.GetColor(TS_TEXT_BACKGROUND));
dc.SetPen(pen);
dc.DrawRectangle(0, y , 10000, rect.GetHeight());
}
}
//
// Draw input and output
//
SetPen(parser);
wxPoint in(point);
parser.Outdated(false);
m_input->DrawList(parser, in, fontsize);
if (m_groupType == GC_TYPE_CODE && m_input->m_next)
parser.Outdated(((EditorCell *)(m_input->m_next))->ContainsChanges());
if (m_output != NULL && !m_hide) {
MathCell *tmp = m_output;
int drop = tmp->GetMaxDrop();
in.y += m_input->GetMaxDrop() + m_output->GetMaxCenter();
m_outputRect.y = in.y - m_output->GetMaxCenter();
m_outputRect.x = in.x;
while (tmp != NULL) {
if (!tmp->m_isBroken) {
tmp->m_currentPoint.x = in.x;
tmp->m_currentPoint.y = in.y;
if (tmp->DrawThisCell(parser, in))
tmp->Draw(parser, in, MAX(tmp->IsMath() ? m_mathFontSize : m_fontSize, MC_MIN_SIZE));
if (tmp->m_nextToDraw != NULL) {
if (tmp->m_nextToDraw->BreakLineHere()) {
in.x = m_indent;
in.y += drop + tmp->m_nextToDraw->GetMaxCenter();
if (tmp->m_bigSkip)
in.y += MC_LINE_SKIP;
drop = tmp->m_nextToDraw->GetMaxDrop();
} else
in.x += (tmp->GetWidth() + MC_CELL_SKIP);
}
} else {
if (tmp->m_nextToDraw != NULL && tmp->m_nextToDraw->BreakLineHere()) {
in.x = m_indent;
in.y += drop + tmp->m_nextToDraw->GetMaxCenter();
if (tmp->m_bigSkip)
in.y += MC_LINE_SKIP;
drop = tmp->m_nextToDraw->GetMaxDrop();
}
}
tmp = tmp->m_nextToDraw;
}
}
parser.Outdated(false);
MathCell *editable = GetEditable();
if (editable != NULL && editable->IsActive()) {
dc.SetPen( *(wxThePenList->FindOrCreatePen(parser.GetColor(TS_ACTIVE_CELL_BRACKET), 2, wxPENSTYLE_SOLID))); // window linux, set a pen
dc.SetBrush( *(wxTheBrushList->FindOrCreateBrush(parser.GetColor(TS_ACTIVE_CELL_BRACKET)))); //highlight c.
}
else {
dc.SetPen( *(wxThePenList->FindOrCreatePen(parser.GetColor(TS_CELL_BRACKET), 1, wxPENSTYLE_SOLID))); // window linux, set a pen
dc.SetBrush( *(wxTheBrushList->FindOrCreateBrush(parser.GetColor(TS_CELL_BRACKET)))); //highlight c.
}
if ((!m_hide) && (!m_hiddenTree)) {
dc.SetBrush(*wxTRANSPARENT_BRUSH);
}
//.........这里部分代码省略.........