Move the dynamic layout parts of XfeManager to their own superclass

XfeDynamicManager.  This will make it a lot easier to write complicated
layout functions, such as the fancy configurable toolbar stuff.
Renamed a bunch of poorly named methods and data members.
This commit is contained in:
ramiro%netscape.com 1998-09-17 14:11:54 +00:00
Родитель c87d8f8601
Коммит 3a27404009
53 изменённых файлов: 4027 добавлений и 2446 удалений

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

@ -253,8 +253,7 @@ _XFE_WIDGET_CLASS_RECORD(arrow,Arrow) =
{
XfeInheritBitGravity, /* bit_gravity */
PreferredGeometry, /* preferred_geometry */
XfeInheritMinimumGeometry, /* minimum_geometry */
XfeInheritUpdateRect, /* update_rect */
XfeInheritUpdateBoundary, /* update_boundary */
NULL, /* prepare_components */
XfeInheritLayoutComponents, /* layout_components */
DrawBackground, /* draw_background */
@ -451,8 +450,8 @@ DrawArrow(Widget w,XEvent *event,Region region,XRectangle * clip_rect)
{
XfeArrowPart * ap = _XfeArrowPart(w);
XfeButtonPart * bp = _XfeButtonPart(w);
Dimension width = XfeMin(ap->arrow_width,_XfeRectWidth(w));
Dimension height = XfeMin(ap->arrow_height,_XfeRectHeight(w));
Dimension width = XfeMin(ap->arrow_width,_XfeBoundaryWidth(w));
Dimension height = XfeMin(ap->arrow_height,_XfeBoundaryHeight(w));
Position x = (_XfeWidth(w) - width) / 2;
Position y = (_XfeHeight(w) - height) / 2;

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

@ -614,8 +614,7 @@ _XFE_WIDGET_CLASS_RECORD(button,Button) =
{
XfeInheritBitGravity, /* bit_gravity */
PreferredGeometry, /* preferred_geometry */
XfeInheritMinimumGeometry, /* minimum_geometry */
XfeInheritUpdateRect, /* update_rect */
XfeInheritUpdateBoundary, /* update_boundary */
PrepareComponents, /* prepare_components */
LayoutComponents, /* layout_components */
DrawBackground, /* draw_background */
@ -1866,7 +1865,7 @@ StringLayoutLabelOnly(Widget w)
{
case XmALIGNMENT_BEGINNING:
lp->label_rect.x = _XfeRectX(w) + RAISE_OFFSET(bp);
lp->label_rect.x = _XfeBoundaryX(w) + RAISE_OFFSET(bp);
break;
@ -1909,7 +1908,7 @@ StringLayoutLabelOnBottom(Widget w)
{
case XmALIGNMENT_BEGINNING:
lp->label_rect.x = _XfeRectX(w) + RAISE_OFFSET(bp);
lp->label_rect.x = _XfeBoundaryX(w) + RAISE_OFFSET(bp);
break;
@ -1955,7 +1954,7 @@ StringLayoutLabelOnTop(Widget w)
{
case XmALIGNMENT_BEGINNING:
lp->label_rect.x = _XfeRectX(w) + RAISE_OFFSET(bp);
lp->label_rect.x = _XfeBoundaryX(w) + RAISE_OFFSET(bp);
break;

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

@ -388,8 +388,7 @@ _XFE_WIDGET_CLASS_RECORD(cascade,Cascade) =
{
XfeInheritBitGravity, /* bit_gravity */
PreferredGeometry, /* preferred_geometry */
XfeInheritMinimumGeometry, /* minimum_geometry */
XfeInheritUpdateRect, /* update_rect */
XfeInheritUpdateBoundary, /* update_boundary */
NULL, /* prepare_components */
LayoutComponents, /* layout_components */
XfeInheritDrawBackground, /* draw_background */
@ -777,10 +776,10 @@ LayoutCascadeArrow(Widget w)
else
{
XfeRectSet(&bound,
_XfeRectX(w),
_XfeRectY(w),
_XfeRectWidth(w),
_XfeRectHeight(w));
_XfeBoundaryX(w),
_XfeBoundaryY(w),
_XfeBoundaryWidth(w),
_XfeBoundaryHeight(w));
}
/* Determine the horizontal layout of the arrow */

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

@ -61,9 +61,9 @@
/* Core class methods */
/* */
/*----------------------------------------------------------------------*/
static void Initialize (Widget,Widget,ArgList,Cardinal *);
static void Destroy (Widget);
static Boolean SetValues (Widget,Widget,Widget,ArgList,Cardinal *);
static void CoreInitialize (Widget,Widget,ArgList,Cardinal *);
static void CoreDestroy (Widget);
static Boolean CoreSetValues (Widget,Widget,Widget,ArgList,Cardinal *);
/*----------------------------------------------------------------------*/
/* */
@ -78,11 +78,11 @@ static Boolean ConstraintSetValues (Widget,Widget,Widget,ArgList,Cardinal *);
/* XfeManager class methods */
/* */
/*----------------------------------------------------------------------*/
static void PreferredGeometry (Widget,Dimension *,Dimension *);
static Boolean AcceptChild (Widget);
static Boolean InsertChild (Widget);
static Boolean DeleteChild (Widget);
static void LayoutChildren (Widget);
static void PreferredGeometry (Widget,Dimension *,Dimension *);
static Boolean AcceptStaticChild (Widget);
static Boolean InsertStaticChild (Widget);
static Boolean DeleteStaticChild (Widget);
static void LayoutStaticChildren (Widget);
/*----------------------------------------------------------------------*/
/* */
@ -282,7 +282,7 @@ _XFE_WIDGET_CLASS_RECORD(chrome,Chrome) =
NULL, /* class_initialize */
NULL, /* class_part_initialize*/
FALSE, /* class_inited */
Initialize, /* initialize */
CoreInitialize, /* initialize */
NULL, /* initialize_hook */
XtInheritRealize, /* realize */
NULL, /* actions */
@ -294,10 +294,10 @@ _XFE_WIDGET_CLASS_RECORD(chrome,Chrome) =
XtExposeCompressMaximal, /* compress_exposure */
TRUE, /* compress_enterleave */
FALSE, /* visible_interest */
Destroy, /* destroy */
CoreDestroy, /* destroy */
XtInheritResize, /* resize */
XtInheritExpose, /* expose */
SetValues, /* set_values */
CoreSetValues, /* set_values */
NULL, /* set_values_hook */
XtInheritSetValuesAlmost, /* set_values_almost */
NULL, /* get_values_hook */
@ -342,24 +342,23 @@ _XFE_WIDGET_CLASS_RECORD(chrome,Chrome) =
},
/* XfeManager Part */
{
XfeInheritBitGravity, /* bit_gravity */
PreferredGeometry, /* preferred_geometry */
XfeInheritMinimumGeometry, /* minimum_geometry */
XfeInheritUpdateRect, /* update_rect */
AcceptChild, /* accept_child */
InsertChild, /* insert_child */
DeleteChild, /* delete_child */
NULL, /* change_managed */
NULL, /* prepare_components */
NULL, /* layout_components */
LayoutChildren, /* layout_children */
NULL, /* draw_background */
XfeInheritDrawShadow, /* draw_shadow */
NULL, /* draw_components */
False, /* count_layable_children*/
NULL, /* child_is_layable */
NULL, /* extension */
{
XfeInheritBitGravity, /* bit_gravity */
PreferredGeometry, /* preferred_geometry */
XfeInheritUpdateBoundary, /* update_boundary */
XfeInheritUpdateChildrenInfo, /* update_children_info */
XfeInheritLayoutWidget, /* layout_widget */
AcceptStaticChild, /* accept_static_child */
InsertStaticChild, /* insert_static_child */
DeleteStaticChild, /* delete_static_child */
LayoutStaticChildren, /* layout_static_children */
NULL, /* change_managed */
NULL, /* prepare_components */
NULL, /* layout_components */
NULL, /* draw_background */
XfeInheritDrawShadow, /* draw_shadow */
NULL, /* draw_components */
NULL, /* extension */
},
/* XfeChrome Part */
@ -439,23 +438,23 @@ DefaultChromeChildType(Widget child,int offset,XrmValue * value)
/* */
/*----------------------------------------------------------------------*/
static void
Initialize(Widget rw,Widget nw,ArgList args,Cardinal *nargs)
CoreInitialize(Widget rw,Widget nw,ArgList args,Cardinal *nargs)
{
XfeChromePart * cp = _XfeChromePart(nw);
/* XfeChromePart * cp = _XfeChromePart(nw); */
/* Finish of initialization */
_XfeManagerChainInitialize(rw,nw,xfeChromeWidgetClass);
}
/*----------------------------------------------------------------------*/
static void
Destroy(Widget w)
CoreDestroy(Widget w)
{
XfeChromePart * cp = _XfeChromePart(w);
/* XfeChromePart * cp = _XfeChromePart(w); */
}
/*----------------------------------------------------------------------*/
static Boolean
SetValues(Widget ow,Widget rw,Widget nw,ArgList args,Cardinal *nargs)
CoreSetValues(Widget ow,Widget rw,Widget nw,ArgList args,Cardinal *nargs)
{
XfeChromePart * np = _XfeChromePart(nw);
XfeChromePart * op = _XfeChromePart(ow);
@ -555,8 +554,8 @@ SetValues(Widget ow,Widget rw,Widget nw,ArgList args,Cardinal *nargs)
static void
ConstraintInitialize(Widget rc,Widget nc,ArgList av,Cardinal * ac)
{
Widget w = _XfeParent(nc);
XfeChromeConstraintPart * cp = _XfeChromeConstraintPart(nc);
/* Widget w = _XfeParent(nc); */
XfeChromeConstraintPart * cp = _XfeChromeConstraintPart(nc);
/* Make sure the chrome child type is ok */
XfeRepTypeCheck(nc,XmRChromeChildType,&cp->chrome_child_type,
@ -569,7 +568,7 @@ ConstraintInitialize(Widget rc,Widget nc,ArgList av,Cardinal * ac)
static Boolean
ConstraintSetValues(Widget oc,Widget rc,Widget nc,ArgList av,Cardinal * ac)
{
Widget w = XtParent(nc);
/* Widget w = XtParent(nc); */
XfeChromeConstraintPart * ncp = _XfeChromeConstraintPart(nc);
XfeChromeConstraintPart * ocp = _XfeChromeConstraintPart(oc);
@ -690,7 +689,7 @@ PreferredGeometry(Widget w,Dimension * width,Dimension * height)
}
/*----------------------------------------------------------------------*/
static Boolean
AcceptChild(Widget child)
AcceptStaticChild(Widget child)
{
Widget w = XtParent(child);
XfeChromePart * cp = _XfeChromePart(w);
@ -725,7 +724,7 @@ AcceptChild(Widget child)
}
/*----------------------------------------------------------------------*/
static Boolean
InsertChild(Widget child)
InsertStaticChild(Widget child)
{
Widget w = XtParent(child);
XfeChromePart * cp = _XfeChromePart(w);
@ -792,7 +791,7 @@ InsertChild(Widget child)
}
/*----------------------------------------------------------------------*/
static Boolean
DeleteChild(Widget child)
DeleteStaticChild(Widget child)
{
Widget w = XtParent(child);
XfeChromePart * cp = _XfeChromePart(w);
@ -838,11 +837,11 @@ DeleteChild(Widget child)
cp->right_view = NULL;
}
return !_XfeBeingDestroyed(w);
return _XfeIsAlive(w);
}
/*----------------------------------------------------------------------*/
static void
LayoutChildren(Widget w)
LayoutStaticChildren(Widget w)
{
XfeChromePart * cp = _XfeChromePart(w);
@ -910,9 +909,9 @@ LayoutMenuBar(Widget w)
/* Place the menu bar on the very top and occupy the full width */
_XfeConfigureWidget(cp->menu_bar,
_XfemRectX(w),
_XfemRectY(w),
_XfemRectWidth(w),
_XfemBoundaryX(w),
_XfemBoundaryY(w),
_XfemBoundaryWidth(w),
_XfeHeight(cp->menu_bar));
}
/*----------------------------------------------------------------------*/
@ -929,12 +928,12 @@ LayoutToolBox(Widget w)
/* Place the tool box right after the menu bar */
_XfeConfigureWidget(cp->tool_box,
_XfemRectX(w),
_XfemBoundaryX(w),
_XfeY(cp->menu_bar) +
_XfeHeight(cp->menu_bar),
_XfemRectWidth(w),
_XfemBoundaryWidth(w),
_XfeHeight(cp->tool_box));
}
@ -944,11 +943,11 @@ LayoutToolBox(Widget w)
/* Place the tool box on the very top */
_XfeConfigureWidget(cp->tool_box,
_XfemRectX(w),
_XfemBoundaryX(w),
_XfemRectY(w),
_XfemBoundaryY(w),
_XfemRectWidth(w),
_XfemBoundaryWidth(w),
_XfeHeight(cp->tool_box));
}
@ -971,13 +970,13 @@ LayoutDashBoard(Widget w)
/* Place the dash board the very bottom and occupy the full width */
_XfeConfigureWidget(cp->dash_board,
_XfemRectX(w),
_XfemBoundaryX(w),
_XfeHeight(w) -
_XfemOffsetBottom(w) -
_XfeHeight(cp->dash_board),
_XfemRectWidth(w),
_XfemBoundaryWidth(w),
_XfeHeight(cp->dash_board));
@ -988,7 +987,7 @@ LayoutTopView(Widget w)
{
XfeChromePart * cp = _XfeChromePart(w);
Widget top = NULL;
Widget bottom = NULL;
/* Widget bottom = NULL; */
int y;
int x;
int width;
@ -1013,21 +1012,21 @@ LayoutTopView(Widget w)
}
else
{
y = _XfemRectY(w);
y = _XfemBoundaryY(w);
}
/* left_view is shown */
if (SHOW_LEFT_VIEW(cp))
{
x = _XfemRectX(w) + _XfeWidth(cp->left_view);
x = _XfemBoundaryX(w) + _XfeWidth(cp->left_view);
width = _XfemRectWidth(w) - _XfeWidth(cp->left_view);
width = _XfemBoundaryWidth(w) - _XfeWidth(cp->left_view);
}
else
{
x = _XfemRectX(w);
x = _XfemBoundaryX(w);
width = _XfemRectWidth(w);
width = _XfemBoundaryWidth(w);
}
/* right_view is shown */
@ -1046,7 +1045,7 @@ static void
LayoutBottomView(Widget w)
{
XfeChromePart * cp = _XfeChromePart(w);
Widget top = NULL;
/* Widget top = NULL; */
Widget bottom = NULL;
int y;
int x;
@ -1075,15 +1074,15 @@ LayoutBottomView(Widget w)
/* left_view is shown */
if (SHOW_LEFT_VIEW(cp))
{
x = _XfemRectX(w) + _XfeWidth(cp->left_view);
x = _XfemBoundaryX(w) + _XfeWidth(cp->left_view);
width = _XfemRectWidth(w) - _XfeWidth(cp->left_view);
width = _XfemBoundaryWidth(w) - _XfeWidth(cp->left_view);
}
else
{
x = _XfemRectX(w);
x = _XfemBoundaryX(w);
width = _XfemRectWidth(w);
width = _XfemBoundaryWidth(w);
}
/* right_view is shown */
@ -1145,7 +1144,7 @@ LayoutCenterView(Widget w)
}
else
{
y = _XfemRectY(w);
y = _XfemBoundaryY(w);
}
if (_XfeIsAlive(bottom))
@ -1160,15 +1159,15 @@ LayoutCenterView(Widget w)
/* left_view is shown */
if (SHOW_LEFT_VIEW(cp))
{
x = _XfemRectX(w) + _XfeWidth(cp->left_view);
x = _XfemBoundaryX(w) + _XfeWidth(cp->left_view);
width = _XfemRectWidth(w) - _XfeWidth(cp->left_view);
width = _XfemBoundaryWidth(w) - _XfeWidth(cp->left_view);
}
else
{
x = _XfemRectX(w);
x = _XfemBoundaryX(w);
width = _XfemRectWidth(w);
width = _XfemBoundaryWidth(w);
}
/* right_view is shown */
@ -1187,10 +1186,10 @@ static void
LayoutLeftView(Widget w)
{
XfeChromePart * cp = _XfeChromePart(w);
Widget top = NULL;
Widget bottom = NULL;
Position y1;
Position y2;
/* Widget top = NULL; */
/* Widget bottom = NULL; */
/* Position y1; */
/* Position y2; */
assert( SHOW_LEFT_VIEW(cp) );
@ -1212,17 +1211,17 @@ LayoutLeftView(Widget w)
}
else
{
y1 = _XfemRectY(w);
y1 = _XfemBoundaryY(w);
}
/* Place the top_view */
_XfeConfigureWidget(cp->top_view,
_XfemRectX(w),
_XfemBoundaryX(w),
y1,
_XfemRectWidth(w),
_XfemBoundaryWidth(w),
_XfeHeight(cp->top_view));
@ -1234,10 +1233,10 @@ static void
LayoutRightView(Widget w)
{
XfeChromePart * cp = _XfeChromePart(w);
Widget top = NULL;
Widget bottom = NULL;
Position y1;
Position y2;
/* Widget top = NULL; */
/* Widget bottom = NULL; */
/* Position y1; */
/* Position y2; */
assert( SHOW_RIGHT_VIEW(cp) );
@ -1259,17 +1258,17 @@ LayoutRightView(Widget w)
}
else
{
y1 = _XfemRectY(w);
y1 = _XfemBoundaryY(w);
}
/* Place the top_view */
_XfeConfigureWidget(cp->top_view,
_XfemRectX(w),
_XfemBoundaryX(w),
y1,
_XfemRectWidth(w),
_XfemBoundaryWidth(w),
_XfeHeight(cp->top_view));

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

@ -66,11 +66,11 @@ static Boolean SetValues (Widget,Widget,Widget,ArgList,Cardinal *);
/* XfeManager class methods */
/* */
/*----------------------------------------------------------------------*/
static void PreferredGeometry (Widget,Dimension *,Dimension *);
static void LayoutComponents (Widget);
static Boolean AcceptChild (Widget);
static Boolean DeleteChild (Widget);
static Boolean InsertChild (Widget);
static void PreferredGeometry (Widget,Dimension *,Dimension *);
static Boolean AcceptStaticChild (Widget);
static Boolean DeleteStaticChild (Widget);
static Boolean InsertStaticChild (Widget);
static void LayoutStaticChildren (Widget);
/*----------------------------------------------------------------------*/
/* */
@ -79,7 +79,7 @@ static Boolean InsertChild (Widget);
/*----------------------------------------------------------------------*/
static Boolean IsDocked (Widget);
static Dimension MaxComponentHeight (Widget);
static void ManageComponents (Widget);
static void ManagerStaticChildren (Widget);
static void LayoutProgressBar (Widget);
static void LayoutToolBar (Widget);
static void LayoutStatusBar (Widget);
@ -350,23 +350,23 @@ _XFE_WIDGET_CLASS_RECORD(dashboard,DashBoard) =
/* XfeManager Part */
{
XfeInheritBitGravity, /* bit_gravity */
PreferredGeometry, /* preferred_geometry */
XfeInheritMinimumGeometry, /* minimum_geometry */
XfeInheritUpdateRect, /* update_rect */
AcceptChild, /* accept_child */
InsertChild, /* insert_child */
DeleteChild, /* delete_child */
NULL, /* change_managed */
NULL, /* prepare_components */
LayoutComponents, /* layout_components */
NULL, /* layout_children */
NULL, /* draw_background */
XfeInheritDrawShadow, /* draw_shadow */
NULL, /* draw_components */
False, /* count_layable_children*/
NULL, /* child_is_layable */
NULL, /* extension */
XfeInheritBitGravity, /* bit_gravity */
PreferredGeometry, /* preferred_geometry */
XfeInheritUpdateBoundary, /* update_boundary */
XfeInheritUpdateChildrenInfo, /* update_children_info */
XfeInheritLayoutWidget, /* layout_widget */
AcceptStaticChild, /* accept_static_child */
InsertStaticChild, /* insert_static_child */
DeleteStaticChild, /* delete_static_child */
LayoutStaticChildren, /* layout_static_children */
NULL, /* change_managed */
NULL, /* prepare_components */
NULL, /* layout_components */
NULL, /* draw_background */
XfeInheritDrawShadow, /* draw_shadow */
NULL, /* draw_components */
NULL, /* extension */
},
/* XfeDashBoard Part */
@ -580,7 +580,7 @@ PreferredGeometry(Widget w,Dimension * width,Dimension * height)
}
/*----------------------------------------------------------------------*/
static void
LayoutComponents(Widget w)
LayoutStaticChildren(Widget w)
{
XfeDashBoardPart * dp = _XfeDashBoardPart(w);
@ -588,7 +588,7 @@ LayoutComponents(Widget w)
dp->max_component_height = MaxComponentHeight(w);
/* Manage the components */
ManageComponents(w);
ManagerStaticChildren(w);
if (SHOW_TOOL_BAR(dp))
{
@ -609,7 +609,7 @@ LayoutComponents(Widget w)
}
/*----------------------------------------------------------------------*/
static Boolean
AcceptChild(Widget child)
AcceptStaticChild(Widget child)
{
Widget w = XtParent(child);
XfeDashBoardPart * dp = _XfeDashBoardPart(w);
@ -640,7 +640,7 @@ AcceptChild(Widget child)
}
/*----------------------------------------------------------------------*/
static Boolean
InsertChild(Widget child)
InsertStaticChild(Widget child)
{
Widget w = XtParent(child);
XfeDashBoardPart * dp = _XfeDashBoardPart(w);
@ -686,7 +686,7 @@ InsertChild(Widget child)
}
/*----------------------------------------------------------------------*/
static Boolean
DeleteChild(Widget child)
DeleteStaticChild(Widget child)
{
Widget w = XtParent(child);
XfeDashBoardPart * dp = _XfeDashBoardPart(w);
@ -906,7 +906,7 @@ RemoveFloatingShell(Widget w)
}
/*----------------------------------------------------------------------*/
static void
ManageComponents(Widget w)
ManagerStaticChildren(Widget w)
{
XfeDashBoardPart * dp = _XfeDashBoardPart(w);

Разница между файлами не показана из-за своего большого размера Загрузить разницу

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

@ -0,0 +1,54 @@
/* -*- 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.
*/
/*----------------------------------------------------------------------*/
/* */
/* Name: <Xfe/DynamicManager.h> */
/* Description: XfeDynamicManager widget public header file. */
/* Author: Ramiro Estrugo <ramiro@netscape.com> */
/* */
/*----------------------------------------------------------------------*/
#ifndef _XfeDynamicManager_h_ /* start DynamicManager.h */
#define _XfeDynamicManager_h_
#include <Xfe/Manager.h>
XFE_BEGIN_CPLUSPLUS_PROTECTION
/*----------------------------------------------------------------------*/
/* */
/* XfeDynamicManager class names */
/* */
/*----------------------------------------------------------------------*/
externalref WidgetClass xfeDynamicManagerWidgetClass;
typedef struct _XfeDynamicManagerClassRec * XfeDynamicManagerWidgetClass;
typedef struct _XfeDynamicManagerRec * XfeDynamicManagerWidget;
#define XfeIsDynamicManager(w) XtIsSubclass(w,xfeDynamicManagerWidgetClass)
/*----------------------------------------------------------------------*/
/* */
/* XfeDynamicManager class names */
/* */
/*----------------------------------------------------------------------*/
XFE_END_CPLUSPLUS_PROTECTION
#endif /* end DynamicManager.h */

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

@ -0,0 +1,237 @@
/* -*- 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.
*/
/*----------------------------------------------------------------------*/
/* */
/* Name: <Xfe/DynamicManagerP.h> */
/* Description: XfeDynamicManager widget private header file. */
/* Author: Ramiro Estrugo <ramiro@netscape.com> */
/* */
/*----------------------------------------------------------------------*/
#ifndef _XfeDynamicManagerP_h_ /* start DynamicManagerP.h */
#define _XfeDynamicManagerP_h_
#include <Xfe/DynamicManager.h>
#include <Xfe/ManagerP.h>
XFE_BEGIN_CPLUSPLUS_PROTECTION
/*----------------------------------------------------------------------*/
/* */
/* XfeDynamicManagerClassPart */
/* */
/*----------------------------------------------------------------------*/
typedef struct
{
/* Dynamic children methods */
XfeChildFunc accept_dynamic_child; /* accept_dynamic_child */
XfeChildFunc insert_dynamic_child; /* insert_dynamic_child */
XfeChildFunc delete_dynamic_child; /* delete_dynamic_child */
XtWidgetProc layout_dynamic_children;/* layout_dynamic_children */
XfeGeometryProc get_child_dimensions; /* get_child_dimensions */
XtPointer extension; /* extension */
} XfeDynamicManagerClassPart;
/*----------------------------------------------------------------------*/
/* */
/* XfeDynamicManagerClassRec */
/* */
/*----------------------------------------------------------------------*/
typedef struct _XfeDynamicManagerClassRec
{
CoreClassPart core_class;
CompositeClassPart composite_class;
ConstraintClassPart constraint_class;
XmManagerClassPart manager_class;
XfeManagerClassPart xfe_manager_class;
XfeDynamicManagerClassPart xfe_dynamic_manager_class;
} XfeDynamicManagerClassRec;
externalref XfeDynamicManagerClassRec xfeDynamicManagerClassRec;
/*----------------------------------------------------------------------*/
/* */
/* XfeDynamicManagerPart */
/* */
/*----------------------------------------------------------------------*/
typedef struct _XfeDynamicManagerPart
{
/* Callback Resources */
/* Dynamic children resources */
XfeLinked dynamic_children; /* Dynamic children */
Dimension max_dyn_width; /* Max dyn width */
Dimension max_dyn_height; /* Max dyn height */
Dimension min_dyn_width; /* Min dyn width */
Dimension min_dyn_height; /* Min dyn height */
Cardinal num_dyn_children; /* Num dyn children */
Cardinal num_managed_dyn_children;/* Num managed dyn children*/
Dimension total_dyn_width; /* Total dyn width */
Dimension total_dyn_height; /* Total dyn height */
/* Private Data Members */
} XfeDynamicManagerPart;
/*----------------------------------------------------------------------*/
/* */
/* XfeDynamicManagerRec */
/* */
/*----------------------------------------------------------------------*/
typedef struct _XfeDynamicManagerRec
{
CorePart core;
CompositePart composite;
ConstraintPart constraint;
XmManagerPart manager;
XfeManagerPart xfe_manager;
XfeDynamicManagerPart xfe_dynamic_manager;
} XfeDynamicManagerRec;
/*----------------------------------------------------------------------*/
/* */
/* XfeDynamicManagerConstraintPart */
/* */
/*----------------------------------------------------------------------*/
typedef struct _XfeDynamicManagerConstraintPart
{
int position_index; /* Position Index */
XfeLinkNode link_node; /* Link node */
} XfeDynamicManagerConstraintPart;
/*----------------------------------------------------------------------*/
/* */
/* XfeDynamicManagerConstraintRec */
/* */
/*----------------------------------------------------------------------*/
typedef struct _XfeDynamicManagerConstraintRec
{
XmManagerConstraintPart manager;
XfeManagerConstraintPart xfe_manager;
XfeDynamicManagerConstraintPart xfe_dynamic_manager;
} XfeDynamicManagerConstraintRec;
/*----------------------------------------------------------------------*/
/* */
/* XfeDynamicManager Method invocation functions */
/* */
/*----------------------------------------------------------------------*/
extern Boolean
_XfeDynamicManagerAcceptDynamicChild (Widget child);
/*----------------------------------------------------------------------*/
extern Boolean
_XfeDynamicManagerInsertDynamicChild (Widget child);
/*----------------------------------------------------------------------*/
extern Boolean
_XfeDynamicManagerDeleteDynamicChild (Widget child);
/*----------------------------------------------------------------------*/
extern void
_XfeDynamicManagerLayoutDynamicChildren (Widget w);
/*----------------------------------------------------------------------*/
extern void
_XfeDynamicManagerGetChildDimensions (Widget child,
Dimension * width_out,
Dimension * height_out);
/*----------------------------------------------------------------------*/
/*----------------------------------------------------------------------*/
/* */
/* XfeDynamicManager private functions */
/* */
/*----------------------------------------------------------------------*/
extern void
_XfeDynamicManagerChildrenInfo (Widget w,
Dimension * max_width_out,
Dimension * max_height_out,
Dimension * total_width_out,
Dimension * total_height_out,
Cardinal * num_managed_out,
Cardinal * num_components_out);
/*----------------------------------------------------------------------*/
/*----------------------------------------------------------------------*/
/* */
/* XfeDynamicManager member access */
/* */
/*----------------------------------------------------------------------*/
#define _XfemDynamicChildren(w) \
(((XfeDynamicManagerWidget) (w))->xfe_dynamic_manager . dynamic_children)
/*----------------------------------------------------------------------*/
#define _XfemNumDynamicChildren(w) \
(((XfeDynamicManagerWidget) (w))->xfe_dynamic_manager . num_dyn_children)
/*----------------------------------------------------------------------*/
#define _XfemNumManagedDynamicChildren(w) \
(((XfeDynamicManagerWidget) (w))->xfe_dynamic_manager . num_managed_dyn_children)
/*----------------------------------------------------------------------*/
#define _XfemMaxDynamicWidth(w) \
(((XfeDynamicManagerWidget) (w))->xfe_dynamic_manager . max_dyn_width)
/*----------------------------------------------------------------------*/
#define _XfemMaxDynamicHeight(w) \
(((XfeDynamicManagerWidget) (w))->xfe_dynamic_manager . max_dyn_height)
/*----------------------------------------------------------------------*/
#define _XfemMinDynamicWidth(w) \
(((XfeDynamicManagerWidget) (w))->xfe_dynamic_manager . min_dyn_width)
/*----------------------------------------------------------------------*/
#define _XfemMinDynamicHeight(w) \
(((XfeDynamicManagerWidget) (w))->xfe_dynamic_manager . min_dyn_height)
/*----------------------------------------------------------------------*/
#define _XfemTotalDynamicWidth(w) \
(((XfeDynamicManagerWidget) (w))->xfe_dynamic_manager . total_dyn_width)
/*----------------------------------------------------------------------*/
#define _XfemTotalDynamicHeight(w) \
(((XfeDynamicManagerWidget) (w))->xfe_dynamic_manager . total_dyn_height)
/*----------------------------------------------------------------------*/
/*----------------------------------------------------------------------*/
/* */
/* Dynamic children count */
/* */
/*----------------------------------------------------------------------*/
#define _XfemDynamicChildrenCount(w) \
(_XfemDynamicChildren(w) ? XfeLinkedCount(_XfemDynamicChildren(w)) : 0)
/*----------------------------------------------------------------------*/
/*----------------------------------------------------------------------*/
/* */
/* XfeDynamicManager child constraint part access macro */
/* */
/*----------------------------------------------------------------------*/
#define _XfeDynamicManagerConstraintPart(w) \
(&(((XfeDynamicManagerConstraintRec *) _XfeConstraints(w)) -> xfe_dynamic_manager))
/*----------------------------------------------------------------------*/
/* */
/* XfeDynamicManager child individual constraint resource access macro */
/* */
/*----------------------------------------------------------------------*/
#define _XfeDynamicManagerPositionIndex(w) \
(_XfeDynamicManagerConstraintPart(w)) -> position_index
/*----------------------------------------------------------------------*/
#define _XfeDynamicManagerLinkNode(w) \
(_XfeDynamicManagerConstraintPart(w)) -> link_node
/*----------------------------------------------------------------------*/
XFE_END_CPLUSPLUS_PROTECTION
#endif /* end DynamicManagerP.h */

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

@ -195,8 +195,7 @@ _XFE_WIDGET_CLASS_RECORD(fontchooser,FontChooser) =
{
XfeInheritBitGravity, /* bit_gravity */
XfeInheritPreferredGeometry, /* preferred_geometry */
XfeInheritMinimumGeometry, /* minimum_geometry */
XfeInheritUpdateRect, /* update_rect */
XfeInheritUpdateBoundary, /* update_boundary */
NULL, /* prepare_components */
XfeInheritLayoutComponents, /* layout_components */
XfeInheritDrawBackground, /* draw_background */

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

@ -675,11 +675,8 @@ _XfeLiberalGeometryManager(Widget child,
if (XfeIsManager(w))
{
/* Layout the components */
_XfeManagerLayoutComponents(w);
/* Layout the children */
_XfeManagerLayoutChildren(w);
/* Layout the widget */
_XfeManagerLayoutWidget(w);
}
else
{

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

@ -122,11 +122,6 @@ _XfePreferredGeometry (Widget w,
Dimension * width_out,
Dimension * height_out);
/*----------------------------------------------------------------------*/
extern void
_XfeMinimumGeometry (Widget w,
Dimension * width_out,
Dimension * height_out);
/*----------------------------------------------------------------------*/
extern Boolean
_XfeMakeGeometryRequest (Widget w,
Dimension width,

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

@ -296,8 +296,7 @@ _XFE_WIDGET_CLASS_RECORD(label,Label) =
{
XfeInheritBitGravity, /* bit_gravity */
PreferredGeometry, /* preferred_geometry */
XfeInheritMinimumGeometry, /* minimum_geometry */
XfeInheritUpdateRect, /* update_rect */
XfeInheritUpdateBoundary, /* update_boundary */
PrepareComponents, /* prepare_components */
LayoutComponents, /* layout_components */
XfeInheritDrawBackground, /* draw_background */
@ -687,7 +686,7 @@ LayoutString(Widget w)
{
case XmALIGNMENT_BEGINNING:
lp->label_rect.x = _XfeRectX(w);
lp->label_rect.x = _XfeBoundaryX(w);
break;
@ -730,12 +729,12 @@ DrawString(Widget w,XEvent * event,Region region,XRectangle * clip_rect)
rect.y = lp->label_rect.y;
/* Determine whether we need to truncate the string */
if (lp->truncate_label && (lp->label_rect.width > _XfeRectWidth(w)))
if (lp->truncate_label && (lp->label_rect.width > _XfeBoundaryWidth(w)))
{
string = CreateTruncatedString(w);
rect.width = _XfeRectWidth(w);
rect.x = _XfeRectX(w);
rect.width = _XfeBoundaryWidth(w);
rect.x = _XfeBoundaryX(w);
need_to_free_string = True;
}
@ -765,7 +764,7 @@ DrawString(Widget w,XEvent * event,Region region,XRectangle * clip_rect)
rect.width,
lp->label_alignment,
lp->label_direction,
&_XfeWidgetRect(w));
&_XfeBoundary(w));
}
else
{
@ -780,7 +779,7 @@ DrawString(Widget w,XEvent * event,Region region,XRectangle * clip_rect)
rect.width,
lp->label_alignment,
lp->label_direction,
&_XfeWidgetRect(w));
&_XfeBoundary(w));
XmStringDraw(XtDisplay(w),
_XfePrimitiveDrawable(w),
@ -792,7 +791,7 @@ DrawString(Widget w,XEvent * event,Region region,XRectangle * clip_rect)
rect.width,
lp->label_alignment,
lp->label_direction,
&_XfeWidgetRect(w));
&_XfeBoundary(w));
}
/* Free the string if needed */
@ -924,7 +923,7 @@ CreateTruncatedString(Widget w)
if (psz_tmp)
{
Dimension max_width = _XfeRectWidth(w) - lp->misc_offset;
Dimension max_width = _XfeBoundaryWidth(w) - lp->misc_offset;
if (!_XfeIsSensitive(w))
{

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

@ -222,8 +222,7 @@ _XFE_WIDGET_CLASS_RECORD(logo,Logo) =
{
XfeInheritBitGravity, /* bit_gravity */
PreferredGeometry, /* preferred_geometry */
XfeInheritMinimumGeometry, /* minimum_geometry */
XfeInheritUpdateRect, /* update_rect */
XfeInheritUpdateBoundary, /* update_boundary */
PrepareComponents, /* prepare_components */
XfeInheritLayoutComponents, /* layout_components */
XfeInheritDrawBackground, /* draw_background */

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

@ -84,6 +84,7 @@ CSRCS = \
Debug.c \
DialogUtil.c \
Draw.c \
DynamicManager.c \
Find.c \
FrameShell.c \
GcUtil.c \
@ -93,6 +94,7 @@ CSRCS = \
ListUtil.c \
Logo.c \
Manager.c \
ManagerChildren.c \
MenuUtil.c \
Oriented.c \
Pane.c \
@ -140,6 +142,8 @@ EXPORTS = \
Defaults.h \
DialogUtil.h \
Draw.h \
DynamicManager.h \
DynamicManagerP.h \
Find.h \
FrameShell.h \
FrameShellP.h \

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

@ -89,6 +89,7 @@ CSRCS = \
Debug.c \
DialogUtil.c \
Draw.c \
DynamicManager.c \
Find.c \
FrameShell.c \
GcUtil.c \
@ -98,6 +99,7 @@ CSRCS = \
ListUtil.c \
Logo.c \
Manager.c \
ManagerChildren.c \
MenuUtil.c \
Oriented.c \
Pane.c \
@ -145,6 +147,8 @@ EXPORTS = \
Defaults.h \
DialogUtil.h \
Draw.h \
DynamicManager.h \
DynamicManagerP.h \
Find.h \
FrameShell.h \
FrameShellP.h \

Разница между файлами не показана из-за своего большого размера Загрузить разницу

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

@ -31,6 +31,31 @@
XFE_BEGIN_CPLUSPLUS_PROTECTION
/*----------------------------------------------------------------------*/
/* */
/* XmRManagerChildType */
/* */
/*----------------------------------------------------------------------*/
enum
{
XmMANAGER_COMPONENT_INVALID, /* */
XmMANAGER_COMPONENT_CHILD, /* */
XmMANAGER_DYNAMIC_CHILD, /* */
XmMANAGER_STATIC_CHILD /* */
};
/*----------------------------------------------------------------------*/
/*----------------------------------------------------------------------*/
/* */
/* XfeManager children info/apply mask bits */
/* */
/*----------------------------------------------------------------------*/
#define XfeCHILDREN_INFO_NONE (0)
#define XfeCHILDREN_INFO_ALIVE (1 << 0)
#define XfeCHILDREN_INFO_MANAGED (1 << 1)
#define XfeCHILDREN_INFO_REALIZED (1 << 2)
#define XfeCHILDREN_INFO_ANY (~(0))
/*----------------------------------------------------------------------*/
/* */
/* XfeManager class names */
@ -54,7 +79,7 @@ typedef void (*XfeManagerApplyProc) (Widget w,
/*----------------------------------------------------------------------*/
/* */
/* XfeManager class names */
/* XfeManager public methods */
/* */
/*----------------------------------------------------------------------*/
extern void
@ -72,12 +97,27 @@ XfeManagerResizeChildren (Widget w,
Boolean set_height,
Boolean only_managed);
/*----------------------------------------------------------------------*/
/*----------------------------------------------------------------------*/
/* */
/* XfeManager public children apply functions */
/* */
/*----------------------------------------------------------------------*/
extern void
XfeManagerApply (Widget w,
int mask,
XfeManagerApplyProc proc,
XtPointer data,
Boolean private_components,
Boolean only_managed);
Boolean private_components,
Boolean freeze_layout);
/*----------------------------------------------------------------------*/
extern void
XfeManagerApplyLinked (Widget w,
unsigned char child_type,
int mask,
XfeManagerApplyProc proc,
XtPointer data,
Boolean freeze_layout);
/*----------------------------------------------------------------------*/
XFE_END_CPLUSPLUS_PROTECTION

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

@ -0,0 +1,465 @@
/* -*- 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.
*/
/*----------------------------------------------------------------------*/
/* */
/* Name: <Xfe/ManagerChildren.c> */
/* Description: XfeManager Children functions. */
/* Author: Ramiro Estrugo <ramiro@netscape.com> */
/* */
/*----------------------------------------------------------------------*/
#include <Xfe/ManagerP.h>
#include <Xfe/DynamicManagerP.h>
#define MESSAGE1 "Widget is not an XfeManager"
#define MESSAGE2 "Widget is not an XfeDynamicManager"
/*----------------------------------------------------------------------*/
/* */
/* Private children and info functions */
/* */
/*----------------------------------------------------------------------*/
static Boolean ChildMatchWithMask (Widget,int);
/*----------------------------------------------------------------------*/
/* */
/* XfeManager children info functions */
/* */
/*----------------------------------------------------------------------*/
/* extern */ void
_XfeManagerGetChildrenInfo(Widget w,
XfeLinked children,
int mask,
XfeGeometryProc proc,
Dimension * max_width_out,
Dimension * max_height_out,
Dimension * min_width_out,
Dimension * min_height_out,
Dimension * total_width_out,
Dimension * total_height_out,
Cardinal * num_managed_out)
{
Dimension max_width = 0;
Dimension max_height = 0;
Dimension min_width = 0;
Dimension min_height = 0;
Dimension total_width = 0;
Dimension total_height = 0;
Cardinal num_managed = 0;
XfeLinkNode node = NULL;
#define FLAG_ALIVE(w,m) \
(((m) & XfeCHILDREN_INFO_ALIVE) ? _XfeIsAlive(w) : True)
#define FLAG_REALIZED(w,m) \
(((m) & XfeCHILDREN_INFO_REALIZED) ? _XfeIsRealized(w) : True)
#define FLAG_MANAGED(w,m) \
(((m) & XfeCHILDREN_INFO_MANAGED) ? _XfeIsManaged(w) : True)
assert( _XfeIsAlive(w) );
/* Make sure the widget is a manager */
if (!XfeIsManager(w))
{
_XfeWarning(w,MESSAGE1);
return;
}
#if 0
/* Make sure the child state mask is not NONE */
if (mask == XfeCHILDREN_INFO_NONE)
{
return;
}
#endif
/* Make sure the children list is not NULL */
if (children == NULL)
{
return;
}
/* Iterate through the children */
for (node = XfeLinkedHead(children);
node;
node = XfeLinkNodeNext(node))
{
Widget child = (Widget) XfeLinkNodeItem(node);
assert( child != NULL );
if (ChildMatchWithMask(child,mask))
{
Dimension child_width;
Dimension child_height;
if (proc != NULL)
{
(*proc)(child,&child_width,&child_height);
}
else
{
child_width = _XfeWidth(child);
child_height = _XfeHeight(child);
}
/* Keep track of maximum width */
if (child_width > max_width)
{
max_width = child_width;
}
/* Keep track of minimum width */
else if (child_width < min_width)
{
min_width = child_width;
}
/* Keep track of maximum height */
if (child_height > max_height)
{
max_height = child_height;
}
/* Keep track of minimum height */
else if (child_height < min_height)
{
min_height = child_height;
}
total_width += child_width;
total_height += child_height;
}
/* Keep track of the number of managed children */
if (_XfeIsManaged(child))
{
num_managed++;
}
}
/* Assign only required arguments */
if (max_width_out)
{
*max_width_out = max_width;
}
if (max_height_out)
{
*max_height_out = max_height;
}
if (min_width_out)
{
*min_width_out = min_width;
}
if (min_height_out)
{
*min_height_out = min_height;
}
if (total_width_out)
{
*total_width_out = total_width;
}
if (total_height_out)
{
*total_height_out = total_height;
}
if (num_managed_out)
{
*num_managed_out = num_managed;
}
}
/*----------------------------------------------------------------------*/
/* extern */ void
_XfeManagerUpdateComponentChildrenInfo(Widget w)
{
#if 0
Dimension max_width = 0;
Dimension max_height = 0;
Dimension min_width = 0;
Dimension min_height = 0;
Dimension total_width = 0;
Dimension total_height = 0;
Cardinal num_managed = 0;
#endif
if (_XfemComponentChildren(w) == NULL)
{
return;
}
#if 0
_XfeManagerGetChildrenInfo(w,
_XfemComponentChildren(w),
XfeCHILDREN_INFO_ALIVE|XfeCHILDREN_INFO_MANAGED,
NULL,
&max_width,
&max_height,
&min_width,
&min_height,
&total_width,
&total_height,
&num_managed);
#endif
_XfemNumComponentChildren(w) = XfeLinkedCount(_XfemComponentChildren(w));
}
/*----------------------------------------------------------------------*/
/* extern */ void
_XfeManagerUpdateStaticChildrenInfo(Widget w)
{
#if 0
Dimension max_width = 0;
Dimension max_height = 0;
Dimension min_width = 0;
Dimension min_height = 0;
Dimension total_width = 0;
Dimension total_height = 0;
Cardinal num_managed = 0;
#endif
if (_XfemStaticChildren(w) == NULL)
{
return;
}
#if 0
_XfeManagerGetChildrenInfo(w,
_XfemStaticChildren(w),
XfeCHILDREN_INFO_ALIVE|XfeCHILDREN_INFO_MANAGED,
NULL,
&max_width,
&max_height,
&min_width,
&min_height,
&total_width,
&total_height,
&num_managed);
#endif
_XfemNumStaticChildren(w) = XfeLinkedCount(_XfemStaticChildren(w));
}
/*----------------------------------------------------------------------*/
/*----------------------------------------------------------------------*/
/* */
/* XfeManager private children apply functions */
/* */
/*----------------------------------------------------------------------*/
/* extern */ void
_XfeManagerApplyProcToChildren(Widget w,
XfeLinked children,
int mask,
XfeManagerApplyProc proc,
XtPointer data)
{
XfeLinkNode node = NULL;
assert( _XfeIsAlive(w) );
assert( proc != NULL );
/* Make sure the widget is a manager */
if (!XfeIsManager(w))
{
_XfeWarning(w,MESSAGE1);
return;
}
/* Iterate through the children */
for (node = XfeLinkedHead(children);
node;
node = XfeLinkNodeNext(node))
{
Widget child = (Widget) XfeLinkNodeItem(node);
assert( child != NULL );
if (ChildMatchWithMask(child,mask))
{
(*proc)(w,child,data);
}
}
}
/*----------------------------------------------------------------------*/
/*----------------------------------------------------------------------*/
/* */
/* XfeManager public children apply functions */
/* */
/*----------------------------------------------------------------------*/
/* extern */ void
XfeManagerApply(Widget w,
int mask,
XfeManagerApplyProc proc,
XtPointer data,
Boolean private_components,
Boolean freeze_layout)
{
Cardinal i;
assert( _XfeIsAlive(w) );
/* Make sure its a Manager */
if (!XfeIsManager(w))
{
_XfeWarning(w,MESSAGE1);
return;
}
/* Freeze layout if needed */
if (freeze_layout)
{
_XfemIgnoreConfigure(w) = True;
}
/* Iterate through all the items */
for (i = 0; i < _XfemNumChildren(w); i++)
{
Widget child = _XfeChildrenIndex(w,i);
if (_XfeIsAlive(child) && ChildMatchWithMask(child,mask))
{
Boolean skip =
(!private_components && XfeIsPrivateComponent(child));
if (!skip)
{
(*proc)(w,child,data);
}
}
}
/* Un-freeze layout if needed */
if (freeze_layout)
{
_XfemIgnoreConfigure(w) = False;
/* ??? I think this should be optional ??? */
XfeManagerLayout(w);
}
}
/*----------------------------------------------------------------------*/
/* extern */ void
XfeManagerApplyLinked(Widget w,
unsigned char child_type,
int mask,
XfeManagerApplyProc proc,
XtPointer data,
Boolean freeze_layout)
{
XfeLinked children = NULL;
assert( _XfeIsAlive(w) );
/* Make sure its a Manager */
if (!XfeIsManager(w))
{
_XfeWarning(w,MESSAGE1);
return;
}
assert( child_type == XmMANAGER_COMPONENT_CHILD ||
child_type == XmMANAGER_DYNAMIC_CHILD ||
child_type == XmMANAGER_STATIC_CHILD );
if (child_type == XmMANAGER_DYNAMIC_CHILD)
{
/* Make sure widget is a XfeDynamicManager */
if (!XfeIsDynamicManager(w))
{
_XfeWarning(w,MESSAGE2);
return;
}
}
if (child_type == XmMANAGER_COMPONENT_CHILD)
{
children = _XfemComponentChildren(w);
}
else if (child_type == XmMANAGER_DYNAMIC_CHILD)
{
children = _XfemDynamicChildren(w);
}
else if (child_type == XmMANAGER_STATIC_CHILD)
{
children = _XfemStaticChildren(w);
}
if (children != NULL)
{
/* Freeze layout if needed */
if (freeze_layout)
{
_XfemIgnoreConfigure(w) = True;
}
_XfeManagerApplyProcToChildren(w,children,mask,proc,data);
/* Un-freeze layout if needed */
if (freeze_layout)
{
_XfemIgnoreConfigure(w) = False;
/* ??? I think this should be optional ??? */
XfeManagerLayout(w);
}
}
}
/*----------------------------------------------------------------------*/
/*----------------------------------------------------------------------*/
/* */
/* Private children and info functions */
/* */
/*----------------------------------------------------------------------*/
static Boolean
ChildMatchWithMask(Widget child,int mask)
{
Boolean result = False;
#define FLAG_ALIVE(w,m) \
(((m) & XfeCHILDREN_INFO_ALIVE) ? _XfeIsAlive(w) : True)
#define FLAG_REALIZED(w,m) \
(((m) & XfeCHILDREN_INFO_REALIZED) ? _XfeIsRealized(w) : True)
#define FLAG_MANAGED(w,m) \
(((m) & XfeCHILDREN_INFO_MANAGED) ? _XfeIsManaged(w) : True)
if (child != NULL)
{
Boolean flag_alive = (child && FLAG_ALIVE(child,mask));
Boolean flag_realized = (flag_alive && FLAG_REALIZED(child,mask));
Boolean flag_managed = (flag_realized && FLAG_MANAGED(child,mask));
result = (flag_alive && flag_realized && flag_managed);
}
return result;
}
/*----------------------------------------------------------------------*/

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

@ -43,64 +43,34 @@ XFE_BEGIN_CPLUSPLUS_PROTECTION
/*----------------------------------------------------------------------*/
typedef struct
{
XfeBitGravityType bit_gravity; /* bit_gravity */
/* Bit gravity */
XfeBitGravityType bit_gravity; /* bit_gravity */
XfeGeometryProc preferred_geometry; /* preferred_geometry */
XfeGeometryProc minimum_geometry; /* minimum_geometry */
/* Geometry methods */
XfeGeometryProc preferred_geometry; /* preferred_geometry */
XtWidgetProc update_boundary; /* update_boundary */
XtWidgetProc update_children_info; /* update_children_info */
XtWidgetProc layout_widget; /* layout_widget */
/* Static children methods */
XfeChildFunc accept_static_child; /* accept_static_child */
XfeChildFunc insert_static_child; /* insert_static_child */
XfeChildFunc delete_static_child; /* delete_static_child */
XtWidgetProc layout_static_children; /* layout_static_children */
XtWidgetProc update_rect; /* update_rect */
/* Change managed method */
XtWidgetProc change_managed; /* change_managed */
XfeChildFunc accept_child; /* accept_child */
XfeChildFunc insert_child; /* insert_child */
XfeChildFunc delete_child; /* delete_child */
XtWidgetProc change_managed; /* change_managed */
/* Component methods */
XfePrepareProc prepare_components; /* prepare_components */
XtWidgetProc layout_components; /* layout_components */
XfePrepareProc prepare_components; /* prepare_components */
/* Rendering methods */
XfeExposeProc draw_background; /* draw_background */
XfeExposeProc draw_shadow; /* draw_shadow */
XfeExposeProc draw_components; /* draw_components */
XtWidgetProc layout_components; /* layout_components */
XtWidgetProc layout_children; /* layout_children */
XfeExposeProc draw_background; /* draw_background */
XfeExposeProc draw_shadow; /* draw_shadow */
XfeExposeProc draw_components; /* draw_components */
/*
* Layable children support.
*
* If the widget class sets the 'count_layable_children' field to
* 'True', then a read-only list of layable children will be allocated
* and maintained by the XfeManager super class. This list can be
* accessed via the XmNlayableChildren and XmNnumLayableChildren.
*
* The purpose of these two fields is to give the sub class widget
* writer the ability to control children layout in detail. The feature
* is optional so that sub classes of XfeManager that don't need detailed
* layout control will not suffer a runtime resource and performance
* penalty.
*
* The 'child_is_layable' is used to determine whether a child is
* layable. By default all children that comply with the following
* are considered layable:
*
* 1. _XfeIsAlive(child)
* 2. _XfeIsRealized(child)
* 3. _XfeIsManaged(child)
* 4. !_XfemNumPrivateComponents(child)
*
* The XfeManager class does not define an 'child_is_layable' method
* by default. Thus, all children that comply with the above
* conditions are considered layable.
*
* A sub class can further filter which children are layable by
* defining an 'child_is_layable' method. If defined, this method
* will be invoked as needed by the XfeManager class. If should
* return 'True' if the given child is layable, or 'False' otherwise.
*
*/
Boolean count_layable_children;
XfeChildFunc child_is_layable;
XtPointer extension; /* extension */
XtPointer extension; /* extension */
} XfeManagerClassPart;
@ -120,27 +90,6 @@ typedef struct _XfeManagerClassRec
externalref XfeManagerClassRec xfeManagerClassRec;
/*----------------------------------------------------------------------*/
/* */
/* XfeManagerLayableInfoRec */
/* */
/*----------------------------------------------------------------------*/
typedef struct _XfeLayableChildrenInfoRec
{
XfeLinked children; /* Layable children */
Cardinal num_children; /* Num layable children */
Dimension max_width; /* Max children width */
Dimension max_height; /* Max children height */
Dimension min_width; /* Min children width */
Dimension min_height; /* Min children height */
Dimension total_width; /* Total children width */
Dimension total_height; /* Total children height*/
} XfeLayableChildrenInfoRec, *XfeLayableChildrenInfo;
/*----------------------------------------------------------------------*/
/* */
/* XfeManagerPart */
@ -167,6 +116,7 @@ typedef struct _XfeManagerPart
Dimension preferred_height; /* Preferred Height */
Boolean use_preferred_width; /* use preferred width */
Boolean use_preferred_height; /* use preferred height */
Dimension min_width; /* Min width */
Dimension min_height; /* Min height */
@ -179,11 +129,13 @@ typedef struct _XfeManagerPart
/* For c++ usage */
XtPointer instance_pointer; /* Instance pointer */
/* Private Component resources */
Cardinal num_private_components; /* Num private components*/
/* Layable children resources */
XfeLayableChildrenInfoRec lc_info;
/* Component children resources */
XfeLinked component_children; /* Component children */
Cardinal num_component_children; /* Num Component children*/
/* Static children resources */
XfeLinked static_children; /* Static children */
Cardinal num_static_children; /* Num Static children */
/* Debug resources */
#ifdef DEBUG
@ -195,9 +147,10 @@ typedef struct _XfeManagerPart
int prepare_flags; /* Require Geometry */
Boolean component_flag; /* Components Layout ? */
XRectangle widget_rect; /* Widget Rect */
XfeDimensionsRec old_dimensions; /* Old dimensions */
/* The widget's boundary */
XRectangle boundary; /* Boundary */
XfeDimensionsRec old_dimensions; /* Old dimensions */
} XfeManagerPart;
/*----------------------------------------------------------------------*/
@ -221,9 +174,7 @@ typedef struct _XfeManagerRec
/*----------------------------------------------------------------------*/
typedef struct _XfeManagerConstraintPart
{
int position_index; /* Position Index */
Boolean private_component; /* Private Component */
XfeLinkNode link_node; /* Link node */
unsigned char manager_child_type; /* Manager Child type */
} XfeManagerConstraintPart;
/*----------------------------------------------------------------------*/
@ -243,6 +194,67 @@ typedef struct _XfeManagerConstraintRec
/* */
/*----------------------------------------------------------------------*/
extern void
_XfeManagerPreferredGeometry (Widget w,
Dimension * width_out,
Dimension * height_out);
/*----------------------------------------------------------------------*/
extern void
_XfeManagerUpdateBoundary (Widget w);
/*----------------------------------------------------------------------*/
extern void
_XfeManagerUpdateChildrenInfo (Widget w);
/*----------------------------------------------------------------------*/
extern void
_XfeManagerLayoutWidget (Widget w);
/*----------------------------------------------------------------------*/
extern Boolean
_XfeManagerInsertStaticChild (Widget child);
/*----------------------------------------------------------------------*/
extern Boolean
_XfeManagerAcceptStaticChild (Widget child);
/*----------------------------------------------------------------------*/
extern Boolean
_XfeManagerDeleteStaticChild (Widget child);
/*----------------------------------------------------------------------*/
extern void
_XfeManagerLayoutStaticChildren (Widget w);
/*----------------------------------------------------------------------*/
extern void
_XfeManagerChangeManaged (Widget child);
/*----------------------------------------------------------------------*/
extern void
_XfeManagerPrepareComponents (Widget w,
int flags);
/*----------------------------------------------------------------------*/
extern void
_XfeManagerLayoutComponents (Widget w);
/*----------------------------------------------------------------------*/
extern void
_XfeManagerDrawBackground (Widget w,
XEvent * event,
Region region,
XRectangle * clip_rect);
/*----------------------------------------------------------------------*/
extern void
_XfeManagerDrawComponents (Widget w,
XEvent * event,
Region region,
XRectangle * clip_rect);
/*----------------------------------------------------------------------*/
extern void
_XfeManagerDrawShadow (Widget w,
XEvent * event,
Region region,
XRectangle * clip_rect);
/*----------------------------------------------------------------------*/
/*----------------------------------------------------------------------*/
/* */
/* XfeManager constraint chain functions */
/* */
/*----------------------------------------------------------------------*/
extern void
_XfeManagerChainInitialize (Widget rw,
Widget nw,
WidgetClass wc);
@ -264,62 +276,6 @@ _XfeConstraintChainSetValues (Widget ow,
Widget nw,
WidgetClass wc);
/*----------------------------------------------------------------------*/
extern void
_XfeManagerPreferredGeometry (Widget w,
Dimension * width_out,
Dimension * height_out);
/*----------------------------------------------------------------------*/
extern void
_XfeManagerMinimumGeometry (Widget w,
Dimension * width_out,
Dimension * height_out);
/*----------------------------------------------------------------------*/
extern void
_XfeManagerUpdateRect (Widget w);
/*----------------------------------------------------------------------*/
extern Boolean
_XfeManagerAcceptChild (Widget child);
/*----------------------------------------------------------------------*/
extern Boolean
_XfeManagerInsertChild (Widget child);
/*----------------------------------------------------------------------*/
extern Boolean
_XfeManagerDeleteChild (Widget child);
/*----------------------------------------------------------------------*/
extern void
_XfeManagerChangeManaged (Widget child);
/*----------------------------------------------------------------------*/
extern void
_XfeManagerPrepareComponents (Widget w,
int flags);
/*----------------------------------------------------------------------*/
extern void
_XfeManagerLayoutComponents (Widget w);
/*----------------------------------------------------------------------*/
extern void
_XfeManagerLayoutChildren (Widget w);
/*----------------------------------------------------------------------*/
extern void
_XfeManagerDrawBackground (Widget w,
XEvent * event,
Region region,
XRectangle * clip_rect);
/*----------------------------------------------------------------------*/
extern void
_XfeManagerDrawComponents (Widget w,
XEvent * event,
Region region,
XRectangle * clip_rect);
/*----------------------------------------------------------------------*/
extern void
_XfeManagerDrawShadow (Widget w,
XEvent * event,
Region region,
XRectangle * clip_rect);
/*----------------------------------------------------------------------*/
extern Boolean
_XfeManagerChildIsLayable (Widget child);
/*----------------------------------------------------------------------*/
/*----------------------------------------------------------------------*/
/* */
@ -327,28 +283,48 @@ _XfeManagerChildIsLayable (Widget child);
/* */
/*----------------------------------------------------------------------*/
extern void
_XfeManagerChildrenInfo (Widget w,
Dimension * max_width_out,
Dimension * max_height_out,
Dimension * total_width_out,
Dimension * total_height_out,
Cardinal * num_managed_out,
Cardinal * num_components_out);
/*----------------------------------------------------------------------*/
extern void
_XfeManagerComponentInfo (Widget w,
Dimension * max_width_out,
Dimension * max_height_out);
/*----------------------------------------------------------------------*/
extern void
_XfeManagerGetLayableChildrenInfo (Widget w,
XfeLayableChildrenInfoRec * info);
/*----------------------------------------------------------------------*/
extern void
_XfeManagerPropagateSetValues (Widget ow,
Widget nw,
Boolean propagate_sensitive);
/*----------------------------------------------------------------------*/
/*----------------------------------------------------------------------*/
/* */
/* XfeManager children info functions */
/* */
/*----------------------------------------------------------------------*/
extern void
_XfeManagerGetChildrenInfo (Widget w,
XfeLinked children,
int mask,
XfeGeometryProc proc,
Dimension * max_width_out,
Dimension * max_height_out,
Dimension * min_width_out,
Dimension * min_height_out,
Dimension * total_width_out,
Dimension * total_height_out,
Cardinal * num_managed_out);
/*----------------------------------------------------------------------*/
extern void
_XfeManagerUpdateComponentChildrenInfo (Widget w);
/*----------------------------------------------------------------------*/
extern void
_XfeManagerUpdateStaticChildrenInfo (Widget w);
/*----------------------------------------------------------------------*/
/*----------------------------------------------------------------------*/
/* */
/* XfeManager private children apply functions */
/* */
/*----------------------------------------------------------------------*/
extern void
_XfeManagerApplyProcToChildren (Widget w,
XfeLinked children,
int mask,
XfeManagerApplyProc proc,
XtPointer data);
/*----------------------------------------------------------------------*/
/*----------------------------------------------------------------------*/
/* */
@ -358,14 +334,6 @@ _XfeManagerPropagateSetValues (Widget ow,
#define _XfeManagerAccessBitGravity(w) \
(((XfeManagerWidgetClass) XtClass(w))->xfe_manager_class . bit_gravity)
/*----------------------------------------------------------------------*/
/* */
/* XfeManagerWidgetClass bit_gravity access macro */
/* */
/*----------------------------------------------------------------------*/
#define _XfeManagerCountLayableChildren(w) \
(((XfeManagerWidgetClass) XtClass(w))->xfe_manager_class . count_layable_children)
/*----------------------------------------------------------------------*/
/* */
/* Xt Composite member access */
@ -552,9 +520,6 @@ _XfeManagerPropagateSetValues (Widget ow,
#define _XfemComponentFlag(w) \
(((XfeManagerWidget) (w))->xfe_manager . component_flag)
/*----------------------------------------------------------------------*/
#define _XfemWidgetRect(w) \
(((XfeManagerWidget) (w))->xfe_manager . widget_rect)
/*----------------------------------------------------------------------*/
#define _XfemInstancePointer(w) \
(((XfeManagerWidget) (w))->xfe_manager . instance_pointer)
/*----------------------------------------------------------------------*/
@ -564,8 +529,42 @@ _XfeManagerPropagateSetValues (Widget ow,
#define _XfemOldHeight(w) \
(((XfeManagerWidget) (w))->xfe_manager . old_dimensions . height)
/*----------------------------------------------------------------------*/
#define _XfemNumPrivateComponents(w) \
(((XfeManagerWidget) (w))->xfe_manager . num_private_components)
#define _XfemComponentChildren(w) \
(((XfeManagerWidget) (w))->xfe_manager . component_children)
/*----------------------------------------------------------------------*/
#define _XfemNumComponentChildren(w) \
(((XfeManagerWidget) (w))->xfe_manager . num_component_children)
/*----------------------------------------------------------------------*/
#define _XfemStaticChildren(w) \
(((XfeManagerWidget) (w))->xfe_manager . static_children)
/*----------------------------------------------------------------------*/
#define _XfemNumStaticChildren(w) \
(((XfeManagerWidget) (w))->xfe_manager . num_static_children)
/*----------------------------------------------------------------------*/
/*----------------------------------------------------------------------*/
/* */
/* Component & Static children count */
/* */
/*----------------------------------------------------------------------*/
#define _XfemComponentChildrenCount(w) \
(_XfemComponentChildren(w) ? XfeLinkedCount(_XfemComponentChildren(w)) : 0)
/*----------------------------------------------------------------------*/
#define _XfemStaticChildrenCount(w) \
(_XfemStaticChildren(w) ? XfeLinkedCount(_XfemStaticChildren(w)) : 0)
/*----------------------------------------------------------------------*/
/*----------------------------------------------------------------------*/
/* */
/* XfeManager boundary access macros */
/* */
/*----------------------------------------------------------------------*/
#define _XfemBoundary(w) (((XfeManagerWidget) (w))->xfe_manager . boundary)
#define _XfemBoundaryHeight(w) (_XfemBoundary(w) . height)
#define _XfemBoundaryWidth(w) (_XfemBoundary(w) . width)
#define _XfemBoundaryX(w) (_XfemBoundary(w) . x)
#define _XfemBoundaryY(w) (_XfemBoundary(w) . y)
/*----------------------------------------------------------------------*/
/*----------------------------------------------------------------------*/
@ -579,24 +578,6 @@ _XfeManagerPropagateSetValues (Widget ow,
/*----------------------------------------------------------------------*/
#endif
/*----------------------------------------------------------------------*/
/* */
/* XfeManager layable children info access macros */
/* */
/*----------------------------------------------------------------------*/
#define _XfemLCInfo(w) \
(((XfeManagerWidget) (w))->xfe_manager . lc_info)
/*----------------------------------------------------------------------*/
#define _XfemLayableChildren(w) (_XfemLCInfo(w) . children)
#define _XfemNumLayableChildren(w) (_XfemLCInfo(w) . num_children)
#define _XfemMaxLayableChildrenWidth(w) (_XfemLCInfo(w) . max_width)
#define _XfemMaxLayableChildrenHeight(w) (_XfemLCInfo(w) . max_height)
#define _XfemMinLayableChildrenWidth(w) (_XfemLCInfo(w) . min_width)
#define _XfemMinLayableChildrenHeight(w) (_XfemLCInfo(w) . min_height)
#define _XfemTotalLayableChildrenWidth(w) (_XfemLCInfo(w) . total_width)
#define _XfemTotalLayableChildrenHeight(w) (_XfemLCInfo(w) . total_height)
/*----------------------------------------------------------------------*/
/*----------------------------------------------------------------------*/
/* */
/* XfeManager misc access macros */
@ -614,14 +595,6 @@ _XfeManagerPropagateSetValues (Widget ow,
#define _XfemOffsetBottom(w) (_XfemShadowThickness(w) + \
_XfemMarginBottom(w))
/*----------------------------------------------------------------------*/
#define _XfemRectHeight(w) (_XfemWidgetRect(w) . height)
/*----------------------------------------------------------------------*/
#define _XfemRectWidth(w) (_XfemWidgetRect(w) . width)
/*----------------------------------------------------------------------*/
#define _XfemRectX(w) (_XfemWidgetRect(w) . x)
/*----------------------------------------------------------------------*/
#define _XfemRectY(w) (_XfemWidgetRect(w) . y)
/*----------------------------------------------------------------------*/
/*----------------------------------------------------------------------*/
/* */
@ -653,14 +626,8 @@ _XfeManagerPropagateSetValues (Widget ow,
/* XfeManager child individual constraint resource access macro */
/* */
/*----------------------------------------------------------------------*/
#define _XfeManagerPositionIndex(w) \
(_XfeManagerConstraintPart(w)) -> position_index
/*----------------------------------------------------------------------*/
#define _XfeManagerPrivateComponent(w) \
(_XfeManagerConstraintPart(w)) -> private_component
/*----------------------------------------------------------------------*/
#define _XfeManagerLinkNode(w) \
(_XfeManagerConstraintPart(w)) -> link_node
#define _XfeConstraintManagerChildType(child) \
(_XfeManagerConstraintPart(child)) -> manager_child_type
/*----------------------------------------------------------------------*/
/*----------------------------------------------------------------------*/

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

@ -423,7 +423,7 @@ XfeDestroyMenuWidgetTree(WidgetList children,
skip = (skip_private_components &&
XfeIsAlive(_XfeParent(children[i])) &&
XfeIsManager(_XfeParent(children[i])) &&
_XfeManagerPrivateComponent(children[i]));
XfeIsPrivateComponent(children[i]));
if (!skip)
{

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

@ -225,7 +225,7 @@ static const XtResource constraint_resources[] =
_XFE_WIDGET_CLASS_RECORD(oriented,Oriented) =
{
{
(WidgetClass) &xfeManagerClassRec, /* superclass */
(WidgetClass) &xfeDynamicManagerClassRec,/* superclass */
"XfeOriented", /* class_name */
sizeof(XfeOrientedRec), /* widget_size */
NULL, /* class_initialize */
@ -290,26 +290,35 @@ _XFE_WIDGET_CLASS_RECORD(oriented,Oriented) =
NULL, /* extension */
},
/* XfeManager Part */
/* XfeManager Part */
{
XfeInheritBitGravity, /* bit_gravity */
XfeInheritPreferredGeometry, /* preferred_geometry */
XfeInheritMinimumGeometry, /* minimum_geometry */
XfeInheritUpdateRect, /* update_rect */
NULL, /* accept_child */
NULL, /* insert_child */
NULL, /* delete_child */
NULL, /* change_managed */
NULL, /* prepare_components */
NULL, /* layout_components */
NULL, /* layout_children */
NULL, /* draw_background */
XfeInheritDrawShadow, /* draw_shadow */
NULL, /* draw_components */
False, /* count_layable_children*/
NULL, /* child_is_layable */
NULL, /* extension */
},
XfeInheritBitGravity, /* bit_gravity */
NULL, /* preferred_geometry */
XfeInheritUpdateBoundary, /* update_boundary */
XfeInheritUpdateChildrenInfo, /* update_children_info */
XfeInheritLayoutWidget, /* layout_widget */
NULL, /* accept_static_child */
NULL, /* insert_static_child */
NULL, /* delete_static_child */
NULL, /* layout_static_children */
NULL, /* change_managed */
NULL, /* prepare_components */
NULL, /* layout_components */
NULL, /* draw_background */
XfeInheritDrawShadow, /* draw_shadow */
NULL, /* draw_components */
NULL, /* extension */
},
/* XfeDynamicManager Part */
{
NULL, /* accept_dynamic_child */
NULL, /* insert_dynamic_child */
NULL, /* delete_dynamic_child */
NULL, /* layout_dynamic_children */
XfeInheritGetChildDimensions, /* get_child_dimensions */
NULL, /* extension */
},
/* XfeOriented Part */
{
@ -1127,6 +1136,11 @@ XfeOrientedChildrenSetAllowDrag(Widget w,Boolean allow_drag)
return;
}
XfeManagerApply(w,ApplyChildSetAllowDrag,(XtPointer) allow_drag,False,False);
XfeManagerApply(w,
XfeCHILDREN_INFO_ANY,
ApplyChildSetAllowDrag,
(XtPointer) allow_drag,
False,
True);
}
/*----------------------------------------------------------------------*/

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

@ -28,7 +28,7 @@
#define _XfeOriented_h_
#include <Xfe/Xfe.h>
#include <Xfe/Manager.h>
#include <Xfe/DynamicManager.h>
XFE_BEGIN_CPLUSPLUS_PROTECTION

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

@ -28,7 +28,7 @@
#define _XfeOrientedP_h_
#include <Xfe/Oriented.h>
#include <Xfe/ManagerP.h>
#include <Xfe/DynamicManagerP.h>
XFE_BEGIN_CPLUSPLUS_PROTECTION
@ -70,6 +70,7 @@ typedef struct _XfeOrientedClassRec
ConstraintClassPart constraint_class;
XmManagerClassPart manager_class;
XfeManagerClassPart xfe_manager_class;
XfeDynamicManagerClassPart xfe_dynamic_manager_class;
XfeOrientedClassPart xfe_oriented_class;
} XfeOrientedClassRec;
@ -109,12 +110,13 @@ typedef struct _XfeOrientedPart
/*----------------------------------------------------------------------*/
typedef struct _XfeOrientedRec
{
CorePart core;
CompositePart composite;
ConstraintPart constraint;
XmManagerPart manager;
XfeManagerPart xfe_manager;
XfeOrientedPart xfe_oriented;
CorePart core;
CompositePart composite;
ConstraintPart constraint;
XmManagerPart manager;
XfeManagerPart xfe_manager;
XfeDynamicManagerPart xfe_dynamic_manager;
XfeOrientedPart xfe_oriented;
} XfeOrientedRec;
/*----------------------------------------------------------------------*/
@ -134,9 +136,10 @@ typedef struct _XfeOrientedConstraintPart
/*----------------------------------------------------------------------*/
typedef struct _XfeOrientedConstraintRec
{
XmManagerConstraintPart manager;
XfeManagerConstraintPart xfe_manager;
XfeOrientedConstraintPart xfe_oriented;
XmManagerConstraintPart manager;
XfeManagerConstraintPart xfe_manager;
XfeDynamicManagerConstraintPart xfe_dynamic_manager;
XfeOrientedConstraintPart xfe_oriented;
} XfeOrientedConstraintRec;
/*----------------------------------------------------------------------*/

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

@ -77,15 +77,14 @@ static Boolean ConstraintSetValues (Widget,Widget,Widget,ArgList,Cardinal *);
/* XfeManager class methods */
/* */
/*----------------------------------------------------------------------*/
static void PreferredGeometry (Widget,Dimension *,Dimension *);
static void MinimumGeometry (Widget,Dimension *,Dimension *);
static Boolean AcceptChild (Widget);
static Boolean InsertChild (Widget);
static Boolean DeleteChild (Widget);
static void PrepareComponents (Widget,int);
static void LayoutComponents (Widget);
static void LayoutChildren (Widget);
static void DrawComponents (Widget,XEvent *,Region,XRectangle *);
static void PreferredGeometry (Widget,Dimension *,Dimension *);
static Boolean AcceptStaticChild (Widget);
static Boolean InsertStaticChild (Widget);
static Boolean DeleteStaticChild (Widget);
static void PrepareComponents (Widget,int);
static void LayoutComponents (Widget);
static void LayoutStaticChildren (Widget);
static void DrawComponents (Widget,XEvent *,Region,XRectangle *);
/*----------------------------------------------------------------------*/
/* */
@ -624,28 +623,37 @@ _XFE_WIDGET_CLASS_RECORD(pane,Pane) =
XmInheritParentProcess, /* parent_process */
NULL, /* extension */
},
/* XfeManager Part */
{
XfeInheritBitGravity, /* bit_gravity */
PreferredGeometry, /* preferred_geometry */
MinimumGeometry, /* minimum_geometry */
XfeInheritUpdateRect, /* update_rect */
AcceptChild, /* accept_child */
InsertChild, /* insert_child */
DeleteChild, /* delete_child */
NULL, /* change_managed */
PrepareComponents, /* prepare_components */
LayoutComponents, /* layout_components */
LayoutChildren, /* layout_children */
NULL, /* draw_background */
XfeInheritDrawShadow, /* draw_shadow */
DrawComponents, /* draw_components */
False, /* count_layable_children*/
NULL, /* child_is_layable */
NULL, /* extension */
{
XfeInheritBitGravity, /* bit_gravity */
PreferredGeometry, /* preferred_geometry */
XfeInheritUpdateBoundary, /* update_boundary */
XfeInheritUpdateChildrenInfo, /* update_children_info */
XfeInheritLayoutWidget, /* layout_widget */
AcceptStaticChild, /* accept_static_child */
InsertStaticChild, /* insert_static_child */
DeleteStaticChild, /* delete_static_child */
LayoutStaticChildren, /* layout_static_children */
NULL, /* change_managed */
PrepareComponents, /* prepare_components */
LayoutComponents, /* layout_components */
NULL, /* draw_background */
XfeInheritDrawShadow, /* draw_shadow */
DrawComponents, /* draw_components */
NULL, /* extension */
},
/* XfeDynamicManager Part */
{
NULL, /* accept_dynamic_child */
NULL, /* insert_dynamic_child */
NULL, /* delete_dynamic_child */
NULL, /* layout_dynamic_children */
NULL, /* extension */
},
/* XfeOriented Part */
{
EnterProc, /* enter */
@ -1020,17 +1028,8 @@ PreferredGeometry(Widget w,Dimension * width,Dimension * height)
}
}
/*----------------------------------------------------------------------*/
static void
MinimumGeometry(Widget w,Dimension * width,Dimension * height)
{
/* XfePanePart * sp = _XfePanePart(w); */
*width = _XfemOffsetLeft(w) + _XfemOffsetRight(w);
*height = _XfemOffsetTop(w) + _XfemOffsetBottom(w);
}
/*----------------------------------------------------------------------*/
static Boolean
AcceptChild(Widget child)
AcceptStaticChild(Widget child)
{
Widget w = _XfeParent(child);
XfePanePart * sp = _XfePanePart(w);
@ -1075,7 +1074,7 @@ AcceptChild(Widget child)
}
/*----------------------------------------------------------------------*/
static Boolean
InsertChild(Widget child)
InsertStaticChild(Widget child)
{
Widget w = _XfeParent(child);
XfePanePart * sp = _XfePanePart(w);
@ -1164,7 +1163,7 @@ InsertChild(Widget child)
}
/*----------------------------------------------------------------------*/
static Boolean
DeleteChild(Widget child)
DeleteStaticChild(Widget child)
{
Widget w = XtParent(child);
XfePanePart * sp = _XfePanePart(w);
@ -1237,7 +1236,7 @@ LayoutComponents(Widget w)
XfePanePart * sp = _XfePanePart(w);
Position sash_position = sp->sash_position;
/* This is a hack and will be fixed later using MinimumGeometry() */
/* This is a hack and will be fixed later in PreferredGeometry() */
int min_width = 4;
int min_height = 4;
@ -1344,7 +1343,7 @@ LayoutComponents(Widget w)
}
/*----------------------------------------------------------------------*/
static void
LayoutChildren(Widget w)
LayoutStaticChildren(Widget w)
{
XfePanePart * sp = _XfePanePart(w);
Boolean one_on = False;
@ -1645,9 +1644,9 @@ ChildOneLayoutVertical(Widget w)
XfePanePart * sp = _XfePanePart(w);
XfeGeometryRec geom;
geom.x = _XfemRectX(w);
geom.y = _XfemRectY(w);
geom.width = _XfemRectWidth(w);
geom.x = _XfemBoundaryX(w);
geom.y = _XfemBoundaryY(w);
geom.width = _XfemBoundaryWidth(w);
/* Check whether the child can resize */
if (CONSTRAINT_ALLOW_RESIZE(sp->child_one))
@ -1659,7 +1658,7 @@ ChildOneLayoutVertical(Widget w)
Widget aw = AttachmentGetVisibleChild(w,sp->child_two);
/* Start by asuming that we can use the full extent of the pane */
geom.height = _XfemRectHeight(w);
geom.height = _XfemBoundaryHeight(w);
/* Layout a visible attachment if needed */
if (_XfeIsAlive(aw))
@ -1671,7 +1670,7 @@ ChildOneLayoutVertical(Widget w)
}
else
{
geom.height = sp->sash_rect.y - _XfemRectY(w) - SASH_SPACING(sp);
geom.height = sp->sash_rect.y - _XfemBoundaryY(w) - SASH_SPACING(sp);
}
}
else
@ -1693,8 +1692,8 @@ ChildTwoLayoutVertical(Widget w)
XfePanePart * sp = _XfePanePart(w);
XfeGeometryRec geom;
geom.x = _XfemRectX(w);
geom.width = _XfemRectWidth(w);
geom.x = _XfemBoundaryX(w);
geom.width = _XfemBoundaryWidth(w);
/* Check whether the child can resize */
if (CONSTRAINT_ALLOW_RESIZE(sp->child_two))
@ -1704,8 +1703,8 @@ ChildTwoLayoutVertical(Widget w)
Widget aw = AttachmentGetVisibleChild(w,sp->child_one);
/* Start by asuming that we can use the full extent of the pane */
geom.y = _XfemRectY(w);
geom.height = _XfemRectHeight(w);
geom.y = _XfemBoundaryY(w);
geom.height = _XfemBoundaryHeight(w);
/* Look for a visible attachment */
if (_XfeIsAlive(aw))
@ -1725,8 +1724,8 @@ ChildTwoLayoutVertical(Widget w)
SASH_SPACING(sp);
geom.height =
_XfemRectY(w) +
_XfemRectHeight(w) -
_XfemBoundaryY(w) +
_XfemBoundaryHeight(w) -
geom.y -
SASH_SPACING(sp);
}
@ -1751,16 +1750,16 @@ ChildOneLayoutHorizontal(Widget w)
XfePanePart * sp = _XfePanePart(w);
XfeGeometryRec geom;
geom.x = _XfemRectX(w);
geom.y = _XfemRectY(w);
geom.height = _XfemRectHeight(w);
geom.x = _XfemBoundaryX(w);
geom.y = _XfemBoundaryY(w);
geom.height = _XfemBoundaryHeight(w);
if (ChildShouldExpand(w,sp->child_one))
{
Widget aw = AttachmentGetVisibleChild(w,sp->child_two);
/* Start by asuming that we can use the full extent of the pane */
geom.width = _XfemRectWidth(w);
geom.width = _XfemBoundaryWidth(w);
/* Look for a visible attachment */
if (_XfeIsAlive(aw))
@ -1772,7 +1771,7 @@ ChildOneLayoutHorizontal(Widget w)
}
else
{
geom.width = sp->sash_rect.x - _XfemRectX(w) - SASH_SPACING(sp);
geom.width = sp->sash_rect.x - _XfemBoundaryX(w) - SASH_SPACING(sp);
}
ChildLayout(sp->child_one,
@ -1789,16 +1788,16 @@ ChildTwoLayoutHorizontal(Widget w)
XfePanePart * sp = _XfePanePart(w);
XfeGeometryRec geom;
geom.y = _XfemRectY(w);
geom.height = _XfemRectHeight(w);
geom.y = _XfemBoundaryY(w);
geom.height = _XfemBoundaryHeight(w);
if (ChildShouldExpand(w,sp->child_two))
{
Widget aw = AttachmentGetVisibleChild(w,sp->child_one);
/* Start by asuming that we can use the full extent of the pane */
geom.x = _XfemRectX(w);
geom.width = _XfemRectWidth(w);
geom.x = _XfemBoundaryX(w);
geom.width = _XfemBoundaryWidth(w);
/* Look for a visible attachment */
if (_XfeIsAlive(aw))
@ -1818,8 +1817,8 @@ ChildTwoLayoutHorizontal(Widget w)
SASH_SPACING(sp);
geom.width =
_XfemRectX(w) +
_XfemRectWidth(w) -
_XfemBoundaryX(w) +
_XfemBoundaryWidth(w) -
geom.x -
SASH_SPACING(sp);
}
@ -1944,7 +1943,7 @@ AttachmentLayout(Widget w,Widget aw,XfeGeometry pg)
(aw == sp->attachment_one_bottom))
{
x = pg->x;
y = _XfemRectY(w);
y = _XfemBoundaryY(w);
width = pg->width;
height = _XfeHeight(aw);
}
@ -1952,7 +1951,7 @@ AttachmentLayout(Widget w,Widget aw,XfeGeometry pg)
(aw == sp->attachment_two_bottom))
{
x = pg->x;
y = _XfemRectY(w) + _XfemRectHeight(w) - _XfeHeight(aw);
y = _XfemBoundaryY(w) + _XfemBoundaryHeight(w) - _XfeHeight(aw);
width = pg->width;
height = _XfeHeight(aw);
}
@ -1963,7 +1962,7 @@ AttachmentLayout(Widget w,Widget aw,XfeGeometry pg)
if ((aw == sp->attachment_one_left) ||
(aw == sp->attachment_one_right))
{
x = _XfemRectY(w);
x = _XfemBoundaryY(w);
y = pg->y;
width = _XfeWidth(aw);
height = pg->height;
@ -1971,7 +1970,7 @@ AttachmentLayout(Widget w,Widget aw,XfeGeometry pg)
else if ((aw == sp->attachment_two_left) ||
(aw == sp->attachment_two_right))
{
x = _XfemRectX(w) + _XfemRectWidth(w) - _XfeWidth(aw);
x = _XfemBoundaryX(w) + _XfemBoundaryWidth(w) - _XfeWidth(aw);
y = pg->y;
width = _XfeWidth(aw);
height = pg->height;
@ -2111,20 +2110,20 @@ SashLayout(Widget w,Position sash_position,XRectangle * sash_rect)
/* Vertical */
if (_XfeOrientedOrientation(w) == XmVERTICAL)
{
sash_rect->x = _XfemRectX(w) + sp->sash_offset;
sash_rect->y = _XfemRectY(w) + sash_position;
sash_rect->x = _XfemBoundaryX(w) + sp->sash_offset;
sash_rect->y = _XfemBoundaryY(w) + sash_position;
sash_rect->width = _XfemRectWidth(w) - 2 * sp->sash_offset;
sash_rect->width = _XfemBoundaryWidth(w) - 2 * sp->sash_offset;
sash_rect->height = sp->sash_thickness;
}
/* Horizontal */
else
{
sash_rect->x = _XfemRectX(w) + sash_position;
sash_rect->y = _XfemRectY(w) + sp->sash_offset;
sash_rect->x = _XfemBoundaryX(w) + sash_position;
sash_rect->y = _XfemBoundaryY(w) + sp->sash_offset;
sash_rect->width = sp->sash_thickness;
sash_rect->height = _XfemRectHeight(w) - 2 * sp->sash_offset;
sash_rect->height = _XfemBoundaryHeight(w) - 2 * sp->sash_offset;
}
}
/*----------------------------------------------------------------------*/
@ -2367,11 +2366,8 @@ SashDragEnd(Widget w,int x,int y,Widget aw)
/* Update the sash position */
sp->sash_position = new_pos;
/* Layout the components */
_XfeManagerLayoutComponents(w);
/* Layout the children */
_XfeManagerLayoutChildren(w);
/* Layout the widget */
_XfeManagerLayoutWidget(w);
/* Draw components */
SashDrawShadow(w,&sp->sash_rect,True);
@ -2461,11 +2457,8 @@ SashDragMotion(Widget w,int x,int y,Widget aw)
/* Update the sash position */
sp->sash_position = new_pos;
/* Layout the components */
_XfeManagerLayoutComponents(w);
/* Layout the children */
_XfeManagerLayoutChildren(w);
/* Layout the widget */
_XfeManagerLayoutWidget(w);
/* Draw components */
SashDrawShadow(w,&sp->sash_rect,True);
@ -2529,7 +2522,7 @@ SashMaxPosition(Widget w)
Dimension pane_minimum_two = ChildMinSize(w,sp->child_two);
max_pos =
_XfemRectWidth(w) -
_XfemBoundaryWidth(w) -
pane_minimum_two -
sp->sash_rect.width;
}
@ -2569,7 +2562,7 @@ SashMaxPositionX(Widget w)
Dimension pane_minimum_two = ChildMinSize(w,sp->child_two);
max_pos =
_XfemRectWidth(w) -
_XfemBoundaryWidth(w) -
pane_minimum_two -
sp->sash_rect.width;
}

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

@ -54,6 +54,7 @@ typedef struct _XfePaneClassRec
ConstraintClassPart constraint_class;
XmManagerClassPart manager_class;
XfeManagerClassPart xfe_manager_class;
XfeDynamicManagerClassPart xfe_dynamic_manager_class;
XfeOrientedClassPart xfe_oriented_class;
XfePaneClassPart xfe_pane_class;
} XfePaneClassRec;
@ -115,13 +116,14 @@ typedef struct _XfePanePart
/*----------------------------------------------------------------------*/
typedef struct _XfePaneRec
{
CorePart core;
CompositePart composite;
ConstraintPart constraint;
XmManagerPart manager;
XfeManagerPart xfe_manager;
XfeOrientedPart xfe_oriented;
XfePanePart xfe_pane;
CorePart core;
CompositePart composite;
ConstraintPart constraint;
XmManagerPart manager;
XfeManagerPart xfe_manager;
XfeDynamicManagerPart xfe_dynamic_manager;
XfeOrientedPart xfe_oriented;
XfePanePart xfe_pane;
} XfePaneRec;
/*----------------------------------------------------------------------*/
@ -149,6 +151,7 @@ typedef struct _XfePaneConstraintRec
{
XmManagerConstraintPart manager;
XfeManagerConstraintPart xfe_manager;
XfeDynamicManagerConstraintPart xfe_dynamic_manager;
XfeOrientedConstraintPart xfe_oriented;
XfePaneConstraintPart xfe_pane;
} XfePaneConstraintRec;

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

@ -77,8 +77,7 @@ static Boolean WidgetDisplayRect (Widget,XRectangle *);
static void InitializePostHook (Widget,Widget);
static Boolean SetValuesPostHook (Widget,Widget,Widget);
static void PreferredGeometry (Widget,Dimension *,Dimension *);
static void MinimumGeometry (Widget,Dimension *,Dimension *);
static void UpdateRect (Widget);
static void UpdateBoundary (Widget);
static void DrawShadow (Widget,XEvent *,Region,XRectangle *);
/*----------------------------------------------------------------------*/
@ -472,8 +471,7 @@ _XFE_WIDGET_CLASS_RECORD(primitive,Primitive) =
{
ForgetGravity, /* bit_gravity */
PreferredGeometry, /* preferred_geometry */
MinimumGeometry, /* minimum_geometry */
UpdateRect, /* update_rect */
UpdateBoundary, /* update_boundary */
NULL, /* prepare_components */
NULL, /* layout_components */
NULL, /* draw_background */
@ -518,11 +516,8 @@ ClassPartInit(WidgetClass wc)
_XfeResolve(cc,sc,xfe_primitive_class,preferred_geometry,
XfeInheritPreferredGeometry);
_XfeResolve(cc,sc,xfe_primitive_class,minimum_geometry,
XfeInheritMinimumGeometry);
_XfeResolve(cc,sc,xfe_primitive_class,update_rect,
XfeInheritUpdateRect);
_XfeResolve(cc,sc,xfe_primitive_class,update_boundary,
XfeInheritUpdateBoundary);
_XfeResolve(cc,sc,xfe_primitive_class,layout_components,
XfeInheritLayoutComponents);
@ -657,8 +652,8 @@ Resize(Widget w)
_XfeHeight(w) = _XfePreferredHeight(w);
}
/* Update the widget rect */
_XfePrimitiveUpdateRect(w);
/* Update the widget boundary */
_XfePrimitiveUpdateBoundary(w);
/* Layout the components */
_XfePrimitiveLayoutComponents(w);
@ -888,10 +883,10 @@ SetValues(Widget ow,Widget rw,Widget nw,ArgList args,Cardinal *nargs)
static Boolean
WidgetDisplayRect(Widget w,XRectangle *rect)
{
rect->x = _XfeRectX(w);
rect->y = _XfeRectY(w);
rect->height = _XfeRectHeight(w);
rect->width = _XfeRectWidth(w);
rect->x = _XfeBoundaryX(w);
rect->y = _XfeBoundaryY(w);
rect->height = _XfeBoundaryHeight(w);
rect->width = _XfeBoundaryWidth(w);
return (rect->width && rect->height);
}
@ -921,8 +916,8 @@ InitializePostHook(Widget rw,Widget nw)
_XfeHeight(nw) = GetHeight(nw);
/* Update the widget rect */
_XfePrimitiveUpdateRect(nw);
/* Update the widget boundary */
_XfePrimitiveUpdateBoundary(nw);
/* Layout the Widget */
_XfePrimitiveLayoutComponents(nw);
@ -974,8 +969,8 @@ SetValuesPostHook(Widget ow,Widget rw,Widget nw)
_XfeHeight(nw) = GetHeight(nw);
}
/* Update the widget rect */
_XfePrimitiveUpdateRect(nw);
/* Update the widget boundary */
_XfePrimitiveUpdateBoundary(nw);
/* Layout the Widget if needed */
if (_XfeConfigFlags(nw) & XfeConfigLayout)
@ -1030,13 +1025,6 @@ PreferredGeometry(Widget w,Dimension *width,Dimension *height)
}
/*----------------------------------------------------------------------*/
static void
MinimumGeometry(Widget w,Dimension *width,Dimension *height)
{
*width = _XfeOffsetLeft(w) + _XfeOffsetRight(w);
*height = _XfeOffsetTop(w) + _XfeOffsetBottom(w);
}
/*----------------------------------------------------------------------*/
static void
DrawShadow(Widget w,XEvent * event,Region region,XRectangle * clip_rect)
{
/* Draw the shadow */
@ -1052,10 +1040,10 @@ DrawShadow(Widget w,XEvent * event,Region region,XRectangle * clip_rect)
}
/*----------------------------------------------------------------------*/
static void
UpdateRect(Widget w)
UpdateBoundary(Widget w)
{
/* Assign the rect coordinates */
XfeRectSet(&_XfeWidgetRect(w),
XfeRectSet(&_XfeBoundary(w),
_XfeOffsetLeft(w),
@ -1271,29 +1259,6 @@ _XfePrimitivePreferredGeometry(Widget w,Dimension *width,Dimension *height)
}
/*----------------------------------------------------------------------*/
/* extern */ void
_XfePrimitiveMinimumGeometry(Widget w,Dimension *width,Dimension *height)
{
XfePrimitiveWidgetClass pc = (XfePrimitiveWidgetClass) XtClass(w);
if (pc->xfe_primitive_class.minimum_geometry)
{
(*pc->xfe_primitive_class.minimum_geometry)(w,width,height);
}
/* Make sure preferred width is greater than zero */
if (*width == 0)
{
*width = XfePRIMITIVE_DEFAULT_WIDTH;
}
/* Make sure preferred height is greater than zero */
if (*height == 0)
{
*height = XfePRIMITIVE_DEFAULT_HEIGHT;
}
}
/*----------------------------------------------------------------------*/
/* extern */ void
_XfePrimitivePrepareComponents(Widget w,int flags)
{
WidgetClass cc;
@ -1329,13 +1294,13 @@ _XfePrimitivePrepareComponents(Widget w,int flags)
}
/*----------------------------------------------------------------------*/
/* extern */ void
_XfePrimitiveUpdateRect(Widget w)
_XfePrimitiveUpdateBoundary(Widget w)
{
XfePrimitiveWidgetClass pc = (XfePrimitiveWidgetClass) XtClass(w);
if (pc->xfe_primitive_class.update_rect)
if (pc->xfe_primitive_class.update_boundary)
{
(*pc->xfe_primitive_class.update_rect)(w);
(*pc->xfe_primitive_class.update_boundary)(w);
}
}
/*----------------------------------------------------------------------*/
@ -1481,10 +1446,10 @@ _XfePrimitiveDrawEverything(Widget w,XEvent * event,Region region)
/* Draw Background */
XfeRectSet(&rect,
_XfeRectX(w) - _XfeMarginLeft(w),
_XfeRectY(w) - _XfeMarginTop(w),
_XfeRectWidth(w) + _XfeMarginLeft(w) + _XfeMarginRight(w),
_XfeRectHeight(w) + _XfeMarginTop(w) + _XfeMarginBottom(w));
_XfeBoundaryX(w) - _XfeMarginLeft(w),
_XfeBoundaryY(w) - _XfeMarginTop(w),
_XfeBoundaryWidth(w) + _XfeMarginLeft(w) + _XfeMarginRight(w),
_XfeBoundaryHeight(w) + _XfeMarginTop(w) + _XfeMarginBottom(w));
_XfePrimitiveDrawBackground(w,event,region,&rect);
@ -1499,10 +1464,10 @@ _XfePrimitiveDrawEverything(Widget w,XEvent * event,Region region)
}
/* Draw Shadow */
_XfePrimitiveDrawShadow(w,event,region,&_XfeWidgetRect(w));
_XfePrimitiveDrawShadow(w,event,region,&_XfeBoundary(w));
/* Draw Components */
_XfePrimitiveDrawComponents(w,event,region,&_XfeWidgetRect(w));
_XfePrimitiveDrawComponents(w,event,region,&_XfeBoundary(w));
}
/*----------------------------------------------------------------------*/
/* extern */ void

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

@ -42,15 +42,22 @@ XFE_BEGIN_CPLUSPLUS_PROTECTION
/*----------------------------------------------------------------------*/
typedef struct
{
/* Bit gravity */
XfeBitGravityType bit_gravity; /* bit_gravity */
/* Geometry methods */
XfeGeometryProc preferred_geometry; /* preferred_geometry */
XfeGeometryProc minimum_geometry; /* minimum_geometry */
XtWidgetProc update_rect; /* update_rect */
XtWidgetProc update_boundary; /* update_boundary */
/* Component methods */
XfePrepareProc prepare_components; /* prepare_components */
XtWidgetProc layout_components; /* layout_components */
/* Rendering methods */
XfeExposeProc draw_background; /* draw_background */
XfeExposeProc draw_shadow; /* draw_shadow */
XfeExposeProc draw_components; /* draw_components */
XtPointer extension; /* extension */
} XfePrimitiveClassPart;
@ -113,8 +120,12 @@ typedef struct _XfePrimitivePart
/* Private Data Members */
int config_flags; /* Config Flags */
int prepare_flags; /* Prepare Flags */
XRectangle widget_rect; /* Widget Rect */
/* The widget's boundary */
XRectangle boundary; /* Boundary */
GC background_GC; /* Background GC */
Pixmap buffer_pixmap; /* Buffer pixmap */
} XfePrimitivePart;
@ -164,7 +175,7 @@ _XfePrimitivePreferredGeometry (Widget w,
Dimension * height);
/*----------------------------------------------------------------------*/
extern void
_XfePrimitiveUpdateRect (Widget w);
_XfePrimitiveUpdateBoundary (Widget w);
/*----------------------------------------------------------------------*/
extern void
_XfePrimitivePrepareComponents (Widget w,
@ -318,9 +329,6 @@ _XfePrimitiveFocus (Widget,XEvent *,char **,Cardinal *);
#define _XfePointerInside(w) \
(((XfePrimitiveWidget) (w))->xfe_primitive . pointer_inside)
/*----------------------------------------------------------------------*/
#define _XfeWidgetRect(w) \
(((XfePrimitiveWidget) (w))->xfe_primitive . widget_rect)
/*----------------------------------------------------------------------*/
#define _XfeBackgroundGC(w) \
(((XfePrimitiveWidget) (w))->xfe_primitive . background_GC)
/*----------------------------------------------------------------------*/
@ -412,6 +420,19 @@ _XfePrimitiveFocus (Widget,XEvent *,char **,Cardinal *);
(((XmPrimitiveWidget) (w))->primitive . user_data)
/*----------------------------------------------------------------------*/
/*----------------------------------------------------------------------*/
/* */
/* XfePrimitive boundary access macros */
/* */
/*----------------------------------------------------------------------*/
#define _XfeBoundary(w) (((XfePrimitiveWidget) (w))->xfe_primitive . boundary)
#define _XfeBoundaryHeight(w) (_XfeBoundary(w) . height)
#define _XfeBoundaryWidth(w) (_XfeBoundary(w) . width)
#define _XfeBoundaryX(w) (_XfeBoundary(w) . x)
#define _XfeBoundaryY(w) (_XfeBoundary(w) . y)
/*----------------------------------------------------------------------*/
/*----------------------------------------------------------------------*/
/* */
/* Access to debug resources */
@ -440,10 +461,6 @@ _XfePrimitiveFocus (Widget,XEvent *,char **,Cardinal *);
#define _XfeOffsetRight(w) (_XfePrimitiveOffset(w) + _XfeMarginRight(w))
#define _XfeOffsetTop(w) (_XfePrimitiveOffset(w) + _XfeMarginTop(w))
#define _XfeOffsetBottom(w) (_XfePrimitiveOffset(w) + _XfeMarginBottom(w))
#define _XfeRectHeight(w) (_XfeWidgetRect(w) . height)
#define _XfeRectWidth(w) (_XfeWidgetRect(w) . width)
#define _XfeRectX(w) (_XfeWidgetRect(w) . x)
#define _XfeRectY(w) (_XfeWidgetRect(w) . y)
/*----------------------------------------------------------------------*/
/* */

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

@ -272,8 +272,7 @@ _XFE_WIDGET_CLASS_RECORD(progressbar,ProgressBar) =
{
XfeInheritBitGravity, /* bit_gravity */
XfeInheritPreferredGeometry, /* preferred_geometry */
XfeInheritMinimumGeometry, /* minimum_geometry */
XfeInheritUpdateRect, /* update_rect */
XfeInheritUpdateBoundary, /* update_boundary */
NULL, /* prepare_components */
LayoutComponents, /* layout_components */
XfeInheritDrawBackground, /* draw_background */
@ -596,18 +595,18 @@ BarLayout(Widget w)
float x2;
#if 0
x1 = (float) pp->start_percent / 100.0 * (float) _XfeRectWidth(w);
x2 = (float) pp->end_percent / 100.0 * (float) _XfeRectWidth(w);
x1 = (float) pp->start_percent / 100.0 * (float) _XfeBoundaryWidth(w);
x2 = (float) pp->end_percent / 100.0 * (float) _XfeBoundaryWidth(w);
#else
x1 = ((float) pp->start_percent * (float) _XfeRectWidth(w)) / 100.0;
x2 = ((float) pp->end_percent * (float) _XfeRectWidth(w)) / 100.0;
x1 = ((float) pp->start_percent * (float) _XfeBoundaryWidth(w)) / 100.0;
x2 = ((float) pp->end_percent * (float) _XfeBoundaryWidth(w)) / 100.0;
#endif
pp->bar_rect.x = _XfeRectX(w) + (int) x1;
pp->bar_rect.y = _XfeRectY(w);
pp->bar_rect.x = _XfeBoundaryX(w) + (int) x1;
pp->bar_rect.y = _XfeBoundaryY(w);
pp->bar_rect.width = (int) (x2 - x1);
pp->bar_rect.height =_XfeRectHeight(w);
pp->bar_rect.height =_XfeBoundaryHeight(w);
#if 0
printf("x1 = %f,x2 = %f\t(x2 - x1) = %f =(int) %d\n",

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

@ -297,6 +297,21 @@ RegisterChromeChildType(void)
XmRepTypeRegister(XmRChromeChildType,names,NULL,XtNumber(names));
}
/*----------------------------------------------------------------------*/
#if 0
static void
RegisterManagerChildType(void)
{
static String names[] =
{
"manager_component_child",
"manager_dynamic_child",
"manager_static_child"
};
XmRepTypeRegister(XmRManagerChildType,names,NULL,XtNumber(names));
}
/*----------------------------------------------------------------------*/
#endif
/* extern */ void
XfeRegisterRepresentationTypes(void)
{
@ -307,6 +322,7 @@ XfeRegisterRepresentationTypes(void)
RegisterButtonType();
RegisterChromeChildType();
RegisterLocationType();
/* RegisterManagerChildType(); */
RegisterPaneChildAttachment();
RegisterPaneChildType();
RegisterPaneDragModeType();

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

@ -69,11 +69,9 @@ _XfeManagerPropagateSetValues(Widget ow,
/* XmNbackground */
if (_XfeBackgroundPixel(nw) != _XfeBackgroundPixel(ow))
{
printf("XmNbackground changed\n");
SET_APPLY_DATA(data,XmNbackground,_XfeBackgroundPixel(nw));
XfeManagerApply(nw,ApplyChildSetValue,&data,True,False);
XfeManagerApply(nw,XfeCHILDREN_INFO_ANY,ApplyChildSetValue,&data,True,False);
_XfemConfigFlags(nw) |= XfeConfigExpose;
}
@ -83,7 +81,7 @@ _XfeManagerPropagateSetValues(Widget ow,
{
SET_APPLY_DATA(data,XmNbackground,_XfeBackgroundPixmap(nw));
XfeManagerApply(nw,ApplyChildSetValue,&data,True,False);
XfeManagerApply(nw,XfeCHILDREN_INFO_ANY,ApplyChildSetValue,&data,True,False);
_XfemConfigFlags(nw) |= XfeConfigExpose;
}
@ -93,7 +91,7 @@ _XfeManagerPropagateSetValues(Widget ow,
{
SET_APPLY_DATA(data,XmNborderColor,_XfeBorderPixmap(nw));
XfeManagerApply(nw,ApplyChildSetValue,&data,True,False);
XfeManagerApply(nw,XfeCHILDREN_INFO_ANY,ApplyChildSetValue,&data,True,False);
_XfemConfigFlags(nw) |= XfeConfigExpose;
}
@ -103,7 +101,7 @@ _XfeManagerPropagateSetValues(Widget ow,
{
SET_APPLY_DATA(data,XmNborderPixmap,_XfeBorderPixmap(nw));
XfeManagerApply(nw,ApplyChildSetValue,&data,True,False);
XfeManagerApply(nw,XfeCHILDREN_INFO_ANY,ApplyChildSetValue,&data,True,False);
_XfemConfigFlags(nw) |= XfeConfigExpose;
}
@ -113,7 +111,7 @@ _XfeManagerPropagateSetValues(Widget ow,
{
SET_APPLY_DATA(data,XmNtopShadowPixmap,_XfemTopShadowPixmap(nw));
XfeManagerApply(nw,ApplyChildSetValue,&data,True,False);
XfeManagerApply(nw,XfeCHILDREN_INFO_ANY,ApplyChildSetValue,&data,True,False);
_XfemConfigFlags(nw) |= XfeConfigExpose;
}
@ -123,7 +121,7 @@ _XfeManagerPropagateSetValues(Widget ow,
{
SET_APPLY_DATA(data,XmNbottomShadowPixmap,_XfemBottomShadowPixmap(nw));
XfeManagerApply(nw,ApplyChildSetValue,&data,True,False);
XfeManagerApply(nw,XfeCHILDREN_INFO_ANY,ApplyChildSetValue,&data,True,False);
_XfemConfigFlags(nw) |= XfeConfigExpose;
}
@ -133,7 +131,7 @@ _XfeManagerPropagateSetValues(Widget ow,
{
SET_APPLY_DATA(data,XmNtopShadowColor,_XfemTopShadowColor(nw));
XfeManagerApply(nw,ApplyChildSetValue,&data,True,False);
XfeManagerApply(nw,XfeCHILDREN_INFO_ANY,ApplyChildSetValue,&data,True,False);
_XfemConfigFlags(nw) |= XfeConfigExpose;
}
@ -143,7 +141,7 @@ _XfeManagerPropagateSetValues(Widget ow,
{
SET_APPLY_DATA(data,XmNbottomShadowColor,_XfemBottomShadowColor(nw));
XfeManagerApply(nw,ApplyChildSetValue,&data,True,False);
XfeManagerApply(nw,XfeCHILDREN_INFO_ANY,ApplyChildSetValue,&data,True,False);
_XfemConfigFlags(nw) |= XfeConfigExpose;
}
@ -153,7 +151,7 @@ _XfeManagerPropagateSetValues(Widget ow,
{
SET_APPLY_DATA(data,XmNforeground,_XfemForeground(nw));
XfeManagerApply(nw,ApplyChildSetValue,&data,True,False);
XfeManagerApply(nw,XfeCHILDREN_INFO_ANY,ApplyChildSetValue,&data,True,False);
_XfemConfigFlags(nw) |= XfeConfigExpose;
}
@ -163,7 +161,7 @@ _XfeManagerPropagateSetValues(Widget ow,
{
if (_XfeSensitive(nw) != _XfeSensitive(ow))
{
XfeManagerApply(nw,ApplyChildSetSensitive,NULL,True,False);
XfeManagerApply(nw,XfeCHILDREN_INFO_ANY,ApplyChildSetSensitive,NULL,True,False);
_XfemConfigFlags(nw) |= XfeConfigExpose;
}
@ -191,7 +189,7 @@ ApplyChildSetValue(Widget w,Widget child,XtPointer client_data)
printf("XtSetValues(%s,%s,%d)\n",
XtName(child),
data->resource_name,
data->resource_value);
(int) data->resource_value);
#endif
}
/*----------------------------------------------------------------------*/

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

@ -196,27 +196,21 @@
#define XmNitemList "itemList"
#define XmNlabelAlignment "labelAlignment"
#define XmNlabelDirection "labelDirection"
#define XmNlayableChildren "layableChildren"
#define XmNleftPixmap "leftPixmap"
#define XmNleftRaisedPixmap "leftRaisedPixmap"
#define XmNleftView "leftView"
#define XmNlinkNode "linkNode"
#define XmNlogo "logo"
#define XmNmanagedItemCount "managedItemCount"
#define XmNmanagerChildType "managerChildType"
#define XmNmatchSubMenuWidth "matchSubMenuWidth"
#define XmNmaxChildHeight "maxChildHeight"
#define XmNmaxChildWidth "maxChildWidth"
#define XmNmaxLayableChildrenHeight "maxLayableChildrenHeight"
#define XmNmaxLayableChildrenWidth "maxLayableChildrenWidth"
#define XmNmaxNumColumns "maxNumColumns"
#define XmNmaxNumRows "maxNumRows"
#define XmNminLayableChildrenHeight "minLayableChildrenHeight"
#define XmNminLayableChildrenWidth "minLayableChildrenWidth"
#define XmNnumAnimationPixmaps "numAnimationPixmaps"
#define XmNnumFontItems "numFontItems"
#define XmNnumLayableChildren "numLayableChildren"
#define XmNnumPopupChildren "numPopupChildren"
#define XmNnumPrivateComponents "numPrivateComponents"
#define XmNnumRows "numRows"
#define XmNopen "open"
#define XmNopenedTabs "openedTabs"
@ -234,7 +228,6 @@
#define XmNpreferredHeight "preferredHeight"
#define XmNpreferredWidth "preferredWidth"
#define XmNpretendSensitive "pretendSensitive"
#define XmNprivateComponent "privateComponent"
#define XmNprogressBar "progressBar"
#define XmNraiseBackground "raiseBackground"
#define XmNraiseBorderThickness "raiseBorderThickness"
@ -286,8 +279,6 @@
#define XmNtopView "topView"
#define XmNtorn "torn"
#define XmNtornShellTitle "tornShellTitle"
#define XmNtotalLayableChildrenHeight "totalLayableChildrenHeight"
#define XmNtotalLayableChildrenWidth "totalLayableChildrenWidth"
#define XmNtrackDeleteWindow "trackDeleteWindow"
#define XmNtrackEditres "trackEditres"
#define XmNtrackMapping "trackMapping"
@ -403,7 +394,6 @@
#define XmCItemForeground "ItemForeground"
#define XmCLabelAlignment "LabelAlignment"
#define XmCLabelDirection "LabelDirection"
#define XmCLayableChildren "LayableChildren"
#define XmCLeftPixmap "LeftPixmap"
#define XmCLeftRaisedPixmap "LeftRaisedPixmap"
#define XmCLinkNode "LinkNode"
@ -412,7 +402,6 @@
#define XmCMaxNumRows "MaxNumRows"
#define XmCNumAnimationPixmaps "NumAnimationPixmaps"
#define XmCNumFontItems "NumFontItems"
#define XmCNumLayableChildren "NumLayableChildren"
#define XmCNumLogoPixmaps "NumLogoPixmaps"
#define XmCNumRows "NumRows"
#define XmCOpen "Open"
@ -424,7 +413,6 @@
#define XmCPopupCursor "PopupCursor"
#define XmCPopupDelay "PopupDelay"
#define XmCPretendSensitive "PretendSensitive"
#define XmCPrivateComponent "PrivateComponent"
#define XmCRaiseBackground "RaiseBackground"
#define XmCRaiseBorderThickness "RaiseBorderThickness"
#define XmCRaiseForeground "RaiseForeground"
@ -480,6 +468,41 @@
#define XmCVerticalPixmap "VerticalPixmap"
#define XmCVerticalRaisedPixmap "VerticalRaisedPixmap"
/*----------------------------------------------------------------------*/
/* */
/* XfeManager Children Resource Names */
/* */
/*----------------------------------------------------------------------*/
#define XmNdynamicChildren "dynamicChildren"
#define XmNmaxDynamicChildrenHeight "maxDynamicChildrenHeight"
#define XmNmaxDynamicChildrenWidth "maxDynamicChildrenWidth"
#define XmNminDynamicChildrenHeight "minDynamicChildrenHeight"
#define XmNminDynamicChildrenWidth "minDynamicChildrenWidth"
#define XmNnumDynamicChildren "numDynamicChildren"
#define XmNnumManagedDynamicChildren "numManagedDynamicChildren"
#define XmNtotalDynamicChildrenHeight "totalDynamicChildrenHeight"
#define XmNtotalDynamicChildrenWidth "totalDynamicChildrenWidth"
#define XmNstaticChildren "staticChildren"
#define XmNmaxStaticChildrenHeight "maxStaticChildrenHeight"
#define XmNmaxStaticChildrenWidth "maxStaticChildrenWidth"
#define XmNminStaticChildrenHeight "minStaticChildrenHeight"
#define XmNminStaticChildrenWidth "minStaticChildrenWidth"
#define XmNnumManagedStaticChildren "numManagedStaticChildren"
#define XmNnumStaticChildren "numStaticChildren"
#define XmNtotalStaticChildrenHeight "totalStaticChildrenHeight"
#define XmNtotalStaticChildrenWidth "totalStaticChildrenWidth"
#define XmNcomponentChildren "componentChildren"
#define XmNmaxComponentChildrenHeight "maxComponentChildrenHeight"
#define XmNmaxComponentChildrenWidth "maxComponentChildrenWidth"
#define XmNminComponentChildrenHeigh "minComponentChildrenHeight"
#define XmNminComponentChildrenWidth "minComponentChildrenWidth"
#define XmNnumComponentChildren "numComponentChildren"
#define XmNnumManagedComponentChildren "numManagedComponentChildren"
#define XmNtotalComponentChildrenHeight "totalComponentChildrenHeight"
#define XmNtotalComponentChildrenWidth "totalComponentChildrenWidth"
/*----------------------------------------------------------------------*/
/* */
/* Representation Types */
@ -508,6 +531,7 @@
#define XmRToolScrollArrowPlacement "ToolScrollArrowPlacement"
#define XmRTruncateProc "TruncateProc"
#define XmRXfeArrowType "XfeArrowType"
#define XmRManagerChildType "ManagerChildType"
/*----------------------------------------------------------------------*/
/* */

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

@ -294,8 +294,7 @@ _XFE_WIDGET_CLASS_RECORD(tab,Tab) =
{
XfeInheritBitGravity, /* bit_gravity */
PreferredGeometry, /* preferred_geometry */
XfeInheritMinimumGeometry, /* minimum_geometry */
XfeInheritUpdateRect, /* update_rect */
XfeInheritUpdateBoundary, /* update_boundary */
PrepareComponents, /* prepare_components */
XfeInheritLayoutComponents, /* layout_components */
DrawBackground, /* draw_background */
@ -687,7 +686,7 @@ DrawTab(Widget w,XEvent *event,Region region,XRectangle * clip_rect)
tp->top_width,
tp->top_height,
(_XfeWidth(w) - tp->top_width) / 2,
_XfeRectY(w));
_XfeBoundaryY(w));
}
/* Draw bottom pixmap if needed */
@ -754,7 +753,7 @@ DrawTab(Widget w,XEvent *event,Region region,XRectangle * clip_rect)
0,0,
tp->left_width,
tp->left_height,
_XfeRectX(w),
_XfeBoundaryX(w),
(_XfeHeight(w) - tp->left_height) / 2);
}

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

@ -61,9 +61,15 @@ static Boolean SetValues (Widget,Widget,Widget,ArgList,
/* */
/*----------------------------------------------------------------------*/
static void PreferredGeometry (Widget,Dimension *,Dimension *);
static void LayoutChildren (Widget);
static void LayoutComponents (Widget);
/*----------------------------------------------------------------------*/
/* */
/* XfeDynamicManager class methods */
/* */
/*----------------------------------------------------------------------*/
static void LayoutDynamicChildren (Widget);
/*----------------------------------------------------------------------*/
/* */
/* Misc XfeTaskBar functions */
@ -250,24 +256,32 @@ _XFE_WIDGET_CLASS_RECORD(taskbar,TaskBar) =
},
/* XfeManager Part */
{
XfeInheritBitGravity, /* bit_gravity */
PreferredGeometry, /* preferred_geometry */
XfeInheritUpdateBoundary, /* update_boundary */
XfeInheritUpdateChildrenInfo, /* update_children_info */
XfeInheritLayoutWidget, /* layout_widget */
NULL, /* accept_static_child */
NULL, /* insert_static_child */
NULL, /* delete_static_child */
NULL, /* layout_static_children */
XfeInheritChangeManaged, /* change_managed */
NULL, /* prepare_components */
LayoutComponents, /* layout_components */
NULL, /* draw_background */
XfeInheritDrawShadow, /* draw_shadow */
XfeInheritDrawComponents, /* draw_components */
NULL, /* extension */
},
/* XfeDynamicManager Part */
{
XfeInheritBitGravity, /* bit_gravity */
PreferredGeometry, /* preferred_geometry */
XfeInheritMinimumGeometry, /* minimum_geometry */
XfeInheritUpdateRect, /* update_rect */
XfeInheritAcceptChild, /* accept_child */
XfeInheritInsertChild, /* insert_child */
XfeInheritDeleteChild, /* delete_child */
XfeInheritChangeManaged, /* change_managed */
NULL, /* prepare_components */
LayoutComponents, /* layout_components */
LayoutChildren, /* layout_children */
NULL, /* draw_background */
XfeInheritDrawShadow, /* draw_shadow */
XfeInheritDrawComponents, /* draw_components */
False, /* count_layable_children*/
NULL, /* child_is_layable */
NULL, /* extension */
XfeInheritAcceptDynamicChild, /* accept_dynamic_child */
XfeInheritInsertDynamicChild, /* insert_dynamic_child */
XfeInheritDeleteDynamicChild, /* delete_dynamic_child */
LayoutDynamicChildren, /* layout_dynamic_children */
NULL, /* extension */
},
/* XfeOriented Part */
@ -327,7 +341,7 @@ Initialize(Widget rw,Widget nw,ArgList args,Cardinal *nargs)
XmNmarginRight, 0,
XmNmarginTop, 0,
XmNmarginBottom, 0,
XmNprivateComponent, True,
/* XmNprivateComponent, True, */
XmNtraversalOn, False,
XmNhighlightThickness, 0,
XmNarmOffset, 0,
@ -434,50 +448,6 @@ PreferredGeometry(Widget w,Dimension * width,Dimension * height)
}
/*----------------------------------------------------------------------*/
static void
LayoutChildren(Widget w)
{
XfeTaskBarPart * tp = _XfeTaskBarPart(w);
XfeToolBarWidgetClass tbc = (XfeToolBarWidgetClass)xfeToolBarWidgetClass;
Dimension action_width;
Dimension action_height;
if (tp->show_action_button && _XfeIsAlive(tp->action_button))
{
action_width = _XfeWidth(tp->action_button);
action_height = _XfeHeight(tp->action_button);
}
else
{
action_width = 0;
action_height = 0;
}
/* Add the action button's dimensions if needed */
switch (_XfeOrientedOrientation(w))
{
case XmHORIZONTAL:
_XfemMarginLeft(w) += action_width;
(*tbc->xfe_manager_class.layout_children)(w);
_XfemMarginLeft(w) -= action_width;
break;
case XmVERTICAL:
_XfemMarginTop(w) += action_height;
(*tbc->xfe_manager_class.layout_children)(w);
_XfemMarginTop(w) -= action_height;
break;
}
}
/*----------------------------------------------------------------------*/
static void
LayoutComponents(Widget w)
{
XfeTaskBarPart * tp = _XfeTaskBarPart(w);
@ -491,20 +461,67 @@ LayoutComponents(Widget w)
return;
}
/* Do our layout */
switch(_XfeOrientedOrientation(w))
/* Horizontal */
if (_XfeOrientedOrientation(w) == XmHORIZONTAL)
{
case XmHORIZONTAL:
LayoutComponentsHorizontal(w);
break;
case XmVERTICAL:
}
/* Vertical */
else
{
LayoutComponentsVertical(w);
break;
}
}
/*----------------------------------------------------------------------*/
/*----------------------------------------------------------------------*/
/* */
/* XfeDynamicManager class methods */
/* */
/*----------------------------------------------------------------------*/
static void
LayoutDynamicChildren(Widget w)
{
XfeTaskBarPart * tp = _XfeTaskBarPart(w);
Dimension action_width;
Dimension action_height;
if (tp->show_action_button && _XfeIsAlive(tp->action_button))
{
action_width = _XfeWidth(tp->action_button);
action_height = _XfeHeight(tp->action_button);
}
else
{
action_width = 0;
action_height = 0;
}
/* Horizontal */
if (_XfeOrientedOrientation(w) == XmHORIZONTAL)
{
/* Add the action button's dimensions to the left margin */
_XfemMarginLeft(w) += action_width;
(*xfeToolBarClassRec.xfe_dynamic_manager_class.layout_dynamic_children)(w);
/* Restore the left margin */
_XfemMarginLeft(w) -= action_width;
}
else
{
/* Add the action button's dimensions to the top margin */
_XfemMarginTop(w) += action_height;
(*xfeToolBarClassRec.xfe_dynamic_manager_class.layout_dynamic_children)(w);
/* Restore the top margin */
_XfemMarginTop(w) -= action_height;
}
}
/*----------------------------------------------------------------------*/
/*----------------------------------------------------------------------*/
/* */
/* Action Button callbacks */

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

@ -49,14 +49,15 @@ typedef struct
/*----------------------------------------------------------------------*/
typedef struct _XfeTaskBarClassRec
{
CoreClassPart core_class;
CompositeClassPart composite_class;
ConstraintClassPart constraint_class;
XmManagerClassPart manager_class;
XfeManagerClassPart xfe_manager_class;
XfeOrientedClassPart xfe_oriented_class;
XfeToolBarClassPart xfe_tool_bar_class;
XfeTaskBarClassPart xfe_task_bar_class;
CoreClassPart core_class;
CompositeClassPart composite_class;
ConstraintClassPart constraint_class;
XmManagerClassPart manager_class;
XfeManagerClassPart xfe_manager_class;
XfeDynamicManagerClassPart xfe_dynamic_manager_class;
XfeOrientedClassPart xfe_oriented_class;
XfeToolBarClassPart xfe_tool_bar_class;
XfeTaskBarClassPart xfe_task_bar_class;
} XfeTaskBarClassRec;
externalref XfeTaskBarClassRec xfeTaskBarClassRec;
@ -87,14 +88,15 @@ typedef struct _XfeTaskBarPart
/*----------------------------------------------------------------------*/
typedef struct _XfeTaskBarRec
{
CorePart core;
CompositePart composite;
ConstraintPart constraint;
XmManagerPart manager;
XfeManagerPart xfe_manager;
XfeToolBarPart xfe_tool_bar;
XfeOrientedPart xfe_oriented;
XfeTaskBarPart xfe_task_bar;
CorePart core;
CompositePart composite;
ConstraintPart constraint;
XmManagerPart manager;
XfeManagerPart xfe_manager;
XfeDynamicManagerPart xfe_dynamic_manager;
XfeToolBarPart xfe_tool_bar;
XfeOrientedPart xfe_oriented;
XfeTaskBarPart xfe_task_bar;
} XfeTaskBarRec;
/*----------------------------------------------------------------------*/

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

@ -64,15 +64,25 @@ static void ConstraintDestroy (Widget);
/* XfeManager class methods */
/* */
/*----------------------------------------------------------------------*/
static void PreferredGeometry (Widget,Dimension *,Dimension *);
static Boolean AcceptChild (Widget);
static Boolean InsertChild (Widget);
static Boolean DeleteChild (Widget);
static void ChangeManaged (Widget);
static void PrepareComponents (Widget,int);
static void LayoutComponents (Widget);
static void LayoutChildren (Widget);
static void DrawComponents (Widget,XEvent *,Region,XRectangle *);
static void PreferredGeometry (Widget,Dimension *,Dimension *);
static Boolean AcceptStaticChild (Widget);
static Boolean InsertStaticChild (Widget);
static Boolean DeleteStaticChild (Widget);
static void LayoutStaticChildren (Widget);
static void ChangeManaged (Widget);
static void PrepareComponents (Widget,int);
static void LayoutComponents (Widget);
static void DrawComponents (Widget,XEvent *,Region,XRectangle *);
/*----------------------------------------------------------------------*/
/* */
/* XfeDynamicManager class methods */
/* */
/*----------------------------------------------------------------------*/
static Boolean AcceptDynamicChild (Widget);
static Boolean InsertDynamicChild (Widget);
static Boolean DeleteDynamicChild (Widget);
static void LayoutDynamicChildren (Widget);
/*----------------------------------------------------------------------*/
/* */
@ -382,7 +392,7 @@ static XtActionsRec actions[] =
_XFE_WIDGET_CLASS_RECORD(temptwo,TempTwo) =
{
{
(WidgetClass) &xfeManagerClassRec, /* superclass */
(WidgetClass) &xfeDynamicManagerClassRec,/* superclass */
"XfeTempTwo", /* class_name */
sizeof(XfeTempTwoRec), /* widget_size */
NULL, /* class_initialize */
@ -446,26 +456,35 @@ _XFE_WIDGET_CLASS_RECORD(temptwo,TempTwo) =
XmInheritParentProcess, /* parent_process */
NULL, /* extension */
},
/* XfeManager Part */
{
XfeInheritBitGravity, /* bit_gravity */
PreferredGeometry, /* preferred_geometry */
XfeInheritUpdateBoundary, /* update_boundary */
XfeInheritUpdateChildrenInfo, /* update_children_info */
XfeInheritLayoutWidget, /* layout_widget */
AcceptStaticChild, /* accept_static_child */
InsertStaticChild, /* insert_static_child */
DeleteStaticChild, /* delete_static_child */
LayoutStaticChildren, /* layout_static_children */
ChangeManaged, /* change_managed */
PrepareComponents, /* prepare_components */
LayoutComponents, /* layout_components */
NULL, /* draw_background */
XfeInheritDrawShadow, /* draw_shadow */
DrawComponents, /* draw_components */
NULL, /* extension */
},
/* XfeDynamicManager Part */
{
XfeInheritBitGravity, /* bit_gravity */
PreferredGeometry, /* preferred_geometry */
XfeInheritMinimumGeometry, /* minimum_geometry */
XfeInheritUpdateRect, /* update_rect */
AcceptChild, /* accept_child */
InsertChild, /* insert_child */
DeleteChild, /* delete_child */
ChangeManaged, /* change_managed */
PrepareComponents, /* prepare_components */
LayoutComponents, /* layout_components */
LayoutChildren, /* layout_children */
NULL, /* draw_background */
XfeInheritDrawShadow, /* draw_shadow */
DrawComponents, /* draw_components */
False, /* count_layable_children*/
NULL, /* child_is_layable */
NULL, /* extension */
AcceptDynamicChild, /* accept_dynamic_child */
InsertDynamicChild, /* insert_dynamic_child */
DeleteDynamicChild, /* delete_dynamic_child */
LayoutDynamicChildren, /* layout_dynamic_children */
XfeInheritGetChildDimensions, /* get_child_dimensions */
NULL, /* extension */
},
/* XfeTempTwo Part */
@ -652,13 +671,13 @@ PreferredGeometry(Widget w,Dimension * width,Dimension * height)
}
/*----------------------------------------------------------------------*/
static Boolean
AcceptChild(Widget child)
AcceptStaticChild(Widget child)
{
return True;
}
/*----------------------------------------------------------------------*/
static Boolean
InsertChild(Widget child)
InsertStaticChild(Widget child)
{
Widget w = XtParent(child);
XfeTempTwoPart * ttp = _XfeTempTwoPart(w);
@ -667,7 +686,7 @@ InsertChild(Widget child)
}
/*----------------------------------------------------------------------*/
static Boolean
DeleteChild(Widget child)
DeleteStaticChild(Widget child)
{
Widget w = XtParent(child);
XfeTempTwoPart * ttp = _XfeTempTwoPart(w);
@ -682,6 +701,13 @@ ChangeManaged(Widget w)
}
/*----------------------------------------------------------------------*/
static void
LayoutStaticChildren(Widget w)
{
XfeTempTwoPart * ttp = _XfeTempTwoPart(w);
}
/*----------------------------------------------------------------------*/
static void
PrepareComponents(Widget w,int flags)
{
if (flags & _XFE_PREPARE_LABEL_STRING)
@ -694,13 +720,6 @@ LayoutComponents(Widget w)
{
XfeTempTwoPart * ttp = _XfeTempTwoPart(w);
}
/*----------------------------------------------------------------------*/
static void
LayoutChildren(Widget w)
{
XfeTempTwoPart * ttp = _XfeTempTwoPart(w);
}
/*----------------------------------------------------------------------*/
static void
@ -711,6 +730,43 @@ DrawComponents(Widget w,XEvent * event,Region region,XRectangle * clip_rect)
}
/*----------------------------------------------------------------------*/
/*----------------------------------------------------------------------*/
/* */
/* XfeDynamicManager class methods */
/* */
/*----------------------------------------------------------------------*/
static Boolean
AcceptDynamicChild(Widget child)
{
return True;
}
/*----------------------------------------------------------------------*/
static Boolean
InsertDynamicChild(Widget child)
{
Widget w = XtParent(child);
XfeTempTwoPart * ttp = _XfeTempTwoPart(w);
return True;
}
/*----------------------------------------------------------------------*/
static Boolean
DeleteDynamicChild(Widget child)
{
Widget w = XtParent(child);
XfeTempTwoPart * ttp = _XfeTempTwoPart(w);
return True;
}
/*----------------------------------------------------------------------*/
static void
LayoutDynamicChildren(Widget w)
{
XfeTempTwoPart * ttp = _XfeTempTwoPart(w);
}
/*----------------------------------------------------------------------*/
/*----------------------------------------------------------------------*/
/* */
/* XfeTempTwo class methods */

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

@ -27,7 +27,7 @@
#ifndef _XfeTempTwo_h_ /* start TempTwo.h */
#define _XfeTempTwo_h_
#include <Xfe/Manager.h>
#include <Xfe/DynamicManager.h>
XFE_BEGIN_CPLUSPLUS_PROTECTION

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

@ -28,7 +28,7 @@
#define _XfeTempTwoP_h_
#include <Xfe/TempTwo.h>
#include <Xfe/ManagerP.h>
#include <Xfe/DynamicManagerP.h>
XFE_BEGIN_CPLUSPLUS_PROTECTION
@ -56,6 +56,7 @@ typedef struct _XfeTempTwoClassRec
ConstraintClassPart constraint_class;
XmManagerClassPart manager_class;
XfeManagerClassPart xfe_manager_class;
XfeDynamicManagerClassPart xfe_dynamic_manager_class;
XfeTempTwoClassPart xfe_temp_two_class;
} XfeTempTwoClassRec;
@ -104,12 +105,13 @@ typedef struct _XfeTempTwoPart
/*----------------------------------------------------------------------*/
typedef struct _XfeTempTwoRec
{
CorePart core;
CompositePart composite;
ConstraintPart constraint;
XmManagerPart manager;
XfeManagerPart xfe_manager;
XfeTempTwoPart xfe_temp_two;
CorePart core;
CompositePart composite;
ConstraintPart constraint;
XmManagerPart manager;
XfeManagerPart xfe_manager;
XfeDynamicManagerPart xfe_dynamic_manager;
XfeTempTwoPart xfe_temp_two;
} XfeTempTwoRec;
/*----------------------------------------------------------------------*/
@ -132,9 +134,10 @@ typedef struct _XfeTempTwoConstraintPart
/*----------------------------------------------------------------------*/
typedef struct _XfeTempTwoConstraintRec
{
XmManagerConstraintPart manager;
XfeManagerConstraintPart xfe_manager;
XfeTempTwoConstraintPart xfe_temp_two;
XmManagerConstraintPart manager;
XfeManagerConstraintPart xfe_manager;
XfeDynamicManagerConstraintPart xfe_dynamic_manager;
XfeTempTwoConstraintPart xfe_temp_two;
} XfeTempTwoConstraintRec;
/*----------------------------------------------------------------------*/

Разница между файлами не показана из-за своего большого размера Загрузить разницу

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

@ -51,13 +51,14 @@ typedef struct
/*----------------------------------------------------------------------*/
typedef struct _XfeToolBarClassRec
{
CoreClassPart core_class;
CompositeClassPart composite_class;
ConstraintClassPart constraint_class;
XmManagerClassPart manager_class;
XfeManagerClassPart xfe_manager_class;
XfeOrientedClassPart xfe_oriented_class;
XfeToolBarClassPart xfe_tool_bar_class;
CoreClassPart core_class;
CompositeClassPart composite_class;
ConstraintClassPart constraint_class;
XmManagerClassPart manager_class;
XfeManagerClassPart xfe_manager_class;
XfeDynamicManagerClassPart xfe_dynamic_manager_class;
XfeOrientedClassPart xfe_oriented_class;
XfeToolBarClassPart xfe_tool_bar_class;
} XfeToolBarClassRec;
externalref XfeToolBarClassRec xfeToolBarClassRec;
@ -108,8 +109,10 @@ typedef struct _XfeToolBarPart
Boolean child_force_width; /* Child force width ? */
Boolean child_force_height; /* Child force height ? */
#if 0
Dimension max_child_width; /* Max Width */
Dimension max_child_height; /* Max Height */
#endif
/* Wrapping resources */
Boolean allow_wrap; /* Allow wrap */
@ -117,10 +120,13 @@ typedef struct _XfeToolBarPart
Cardinal max_num_rows; /* Max num rows */
/* Private data -- Dont even look past this comment -- */
#if 0
Dimension total_children_width; /* Total children width */
Dimension total_children_height; /* Total children height*/
Cardinal num_managed; /* Num managed widgets */
Cardinal num_components; /* Num components */
#endif
Widget indicator; /* Indicator */
Widget indicator_target; /* Indicator target */
Widget edit_text; /* Edit text */
@ -134,13 +140,14 @@ typedef struct _XfeToolBarPart
/*----------------------------------------------------------------------*/
typedef struct _XfeToolBarRec
{
CorePart core;
CompositePart composite;
ConstraintPart constraint;
XmManagerPart manager;
XfeManagerPart xfe_manager;
XfeOrientedPart xfe_oriented;
XfeToolBarPart xfe_tool_bar;
CorePart core;
CompositePart composite;
ConstraintPart constraint;
XmManagerPart manager;
XfeManagerPart xfe_manager;
XfeDynamicManagerPart xfe_dynamic_manager;
XfeOrientedPart xfe_oriented;
XfeToolBarPart xfe_tool_bar;
} XfeToolBarRec;
/*----------------------------------------------------------------------*/
@ -160,10 +167,11 @@ typedef struct _XfeToolBarConstraintPart
/*----------------------------------------------------------------------*/
typedef struct _XfeToolBarConstraintRec
{
XmManagerConstraintPart manager;
XfeManagerConstraintPart xfe_manager;
XfeOrientedConstraintPart xfe_oriented;
XfeToolBarConstraintPart xfe_tool_bar;
XmManagerConstraintPart manager;
XfeManagerConstraintPart xfe_manager;
XfeDynamicManagerConstraintPart xfe_dynamic_manager;
XfeOrientedConstraintPart xfe_oriented;
XfeToolBarConstraintPart xfe_tool_bar;
} XfeToolBarConstraintRec;
/*----------------------------------------------------------------------*/

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

@ -79,12 +79,17 @@ static Boolean ConstraintSetValues (Widget,Widget,Widget,ArgList,
/* */
/*----------------------------------------------------------------------*/
static void PreferredGeometry (Widget,Dimension *,Dimension *);
static void MinimumGeometry (Widget,Dimension *,Dimension *);
static void LayoutComponents (Widget);
static void LayoutChildren (Widget);
static Boolean AcceptChild (Widget);
static Boolean DeleteChild (Widget);
static Boolean InsertChild (Widget);
/*----------------------------------------------------------------------*/
/* */
/* XfeDynamicManager class methods */
/* */
/*----------------------------------------------------------------------*/
static Boolean AcceptDynamicChild (Widget);
static Boolean InsertDynamicChild (Widget);
static Boolean DeleteDynamicChild (Widget);
static void LayoutDynamicChildren (Widget);
/*----------------------------------------------------------------------*/
/* */
@ -560,7 +565,7 @@ static const XtResource constraint_resources[] =
_XFE_WIDGET_CLASS_RECORD(toolbox,ToolBox) =
{
{
(WidgetClass) &xfeManagerClassRec, /* superclass */
(WidgetClass) &xfeDynamicManagerClassRec,/* superclass */
"XfeToolBox", /* class_name */
sizeof(XfeToolBoxRec), /* widget_size */
NULL, /* class_initialize */
@ -596,7 +601,11 @@ _XFE_WIDGET_CLASS_RECORD(toolbox,ToolBox) =
/* Composite Part */
{
#if 1
_XfeLiberalGeometryManager, /* geometry_manager */
#else
XtInheritGeometryManager, /* geometry_manager */
#endif
XtInheritChangeManaged, /* change_managed */
XtInheritInsertChild, /* insert_child */
XtInheritDeleteChild, /* delete_child */
@ -625,26 +634,35 @@ _XFE_WIDGET_CLASS_RECORD(toolbox,ToolBox) =
NULL, /* extension */
},
/* XfeManager Part */
/* XfeManager Part */
{
XfeInheritBitGravity, /* bit_gravity */
PreferredGeometry, /* preferred_geometry */
MinimumGeometry, /* minimum_geometry */
XfeInheritUpdateRect, /* update_rect */
AcceptChild, /* accept_child */
InsertChild, /* insert_child */
DeleteChild, /* delete_child */
NULL, /* change_managed */
NULL, /* prepare_components */
LayoutComponents, /* layout_components */
LayoutChildren, /* layout_children */
NULL, /* draw_background */
XfeInheritDrawShadow, /* draw_shadow */
NULL, /* draw_components */
False, /* count_layable_children*/
NULL, /* child_is_layable */
NULL, /* extension */
},
XfeInheritBitGravity, /* bit_gravity */
PreferredGeometry, /* preferred_geometry */
XfeInheritUpdateBoundary, /* update_boundary */
XfeInheritUpdateChildrenInfo, /* update_children_info */
XfeInheritLayoutWidget, /* layout_widget */
NULL, /* accept_static_child */
NULL, /* insert_static_child */
NULL, /* delete_static_child */
NULL, /* layout_static_children */
NULL, /* change_managed */
NULL, /* prepare_components */
LayoutComponents, /* layout_components */
NULL, /* draw_background */
XfeInheritDrawShadow, /* draw_shadow */
NULL, /* draw_components */
NULL, /* extension */
},
/* XfeDynamicManager Part */
{
AcceptDynamicChild, /* accept_dynamic_child */
InsertDynamicChild, /* insert_dynamic_child */
DeleteDynamicChild, /* delete_dynamic_child */
LayoutDynamicChildren, /* layout_dynamic_children */
XfeInheritGetChildDimensions, /* get_child_dimensions */
NULL, /* extension */
},
/* XfeToolBox Part */
{
@ -836,13 +854,13 @@ ConstraintSetValues(Widget oc,Widget rc,Widget nc,ArgList args,Cardinal *nargs)
XfeToolBoxConstraintPart * ocp = _XfeToolBoxConstraintPart(oc);
/* position_index */
if (_XfeManagerPositionIndex(nc) != _XfeManagerPositionIndex(oc))
if (_XfeDynamicManagerPositionIndex(nc) != _XfeDynamicManagerPositionIndex(oc))
{
/* Make sure the new position index is within range */
if ((_XfeManagerPositionIndex(nc) < 0) ||
(_XfeManagerPositionIndex(nc) >= tp->item_count))
if ((_XfeDynamicManagerPositionIndex(nc) < 0) ||
(_XfeDynamicManagerPositionIndex(nc) >= tp->item_count))
{
_XfeManagerPositionIndex(nc) = _XfeManagerPositionIndex(oc);
_XfeDynamicManagerPositionIndex(nc) = _XfeDynamicManagerPositionIndex(oc);
_XfeArgWarning(w,MESSAGE5,XtName(nc));
}
@ -850,8 +868,8 @@ ConstraintSetValues(Widget oc,Widget rc,Widget nc,ArgList args,Cardinal *nargs)
{
/* Swap the items */
SwapItems(w,
_XfeManagerPositionIndex(nc),
_XfeManagerPositionIndex(oc));
_XfeDynamicManagerPositionIndex(nc),
_XfeDynamicManagerPositionIndex(oc));
/* UpdatePositionIndeces(w); */
@ -923,21 +941,12 @@ PreferredGeometry(Widget w,Dimension * width,Dimension * height)
}
/*----------------------------------------------------------------------*/
static void
MinimumGeometry(Widget w,Dimension * width,Dimension * height)
{
/* XfeToolBoxPart * tp = _XfeToolBoxPart(w); */
*width = _XfemOffsetLeft(w) + _XfemOffsetRight(w);
*height = _XfemOffsetTop(w) + _XfemOffsetBottom(w);
}
/*----------------------------------------------------------------------*/
static void
LayoutComponents(Widget w)
{
XfeToolBoxPart * tp = _XfeToolBoxPart(w);
Cardinal i;
int x = _XfemRectX(w);
int y = _XfemRectY(w);
int x = _XfemBoundaryX(w);
int y = _XfemBoundaryY(w);
/* if ((_XfeWidth(w) <= 10) || (_XfeHeight(w) <= 10)) */
/* { */
@ -956,7 +965,7 @@ LayoutComponents(Widget w)
{
_XfeConfigureWidget(tp->opened_tabs[i],
_XfemRectX(w),
_XfemBoundaryX(w),
y,
@ -999,62 +1008,24 @@ LayoutComponents(Widget w)
}
}
/*----------------------------------------------------------------------*/
static void
LayoutChildren(Widget w)
{
XfeToolBoxPart * tp = _XfeToolBoxPart(w);
Cardinal i;
int y = _XfemRectY(w);
for (i = 0; i < tp->item_count; i++)
{
Widget item = tp->items[i];
if (_XfeIsAlive(item))
{
/* Item is managed */
if (_XfeChildIsShown(item))
{
/* Open */
if (_XfeToolBoxChildOpen(item))
{
int width;
int height;
width = _XfemRectWidth(w) - _XfeWidth(tp->opened_tabs[i]);
height = _XfeHeight(item);
_XfeConfigureWidget(item,
_XfemRectX(w) +
_XfeWidth(tp->opened_tabs[i]),
y,
width,
height);
y += (_XfeHeight(item) + tp->vertical_spacing);
}
/* Closed */
else
{
_XfeMoveWidget(item,FAR_AWAY,FAR_AWAY);
}
}
}
}
}
/*----------------------------------------------------------------------*/
/* */
/* XfeDynamicManager class methods */
/* */
/*----------------------------------------------------------------------*/
static Boolean
AcceptChild(Widget child)
AcceptDynamicChild(Widget child)
{
Widget w = XtParent(child);
/* printf("AcceptDynamicChild(%s) for %s\n",XtName(w),XtName(child)); */
return True;
}
/*----------------------------------------------------------------------*/
static Boolean
InsertChild(Widget child)
InsertDynamicChild(Widget child)
{
Widget w = XtParent(child);
XfeToolBoxPart * tp = _XfeToolBoxPart(w);
@ -1062,7 +1033,7 @@ InsertChild(Widget child)
Widget closed_tab;
Cardinal index;
/* printf("InsertChild(%s) for %s\n",XtName(w),XtName(child)); */
/* printf("InsertDynamicChild(%s) for %s\n",XtName(w),XtName(child)); */
/* Increase the item count */
tp->item_count++;
@ -1125,7 +1096,7 @@ InsertChild(Widget child)
}
/*----------------------------------------------------------------------*/
static Boolean
DeleteChild(Widget child)
DeleteDynamicChild(Widget child)
{
Widget w = XtParent(child);
XfeToolBoxPart * tp = _XfeToolBoxPart(w);
@ -1148,6 +1119,54 @@ DeleteChild(Widget child)
return XtIsManaged(child);
}
/*----------------------------------------------------------------------*/
static void
LayoutDynamicChildren(Widget w)
{
XfeToolBoxPart * tp = _XfeToolBoxPart(w);
Cardinal i;
int y = _XfemBoundaryY(w);
for (i = 0; i < tp->item_count; i++)
{
Widget item = tp->items[i];
if (_XfeIsAlive(item))
{
/* Item is managed */
if (_XfeChildIsShown(item))
{
/* Open */
if (_XfeToolBoxChildOpen(item))
{
int width;
int height;
width = _XfemBoundaryWidth(w) - _XfeWidth(tp->opened_tabs[i]);
height = _XfeHeight(item);
_XfeConfigureWidget(item,
_XfemBoundaryX(w) +
_XfeWidth(tp->opened_tabs[i]),
y,
width,
height);
y += (_XfeHeight(item) + tp->vertical_spacing);
}
/* Closed */
else
{
_XfeMoveWidget(item,FAR_AWAY,FAR_AWAY);
}
}
}
}
}
/*----------------------------------------------------------------------*/
/*----------------------------------------------------------------------*/
/* */
@ -1163,7 +1182,7 @@ CreateTab(Widget w,Boolean opened)
Arg av[10];
Cardinal ac = 0;
XtSetArg(av[ac],XmNprivateComponent, True); ac++;
XtSetArg(av[ac],XmNmanagerChildType, XmMANAGER_COMPONENT_CHILD); ac++;
/* Opened - vertical */
if (opened)
@ -1532,7 +1551,7 @@ DragEnd(Widget item,XEvent * event,int y,int root_y)
}
LayoutComponents(w);
LayoutChildren(w);
LayoutDynamicChildren(w);
}
/*----------------------------------------------------------------------*/
static void
@ -1651,7 +1670,7 @@ DragMotion(Widget item,XEvent * event,int y,int root_y)
{
if (index == FirstManagedIndex(w))
{
empty_slot_y = _XfemRectY(w);
empty_slot_y = _XfemBoundaryY(w);
}
else
{
@ -1985,7 +2004,7 @@ SnapItemInPlace(Widget w,int index)
/* Check for the first item */
if (index == first_managed_index)
{
moved = MoveItem(w,index,_XfemRectY(w));
moved = MoveItem(w,index,_XfemBoundaryY(w));
}
/* Check for the last item */
else if (index == last_managed_index)
@ -2219,7 +2238,7 @@ UpdatePositionIndeces(Widget w)
{
if (_XfeIsAlive(tp->items[i]))
{
_XfeManagerPositionIndex(tp->items[i]) = index;
_XfeDynamicManagerPositionIndex(tp->items[i]) = index;
index++;
}
@ -2262,7 +2281,7 @@ UpdatePositionIndeces(Widget w)
assert( _XfeIsAlive(tp->items[i]) );
_XfeManagerPositionIndex(tp->items[i]) = i;
_XfeDynamicManagerPositionIndex(tp->items[i]) = i;
}
@ -2389,7 +2408,7 @@ XfeToolBoxItemSetPosition(Widget w,Widget item,int pos)
if ((tp->item_count < 2) ||
(pos < 0) ||
(pos >= tp->item_count) ||
(pos == _XfeManagerPositionIndex(item)))
(pos == _XfeDynamicManagerPositionIndex(item)))
{
return;
}
@ -2411,7 +2430,7 @@ XfeToolBoxItemSetPosition(Widget w,Widget item,int pos)
UpdatePositionIndeces(w);
LayoutComponents(w);
LayoutChildren(w);
LayoutDynamicChildren(w);
/* printf("Swap(%s = %d)\n",XtName(tp->items[pos]),pos); */
@ -2425,7 +2444,7 @@ XfeToolBoxItemGetPosition(Widget w,Widget item)
assert( _XfeIsAlive(w) );
assert( XfeIsToolBox(w) );
return _XfeManagerPositionIndex(item);
return _XfeDynamicManagerPositionIndex(item);
}
/*----------------------------------------------------------------------*/

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

@ -27,7 +27,7 @@
#ifndef _XfeToolBox_h_ /* start ToolBox.h */
#define _XfeToolBox_h_
#include <Xfe/Manager.h>
#include <Xfe/DynamicManager.h>
XFE_BEGIN_CPLUSPLUS_PROTECTION

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

@ -28,7 +28,7 @@
#define _XfeToolBoxP_h_
#include <Xfe/ToolBox.h>
#include <Xfe/ManagerP.h>
#include <Xfe/DynamicManagerP.h>
XFE_BEGIN_CPLUSPLUS_PROTECTION
@ -54,6 +54,7 @@ typedef struct _XfeToolBoxClassRec
ConstraintClassPart constraint_class;
XmManagerClassPart manager_class;
XfeManagerClassPart xfe_manager_class;
XfeDynamicManagerClassPart xfe_dynamic_manager_class;
XfeToolBoxClassPart xfe_tool_box_class;
} XfeToolBoxClassRec;
@ -135,12 +136,13 @@ typedef struct _XfeToolBoxPart
/*----------------------------------------------------------------------*/
typedef struct _XfeToolBoxRec
{
CorePart core;
CompositePart composite;
ConstraintPart constraint;
XmManagerPart manager;
XfeManagerPart xfe_manager;
XfeToolBoxPart xfe_tool_box;
CorePart core;
CompositePart composite;
ConstraintPart constraint;
XmManagerPart manager;
XfeManagerPart xfe_manager;
XfeDynamicManagerPart xfe_dynamic_manager;
XfeToolBoxPart xfe_tool_box;
} XfeToolBoxRec;
/*----------------------------------------------------------------------*/
@ -160,9 +162,10 @@ typedef struct _XfeToolBoxConstraintPart
/*----------------------------------------------------------------------*/
typedef struct _XfeToolBoxConstraintRec
{
XmManagerConstraintPart manager;
XfeManagerConstraintPart xfe_manager;
XfeToolBoxConstraintPart xfe_tool_box;
XmManagerConstraintPart manager;
XfeManagerConstraintPart xfe_manager;
XfeDynamicManagerConstraintPart xfe_dynamic_manager;
XfeToolBoxConstraintPart xfe_tool_box;
} XfeToolBoxConstraintRec;
/*----------------------------------------------------------------------*/

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

@ -49,11 +49,11 @@ static Boolean SetValues (Widget,Widget,Widget,ArgList,Cardinal *);
/* XfeManager class methods */
/* */
/*----------------------------------------------------------------------*/
static void PreferredGeometry (Widget,Dimension *,Dimension *);
static void LayoutComponents (Widget);
static Boolean AcceptChild (Widget);
static Boolean DeleteChild (Widget);
static Boolean InsertChild (Widget);
static void PreferredGeometry (Widget,Dimension *,Dimension *);
static Boolean AcceptStaticChild (Widget);
static Boolean InsertStaticChild (Widget);
static Boolean DeleteStaticChild (Widget);
static void LayoutStaticChildren (Widget);
/*----------------------------------------------------------------------*/
/* */
@ -181,26 +181,25 @@ _XFE_WIDGET_CLASS_RECORD(toolitem,ToolItem) =
NULL, /* extension */
},
/* XfeManager Part */
/* XfeManager Part */
{
XfeInheritBitGravity, /* bit_gravity */
PreferredGeometry, /* preferred_geometry */
XfeInheritMinimumGeometry, /* minimum_geometry */
XfeInheritUpdateRect, /* update_rect */
AcceptChild, /* accept_child */
InsertChild, /* insert_child */
DeleteChild, /* delete_child */
NULL, /* change_managed */
NULL, /* prepare_components */
LayoutComponents, /* layout_components */
NULL, /* layout_children */
NULL, /* draw_background */
XfeInheritDrawShadow, /* draw_shadow */
NULL, /* draw_components */
False, /* count_layable_children*/
NULL, /* child_is_layable */
NULL, /* extension */
},
XfeInheritBitGravity, /* bit_gravity */
PreferredGeometry, /* preferred_geometry */
XfeInheritUpdateBoundary, /* update_boundary */
XfeInheritUpdateChildrenInfo, /* update_children_info */
XfeInheritLayoutWidget, /* layout_widget */
AcceptStaticChild, /* accept_static_child */
InsertStaticChild, /* insert_static_child */
DeleteStaticChild, /* delete_static_child */
LayoutStaticChildren, /* layout_static_children */
NULL, /* change_managed */
NULL, /* prepare_components */
NULL, /* layout_components */
NULL, /* draw_background */
XfeInheritDrawShadow, /* draw_shadow */
NULL, /* draw_components */
NULL, /* extension */
},
/* XfeToolItem Part */
{
@ -286,8 +285,69 @@ PreferredGeometry(Widget w,Dimension * width,Dimension * height)
}
}
/*----------------------------------------------------------------------*/
static Boolean
AcceptStaticChild(Widget child)
{
Widget w = XtParent(child);
XfeToolItemPart * tp = _XfeToolItemPart(w);
Boolean accept = False;
/* logo */
if (XfeIsLogo(child))
{
accept = !tp->logo;
}
/* Item */
else
{
accept = !tp->item;
}
return accept;
}
/*----------------------------------------------------------------------*/
static Boolean
InsertStaticChild(Widget child)
{
Widget w = XtParent(child);
XfeToolItemPart * tp = _XfeToolItemPart(w);
/* Logo for logo */
if (XfeIsLogo(child))
{
tp->logo = child;
}
/* Item */
else
{
tp->item = child;
}
return True;
}
/*----------------------------------------------------------------------*/
static Boolean
DeleteStaticChild(Widget child)
{
Widget w = XtParent(child);
XfeToolItemPart * tp = _XfeToolItemPart(w);
/* Logo */
if (child == tp->logo)
{
tp->logo = NULL;
}
/* Item */
else if (child == tp->item)
{
tp->item = NULL;
}
return True;
}
/*----------------------------------------------------------------------*/
static void
LayoutComponents(Widget w)
LayoutStaticChildren(Widget w)
{
XfeToolItemPart * tp = _XfeToolItemPart(w);
@ -311,7 +371,7 @@ LayoutComponents(Widget w)
/* Configure the tool bar */
if (_XfeChildIsShown(tp->item))
{
Dimension width = _XfemRectWidth(w);
Dimension width = _XfemBoundaryWidth(w);
if (_XfeChildIsShown(tp->logo))
{
@ -331,67 +391,6 @@ LayoutComponents(Widget w)
}
}
/*----------------------------------------------------------------------*/
static Boolean
AcceptChild(Widget child)
{
Widget w = XtParent(child);
XfeToolItemPart * tp = _XfeToolItemPart(w);
Boolean accept = False;
/* logo */
if (XfeIsLogo(child))
{
accept = !tp->logo;
}
/* Item */
else
{
accept = !tp->item;
}
return accept;
}
/*----------------------------------------------------------------------*/
static Boolean
InsertChild(Widget child)
{
Widget w = XtParent(child);
XfeToolItemPart * tp = _XfeToolItemPart(w);
/* Logo for logo */
if (XfeIsLogo(child))
{
tp->logo = child;
}
/* Item */
else
{
tp->item = child;
}
return True;
}
/*----------------------------------------------------------------------*/
static Boolean
DeleteChild(Widget child)
{
Widget w = XtParent(child);
XfeToolItemPart * tp = _XfeToolItemPart(w);
/* Logo */
if (child == tp->logo)
{
tp->logo = NULL;
}
/* Item */
else if (child == tp->item)
{
tp->item = NULL;
}
return True;
}
/*----------------------------------------------------------------------*/
/*----------------------------------------------------------------------*/
/* */

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

@ -56,12 +56,13 @@ static Boolean SetValues (Widget,Widget,Widget,ArgList,Cardinal *);
/* XfeManager class methods */
/* */
/*----------------------------------------------------------------------*/
static void PreferredGeometry (Widget,Dimension *,Dimension *);
static void DrawComponents (Widget,XEvent *,Region,XRectangle *);
static void LayoutComponents (Widget);
static Boolean AcceptChild (Widget);
static Boolean DeleteChild (Widget);
static Boolean InsertChild (Widget);
static void PreferredGeometry (Widget,Dimension *,Dimension *);
static Boolean AcceptStaticChild (Widget);
static Boolean InsertStaticChild (Widget);
static Boolean DeleteStaticChild (Widget);
static void LayoutStaticChildren (Widget);
static void LayoutComponents (Widget);
static void DrawComponents (Widget,XEvent *,Region,XRectangle *);
/*----------------------------------------------------------------------*/
/* */
@ -295,26 +296,34 @@ _XFE_WIDGET_CLASS_RECORD(toolscroll,ToolScroll) =
NULL, /* extension */
},
/* XfeManager Part */
/* XfeManager Part */
{
XfeInheritBitGravity, /* bit_gravity */
PreferredGeometry, /* preferred_geometry */
XfeInheritMinimumGeometry, /* minimum_geometry */
XfeInheritUpdateRect, /* update_rect */
AcceptChild, /* accept_child */
InsertChild, /* insert_child */
DeleteChild, /* delete_child */
NULL, /* change_managed */
NULL, /* prepare_components */
LayoutComponents, /* layout_components */
NULL, /* layout_children */
NULL, /* draw_background */
XfeInheritDrawShadow, /* draw_shadow */
DrawComponents, /* draw_components */
False, /* count_layable_children*/
NULL, /* child_is_layable */
NULL, /* extension */
},
XfeInheritBitGravity, /* bit_gravity */
PreferredGeometry, /* preferred_geometry */
XfeInheritUpdateBoundary, /* update_boundary */
XfeInheritUpdateChildrenInfo, /* update_children_info */
XfeInheritLayoutWidget, /* layout_widget */
AcceptStaticChild, /* accept_static_child */
InsertStaticChild, /* insert_static_child */
DeleteStaticChild, /* delete_static_child */
LayoutStaticChildren, /* layout_static_children */
NULL, /* change_managed */
NULL, /* prepare_components */
LayoutComponents, /* layout_components */
NULL, /* draw_background */
XfeInheritDrawShadow, /* draw_shadow */
DrawComponents, /* draw_components */
NULL, /* extension */
},
/* XfeDynamicManager Part */
{
NULL, /* accept_dynamic_child */
NULL, /* insert_dynamic_child */
NULL, /* delete_dynamic_child */
NULL, /* layout_dynamic_children */
NULL, /* extension */
},
/* XfeOriented Part */
{
@ -527,21 +536,33 @@ PreferredGeometry(Widget w,Dimension * width,Dimension * height)
}
}
/*----------------------------------------------------------------------*/
static void
DrawComponents(Widget w,XEvent * event,Region region,XRectangle * clip_rect)
static Boolean
AcceptStaticChild(Widget child)
{
XfeToolScrollPart * tp = _XfeToolScrollPart(w);
return False;
}
/*----------------------------------------------------------------------*/
static Boolean
InsertStaticChild(Widget child)
{
Widget w = XtParent(child);
/* XfeToolScrollPart * tp = _XfeToolScrollPart(w); */
if (tp->clip_shadow_thickness > 0)
{
XfeDrawShadowsAroundWidget(w,
tp->clip_area,
_XfemTopShadowGC(w),
_XfemBottomShadowGC(w),
_XfeOrientedSpacing(w),
tp->clip_shadow_thickness,
tp->clip_shadow_type);
}
return True;
}
/*----------------------------------------------------------------------*/
static Boolean
DeleteStaticChild(Widget child)
{
Widget w = XtParent(child);
/* XfeToolScrollPart * tp = _XfeToolScrollPart(w); */
return True;
}
/*----------------------------------------------------------------------*/
static void
LayoutStaticChildren(Widget w)
{
}
/*----------------------------------------------------------------------*/
static void
@ -562,28 +583,21 @@ LayoutComponents(Widget w)
LayoutToolBar(w);
}
/*----------------------------------------------------------------------*/
static Boolean
AcceptChild(Widget child)
static void
DrawComponents(Widget w,XEvent * event,Region region,XRectangle * clip_rect)
{
return False;
}
/*----------------------------------------------------------------------*/
static Boolean
InsertChild(Widget child)
{
Widget w = XtParent(child);
/* XfeToolScrollPart * tp = _XfeToolScrollPart(w); */
XfeToolScrollPart * tp = _XfeToolScrollPart(w);
return True;
}
/*----------------------------------------------------------------------*/
static Boolean
DeleteChild(Widget child)
{
Widget w = XtParent(child);
/* XfeToolScrollPart * tp = _XfeToolScrollPart(w); */
return True;
if (tp->clip_shadow_thickness > 0)
{
XfeDrawShadowsAroundWidget(w,
tp->clip_area,
_XfemTopShadowGC(w),
_XfemBottomShadowGC(w),
_XfeOrientedSpacing(w),
tp->clip_shadow_thickness,
tp->clip_shadow_type);
}
}
/*----------------------------------------------------------------------*/
@ -721,8 +735,8 @@ static void
LayoutVertical(Widget w)
{
XfeToolScrollPart * tp = _XfeToolScrollPart(w);
int backward_width = _XfemRectWidth(w) / 2;
int forward_width = _XfemRectWidth(w) - backward_width;
int backward_width = _XfemBoundaryWidth(w) / 2;
int forward_width = _XfemBoundaryWidth(w) - backward_width;
/* The backward arrow */
@ -731,8 +745,8 @@ LayoutVertical(Widget w)
XtVaSetValues(tp->backward_arrow,XmNarrowDirection,XmARROW_DOWN,NULL);
_XfeConfigureWidget(tp->backward_arrow,
_XfemRectX(w),
_XfemRectY(w),
_XfemBoundaryX(w),
_XfemBoundaryY(w),
backward_width,
_XfeHeight(tp->backward_arrow));
}
@ -747,7 +761,7 @@ LayoutVertical(Widget w)
_XfeX(tp->backward_arrow) +
_XfeWidth(tp->backward_arrow),
_XfemRectY(w),
_XfemBoundaryY(w),
forward_width,
@ -758,7 +772,7 @@ LayoutVertical(Widget w)
{
_XfeConfigureWidget(tp->clip_area,
_XfemRectX(w) +
_XfemBoundaryX(w) +
tp->clip_shadow_thickness +
_XfeOrientedSpacing(w),
@ -767,11 +781,11 @@ LayoutVertical(Widget w)
tp->clip_shadow_thickness +
_XfeOrientedSpacing(w),
_XfemRectWidth(w) -
_XfemBoundaryWidth(w) -
2 * tp->clip_shadow_thickness -
2 * _XfeOrientedSpacing(w),
_XfemRectHeight(w) -
_XfemBoundaryHeight(w) -
_XfeHeight(tp->backward_arrow) -
2 * tp->clip_shadow_thickness -
2 * _XfeOrientedSpacing(w));
@ -783,8 +797,8 @@ static void
LayoutHorizontal(Widget w)
{
XfeToolScrollPart * tp = _XfeToolScrollPart(w);
int backward_height = _XfemRectHeight(w) / 2;
int forward_height = _XfemRectHeight(w) - backward_height;
int backward_height = _XfemBoundaryHeight(w) / 2;
int forward_height = _XfemBoundaryHeight(w) - backward_height;
/* The backward arrow */
if (backward_height > 1)
@ -792,8 +806,8 @@ LayoutHorizontal(Widget w)
XtVaSetValues(tp->backward_arrow,XmNarrowDirection,XmARROW_LEFT,NULL);
_XfeConfigureWidget(tp->backward_arrow,
_XfemRectX(w),
_XfemRectY(w),
_XfemBoundaryX(w),
_XfemBoundaryY(w),
_XfeWidth(tp->backward_arrow),
backward_height);
}
@ -805,7 +819,7 @@ LayoutHorizontal(Widget w)
_XfeConfigureWidget(tp->forward_arrow,
_XfemRectX(w),
_XfemBoundaryX(w),
_XfeY(tp->backward_arrow) +
_XfeHeight(tp->backward_arrow),
@ -824,16 +838,16 @@ LayoutHorizontal(Widget w)
tp->clip_shadow_thickness +
_XfeOrientedSpacing(w),
_XfemRectY(w) +
_XfemBoundaryY(w) +
tp->clip_shadow_thickness +
_XfeOrientedSpacing(w),
_XfemRectWidth(w) -
_XfemBoundaryWidth(w) -
_XfeWidth(tp->backward_arrow) -
2 * tp->clip_shadow_thickness -
2 * _XfeOrientedSpacing(w),
_XfemRectHeight(w) -
_XfemBoundaryHeight(w) -
2 * tp->clip_shadow_thickness -
2 * _XfeOrientedSpacing(w));
}

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

@ -54,6 +54,7 @@ typedef struct _XfeToolScrollClassRec
ConstraintClassPart constraint_class;
XmManagerClassPart manager_class;
XfeManagerClassPart xfe_manager_class;
XfeDynamicManagerClassPart xfe_dynamic_manager_class;
XfeOrientedClassPart xfe_oriented_class;
XfeToolScrollClassPart xfe_tool_scroll_class;
} XfeToolScrollClassRec;
@ -90,13 +91,14 @@ typedef struct _XfeToolScrollPart
/*----------------------------------------------------------------------*/
typedef struct _XfeToolScrollRec
{
CorePart core;
CompositePart composite;
ConstraintPart constraint;
XmManagerPart manager;
XfeManagerPart xfe_manager;
XfeOrientedPart xfe_oriented;
XfeToolScrollPart xfe_tool_scroll;
CorePart core;
CompositePart composite;
ConstraintPart constraint;
XmManagerPart manager;
XfeManagerPart xfe_manager;
XfeDynamicManagerPart xfe_dynamic_manager;
XfeOrientedPart xfe_oriented;
XfeToolScrollPart xfe_tool_scroll;
} XfeToolScrollRec;
/*----------------------------------------------------------------------*/

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

@ -690,7 +690,7 @@ XfeToggleButtonIsSet(Widget w)
XfeIsPrivateComponent(Widget w)
{
return (XfeIsManager(_XfeParent(w)) &&
_XfeManagerPrivateComponent(w));
_XfeConstraintManagerChildType(w) == XmMANAGER_COMPONENT_CHILD);
}
/*----------------------------------------------------------------------*/

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

@ -27,8 +27,6 @@
#ifndef _XfeXfeP_h_ /* start XfeP.h */
#define _XfeXfeP_h_
/* XFE_BEGIN_CPLUSPLUS_PROTECTION */
#include <Xm/XmP.h>
#include <Xm/DrawP.h>
#include <Xfe/Xfe.h>
@ -110,14 +108,14 @@ typedef int XfeBitGravityType;
/* Widget method inheritance macros */
/* */
/*----------------------------------------------------------------------*/
#define XfeInheritAcceptChild ((XfeChildFunc) _XtInherit)
#define XfeInheritAcceptDynamicChild ((XfeChildFunc) _XtInherit)
#define XfeInheritAcceptStaticChild ((XfeChildFunc) _XtInherit)
#define XfeInheritArmTimeout ((XtTimerCallbackProc) _XtInherit)
#define XfeInheritBitGravity ((XfeBitGravityType) _XtInherit)
#define XfeInheritChangeManaged ((XtWidgetProc) _XtInherit)
#define XfeInheritChildIsLayable ((XfeChildFunc) _XtInherit)
#define XfeInheritClickTimeout ((XtTimerCallbackProc) _XtInherit)
#define XfeInheritCountLayableChildren ((Boolean) _XtInherit)
#define XfeInheritDeleteChild ((XfeChildFunc) _XtInherit)
#define XfeInheritDeleteDynamicChild ((XfeChildFunc) _XtInherit)
#define XfeInheritDeleteStaticChild ((XfeChildFunc) _XtInherit)
#define XfeInheritDescendantDragEnd ((XfeOrientedProc) _XtInherit)
#define XfeInheritDescendantDragMotion ((XfeOrientedProc) _XtInherit)
#define XfeInheritDescendantDragStart ((XfeOrientedProc) _XtInherit)
@ -139,23 +137,27 @@ typedef int XfeBitGravityType;
#define XfeInheritDrawUnderline ((XfeExposeProc) _XtInherit)
#define XfeInheritEnter ((XfeOrientedProc) _XtInherit)
#define XfeInheritGetBackgroundGC ((XfeGetGCFunc) _XtInherit)
#define XfeInheritGetChildDimensions ((XfeGeometryProc) _XtInherit)
#define XfeInheritGetLabelGC ((XfeGetGCFunc) _XtInherit)
#define XfeInheritGetPixmapGC ((XfeGetGCFunc) _XtInherit)
#define XfeInheritGetSelectionGC ((XfeGetGCFunc) _XtInherit)
#define XfeInheritInsertChild ((XfeChildFunc) _XtInherit)
#define XfeInheritInsertDynamicChild ((XfeChildFunc) _XtInherit)
#define XfeInheritInsertStaticChild ((XfeChildFunc) _XtInherit)
#define XfeInheritLayoutArrow ((XtWidgetProc) _XtInherit)
#define XfeInheritLayoutChildren ((XtWidgetProc) _XtInherit)
#define XfeInheritLayoutComponents ((XtWidgetProc) _XtInherit)
#define XfeInheritLayoutDynamicChildren ((XtWidgetProc) _XtInherit)
#define XfeInheritLayoutIndicator ((XtWidgetProc) _XtInherit)
#define XfeInheritLayoutPixmap ((XtWidgetProc) _XtInherit)
#define XfeInheritLayoutStaticChildren ((XtWidgetProc) _XtInherit)
#define XfeInheritLayoutString ((XtWidgetProc) _XtInherit)
#define XfeInheritLayoutTitle ((XtWidgetProc) _XtInherit)
#define XfeInheritLayoutWidget ((XtWidgetProc) _XtInherit)
#define XfeInheritLeave ((XfeOrientedProc) _XtInherit)
#define XfeInheritMinimumGeometry ((XfeGeometryProc) _XtInherit)
#define XfeInheritMotion ((XfeOrientedProc) _XtInherit)
#define XfeInheritPreferredGeometry ((XfeGeometryProc) _XtInherit)
#define XfeInheritToggleSelection ((XtWidgetProc) _XtInherit)
#define XfeInheritUpdateRect ((XtWidgetProc) _XtInherit)
#define XfeInheritUpdateBoundary ((XtWidgetProc) _XtInherit)
#define XfeInheritUpdateChildrenInfo ((XtWidgetProc) _XtInherit)
/*----------------------------------------------------------------------*/
/* */

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

@ -55,14 +55,12 @@ static void GetValuesHook (Widget,ArgList,Cardinal *);
/* XfeManager class methods */
/* */
/*----------------------------------------------------------------------*/
static void PreferredGeometry (Widget,Dimension *,Dimension *);
static Boolean AcceptChild (Widget);
static Boolean InsertChild (Widget);
static Boolean DeleteChild (Widget);
static void ChangeManaged (Widget);
static void PrepareComponents (Widget,int);
static void LayoutComponents (Widget);
static void DrawComponents (Widget,XEvent *,Region,XRectangle *);
static void PreferredGeometry (Widget,Dimension *,Dimension *);
static Boolean AcceptStaticChild (Widget);
static Boolean InsertStaticChild (Widget);
static Boolean DeleteStaticChild (Widget);
static void LayoutStaticChildren (Widget);
static void DrawComponents (Widget,XEvent *,Region,XRectangle *);
/*----------------------------------------------------------------------*/
/* */
@ -372,24 +370,23 @@ _XFE_WIDGET_CLASS_RECORD(caption,Caption) =
},
/* XfeManager Part */
{
XfeInheritBitGravity, /* bit_gravity */
PreferredGeometry, /* preferred_geometry */
XfeInheritMinimumGeometry, /* minimum_geometry */
XfeInheritUpdateRect, /* update_rect */
AcceptChild, /* accept_child */
InsertChild, /* insert_child */
DeleteChild, /* delete_child */
ChangeManaged, /* change_managed */
PrepareComponents, /* prepare_components */
LayoutComponents, /* layout_components */
NULL, /* layout_children */
NULL, /* draw_background */
XfeInheritDrawShadow, /* draw_shadow */
DrawComponents, /* draw_components */
False, /* count_layable_children*/
NULL, /* child_is_layable */
NULL, /* extension */
{
XfeInheritBitGravity, /* bit_gravity */
PreferredGeometry, /* preferred_geometry */
XfeInheritUpdateBoundary, /* update_boundary */
XfeInheritUpdateChildrenInfo, /* update_children_info */
XfeInheritLayoutWidget, /* layout_widget */
AcceptStaticChild, /* accept_static_child */
InsertStaticChild, /* insert_static_child */
DeleteStaticChild, /* delete_static_child */
LayoutStaticChildren, /* layout_static_children */
NULL, /* change_managed */
NULL, /* prepare_components */
NULL, /* layout_components */
NULL, /* draw_background */
XfeInheritDrawShadow, /* draw_shadow */
DrawComponents, /* draw_components */
NULL, /* extension */
},
/* XfeCaption Part */
@ -556,13 +553,13 @@ PreferredGeometry(Widget w,Dimension * width,Dimension * height)
}
/*----------------------------------------------------------------------*/
static Boolean
AcceptChild(Widget child)
AcceptStaticChild(Widget child)
{
return True;
}
/*----------------------------------------------------------------------*/
static Boolean
InsertChild(Widget child)
InsertStaticChild(Widget child)
{
/* Widget w = XtParent(child); */
/* XfeCaptionPart * pp = _XfeCaptionPart(w); */
@ -571,7 +568,7 @@ InsertChild(Widget child)
}
/*----------------------------------------------------------------------*/
static Boolean
DeleteChild(Widget child)
DeleteStaticChild(Widget child)
{
/* Widget w = XtParent(child); */
/* XfeCaptionPart * pp = _XfeCaptionPart(w); */
@ -580,23 +577,7 @@ DeleteChild(Widget child)
}
/*----------------------------------------------------------------------*/
static void
ChangeManaged(Widget w)
{
/* XfeCaptionPart * pp = _XfeCaptionPart(w); */
}
/*----------------------------------------------------------------------*/
static void
PrepareComponents(Widget w,int flags)
{
/* XfeCaptionPart * pp = _XfeCaptionPart(w); */
/* if (flags & _XFE_PREPARE_CLOSE_PIXMAP_MASK) */
/* { */
/* } */
}
/*----------------------------------------------------------------------*/
static void
LayoutComponents(Widget w)
LayoutStaticChildren(Widget w)
{
XfeCaptionPart * pp = _XfeCaptionPart(w);
@ -754,7 +735,7 @@ LayoutChildOnRight(Widget w)
if (pp->child_resize)
{
child_width =
_XfemRectWidth(w) -
_XfemBoundaryWidth(w) -
_XfeWidth(pp->title) -
pp->spacing;
@ -969,13 +950,13 @@ XfeCaptionMaxChildWidth(Widget w)
if (pp->caption_layout == XmCAPTION_CHILD_ON_BOTTOM ||
pp->caption_layout == XmCAPTION_CHILD_ON_TOP)
{
max_child_width = _XfemRectWidth(w);
max_child_width = _XfemBoundaryWidth(w);
}
else if (pp->caption_layout == XmCAPTION_CHILD_ON_LEFT ||
pp->caption_layout == XmCAPTION_CHILD_ON_RIGHT)
{
max_child_width =
_XfemRectWidth(w) -
_XfemBoundaryWidth(w) -
_XfeWidth(pp->title) -
pp->spacing;
}
@ -988,7 +969,7 @@ XfeCaptionMaxChildWidth(Widget w)
/* Child only */
else if (_XfeChildIsShown(pp->child))
{
max_child_width = _XfemRectWidth(w);
max_child_width = _XfemBoundaryWidth(w);
}
return max_child_width;

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

@ -108,12 +108,12 @@ typedef struct _XfeCaptionPart
/*----------------------------------------------------------------------*/
typedef struct _XfeCaptionRec
{
CorePart core;
CompositePart composite;
ConstraintPart constraint;
XmManagerPart manager;
XfeManagerPart xfe_manager;
XfeCaptionPart xfe_caption;
CorePart core;
CompositePart composite;
ConstraintPart constraint;
XmManagerPart manager;
XfeManagerPart xfe_manager;
XfeCaptionPart xfe_caption;
} XfeCaptionRec;
/*----------------------------------------------------------------------*/

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

@ -189,24 +189,23 @@ _XFE_WIDGET_CLASS_RECORD(textcaption,TextCaption) =
},
/* XfeManager Part */
{
XfeInheritBitGravity, /* bit_gravity */
XfeInheritPreferredGeometry, /* preferred_geometry */
XfeInheritMinimumGeometry, /* minimum_geometry */
XfeInheritUpdateRect, /* update_rect */
XfeInheritAcceptChild, /* accept_child */
XfeInheritInsertChild, /* insert_child */
XfeInheritDeleteChild, /* delete_child */
NULL, /* change_managed */
NULL, /* prepare_components */
XfeInheritLayoutComponents, /* layout_components */
NULL, /* layout_children */
NULL, /* draw_background */
XfeInheritDrawShadow, /* draw_shadow */
XfeInheritDrawComponents, /* draw_components */
False, /* count_layable_children*/
NULL, /* child_is_layable */
NULL, /* extension */
{
XfeInheritBitGravity, /* bit_gravity */
XfeInheritPreferredGeometry, /* preferred_geometry */
XfeInheritUpdateBoundary, /* update_boundary */
XfeInheritUpdateChildrenInfo, /* update_children_info */
XfeInheritLayoutWidget, /* layout_widget */
XfeInheritAcceptStaticChild, /* accept_static_child */
XfeInheritInsertStaticChild, /* insert_static_child */
XfeInheritDeleteStaticChild, /* delete_static_child */
XfeInheritLayoutStaticChildren, /* layout_static_children */
NULL, /* change_managed */
NULL, /* prepare_components */
NULL, /* layout_components */
NULL, /* draw_background */
XfeInheritDrawShadow, /* draw_shadow */
XfeInheritDrawComponents, /* draw_components */
NULL, /* extension */
},
/* XfeCaption Part */

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

@ -81,13 +81,13 @@ typedef struct _XfeTextCaptionPart
/*----------------------------------------------------------------------*/
typedef struct _XfeTextCaptionRec
{
CorePart core;
CompositePart composite;
ConstraintPart constraint;
XmManagerPart manager;
XfeManagerPart xfe_manager;
XfeCaptionPart xfe_caption;
XfeTextCaptionPart xfe_text_caption;
CorePart core;
CompositePart composite;
ConstraintPart constraint;
XmManagerPart manager;
XfeManagerPart xfe_manager;
XfeCaptionPart xfe_caption;
XfeTextCaptionPart xfe_text_caption;
} XfeTextCaptionRec;
/*----------------------------------------------------------------------*/

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

@ -57,10 +57,10 @@
#define CB_OFFSET_RIGHT(w,cp) (cp->highlight_thickness+_XfemOffsetRight(w))
#define CB_OFFSET_TOP(w,cp) (cp->highlight_thickness+_XfemOffsetTop(w))
#define CB_RECT_X(w,cp) (_XfemRectX(w) + cp->highlight_thickness)
#define CB_RECT_Y(w,cp) (_XfemRectY(w) + cp->highlight_thickness)
#define CB_RECT_WIDTH(w,cp) (_XfemRectWidth(w)-2*cp->highlight_thickness)
#define CB_RECT_HEIGHT(w,cp) (_XfemRectHeight(w)-2*cp->highlight_thickness)
#define CB_RECT_X(w,cp) (_XfemBoundaryX(w) + cp->highlight_thickness)
#define CB_RECT_Y(w,cp) (_XfemBoundaryY(w) + cp->highlight_thickness)
#define CB_RECT_WIDTH(w,cp) (_XfemBoundaryWidth(w)-2*cp->highlight_thickness)
#define CB_RECT_HEIGHT(w,cp) (_XfemBoundaryHeight(w)-2*cp->highlight_thickness)
#define STICK_DELAY 200
@ -82,7 +82,7 @@ static void GetValuesHook (Widget,ArgList,Cardinal *);
/* */
/*----------------------------------------------------------------------*/
static void PreferredGeometry (Widget,Dimension *,Dimension *);
static Boolean AcceptChild (Widget);
static Boolean AcceptStaticChild (Widget);
static void LayoutComponents (Widget);
static void DrawShadow (Widget,XEvent *,Region,XRectangle *);
static void DrawComponents (Widget,XEvent *,Region,XRectangle *);
@ -599,24 +599,23 @@ _XFE_WIDGET_CLASS_RECORD(combobox,ComboBox) =
},
/* XfeManager Part */
{
XfeInheritBitGravity, /* bit_gravity */
PreferredGeometry, /* preferred_geometry */
XfeInheritMinimumGeometry, /* minimum_geometry */
XfeInheritUpdateRect, /* update_rect */
AcceptChild, /* accept_child */
NULL, /* insert_child */
NULL, /* delete_child */
NULL, /* change_managed */
NULL, /* prepare_components */
LayoutComponents, /* layout_components */
NULL, /* layout_children */
NULL, /* draw_background */
DrawShadow, /* draw_shadow */
DrawComponents, /* draw_components */
False, /* count_layable_children*/
NULL, /* child_is_layable */
NULL, /* extension */
{
XfeInheritBitGravity, /* bit_gravity */
PreferredGeometry, /* preferred_geometry */
XfeInheritUpdateBoundary, /* update_boundary */
XfeInheritUpdateChildrenInfo, /* update_children_info */
XfeInheritLayoutWidget, /* layout_widget */
AcceptStaticChild, /* accept_static_child */
NULL, /* insert_static_child */
NULL, /* delete_static_child */
NULL, /* layout_static_children */
NULL, /* change_managed */
NULL, /* prepare_components */
LayoutComponents, /* layout_components */
NULL, /* draw_background */
DrawShadow, /* draw_shadow */
DrawComponents, /* draw_components */
NULL, /* extension */
},
/* XfeComboBox Part */
@ -891,7 +890,7 @@ PreferredGeometry(Widget w,Dimension * width,Dimension * height)
}
/*----------------------------------------------------------------------*/
static Boolean
AcceptChild(Widget child)
AcceptStaticChild(Widget child)
{
return False;
}
@ -1437,7 +1436,7 @@ TextFocusCB(Widget text,XtPointer client_data,XtPointer call_data)
cp->highlighted = True;
DrawHighlight(w,NULL,NULL,&_XfemWidgetRect(w));
DrawHighlight(w,NULL,NULL,&_XfemBoundary(w));
}
/*----------------------------------------------------------------------*/
static void
@ -1448,7 +1447,7 @@ TextLosingFocusCB(Widget text,XtPointer client_data,XtPointer call_data)
cp->highlighted = False;
DrawHighlight(w,NULL,NULL,&_XfemWidgetRect(w));
DrawHighlight(w,NULL,NULL,&_XfemBoundary(w));
}
/*----------------------------------------------------------------------*/

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

@ -54,10 +54,10 @@
#define CB_OFFSET_RIGHT(w,cp) (cp->highlight_thickness+_XfemOffsetRight(w))
#define CB_OFFSET_TOP(w,cp) (cp->highlight_thickness+_XfemOffsetTop(w))
#define CB_RECT_X(w,cp) (_XfemRectX(w) + cp->highlight_thickness)
#define CB_RECT_Y(w,cp) (_XfemRectY(w) + cp->highlight_thickness)
#define CB_RECT_WIDTH(w,cp) (_XfemRectWidth(w)-2*cp->highlight_thickness)
#define CB_RECT_HEIGHT(w,cp) (_XfemRectHeight(w)-2*cp->highlight_thickness)
#define CB_RECT_X(w,cp) (_XfemBoundaryX(w) + cp->highlight_thickness)
#define CB_RECT_Y(w,cp) (_XfemBoundaryY(w) + cp->highlight_thickness)
#define CB_RECT_WIDTH(w,cp) (_XfemBoundaryWidth(w)-2*cp->highlight_thickness)
#define CB_RECT_HEIGHT(w,cp) (_XfemBoundaryHeight(w)-2*cp->highlight_thickness)
/*----------------------------------------------------------------------*/
/* */
@ -74,11 +74,11 @@ static void GetValuesHook (Widget,ArgList,Cardinal *);
/* XfeManager class methods */
/* */
/*----------------------------------------------------------------------*/
static void PreferredGeometry (Widget,Dimension *,Dimension *);
static Boolean AcceptChild (Widget);
static Boolean InsertChild (Widget);
static Boolean DeleteChild (Widget);
static void LayoutComponents (Widget);
static void PreferredGeometry (Widget,Dimension *,Dimension *);
static Boolean AcceptStaticChild (Widget);
static Boolean InsertStaticChild (Widget);
static Boolean DeleteStaticChild (Widget);
static void LayoutStaticChildren (Widget);
/*----------------------------------------------------------------------*/
/* */
@ -514,26 +514,25 @@ _XFE_WIDGET_CLASS_RECORD(fancybox,FancyBox) =
XmInheritParentProcess, /* parent_process */
NULL, /* extension */
},
/* XfeManager Part */
{
XfeInheritBitGravity, /* bit_gravity */
PreferredGeometry, /* preferred_geometry */
XfeInheritMinimumGeometry, /* minimum_geometry */
XfeInheritUpdateRect, /* update_rect */
AcceptChild, /* accept_child */
InsertChild, /* insert_child */
DeleteChild, /* delete_child */
NULL, /* change_managed */
NULL, /* prepare_components */
LayoutComponents, /* layout_components */
NULL, /* layout_children */
NULL, /* draw_background */
XfeInheritDrawShadow, /* draw_shadow */
XfeInheritDrawComponents, /* draw_components */
False, /* count_layable_children*/
NULL, /* child_is_layable */
NULL, /* extension */
{
XfeInheritBitGravity, /* bit_gravity */
PreferredGeometry, /* preferred_geometry */
XfeInheritUpdateBoundary, /* update_boundary */
XfeInheritUpdateChildrenInfo, /* update_children_info */
XfeInheritLayoutWidget, /* layout_widget */
AcceptStaticChild, /* accept_static_child */
InsertStaticChild, /* insert_static_child */
DeleteStaticChild, /* delete_static_child */
LayoutStaticChildren, /* layout_static_children */
NULL, /* change_managed */
NULL, /* prepare_components */
XfeInheritLayoutComponents, /* layout_components */
NULL, /* draw_background */
XfeInheritDrawShadow, /* draw_shadow */
XfeInheritDrawComponents, /* draw_components */
NULL, /* extension */
},
/* XfeComboBox Part */
@ -712,7 +711,7 @@ PreferredGeometry(Widget w,Dimension * width,Dimension * height)
}
/*----------------------------------------------------------------------*/
static Boolean
AcceptChild(Widget child)
AcceptStaticChild(Widget child)
{
Widget w = _XfeParent(child);
XfeFancyBoxPart * fp = _XfeFancyBoxPart(w);
@ -721,7 +720,7 @@ AcceptChild(Widget child)
}
/*----------------------------------------------------------------------*/
static Boolean
InsertChild(Widget child)
InsertStaticChild(Widget child)
{
Widget w = _XfeParent(child);
XfeFancyBoxPart * fp = _XfeFancyBoxPart(w);
@ -732,7 +731,7 @@ InsertChild(Widget child)
}
/*----------------------------------------------------------------------*/
static Boolean
DeleteChild(Widget child)
DeleteStaticChild(Widget child)
{
Widget w = _XfeParent(child);
XfeFancyBoxPart * fp = _XfeFancyBoxPart(w);
@ -743,14 +742,8 @@ DeleteChild(Widget child)
}
/*----------------------------------------------------------------------*/
static void
LayoutComponents(Widget w)
LayoutStaticChildren(Widget w)
{
/* Layout the arrow */
_XfeComboBoxLayoutArrow(w);
/* Layout the title */
_XfeComboBoxLayoutTitle(w);
/* Layout the icon if needed */
IconLayout(w);
}