More stuff for RDF properties as well as fixing color parsing.

git-svn-id: svn://10.0.0.236/trunk@7308 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
pinkerton%netscape.com
1998-08-05 02:54:32 +00:00
parent 420c492a7e
commit f4dbc31508
2 changed files with 27 additions and 13 deletions

View File

@@ -189,11 +189,11 @@ URDFUtilities :: GetColor ( HT_Resource inNode, void* inHTToken, RGBColor* outCo
if ( inNode && inHTToken ) {
char* color = NULL;
PRBool success = HT_GetNodeData ( inNode, inHTToken, HT_COLUMN_STRING, &color );
PRBool success = HT_GetTemplateData ( inNode, inHTToken, HT_COLUMN_STRING, &color );
if ( success && color ) {
uint8 red, green, blue;
if ( XP_ColorNameToRGB(color, &red, &green, &blue) == 0 ) {
*outColor = UGraphics::MakeRGBColor(red, green, blue);\
if ( LO_ParseRGB(color, &red, &green, &blue) ) {
*outColor = UGraphics::MakeRGBColor(red, green, blue);
usingHTColor = true;
}
}
@@ -208,21 +208,34 @@ URDFUtilities :: GetColor ( HT_Resource inNode, void* inHTToken, RGBColor* outCo
// PropertyValueBool
//
// Gets the value of the given token and determines if it is "[Y|y]es" or "[N|n]o" based
// on the first character. Returns the appropriate boolean value (yes = true).
// on the first character. Returns the appropriate boolean value (yes = true). If the
// property is not specified (or not specified correctly) return the default value.
//
bool
URDFUtilities :: PropertyValueBool ( HT_Resource inNode, void* inHTToken )
URDFUtilities :: PropertyValueBool ( HT_Resource inNode, void* inHTToken, bool inDefaultValue )
{
char* value = NULL;
bool retVal = inDefaultValue;
PRBool success = HT_GetNodeData ( inNode, inHTToken, HT_COLUMN_STRING, &value );
if ( success && value )
return (*value == 'y' || *value == 'Y') ? true : false;
return false;
if ( inNode && inHTToken ) {
char* value = NULL;
PRBool success = HT_GetTemplateData ( inNode, inHTToken, HT_COLUMN_STRING, &value );
if ( success && value ) {
switch ( *value ) {
case 'Y': case 'y':
retVal = true;
break;
case 'N': case 'n':
retVal = false;
}
}
}
return retVal;
} // PropertyValueBool
//
// LaunchNode
// LaunchURL

View File

@@ -51,8 +51,9 @@ class URDFUtilities
static bool SetupForegroundTextColor ( HT_Resource inNode, void* inHTToken, ThemeTextColor inBrush ) ;
static bool GetColor ( HT_Resource inNode, void* inHTToken, RGBColor * outColor ) ;
// true if property is "yes", false if value is "no"
static bool PropertyValueBool ( HT_Resource inNode, void* inHTToken );
// true if property is "yes", false if value is "no", and the default if the property is
// not (or incorrectly) specified
static bool PropertyValueBool ( HT_Resource inNode, void* inHTToken, bool inDefaultValue );
// call these before starting to load any URLs. HT may know how to handle them mo-better.
static bool LaunchNode ( HT_Resource inNode ) ;