From 22c12455c385537d11ed737dc723a6986ab05495 Mon Sep 17 00:00:00 2001 From: "radha%netscape.com" Date: Mon, 24 Aug 1998 20:13:43 +0000 Subject: [PATCH] Call RDFImage to draw background pixmap --- cmd/xfe/src/RDFTreeView.cpp | 45 ++++++++++++++++++++++++++++++++++--- 1 file changed, 42 insertions(+), 3 deletions(-) diff --git a/cmd/xfe/src/RDFTreeView.cpp b/cmd/xfe/src/RDFTreeView.cpp index 47c7e1ba385..e57cf07ef17 100644 --- a/cmd/xfe/src/RDFTreeView.cpp +++ b/cmd/xfe/src/RDFTreeView.cpp @@ -29,6 +29,7 @@ #include "Command.h" #include "xfe2_extern.h" #include "xpgetstr.h" +#include "RDFImage.h" #include #include @@ -57,6 +58,7 @@ extern int XP_BKMKS_LESS_THAN_ONE_HOUR_AGO; extern "C" { extern PRBool fe_getPixelFromRGB(MWContext *, char * rgbString, Pixel * pixel); + extern void treeview_bg_image_cb(XtPointer clientData); }; @@ -216,6 +218,8 @@ XFE_RDFTreeView::~XFE_RDFTreeView() { delete _popup; } + // Remove yourself from the RDFImage's listener list + XFE_RDFImage::removeListener(this); } ////////////////////////////////////////////////////////////////////////// void @@ -577,9 +581,9 @@ XFE_RDFTreeView::setHTView(HT_View htview) { return; } - + setHTTreeViewProperties(_ht_rdfView); fill_tree(); - setHTTreeViewProperties(_ht_rdfView); + } ////////////////////////////////////////////////////////////////////// HT_View @@ -1020,9 +1024,29 @@ XFE_RDFTreeView::setHTTreeViewProperties( HT_View view) /* viewBGURL */ HT_GetTemplateData(HT_TopNode(view), gNavCenter->viewBGURL, HT_COLUMN_STRING, &data); + if (data) { - /* Do the RDFImage thing here */ + /* Do the RDFImage thing here */ + char * imageURL = (char *)data; + XFE_RDFImage * rdfImage=NULL; + Pixmap image, mask; + + + rdfImage = XFE_RDFImage::isImageAvailable(imageURL); + if (rdfImage) { + image = rdfImage->getPixmap(); + mask = rdfImage->getMask(); + XtVaSetValues(m_widget, XmNbackgroundPixmap, image, NULL); + } + else { + + rdfImage = new XFE_RDFImage(m_toplevel, (void *) this, (char *) data, CONTEXT_DATA(m_contextData)->colormap, m_widget); + rdfImage->setCompleteCallback((completeCallbackPtr)treeview_bg_image_cb, (void *) m_widget); + rdfImage->loadImage(); + } + + } @@ -1158,7 +1182,22 @@ fe_getPixelFromRGB(MWContext * context, char * color, Pixel *pixel) return (bColorsFound); } +}; +extern "C" +{ +void +treeview_bg_image_cb(XtPointer client_data) +{ + + callbackClientData * cb = (callbackClientData *) client_data; + Widget tree = (Widget )cb->widget; + Dimension b_width=0, b_height=0; + + XtVaSetValues(tree, XmNbackgroundPixmap, cb->image, NULL); + XP_FREE(cb); + +} }; /* extern C */