📄 panedrawpl.cpp
字号:
{
dc.SetPen( mpLayout->mDarkPen );
dc.DrawPoint( bounds.x, bounds.y -1 );
dc.SetPen( mpLayout->mLightPen );
dc.DrawPoint( bounds.x, bounds.y + bounds.height );
}
}
}
}
void cbPaneDrawPlugin::DrawLowerRowShades( cbRowInfo* pRow, wxDC& dc, int level )
{
for( size_t i = 0; i != pRow->mBars.Count(); ++i )
{
wxRect& bounds = pRow->mBars[i]->mBoundsInParent;
if ( mpPane->IsHorizontal() )
{
DrawShade( level, bounds, FL_ALIGN_BOTTOM, dc );
if ( level == 1 )
{
dc.SetPen( mpLayout->mDarkPen );
dc.DrawPoint( bounds.x - 1, bounds.y + bounds.height -1 );
dc.SetPen( mpLayout->mLightPen );
dc.DrawPoint( bounds.x + bounds.width , bounds.y + bounds.height -1 );
}
}
else
{
DrawShade( level, bounds, FL_ALIGN_RIGHT, dc );
if ( level == 1 )
{
dc.SetPen( mpLayout->mDarkPen );
dc.DrawPoint( bounds.x + bounds.width - 1, bounds.y -1 );
dc.SetPen( mpLayout->mLightPen );
dc.DrawPoint( bounds.x + bounds.width - 1, bounds.y + bounds.height );
}
}
}
}
void cbPaneDrawPlugin::DrawBarInnerShadeRect( cbBarInfo* pBar, wxDC& dc )
{
wxRect& bounds = pBar->mBoundsInParent;
dc.SetPen( mpLayout->mDarkPen );
dc.DrawLine( bounds.x + bounds.width - 1,
bounds.y,
bounds.x + bounds.width - 1,
bounds.y + bounds.height );
dc.DrawLine( bounds.x,
bounds.y + bounds.height - 1,
bounds.x + bounds.width,
bounds.y + bounds.height -1 );
dc.SetPen( mpLayout->mLightPen );
dc.DrawLine( bounds.x,
bounds.y,
bounds.x + bounds.width - 1,
bounds.y );
dc.DrawLine( bounds.x,
bounds.y,
bounds.x,
bounds.y + bounds.height - 1 );
}
void cbPaneDrawPlugin::DrawShade( int level, wxRect& rect, int alignment, wxDC& dc )
{
// simulates "guled-bricks" appearence of control bars
if ( ( alignment == FL_ALIGN_TOP && level == 1 ) ||
( alignment == FL_ALIGN_BOTTOM && level == 0 ) ||
( alignment == FL_ALIGN_LEFT && level == 1 ) ||
( alignment == FL_ALIGN_RIGHT && level == 0 )
)
dc.SetPen( mpLayout->mDarkPen );
else
dc.SetPen( mpLayout->mLightPen );
if ( alignment == FL_ALIGN_TOP )
{
if ( level == 0 )
dc.DrawLine( rect.x,
rect.y,
rect.x + rect.width - 1,
rect.y );
else
dc.DrawLine( rect.x - 1,
rect.y - 1,
rect.x + rect.width + 0,
rect.y - 1 );
}
else
if ( alignment == FL_ALIGN_BOTTOM )
{
if ( level == 0 )
dc.DrawLine( rect.x,
rect.y + rect.height - 1,
rect.x + rect.width,
rect.y + rect.height - 1 );
else
dc.DrawLine( rect.x - 1,
rect.y + rect.height,
rect.x + rect.width + 1,
rect.y + rect.height );
}
else
if ( alignment == FL_ALIGN_LEFT )
{
if ( level == 0 )
dc.DrawLine( rect.x,
rect.y,
rect.x,
rect.y + rect.height - 1 );
else
dc.DrawLine( rect.x - 1,
rect.y - 1,
rect.x - 1,
rect.y + rect.height );
}
else
if ( alignment == FL_ALIGN_RIGHT )
{
if ( level == 0 )
dc.DrawLine( rect.x + rect.width - 1,
rect.y,
rect.x + rect.width - 1,
rect.y + rect.height );
else
{
dc.DrawLine( rect.x + rect.width,
rect.y - 1,
rect.x + rect.width,
rect.y + rect.height + 1 );
}
}
}
void cbPaneDrawPlugin::DrawShade1( int level, wxRect& rect, int alignment, wxDC& dc )
{
// simulates "guled-bricks" appearence of control bars
if ( ( alignment == FL_ALIGN_TOP && level == 1 ) ||
( alignment == FL_ALIGN_BOTTOM && level == 0 ) ||
( alignment == FL_ALIGN_LEFT && level == 1 ) ||
( alignment == FL_ALIGN_RIGHT && level == 0 )
)
dc.SetPen( mpLayout->mDarkPen );
else
dc.SetPen( mpLayout->mLightPen );
if ( alignment == FL_ALIGN_TOP )
{
if ( level == 0 )
dc.DrawLine( rect.x,
rect.y,
rect.x + rect.width,
rect.y );
else
dc.DrawLine( rect.x,
rect.y - 1,
rect.x + rect.width,
rect.y - 1 );
}
else
if ( alignment == FL_ALIGN_BOTTOM )
{
if ( level == 0 )
dc.DrawLine( rect.x,
rect.y + rect.height - 1,
rect.x + rect.width,
rect.y + rect.height - 1 );
else
dc.DrawLine( rect.x,
rect.y + rect.height,
rect.x + rect.width,
rect.y + rect.height );
}
else
if ( alignment == FL_ALIGN_LEFT )
{
if ( level == 0 )
dc.DrawLine( rect.x,
rect.y,
rect.x,
rect.y + rect.height );
else
dc.DrawLine( rect.x - 1,
rect.y,
rect.x - 1,
rect.y + rect.height );
}
else
if ( alignment == FL_ALIGN_RIGHT )
{
if ( level == 0 )
dc.DrawLine( rect.x + rect.width - 1,
rect.y,
rect.x + rect.width - 1,
rect.y + rect.height );
else
{
dc.DrawLine( rect.x + rect.width,
rect.y ,
rect.x + rect.width,
rect.y + rect.height );
}
}
}
void cbPaneDrawPlugin::DrawPaneShade( wxDC& dc, int alignment )
{
if ( !mpPane->mProps.mShow3DPaneBorderOn ) return;
wxRect bounds = mpPane->mBoundsInParent;
bounds.x += mpPane->mLeftMargin;
bounds.y += mpPane->mTopMargin;
bounds.width -= ( mpPane->mLeftMargin + mpPane->mRightMargin );
bounds.height -= ( mpPane->mTopMargin + mpPane->mBottomMargin );
DrawShade( 0, bounds, alignment, dc );
DrawShade( 1, bounds, alignment, dc );
}
void cbPaneDrawPlugin::DrawPaneShadeForRow( cbRowInfo* pRow, wxDC& dc )
{
if ( !mpPane->mProps.mShow3DPaneBorderOn ) return;
// do not draw decoration, if pane has "vainished"
if ( mpPane->mPaneWidth < 0 ||
mpPane->mPaneHeight < 0 )
return;
wxRect bounds = pRow->mBoundsInParent;
if ( mpPane->mAlignment == FL_ALIGN_TOP ||
mpPane->mAlignment == FL_ALIGN_BOTTOM )
{
--bounds.y;
bounds.height += 2;
DrawShade1( 0, bounds, FL_ALIGN_LEFT, dc );
DrawShade1( 1, bounds, FL_ALIGN_LEFT, dc );
DrawShade1( 0, bounds, FL_ALIGN_RIGHT, dc );
DrawShade1( 1, bounds, FL_ALIGN_RIGHT, dc );
if ( !pRow->mpNext )
DrawPaneShade( dc, FL_ALIGN_BOTTOM );
if ( !pRow->mpPrev )
DrawPaneShade( dc, FL_ALIGN_TOP );
}
else
{
--bounds.x;
bounds.width += 2;
DrawShade1( 0, bounds, FL_ALIGN_TOP, dc );
DrawShade1( 1, bounds, FL_ALIGN_TOP, dc );
DrawShade1( 0, bounds, FL_ALIGN_BOTTOM, dc );
DrawShade1( 1, bounds, FL_ALIGN_BOTTOM, dc );
if ( !pRow->mpNext )
DrawPaneShade( dc, FL_ALIGN_RIGHT );
if ( !pRow->mpPrev )
DrawPaneShade( dc, FL_ALIGN_LEFT );
}
}
void cbPaneDrawPlugin::OnDrawPaneDecorations( cbDrawPaneDecorEvent& event )
{
wxDC& dc = *event.mpDc;
cbDockPane* pPane = event.mpPane;
RowArrayT& lst = pPane->GetRowList();
// FIXME:: this is a workaround for some glitches
if ( lst.Count() )
{
cbRowInfo* pLastRow = lst[ lst.Count() - 1 ];
pPane->PaintRowBackground( pLastRow, dc );
pPane->PaintRowDecorations( pLastRow, dc );
pPane->PaintRowHandles( pLastRow, dc );
}
if ( !pPane->mProps.mShow3DPaneBorderOn ) return;
// do not draw decoration, if pane is completely hidden
if ( event.mpPane->mPaneWidth < 0 ||
event.mpPane->mPaneHeight < 0 )
return;
DrawPaneShade( dc, FL_ALIGN_TOP );
DrawPaneShade( dc, FL_ALIGN_BOTTOM );
DrawPaneShade( dc, FL_ALIGN_LEFT );
DrawPaneShade( dc, FL_ALIGN_RIGHT );
event.Skip(); // pass event to the next plugin
}
// bar decoration/sizing handlers
void cbPaneDrawPlugin::OnDrawBarDecorations( cbDrawBarDecorEvent& event )
{
// cbBarInfo* pBar = event.mpBar;
wxDC& dc = *event.mpDc;
// draw brick borders
wxRect& rect = event.mBoundsInParent;
dc.SetPen( mpLayout->mLightPen );
// horiz
dc.DrawLine( rect.x, rect.y,
rect.x + rect.width-1, rect.y );
// vert
dc.DrawLine( rect.x, rect.y,
rect.x, rect.y + rect.height-1 );
dc.SetPen( mpLayout->mDarkPen );
// vert
dc.DrawLine( rect.x + rect.width-1, rect.y,
rect.x + rect.width-1, rect.y + rect.height-1 );
// horiz
dc.DrawLine( rect.x, rect.y + rect.height-1,
rect.x + rect.width, rect.y + rect.height-1 );
event.Skip(); // pass event to the next plugin
}
void cbPaneDrawPlugin::OnDrawBarHandles( cbDrawBarHandlesEvent& event )
{
// short-cuts
cbBarInfo* pBar = event.mpBar;
wxDC& dc = *event.mpDc;
mpPane = event.mpPane;
// draw handles around the bar if present
if ( pBar->mHasLeftHandle ||
pBar->mHasRightHandle )
{
wxRect& bounds = pBar->mBoundsInParent;
if ( mpPane->IsHorizontal() )
{
if ( pBar->mHasLeftHandle )
mpPane->DrawVertHandle( dc, bounds.x - mpPane->mProps.mResizeHandleSize -1,
bounds.y, bounds.height );
if ( pBar->mHasRightHandle )
mpPane->DrawVertHandle( dc,
bounds.x + bounds.width -1,
bounds.y, bounds.height );
}
else
{
if ( pBar->mHasLeftHandle )
mpPane->DrawHorizHandle( dc, bounds.x,
bounds.y - mpPane->mProps.mResizeHandleSize - 1,
bounds.width );
if ( pBar->mHasRightHandle )
mpPane->DrawHorizHandle( dc, bounds.x,
bounds.y + bounds.height - 1,
bounds.width );
}
}
event.Skip(); // pass event to the next plugin
}
void cbPaneDrawPlugin::OnStartDrawInArea( cbStartDrawInAreaEvent& event )
{
// DBG::
wxASSERT( mpClntDc == NULL );
// FOR NOW:: create/destroy client-dc upon each drawing
mpClntDc = new wxClientDC( &mpLayout->GetParentFrame() );
(*event.mppDc) = mpClntDc;
mpClntDc->SetClippingRegion( event.mArea.x, event.mArea.y,
event.mArea.width, event.mArea.height );
}
void cbPaneDrawPlugin::OnFinishDrawInArea( cbFinishDrawInAreaEvent& WXUNUSED(event) )
{
// DBG::
wxASSERT( mpClntDc );
delete mpClntDc;
mpClntDc = NULL;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -