Adding caret width and blink time to nsILookAndFeel
git-svn-id: svn://10.0.0.236/trunk@39411 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
parent
4c961dbcc0
commit
997d078ca7
@ -66,7 +66,10 @@ public:
|
||||
eMetric_ListHorizontalInsideMinimumPadding,
|
||||
|
||||
eMetric_ListShouldUseVerticalInsidePadding, // needed only because of GTK
|
||||
eMetric_ListVerticalInsidePadding // needed only because of GTK
|
||||
eMetric_ListVerticalInsidePadding, // needed only because of GTK
|
||||
|
||||
eMetric_CaretBlinkTime, // default, may be overriden by OS
|
||||
eMetric_CaretWidthTwips
|
||||
} nsMetricID;
|
||||
|
||||
typedef enum {
|
||||
|
||||
@ -139,6 +139,12 @@ NS_IMETHODIMP nsLookAndFeel::GetMetric(const nsMetricID aID, PRInt32 & aMetric)
|
||||
case eMetric_ListVerticalInsidePadding:
|
||||
aMetric = 0;
|
||||
break;
|
||||
case eMetric_CaretBlinkTime:
|
||||
aMetric = 500;
|
||||
break;
|
||||
case eMetric_CaretWidthTwips:
|
||||
aMetric = 20;
|
||||
break;
|
||||
default:
|
||||
aMetric = -1;
|
||||
res = NS_ERROR_FAILURE;
|
||||
|
||||
@ -153,6 +153,12 @@ NS_IMETHODIMP nsLookAndFeel::GetMetric(const nsMetricID aID, PRInt32 & aMetric)
|
||||
case eMetric_ListVerticalInsidePadding:
|
||||
aMetric = 1;
|
||||
break;
|
||||
case eMetric_CaretBlinkTime:
|
||||
aMetric = 500;
|
||||
break;
|
||||
case eMetric_CaretWidthTwips:
|
||||
aMetric = 20;
|
||||
break;
|
||||
default:
|
||||
aMetric = -1;
|
||||
res = NS_ERROR_FAILURE;
|
||||
|
||||
@ -159,6 +159,12 @@ NS_IMETHODIMP nsLookAndFeel::GetMetric(const nsMetricID aID, PRInt32 & aMetric)
|
||||
case eMetric_ListVerticalInsidePadding:
|
||||
aMetric = 3;
|
||||
break;
|
||||
case eMetric_CaretBlinkTime:
|
||||
aMetric = ::GetCaretTime() * 1000 / 60;
|
||||
break;
|
||||
case eMetric_CaretWidthTwips:
|
||||
aMetric = 20;
|
||||
break;
|
||||
default:
|
||||
aMetric = 0;
|
||||
res = NS_ERROR_FAILURE;
|
||||
|
||||
@ -110,6 +110,12 @@ NS_IMETHODIMP nsLookAndFeel::GetMetric(const nsMetricID aID, PRInt32 & aMetric)
|
||||
case eMetric_RadioboxSize:
|
||||
aMetric = 12;
|
||||
break;
|
||||
case eMetric_CaretBlinkTime:
|
||||
aMetric = 500;
|
||||
break;
|
||||
case eMetric_CaretWidthTwips:
|
||||
aMetric = 20;
|
||||
break;
|
||||
default:
|
||||
aMetric = 0;
|
||||
res = NS_ERROR_FAILURE;
|
||||
|
||||
@ -123,6 +123,28 @@ NS_IMETHODIMP nsLookAndFeel::GetMetric(const nsMetricID aID, PRInt32 & aMetric)
|
||||
aMetric = 0;
|
||||
break;
|
||||
|
||||
case eMetric_CaretBlinkTime:
|
||||
aMetric = WinQuerySysValue( HWND_DESKTOP, SV_CURSORRATE);
|
||||
break;
|
||||
case eMetric_CaretWidthTwips:
|
||||
// Sigh - this is in 'twips', should be in 'app units', but there's no
|
||||
// DC anyway so we can't work it out!
|
||||
|
||||
// The reason for this is that there is some rounding weirdness,
|
||||
// such that the 2-pixel caret requested by the windows guys
|
||||
// got rounded down to a 1-pixel caret for drawing, because
|
||||
// of errors in conversion to twips and back.
|
||||
|
||||
ULONG ulPels = WinQuerySysValue( HWND_DESKTOP, SV_CYBORDER);
|
||||
|
||||
// With luck, either:
|
||||
// * these metrics will go into nsILookAndFeel, or
|
||||
// * we'll get an nsIDeviceContext here
|
||||
//
|
||||
// For now, lets assume p2t = 20.
|
||||
aMetric = 20 * ulPels;
|
||||
break;
|
||||
|
||||
default:
|
||||
NS_ASSERTION( 0, "Bad metric");
|
||||
break;
|
||||
|
||||
@ -158,6 +158,12 @@ NS_IMETHODIMP nsLookAndFeel::GetMetric(const nsMetricID aID, PRInt32 & aMetric)
|
||||
break;
|
||||
case eMetric_ListVerticalInsidePadding:
|
||||
aMetric = 0; // REVISIT - HACK!
|
||||
break;
|
||||
case eMetric_CaretBlinkTime:
|
||||
aMetric = 500;
|
||||
break;
|
||||
case eMetric_CaretWidthTwips:
|
||||
aMetric = 20;
|
||||
break;
|
||||
default:
|
||||
aMetric = -1;
|
||||
|
||||
@ -139,6 +139,12 @@ NS_IMETHODIMP nsLookAndFeel::GetMetric(const nsMetricID aID, PRInt32 & aMetric)
|
||||
case eMetric_ListVerticalInsidePadding:
|
||||
aMetric = 0;
|
||||
break;
|
||||
case eMetric_CaretBlinkTime:
|
||||
aMetric = 500;
|
||||
break;
|
||||
case eMetric_CaretWidthTwips:
|
||||
aMetric = 30;
|
||||
break;
|
||||
default:
|
||||
aMetric = -1;
|
||||
res = NS_ERROR_FAILURE;
|
||||
|
||||
@ -98,6 +98,12 @@ NS_IMETHODIMP nsLookAndFeel::GetMetric(const nsMetricID aID, PRInt32 & aMetric)
|
||||
case eMetric_ListVerticalInsidePadding:
|
||||
aMetric = 0;
|
||||
break;
|
||||
case eMetric_CaretBlinkTime:
|
||||
aMetric = 500;
|
||||
break;
|
||||
case eMetric_CaretWidthTwips:
|
||||
aMetric = 20;
|
||||
break;
|
||||
default:
|
||||
aMetric = -1;
|
||||
res = NS_ERROR_FAILURE;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user