Bug 345141 - arrows on scrollbars do nothing. Patch by Adam Guthrie, r+sr=roc

This commit is contained in:
martijn.martijn%gmail.com 2006-07-19 22:13:18 +00:00
Родитель 299094a298
Коммит 35635dee14
3 изменённых файлов: 30 добавлений и 18 удалений

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

@ -95,13 +95,14 @@ nsScrollbarButtonFrame::HandleEvent(nsPresContext* aPresContext,
// if we didn't handle the press ourselves, pass it on to the superclass
if (!HandleButtonPress(aPresContext, aEvent, aEventStatus))
return nsButtonBoxFrame::HandleEvent(aPresContext, aEvent, aEventStatus);
return NS_OK;
}
PRBool
nsScrollbarButtonFrame::HandleButtonPress(nsPresContext* aPresContext,
nsGUIEvent* aEvent,
nsEventStatus* aEventStatus)
nsGUIEvent* aEvent,
nsEventStatus* aEventStatus)
{
// Get the desired action for the scrollbar button.
nsILookAndFeel::nsMetricID tmpAction;
@ -177,7 +178,6 @@ nsScrollbarButtonFrame::HandleButtonPress(nsPresContext* aPresContext,
// We were told to ignore this click, or someone assigned a non-standard
// value to the button's action.
return PR_FALSE;
break;
}
// set this attribute so we can style it later
mContent->SetAttr(kNameSpaceID_None, nsXULAtoms::active, NS_LITERAL_STRING("true"), PR_TRUE);

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

@ -332,6 +332,19 @@ NS_IMETHODIMP nsLookAndFeel::GetMetric(const nsMetricID aID, PRInt32 & aMetric)
{
nsresult res = NS_OK;
// Set these before they can get overrided in the nsXPLookAndFeel.
switch (aID) {
case eMetric_ScrollButtonLeftMouseButtonAction:
aMetric = 0;
return NS_OK;
case eMetric_ScrollButtonMiddleMouseButtonAction:
aMetric = 1;
return NS_OK;
case eMetric_ScrollButtonRightMouseButtonAction:
aMetric = 2;
return NS_OK;
}
res = nsXPLookAndFeel::GetMetric(aID, aMetric);
if (NS_SUCCEEDED(res))
return res;
@ -492,15 +505,6 @@ NS_IMETHODIMP nsLookAndFeel::GetMetric(const nsMetricID aID, PRInt32 & aMetric)
case eMetric_ScrollSliderStyle:
aMetric = eMetric_ScrollThumbStyleProportional;
break;
case eMetric_ScrollButtonLeftMouseButtonAction:
aMetric = 0;
break;
case eMetric_ScrollButtonMiddleMouseButtonAction:
aMetric = 1;
break;
case eMetric_ScrollButtonRightMouseButtonAction:
aMetric = 2;
break;
case eMetric_TreeOpenDelay:
aMetric = 1000;
break;

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

@ -106,12 +106,6 @@ nsLookAndFeelIntPref nsXPLookAndFeel::sIntPrefs[] =
eMetric_TreeScrollLinesMax, PR_FALSE, nsLookAndFeelTypeInt, 0 },
{ "accessibility.tabfocus",
eMetric_TabFocusModel, PR_FALSE, nsLookAndFeelTypeInt, 0 },
{ "ui.scrollbarButtonLeftMouseButtonAction",
eMetric_ScrollButtonLeftMouseButtonAction, PR_FALSE, nsLookAndFeelTypeInt, 0 },
{ "ui.scrollbarButtonMiddleMouseButtonAction",
eMetric_ScrollButtonMiddleMouseButtonAction, PR_FALSE, nsLookAndFeelTypeInt, 3 },
{ "ui.scrollbarButtonRightMouseButtonAction",
eMetric_ScrollButtonRightMouseButtonAction, PR_FALSE, nsLookAndFeelTypeInt, 3 },
{ "ui.alertNotificationOrigin",
eMetric_AlertNotificationOrigin, PR_FALSE, nsLookAndFeelTypeInt, 0 },
};
@ -551,6 +545,20 @@ nsXPLookAndFeel::GetMetric(const nsMetricID aID, PRInt32& aMetric)
if (!sInitialized)
Init();
// Set the default values for these prefs. but allow different platforms
// to override them in their nsLookAndFeel if desired.
switch (aID) {
case eMetric_ScrollButtonLeftMouseButtonAction:
aMetric = 0;
return NS_OK;
case eMetric_ScrollButtonMiddleMouseButtonAction:
aMetric = 3;
return NS_OK;
case eMetric_ScrollButtonRightMouseButtonAction:
aMetric = 3;
return NS_OK;
}
for (unsigned int i = 0; i < ((sizeof (sIntPrefs) / sizeof (*sIntPrefs))); ++i)
if (sIntPrefs[i].isSet && (sIntPrefs[i].id == aID))
{