mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-09 03:15:11 +00:00
added Set/GetLineHeight().
This commit is contained in:
parent
f9909200eb
commit
7269559974
@ -169,6 +169,21 @@ public:
|
||||
*/
|
||||
NS_IMETHOD GetScrollProperties(PRUint32 *aProperties) = 0;
|
||||
|
||||
/**
|
||||
* Set the height of a line used for line scrolling.
|
||||
* @param aHeight new line height in app units. the default
|
||||
* height is 12 points.
|
||||
* @return error status
|
||||
*/
|
||||
NS_IMETHOD SetLineHeight(nscoord aHeight) = 0;
|
||||
|
||||
/**
|
||||
* Get the height of a line used for line scrolling.
|
||||
* @param aHeight out parameter for line height
|
||||
* @return error status
|
||||
*/
|
||||
NS_IMETHOD GetLineHeight(nscoord *aHeight) = 0;
|
||||
|
||||
/**
|
||||
* Scroll the view up or down by aNumLines lines. positive
|
||||
* values move down in the view. Prevents scrolling off the
|
||||
|
@ -390,6 +390,7 @@ nsScrollingView :: nsScrollingView()
|
||||
mCornerView = nsnull;
|
||||
mScrollPref = nsScrollPreference_kAuto;
|
||||
mScrollingTimer = nsnull;
|
||||
mLineHeight = 240;
|
||||
}
|
||||
|
||||
nsScrollingView :: ~nsScrollingView()
|
||||
@ -442,6 +443,32 @@ nsrefcnt nsScrollingView :: Release()
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
NS_IMETHODIMP nsScrollingView :: Init(nsIViewManager* aManager,
|
||||
const nsRect &aBounds,
|
||||
const nsIView *aParent,
|
||||
const nsViewClip *aClip,
|
||||
nsViewVisibility aVisibilityFlag)
|
||||
{
|
||||
nsIDeviceContext *dx = nsnull;
|
||||
|
||||
aManager->GetDeviceContext(dx);
|
||||
|
||||
if (dx)
|
||||
{
|
||||
float t2d, d2a;
|
||||
|
||||
dx->GetTwipsToDevUnits(t2d);
|
||||
dx->GetDevUnitsToAppUnits(d2a);
|
||||
|
||||
mLineHeight = NSToCoordRound(240.0f * t2d * d2a);
|
||||
|
||||
NS_RELEASE(dx);
|
||||
}
|
||||
|
||||
return nsView::Init(aManager, aBounds, aParent, aClip, aVisibilityFlag);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsScrollingView :: SetDimensions(nscoord width, nscoord height, PRBool aPaint)
|
||||
{
|
||||
nsIDeviceContext *dx;
|
||||
@ -1047,7 +1074,7 @@ NS_IMETHODIMP nsScrollingView :: ComputeScrollOffsets(PRBool aAdjustWidgets)
|
||||
dy = NSTwipsToIntPixels((offy - mOffsetY), scale);
|
||||
|
||||
scrollv->SetParameters(mSizeY, availheight,
|
||||
mOffsetY, NSIntPointsToTwips(12));
|
||||
mOffsetY, mLineHeight);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -1126,7 +1153,7 @@ NS_IMETHODIMP nsScrollingView :: ComputeScrollOffsets(PRBool aAdjustWidgets)
|
||||
dx = NSTwipsToIntPixels((offx - mOffsetX), scale);
|
||||
|
||||
scrollh->SetParameters(mSizeX, availwidth,
|
||||
mOffsetX, NSIntPointsToTwips(12));
|
||||
mOffsetX, mLineHeight);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -1568,6 +1595,18 @@ NS_IMETHODIMP nsScrollingView :: GetScrollProperties(PRUint32 *aProperties)
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsScrollingView :: SetLineHeight(nscoord aHeight)
|
||||
{
|
||||
mLineHeight = aHeight;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsScrollingView :: GetLineHeight(nscoord *aHeight)
|
||||
{
|
||||
*aHeight = mLineHeight;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsScrollingView :: ScrollByLines(PRInt32 aNumLines)
|
||||
{
|
||||
nsIScrollbar *scrollv = nsnull;
|
||||
|
@ -36,6 +36,11 @@ public:
|
||||
void** aInstancePtr);
|
||||
|
||||
//overrides
|
||||
NS_IMETHOD Init(nsIViewManager* aManager,
|
||||
const nsRect &aBounds,
|
||||
const nsIView *aParent,
|
||||
const nsViewClip *aClip = nsnull,
|
||||
nsViewVisibility aVisibilityFlag = nsViewVisibility_kShow);
|
||||
NS_IMETHOD SetDimensions(nscoord width, nscoord height, PRBool aPaint = PR_TRUE);
|
||||
NS_IMETHOD SetPosition(nscoord aX, nscoord aY);
|
||||
NS_IMETHOD HandleEvent(nsGUIEvent *aEvent, PRUint32 aEventFlags, nsEventStatus &aStatus);
|
||||
@ -64,6 +69,8 @@ public:
|
||||
PRBool *aHorizontalVisible) const;
|
||||
NS_IMETHOD SetScrollProperties(PRUint32 aProperties);
|
||||
NS_IMETHOD GetScrollProperties(PRUint32 *aProperties);
|
||||
NS_IMETHOD SetLineHeight(nscoord aHeight);
|
||||
NS_IMETHOD GetLineHeight(nscoord *aHeight);
|
||||
NS_IMETHOD ScrollByLines(PRInt32 aNumLines);
|
||||
NS_IMETHOD ScrollByPages(PRInt32 aNumPages);
|
||||
|
||||
@ -98,6 +105,7 @@ protected:
|
||||
nsITimer *mScrollingTimer;
|
||||
nscoord mScrollingDelta;
|
||||
PRUint32 mScrollProperties;
|
||||
nscoord mLineHeight;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
Loading…
Reference in New Issue
Block a user