Removal of the mutable keyword (to keep VC4.2 happy), and a fix to make

sure the folder and trigger images load for everyone.
This commit is contained in:
hyatt%netscape.com 1998-12-02 23:04:55 +00:00
Родитель 917e7c14ab
Коммит 1152415d74
5 изменённых файлов: 42 добавлений и 24 удалений

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

@ -225,25 +225,34 @@ void nsHTTreeDataModel::GetTitleBarText(nsString& text) const
// Protected Helpers
nsIImage* nsHTTreeDataModel::GetTitleBGImage() const
{
// cast away const because we can't use mutable
nsHTTreeDataModel* self = const_cast<nsHTTreeDataModel*>(this);
nsString url("http://www.shadowland.org/images/ancient_glyphs.jpg");
if (mTitleBGRequest == nsnull)
mTitleBGRequest = RequestImage(url);
self->mTitleBGRequest = RequestImage(url);
return mTitleBGRequest->GetImage();
}
nsIImage* nsHTTreeDataModel::GetControlStripBGImage() const
{
// cast away const because we can't use mutable
nsHTTreeDataModel* self = const_cast<nsHTTreeDataModel*>(this);
nsString url("http://www.shadowland.org/images/minute_bumps.jpg");
if (mControlStripBGRequest == nsnull)
mControlStripBGRequest = RequestImage(url);
self->mControlStripBGRequest = RequestImage(url);
return mControlStripBGRequest->GetImage();
}
nsIImage* nsHTTreeDataModel::GetColumnHeaderBGImage() const
{
// cast away const because we can't use mutable
nsHTTreeDataModel* self = const_cast<nsHTTreeDataModel*>(this);
nsString url("http://www.shadowland.org/images/tapestry.jpg");
if (mColumnHeaderBGRequest == nsnull)
mColumnHeaderBGRequest = RequestImage(url);
self->mColumnHeaderBGRequest = RequestImage(url);
return mColumnHeaderBGRequest->GetImage();
}

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

@ -103,9 +103,9 @@ private:
PRUint32 mVisibleColumnCount;
PRUint32 mTotalColumnCount;
mutable nsIImageRequest* mTitleBGRequest; // The title bar background image
mutable nsIImageRequest* mControlStripBGRequest;// The control strip bg image
mutable nsIImageRequest* mColumnHeaderBGRequest;// The column header background image
nsIImageRequest* mTitleBGRequest; // The title bar background image
nsIImageRequest* mControlStripBGRequest;// The control strip bg image
nsIImageRequest* mColumnHeaderBGRequest;// The column header background image
};

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

@ -68,7 +68,7 @@ nsresult nsHTTreeItem::QueryInterface(REFNSIID aIID, void** aInstancePtr)
// TreeItem Implementation ---------------------
void nsHTTreeItem::GetItemStyle(nsIDeviceContext* dc, nsTreeItemStyleInfo& styleInfo)
void nsHTTreeItem::GetItemStyle(nsIDeviceContext* dc, nsTreeItemStyleInfo& styleInfo) const
{
styleInfo.foregroundColor = NS_RGB(0,0,0);
styleInfo.backgroundColor = NS_RGB(240,240,240);
@ -85,53 +85,62 @@ void nsHTTreeItem::GetItemStyle(nsIDeviceContext* dc, nsTreeItemStyleInfo& style
styleInfo.pBackgroundImage = GetBackgroundImage();
}
nsIImage* nsHTTreeItem::GetTriggerImage()
nsIImage* nsHTTreeItem::GetTriggerImage() const
{
// cast away const because we can't use mutable
nsHTTreeItem* self = const_cast<nsHTTreeItem*>(this);
// TODO: Really read in these properties
nsString openTriggerURL("file:///c|/Program%20Files/SL/CLIENT/IMAGES/overlay.gif");
nsString closedTriggerURL("file:///c|/Program%20Files/SL/CLIENT/IMAGES/overlay.gif");
nsString openTriggerURL("http://www.shadowland.org/client/images/overlay.gif");
nsString closedTriggerURL("http://www.shadowland.org/client/images/overlay.gif");
if (IsExpanded())
{
if (mOpenTriggerRequest == nsnull)
{
// Request the image.
mOpenTriggerRequest = RequestImage(openTriggerURL);
self->mOpenTriggerRequest = RequestImage(openTriggerURL);
}
return mOpenTriggerRequest->GetImage();
}
else
{
if (mClosedTriggerRequest == nsnull)
mClosedTriggerRequest = RequestImage(closedTriggerURL);
self->mClosedTriggerRequest = RequestImage(closedTriggerURL);
return mClosedTriggerRequest->GetImage();
}
}
nsIImage* nsHTTreeItem::GetIconImage()
nsIImage* nsHTTreeItem::GetIconImage() const
{
nsString openIconURL("file:///c|/Program%20Files/SL/CLIENT/IMAGES/OpenRead.gif");
nsString closedIconURL("file:///c|/Program%20Files/SL/CLIENT/IMAGES/ClosedRead.gif");
// cast away const because we can't use mutable
nsHTTreeItem* self = const_cast<nsHTTreeItem*>(this);
nsString openIconURL("http://www.shadowland.org/CLIENT/IMAGES/OpenRead.gif");
nsString closedIconURL("http://www.shadowland.org/CLIENT/IMAGES/ClosedRead.gif");
if (IsExpanded())
{
if (mOpenIconRequest == nsnull)
mOpenIconRequest = RequestImage(openIconURL);
self->mOpenIconRequest = RequestImage(openIconURL);
return mOpenIconRequest->GetImage();
}
else
{
if (mClosedIconRequest == nsnull)
mClosedIconRequest = RequestImage(closedIconURL);
self->mClosedIconRequest = RequestImage(closedIconURL);
return mClosedIconRequest->GetImage();
}
}
nsIImage* nsHTTreeItem::GetBackgroundImage()
nsIImage* nsHTTreeItem::GetBackgroundImage() const
{
// cast away const because we can't use mutable
nsHTTreeItem* self = const_cast<nsHTTreeItem*>(this);
nsString bgURL("http://www.shadowland.org/images/chalk.jpg");
if (mBackgroundRequest == nsnull)
mBackgroundRequest = RequestImage(bgURL);
self->mBackgroundRequest = RequestImage(bgURL);
return mBackgroundRequest->GetImage();
}

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

@ -59,15 +59,15 @@ public:
// End of delegated functions
virtual void GetItemStyle(nsIDeviceContext* dc,
nsTreeItemStyleInfo& styleInfo);
nsTreeItemStyleInfo& styleInfo) const;
virtual void GetTextForColumn(nsTreeColumn* pColumn, nsString& nodeText) const;
protected:
nsIImageRequest* RequestImage(nsString& reqUrl) const; // Helper to kick off the image load.
nsIImage* GetTriggerImage();
nsIImage* GetIconImage();
nsIImage* GetBackgroundImage();
nsIImage* GetTriggerImage() const;
nsIImage* GetIconImage() const;
nsIImage* GetBackgroundImage() const;
protected:
nsIImageRequest* mClosedIconRequest; // Closed image

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

@ -44,7 +44,7 @@ public:
virtual ~nsTreeItem() {};
virtual void GetItemStyle(nsIDeviceContext* dc,
nsTreeItemStyleInfo& styleInfo) = 0;
nsTreeItemStyleInfo& styleInfo) const = 0;
virtual void GetTextForColumn(nsTreeColumn* pColumn, nsString& nodeText) const = 0;