This commit is contained in:
ramiro%netscape.com 1998-10-10 02:41:04 +00:00
Родитель 634a6c99e0
Коммит 7e14811a6a
26 изменённых файлов: 4113 добавлений и 6 удалений

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

@ -0,0 +1,62 @@
#!gmake
#
# 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: Makefile
# Description: Makefile for XfePref library
# Author: Ramiro Estrugo <ramiro@netscape.com>
#
##########################################################################
DEPTH = ../../../..
# XfeWidgets headers are exported to dist/public/XfePref/Xfe. We use
# the 'Xfe' directory to avoid the hasstle of having to remember yet another
# include prefix.
MODULE = XfePref/Xfe
LIBRARY_NAME = XfePref
CSRCS = \
PrefGroup.c \
PrefPanel.c \
PrefPanelInfo.c \
PrefView.c \
$(NULL)
REQUIRES = \
XfeWidgets \
XfePref \
Microline
EXPORTS = \
PrefGroup.h \
PrefGroupP.h \
PrefItem.h \
PrefItemP.h \
PrefPanel.h \
PrefPanelInfo.h \
PrefPanelInfoP.h \
PrefPanelP.h \
PrefView.h \
PrefViewP.h \
$(NULL)
include $(DEPTH)/config/rules.mk

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

@ -0,0 +1,530 @@
/* -*- 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/PrefGroup.c> */
/* Description: XfePrefGroup widget source. */
/* Author: Ramiro Estrugo <ramiro@netscape.com> */
/* */
/*----------------------------------------------------------------------*/
#include <Xfe/PrefGroupP.h>
#include <Xm/Label.h>
#include <Xm/Frame.h>
#define MESSAGE1 "Widget is not an XfePrefGroup."
#define MESSAGE2 "XmNtitleDirection is not XmSTRING_DIRECTION_L_TO_R or XmSTRING_DIRECTION_R_TO_L."
#define DEFAULT_TITLE_NAME "PrefGroupTitle"
#define DEFAULT_SUB_TITLE_NAME "PrefGroupSubTitle"
/*----------------------------------------------------------------------*/
/* */
/* Core class methods */
/* */
/*----------------------------------------------------------------------*/
static void Initialize (Widget,Widget,ArgList,Cardinal *);
static void Destroy (Widget);
static Boolean SetValues (Widget,Widget,Widget,ArgList,Cardinal *);
static void GetValuesHook (Widget,ArgList,Cardinal *);
/*----------------------------------------------------------------------*/
/* */
/* XfeManager class methods */
/* */
/*----------------------------------------------------------------------*/
static void PreferredGeometry (Widget,Dimension *,Dimension *);
static Boolean AcceptStaticChild (Widget);
static Boolean InsertStaticChild (Widget);
static Boolean DeleteStaticChild (Widget);
static void LayoutComponents (Widget);
static void LayoutStaticChildren (Widget);
static void DrawComponents (Widget,XEvent *,Region,XRectangle *);
static Widget TitleCreate (Widget);
/*----------------------------------------------------------------------*/
/* */
/* XfePrefGroup resources */
/* */
/*----------------------------------------------------------------------*/
static XtResource resources[] =
{
/* Frame resources */
{
XmNframeType,
XmCFrameType,
XmRShadowType,
sizeof(unsigned char),
XtOffsetOf(XfePrefGroupRec , xfe_pref_group . frame_type),
XmRImmediate,
(XtPointer) XmSHADOW_ETCHED_IN
},
{
XmNframeThickness,
XmCFrameThickness,
XmRHorizontalDimension,
sizeof(Dimension),
XtOffsetOf(XfePrefGroupRec , xfe_pref_group . frame_thickness),
XmRImmediate,
(XtPointer) 2
},
/* Title resources */
{
XmNtitle,
XmCReadOnly,
XmRWidget,
sizeof(Widget),
XtOffsetOf(XfePrefGroupRec , xfe_pref_group . title),
XmRImmediate,
(XtPointer) NULL
},
{
XmNtitleAlignment,
XmCTitleAlignment,
XmRAlignment,
sizeof(unsigned char),
XtOffsetOf(XfePrefGroupRec , xfe_pref_group . title_alignment),
XmRImmediate,
(XtPointer) XmALIGNMENT_BEGINNING
},
{
XmNtitleDirection,
XmCTitleDirection,
XmRStringDirection,
sizeof(unsigned char),
XtOffsetOf(XfePrefGroupRec , xfe_pref_group . title_direction),
XmRImmediate,
(XtPointer) XmSTRING_DIRECTION_L_TO_R
},
{
XmNtitleFontList,
XmCTitleFontList,
XmRFontList,
sizeof(XmFontList),
XtOffsetOf(XfePrefGroupRec , xfe_pref_group . title_font_list),
XmRCallProc,
(XtPointer) _XfeCallProcDefaultLabelFontList
},
{
XmNtitleOffset,
XmCTitleOffset,
XmRHorizontalDimension,
sizeof(Dimension),
XtOffsetOf(XfePrefGroupRec , xfe_pref_group . title_offset),
XmRImmediate,
(XtPointer) 20
},
{
XmNtitleString,
XmCTitleString,
XmRXmString,
sizeof(XmString),
XtOffsetOf(XfePrefGroupRec , xfe_pref_group . title_string),
XmRImmediate,
(XtPointer) NULL
},
/* Widget names */
{
XmNtitleWidgetName,
XmCReadOnly,
XmRString,
sizeof(String),
XtOffsetOf(XfePrefGroupRec , xfe_pref_group . title_widget_name),
XmRString,
"PrefGroupTitle"
},
{
XmNframeWidgetName,
XmCReadOnly,
XmRString,
sizeof(String),
XtOffsetOf(XfePrefGroupRec , xfe_pref_group . frame_widget_name),
XmRString,
"PrefGroupFrame"
},
};
/*----------------------------------------------------------------------*/
/* */
/* XfePrefGroup synthetic resources */
/* */
/*----------------------------------------------------------------------*/
static XmSyntheticResource synthetic_resources[] =
{
{
XmNtitleOffset,
sizeof(Dimension),
XtOffsetOf(XfePrefGroupRec , xfe_pref_group . title_offset),
_XmFromHorizontalPixels,
_XmToHorizontalPixels
},
{
XmNtitleSpacing,
sizeof(Dimension),
XtOffsetOf(XfePrefGroupRec , xfe_pref_group . title_spacing),
_XmFromHorizontalPixels,
_XmToHorizontalPixels
},
};
/*----------------------------------------------------------------------*/
/* */
/* Widget Class Record Initialization */
/* */
/*----------------------------------------------------------------------*/
_XFE_WIDGET_CLASS_RECORD(prefgroup,PrefGroup) =
{
{
(WidgetClass) &xfeManagerClassRec, /* superclass */
"XfePrefGroup", /* class_name */
sizeof(XfePrefGroupRec), /* widget_size */
NULL, /* class_initialize */
NULL, /* class_part_initialize*/
FALSE, /* class_inited */
Initialize, /* initialize */
NULL, /* initialize_hook */
XtInheritRealize, /* realize */
NULL, /* actions */
0, /* num_actions */
resources, /* resources */
XtNumber(resources), /* num_resources */
NULLQUARK, /* xrm_class */
TRUE, /* compress_motion */
XtExposeCompressMaximal, /* compress_exposure */
TRUE, /* compress_enterleave */
FALSE, /* visible_interest */
Destroy, /* destroy */
XtInheritResize, /* resize */
XtInheritExpose, /* expose */
SetValues, /* set_values */
NULL, /* set_values_hook */
XtInheritSetValuesAlmost, /* set_values_almost */
GetValuesHook, /* get_values_hook */
NULL, /* access_focus */
XtVersion, /* version */
NULL, /* callback_private */
XtInheritTranslations, /* tm_table */
XtInheritQueryGeometry, /* query_geometry */
XtInheritDisplayAccelerator, /* display accelerator */
NULL, /* extension */
},
/* Composite Part */
{
XtInheritGeometryManager, /* geometry_manager */
XtInheritChangeManaged, /* change_managed */
XtInheritInsertChild, /* insert_child */
XtInheritDeleteChild, /* delete_child */
NULL /* extension */
},
/* Constraint Part */
{
NULL, /* syn resources */
0, /* num syn_resources */
sizeof(XfeManagerConstraintRec), /* constraint size */
NULL, /* init proc */
NULL, /* destroy proc */
NULL, /* set values proc */
NULL, /* extension */
},
/* XmManager Part */
{
XtInheritTranslations, /* tm_table */
synthetic_resources, /* syn resources */
XtNumber(synthetic_resources), /* num syn_resources */
NULL, /* syn_cont_resources */
0, /* num_syn_cont_resource*/
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 */
NULL, /* change_managed */
NULL, /* prepare_components */
LayoutComponents, /* layout_components */
NULL, /* draw_background */
XfeInheritDrawShadow, /* draw_shadow */
DrawComponents, /* draw_components */
NULL, /* extension */
},
/* XfePrefGroup Part */
{
NULL, /* extension */
},
};
/*----------------------------------------------------------------------*/
/* */
/* xfePrefGroupWidgetClass declaration. */
/* */
/*----------------------------------------------------------------------*/
_XFE_WIDGET_CLASS(prefgroup,PrefGroup);
/*----------------------------------------------------------------------*/
/* */
/* Core Class methods */
/* */
/*----------------------------------------------------------------------*/
static void
Initialize(Widget rw,Widget nw,ArgList args,Cardinal *nargs)
{
XfePrefGroupPart * pp = _XfePrefGroupPart(nw);
/* Create private components */
pp->title = TitleCreate(nw);
/* Initialize private members */
/* Finish of initialization */
_XfeManagerChainInitialize(rw,nw,xfePrefGroupWidgetClass);
}
/*----------------------------------------------------------------------*/
static void
Destroy(Widget w)
{
/* XfePrefGroupPart * pp = _XfePrefGroupPart(w); */
}
/*----------------------------------------------------------------------*/
static Boolean
SetValues(Widget ow,Widget rw,Widget nw,ArgList args,Cardinal *nargs)
{
/* XfePrefGroupPart * np = _XfePrefGroupPart(nw); */
/* XfePrefGroupPart * op = _XfePrefGroupPart(ow); */
/* shadow_thickness */
if (_XfemShadowThickness(nw) != _XfemShadowThickness(ow))
{
_XfemConfigFlags(nw) |= XfeConfigLE;
}
return _XfeManagerChainSetValues(ow,rw,nw,xfePrefGroupWidgetClass);
}
/*----------------------------------------------------------------------*/
static void
GetValuesHook(Widget w,ArgList args,Cardinal* nargs)
{
/* XfePrefGroupPart * pp = _XfePrefGroupPart(w); */
Cardinal i;
for (i = 0; i < *nargs; i++)
{
#if 0
/* label_string */
if (strcmp(args[i].name,XmNlabelString) == 0)
{
*((XtArgVal *) args[i].value) =
(XtArgVal) XmStringCopy(lp->label_string);
}
/* font_list */
else if (strcmp(args[i].name,XmNfontList) == 0)
{
*((XtArgVal *) args[i].value) =
(XtArgVal) XmFontListCopy(lp->font_list);
}
#endif
}
}
/*----------------------------------------------------------------------*/
/*----------------------------------------------------------------------*/
/* */
/* XfeManager class methods */
/* */
/*----------------------------------------------------------------------*/
static void
PreferredGeometry(Widget w,Dimension * width,Dimension * height)
{
/* XfePrefGroupPart * pp = _XfePrefGroupPart(w); */
}
/*----------------------------------------------------------------------*/
static Boolean
AcceptStaticChild(Widget child)
{
return True;
}
/*----------------------------------------------------------------------*/
static Boolean
InsertStaticChild(Widget child)
{
/* Widget w = XtParent(child); */
/* XfePrefGroupPart * pp = _XfePrefGroupPart(w); */
return True;
}
/*----------------------------------------------------------------------*/
static Boolean
DeleteStaticChild(Widget child)
{
/* Widget w = XtParent(child); */
/* XfePrefGroupPart * pp = _XfePrefGroupPart(w); */
return True;
}
/*----------------------------------------------------------------------*/
static void
LayoutStaticChildren(Widget w)
{
/* XfePrefGroupPart * pp = _XfePrefGroupPart(w); */
}
/*----------------------------------------------------------------------*/
static void
LayoutComponents(Widget w)
{
XfePrefGroupPart * pp = _XfePrefGroupPart(w);
if (_XfeChildIsShown(pp->title))
{
int x;
int y;
/* Left to right */
if (pp->title_direction == XmSTRING_DIRECTION_L_TO_R)
{
x = _XfemBoundaryX(w) + pp->title_offset;
}
/* Right to left */
else if (pp->title_direction == XmSTRING_DIRECTION_R_TO_L)
{
x = _XfeWidth(w) -
_XfemOffsetRight(w) -
_XfeWidth(pp->title) -
pp->title_offset;
}
else
{
_XfeWarning(w,MESSAGE2);
}
_XfeConfigureWidget(pp->title,
x,
y,
_XfeWidth(pp->title),
_XfeHeight(pp->title));
if (_XfeIsRealized(pp->title))
{
XRaiseWindow(XtDisplay(pp->title),_XfeWindow(pp->title));
}
}
}
/*----------------------------------------------------------------------*/
static void
DrawComponents(Widget w,XEvent * event,Region region,XRectangle * clip_rect)
{
XfePrefGroupPart * pp = _XfePrefGroupPart(w);
Position x;
Position y;
Dimension width;
Dimension height;
/* Make sure the frame has at least a thickness of 1 */
if (pp->frame_thickness < 1)
{
return;
}
x = _XfemOffsetLeft(w);
y = _XfemOffsetTop(w);
width = _XfemBoundaryWidth(w);
height = _XfemBoundaryHeight(w);
/* The frame should render right through the child */
if (_XfeChildIsShown(pp->title))
{
int dy = (_XfeHeight(pp->title) / 2) - (pp->frame_thickness / 2);
y += dy;
height -= dy;
}
/* Draw the shadow */
_XmDrawShadows(XtDisplay(w),
_XfeWindow(w),
_XfemTopShadowGC(w),_XfemBottomShadowGC(w),
x,y,
width,height,
pp->frame_thickness,
pp->frame_type);
}
/*----------------------------------------------------------------------*/
static Widget
TitleCreate(Widget w)
{
XfePrefGroupPart * pp = _XfePrefGroupPart(w);
Widget title = NULL;
Arg av[20];
Cardinal ac = 0;
#if 0
XtSetArg(av[ac],XmNbackground, _XfeBackgroundPixel(w)); ac++;
XtSetArg(av[ac],XmNforeground, _XfemForeground(w)); ac++;
#endif
XtSetArg(av[ac],XmNshadowThickness, 0); ac++;
XtSetArg(av[ac],XmNstringDirection, pp->title_direction); ac++;
XtSetArg(av[ac],XmNalignment, pp->title_alignment); ac++;
if (pp->title_font_list != NULL)
{
XtSetArg(av[ac],XmNfontList, pp->title_font_list); ac++;
}
title = XtCreateManagedWidget(pp->title_widget_name,
xmLabelWidgetClass,
w,
av,ac);
return title;
}
/*----------------------------------------------------------------------*/
/*----------------------------------------------------------------------*/
/* */
/* XfePrefGroup Public Methods */
/* */
/*----------------------------------------------------------------------*/
/* extern */ Widget
XfeCreatePrefGroup(Widget pw,char * name,Arg * av,Cardinal ac)
{
return XtCreateWidget(name,xfePrefGroupWidgetClass,pw,av,ac);
}
/*----------------------------------------------------------------------*/

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

@ -0,0 +1,86 @@
/* -*- 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/PrefGroup.h> */
/* Description: XfePrefGroup widget public header file. */
/* Author: Ramiro Estrugo <ramiro@netscape.com> */
/* */
/*----------------------------------------------------------------------*/
#ifndef _XfePrefGroup_h_ /* start PrefGroup.h */
#define _XfePrefGroup_h_
#include <Xfe/Manager.h>
XFE_BEGIN_CPLUSPLUS_PROTECTION
/*----------------------------------------------------------------------*/
/* */
/* XfePrefGroup resource names */
/* */
/*----------------------------------------------------------------------*/
#define XmNframeThickness "frameThickness"
#define XmNframeType "frameType"
#define XmNframeWidgetName "frameWidgetName"
#define XmNtitleWidgetName "titleWidgetName"
#define XmNtitleAlignment "titleAlignment"
#define XmNtitleDirection "titleDirection"
#define XmNtitleOffset "titleOffset"
#define XmNtitleSpacing "titleSpacing"
#define XmCFrameThickness "FrameThickness"
#define XmCFrameType "FrameType"
#define XmCTitleAlignment "TitleAlignment"
#define XmCTitleDirection "TitleDirection"
#define XmCTitleOffset "TitleOffset"
#define XmCTitleSpacing "TitleSpacing"
/*----------------------------------------------------------------------*/
/* */
/* XfePrefGroup class names */
/* */
/*----------------------------------------------------------------------*/
externalref WidgetClass xfePrefGroupWidgetClass;
typedef struct _XfePrefGroupClassRec * XfePrefGroupWidgetClass;
typedef struct _XfePrefGroupRec * XfePrefGroupWidget;
/*----------------------------------------------------------------------*/
/* */
/* XfePrefGroup subclass test macro */
/* */
/*----------------------------------------------------------------------*/
#define XfeIsPrefGroup(w) XtIsSubclass(w,xfePrefGroupWidgetClass)
/*----------------------------------------------------------------------*/
/* */
/* XfePrefGroup public methods */
/* */
/*----------------------------------------------------------------------*/
extern Widget
XfeCreatePrefGroup (Widget pw,
String name,
Arg * av,
Cardinal ac);
/*----------------------------------------------------------------------*/
XFE_END_CPLUSPLUS_PROTECTION
#endif /* end PrefGroup.h */

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

@ -0,0 +1,117 @@
/* -*- 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/PrefGroupP.h> */
/* Description: XfePrefGroup widget private header file. */
/* Author: Ramiro Estrugo <ramiro@netscape.com> */
/* */
/*----------------------------------------------------------------------*/
#ifndef _XfePrefGroupP_h_ /* start PrefGroupP.h */
#define _XfePrefGroupP_h_
#include <Xfe/PrefGroup.h>
#include <Xfe/ManagerP.h>
XFE_BEGIN_CPLUSPLUS_PROTECTION
/*----------------------------------------------------------------------*/
/* */
/* XfePrefGroupClassPart */
/* */
/*----------------------------------------------------------------------*/
typedef struct
{
XtPointer extension; /* extension */
} XfePrefGroupClassPart;
/*----------------------------------------------------------------------*/
/* */
/* XfePrefGroupClassRec */
/* */
/*----------------------------------------------------------------------*/
typedef struct _XfePrefGroupClassRec
{
CoreClassPart core_class;
CompositeClassPart composite_class;
ConstraintClassPart constraint_class;
XmManagerClassPart manager_class;
XfeManagerClassPart xfe_manager_class;
XfePrefGroupClassPart xfe_pref_group_class;
} XfePrefGroupClassRec;
externalref XfePrefGroupClassRec xfePrefGroupClassRec;
/*----------------------------------------------------------------------*/
/* */
/* XfePrefGroupPart */
/* */
/*----------------------------------------------------------------------*/
typedef struct _XfePrefGroupPart
{
/* Frame resources */
unsigned char frame_type; /* Frame type */
Dimension frame_thickness; /* Frame thickness */
/* Title resources */
Widget title; /* Title */
unsigned char title_alignment; /* Title alignment */
unsigned char title_direction; /* Title direction */
XmFontList title_font_list; /* Title font list */
Dimension title_offset; /* Title offset */
XmString title_string; /* Title string */
/* Widget names */
String title_widget_name; /* Title widget name */
String frame_widget_name; /* Frame widget name */
Dimension title_spacing; /* Title spacing */
/* Private data -- Dont even look past this comment -- */
} XfePrefGroupPart;
/*----------------------------------------------------------------------*/
/* */
/* XfePrefGroupRec */
/* */
/*----------------------------------------------------------------------*/
typedef struct _XfePrefGroupRec
{
CorePart core;
CompositePart composite;
ConstraintPart constraint;
XmManagerPart manager;
XfeManagerPart xfe_manager;
XfePrefGroupPart xfe_pref_group;
} XfePrefGroupRec;
/*----------------------------------------------------------------------*/
/* */
/* XfePrefGroupPart Access Macro */
/* */
/*----------------------------------------------------------------------*/
#define _XfePrefGroupPart(w) &(((XfePrefGroupWidget) w) -> xfe_pref_group)
XFE_END_CPLUSPLUS_PROTECTION
#endif /* end PrefGroupP.h */

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

@ -0,0 +1,586 @@
/* -*- 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/PrefItem.c> */
/* Description: XfePrefItem widget source. */
/* Author: Ramiro Estrugo <ramiro@netscape.com> */
/* */
/*----------------------------------------------------------------------*/
#include <Xfe/PrefItemP.h>
#include <Xm/Label.h>
#include <Xm/Frame.h>
#define MESSAGE1 "Widget is not an XfePrefItem."
#define MESSAGE2 "XmNtitleDirection is not XmSTRING_DIRECTION_L_TO_R or XmSTRING_DIRECTION_R_TO_L."
#define DEFAULT_TITLE_NAME "PrefItemTitle"
#define DEFAULT_SUB_TITLE_NAME "PrefItemSubTitle"
/*----------------------------------------------------------------------*/
/* */
/* Core class methods */
/* */
/*----------------------------------------------------------------------*/
static void Initialize (Widget,Widget,ArgList,Cardinal *);
static void Destroy (Widget);
static Boolean SetValues (Widget,Widget,Widget,ArgList,Cardinal *);
static void GetValuesHook (Widget,ArgList,Cardinal *);
/*----------------------------------------------------------------------*/
/* */
/* XfeManager class methods */
/* */
/*----------------------------------------------------------------------*/
static void PreferredGeometry (Widget,Dimension *,Dimension *);
static Boolean AcceptStaticChild (Widget);
static Boolean InsertStaticChild (Widget);
static Boolean DeleteStaticChild (Widget);
static void ChangeManaged (Widget);
static void PrepareComponents (Widget,int);
static void LayoutComponents (Widget);
static void LayoutStaticChildren (Widget);
static void DrawComponents (Widget,XEvent *,Region,XRectangle *);
static Widget TitleCreate (Widget);
/*----------------------------------------------------------------------*/
/* */
/* XfePrefItem resources */
/* */
/*----------------------------------------------------------------------*/
static XtResource resources[] =
{
/* Frame resources */
{
XmNframeType,
XmCFrameType,
XmRShadowType,
sizeof(unsigned char),
XtOffsetOf(XfePrefItemRec , xfe_pref_item . frame_type),
XmRImmediate,
(XtPointer) XmSHADOW_ETCHED_IN
},
{
XmNframeThickness,
XmCFrameThickness,
XmRHorizontalDimension,
sizeof(Dimension),
XtOffsetOf(XfePrefItemRec , xfe_pref_item . frame_thickness),
XmRImmediate,
(XtPointer) 2
},
/* Title resources */
{
XmNtitle,
XmCReadOnly,
XmRWidget,
sizeof(Widget),
XtOffsetOf(XfePrefItemRec , xfe_pref_item . title),
XmRImmediate,
(XtPointer) NULL
},
{
XmNtitleAlignment,
XmCTitleAlignment,
XmRAlignment,
sizeof(unsigned char),
XtOffsetOf(XfePrefItemRec , xfe_pref_item . title_alignment),
XmRImmediate,
(XtPointer) XmALIGNMENT_BEGINNING
},
{
XmNtitleDirection,
XmCTitleDirection,
XmRStringDirection,
sizeof(unsigned char),
XtOffsetOf(XfePrefItemRec , xfe_pref_item . title_direction),
XmRImmediate,
(XtPointer) XmSTRING_DIRECTION_L_TO_R
},
{
XmNtitleFontList,
XmCTitleFontList,
XmRFontList,
sizeof(XmFontList),
XtOffsetOf(XfePrefItemRec , xfe_pref_item . title_font_list),
XmRCallProc,
(XtPointer) _XfeCallProcDefaultLabelFontList
},
{
XmNtitleOffset,
XmCTitleOffset,
XmRHorizontalDimension,
sizeof(Dimension),
XtOffsetOf(XfePrefItemRec , xfe_pref_item . title_offset),
XmRImmediate,
(XtPointer) 20
},
{
XmNtitleString,
XmCTitleString,
XmRXmString,
sizeof(XmString),
XtOffsetOf(XfePrefItemRec , xfe_pref_item . title_string),
XmRImmediate,
(XtPointer) NULL
},
/* Widget names */
{
XmNtitleWidgetName,
XmCReadOnly,
XmRString,
sizeof(String),
XtOffsetOf(XfePrefItemRec , xfe_pref_item . title_widget_name),
XmRString,
"PrefItemTitle"
},
{
XmNframeWidgetName,
XmCReadOnly,
XmRString,
sizeof(String),
XtOffsetOf(XfePrefItemRec , xfe_pref_item . frame_widget_name),
XmRString,
"PrefItemFrame"
},
};
/*----------------------------------------------------------------------*/
/* */
/* XfePrefItem synthetic resources */
/* */
/*----------------------------------------------------------------------*/
static XmSyntheticResource synthetic_resources[] =
{
{
XmNtitleOffset,
sizeof(Dimension),
XtOffsetOf(XfePrefItemRec , xfe_pref_item . title_offset),
_XmFromHorizontalPixels,
_XmToHorizontalPixels
},
{
XmNtitleSpacing,
sizeof(Dimension),
XtOffsetOf(XfePrefItemRec , xfe_pref_item . title_spacing),
_XmFromHorizontalPixels,
_XmToHorizontalPixels
},
};
/*----------------------------------------------------------------------*/
/* */
/* Widget Class Record Initialization */
/* */
/*----------------------------------------------------------------------*/
_XFE_WIDGET_CLASS_RECORD(prefitem,PrefItem) =
{
{
(WidgetClass) &xfeManagerClassRec, /* superclass */
"XfePrefItem", /* class_name */
sizeof(XfePrefItemRec), /* widget_size */
NULL, /* class_initialize */
NULL, /* class_part_initialize*/
FALSE, /* class_inited */
Initialize, /* initialize */
NULL, /* initialize_hook */
XtInheritRealize, /* realize */
NULL, /* actions */
0, /* num_actions */
resources, /* resources */
XtNumber(resources), /* num_resources */
NULLQUARK, /* xrm_class */
TRUE, /* compress_motion */
XtExposeCompressMaximal, /* compress_exposure */
TRUE, /* compress_enterleave */
FALSE, /* visible_interest */
Destroy, /* destroy */
XtInheritResize, /* resize */
XtInheritExpose, /* expose */
SetValues, /* set_values */
NULL, /* set_values_hook */
XtInheritSetValuesAlmost, /* set_values_almost */
GetValuesHook, /* get_values_hook */
NULL, /* access_focus */
XtVersion, /* version */
NULL, /* callback_private */
XtInheritTranslations, /* tm_table */
XtInheritQueryGeometry, /* query_geometry */
XtInheritDisplayAccelerator, /* display accelerator */
NULL, /* extension */
},
/* Composite Part */
{
XtInheritGeometryManager, /* geometry_manager */
XtInheritChangeManaged, /* change_managed */
XtInheritInsertChild, /* insert_child */
XtInheritDeleteChild, /* delete_child */
NULL /* extension */
},
/* Constraint Part */
{
NULL, /* syn resources */
0, /* num syn_resources */
sizeof(XfeManagerConstraintRec), /* constraint size */
NULL, /* init proc */
NULL, /* destroy proc */
NULL, /* set values proc */
NULL, /* extension */
},
/* XmManager Part */
{
XtInheritTranslations, /* tm_table */
synthetic_resources, /* syn resources */
XtNumber(synthetic_resources), /* num syn_resources */
NULL, /* syn_cont_resources */
0, /* num_syn_cont_resource*/
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 */
NULL, /* change_managed */
NULL, /* prepare_components */
LayoutComponents, /* layout_components */
NULL, /* draw_background */
XfeInheritDrawShadow, /* draw_shadow */
DrawComponents, /* draw_components */
NULL, /* extension */
},
/* XfePrefItem Part */
{
NULL, /* extension */
},
};
/*----------------------------------------------------------------------*/
/* */
/* xfePrefItemWidgetClass declaration. */
/* */
/*----------------------------------------------------------------------*/
_XFE_WIDGET_CLASS(prefitem,PrefItem);
/*----------------------------------------------------------------------*/
/* */
/* Core Class methods */
/* */
/*----------------------------------------------------------------------*/
static void
Initialize(Widget rw,Widget nw,ArgList args,Cardinal *nargs)
{
XfePrefItemPart * pp = _XfePrefItemPart(nw);
/* Create private components */
pp->title = TitleCreate(nw);
/* Initialize private members */
/* Finish of initialization */
_XfeManagerChainInitialize(rw,nw,xfePrefItemWidgetClass);
}
/*----------------------------------------------------------------------*/
static void
Destroy(Widget w)
{
XfePrefItemPart * pp = _XfePrefItemPart(w);
}
/*----------------------------------------------------------------------*/
static Boolean
SetValues(Widget ow,Widget rw,Widget nw,ArgList args,Cardinal *nargs)
{
XfePrefItemPart * np = _XfePrefItemPart(nw);
XfePrefItemPart * op = _XfePrefItemPart(ow);
/* shadow_thickness */
if (_XfemShadowThickness(nw) != _XfemShadowThickness(ow))
{
_XfemConfigFlags(nw) |= XfeConfigLE;
}
return _XfeManagerChainSetValues(ow,rw,nw,xfePrefItemWidgetClass);
}
/*----------------------------------------------------------------------*/
static void
GetValuesHook(Widget w,ArgList args,Cardinal* nargs)
{
XfePrefItemPart * pp = _XfePrefItemPart(w);
Cardinal i;
for (i = 0; i < *nargs; i++)
{
#if 0
/* label_string */
if (strcmp(args[i].name,XmNlabelString) == 0)
{
*((XtArgVal *) args[i].value) =
(XtArgVal) XmStringCopy(lp->label_string);
}
/* font_list */
else if (strcmp(args[i].name,XmNfontList) == 0)
{
*((XtArgVal *) args[i].value) =
(XtArgVal) XmFontListCopy(lp->font_list);
}
#endif
}
}
/*----------------------------------------------------------------------*/
/*----------------------------------------------------------------------*/
/* */
/* XfeManager class methods */
/* */
/*----------------------------------------------------------------------*/
static void
PreferredGeometry(Widget w,Dimension * width,Dimension * height)
{
XfePrefItemPart * pp = _XfePrefItemPart(w);
}
/*----------------------------------------------------------------------*/
static Boolean
AcceptStaticChild(Widget child)
{
return True;
}
/*----------------------------------------------------------------------*/
static Boolean
InsertStaticChild(Widget child)
{
Widget w = XtParent(child);
XfePrefItemPart * pp = _XfePrefItemPart(w);
return True;
}
/*----------------------------------------------------------------------*/
static Boolean
DeleteStaticChild(Widget child)
{
Widget w = XtParent(child);
XfePrefItemPart * pp = _XfePrefItemPart(w);
return True;
}
/*----------------------------------------------------------------------*/
static void
ChangeManaged(Widget w)
{
XfePrefItemPart * pp = _XfePrefItemPart(w);
}
/*----------------------------------------------------------------------*/
static void
PrepareComponents(Widget w,int flags)
{
XfePrefItemPart * pp = _XfePrefItemPart(w);
/* if (flags & _XFE_PREPARE_CLOSE_PIXMAP_MASK) */
/* { */
/* } */
}
/*----------------------------------------------------------------------*/
static void
LayoutComponents(Widget w)
{
XfePrefItemPart * pp = _XfePrefItemPart(w);
if (_XfeChildIsShown(pp->title))
{
int x;
int y;
/* Left to right */
if (pp->title_direction == XmSTRING_DIRECTION_L_TO_R)
{
x = _XfemBoundaryX(w) + pp->title_offset;
}
/* Right to left */
else if (pp->title_direction == XmSTRING_DIRECTION_R_TO_L)
{
x = _XfeWidth(w) -
_XfemOffsetRight(w) -
_XfeWidth(pp->title) -
pp->title_offset;
}
else
{
_XfeWarning(w,MESSAGE2);
}
_XfeConfigureWidget(pp->title,
x,
y,
_XfeWidth(pp->title),
_XfeHeight(pp->title));
if (_XfeIsRealized(pp->title))
{
XRaiseWindow(XtDisplay(pp->title),_XfeWindow(pp->title));
}
}
}
/*----------------------------------------------------------------------*/
static void
LayoutStaticChildren(Widget w)
{
XfePrefItemPart * pp = _XfePrefItemPart(w);
}
/*----------------------------------------------------------------------*/
static void
DrawComponents(Widget w,XEvent * event,Region region,XRectangle * clip_rect)
{
XfePrefItemPart * pp = _XfePrefItemPart(w);
Position x;
Position y;
Dimension width;
Dimension height;
/* Make sure the frame has at least a thickness of 1 */
if (pp->frame_thickness < 1)
{
return;
}
x = _XfemOffsetLeft(w);
y = _XfemOffsetTop(w);
width = _XfemBoundaryWidth(w);
height = _XfemBoundaryHeight(w);
/* The frame should render right through the child */
if (_XfeChildIsShown(pp->title))
{
int dy = (_XfeHeight(pp->title) / 2) - (pp->frame_thickness / 2);
y += dy;
height -= dy;
}
/* Draw the shadow */
_XmDrawShadows(XtDisplay(w),
_XfeWindow(w),
_XfemTopShadowGC(w),_XfemBottomShadowGC(w),
x,y,
width,height,
pp->frame_thickness,
pp->frame_type);
}
/*----------------------------------------------------------------------*/
/*----------------------------------------------------------------------*/
/* */
/* XfePrefItem class methods */
/* */
/*----------------------------------------------------------------------*/
static void
LayoutString(Widget w)
{
XfePrefItemPart * pp = _XfePrefItemPart(w);
}
/*----------------------------------------------------------------------*/
static void
DrawString(Widget w,XEvent * event,Region region,XRectangle * clip_rect)
{
XfePrefItemPart * pp = _XfePrefItemPart(w);
}
/*----------------------------------------------------------------------*/
/*----------------------------------------------------------------------*/
/* */
/* XfePrefItem action procedures */
/* */
/*----------------------------------------------------------------------*/
static void
BtnDown(Widget w,XEvent * event,char ** params,Cardinal * nparams)
{
XfePrefItemPart * pp = _XfePrefItemPart(w);
}
/*----------------------------------------------------------------------*/
static void
BtnUp(Widget w,XEvent * event,char ** params,Cardinal * nparams)
{
XfePrefItemPart * pp = _XfePrefItemPart(w);
}
/*----------------------------------------------------------------------*/
static Widget
TitleCreate(Widget w)
{
XfePrefItemPart * pp = _XfePrefItemPart(w);
Widget title = NULL;
Arg av[20];
Cardinal ac = 0;
#if 0
XtSetArg(av[ac],XmNbackground, _XfeBackgroundPixel(w)); ac++;
XtSetArg(av[ac],XmNforeground, _XfemForeground(w)); ac++;
#endif
XtSetArg(av[ac],XmNshadowThickness, 0); ac++;
XtSetArg(av[ac],XmNstringDirection, pp->title_direction); ac++;
XtSetArg(av[ac],XmNalignment, pp->title_alignment); ac++;
if (pp->title_font_list != NULL)
{
XtSetArg(av[ac],XmNfontList, pp->title_font_list); ac++;
}
title = XtCreateManagedWidget(pp->title_widget_name,
xmLabelWidgetClass,
w,
av,ac);
return title;
}
/*----------------------------------------------------------------------*/
/*----------------------------------------------------------------------*/
/* */
/* XfePrefItem Public Methods */
/* */
/*----------------------------------------------------------------------*/
/* extern */ Widget
XfeCreatePrefItem(Widget pw,char * name,Arg * av,Cardinal ac)
{
return XtCreateWidget(name,xfePrefItemWidgetClass,pw,av,ac);
}
/*----------------------------------------------------------------------*/

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

@ -0,0 +1,78 @@
/* -*- 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/PrefItem.h> */
/* Description: XfePrefItem widget public header file. */
/* Author: Ramiro Estrugo <ramiro@netscape.com> */
/* */
/*----------------------------------------------------------------------*/
#ifndef _XfePrefItem_h_ /* start PrefItem.h */
#define _XfePrefItem_h_
#include <Xfe/Manager.h>
#include <Xfe/XfePref.h>
XFE_BEGIN_CPLUSPLUS_PROTECTION
/*----------------------------------------------------------------------*/
/* */
/* XmRPrefItemType */
/* */
/*----------------------------------------------------------------------*/
enum
{
XmPREF_ITEM_TOGGLE_GROUP, /* */
XmPREF_ITEM_RADIO_GROUP, /* */
};
/*----------------------------------------------------------------------*/
/*----------------------------------------------------------------------*/
/* */
/* XfePrefItem class names */
/* */
/*----------------------------------------------------------------------*/
externalref WidgetClass xfePrefItemWidgetClass;
typedef struct _XfePrefItemClassRec * XfePrefItemWidgetClass;
typedef struct _XfePrefItemRec * XfePrefItemWidget;
/*----------------------------------------------------------------------*/
/* */
/* XfePrefItem subclass test macro */
/* */
/*----------------------------------------------------------------------*/
#define XfeIsPrefItem(w) XtIsSubclass(w,xfePrefItemWidgetClass)
/*----------------------------------------------------------------------*/
/* */
/* XfePrefItem public methods */
/* */
/*----------------------------------------------------------------------*/
extern Widget
XfeCreatePrefItem (Widget pw,
String name,
Arg * av,
Cardinal ac);
/*----------------------------------------------------------------------*/
XFE_END_CPLUSPLUS_PROTECTION
#endif /* end PrefItem.h */

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

@ -0,0 +1,118 @@
/* -*- 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/PrefItemP.h> */
/* Description: XfePrefItem widget private header file. */
/* Author: Ramiro Estrugo <ramiro@netscape.com> */
/* */
/*----------------------------------------------------------------------*/
#ifndef _XfePrefItemP_h_ /* start PrefItemP.h */
#define _XfePrefItemP_h_
#include <Xfe/PrefItem.h>
#include <Xfe/ManagerP.h>
XFE_BEGIN_CPLUSPLUS_PROTECTION
/*----------------------------------------------------------------------*/
/* */
/* XfePrefItemClassPart */
/* */
/*----------------------------------------------------------------------*/
typedef struct
{
XtPointer extension; /* extension */
} XfePrefItemClassPart;
/*----------------------------------------------------------------------*/
/* */
/* XfePrefItemClassRec */
/* */
/*----------------------------------------------------------------------*/
typedef struct _XfePrefItemClassRec
{
CoreClassPart core_class;
CompositeClassPart composite_class;
ConstraintClassPart constraint_class;
XmManagerClassPart manager_class;
XfeManagerClassPart xfe_manager_class;
XfePrefItemClassPart xfe_pref_item_class;
} XfePrefItemClassRec;
externalref XfePrefItemClassRec xfePrefItemClassRec;
/*----------------------------------------------------------------------*/
/* */
/* XfePrefItemPart */
/* */
/*----------------------------------------------------------------------*/
typedef struct _XfePrefItemPart
{
/* Frame resources */
unsigned char frame_type; /* Frame type */
Dimension frame_thickness; /* Frame thickness */
unsigned char item_type; /* Item type */
/* Title resources */
Widget title; /* Title */
unsigned char title_alignment; /* Title alignment */
unsigned char title_direction; /* Title direction */
XmFontList title_font_list; /* Title font list */
Dimension title_offset; /* Title offset */
XmString title_string; /* Title string */
/* Widget names */
String title_widget_name; /* Title widget name */
String frame_widget_name; /* Frame widget name */
Dimension title_spacing; /* Title spacing */
/* Private data -- Dont even look past this comment -- */
} XfePrefItemPart;
/*----------------------------------------------------------------------*/
/* */
/* XfePrefItemRec */
/* */
/*----------------------------------------------------------------------*/
typedef struct _XfePrefItemRec
{
CorePart core;
CompositePart composite;
ConstraintPart constraint;
XmManagerPart manager;
XfeManagerPart xfe_manager;
XfePrefItemPart xfe_pref_item;
} XfePrefItemRec;
/*----------------------------------------------------------------------*/
/* */
/* XfePrefItemPart Access Macro */
/* */
/*----------------------------------------------------------------------*/
#define _XfePrefItemPart(w) &(((XfePrefItemWidget) w) -> xfe_pref_item)
XFE_END_CPLUSPLUS_PROTECTION
#endif /* end PrefItemP.h */

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

@ -0,0 +1,604 @@
/* -*- 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/PrefPanel.c> */
/* Description: XfePrefPanel widget source. */
/* Author: Ramiro Estrugo <ramiro@netscape.com> */
/* */
/*----------------------------------------------------------------------*/
#include <Xfe/PrefPanelP.h>
#include <Xm/Label.h>
#define MESSAGE1 "Widget is not an XfePrefPanel."
#define MESSAGE2 "XmNtitleDirection is not XmSTRING_DIRECTION_L_TO_R or XmSTRING_DIRECTION_R_TO_L."
#define DEFAULT_TITLE_NAME "PrefPanelTitle"
#define DEFAULT_SUB_TITLE_NAME "PrefPanelSubTitle"
/*----------------------------------------------------------------------*/
/* */
/* Core class methods */
/* */
/*----------------------------------------------------------------------*/
static void Initialize (Widget,Widget,ArgList,Cardinal *);
static void Destroy (Widget);
static Boolean SetValues (Widget,Widget,Widget,ArgList,Cardinal *);
static void GetValuesHook (Widget,ArgList,Cardinal *);
/*----------------------------------------------------------------------*/
/* */
/* XfeManager class methods */
/* */
/*----------------------------------------------------------------------*/
static void PreferredGeometry (Widget,Dimension *,Dimension *);
static Boolean AcceptStaticChild (Widget);
static Boolean InsertStaticChild (Widget);
static Boolean DeleteStaticChild (Widget);
static void LayoutComponents (Widget);
static void LayoutStaticChildren (Widget);
static void DrawComponents (Widget,XEvent *,Region,XRectangle *);
static Widget SubTitleCreate (Widget);
static Widget TitleCreate (Widget);
/*----------------------------------------------------------------------*/
/* */
/* XfePrefPanel resources */
/* */
/*----------------------------------------------------------------------*/
static XtResource resources[] =
{
/* Color resources */
{
XmNtitleBackground,
XmCTitleBackground,
XmRPixel,
sizeof(Pixel),
XtOffsetOf(XfePrefPanelRec , xfe_pref_panel . title_background),
XmRCallProc,
(XtPointer) _XfeCallProcCopyForeground
},
{
XmNtitleForeground,
XmCTitleForeground,
XmRPixel,
sizeof(Pixel),
XtOffsetOf(XfePrefPanelRec , xfe_pref_panel . title_foreground),
XmRCallProc,
(XtPointer) _XfeCallProcCopyBackground
},
/* i18n resources */
{
XmNtitleDirection,
XmCTitleDirection,
XmRStringDirection,
sizeof(unsigned char),
XtOffsetOf(XfePrefPanelRec , xfe_pref_panel . title_direction),
XmRImmediate,
(XtPointer) XmSTRING_DIRECTION_L_TO_R
},
{
XmNtitleSpacing,
XmCTitleSpacing,
XmRHorizontalDimension,
sizeof(Dimension),
XtOffsetOf(XfePrefPanelRec , xfe_pref_panel . title_spacing),
XmRImmediate,
(XtPointer) 20
},
/* Title resources */
{
XmNtitle,
XmCReadOnly,
XmRWidget,
sizeof(Widget),
XtOffsetOf(XfePrefPanelRec , xfe_pref_panel . title),
XmRImmediate,
(XtPointer) NULL
},
{
XmNtitleAlignment,
XmCTitleAlignment,
XmRAlignment,
sizeof(unsigned char),
XtOffsetOf(XfePrefPanelRec , xfe_pref_panel . title_alignment),
XmRImmediate,
(XtPointer) XmALIGNMENT_BEGINNING
},
{
XmNtitleFontList,
XmCTitleFontList,
XmRFontList,
sizeof(XmFontList),
XtOffsetOf(XfePrefPanelRec , xfe_pref_panel . title_font_list),
XmRCallProc,
(XtPointer) _XfeCallProcDefaultLabelFontList
},
{
XmNtitleString,
XmCTitleString,
XmRXmString,
sizeof(XmString),
XtOffsetOf(XfePrefPanelRec , xfe_pref_panel . title_string),
XmRImmediate,
(XtPointer) NULL
},
/* Sub title resources */
{
XmNsubTitle,
XmCReadOnly,
XmRWidget,
sizeof(Widget),
XtOffsetOf(XfePrefPanelRec , xfe_pref_panel . sub_title),
XmRImmediate,
(XtPointer) NULL
},
{
XmNsubTitleAlignment,
XmCSubTitleAlignment,
XmRAlignment,
sizeof(unsigned char),
XtOffsetOf(XfePrefPanelRec , xfe_pref_panel . sub_title_alignment),
XmRImmediate,
(XtPointer) XmALIGNMENT_END
},
{
XmNsubTitleFontList,
XmCSubTitleFontList,
XmRFontList,
sizeof(XmFontList),
XtOffsetOf(XfePrefPanelRec , xfe_pref_panel . sub_title_font_list),
XmRCallProc,
(XtPointer) _XfeCallProcDefaultLabelFontList
},
{
XmNsubTitleString,
XmCSubTitleString,
XmRXmString,
sizeof(XmString),
XtOffsetOf(XfePrefPanelRec , xfe_pref_panel . sub_title_string),
XmRImmediate,
(XtPointer) NULL
},
/* Widget names */
{
XmNtitleWidgetName,
XmCReadOnly,
XmRString,
sizeof(String),
XtOffsetOf(XfePrefPanelRec , xfe_pref_panel . title_widget_name),
XmRString,
"PrefPanelTitle"
},
{
XmNsubTitleWidgetName,
XmCReadOnly,
XmRString,
sizeof(String),
XtOffsetOf(XfePrefPanelRec , xfe_pref_panel . sub_title_widget_name),
XmRString,
"PrefPanelSubTitle"
},
};
/*----------------------------------------------------------------------*/
/* */
/* XfePrefPanel synthetic resources */
/* */
/*----------------------------------------------------------------------*/
static XmSyntheticResource synthetic_resources[] =
{
{
XmNtitleSpacing,
sizeof(Dimension),
XtOffsetOf(XfePrefPanelRec , xfe_pref_panel . title_spacing),
_XmFromHorizontalPixels,
_XmToHorizontalPixels
},
};
/*----------------------------------------------------------------------*/
/* */
/* Widget Class Record Initialization */
/* */
/*----------------------------------------------------------------------*/
_XFE_WIDGET_CLASS_RECORD(prefpanel,PrefPanel) =
{
{
(WidgetClass) &xfeManagerClassRec, /* superclass */
"XfePrefPanel", /* class_name */
sizeof(XfePrefPanelRec), /* widget_size */
NULL, /* class_initialize */
NULL, /* class_part_initialize*/
FALSE, /* class_inited */
Initialize, /* initialize */
NULL, /* initialize_hook */
XtInheritRealize, /* realize */
NULL, /* actions */
0, /* num_actions */
resources, /* resources */
XtNumber(resources), /* num_resources */
NULLQUARK, /* xrm_class */
TRUE, /* compress_motion */
XtExposeCompressMaximal, /* compress_exposure */
TRUE, /* compress_enterleave */
FALSE, /* visible_interest */
Destroy, /* destroy */
XtInheritResize, /* resize */
XtInheritExpose, /* expose */
SetValues, /* set_values */
NULL, /* set_values_hook */
XtInheritSetValuesAlmost, /* set_values_almost */
GetValuesHook, /* get_values_hook */
NULL, /* access_focus */
XtVersion, /* version */
NULL, /* callback_private */
XtInheritTranslations, /* tm_table */
XtInheritQueryGeometry, /* query_geometry */
XtInheritDisplayAccelerator, /* display accelerator */
NULL, /* extension */
},
/* Composite Part */
{
XtInheritGeometryManager, /* geometry_manager */
XtInheritChangeManaged, /* change_managed */
XtInheritInsertChild, /* insert_static_child */
XtInheritDeleteChild, /* delete_static_child */
NULL /* extension */
},
/* Constraint Part */
{
NULL, /* syn resources */
0, /* num syn_resources */
sizeof(XfeManagerConstraintRec), /* constraint size */
NULL, /* init proc */
NULL, /* destroy proc */
NULL, /* set values proc */
NULL, /* extension */
},
/* XmManager Part */
{
XtInheritTranslations, /* tm_table */
synthetic_resources, /* syn resources */
XtNumber(synthetic_resources), /* num syn_resources */
NULL, /* syn_cont_resources */
0, /* num_syn_cont_resource*/
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 */
NULL, /* change_managed */
NULL, /* prepare_components */
LayoutComponents, /* layout_components */
NULL, /* draw_background */
XfeInheritDrawShadow, /* draw_shadow */
DrawComponents, /* draw_components */
NULL, /* extension */
},
/* XfePrefPanel Part */
{
NULL, /* extension */
},
};
/*----------------------------------------------------------------------*/
/* */
/* xfePrefPanelWidgetClass declaration. */
/* */
/*----------------------------------------------------------------------*/
_XFE_WIDGET_CLASS(prefpanel,PrefPanel);
/*----------------------------------------------------------------------*/
/* */
/* Core Class methods */
/* */
/*----------------------------------------------------------------------*/
static void
Initialize(Widget rw,Widget nw,ArgList args,Cardinal *nargs)
{
XfePrefPanelPart * pp = _XfePrefPanelPart(nw);
/* Create private components */
pp->title = TitleCreate(nw);
pp->sub_title = SubTitleCreate(nw);
/* Initialize private members */
/* Finish of initialization */
_XfeManagerChainInitialize(rw,nw,xfePrefPanelWidgetClass);
}
/*----------------------------------------------------------------------*/
static void
Destroy(Widget w)
{
/* XfePrefPanelPart * pp = _XfePrefPanelPart(w); */
}
/*----------------------------------------------------------------------*/
static Boolean
SetValues(Widget ow,Widget rw,Widget nw,ArgList args,Cardinal *nargs)
{
/* XfePrefPanelPart * np = _XfePrefPanelPart(nw); */
/* XfePrefPanelPart * op = _XfePrefPanelPart(ow); */
/* shadow_thickness */
if (_XfemShadowThickness(nw) != _XfemShadowThickness(ow))
{
_XfemConfigFlags(nw) |= XfeConfigLE;
}
return _XfeManagerChainSetValues(ow,rw,nw,xfePrefPanelWidgetClass);
}
/*----------------------------------------------------------------------*/
static void
GetValuesHook(Widget w,ArgList args,Cardinal* nargs)
{
/* XfePrefPanelPart * pp = _XfePrefPanelPart(w); */
Cardinal i;
for (i = 0; i < *nargs; i++)
{
#if 0
/* label_string */
if (strcmp(args[i].name,XmNlabelString) == 0)
{
*((XtArgVal *) args[i].value) =
(XtArgVal) XmStringCopy(lp->label_string);
}
/* font_list */
else if (strcmp(args[i].name,XmNfontList) == 0)
{
*((XtArgVal *) args[i].value) =
(XtArgVal) XmFontListCopy(lp->font_list);
}
#endif
}
}
/*----------------------------------------------------------------------*/
/*----------------------------------------------------------------------*/
/* */
/* XfeManager class methods */
/* */
/*----------------------------------------------------------------------*/
static void
PreferredGeometry(Widget w,Dimension * width,Dimension * height)
{
/* XfePrefPanelPart * pp = _XfePrefPanelPart(w); */
}
/*----------------------------------------------------------------------*/
static Boolean
AcceptStaticChild(Widget child)
{
return True;
}
/*----------------------------------------------------------------------*/
static Boolean
InsertStaticChild(Widget child)
{
/* Widget w = XtParent(child); */
/* XfePrefPanelPart * pp = _XfePrefPanelPart(w); */
return True;
}
/*----------------------------------------------------------------------*/
static Boolean
DeleteStaticChild(Widget child)
{
/* Widget w = XtParent(child); */
/* XfePrefPanelPart * pp = _XfePrefPanelPart(w); */
return True;
}
/*----------------------------------------------------------------------*/
static void
LayoutComponents(Widget w)
{
XfePrefPanelPart * pp = _XfePrefPanelPart(w);
int title_x;
int sub_title_x;
int title_width = 0;
int sub_title_width = 0;
int max_height = 0;
Widget title =
_XfeChildIsShown(pp->title) ? pp->title : NULL;
Widget sub_title =
_XfeChildIsShown(pp->sub_title) ? pp->sub_title : NULL;
/* Determine the max height */
if (title)
{
max_height = _XfeHeight(title);
}
if (sub_title)
{
max_height = XfeMax(max_height,_XfeHeight(sub_title));
}
/* Left to right */
if (pp->title_direction == XmSTRING_DIRECTION_L_TO_R)
{
/* Configure the title */
if (title)
{
title_x = _XfemBoundaryX(w);
title_width = _XfeWidth(title);
printf("title_width = %d\n",title_width);
}
/* Configure the sub title */
if (sub_title)
{
sub_title_width = _XfeWidth(sub_title);
sub_title_x =
_XfeWidth(w) -
_XfemOffsetRight(w) -
sub_title_width;
}
}
/* Right to left */
else if (pp->title_direction == XmSTRING_DIRECTION_R_TO_L)
{
/* Configure the title */
if (title)
{
title_x = _XfeWidth(w) - _XfemOffsetRight(w) - _XfeWidth(title);
title_width = _XfeWidth(title);
}
/* Configure the sub title */
if (sub_title)
{
sub_title_x = _XfemBoundaryX(w);
sub_title_width = title_x - sub_title_x;
}
}
else
{
_XfeWarning(w,MESSAGE2);
}
if (title_width > 0)
{
_XfeConfigureWidget(title,
title_x,
_XfemBoundaryY(w),
title_width,
max_height);
}
if (sub_title_width > 0)
{
_XfeConfigureWidget(sub_title,
sub_title_x,
_XfemBoundaryY(w),
sub_title_width,
max_height);
}
}
/*----------------------------------------------------------------------*/
static void
LayoutStaticChildren(Widget w)
{
/* XfePrefPanelPart * pp = _XfePrefPanelPart(w); */
}
/*----------------------------------------------------------------------*/
static void
DrawComponents(Widget w,XEvent * event,Region region,XRectangle * clip_rect)
{
/* XfePrefPanelPart * pp = _XfePrefPanelPart(w); */
}
/*----------------------------------------------------------------------*/
static Widget
TitleCreate(Widget w)
{
XfePrefPanelPart * pp = _XfePrefPanelPart(w);
Widget title = NULL;
Arg av[20];
Cardinal ac = 0;
XtSetArg(av[ac],XmNbackground, pp->title_background); ac++;
XtSetArg(av[ac],XmNforeground, pp->title_foreground); ac++;
XtSetArg(av[ac],XmNshadowThickness, 0); ac++;
XtSetArg(av[ac],XmNstringDirection, pp->title_direction); ac++;
XtSetArg(av[ac],XmNalignment, pp->title_alignment); ac++;
if (pp->title_font_list != NULL)
{
XtSetArg(av[ac],XmNfontList, pp->title_font_list); ac++;
}
title = XtCreateManagedWidget(pp->title_widget_name,
xmLabelWidgetClass,
w,
av,ac);
return title;
}
/*----------------------------------------------------------------------*/
static Widget
SubTitleCreate(Widget w)
{
XfePrefPanelPart * pp = _XfePrefPanelPart(w);
Widget sub_title = NULL;
Arg av[20];
Cardinal ac = 0;
XtSetArg(av[ac],XmNbackground, pp->title_background); ac++;
XtSetArg(av[ac],XmNforeground, pp->title_foreground); ac++;
XtSetArg(av[ac],XmNshadowThickness, 0); ac++;
XtSetArg(av[ac],XmNstringDirection, pp->title_direction); ac++;
XtSetArg(av[ac],XmNalignment, pp->sub_title_alignment); ac++;
if (pp->sub_title_font_list != NULL)
{
XtSetArg(av[ac],XmNfontList, pp->sub_title_font_list); ac++;
}
sub_title = XtCreateManagedWidget(pp->sub_title_widget_name,
xmLabelWidgetClass,
w,
av,ac);
return sub_title;
}
/*----------------------------------------------------------------------*/
/*----------------------------------------------------------------------*/
/* */
/* XfePrefPanel Public Methods */
/* */
/*----------------------------------------------------------------------*/
/* extern */ Widget
XfeCreatePrefPanel(Widget pw,char * name,Arg * av,Cardinal ac)
{
return XtCreateWidget(name,xfePrefPanelWidgetClass,pw,av,ac);
}
/*----------------------------------------------------------------------*/

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

@ -0,0 +1,85 @@
/* -*- 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/PrefPanel.h> */
/* Description: XfePrefPanel widget public header file. */
/* Author: Ramiro Estrugo <ramiro@netscape.com> */
/* */
/*----------------------------------------------------------------------*/
#ifndef _XfePrefPanel_h_ /* start PrefPanel.h */
#define _XfePrefPanel_h_
#include <Xfe/Manager.h>
#include <Xfe/PrefGroup.h>
XFE_BEGIN_CPLUSPLUS_PROTECTION
/*----------------------------------------------------------------------*/
/* */
/* XfePrefGroup resource names */
/* */
/*----------------------------------------------------------------------*/
#define XmNsubTitle "subTitle"
#define XmNsubTitleAlignment "subTitleAlignment"
#define XmNsubTitleFontList "subTitleFontList"
#define XmNsubTitleString "subTitleString"
#define XmNtitleBackground "titleBackground"
#define XmNtitleForeground "titleForeground"
#define XmNsubTitleWidgetName "subTitleWidgetName"
#define XmCSubTitleAlignment "SubTitleAlignment"
#define XmCSubTitleFontList "SubTitleFontList"
#define XmCSubTitleString "SubTitleString"
#define XmCTitleBackground "TitleBackground"
#define XmCTitleForeground "TitleForeground"
/*----------------------------------------------------------------------*/
/* */
/* XfePrefPanel class names */
/* */
/*----------------------------------------------------------------------*/
externalref WidgetClass xfePrefPanelWidgetClass;
typedef struct _XfePrefPanelClassRec * XfePrefPanelWidgetClass;
typedef struct _XfePrefPanelRec * XfePrefPanelWidget;
/*----------------------------------------------------------------------*/
/* */
/* XfePrefPanel subclass test macro */
/* */
/*----------------------------------------------------------------------*/
#define XfeIsPrefPanel(w) XtIsSubclass(w,xfePrefPanelWidgetClass)
/*----------------------------------------------------------------------*/
/* */
/* XfePrefPanel public methods */
/* */
/*----------------------------------------------------------------------*/
extern Widget
XfeCreatePrefPanel (Widget pw,
String name,
Arg * av,
Cardinal ac);
/*----------------------------------------------------------------------*/
XFE_END_CPLUSPLUS_PROTECTION
#endif /* end PrefPanel.h */

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

@ -0,0 +1,70 @@
/* -*- 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/PrefPanelInfo.c> */
/* Description: Preference panel info object source. */
/* Author: Ramiro Estrugo <ramiro@netscape.com> */
/* */
/*----------------------------------------------------------------------*/
#include <Xfe/PrefPanelInfoP.h>
/*----------------------------------------------------------------------*/
/* */
/* Construct */
/* */
/*----------------------------------------------------------------------*/
/* extern */ XfePrefPanelInfo
XfePrefPanelInfoConstruct(String panel_name)
{
XfePrefPanelInfoRec * panel_info = NULL;
assert( panel_name != NULL );
panel_info = (XfePrefPanelInfo) XtMalloc(sizeof(XfePrefPanelInfoRec) * 1);
panel_info->panel_name = (String) XtNewString(panel_name);
panel_info->panel_widget = NULL;
panel_info->sub_panel_list = NULL;
return panel_info;
}
/*----------------------------------------------------------------------*/
/* extern */ void
XfePrefPanelInfoDestroy(XfePrefPanelInfo panel_info)
{
assert( panel_info != NULL );
if (panel_info->panel_name != NULL)
{
XtFree(panel_info->panel_name);
}
XtFree((char *) panel_info);
}
/*----------------------------------------------------------------------*/
/* extern */ String
XfePrefPanelInfoGetName(XfePrefPanelInfo panel_info)
{
assert( panel_info != NULL );
return panel_info->panel_name;
}
/*----------------------------------------------------------------------*/

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

@ -0,0 +1,55 @@
/* -*- 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/_XfePrefPanelInfoP_h_.h> */
/* Description: Preference panel info object header. */
/* Author: Ramiro Estrugo <ramiro@netscape.com> */
/* */
/*----------------------------------------------------------------------*/
#ifndef _XfePrefPanelInfo_h_ /* start PrefPanelInfo.h*/
#define _XfePrefPanelInfo_h_
#include <Xfe/Xfe.h>
XFE_BEGIN_CPLUSPLUS_PROTECTION
/*----------------------------------------------------------------------*/
/* */
/* XfePref opaque types */
/* */
/*----------------------------------------------------------------------*/
typedef struct _XfePrefPanelInfoRec * XfePrefPanelInfo;
/*----------------------------------------------------------------------*/
extern XfePrefPanelInfo
XfePrefPanelInfoConstruct (String panel_name);
/*----------------------------------------------------------------------*/
extern void
XfePrefPanelInfoDestroy (XfePrefPanelInfo panel_info);
/*----------------------------------------------------------------------*/
extern String
XfePrefPanelInfoGetName (XfePrefPanelInfo panel_info);
/*----------------------------------------------------------------------*/
XFE_END_CPLUSPLUS_PROTECTION
#endif /* end PrefPanelInfo.h */

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

@ -0,0 +1,52 @@
/* -*- 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/PrefPanelInfoP.h> */
/* Description: Preference panel info object private header. */
/* Author: Ramiro Estrugo <ramiro@netscape.com> */
/* */
/*----------------------------------------------------------------------*/
#ifndef _XfePrefPanelInfoP_h_ /* start PrefPanelInfoP.h */
#define _XfePrefPanelInfoP_h_
#include <Xfe/XfeP.h>
#include <Xfe/PrefPanelInfo.h>
#include <Xfe/Linked.h>
XFE_BEGIN_CPLUSPLUS_PROTECTION
/*----------------------------------------------------------------------*/
/* */
/* XfePrefPanelInfo */
/* */
/*----------------------------------------------------------------------*/
typedef struct _XfePrefPanelInfoRec
{
String panel_name;
Widget panel_widget;
XfeLinked sub_panel_list;
} XfePrefPanelInfoRec;
/*----------------------------------------------------------------------*/
XFE_END_CPLUSPLUS_PROTECTION
#endif /* start PrefPanelInfoP.h */

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

@ -0,0 +1,124 @@
/* -*- 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/PrefPanelP.h> */
/* Description: XfePrefPanel widget private header file. */
/* Author: Ramiro Estrugo <ramiro@netscape.com> */
/* */
/*----------------------------------------------------------------------*/
#ifndef _XfePrefPanelP_h_ /* start PrefPanelP.h */
#define _XfePrefPanelP_h_
#include <Xfe/PrefPanel.h>
#include <Xfe/ManagerP.h>
XFE_BEGIN_CPLUSPLUS_PROTECTION
/*----------------------------------------------------------------------*/
/* */
/* XfePrefPanelClassPart */
/* */
/*----------------------------------------------------------------------*/
typedef struct
{
XtPointer extension; /* extension */
} XfePrefPanelClassPart;
/*----------------------------------------------------------------------*/
/* */
/* XfePrefPanelClassRec */
/* */
/*----------------------------------------------------------------------*/
typedef struct _XfePrefPanelClassRec
{
CoreClassPart core_class;
CompositeClassPart composite_class;
ConstraintClassPart constraint_class;
XmManagerClassPart manager_class;
XfeManagerClassPart xfe_manager_class;
XfePrefPanelClassPart xfe_pref_panel_class;
} XfePrefPanelClassRec;
externalref XfePrefPanelClassRec xfePrefPanelClassRec;
/*----------------------------------------------------------------------*/
/* */
/* XfePrefPanelPart */
/* */
/*----------------------------------------------------------------------*/
typedef struct _XfePrefPanelPart
{
/* Color resources */
Pixel title_background; /* Title background */
Pixel title_foreground; /* Title foreground */
/* i18n resources */
unsigned char title_direction; /* Title direction */
Dimension title_spacing; /* Title spacing */
/* Title resources */
Widget title; /* Title */
unsigned char title_alignment; /* Title alignment */
XmFontList title_font_list; /* Title font list */
XmString title_string; /* Title string */
Widget title_icon; /* Title string */
/* Sub title resources */
Widget sub_title; /* Sub title */
unsigned char sub_title_alignment; /* Sub title alignment */
XmString sub_title_string; /* Sub title string */
XmFontList sub_title_font_list; /* Sub title font list */
/* Widget names */
String title_widget_name; /* Title widget name */
String sub_title_widget_name; /* Sub title widget name*/
/* Private data -- Dont even look past this comment -- */
} XfePrefPanelPart;
/*----------------------------------------------------------------------*/
/* */
/* XfePrefPanelRec */
/* */
/*----------------------------------------------------------------------*/
typedef struct _XfePrefPanelRec
{
CorePart core;
CompositePart composite;
ConstraintPart constraint;
XmManagerPart manager;
XfeManagerPart xfe_manager;
XfePrefPanelPart xfe_pref_panel;
} XfePrefPanelRec;
/*----------------------------------------------------------------------*/
/* */
/* XfePrefPanelPart Access Macro */
/* */
/*----------------------------------------------------------------------*/
#define _XfePrefPanelPart(w) &(((XfePrefPanelWidget) w) -> xfe_pref_panel)
XFE_END_CPLUSPLUS_PROTECTION
#endif /* end PrefPanelP.h */

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

@ -0,0 +1,806 @@
/* -*- 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/PrefView.c> */
/* Description: XfePrefView widget source. */
/* Author: Ramiro Estrugo <ramiro@netscape.com> */
/* */
/*----------------------------------------------------------------------*/
#include <stdio.h>
#include <Xfe/PrefViewP.h>
/* Possible children classes */
#include <Xfe/Label.h>
#include <Xfe/Button.h>
#include <Xfe/Cascade.h>
#include <XmL/Tree.h>
#define MESSAGE1 "Widget is not an XfePrefView."
#define MESSAGE2 "XmNpanelTree is a read-only resource."
#define MESSAGE3 "XmNprefInfoList is a read-only resource."
#define TREE_NAME "PrefTree"
static void whack_tree(Widget tree);
/*----------------------------------------------------------------------*/
/* */
/* Core class methods */
/* */
/*----------------------------------------------------------------------*/
static void Initialize (Widget,Widget,ArgList,Cardinal *);
static void Destroy (Widget);
static Boolean SetValues (Widget,Widget,Widget,ArgList,Cardinal *);
static void GetValuesHook (Widget,ArgList,Cardinal *);
/*----------------------------------------------------------------------*/
/* */
/* Constraint class methods */
/* */
/*----------------------------------------------------------------------*/
static void ConstraintInitialize(Widget,Widget,ArgList,Cardinal *);
static Boolean ConstraintSetValues (Widget,Widget,Widget,ArgList,Cardinal *);
static void ConstraintDestroy (Widget);
/*----------------------------------------------------------------------*/
/* */
/* XfeManager class methods */
/* */
/*----------------------------------------------------------------------*/
static void PreferredGeometry (Widget,Dimension *,Dimension *);
static Boolean AcceptStaticChild (Widget);
static Boolean InsertStaticChild (Widget);
static Boolean DeleteStaticChild (Widget);
static void LayoutComponents (Widget);
static void LayoutStaticChildren (Widget);
static void DrawComponents (Widget,XEvent *,Region,XRectangle *);
/*----------------------------------------------------------------------*/
/* */
/* XfePrefView action procedures */
/* */
/*----------------------------------------------------------------------*/
static void BtnUp (Widget,XEvent *,char **,Cardinal *);
static void BtnDown (Widget,XEvent *,char **,Cardinal *);
/*----------------------------------------------------------------------*/
/* */
/* Tree functions */
/* */
/*----------------------------------------------------------------------*/
static void TreeCreate (Widget);
/*----------------------------------------------------------------------*/
/* */
/* Panel list/info functions */
/* */
/*----------------------------------------------------------------------*/
static void PanelInfoFree (XtPointer,XtPointer);
static void PanelListFree (Widget);
/*----------------------------------------------------------------------*/
/* */
/* Panel tree callbacks */
/* */
/*----------------------------------------------------------------------*/
static void TreeSelectCB (Widget,XtPointer,XtPointer);
/*----------------------------------------------------------------------*/
/* */
/* XfePrefView resources */
/* */
/*----------------------------------------------------------------------*/
static const XtResource resources[] =
{
/* Tree resources */
{
XmNpanelTree,
XmCReadOnly,
XmRWidget,
sizeof(Widget),
XtOffsetOf(XfePrefViewRec , xfe_pref_view . panel_tree),
XmRImmediate,
(XtPointer) NULL
},
/* Panel info resources */
{
XmNpanelInfoList,
XmCPanelInfoList,
XmRLinked,
sizeof(XfeLinked),
XtOffsetOf(XfePrefViewRec , xfe_pref_view . panel_info_list),
XmRImmediate,
(XtPointer) NULL
},
};
/*----------------------------------------------------------------------*/
/* */
/* XfePref synthetic resources */
/* */
/*----------------------------------------------------------------------*/
static const XmSyntheticResource syn_resources[] =
{
{
XmNspacing,
sizeof(Dimension),
XtOffsetOf(XfePrefViewRec , xfe_pref_view . spacing),
_XmFromHorizontalPixels,
_XmToHorizontalPixels
},
};
/*----------------------------------------------------------------------*/
/* */
/* XfePrefView constraint resources */
/* */
/*----------------------------------------------------------------------*/
static const XtResource constraint_resources[] =
{
{
XmNpanelTitle,
XmCPanelTitle,
XmRXmString,
sizeof(XmString),
XtOffsetOf(XfePrefViewConstraintRec , xfe_pref_view . panel_title),
XmRImmediate,
(XtPointer) NULL
},
{
XmNpanelSubTitle,
XmCPanelSubTitle,
XmRXmString,
sizeof(XmString),
XtOffsetOf(XfePrefViewConstraintRec , xfe_pref_view . panel_sub_title),
XmRImmediate,
(XtPointer) NULL
},
{
XmNnumGroups,
XmCNumGroups,
XmRCardinal,
sizeof(Cardinal),
XtOffsetOf(XfePrefViewConstraintRec , xfe_pref_view . num_groups),
XmRImmediate,
(XtPointer) 0
},
};
/*----------------------------------------------------------------------*/
/* */
/* XfePrefView actions */
/* */
/*----------------------------------------------------------------------*/
static XtActionsRec actions[] =
{
{ "BtnDown", BtnDown },
{ "BtnUp", BtnUp },
};
/*----------------------------------------------------------------------*/
/* */
/* Widget Class Record Initialization */
/* */
/*----------------------------------------------------------------------*/
_XFE_WIDGET_CLASS_RECORD(prefview,PrefView) =
{
{
(WidgetClass) &xfeManagerClassRec, /* superclass */
"XfePrefView", /* class_name */
sizeof(XfePrefViewRec), /* widget_size */
NULL, /* class_initialize */
NULL, /* class_part_initialize*/
FALSE, /* class_inited */
Initialize, /* initialize */
NULL, /* initialize_hook */
XtInheritRealize, /* realize */
actions, /* actions */
XtNumber(actions), /* num_actions */
(XtResource *) resources, /* resources */
XtNumber(resources), /* num_resources */
NULLQUARK, /* xrm_class */
TRUE, /* compress_motion */
XtExposeCompressMaximal, /* compress_exposure */
TRUE, /* compress_enterleave */
FALSE, /* visible_interest */
Destroy, /* destroy */
XtInheritResize, /* resize */
XtInheritExpose, /* expose */
SetValues, /* set_values */
NULL, /* set_values_hook */
XtInheritSetValuesAlmost, /* set_values_almost */
GetValuesHook, /* get_values_hook */
NULL, /* access_focus */
XtVersion, /* version */
NULL, /* callback_private */
XtInheritTranslations, /* tm_table */
XtInheritQueryGeometry, /* query_geometry */
XtInheritDisplayAccelerator, /* display accelerator */
NULL, /* extension */
},
/* Composite Part */
{
XtInheritGeometryManager, /* geometry_manager */
XtInheritChangeManaged, /* change_managed */
XtInheritInsertChild, /* insert_child */
XtInheritDeleteChild, /* delete_child */
NULL /* extension */
},
/* Constraint Part */
{
(XtResource *) constraint_resources, /* constraint res */
XtNumber(constraint_resources), /* num constraint res */
sizeof(XfePrefViewConstraintRec), /* constraint size */
ConstraintInitialize, /* init proc */
ConstraintDestroy, /* destroy proc */
ConstraintSetValues, /* set values proc */
NULL, /* extension */
},
/* XmManager Part */
{
XtInheritTranslations, /* tm_table */
(XmSyntheticResource *) syn_resources, /* syn resources */
XtNumber(syn_resources), /* num syn_resources */
NULL, /* syn_cont_resources */
0, /* num_syn_cont_resource*/
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 */
NULL, /* change_managed */
NULL, /* prepare_components */
LayoutComponents, /* layout_components */
NULL, /* draw_background */
XfeInheritDrawShadow, /* draw_shadow */
DrawComponents, /* draw_components */
NULL, /* extension */
},
/* XfePrefView Part */
{
NULL, /* extension */
},
};
/*----------------------------------------------------------------------*/
/* */
/* xfePrefViewWidgetClass declaration. */
/* */
/*----------------------------------------------------------------------*/
_XFE_WIDGET_CLASS(prefview,PrefView);
/*----------------------------------------------------------------------*/
/* */
/* Core Class methods */
/* */
/*----------------------------------------------------------------------*/
static void
Initialize(Widget rw,Widget nw,ArgList args,Cardinal *nargs)
{
XfePrefViewPart * pp = _XfePrefViewPart(nw);
/* Create the tree */
TreeCreate(nw);
/* Construct the panel list */
pp->panel_info_list = XfeLinkedConstruct();
/* Finish of initialization */
_XfeManagerChainInitialize(rw,nw,xfePrefViewWidgetClass);
}
/*----------------------------------------------------------------------*/
static void
Destroy(Widget w)
{
/* XfePrefViewPart * pp = _XfePrefViewPart(w); */
PanelListFree(w);
}
/*----------------------------------------------------------------------*/
static Boolean
SetValues(Widget ow,Widget rw,Widget nw,ArgList args,Cardinal *nargs)
{
XfePrefViewPart * np = _XfePrefViewPart(nw);
XfePrefViewPart * op = _XfePrefViewPart(ow);
/* XmNpanelTree */
if (np->panel_tree != op->panel_tree)
{
np->panel_tree = op->panel_tree;
_XfeWarning(nw,MESSAGE2);
}
/* XmNpanelInfoList */
if (np->panel_info_list != op->panel_info_list)
{
np->panel_info_list = op->panel_info_list;
_XfeWarning(nw,MESSAGE3);
}
return _XfeManagerChainSetValues(ow,rw,nw,xfePrefViewWidgetClass);
}
/*----------------------------------------------------------------------*/
static void
GetValuesHook(Widget w,ArgList args,Cardinal* nargs)
{
/* XfePrefViewPart * pp = _XfePrefViewPart(w); */
Cardinal i;
for (i = 0; i < *nargs; i++)
{
#if 0
/* label_string */
if (strcmp(args[i].name,XmNlabelString) == 0)
{
*((XtArgVal *) args[i].value) =
(XtArgVal) XmStringCopy(lp->label_string);
}
/* font_list */
else if (strcmp(args[i].name,XmNfontList) == 0)
{
*((XtArgVal *) args[i].value) =
(XtArgVal) XmFontListCopy(lp->font_list);
}
#endif
}
}
/*----------------------------------------------------------------------*/
/*----------------------------------------------------------------------*/
/* */
/* Constraint class methods */
/* */
/*----------------------------------------------------------------------*/
static void
ConstraintInitialize(Widget rc,Widget nc,ArgList args,Cardinal *nargs)
{
/* Widget w = _XfeParent(nc); */
/* XfePrefViewPart * pp = _XfePrefViewPart(w); */
/* Finish constraint initialization */
_XfeConstraintChainInitialize(rc,nc,xfePrefViewWidgetClass);
}
/*----------------------------------------------------------------------*/
static void
ConstraintDestroy(Widget c)
{
/* Widget w = XtParent(c); */
/* XfePrefViewPart * pp = _XfePrefViewPart(w); */
}
/*----------------------------------------------------------------------*/
static Boolean
ConstraintSetValues(Widget oc,Widget rc,Widget nc,ArgList args,Cardinal *nargs)
{
/* Widget w = XtParent(nc); */
/* XfePrefViewPart * pp = _XfePrefViewPart(w); */
/* XfePrefViewConstraintPart * ncp = _XfePrefViewConstraintPart(nc); */
/* XfePrefViewConstraintPart * ocp = _XfePrefViewConstraintPart(oc); */
/* Finish constraint set values */
return _XfeConstraintChainSetValues(oc,rc,nc,xfePrefViewWidgetClass);
}
/*----------------------------------------------------------------------*/
/*----------------------------------------------------------------------*/
/* */
/* XfeManager class methods */
/* */
/*----------------------------------------------------------------------*/
static void
PreferredGeometry(Widget w,Dimension * width,Dimension * height)
{
/* XfePrefViewPart * pp = _XfePrefViewPart(w); */
}
/*----------------------------------------------------------------------*/
static Boolean
AcceptStaticChild(Widget child)
{
return True;
}
/*----------------------------------------------------------------------*/
static Boolean
InsertStaticChild(Widget child)
{
/* Widget w = XtParent(child); */
/* XfePrefViewPart * pp = _XfePrefViewPart(w); */
return True;
}
/*----------------------------------------------------------------------*/
static Boolean
DeleteStaticChild(Widget child)
{
/* Widget w = XtParent(child); */
/* XfePrefViewPart * pp = _XfePrefViewPart(w); */
return True;
}
/*----------------------------------------------------------------------*/
static void
LayoutComponents(Widget w)
{
XfePrefViewPart * pp = _XfePrefViewPart(w);
/* Configure the tree */
if (_XfeChildIsShown(pp->panel_tree))
{
Dimension width;
Dimension height;
_XfePreferredGeometry(pp->panel_tree,&width,&height);
/* Place the panel_tree on the left */
_XfeConfigureWidget(pp->panel_tree,
_XfemBoundaryX(w),
_XfemBoundaryY(w),
_XfeWidth(pp->panel_tree),
_XfemBoundaryHeight(w));
}
}
/*----------------------------------------------------------------------*/
static void
LayoutStaticChildren(Widget w)
{
/* XfePrefViewPart * pp = _XfePrefViewPart(w); */
}
/*----------------------------------------------------------------------*/
static void
DrawComponents(Widget w,XEvent * event,Region region,XRectangle * clip_rect)
{
/* XfePrefViewPart * pp = _XfePrefViewPart(w); */
}
/*----------------------------------------------------------------------*/
/*----------------------------------------------------------------------*/
/* */
/* Tree functions */
/* */
/*----------------------------------------------------------------------*/
static void
TreeCreate(Widget w)
{
XfePrefViewPart * pp = _XfePrefViewPart(w);
assert( pp->panel_tree == NULL );
/* Initialize private members */
pp->panel_tree =
XtVaCreateManagedWidget(TREE_NAME,
xmlTreeWidgetClass,
w,
XmNtopFixedMargin, 10,
XmNbottomFixedMargin, 10,
XmNleftFixedMargin, 10,
XmNrightFixedMargin, 10,
XmNshadowThickness, 0,
XmNignorePixmaps, True,
XmNiconSpacing, 0,
XmNhighlightThickness, 0,
XmNhorizontalSizePolicy, XmVARIABLE,
XmNselectionPolicy, XmSELECT_SINGLE_ROW,
/* XmNglobalPixmapWidth, 1, */
/* XmNglobalPixmapHeight, 1, */
XmNvisibleRows, 10,
XmNshadowThickness, 0,
XmNshadowThickness, 0,
/* XmNwidth, 250, */
NULL);
#if 0
XtVaSetValues(pp->panel_tree,
XmNcellDefaults, True,
XmNcellLeftBorderType, XmBORDER_NONE,
XmNcellRightBorderType, XmBORDER_NONE,
XmNcellTopBorderType, XmBORDER_NONE,
XmNcellBottomBorderType, XmBORDER_NONE,
NULL);
#endif
#if 0
XtVaSetValues(pp->panel_tree,
XmNconnectingLineColor, _XfeBackgroundPixel(pp->panel_tree),
NULL);
#endif
whack_tree(pp->panel_tree);
XtVaSetValues(pp->panel_tree,
/* XmNcellDefaults, True, */
/* XmNcolumn, 0, */
XmNcellType, XmICON_CELL,
NULL);
/* Add tree callbacks */
XtAddCallback(pp->panel_tree,XmNselectCallback,TreeSelectCB,(XtPointer) w);
}
/*----------------------------------------------------------------------*/
/*----------------------------------------------------------------------*/
/* */
/* XfePrefView action procedures */
/* */
/*----------------------------------------------------------------------*/
static void
BtnDown(Widget w,XEvent * event,char ** params,Cardinal * nparams)
{
/* XfePrefViewPart * pp = _XfePrefViewPart(w); */
}
/*----------------------------------------------------------------------*/
static void
BtnUp(Widget w,XEvent * event,char ** params,Cardinal * nparams)
{
/* XfePrefViewPart * pp = _XfePrefViewPart(w); */
}
/*----------------------------------------------------------------------*/
/*----------------------------------------------------------------------*/
/* */
/* Panel list/info functions */
/* */
/*----------------------------------------------------------------------*/
static void
PanelInfoFree(XtPointer item,XtPointer client_data)
{
XfePrefPanelInfo panel_info = (XfePrefPanelInfo) item;
/* Destroy the panel info if needed */
if (panel_info != NULL)
{
XfePrefPanelInfoDestroy(panel_info);
}
}
/*----------------------------------------------------------------------*/
static void
PanelListFree(Widget w)
{
XfePrefViewPart * pp = _XfePrefViewPart(w);
/* Destroy the panel list */
if (pp->panel_info_list != NULL)
{
XfeLinkedDestroy(pp->panel_info_list,PanelInfoFree,NULL);
}
pp->panel_info_list = NULL;
}
/*----------------------------------------------------------------------*/
/*----------------------------------------------------------------------*/
/* */
/* Panel tree callbacks */
/* */
/*----------------------------------------------------------------------*/
static void
TreeSelectCB(Widget tree,XtPointer client_data,XtPointer call_data)
{
Widget w = (Widget) client_data;
XfePrefViewPart * pp = _XfePrefViewPart(w);
XmLGridCallbackStruct * cbs = (XmLGridCallbackStruct *) call_data;
XmLGridRow row = NULL;
/* Make sure the cell has content */
if (cbs->rowType != XmCONTENT)
{
return;
}
row = XmLGridGetRow(pp->panel_tree,XmCONTENT,cbs->row);
printf("TreeSelectCB(%s,row = %d,col = %d)\n",
XtName(w),cbs->row,cbs->column);
}
/*----------------------------------------------------------------------*/
/*----------------------------------------------------------------------*/
/* */
/* XfePrefView Public Methods */
/* */
/*----------------------------------------------------------------------*/
/* extern */ Widget
XfeCreatePrefView(Widget pw,char * name,Arg * av,Cardinal ac)
{
return XtCreateWidget(name,xfePrefViewWidgetClass,pw,av,ac);
}
/*----------------------------------------------------------------------*/
/* extern */ Widget
XfePrefViewAddPanel(Widget w,
String panel_name,
XmString xm_panel_name,
Boolean has_sub_panels)
{
XfePrefViewPart * pp = _XfePrefViewPart(w);
Widget panel = NULL;
XfePrefPanelInfo panel_info = NULL;
Boolean need_to_free = False;
assert( _XfeIsAlive(w) );
assert( XfeIsPrefView(w) );
panel_info = XfePrefPanelInfoConstruct(panel_name);
XfeLinkedInsertAtTail(pp->panel_info_list,panel_info);
if (xm_panel_name == NULL)
{
xm_panel_name = XmStringCreateLtoR(panel_name,
XmFONTLIST_DEFAULT_TAG);
need_to_free = True;
}
XmLTreeAddRow(pp->panel_tree,
1,
has_sub_panels,
True,
XmLAST_POSITION,
XmUNSPECIFIED_PIXMAP,
XmUNSPECIFIED_PIXMAP,
xm_panel_name);
if (need_to_free)
{
XmStringFree(xm_panel_name);
}
/* Create the panel */
panel = XtVaCreateWidget("panel",
xfePrefPanelWidgetClass,
w,
XmNmanagerChildType, XmMANAGER_COMPONENT_CHILD,
NULL);
return panel;
}
/*----------------------------------------------------------------------*/
static Boolean
FindTestFunc(XtPointer item,XtPointer client_data)
{
XfePrefPanelInfo info = (XfePrefPanelInfo) item;
String target_panel_name = (String) client_data;
String test_panel_name;
test_panel_name = XfePrefPanelInfoGetName(info);
assert( test_panel_name != NULL );
return (strcmp(target_panel_name,test_panel_name) == 0);
}
/*----------------------------------------------------------------------*/
/* extern */ XfePrefPanelInfo
XfePaneViewStringtoPanelInfo(Widget w,String panel_name)
{
XfePrefViewPart * pp = _XfePrefViewPart(w);
assert( _XfeIsAlive(w) );
assert( XfeIsPrefView(w) );
assert( panel_name != NULL );
return (XfePrefPanelInfo) XfeLinkedFind(pp->panel_info_list,
FindTestFunc,
(XtPointer) panel_name);
}
/*----------------------------------------------------------------------*/
static void
add_row(Widget tree,
int row,
Boolean expands,
String str,
int pos)
{
XmString xmstr = XmStringCreateSimple(str);
XmLTreeAddRow(tree,
row,
expands,
True,
pos,
XmUNSPECIFIED_PIXMAP,
XmUNSPECIFIED_PIXMAP,
xmstr);
XmStringFree(xmstr);
}
static void
whack_tree(Widget tree)
{
XtVaSetValues(tree,
XmNlayoutFrozen, True,
NULL);
add_row(tree, 1, True , "Appearnace" , XmLAST_POSITION);
add_row(tree, 2, False, "Fonts" , XmLAST_POSITION);
add_row(tree, 2, False, "Colors" , XmLAST_POSITION);
add_row(tree, 1, True , "Navigator" , XmLAST_POSITION);
add_row(tree, 2, False, "Languages" , XmLAST_POSITION);
add_row(tree, 2, False, "Applications" , XmLAST_POSITION);
add_row(tree, 1, True , "Mail & Groups" , XmLAST_POSITION);
add_row(tree, 2, False, "Identity" , XmLAST_POSITION);
add_row(tree, 2, False, "Messages" , XmLAST_POSITION);
add_row(tree, 2, False, "Mail Server" , XmLAST_POSITION);
add_row(tree, 2, False, "Groups Server" , XmLAST_POSITION);
add_row(tree, 2, False, "Directory" , XmLAST_POSITION);
add_row(tree, 1, True , "Composer" , XmLAST_POSITION);
add_row(tree, 2, False, "New Page Colors" , XmLAST_POSITION);
add_row(tree, 2, False, "Publish" , XmLAST_POSITION);
add_row(tree, 3, False, "Row Three" , 3);
add_row(tree, 3, False, "Row Three" , 3);
add_row(tree, 4, False, "Row Three" , 3);
add_row(tree, 1, True , "Advanced" , XmLAST_POSITION);
add_row(tree, 2, False, "Cache" , XmLAST_POSITION);
add_row(tree, 2, False, "Proxies" , XmLAST_POSITION);
add_row(tree, 2, False, "Disk Space" , XmLAST_POSITION);
XtVaSetValues(tree,
XmNlayoutFrozen, False,
NULL);
}

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

@ -0,0 +1,93 @@
/* -*- 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/PrefView.h> */
/* Description: XfePrefView widget public header file. */
/* Author: Ramiro Estrugo <ramiro@netscape.com> */
/* */
/*----------------------------------------------------------------------*/
#ifndef _XfePrefView_h_ /* start PrefView.h */
#define _XfePrefView_h_
#include <Xfe/Manager.h>
#include <Xfe/PrefPanel.h>
#include <Xfe/PrefPanelInfo.h>
XFE_BEGIN_CPLUSPLUS_PROTECTION
/*----------------------------------------------------------------------*/
/* */
/* XfePrefView resource names */
/* */
/*----------------------------------------------------------------------*/
#define XmNnumGroups "numGroups"
#define XmNpanelInfoList "panelInfoList"
#define XmNpanelSubTitle "panelSubTitle"
#define XmNpanelTitle "panelTitle"
#define XmNpanelTree "panelTree"
#define XmCNumGroups "NumGroups"
#define XmCPanelInfoList "PanelInfoList"
#define XmCPanelSubTitle "PanelSubTitle"
#define XmCPanelTitle "PanelTitle"
/*----------------------------------------------------------------------*/
/* */
/* XfePrefView class names */
/* */
/*----------------------------------------------------------------------*/
externalref WidgetClass xfePrefViewWidgetClass;
typedef struct _XfePrefViewClassRec * XfePrefViewWidgetClass;
typedef struct _XfePrefViewRec * XfePrefViewWidget;
/*----------------------------------------------------------------------*/
/* */
/* XfePrefView subclass test macro */
/* */
/*----------------------------------------------------------------------*/
#define XfeIsPrefView(w) XtIsSubclass(w,xfePrefViewWidgetClass)
/*----------------------------------------------------------------------*/
/* */
/* XfePrefView public methods */
/* */
/*----------------------------------------------------------------------*/
extern Widget
XfeCreatePrefView (Widget pw,
String name,
Arg * av,
Cardinal ac);
/*----------------------------------------------------------------------*/
extern Widget
XfePrefViewAddPanel (Widget w,
String panel_name,
XmString xm_panel_name,
Boolean has_sub_panels);
/*----------------------------------------------------------------------*/
extern XfePrefPanelInfo
XfePaneViewStringtoPanelInfo (Widget w,
String panel_name);
/*----------------------------------------------------------------------*/
XFE_END_CPLUSPLUS_PROTECTION
#endif /* end PrefView.h */

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

@ -0,0 +1,143 @@
/* -*- 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/PrefViewP.h> */
/* Description: XfePrefView widget private header file. */
/* Author: Ramiro Estrugo <ramiro@netscape.com> */
/* */
/*----------------------------------------------------------------------*/
#ifndef _XfePrefViewP_h_ /* start PrefViewP.h */
#define _XfePrefViewP_h_
#include <Xfe/PrefView.h>
#include <Xfe/ManagerP.h>
#include <Xfe/Linked.h>
XFE_BEGIN_CPLUSPLUS_PROTECTION
/*----------------------------------------------------------------------*/
/* */
/* XfePrefViewClassPart */
/* */
/*----------------------------------------------------------------------*/
typedef struct
{
XtPointer extension; /* extension */
} XfePrefViewClassPart;
/*----------------------------------------------------------------------*/
/* */
/* XfePrefViewClassRec */
/* */
/*----------------------------------------------------------------------*/
typedef struct _XfePrefViewClassRec
{
CoreClassPart core_class;
CompositeClassPart composite_class;
ConstraintClassPart constraint_class;
XmManagerClassPart manager_class;
XfeManagerClassPart xfe_manager_class;
XfePrefViewClassPart xfe_pref_view_class;
} XfePrefViewClassRec;
externalref XfePrefViewClassRec xfePrefViewClassRec;
/*----------------------------------------------------------------------*/
/* */
/* XfePrefViewPart */
/* */
/*----------------------------------------------------------------------*/
typedef struct _XfePrefViewPart
{
/* Component Resources */
Widget panel_tree; /* Panel tree */
/* Panel resources */
XfeLinked panel_info_list; /* Panel info list */
Dimension spacing;
/* Private data -- Dont even look past this comment -- */
GC pref_GC; /* Pref GC */
XRectangle pref_rect; /* Pref rect */
} XfePrefViewPart;
/*----------------------------------------------------------------------*/
/* */
/* XfePrefViewRec */
/* */
/*----------------------------------------------------------------------*/
typedef struct _XfePrefViewRec
{
CorePart core;
CompositePart composite;
ConstraintPart constraint;
XmManagerPart manager;
XfeManagerPart xfe_manager;
XfePrefViewPart xfe_pref_view;
} XfePrefViewRec;
/*----------------------------------------------------------------------*/
/* */
/* XfePrefViewConstraintPart */
/* */
/*----------------------------------------------------------------------*/
typedef struct _XfePrefViewConstraintPart
{
XmString panel_title; /* Panel's title */
XmString panel_sub_title; /* Panel's sub title */
Cardinal num_groups; /* Num groups in panel */
} XfePrefViewConstraintPart;
/*----------------------------------------------------------------------*/
/* */
/* XfePrefViewConstraintRec */
/* */
/*----------------------------------------------------------------------*/
typedef struct _XfePrefViewConstraintRec
{
XmManagerConstraintPart manager;
XfeManagerConstraintPart xfe_manager;
XfePrefViewConstraintPart xfe_pref_view;
} XfePrefViewConstraintRec;
/*----------------------------------------------------------------------*/
/* */
/* XfePrefViewPart Access Macro */
/* */
/*----------------------------------------------------------------------*/
#define _XfePrefViewPart(w) &(((XfePrefViewWidget) w) -> xfe_pref_view)
/*----------------------------------------------------------------------*/
/* */
/* XfePrefViewPart child constraint part access macro */
/* */
/*----------------------------------------------------------------------*/
#define _XfePrefViewConstraintPart(w) \
(&(((XfePrefViewConstraintRec *) _XfeConstraints(w)) -> xfe_pref_view))
XFE_END_CPLUSPLUS_PROTECTION
#endif /* end PrefViewP.h */

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

@ -0,0 +1,48 @@
#! gmake
#
# 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.
#
DEPTH = ../../../../..
CSRCS = \
PrefGroupTest.c \
PrefPanelTest.c \
PrefViewTest.c \
$(NULL)
REQUIRES = \
XfeTest \
XfePref \
XfeToolBar \
XfeComboBox \
XfeBm \
XfeWidgets \
Microline
STATIC_PROGS = $(addprefix $(OBJDIR)/, $(CSRCS:.c=.static))
SHARED_PROGS = $(addprefix $(OBJDIR)/, $(CSRCS:.c=.shared))
include $(DEPTH)/config/rules.mk
include $(DEPTH)/cmd/xfe/XfeWidgets/XfeWidgets.mk
all:: $(STATIC_PROGS) $(SHARED_PROGS)
install:: $(STATIC_PROGS) $(SHARED_PROGS)
shared: $(SHARED_PROGS)
static: $(STATIC_PROGS)

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

@ -0,0 +1,64 @@
! -*- Mode: Fundamental; tab-width: 4; indent-tabs-mode: nil -*-
!
! 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.
PrefGroupTest*MainForm.width: 800
PrefGroupTest*MainForm.height: 400
PrefGroupTest*MainForm.background: Gray60
PrefGroupTest*MainForm.shadowThickness: 0
PrefGroupTest*MainForm.shadowType: shadow_in
PrefGroupTest*fontList: -*-helvetica-medium-r-*-*-*-120-*-*-*-*-iso8859-*
PrefGroupTest*labelFontList: -*-helvetica-medium-r-*-*-*-120-*-*-*-*-iso8859-*
PrefGroupTest*foreground: Black
PrefGroupTest*PrefGroup.bottomAttachment: attach_form
PrefGroupTest*PrefGroup.leftAttachment: attach_form
PrefGroupTest*PrefGroup.rightAttachment: attach_form
PrefGroupTest*PrefGroup.topAttachment: attach_form
PrefGroupTest*PrefGroup.bottomOffset: 10
PrefGroupTest*PrefGroup.leftOffset: 10
PrefGroupTest*PrefGroup.rightOffset: 10
PrefGroupTest*PrefGroup.topOffset: 10
PrefGroupTest*PrefGroup*background: Gray60
PrefGroupTest*PrefGroup.usePreferredWidth: false
PrefGroupTest*PrefGroup.usePreferredHeight: false
PrefGroupTest*PrefGroup.titleFontList: -*-helvetica-bold-r-*-*-*-120-*-*-*-*-iso8859-*
PrefGroupTest*PrefGroup.subTitleFontList: -*-helvetica-medium-r-*-*-*-100-*-*-*-*-iso8859-*
!PrefGroupTest*PrefGroup.titleDirection: string_direction_r_to_l
PrefGroupTest*PrefGroup.titleAlignment: alignment_beginning
PrefGroupTest*PrefGroup.subTitleAlignment: alignment_end
PrefGroupTest*PrefGroup.frameThickness: 3
PrefGroupTest*PrefGroup.frameType: shadow_etched_in
PrefGroupTest*PrefGroup.titleWidgetName: Caca
PrefGroupTest*PrefGroup.subTitleWidgetName: Vaca
!PrefGroupTest*PrefGroup*Caca*background: red
!PrefGroupTest*PrefGroupselectBackground: #FFFFCC
!PrefGroupTest*PrefGroup*selectForeground: Black
!PrefGroupTest*PrefGroup.background: red

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

@ -0,0 +1,51 @@
/* -*- 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: LabelTest.c */
/* Description: Test for XfeLabel widget. */
/* Author: Ramiro Estrugo <ramiro@netscape.com> */
/* */
/*----------------------------------------------------------------------*/
#include <Xfe/XfeTest.h>
#include <Xfe/PrefGroup.h>
/*----------------------------------------------------------------------*/
int
main(int argc,char *argv[])
{
Widget form;
Widget frame;
Widget pref_group;
XfeAppCreateSimple("PrefGroupTest",&argc,argv,"MainFrame",&frame,&form);
pref_group = XtVaCreateManagedWidget("PrefGroup",
xfePrefGroupWidgetClass,
form,
NULL);
XtPopup(frame,XtGrabNone);
XfeAppMainLoop();
return 0;
}
/*----------------------------------------------------------------------*/

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

@ -0,0 +1,64 @@
! -*- Mode: Fundamental; tab-width: 4; indent-tabs-mode: nil -*-
!
! 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.
PrefItemTest*MainForm.width: 800
PrefItemTest*MainForm.height: 400
PrefItemTest*MainForm.background: Gray60
PrefItemTest*MainForm.shadowThickness: 0
PrefItemTest*MainForm.shadowType: shadow_in
PrefItemTest*fontList: -*-helvetica-medium-r-*-*-*-120-*-*-*-*-iso8859-*
PrefItemTest*labelFontList: -*-helvetica-medium-r-*-*-*-120-*-*-*-*-iso8859-*
PrefItemTest*foreground: Black
PrefItemTest*PrefItem.bottomAttachment: attach_form
PrefItemTest*PrefItem.leftAttachment: attach_form
PrefItemTest*PrefItem.rightAttachment: attach_form
PrefItemTest*PrefItem.topAttachment: attach_form
PrefItemTest*PrefItem.bottomOffset: 10
PrefItemTest*PrefItem.leftOffset: 10
PrefItemTest*PrefItem.rightOffset: 10
PrefItemTest*PrefItem.topOffset: 10
PrefItemTest*PrefItem*background: Gray60
PrefItemTest*PrefItem.usePreferredWidth: false
PrefItemTest*PrefItem.usePreferredHeight: false
PrefItemTest*PrefItem.titleFontList: -*-helvetica-bold-r-*-*-*-120-*-*-*-*-iso8859-*
PrefItemTest*PrefItem.subTitleFontList: -*-helvetica-medium-r-*-*-*-100-*-*-*-*-iso8859-*
!PrefItemTest*PrefItem.titleDirection: string_direction_r_to_l
PrefItemTest*PrefItem.titleAlignment: alignment_beginning
PrefItemTest*PrefItem.subTitleAlignment: alignment_end
PrefItemTest*PrefItem.frameThickness: 3
PrefItemTest*PrefItem.frameType: shadow_etched_in
PrefItemTest*PrefItem.titleWidgetName: Caca
PrefItemTest*PrefItem.subTitleWidgetName: Vaca
!PrefItemTest*PrefItem*Caca*background: red
!PrefItemTest*PrefItemselectBackground: #FFFFCC
!PrefItemTest*PrefItem*selectForeground: Black
!PrefItemTest*PrefItem.background: red

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

@ -0,0 +1,51 @@
/* -*- 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: LabelTest.c */
/* Description: Test for XfeLabel widget. */
/* Author: Ramiro Estrugo <ramiro@netscape.com> */
/* */
/*----------------------------------------------------------------------*/
#include <Xfe/XfeTest.h>
#include <Xfe/PrefItem.h>
/*----------------------------------------------------------------------*/
int
main(int argc,char *argv[])
{
Widget form;
Widget frame;
Widget pref_item;
XfeAppCreateSimple("PrefItemTest",&argc,argv,"MainFrame",&frame,&form);
pref_item = XtVaCreateManagedWidget("PrefItem",
xfePrefItemWidgetClass,
form,
NULL);
XtPopup(frame,XtGrabNone);
XfeAppMainLoop();
return 0;
}
/*----------------------------------------------------------------------*/

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

@ -0,0 +1,64 @@
! -*- Mode: Fundamental; tab-width: 4; indent-tabs-mode: nil -*-
!
! 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.
PrefPanelTest*MainForm.width: 800
PrefPanelTest*MainForm.height: 400
PrefPanelTest*MainForm.background: Gray70
PrefPanelTest*MainForm.shadowThickness: 0
PrefPanelTest*MainForm.shadowType: shadow_in
PrefPanelTest*fontList: -*-helvetica-medium-r-*-*-*-120-*-*-*-*-iso8859-*
PrefPanelTest*labelFontList: -*-helvetica-medium-r-*-*-*-120-*-*-*-*-iso8859-*
PrefPanelTest*foreground: Black
PrefPanelTest*PrefPanel.bottomAttachment: attach_form
PrefPanelTest*PrefPanel.leftAttachment: attach_form
PrefPanelTest*PrefPanel.rightAttachment: attach_form
PrefPanelTest*PrefPanel.topAttachment: attach_form
PrefPanelTest*PrefPanel.bottomOffset: 10
PrefPanelTest*PrefPanel.leftOffset: 10
PrefPanelTest*PrefPanel.rightOffset: 10
PrefPanelTest*PrefPanel.topOffset: 10
PrefPanelTest*PrefPanel.background: Gray60
PrefPanelTest*PrefPanel.usePreferredWidth: false
PrefPanelTest*PrefPanel.usePreferredHeight: false
PrefPanelTest*PrefPanel.titleFontList: -*-helvetica-bold-r-*-*-*-120-*-*-*-*-iso8859-*
PrefPanelTest*PrefPanel.subTitleFontList: -*-helvetica-medium-r-*-*-*-100-*-*-*-*-iso8859-*
!PrefPanelTest*PrefPanel.titleDirection: string_direction_r_to_l
PrefPanelTest*PrefPanel.titleAlignment: alignment_beginning
PrefPanelTest*PrefPanel.subTitleAlignment: alignment_end
PrefPanelTest*PrefPanel.titleWidgetName: Caca
PrefPanelTest*PrefPanel.subTitleWidgetName: Vaca
PrefPanelTest*PrefPanel*Caca*background: red
PrefPanelTest*PrefPanel*Vaca*background: blue
PrefPanelTest*PrefPanelselectBackground: #FFFFCC
PrefPanelTest*PrefPanel*selectForeground: Black
!PrefPanelTest*PrefPanel.background: red

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

@ -0,0 +1,51 @@
/* -*- 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: PrefPanelTest.c */
/* Description: Test for XfePrefPanel widget. */
/* Author: Ramiro Estrugo <ramiro@netscape.com> */
/* */
/*----------------------------------------------------------------------*/
#include <Xfe/XfeTest.h>
#include <Xfe/PrefPanel.h>
/*----------------------------------------------------------------------*/
int
main(int argc,char *argv[])
{
Widget form;
Widget frame;
Widget pref_panel;
XfeAppCreateSimple("PrefPanelTest",&argc,argv,"MainFrame",&frame,&form);
pref_panel = XtVaCreateManagedWidget("PrefPanel",
xfePrefPanelWidgetClass,
form,
NULL);
XtPopup(frame,XtGrabNone);
XfeAppMainLoop();
return 0;
}
/*----------------------------------------------------------------------*/

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

@ -0,0 +1,48 @@
! -*- Mode: Fundamental; tab-width: 4; indent-tabs-mode: nil -*-
!
! 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.
PrefViewTest*MainForm.width: 800
PrefViewTest*MainForm.height: 600
PrefViewTest*MainForm.background: Gray70
PrefViewTest*MainForm.shadowThickness: 0
PrefViewTest*MainForm.shadowType: shadow_in
PrefViewTest*fontList: -*-helvetica-medium-r-*-*-*-120-*-*-*-*-iso8859-*
PrefViewTest*labelFontList: -*-helvetica-medium-r-*-*-*-120-*-*-*-*-iso8859-*
PrefViewTest*foreground: Black
PrefViewTest*PrefView.bottomAttachment: attach_form
PrefViewTest*PrefView.leftAttachment: attach_form
PrefViewTest*PrefView.rightAttachment: attach_form
PrefViewTest*PrefView.topAttachment: attach_form
PrefViewTest*PrefView.bottomOffset: 10
PrefViewTest*PrefView.leftOffset: 10
PrefViewTest*PrefView.rightOffset: 10
PrefViewTest*PrefView.topOffset: 10
PrefViewTest*PrefView.background: Gray60
PrefViewTest*PrefView.usePreferredWidth: false
PrefViewTest*PrefView.usePreferredHeight: false
PrefViewTest*PrefView*selectBackground: #FFFFCC
PrefViewTest*PrefView*selectForeground: Black

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

@ -0,0 +1,56 @@
/* -*- 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: prefViewTest.c */
/* Description: Test for XfeLabel widget. */
/* Author: Ramiro Estrugo <ramiro@netscape.com> */
/* */
/*----------------------------------------------------------------------*/
#include <Xfe/XfeTest.h>
#include <Xfe/PrefView.h>
/*----------------------------------------------------------------------*/
int
main(int argc,char *argv[])
{
Widget form;
Widget frame;
Widget pref_view;
XfeAppCreateSimple("PrefViewTest",&argc,argv,"MainFrame",&frame,&form);
pref_view = XtVaCreateManagedWidget("PrefView",
xfePrefViewWidgetClass,
form,
NULL);
#if 0
XfePrefViewAddPanel(pref_view,"Appearance",NULL,True);
XfePrefViewAddPanel(pref_view,"Navigator",NULL,True);
#endif
XtPopup(frame,XtGrabNone);
XfeAppMainLoop();
return 0;
}
/*----------------------------------------------------------------------*/

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

@ -54,9 +54,11 @@ ToolBarTest*ToolBar.spacing: 0
ToolBarTest*ToolBar.forceWidth: false
ToolBarTest*ToolBar.usePreferredWidth: true
ToolBarTest*ToolBar.usePreferredWidth: false
ToolBarTest*ToolBar.usePreferredHeight: true
ToolBarTest*ToolBar.maxNumRows: 20
!ToolBarTest*ToolBar.selectionPolicy: tool_bar_select_single
!ToolBarTest*ToolBar.selectionModifiers: Shift
ToolBarTest*ToolBar*editModifiers: Shift
@ -107,12 +109,11 @@ ToolBarTest*hsep.width: 20
ToolBarTest*Scale.leftAttachment: attach_form
ToolBarTest*Scale.topAttachment: attach_widget
ToolBarTest*Scale.bottomAttachment: attach_none
ToolBarTest*Scale.topAttachment: attach_none
ToolBarTest*Scale.bottomAttachment: attach_form
ToolBarTest*Scale.rightAttachment: attach_none
ToolBarTest*Scale.leftOffset: 5
ToolBarTest*Scale.topOffset: 50
ToolBarTest*Scale.topWidget: ToolBar
ToolBarTest*Scale.leftOffset: 5
ToolBarTest*Scale.bottomOffset: 5
ToolBarTest*Scale.orientation: horizontal