general cleanup, change PaintLines() to PaintRows(), cleaned up cntr.

This commit is contained in:
pinkerton%netscape.com 1998-12-03 01:27:24 +00:00
Родитель 42abeacfcb
Коммит 35f3bb2489
2 изменённых файлов: 17 добавлений и 20 удалений

Просмотреть файл

@ -71,11 +71,6 @@ nsTreeView::nsTreeView() : nsITreeView(), nsDataModelWidget()
{
NS_INIT_REFCNT();
mDataModel = nsnull;
mColumnBarRect.SetRect(0,0,0,0);
mTitleBarRect.SetRect(0,0,0,0);
mControlStripRect.SetRect(0,0,0,0);
mTreeRect.SetRect(0,0,0,0);
mCachedMoveRect.SetRect(0,0,0,0);
mMouseDown = PR_FALSE;
mMouseDragging = PR_FALSE;
mDraggingColumnHeader = PR_FALSE;
@ -155,7 +150,7 @@ nsEventStatus nsTreeView::HandleEvent(nsGUIEvent *aEvent)
PaintColumnBar(ctx, r);
// Paint the tree.
PaintTreeLines(ctx, r);
PaintTreeRows(ctx, r);
}
ctx->CopyOffScreenBits(ds, 0, 0, rect, NS_COPYBITS_USE_SOURCE_CLIP_REGION);
ctx->DestroyDrawingSurface(ds);
@ -601,7 +596,7 @@ void nsTreeView::PaintPusherArrow(nsIRenderingContext* drawCtx,
}
}
void nsTreeView::PaintTreeLines(nsIRenderingContext* drawCtx,
void nsTreeView::PaintTreeRows(nsIRenderingContext* drawCtx,
nsRect& rect)
{
// The fun part. Painting of the individual lines of the tree.
@ -619,7 +614,7 @@ void nsTreeView::PaintTreeLines(nsIRenderingContext* drawCtx,
while (pItem && yPosition < rect.y + rect.height)
{
PaintTreeLine(drawCtx, pItem, yPosition);
PaintTreeRow(drawCtx, pItem, yPosition);
n++;
pItem = (nsTreeItem*)mDataModel->GetNthItem(n);
}
@ -634,7 +629,7 @@ void nsTreeView::PaintTreeLines(nsIRenderingContext* drawCtx,
}
}
void nsTreeView::PaintTreeLine(nsIRenderingContext* drawCtx, nsTreeItem* pItem, int& yPosition)
void nsTreeView::PaintTreeRow(nsIRenderingContext* drawCtx, nsTreeItem* pItem, int& yPosition)
{
// Determine the height of this tree line. It is going to be the max of
// three objects: the trigger image, the icon, and the font height.

Просмотреть файл

@ -29,10 +29,6 @@
class nsIImageGroup;
class nsIImage;
// Constants
const int cIndentAmount = 19;
const int cIconMargin = 2;
const int cMinColumnWidth = 30;
//------------------------------------------------------------
// A tree view consists of several components: a title bar, a control strip,
@ -46,7 +42,6 @@ const int cMinColumnWidth = 30;
class nsTreeView : public nsITreeView,
public nsDataModelWidget
{
public:
nsTreeView();
@ -67,6 +62,9 @@ public:
nsWidgetInitData *aInitData);
protected:
enum { cIndentAmount = 19, cIconMargin = 2, cMinColumnWidth = 30 };
// These functions are all used in painting.
void PaintTitleBar(nsIRenderingContext* drawCtx,
nsRect& rect);
@ -83,10 +81,9 @@ protected:
void PaintPusherArrow(nsIRenderingContext* drawCtx,
PRBool isLeftArrow, int left, int width);
// These functions are used to paint the lines in the tree.
void PaintTreeLines(nsIRenderingContext* drawCtx,
nsRect& rect);
void PaintTreeLine(nsIRenderingContext* drawCtx, nsTreeItem* pItem, int& yPosition);
// These functions are used to paint the rows in the tree.
void PaintTreeRows(nsIRenderingContext* drawCtx, nsRect& rect);
void PaintTreeRow(nsIRenderingContext* drawCtx, nsTreeItem* pItem, int& yPosition);
// General function for painting a background image.
void PaintBackgroundImage(nsIRenderingContext* drawCtx,
@ -138,7 +135,12 @@ protected:
PRBool mDraggingColumnEdge; // Whether or not we're dragging a column edge.
PRBool mDraggingColumnHeader; // Whether or not we're dragging a column header
private:
// tree views are widgets which exist in one-to-one correspondance with objects on
// the screen. Copying them does not make sense, so we outlaw it explicitly.
nsTreeView ( const nsTreeView & ) ; // DON'T IMPLEMENT
nsTreeView & operator= ( const nsTreeView & ); // DON'T IMPLEMENT
};
#endif /* nsToolbar_h___ */
#endif /* nsTreeView_h___ */