本文整理汇总了C++中CLVColumn::DrawColumnHeader方法的典型用法代码示例。如果您正苦于以下问题:C++ CLVColumn::DrawColumnHeader方法的具体用法?C++ CLVColumn::DrawColumnHeader怎么用?C++ CLVColumn::DrawColumnHeader使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CLVColumn
的用法示例。
在下文中一共展示了CLVColumn::DrawColumnHeader方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Draw
void CLVColumnLabelView::Draw(BRect update_rect)
{
BRect ViewBounds = Bounds();
//Draw each column label in turn
float ColumnBegin = 0.0;
float ColumnEnd = -1.0;
bool MergeWithLeft = false;
int32 NumberOfColumns = fDisplayList->CountItems();
BPoint Start,Stop;
for(int32 ColumnDraw = 0; ColumnDraw < NumberOfColumns; ColumnDraw++)
{
CLVColumn* ThisColumn = (CLVColumn*)fDisplayList->ItemAt(ColumnDraw);
if(ThisColumn->IsShown())
{
//Figure out where this column is
ColumnBegin = ThisColumn->fColumnBegin;
ColumnEnd = ThisColumn->fColumnEnd;
//Start by figuring out if this column will merge with a shown column to the right
bool MergeWithRight = false;
if(ThisColumn->fFlags & CLV_MERGE_WITH_RIGHT)
{
for(int32 ColumnCounter = ColumnDraw+1; ColumnCounter < NumberOfColumns;
ColumnCounter++)
{
CLVColumn* NextColumn = (CLVColumn*)fDisplayList->ItemAt(ColumnCounter);
if(NextColumn->IsShown())
{
//The next column is shown
MergeWithRight = true;
break;
}
else if(!(NextColumn->fFlags & CLV_MERGE_WITH_RIGHT))
//The next column is not shown and doesn't pass on the merge
break;
}
}
if(update_rect.Intersects(BRect(ColumnBegin,ViewBounds.top,ColumnEnd,
ViewBounds.bottom)))
{
//Need to draw this column
BeginLineArray(4);
//Top line
Start.Set(ColumnBegin,ViewBounds.top);
Stop.Set(ColumnEnd-1.0,ViewBounds.top);
if(MergeWithRight && !(ThisColumn == fColumnClicked && fColumnResizing))
Stop.x = ColumnEnd;
AddLine(Start,Stop,BeHighlight);
//Left line
if(!MergeWithLeft)
AddLine(BPoint(ColumnBegin,ViewBounds.top+1.0),
BPoint(ColumnBegin,ViewBounds.bottom),BeHighlight);
//Bottom line
Start.Set(ColumnBegin+1.0,ViewBounds.bottom);
if(MergeWithLeft)
Start.x = ColumnBegin;
Stop.Set(ColumnEnd-1.0,ViewBounds.bottom);
if(MergeWithRight && !(ThisColumn == fColumnClicked && fColumnResizing))
Stop.x = ColumnEnd;
AddLine(Start,Stop,BeShadow);
//Right line
if(ThisColumn == fColumnClicked && fColumnResizing)
AddLine(BPoint(ColumnEnd,ViewBounds.top),BPoint(ColumnEnd,ViewBounds.bottom),
BeFocusBlue);
else if(!MergeWithRight)
AddLine(BPoint(ColumnEnd,ViewBounds.top),BPoint(ColumnEnd,ViewBounds.bottom),
BeShadow);
EndLineArray();
//Add the label
//Limit the clipping region to the interior of the box
BRect TextRect(ColumnBegin+1.0,ViewBounds.top+1.0,ColumnEnd-1.0,
ViewBounds.bottom-1.0);
BRegion TextRegion;
TextRegion.Include(TextRect);
ConstrainClippingRegion(&TextRegion);
bool focus;
bool sort_key;
if(ThisColumn == fColumnClicked && !fColumnResizing)
focus = true;
else
focus = false;
if(fParent->fSortKeyList.HasItem(ThisColumn) && ThisColumn->fSortMode != NoSort)
sort_key = true;
else
sort_key = false;
ThisColumn->DrawColumnHeader(this,TextRect,sort_key,focus,fFontAscent);
//Restore the clipping region
ConstrainClippingRegion(NULL);
}
//Set MergeWithLeft flag for the next column to the appropriate state
MergeWithLeft = MergeWithRight;
}
}
//Add highlight and shadow to the region after the columns if necessary
if(ColumnEnd < ViewBounds.right)
//.........这里部分代码省略.........