Added several enums for form's controls

This commit is contained in:
rods%netscape.com 1998-12-21 16:53:49 +00:00
Родитель cccaeefc91
Коммит 8bbcbd7687
7 изменённых файлов: 229 добавлений и 9 удалений

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

@ -48,11 +48,35 @@ public:
eMetric_WindowBorderWidth,
eMetric_WindowBorderHeight,
eMetric_Widget3DBorder,
eMetric_TextFieldHeight
eMetric_TextFieldHeight,
eMetric_TextVerticalInsidePadding, // needed only because of GTK
eMetric_TextShouldUseVerticalInsidePadding, // needed only because of GTK
eMetric_TextHorizontalInsideMinimumPadding,
eMetric_TextShouldUseHorizontalInsideMinimumPadding, // needed only because of GTK
eMetric_ButtonHorizontalInsidePaddingNavQuirks,
eMetric_ButtonHorizontalInsidePaddingOffsetNavQuirks,
eMetric_ListShouldUseHorizontalInsideMinimumPadding, // needed only because of GTK
eMetric_ListHorizontalInsideMinimumPadding,
eMetric_ListShouldUseVerticalInsidePadding, // needed only because of GTK
eMetric_ListVerticalInsidePadding // needed only because of GTK
} nsMetricID;
typedef enum {
eMetricFloat_TextFieldVerticalInsidePadding,
eMetricFloat_TextFieldHorizontalInsidePadding,
eMetricFloat_TextAreaVerticalInsidePadding,
eMetricFloat_TextAreaHorizontalInsidePadding,
eMetricFloat_ListVerticalInsidePadding,
eMetricFloat_ListHorizontalInsidePadding,
eMetricFloat_ButtonVerticalInsidePadding,
eMetricFloat_ButtonHorizontalInsidePadding
} nsMetricFloatID;
NS_IMETHOD GetColor(const nsColorID aID, nscolor &aColor) = 0;
NS_IMETHOD GetMetric(const nsMetricID aID, PRInt32 & aMetric) = 0;
NS_IMETHOD GetMetric(const nsMetricFloatID aID, float & aMetric) = 0;
};
#define nsLAF nsILookAndFeel

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

@ -115,6 +115,36 @@ NS_IMETHODIMP nsLookAndFeel::GetMetric(const nsMetricID aID, PRInt32 & aMetric)
// FIXME we need to allow the entry to size itself based on the font
aMetric = 20;
break;
case eMetric_ButtonHorizontalInsidePaddingNavQuirks:
aMetric = 20;
break;
case eMetric_ButtonHorizontalInsidePaddingOffsetNavQuirks:
aMetric = 0;
break;
case eMetric_TextHorizontalInsideMinimumPadding:
aMetric = 6;
break;
case eMetric_TextVerticalInsidePadding:
aMetric = 10;
break;
case eMetric_TextShouldUseVerticalInsidePadding:
aMetric = 1;
break;
case eMetric_TextShouldUseHorizontalInsideMinimumPadding:
aMetric = 0;
break;
case eMetric_ListShouldUseHorizontalInsideMinimumPadding:
aMetric = 1;
break;
case eMetric_ListHorizontalInsideMinimumPadding:
aMetric = 7;
break;
case eMetric_ListShouldUseVerticalInsidePadding:
aMetric = 1;
break;
case eMetric_ListVerticalInsidePadding:
aMetric = 1;
break;
default:
aMetric = 0;
res = NS_ERROR_FAILURE;
@ -125,4 +155,38 @@ NS_IMETHODIMP nsLookAndFeel::GetMetric(const nsMetricID aID, PRInt32 & aMetric)
return res;
}
NS_IMETHODIMP nsLookAndFeel::GetMetric(const nsMetricFloatID aID, float & aMetric)
{
nsresult res = NS_OK;
switch (aID) {
case eMetricFloat_TextFieldVerticalInsidePadding:
aMetric = 10.0f;
break;
case eMetricFloat_TextFieldHorizontalInsidePadding:
aMetric = 10000.0f; // large number on purpose so minimum padding is used
break;
case eMetricFloat_TextAreaVerticalInsidePadding:
aMetric = 10.0f;
break;
case eMetricFloat_TextAreaHorizontalInsidePadding:
aMetric = 10000.0f; // large number on purpose so minimum padding is used
break;
case eMetricFloat_ListVerticalInsidePadding:
aMetric = 1.0f;
break;
case eMetricFloat_ListHorizontalInsidePadding:
aMetric = 7.0f;
break;
case eMetricFloat_ButtonVerticalInsidePadding:
aMetric = 0.5f;
break;
case eMetricFloat_ButtonHorizontalInsidePadding:
aMetric = 0.5f;
break;
default:
aMetric = -1.0;
res = NS_ERROR_FAILURE;
}
return res;
}

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

@ -29,6 +29,7 @@ public:
NS_IMETHOD GetColor(const nsColorID aID, nscolor &aColor);
NS_IMETHOD GetMetric(const nsMetricID aID, PRInt32 & aMetric);
NS_IMETHOD GetMetric(const nsMetricFloatID aID, float & aMetric);
};
#endif

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

@ -105,6 +105,36 @@ NS_IMETHODIMP nsLookAndFeel::GetMetric(const nsMetricID aID, PRInt32 & aMetric)
case eMetric_TextFieldHeight:
aMetric = 16;
break;
case eMetric_ButtonHorizontalInsidePaddingNavQuirks:
aMetric = 20;
break;
case eMetric_ButtonHorizontalInsidePaddingOffsetNavQuirks:
aMetric = 0;
break;
case eMetric_TextHorizontalInsideMinimumPadding:
aMetric = 3;
break;
case eMetric_TextVerticalInsidePadding:
aMetric = 0;
break;
case eMetric_TextShouldUseVerticalInsidePadding:
aMetric = 0;
break;
case eMetric_TextShouldUseHorizontalInsideMinimumPadding:
aMetric = 1;
break;
case eMetric_ListShouldUseHorizontalInsideMinimumPadding:
aMetric = 0;
break;
case eMetric_ListHorizontalInsideMinimumPadding:
aMetric = 3;
break;
case eMetric_ListShouldUseVerticalInsidePadding:
aMetric = 0;
break;
case eMetric_ListVerticalInsidePadding:
aMetric = 0;
break;
default:
aMetric = 0;
res = NS_ERROR_FAILURE;
@ -112,4 +142,38 @@ NS_IMETHODIMP nsLookAndFeel::GetMetric(const nsMetricID aID, PRInt32 & aMetric)
return res;
}
NS_IMETHODIMP nsLookAndFeel::GetMetric(const nsMetricFloatID aID, float & aMetric)
{
nsresult res = NS_OK;
switch (aID) {
case eMetricFloat_TextFieldVerticalInsidePadding:
aMetric = 0.25f;
break;
case eMetricFloat_TextFieldHorizontalInsidePadding:
aMetric = 0.95f;
break;
case eMetricFloat_TextAreaVerticalInsidePadding:
aMetric = 0.40f;
break;
case eMetricFloat_TextAreaHorizontalInsidePadding:
aMetric = 0.40f;
break;
case eMetricFloat_ListVerticalInsidePadding:
aMetric = 0.10f;
break;
case eMetricFloat_ListHorizontalInsidePadding:
aMetric = 0.40f;
break;
case eMetricFloat_ButtonVerticalInsidePadding:
aMetric = 0.5f;
break;
case eMetricFloat_ButtonHorizontalInsidePadding:
aMetric = 0.5f;
break;
default:
aMetric = -1.0;
res = NS_ERROR_FAILURE;
}
return res;
}

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

@ -29,6 +29,7 @@ public:
NS_IMETHOD GetColor(const nsColorID aID, nscolor &aColor);
NS_IMETHOD GetMetric(const nsMetricID aID, PRInt32 & aMetric);
NS_IMETHOD GetMetric(const nsMetricFloatID aID, float & aMetric);
};
#endif

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

@ -34,9 +34,9 @@ nsLookAndFeel::~nsLookAndFeel()
NS_IMETHODIMP nsLookAndFeel::GetColor(const nsColorID aID, nscolor &aColor)
{
nsresult res = NS_OK;
int idx;
switch (aID) {
nsresult res = NS_OK;
int idx;
switch (aID) {
case eColor_WindowBackground:
idx = COLOR_WINDOW;
break;
@ -78,15 +78,15 @@ NS_IMETHODIMP nsLookAndFeel::GetColor(const nsColorID aID, nscolor &aColor)
break;
}
aColor = ::GetSysColor(idx);
aColor = ::GetSysColor(idx);
return res;
return res;
}
NS_IMETHODIMP nsLookAndFeel::GetMetric(const nsMetricID aID, PRInt32 & aMetric)
{
nsresult res = NS_OK;
switch (aID) {
nsresult res = NS_OK;
switch (aID) {
case eMetric_WindowTitleHeight:
aMetric = ::GetSystemMetrics(SM_CYCAPTION);
break;
@ -102,10 +102,75 @@ NS_IMETHODIMP nsLookAndFeel::GetMetric(const nsMetricID aID, PRInt32 & aMetric)
case eMetric_TextFieldHeight:
aMetric = 24;
break;
case eMetric_ButtonHorizontalInsidePaddingNavQuirks:
aMetric = 10;
break;
case eMetric_ButtonHorizontalInsidePaddingOffsetNavQuirks:
aMetric = 8;
break;
case eMetric_TextHorizontalInsideMinimumPadding:
aMetric = 3;
break;
case eMetric_TextVerticalInsidePadding:
aMetric = 0;
break;
case eMetric_TextShouldUseVerticalInsidePadding:
aMetric = 0;
break;
case eMetric_TextShouldUseHorizontalInsideMinimumPadding:
aMetric = 1;
break;
case eMetric_ListShouldUseHorizontalInsideMinimumPadding:
aMetric = 0;
break;
case eMetric_ListHorizontalInsideMinimumPadding:
aMetric = 3;
break;
case eMetric_ListShouldUseVerticalInsidePadding:
aMetric = 0;
break;
case eMetric_ListVerticalInsidePadding:
aMetric = 0;
break;
default:
aMetric = -1;
res = NS_ERROR_FAILURE;
}
return res;
return res;
}
NS_IMETHODIMP nsLookAndFeel::GetMetric(const nsMetricFloatID aID, float & aMetric)
{
nsresult res = NS_OK;
switch (aID) {
case eMetricFloat_TextFieldVerticalInsidePadding:
aMetric = 0.25f;
break;
case eMetricFloat_TextFieldHorizontalInsidePadding:
aMetric = 0.95f;
break;
case eMetricFloat_TextAreaVerticalInsidePadding:
aMetric = 0.40f;
break;
case eMetricFloat_TextAreaHorizontalInsidePadding:
aMetric = 0.40f;
break;
case eMetricFloat_ListVerticalInsidePadding:
aMetric = 0.10f;
break;
case eMetricFloat_ListHorizontalInsidePadding:
aMetric = 0.40f;
break;
case eMetricFloat_ButtonVerticalInsidePadding:
aMetric = 0.25f;
break;
case eMetricFloat_ButtonHorizontalInsidePadding:
aMetric = 0.25f;
break;
default:
aMetric = -1.0;
res = NS_ERROR_FAILURE;
}
return res;
}

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

@ -30,6 +30,7 @@ public:
NS_IMETHOD GetColor(const nsColorID aID, nscolor &aColor);
NS_IMETHOD GetMetric(const nsMetricID aID, PRInt32 & aMetric);
NS_IMETHOD GetMetric(const nsMetricFloatID aID, float & aMetric);
};
#endif