Move html pane to XFE_RDFChromeTreeView.
git-svn-id: svn://10.0.0.236/trunk@9615 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
@@ -28,7 +28,13 @@
|
||||
#include "IconGroup.h"
|
||||
#include "xp_ncent.h"
|
||||
|
||||
#include <Xfe/XfeAll.h>
|
||||
//#include <Xfe/XfeAll.h>
|
||||
|
||||
#include <Xm/Form.h>
|
||||
|
||||
#ifdef MOZ_SELECTOR_BAR
|
||||
#include <Xfe/ToolScroll.h>
|
||||
#endif
|
||||
|
||||
#if DEBUG_slamm
|
||||
#define D(x) x
|
||||
@@ -63,10 +69,9 @@ XFE_NavCenterView::XFE_NavCenterView(XFE_Component *toplevel_component,
|
||||
#ifdef MOZ_SELECTOR_BAR
|
||||
createSelectorBar();
|
||||
#endif
|
||||
|
||||
createTree();
|
||||
#ifdef HTML_PANE
|
||||
createHTMLArea();
|
||||
#endif
|
||||
|
||||
doAttachments();
|
||||
|
||||
#ifdef MOZ_SELECTOR_BAR
|
||||
@@ -74,21 +79,12 @@ XFE_NavCenterView::XFE_NavCenterView(XFE_Component *toplevel_component,
|
||||
#endif
|
||||
|
||||
addView(_rdftree);
|
||||
#ifdef HTML_PANE
|
||||
addView(_htmlview);
|
||||
#endif
|
||||
|
||||
#ifdef MOZ_SELECTOR_BAR
|
||||
XtManageChild(_selector);
|
||||
#endif /*MOZ_SELECTOR_BAR*/
|
||||
|
||||
_rdftree->show();
|
||||
|
||||
#ifdef HTML_PANE
|
||||
_htmlview->show();
|
||||
_htmlview->getURL(NET_CreateURLStruct("http://home.netscape.com/",NET_DONT_RELOAD));
|
||||
#endif
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -305,7 +301,7 @@ XFE_NavCenterView::addHTView(HT_View htview)
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
void
|
||||
XFE_NavCenterView::selector_activate_cb(Widget /* w */,
|
||||
XtPointer clientData,
|
||||
XtPointer /* clientData */,
|
||||
XtPointer /* callData */)
|
||||
{
|
||||
// HT_View htView = (HT_View)clientData;
|
||||
@@ -426,13 +422,8 @@ XFE_NavCenterView::createTree()
|
||||
_rdftree = new XFE_RDFChromeTreeView(this, getBaseWidget(),
|
||||
this, m_contextData);
|
||||
_rdftree->setStandAloneState(_isStandalone);
|
||||
}
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
void
|
||||
XFE_NavCenterView::createHTMLArea()
|
||||
{
|
||||
_htmlview = new XFE_HTMLView(this, getBaseWidget(),
|
||||
NULL, m_contextData);
|
||||
|
||||
// _rdftree->setHtmlPaneHeight(50);
|
||||
}
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
void
|
||||
@@ -449,11 +440,7 @@ XFE_NavCenterView::doAttachments()
|
||||
|
||||
XtVaSetValues(_rdftree->getBaseWidget(),
|
||||
XmNtopAttachment, XmATTACH_FORM,
|
||||
#ifdef HTML_PANE
|
||||
XmNbottomAttachment, XmATTACH_NONE,
|
||||
#else
|
||||
XmNbottomAttachment, XmATTACH_FORM,
|
||||
#endif
|
||||
#ifdef MOZ_SELECTOR_BAR
|
||||
XmNleftAttachment, XmATTACH_WIDGET,
|
||||
XmNleftWidget, _selector,
|
||||
@@ -462,23 +449,5 @@ XFE_NavCenterView::doAttachments()
|
||||
#endif /*MOZ_SELECTOR_BAR*/
|
||||
XmNrightAttachment, XmATTACH_FORM,
|
||||
NULL);
|
||||
|
||||
#ifdef HTML_PANE
|
||||
Widget html_base = _htmlview->getBaseWidget();
|
||||
XtVaSetValues(html_base,
|
||||
XmNtopAttachment, XmATTACH_WIDGET,
|
||||
XmNtopWidget, _rdftree->getBaseWidget(),
|
||||
XmNbottomAttachment, XmATTACH_FORM,
|
||||
XmNleftAttachment, XmATTACH_WIDGET,
|
||||
#ifdef MOZ_SELECTOR_BAR
|
||||
XmNleftAttachment, XmATTACH_WIDGET,
|
||||
XmNleftWidget, _selector,
|
||||
#else
|
||||
XmNleftAttachment, XmATTACH_FORM,
|
||||
#endif /*MOZ_SELECTOR_BAR*/
|
||||
XmNrightAttachment, XmATTACH_FORM,
|
||||
NULL);
|
||||
#endif
|
||||
|
||||
}
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
|
||||
@@ -30,11 +30,8 @@
|
||||
#include "RDFBase.h"
|
||||
#include "RDFImage.h"
|
||||
|
||||
class XFE_HTMLView;
|
||||
class XFE_RDFChromeTreeView;
|
||||
|
||||
|
||||
|
||||
class XFE_NavCenterView : public XFE_View,
|
||||
public XFE_RDFBase
|
||||
{
|
||||
@@ -68,8 +65,8 @@ protected:
|
||||
virtual void deletePane ();
|
||||
|
||||
private:
|
||||
XFE_HTMLView * _htmlview;
|
||||
XFE_RDFChromeTreeView * _rdftree;
|
||||
|
||||
#ifdef MOZ_SELECTOR_BAR
|
||||
Widget _selector;
|
||||
#else
|
||||
@@ -84,7 +81,6 @@ private:
|
||||
void createSelectorBar ();
|
||||
#endif
|
||||
void createTree ();
|
||||
void createHTMLArea ();
|
||||
void doAttachments ();
|
||||
};
|
||||
|
||||
|
||||
@@ -52,22 +52,26 @@ typedef struct _closeRdfViewCBStruct {
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
XFE_RDFChromeTreeView::XFE_RDFChromeTreeView(XFE_Component * toplevel,
|
||||
Widget parent,
|
||||
XFE_View * parent_view,
|
||||
MWContext * context) :
|
||||
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)
|
||||
_modeControl(NULL),
|
||||
_htmlPaneForm(NULL),
|
||||
_htmlPane(NULL),
|
||||
_htmlPaneHeight(0)
|
||||
{
|
||||
createControlToolbar();
|
||||
|
||||
createViewLabel();
|
||||
|
||||
doAttachments();
|
||||
|
||||
show();
|
||||
XtManageChild(_tree);
|
||||
}
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
XFE_RDFChromeTreeView::~XFE_RDFChromeTreeView()
|
||||
@@ -131,6 +135,36 @@ XFE_RDFChromeTreeView::createViewLabel()
|
||||
XmNalignment, XmALIGNMENT_BEGINNING,
|
||||
NULL);
|
||||
|
||||
}
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
void
|
||||
XFE_RDFChromeTreeView::createHtmlPane()
|
||||
{
|
||||
_htmlPaneForm = XtVaCreateWidget("htmlPaneForm",
|
||||
xmFormWidgetClass,
|
||||
getBaseWidget(),
|
||||
XmNshadowThickness, 0,
|
||||
NULL);
|
||||
#if 0
|
||||
_htmlPane = new XFE_HTMLView(this,
|
||||
_htmlPaneForm,
|
||||
NULL,
|
||||
getContext());
|
||||
|
||||
addView(_htmlPane);
|
||||
|
||||
XtVaSetValues(_htmlPane->getBaseWidget(),
|
||||
XmNtopAttachment, XmATTACH_FORM,
|
||||
XmNrightAttachment, XmATTACH_FORM,
|
||||
XmNleftAttachment, XmATTACH_FORM,
|
||||
XmNbottomAttachment, XmATTACH_FORM,
|
||||
NULL);
|
||||
|
||||
_htmlPane->show();
|
||||
|
||||
// HACK HACK HACK
|
||||
_htmlPane->getURL(NET_CreateURLStruct("http://dunk",NET_DONT_RELOAD));
|
||||
#endif
|
||||
}
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
void
|
||||
@@ -150,13 +184,67 @@ XFE_RDFChromeTreeView::doAttachments()
|
||||
XmNleftAttachment, XmATTACH_FORM,
|
||||
XmNbottomAttachment, XmATTACH_NONE,
|
||||
NULL);
|
||||
XtVaSetValues(_tree,
|
||||
XmNtopAttachment, XmATTACH_WIDGET,
|
||||
XmNtopWidget, _viewLabel,
|
||||
XmNrightAttachment, XmATTACH_FORM,
|
||||
XmNleftAttachment, XmATTACH_FORM,
|
||||
XmNbottomAttachment, XmATTACH_FORM,
|
||||
NULL);
|
||||
|
||||
// 0%
|
||||
if (_htmlPaneHeight == 0)
|
||||
{
|
||||
XtVaSetValues(_tree,
|
||||
XmNtopAttachment, XmATTACH_WIDGET,
|
||||
XmNtopWidget, _viewLabel,
|
||||
XmNrightAttachment, XmATTACH_FORM,
|
||||
XmNleftAttachment, XmATTACH_FORM,
|
||||
XmNbottomAttachment, XmATTACH_FORM,
|
||||
NULL);
|
||||
}
|
||||
// 100%
|
||||
else if (_htmlPaneHeight == 100)
|
||||
{
|
||||
XtVaSetValues(_htmlPaneForm,
|
||||
XmNtopAttachment, XmATTACH_WIDGET,
|
||||
XmNtopWidget, _viewLabel,
|
||||
XmNrightAttachment, XmATTACH_FORM,
|
||||
XmNleftAttachment, XmATTACH_FORM,
|
||||
XmNbottomAttachment, XmATTACH_FORM,
|
||||
NULL);
|
||||
|
||||
}
|
||||
// 0% < height < 100%
|
||||
else
|
||||
{
|
||||
int max_html_pane_height =
|
||||
XfeHeight(getBaseWidget()) -
|
||||
XfeHeight(_controlToolBar) -
|
||||
XfeHeight(_viewLabel);
|
||||
|
||||
XP_ASSERT( max_html_pane_height > 0 );
|
||||
|
||||
int html_pane_height = max_html_pane_height * _htmlPaneHeight / 100;
|
||||
|
||||
XP_ASSERT( _htmlPane != NULL );
|
||||
|
||||
XtVaSetValues(_htmlPaneForm,
|
||||
// XmNheight, 50,
|
||||
XmNheight, html_pane_height,
|
||||
NULL);
|
||||
|
||||
XtVaSetValues(_htmlPaneForm,
|
||||
XmNtopAttachment, XmATTACH_NONE,
|
||||
XmNrightAttachment, XmATTACH_FORM,
|
||||
XmNleftAttachment, XmATTACH_FORM,
|
||||
XmNbottomAttachment, XmATTACH_FORM,
|
||||
NULL);
|
||||
|
||||
XtVaSetValues(_tree,
|
||||
XmNtopAttachment, XmATTACH_WIDGET,
|
||||
XmNtopWidget, _viewLabel,
|
||||
XmNrightAttachment, XmATTACH_FORM,
|
||||
XmNleftAttachment, XmATTACH_FORM,
|
||||
XmNbottomAttachment, XmATTACH_WIDGET,
|
||||
XmNbottomWidget, _htmlPaneForm,
|
||||
NULL);
|
||||
|
||||
// _htmlPane->show();
|
||||
}
|
||||
}
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
void
|
||||
@@ -176,7 +264,7 @@ XFE_RDFChromeTreeView::updateRoot()
|
||||
|
||||
XFE_RDFTreeView::updateRoot();
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
void
|
||||
XFE_RDFChromeTreeView::notify(HT_Resource n,
|
||||
HT_Event whatHappened)
|
||||
@@ -224,7 +312,13 @@ XFE_RDFChromeTreeView::closeRdfView_cb(Widget /* w */, XtPointer clientData, XtP
|
||||
|
||||
#endif /*MOZ_SELECTOR_BAR*/
|
||||
}
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// XFE_RDFChromeTreeView public methods.
|
||||
//
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
void
|
||||
XFE_RDFChromeTreeView::setHTTitlebarProperties(HT_View view, Widget titleBar)
|
||||
{
|
||||
@@ -247,8 +341,6 @@ XFE_RDFChromeTreeView::setHTTitlebarProperties(HT_View view, Widget titleBar)
|
||||
XtSetArg(av[ac], XmNforeground, pixel); ac++;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/* titleBarBGColor */
|
||||
HT_GetTemplateData(HT_TopNode(view), gNavCenter->titleBarBGColor, HT_COLUMN_STRING, &data);
|
||||
if (data)
|
||||
@@ -266,10 +358,46 @@ XFE_RDFChromeTreeView::setHTTitlebarProperties(HT_View view, Widget titleBar)
|
||||
|
||||
}
|
||||
|
||||
|
||||
XtSetValues(titleBar, av, ac);
|
||||
|
||||
|
||||
}
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Set the HTML pane height (as a percentage of the view)
|
||||
//
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
void
|
||||
XFE_RDFChromeTreeView::setHtmlPaneHeight(PRUint32 height)
|
||||
{
|
||||
// Make sure it actually changed
|
||||
if (_htmlPaneHeight == height)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
// Make sure its not more than 100%
|
||||
if (_htmlPaneHeight > 100)
|
||||
{
|
||||
_htmlPaneHeight = 100;
|
||||
}
|
||||
|
||||
// Create the html pane if needed (for the first time)
|
||||
if ((height > 0) && (_htmlPane == NULL))
|
||||
{
|
||||
createHtmlPane();
|
||||
}
|
||||
|
||||
_htmlPaneHeight = height;
|
||||
|
||||
XP_ASSERT( _htmlPaneForm != NULL );
|
||||
XP_ASSERT( _htmlPane != NULL );
|
||||
|
||||
// Show the html pane form if needed
|
||||
XfeSetManagedState(_htmlPaneForm,_htmlPaneHeight != 0);
|
||||
|
||||
// Show the tree if needed
|
||||
XfeSetManagedState(_tree,_htmlPaneHeight != 100);
|
||||
|
||||
// Redo attachments
|
||||
doAttachments();
|
||||
}
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
|
||||
@@ -30,6 +30,7 @@
|
||||
#include "htrdf.h"
|
||||
#include "NavCenterView.h"
|
||||
#include "RDFTreeView.h"
|
||||
#include "HTMLView.h"
|
||||
|
||||
class XFE_RDFChromeTreeView : public XFE_RDFTreeView
|
||||
{
|
||||
@@ -58,7 +59,11 @@ public:
|
||||
// RDF Specific calls
|
||||
void setHTTitlebarProperties(HT_View view, Widget titleBar);
|
||||
|
||||
// Set the HTML pane height (as a percentage of the view)
|
||||
void setHtmlPaneHeight(PRUint32 height);
|
||||
|
||||
protected:
|
||||
|
||||
// Override RDFBase methods
|
||||
virtual void updateRoot ();
|
||||
|
||||
@@ -79,11 +84,21 @@ private:
|
||||
// Toggle tree operating mode
|
||||
Widget _modeControl;
|
||||
|
||||
// The HTML pane form
|
||||
Widget _htmlPaneForm;
|
||||
|
||||
// The HTML pane
|
||||
XFE_HTMLView * _htmlPane;
|
||||
|
||||
// The height of the HTML pane as a percentage of the view
|
||||
PRUint32 _htmlPaneHeight;
|
||||
|
||||
static void closeRdfView_cb(Widget, XtPointer, XtPointer);
|
||||
|
||||
// Create widgets
|
||||
void createControlToolbar();
|
||||
void createViewLabel();
|
||||
void createHtmlPane();
|
||||
void doAttachments();
|
||||
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user