Remove unuised XfeToolBoxForm*() hackery. Chrome widget does all the
magic now. git-svn-id: svn://10.0.0.236/trunk@292 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
@@ -2538,207 +2538,3 @@ XfeToolBoxIsNeeded(Widget w)
|
||||
return False;
|
||||
}
|
||||
/*----------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------*/
|
||||
/* */
|
||||
/* Hackery crap which should go sway real soon */
|
||||
/* */
|
||||
/*----------------------------------------------------------------------*/
|
||||
static void
|
||||
FormResizeEH(Widget form,
|
||||
XtPointer client_data,
|
||||
XEvent * event,
|
||||
Boolean * cont)
|
||||
{
|
||||
XfeToolBoxFormDoLayout(form);
|
||||
|
||||
*cont = True;
|
||||
}
|
||||
/*----------------------------------------------------------------------*/
|
||||
static void
|
||||
ToolBoxTabCB(Widget w,XtPointer client_data,XtPointer call_data)
|
||||
{
|
||||
XfeToolBoxFormDoLayout(XtParent(w));
|
||||
}
|
||||
/*----------------------------------------------------------------------*/
|
||||
static void
|
||||
ToolBoxChangeManagedCB(Widget w,XtPointer client_data,XtPointer call_data)
|
||||
{
|
||||
XfeToolBoxFormDoLayout(XtParent(w));
|
||||
}
|
||||
/*----------------------------------------------------------------------*/
|
||||
/* extern */ void
|
||||
XfeToolBoxAddLayoutSupport(Widget form,Widget tool_box)
|
||||
{
|
||||
assert( XmIsForm(form) );
|
||||
assert( XfeIsToolBox(tool_box) );
|
||||
assert( XtParent(tool_box) == form );
|
||||
|
||||
XtAddEventHandler(form,
|
||||
StructureNotifyMask,
|
||||
True,
|
||||
FormResizeEH,
|
||||
(XtPointer) NULL);
|
||||
|
||||
XtAddCallback(tool_box,
|
||||
XmNopenCallback,
|
||||
ToolBoxTabCB,
|
||||
(XtPointer) NULL);
|
||||
|
||||
XtAddCallback(tool_box,
|
||||
XmNcloseCallback,
|
||||
ToolBoxTabCB,
|
||||
(XtPointer) NULL);
|
||||
|
||||
XtAddCallback(tool_box,
|
||||
XmNchangeManagedCallback,
|
||||
ToolBoxChangeManagedCB,
|
||||
(XtPointer) NULL);
|
||||
}
|
||||
/*----------------------------------------------------------------------*/
|
||||
/* extern */ void
|
||||
XfeToolBoxFormDoLayout(Widget form)
|
||||
{
|
||||
Widget * children;
|
||||
Cardinal num_children;
|
||||
Widget tool_box = NULL;
|
||||
Widget view_area = NULL;
|
||||
Widget above_view_area = NULL;
|
||||
Cardinal i;
|
||||
|
||||
Boolean show_tool_box;
|
||||
Boolean show_view_area;
|
||||
Boolean show_above_view_area;
|
||||
|
||||
/* Make sure the form is alive */
|
||||
if (!_XfeIsAlive(form))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
children = _XfemChildren(form);
|
||||
num_children = _XfemNumChildren(form);
|
||||
|
||||
/* Make sure there is something to layout */
|
||||
if (!children || !num_children)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
assert( num_children >= 1 );
|
||||
assert( num_children <= 3 );
|
||||
|
||||
tool_box = XfeDescendantFindByClass(form,
|
||||
xfeToolBoxWidgetClass,
|
||||
XfeFIND_ALIVE,
|
||||
False);
|
||||
|
||||
/* Find the view area and above view area */
|
||||
for(i = 0; i < num_children; i++)
|
||||
{
|
||||
if (tool_box && (children[i] != tool_box))
|
||||
{
|
||||
if (!view_area)
|
||||
{
|
||||
view_area = children[i];
|
||||
}
|
||||
else
|
||||
{
|
||||
above_view_area = children[i];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* Determine if we need to show the toolbox */
|
||||
show_tool_box = (_XfeIsAlive(tool_box) && XfeToolBoxIsNeeded(tool_box));
|
||||
|
||||
/* Determine if we to need show the above view area */
|
||||
show_above_view_area = (_XfeIsAlive(above_view_area) &&
|
||||
XtIsManaged(above_view_area));
|
||||
|
||||
/* Determine if we need to show the view area */
|
||||
show_view_area = (_XfeIsAlive(view_area) &&
|
||||
XtIsManaged(view_area));
|
||||
|
||||
/* Configure the tool box */
|
||||
if (_XfeIsAlive(tool_box))
|
||||
{
|
||||
XtVaSetValues(tool_box,XmNusePreferredHeight,True,NULL);
|
||||
|
||||
if (show_tool_box)
|
||||
{
|
||||
XtVaSetValues(tool_box,
|
||||
XmNleftAttachment, XmATTACH_FORM,
|
||||
XmNrightAttachment, XmATTACH_FORM,
|
||||
XmNtopAttachment, XmATTACH_FORM,
|
||||
XmNbottomAttachment, XmATTACH_NONE,
|
||||
XmNtopOffset, 0,
|
||||
NULL);
|
||||
|
||||
_XfeResizeWidget(tool_box,
|
||||
_XfeWidth(tool_box),
|
||||
_XfemPreferredHeight(tool_box));
|
||||
|
||||
XfeResize(tool_box);
|
||||
}
|
||||
else
|
||||
{
|
||||
XtVaSetValues(tool_box,XmNtopOffset,-2,NULL);
|
||||
}
|
||||
}
|
||||
|
||||
/* Configure the above view area */
|
||||
if (show_above_view_area)
|
||||
{
|
||||
/*
|
||||
* We cant seem to be able to use attachments for the toolbox
|
||||
* because of the dynamic nature of the toolbox geometry.
|
||||
* It should work but it doesn't so we do this hckery instead.
|
||||
*/
|
||||
int offset = 0;
|
||||
|
||||
/* Place after toolbox if needed */
|
||||
if (show_tool_box)
|
||||
{
|
||||
offset = _XfeX(tool_box) + _XfemPreferredHeight(tool_box);
|
||||
}
|
||||
|
||||
XtVaSetValues(above_view_area,
|
||||
XmNleftAttachment, XmATTACH_FORM,
|
||||
XmNrightAttachment, XmATTACH_FORM,
|
||||
XmNbottomAttachment, XmATTACH_NONE,
|
||||
XmNtopAttachment, XmATTACH_FORM,
|
||||
XmNtopOffset, offset,
|
||||
NULL);
|
||||
}
|
||||
|
||||
/* Configure the view area */
|
||||
if (show_view_area)
|
||||
{
|
||||
Widget top_widget = NULL;
|
||||
unsigned char top_attachment;
|
||||
|
||||
/* Place after above view area if needed */
|
||||
if (show_above_view_area)
|
||||
{
|
||||
top_widget = above_view_area;
|
||||
}
|
||||
/* Place after tool box if needed */
|
||||
else if (show_tool_box)
|
||||
{
|
||||
top_widget = tool_box;
|
||||
}
|
||||
|
||||
top_widget = _XfeIsAlive(top_widget) ? top_widget : NULL;
|
||||
top_attachment = top_widget ? XmATTACH_WIDGET : XmATTACH_FORM;
|
||||
|
||||
XtVaSetValues(view_area,
|
||||
XmNleftAttachment, XmATTACH_FORM,
|
||||
XmNrightAttachment, XmATTACH_FORM,
|
||||
XmNbottomAttachment, XmATTACH_FORM,
|
||||
XmNtopAttachment, top_attachment,
|
||||
XmNtopWidget, top_widget,
|
||||
NULL);
|
||||
}
|
||||
}
|
||||
/*----------------------------------------------------------------------*/
|
||||
|
||||
@@ -180,19 +180,6 @@ extern Boolean
|
||||
XfeToolBoxIsNeeded (Widget w);
|
||||
/*----------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------*/
|
||||
/* */
|
||||
/* Hackery crap which should go sway real soon */
|
||||
/* */
|
||||
/*----------------------------------------------------------------------*/
|
||||
extern void
|
||||
XfeToolBoxAddLayoutSupport (Widget form,
|
||||
Widget tool_box);
|
||||
/*----------------------------------------------------------------------*/
|
||||
extern void
|
||||
XfeToolBoxFormDoLayout (Widget form);
|
||||
/*----------------------------------------------------------------------*/
|
||||
|
||||
#ifdef __cplusplus /* end C++ */
|
||||
}
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user