Change RDFView to RDFChromeTreeView (per mcafee's request). RDFChromeTreeView inherits from RDFTreeView (adding chrome around it).

This commit is contained in:
slamm%netscape.com 1998-09-03 21:43:38 +00:00
Родитель f5b64d4b80
Коммит e60426e280
6 изменённых файлов: 367 добавлений и 2 удалений

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

@ -116,12 +116,12 @@ CPPSRCS = \
PrefsLang.cpp \
PrefsProxiesView.cpp \
RDFBase.cpp \
RDFChromeTreeView.cpp \
RDFImage.cpp \
RDFMenuToolbarBase.cpp \
RDFTreeView.cpp \
RDFToolbar.cpp \
RDFToolbox.cpp \
RDFView.cpp \
RadioGroup.cpp \
Splash.cpp \
Toolbar.cpp \

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

@ -121,12 +121,12 @@ CPPSRCS = \
PrefsLang.cpp \
PrefsProxiesView.cpp \
RDFBase.cpp \
RDFChromeTreeView.cpp \
RDFImage.cpp \
RDFMenuToolbarBase.cpp \
RDFTreeView.cpp \
RDFToolbar.cpp \
RDFToolbox.cpp \
RDFView.cpp \
RadioGroup.cpp \
Splash.cpp \
Toolbar.cpp \

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

@ -0,0 +1,274 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
*
* The contents of this file are subject to the Netscape Public License
* Version 1.0 (the "NPL"); you may not use this file except in
* compliance with the NPL. You may obtain a copy of the NPL at
* http://www.mozilla.org/NPL/
*
* Software distributed under the NPL is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
* for the specific language governing rights and limitations under the
* NPL.
*
* The Initial Developer of this code under the NPL is Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
* Reserved.
*/
/*
RDFChromeTreeView.cpp -- view of rdf data
Created: Stephen Lamm <slamm@netscape.com>, 5-Nov-97.
*/
#include "RDFChromeTreeView.h"
#include "Command.h"
#include "xfe2_extern.h"
#include "xpgetstr.h"
#include <XmL/Tree.h>
#include <Xfe/Button.h>
#include <Xfe/ToolBar.h>
#include <Xm/Label.h>
#define TREE_NAME "RdfTree"
extern "C" RDF_NCVocab gNavCenter;
extern "C"
{
extern PRBool fe_getPixelFromRGB(MWContext *, char * rgbString, Pixel * pixel);
};
#ifdef DEBUG_slamm
#define D(x) x
#else
#define D(x)
#endif
#define SECONDS_PER_DAY 86400L
typedef struct _closeRdfViewCBStruct {
XFE_RDFChromeTreeView * rdfview;
XFE_NavCenterView * ncview;
} closeRdfViewCBStruct;
//////////////////////////////////////////////////////////////////////////
XFE_RDFChromeTreeView::XFE_RDFChromeTreeView(XFE_Component * toplevel,
Widget parent,
XFE_View * parent_view,
MWContext * context) :
XFE_RDFTreeView(toplevel, parent, parent_view, context),
_viewLabel(NULL),
_controlToolBar(NULL),
_addBookmarkControl(NULL),
_closeControl(NULL),
_modeControl(NULL)
{
createControlToolbar();
createViewLabel();
doAttachments();
XtManageChild(_tree);
show();
}
//////////////////////////////////////////////////////////////////////////
XFE_RDFChromeTreeView::~XFE_RDFChromeTreeView()
{
}
//////////////////////////////////////////////////////////////////////////
void
XFE_RDFChromeTreeView::createControlToolbar()
{
// Control Tool Bar
_controlToolBar =
XtVaCreateManagedWidget("controlToolBar",
xfeToolBarWidgetClass,
getBaseWidget(),
XmNorientation, XmHORIZONTAL,
XmNusePreferredWidth, True,
XmNusePreferredHeight, True,
XmNchildForceWidth, False,
XmNchildForceHeight, True,
XmNchildUsePreferredWidth, True,
XmNchildUsePreferredHeight, False,
NULL);
// Add Bookmark
_addBookmarkControl = XtVaCreateManagedWidget("addBookmark",
xfeButtonWidgetClass,
_controlToolBar,
NULL);
// Close
_closeControl = XtVaCreateManagedWidget("close",
xfeButtonWidgetClass,
_controlToolBar,
NULL);
#if 0
// Mode
_modeControl = XtVaCreateManagedWidget("mode",
xfeButtonWidgetClass,
_controlToolBar,
NULL);
#endif
#ifdef NOT_YET
closeRdfViewCBStruct * cb_str = new closeRdfViewCBStruct;
cb_str->rdfview = this;
cb_str->ncview = (XFE_NavCenterView *)parent_view;
XtAddCallback(closeRDFChromeTreeView, XmNactivateCallback, (XtCallbackProc)closeRdfView_cb , (void *)cb_str);
#endif /* NOT_YET */
}
//////////////////////////////////////////////////////////////////////////
void
XFE_RDFChromeTreeView::createViewLabel()
{
// View label
_viewLabel =
XtVaCreateManagedWidget("viewLabel",
xmLabelWidgetClass,
getBaseWidget(),
XmNalignment, XmALIGNMENT_BEGINNING,
NULL);
}
//////////////////////////////////////////////////////////////////////////
void
XFE_RDFChromeTreeView::doAttachments()
{
XtVaSetValues(_controlToolBar,
XmNtopAttachment, XmATTACH_FORM,
XmNrightAttachment, XmATTACH_FORM,
XmNleftAttachment, XmATTACH_NONE,
XmNbottomAttachment, XmATTACH_NONE,
NULL);
XtVaSetValues(_viewLabel,
XmNtopAttachment, XmATTACH_WIDGET,
XmNtopWidget, _controlToolBar,
XmNrightAttachment, XmATTACH_FORM,
XmNleftAttachment, XmATTACH_FORM,
XmNbottomAttachment, XmATTACH_NONE,
NULL);
XtVaSetValues(_tree,
XmNtopAttachment, XmATTACH_WIDGET,
XmNtopWidget, _viewLabel,
XmNrightAttachment, XmATTACH_FORM,
XmNleftAttachment, XmATTACH_FORM,
XmNbottomAttachment, XmATTACH_FORM,
NULL);
}
//////////////////////////////////////////////////////////////////////////
void
XFE_RDFChromeTreeView::updateRoot()
{
char * label = HT_GetViewName(_ht_view);
// XXX Aurora NEED TO LOCALIZE XXX
XmString xmstr = XmStringCreateLocalized(label);
XtVaSetValues(_viewLabel,XmNlabelString,xmstr,NULL);
XmStringFree(xmstr);
// Set the HT properties
setHTTitlebarProperties(_ht_view, _viewLabel);
XFE_RDFTreeView::updateRoot();
}
void
XFE_RDFChromeTreeView::notify(HT_Resource n,
HT_Event whatHappened)
{
D(debugEvent(n, whatHappened,"RV"););
// HT_EVENT_VIEW_SELECTED
if (whatHappened == HT_EVENT_VIEW_SELECTED)
{
setHTView(HT_GetView(n));
}
XFE_RDFTreeView::notify(n, whatHappened);
}
//////////////////////////////////////////////////////////////////////
void
XFE_RDFChromeTreeView::closeRdfView_cb(Widget /* w */, XtPointer clientData, XtPointer /* callData */)
{
closeRdfViewCBStruct * obj = (closeRdfViewCBStruct *) clientData;
XFE_NavCenterView * ncview = obj->ncview;
// Widget nc_base_widget = ncview->getBaseWidget();
Widget parent = XtParent(obj->rdfview->_controlToolBar);
/* XtVaSetValues(nc_base_widget, XmNresizable, True, NULL); */
XtUnmanageChild(parent);
#ifdef MOZ_SELECTOR_BAR
Widget selector = (Widget )ncview->getSelector();
XtUnmanageChild(selector);
XtVaSetValues(selector, XmNrightAttachment, XmATTACH_FORM,
XmNleftAttachment, XmATTACH_FORM,
XmNtopAttachment, XmATTACH_FORM,
XmNbottomAttachment, XmATTACH_FORM,
NULL);
XtManageChild(selector);
#endif /*MOZ_SELECTOR_BAR*/
}
void
XFE_RDFChromeTreeView::setHTTitlebarProperties(HT_View view, Widget titleBar)
{
Arg av[30];
Cardinal ac=0;
void * data=NULL;
Pixel pixel;
PRBool gotit=False;
//////////////// TITLEBAR PROPERTIES ///////////////////
ac = 0;
/* titleBarFGColor */
HT_GetTemplateData(HT_TopNode(view), gNavCenter->titleBarFGColor, HT_COLUMN_STRING, &data);
if (data)
{
gotit = fe_getPixelFromRGB(getContext(), (char *) data, &pixel);
if (gotit)
XtSetArg(av[ac], XmNforeground, pixel); ac++;
}
/* titleBarBGColor */
HT_GetTemplateData(HT_TopNode(view), gNavCenter->titleBarBGColor, HT_COLUMN_STRING, &data);
if (data)
{
gotit = fe_getPixelFromRGB(getContext(), (char *) data, &pixel);
if (gotit)
XtSetArg(av[ac], XmNbackground, pixel); ac++;
}
/* titleBarBGURL */
HT_GetTemplateData(HT_TopNode(view), gNavCenter->titleBarBGURL, HT_COLUMN_STRING, &data);
if (data)
{
/* Do the RDFImage thing */
}
XtSetValues(titleBar, av, ac);
}

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

@ -0,0 +1,91 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
*
* The contents of this file are subject to the Netscape Public License
* Version 1.0 (the "NPL"); you may not use this file except in
* compliance with the NPL. You may obtain a copy of the NPL at
* http://www.mozilla.org/NPL/
*
* Software distributed under the NPL is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
* for the specific language governing rights and limitations under the
* NPL.
*
* The Initial Developer of this code under the NPL is Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
* Reserved.
*/
/*
RDFChromeTreeView.h -- class definition for XFE_RDFChromeTreeView
Created: Stephen Lamm <slamm@netscape.com>, 5-Nov-97.
*/
#ifndef _xfe_rdfchrometreeview_h
#define _xfe_rdfchrometreeview_h
#include "View.h"
#include "IconGroup.h"
#include "htrdf.h"
#include "NavCenterView.h"
#include "RDFTreeView.h"
class XFE_RDFChromeTreeView : public XFE_RDFTreeView
{
public:
XFE_RDFChromeTreeView(XFE_Component *toplevel, Widget parent,
XFE_View *parent_view, MWContext *context);
~XFE_RDFChromeTreeView();
// Get tooltipString & docString;
// returned string shall be freed by the callee
// row < 0 indicates heading row; otherwise it is a content row
// (starting from 0)
//
virtual char *getCellTipString(int /* row */, int /* column */) {return NULL;}
virtual char *getCellDocString(int /* row */, int /* column */) {return NULL;}
// Open properties dialog
//void openPropertiesWindow();
//void closePropertiesWindow();
// Override RDFBase notify method
void notify(HT_Resource n, HT_Event whatHappened);
// RDF Specific calls
void setHTTitlebarProperties(HT_View view, Widget titleBar);
protected:
// Override RDFBase methods
virtual void updateRoot ();
private:
// The label that displays the currently open pane
Widget _viewLabel;
// Parent of the label and the button on top
Widget _controlToolBar;
// Toggle tree operating mode
Widget _addBookmarkControl;
// Close the view
Widget _closeControl;
// Toggle tree operating mode
Widget _modeControl;
static void closeRdfView_cb(Widget, XtPointer, XtPointer);
// Create widgets
void createControlToolbar();
void createViewLabel();
void doAttachments();
};
#endif /* _xfe_rdfchrometreeview_h */

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

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