Add caption files.

This commit is contained in:
ramiro%netscape.com 1998-07-31 10:46:34 +00:00
parent 9f5be51af3
commit 0b4ccbc4ff
22 changed files with 2275 additions and 347 deletions

View File

@ -35,6 +35,7 @@ endif
ifdef eXFE_WIDGETS_BUILD_UNUSED
UNUSED_DIRS = \
XfeCaption \
XfeComboBox \
$(NULL)
endif

View File

@ -271,6 +271,7 @@
#define XmNtabOffset "TabOffset"
#define XmNtaskBar "taskBar"
#define XmNtaskBarDocked "taskBarDocked"
#define XmNtitleFontList "titleFontList"
#define XmNtoggleBehavior "toggleBehavior"
#define XmNtoolBar "toolBar"
#define XmNtoolBarPosition "toolBarPosition"
@ -450,6 +451,7 @@
#define XmCSubMenuLocation "SubMenuLocation"
#define XmCSwapThreshold "SwapThreshold"
#define XmCTaskBarDocked "TaskBarDocked"
#define XmCTitleFontList "TitleFontList"
#define XmCToggleBehavior "ToggleBehavior"
#define XmCToolBarPosition "ToolBarPosition"
#define XmCToolBarSelectionPolicy "ToolBarSelectionPolicy"

View File

@ -0,0 +1,994 @@
/* -*- 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/Caption.c> */
/* Description: XfeCaption widget source. */
/* Author: Ramiro Estrugo <ramiro@netscape.com> */
/* */
/*----------------------------------------------------------------------*/
#include <Xfe/CaptionP.h>
#include <Xfe/Button.h>
#include <Xm/RepType.h>
#define MESSAGE1 "Widget is not an XfeCaption."
#define MESSAGE2 "XmNtitleDirection is not XmSTRING_DIRECTION_L_TO_R or XmSTRING_DIRECTION_R_TO_L."
#define TITLE_NAME "CaptionTitle"
#define DEFAULT_SUB_TITLE_NAME "CaptionSubTitle"
#define DEFAULT_MAX_CHILD_WIDTH 65535
#define DEFAULT_MAX_CHILD_HEIGHT 65535
/*----------------------------------------------------------------------*/
/* */
/* Core class methods */
/* */
/*----------------------------------------------------------------------*/
static void ClassInitialize (void);
static void ClassPartInit (WidgetClass);
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 AcceptChild (Widget);
static Boolean InsertChild (Widget);
static Boolean DeleteChild (Widget);
static void ChangeManaged (Widget);
static void PrepareComponents (Widget,int);
static void LayoutComponents (Widget);
static void DrawComponents (Widget,XEvent *,Region,XRectangle *);
/*----------------------------------------------------------------------*/
/* */
/* XfeCaption action procedures */
/* */
/*----------------------------------------------------------------------*/
static void Activate (Widget,XEvent *,char **,Cardinal *);
/*----------------------------------------------------------------------*/
/* */
/* Title functions */
/* */
/*----------------------------------------------------------------------*/
static Widget TitleCreate (Widget);
/*----------------------------------------------------------------------*/
/* */
/* Title callbacks */
/* */
/*----------------------------------------------------------------------*/
static void TitleActivateCB (Widget,XtPointer,XtPointer);
/*----------------------------------------------------------------------*/
/* */
/* Layout functions */
/* */
/*----------------------------------------------------------------------*/
static void LayoutChildOnBottom (Widget);
static void LayoutChildOnLeft (Widget);
static void LayoutChildOnRight (Widget);
static void LayoutChildOnTop (Widget);
static void LayoutTitleOnly (Widget);
static void LayoutChildOnly (Widget);
/*----------------------------------------------------------------------*/
/* */
/* RepType registration functions */
/* */
/*----------------------------------------------------------------------*/
static void RegisterCaptionLayout (void);
static void RegisterCaptionHorizontalAlignment (void);
static void RegisterCaptionVerticalAlignment (void);
/*----------------------------------------------------------------------*/
/* */
/* XfeCaption resources */
/* */
/*----------------------------------------------------------------------*/
static XtResource resources[] =
{
/* Layout resources */
{
XmNcaptionLayout,
XmCCaptionLayout,
XmRCaptionLayout,
sizeof(unsigned char),
XtOffsetOf(XfeCaptionRec , xfe_caption . caption_layout),
XmRImmediate,
(XtPointer) XmCAPTION_CHILD_ON_RIGHT
},
{
XmNspacing,
XmCSpacing,
XmRHorizontalDimension,
sizeof(Dimension),
XtOffsetOf(XfeCaptionRec , xfe_caption . spacing),
XmRImmediate,
(XtPointer) 2
},
/* Title resources */
{
XmNtitle,
XmCReadOnly,
XmRWidget,
sizeof(Widget),
XtOffsetOf(XfeCaptionRec , xfe_caption . title),
XmRImmediate,
(XtPointer) NULL
},
{
XmNtitleHorizontalAlignment,
XmCCaptionHorizontalAlignment,
XmRCaptionHorizontalAlignment,
sizeof(unsigned char),
XtOffsetOf(XfeCaptionRec , xfe_caption . title_hor_alignment),
XmRImmediate,
(XtPointer) XmCAPTION_HORIZONTAL_ALIGNMENT_LEFT
},
{
XmNtitleVerticalAlignment,
XmCCaptionVerticalAlignment,
XmRCaptionVerticalAlignment,
sizeof(unsigned char),
XtOffsetOf(XfeCaptionRec , xfe_caption . title_ver_alignment),
XmRImmediate,
(XtPointer) XmCAPTION_VERTICAL_ALIGNMENT_CENTER
},
{
XmNtitleDirection,
XmCTitleDirection,
XmRStringDirection,
sizeof(unsigned char),
XtOffsetOf(XfeCaptionRec , xfe_caption . title_direction),
XmRImmediate,
(XtPointer) XmSTRING_DIRECTION_L_TO_R
},
{
XmNtitleFontList,
XmCTitleFontList,
XmRFontList,
sizeof(XmFontList),
XtOffsetOf(XfeCaptionRec , xfe_caption . title_font_list),
XmRCallProc,
(XtPointer) _XfeCallProcDefaultLabelFontList
},
{
XmNtitleString,
XmCTitleString,
XmRXmString,
sizeof(XmString),
XtOffsetOf(XfeCaptionRec , xfe_caption . title_string),
XmRImmediate,
(XtPointer) NULL
},
/* Child resources */
{
XmNchild,
XmCReadOnly,
XmRWidget,
sizeof(Widget),
XtOffsetOf(XfeCaptionRec , xfe_caption . child),
XmRImmediate,
(XtPointer) NULL
},
{
XmNchildHorizontalAlignment,
XmCCaptionHorizontalAlignment,
XmRCaptionHorizontalAlignment,
sizeof(unsigned char),
XtOffsetOf(XfeCaptionRec , xfe_caption . child_hor_alignment),
XmRImmediate,
(XtPointer) XmCAPTION_HORIZONTAL_ALIGNMENT_LEFT
},
{
XmNchildVerticalAlignment,
XmCCaptionVerticalAlignment,
XmRCaptionVerticalAlignment,
sizeof(unsigned char),
XtOffsetOf(XfeCaptionRec , xfe_caption . child_ver_alignment),
XmRImmediate,
(XtPointer) XmCAPTION_VERTICAL_ALIGNMENT_CENTER
},
{
XmNchildResize,
XmCChildResize,
XmRBoolean,
sizeof(Boolean),
XtOffsetOf(XfeCaptionRec , xfe_caption . child_resize),
XmRImmediate,
(XtPointer) False
},
/* Dimension resources */
{
XmNmaxChildHeight,
XmCMaxChildHeight,
XmRVerticalDimension,
sizeof(Dimension),
XtOffsetOf(XfeCaptionRec , xfe_caption . max_child_height),
XmRImmediate,
(XtPointer) DEFAULT_MAX_CHILD_HEIGHT
},
{
XmNmaxChildWidth,
XmCMaxChildWidth,
XmRHorizontalDimension,
sizeof(Dimension),
XtOffsetOf(XfeCaptionRec , xfe_caption . max_child_width),
XmRImmediate,
(XtPointer) DEFAULT_MAX_CHILD_WIDTH
},
};
/*----------------------------------------------------------------------*/
/* */
/* XfeCaption synthetic resources */
/* */
/*----------------------------------------------------------------------*/
static XmSyntheticResource synthetic_resources[] =
{
{
XmNmaxChildHeight,
sizeof(Dimension),
XtOffsetOf(XfeCaptionRec , xfe_caption . max_child_height),
_XmFromVerticalPixels,
_XmToVerticalPixels
},
{
XmNmaxChildWidth,
sizeof(Dimension),
XtOffsetOf(XfeCaptionRec , xfe_caption . max_child_width),
_XmFromHorizontalPixels,
_XmToHorizontalPixels
},
{
XmNspacing,
sizeof(Dimension),
XtOffsetOf(XfeCaptionRec , xfe_caption . spacing),
_XmFromHorizontalPixels,
_XmToHorizontalPixels
},
};
/*----------------------------------------------------------------------*/
/* */
/* XfeCaption extra translations */
/* */
/*----------------------------------------------------------------------*/
/* extern */ char _XfeCaptionExtraTranslations[] ="\
<BtnUp>: Activate()\n\
<BtnDown>: Activate()";
/*----------------------------------------------------------------------*/
/* */
/* XfeCaption actions */
/* */
/*----------------------------------------------------------------------*/
static XtActionsRec actions[] =
{
{ "Activate", Activate },
};
/*----------------------------------------------------------------------*/
/* */
/* Widget Class Record Initialization */
/* */
/*----------------------------------------------------------------------*/
_XFE_WIDGET_CLASS_RECORD(caption,Caption) =
{
{
(WidgetClass) &xfeManagerClassRec, /* superclass */
"XfeCaption", /* class_name */
sizeof(XfeCaptionRec), /* widget_size */
ClassInitialize, /* class_initialize */
ClassPartInit, /* class_part_initialize*/
FALSE, /* class_inited */
Initialize, /* initialize */
NULL, /* initialize_hook */
XtInheritRealize, /* realize */
actions, /* actions */
XtNumber(actions), /* 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 */
XfeInheritMinimumGeometry, /* minimum_geometry */
XfeInheritUpdateRect, /* update_rect */
AcceptChild, /* accept_child */
InsertChild, /* insert_child */
DeleteChild, /* delete_child */
ChangeManaged, /* change_managed */
PrepareComponents, /* prepare_components */
LayoutComponents, /* layout_components */
NULL, /* layout_children */
NULL, /* draw_background */
XfeInheritDrawShadow, /* draw_shadow */
DrawComponents, /* draw_components */
False, /* count_layable_children*/
NULL, /* child_is_layable */
NULL, /* extension */
},
/* XfeCaption Part */
{
NULL, /* activate */
NULL, /* extension */
},
};
/*----------------------------------------------------------------------*/
/* */
/* xfeCaptionWidgetClass declaration. */
/* */
/*----------------------------------------------------------------------*/
_XFE_WIDGET_CLASS(caption,Caption);
/*----------------------------------------------------------------------*/
/* */
/* Core Class methods */
/* */
/*----------------------------------------------------------------------*/
static void
ClassInitialize()
{
/* Register XfeCaption Representation Types */
RegisterCaptionLayout();
RegisterCaptionHorizontalAlignment();
RegisterCaptionVerticalAlignment();
}
/*----------------------------------------------------------------------*/
static void
ClassPartInit(WidgetClass wc)
{
XfeCaptionWidgetClass cc = (XfeCaptionWidgetClass) wc;
XfeCaptionWidgetClass sc = (XfeCaptionWidgetClass) wc->core_class.superclass;
_XfeResolve(cc,sc,xfe_caption_class,activate,XfeInheritCaptionActivate);
}
/*----------------------------------------------------------------------*/
static void
Initialize(Widget rw,Widget nw,ArgList args,Cardinal *nargs)
{
XfeCaptionPart * pp = _XfeCaptionPart(nw);
/* Create private components */
pp->title = TitleCreate(nw);
/* Initialize private members */
/* Add extra caption translations */
XfeOverrideTranslations(nw,_XfeCaptionExtraTranslations);
/* Finish of initialization */
_XfeManagerChainInitialize(rw,nw,xfeCaptionWidgetClass);
}
/*----------------------------------------------------------------------*/
static void
Destroy(Widget w)
{
/* XfeCaptionPart * pp = _XfeCaptionPart(w); */
}
/*----------------------------------------------------------------------*/
static Boolean
SetValues(Widget ow,Widget rw,Widget nw,ArgList args,Cardinal *nargs)
{
/* XfeCaptionPart * np = _XfeCaptionPart(nw); */
/* XfeCaptionPart * op = _XfeCaptionPart(ow); */
/* shadow_thickness */
if (_XfemShadowThickness(nw) != _XfemShadowThickness(ow))
{
_XfemConfigFlags(nw) |= XfeConfigLE;
}
return _XfeManagerChainSetValues(ow,rw,nw,xfeCaptionWidgetClass);
}
/*----------------------------------------------------------------------*/
static void
GetValuesHook(Widget w,ArgList args,Cardinal* nargs)
{
/* XfeCaptionPart * pp = _XfeCaptionPart(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)
{
XfeCaptionPart * pp = _XfeCaptionPart(w);
*width = _XfemOffsetLeft(w) + _XfemOffsetRight(w);
*height = _XfemOffsetTop(w) + _XfemOffsetBottom(w);
/* Both */
if (_XfeChildIsShown(pp->title) && _XfeChildIsShown(pp->child))
{
if (pp->caption_layout == XmCAPTION_CHILD_ON_BOTTOM ||
pp->caption_layout == XmCAPTION_CHILD_ON_TOP)
{
*width += XfeMax(_XfeWidth(pp->title),_XfeWidth(pp->child));
*height +=
(_XfeHeight(pp->title) +
pp->spacing +
_XfeHeight(pp->child));
}
else if (pp->caption_layout == XmCAPTION_CHILD_ON_LEFT ||
pp->caption_layout == XmCAPTION_CHILD_ON_RIGHT)
{
*width +=
(_XfeWidth(pp->title) +
pp->spacing +
_XfeWidth(pp->child));
*height += XfeMax(_XfeHeight(pp->title),_XfeHeight(pp->child));
}
#ifdef DEBUG_ramiro
else
{
assert( 0 );
}
#endif
}
/* Title only */
else if (_XfeChildIsShown(pp->title))
{
*width += _XfeWidth(pp->title);
*height += _XfeHeight(pp->title);
}
/* Child only */
else if (_XfeChildIsShown(pp->child))
{
*width += _XfeWidth(pp->child);
*height += _XfeHeight(pp->child);
}
}
/*----------------------------------------------------------------------*/
static Boolean
AcceptChild(Widget child)
{
return True;
}
/*----------------------------------------------------------------------*/
static Boolean
InsertChild(Widget child)
{
/* Widget w = XtParent(child); */
/* XfeCaptionPart * pp = _XfeCaptionPart(w); */
return True;
}
/*----------------------------------------------------------------------*/
static Boolean
DeleteChild(Widget child)
{
/* Widget w = XtParent(child); */
/* XfeCaptionPart * pp = _XfeCaptionPart(w); */
return True;
}
/*----------------------------------------------------------------------*/
static void
ChangeManaged(Widget w)
{
/* XfeCaptionPart * pp = _XfeCaptionPart(w); */
}
/*----------------------------------------------------------------------*/
static void
PrepareComponents(Widget w,int flags)
{
/* XfeCaptionPart * pp = _XfeCaptionPart(w); */
/* if (flags & _XFE_PREPARE_CLOSE_PIXMAP_MASK) */
/* { */
/* } */
}
/*----------------------------------------------------------------------*/
static void
LayoutComponents(Widget w)
{
XfeCaptionPart * pp = _XfeCaptionPart(w);
/* Both */
if (_XfeChildIsShown(pp->title) && _XfeChildIsShown(pp->child))
{
if (pp->caption_layout == XmCAPTION_CHILD_ON_BOTTOM)
{
LayoutChildOnBottom(w);
}
else if (pp->caption_layout == XmCAPTION_CHILD_ON_LEFT)
{
LayoutChildOnLeft(w);
}
else if (pp->caption_layout == XmCAPTION_CHILD_ON_RIGHT)
{
LayoutChildOnRight(w);
}
else if (pp->caption_layout == XmCAPTION_CHILD_ON_TOP)
{
LayoutChildOnTop(w);
}
}
/* Title only */
else if (_XfeChildIsShown(pp->title))
{
LayoutTitleOnly(w);
}
/* Child only */
else if (_XfeChildIsShown(pp->child))
{
LayoutChildOnly(w);
}
}
/*----------------------------------------------------------------------*/
static void
DrawComponents(Widget w,XEvent * event,Region region,XRectangle * clip_rect)
{
/* XfeCaptionPart * pp = _XfeCaptionPart(w); */
}
/*----------------------------------------------------------------------*/
/*----------------------------------------------------------------------*/
/* */
/* XfeCaption action procedures */
/* */
/*----------------------------------------------------------------------*/
static void
Activate(Widget w,XEvent * event,char ** params,Cardinal * nparams)
{
_XfeCaptionActivate(w);
}
/*----------------------------------------------------------------------*/
/*----------------------------------------------------------------------*/
/* */
/* Title functions */
/* */
/*----------------------------------------------------------------------*/
static Widget
TitleCreate(Widget w)
{
XfeCaptionPart * pp = _XfeCaptionPart(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],XmNalignment, pp->title_alignment); ac++; */
XtSetArg(av[ac],XmNshadowThickness, 0); ac++;
XtSetArg(av[ac],XmNstringDirection, pp->title_direction); ac++;
XtSetArg(av[ac],XmNraiseBorderThickness, 0); ac++;
XtSetArg(av[ac],XmNraiseOnEnter, False); ac++;
XtSetArg(av[ac],XmNfillOnArm, False); ac++;
XtSetArg(av[ac],XmNarmOffset, 0); ac++;
if (pp->title_font_list != NULL)
{
XtSetArg(av[ac],XmNfontList, pp->title_font_list); ac++;
}
if (pp->title_string != NULL)
{
XtSetArg(av[ac],XmNlabelString, pp->title_string); ac++;
}
title = XtCreateManagedWidget(TITLE_NAME,
xfeButtonWidgetClass,
w,
av,
ac);
XtAddCallback(title,XmNactivateCallback,TitleActivateCB,w);
return title;
}
/*----------------------------------------------------------------------*/
/*----------------------------------------------------------------------*/
/* */
/* Title callbacks */
/* */
/*----------------------------------------------------------------------*/
static void
TitleActivateCB(Widget title,XtPointer client_data,XtPointer call_data)
{
Widget w = (Widget) client_data;
_XfeCaptionActivate(w);
}
/*----------------------------------------------------------------------*/
/*----------------------------------------------------------------------*/
/* */
/* Layout functions */
/* */
/*----------------------------------------------------------------------*/
static void
LayoutChildOnBottom(Widget w)
{
XfeCaptionPart * pp = _XfeCaptionPart(w);
assert( _XfeChildIsShown(pp->title) );
assert( _XfeChildIsShown(pp->child) );
}
/*----------------------------------------------------------------------*/
static void
LayoutChildOnLeft(Widget w)
{
XfeCaptionPart * pp = _XfeCaptionPart(w);
assert( _XfeChildIsShown(pp->title) );
assert( _XfeChildIsShown(pp->child) );
}
/*----------------------------------------------------------------------*/
static void
LayoutChildOnRight(Widget w)
{
XfeCaptionPart * pp = _XfeCaptionPart(w);
int title_x;
int title_y;
int child_x;
int child_y;
int child_width;
int child_height;
assert( _XfeChildIsShown(pp->title) );
assert( _XfeChildIsShown(pp->child) );
if (pp->child_resize)
{
child_width =
_XfemRectWidth(w) -
_XfeWidth(pp->title) -
pp->spacing;
/* child_width = XfeMax(_XfeWidth(pp->child),child_width); */
}
else
{
child_width = _XfeWidth(pp->child);
}
if (child_width > pp->max_child_width)
{
child_width = pp->max_child_width;
}
child_height = _XfeHeight(pp->child);
/* Child x */
if (pp->child_hor_alignment == XmCAPTION_HORIZONTAL_ALIGNMENT_LEFT)
{
child_x =
_XfeWidth(w) -
_XfemOffsetRight(w) -
child_width;
}
else if (pp->child_hor_alignment == XmCAPTION_HORIZONTAL_ALIGNMENT_CENTER)
{
child_x =
_XfeWidth(w) -
_XfemOffsetRight(w) -
child_width;
}
else if (pp->child_hor_alignment == XmCAPTION_HORIZONTAL_ALIGNMENT_RIGHT)
{
child_x =
_XfeWidth(w) -
_XfemOffsetRight(w) -
child_width;
}
/* Child y */
if (pp->child_ver_alignment == XmCAPTION_VERTICAL_ALIGNMENT_TOP)
{
child_y = _XfemOffsetTop(w);
}
else if (pp->child_ver_alignment == XmCAPTION_VERTICAL_ALIGNMENT_CENTER)
{
child_y = (_XfeHeight(w) - child_height) / 2;
}
else if (pp->child_ver_alignment == XmCAPTION_VERTICAL_ALIGNMENT_BOTTOM)
{
child_y = _XfeHeight(w) - _XfemOffsetBottom(w) - child_height;
}
/* Title x */
if (pp->title_hor_alignment == XmCAPTION_HORIZONTAL_ALIGNMENT_LEFT)
{
title_x = _XfemOffsetLeft(w);
}
else if (pp->title_hor_alignment == XmCAPTION_HORIZONTAL_ALIGNMENT_CENTER)
{
title_x = _XfemOffsetLeft(w);
}
else if (pp->title_hor_alignment == XmCAPTION_HORIZONTAL_ALIGNMENT_RIGHT)
{
title_x = _XfemOffsetLeft(w);
}
/* Title y */
if (pp->title_ver_alignment == XmCAPTION_VERTICAL_ALIGNMENT_TOP)
{
title_y = _XfemOffsetTop(w);
}
else if (pp->title_ver_alignment == XmCAPTION_VERTICAL_ALIGNMENT_CENTER)
{
title_y = (_XfeHeight(w) - _XfeHeight(pp->title)) / 2;
}
else if (pp->title_ver_alignment == XmCAPTION_VERTICAL_ALIGNMENT_BOTTOM)
{
title_y = _XfeHeight(w) - _XfemOffsetBottom(w) - _XfeHeight(pp->title);
}
_XfeMoveWidget(pp->title,title_x,title_y);
/* _XfeMoveWidget(pp->child,child_x,child_y); */
_XfeConfigureWidget(pp->child,child_x,child_y,child_width,child_height);
}
/*----------------------------------------------------------------------*/
static void
LayoutChildOnTop(Widget w)
{
XfeCaptionPart * pp = _XfeCaptionPart(w);
assert( _XfeChildIsShown(pp->title) );
assert( _XfeChildIsShown(pp->child) );
}
/*----------------------------------------------------------------------*/
static void
LayoutTitleOnly (Widget w)
{
XfeCaptionPart * pp = _XfeCaptionPart(w);
assert( _XfeChildIsShown(pp->title) );
printf("LayoutChildTitleOnly(%s)\n",XtName(w));
}
/*----------------------------------------------------------------------*/
static void
LayoutChildOnly (Widget w)
{
XfeCaptionPart * pp = _XfeCaptionPart(w);
assert( _XfeChildIsShown(pp->child) );
}
/*----------------------------------------------------------------------*/
/*----------------------------------------------------------------------*/
/* */
/* RepType registration functions */
/* */
/*----------------------------------------------------------------------*/
static void
RegisterCaptionLayout(void)
{
static String names[] =
{
"caption_child_on_bottom",
"caption_child_on_left",
"caption_child_on_right",
"caption_child_on_top"
};
XmRepTypeRegister(XmRCaptionLayout,names,NULL,XtNumber(names));
}
/*----------------------------------------------------------------------*/
static void
RegisterCaptionHorizontalAlignment(void)
{
static String names[] =
{
"caption_vertical_alignment_left",
"caption_vertical_alignment_center",
"caption_vertical_alignment_right"
};
XmRepTypeRegister(XmRCaptionVerticalAlignment,names,NULL,XtNumber(names));
}
/*----------------------------------------------------------------------*/
static void
RegisterCaptionVerticalAlignment(void)
{
static String names[] =
{
"caption_vertical_alignment_bottom",
"caption_vertical_alignment_center",
"caption_vertical_alignment_top"
};
XmRepTypeRegister(XmRCaptionVerticalAlignment,names,NULL,XtNumber(names));
}
/*----------------------------------------------------------------------*/
/*----------------------------------------------------------------------*/
/* */
/* Misc functions */
/* */
/*----------------------------------------------------------------------*/
/*----------------------------------------------------------------------*/
/* */
/* XfeCaption method invocation functions */
/* */
/*----------------------------------------------------------------------*/
/* extern */ void
_XfeCaptionActivate(Widget w)
{
XfeCaptionWidgetClass mc = (XfeCaptionWidgetClass) XtClass(w);
if (mc->xfe_caption_class.activate)
{
(*mc->xfe_caption_class.activate)(w);
}
}
/*----------------------------------------------------------------------*/
/*----------------------------------------------------------------------*/
/* */
/* XfeCaption Public Methods */
/* */
/*----------------------------------------------------------------------*/
/* extern */ Widget
XfeCreateCaption(Widget pw,char * name,Arg * av,Cardinal ac)
{
return XtCreateWidget(name,xfeCaptionWidgetClass,pw,av,ac);
}
/*----------------------------------------------------------------------*/
extern Dimension
XfeCaptionMaxChildWidth(Widget w)
{
XfeCaptionPart * pp = _XfeCaptionPart(w);
Dimension max_child_width = 0;
assert( _XfeIsAlive(w) );
/* Both */
if (_XfeChildIsShown(pp->title) && _XfeChildIsShown(pp->child))
{
if (pp->caption_layout == XmCAPTION_CHILD_ON_BOTTOM ||
pp->caption_layout == XmCAPTION_CHILD_ON_TOP)
{
max_child_width = _XfemRectWidth(w);
}
else if (pp->caption_layout == XmCAPTION_CHILD_ON_LEFT ||
pp->caption_layout == XmCAPTION_CHILD_ON_RIGHT)
{
max_child_width =
_XfemRectWidth(w) -
_XfeWidth(pp->title) -
pp->spacing;
}
}
/* Title only */
else if (_XfeChildIsShown(pp->title))
{
max_child_width = 0;
}
/* Child only */
else if (_XfeChildIsShown(pp->child))
{
max_child_width = _XfemRectWidth(w);
}
return max_child_width;
}
/*----------------------------------------------------------------------*/

View File

@ -0,0 +1,122 @@
/* -*- 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/Caption.h> */
/* Description: XfeCaption widget public header file. */
/* Author: Ramiro Estrugo <ramiro@netscape.com> */
/* */
/*----------------------------------------------------------------------*/
#ifndef _XfeCaption_h_ /* start Caption.h */
#define _XfeCaption_h_
#include <Xfe/Manager.h>
#include <Xfe/CaptionStringDefs.h>
XFE_BEGIN_CPLUSPLUS_PROTECTION
/*----------------------------------------------------------------------*/
/* */
/* XmRCaptionLayout */
/* */
/*----------------------------------------------------------------------*/
enum
{
XmCAPTION_CHILD_ON_BOTTOM,
XmCAPTION_CHILD_ON_LEFT,
XmCAPTION_CHILD_ON_RIGHT,
XmCAPTION_CHILD_ON_TOP
};
/*----------------------------------------------------------------------*/
/*----------------------------------------------------------------------*/
/* */
/* XmRHorizontalAlignment */
/* */
/*----------------------------------------------------------------------*/
enum
{
XmCAPTION_HORIZONTAL_ALIGNMENT_LEFT,
XmCAPTION_HORIZONTAL_ALIGNMENT_CENTER,
XmCAPTION_HORIZONTAL_ALIGNMENT_RIGHT
};
/*----------------------------------------------------------------------*/
/*----------------------------------------------------------------------*/
/* */
/* XmRVerticalAlignment */
/* */
/*----------------------------------------------------------------------*/
enum
{
XmCAPTION_VERTICAL_ALIGNMENT_BOTTOM,
XmCAPTION_VERTICAL_ALIGNMENT_CENTER,
XmCAPTION_VERTICAL_ALIGNMENT_TOP
};
/*----------------------------------------------------------------------*/
/*----------------------------------------------------------------------*/
/* */
/* Caption max dimensions callback structure */
/* */
/*----------------------------------------------------------------------*/
typedef struct
{
int reason; /* Reason why CB was invoked */
XEvent * event; /* Event that triggered CB */
Dimension max_child_width; /* Max child width */
Dimension max_child_height; /* Max child height */
} XfeCaptionMaxDimensionsCallbackStruct;
/*----------------------------------------------------------------------*/
/* */
/* XfeBox class names */
/* */
/*----------------------------------------------------------------------*/
externalref WidgetClass xfeCaptionWidgetClass;
typedef struct _XfeCaptionClassRec * XfeCaptionWidgetClass;
typedef struct _XfeCaptionRec * XfeCaptionWidget;
/*----------------------------------------------------------------------*/
/* */
/* XfeBox subclass test macro */
/* */
/*----------------------------------------------------------------------*/
#define XfeIsCaption(w) XtIsSubclass(w,xfeCaptionWidgetClass)
/*----------------------------------------------------------------------*/
/* */
/* XfeCaption public methods */
/* */
/*----------------------------------------------------------------------*/
extern Widget
XfeCreateCaption (Widget pw,
String name,
Arg * av,
Cardinal ac);
/*----------------------------------------------------------------------*/
extern Dimension
XfeCaptionMaxChildWidth (Widget w);
/*----------------------------------------------------------------------*/
XFE_END_CPLUSPLUS_PROTECTION
#endif /* end Caption.h */

View File

@ -0,0 +1,138 @@
/* -*- 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/CaptionP.h> */
/* Description: XfeCaption widget private header file. */
/* Author: Ramiro Estrugo <ramiro@netscape.com> */
/* */
/*----------------------------------------------------------------------*/
#ifndef _XfeCaptionP_h_ /* start CaptionP.h */
#define _XfeCaptionP_h_
#include <Xfe/Caption.h>
#include <Xfe/ManagerP.h>
XFE_BEGIN_CPLUSPLUS_PROTECTION
/*----------------------------------------------------------------------*/
/* */
/* XfeCaption Widget method inheritance macros */
/* */
/*----------------------------------------------------------------------*/
#define XfeInheritCaptionActivate ((XtWidgetProc) _XtInherit)
/*----------------------------------------------------------------------*/
/* */
/* XfeCaptionClassPart */
/* */
/*----------------------------------------------------------------------*/
typedef struct
{
XtWidgetProc activate; /* activate */
XtPointer extension; /* extension */
} XfeCaptionClassPart;
/*----------------------------------------------------------------------*/
/* */
/* XfeCaptionClassRec */
/* */
/*----------------------------------------------------------------------*/
typedef struct _XfeCaptionClassRec
{
CoreClassPart core_class;
CompositeClassPart composite_class;
ConstraintClassPart constraint_class;
XmManagerClassPart manager_class;
XfeManagerClassPart xfe_manager_class;
XfeCaptionClassPart xfe_caption_class;
} XfeCaptionClassRec;
externalref XfeCaptionClassRec xfeCaptionClassRec;
/*----------------------------------------------------------------------*/
/* */
/* XfeCaptionPart */
/* */
/*----------------------------------------------------------------------*/
typedef struct _XfeCaptionPart
{
/* Layout resources */
unsigned char caption_layout; /* Caption layout */
Dimension spacing; /* Spacing */
/* Title resources */
Widget title; /* Title */
unsigned char title_hor_alignment; /* Title hor alignment */
unsigned char title_ver_alignment; /* Title ver alignment */
unsigned char title_direction; /* Title direction */
XmFontList title_font_list; /* Title font list */
XmString title_string; /* Title string */
/* Child resources */
Widget child; /* Child */
unsigned char child_hor_alignment; /* Child hor alignment */
unsigned char child_ver_alignment; /* Child ver alignment */
Boolean child_resize; /* Child Resize */
/* Dimension resources */
unsigned char max_child_method; /* Max child method */
Dimension max_child_width; /* Max child width */
Dimension max_child_height; /* Max child height */
/* Private data -- Dont even look past this comment -- */
} XfeCaptionPart;
/*----------------------------------------------------------------------*/
/* */
/* XfeCaptionRec */
/* */
/*----------------------------------------------------------------------*/
typedef struct _XfeCaptionRec
{
CorePart core;
CompositePart composite;
ConstraintPart constraint;
XmManagerPart manager;
XfeManagerPart xfe_manager;
XfeCaptionPart xfe_caption;
} XfeCaptionRec;
/*----------------------------------------------------------------------*/
/* */
/* XfeCaptionPart Access Macro */
/* */
/*----------------------------------------------------------------------*/
#define _XfeCaptionPart(w) &(((XfeCaptionWidget) w) -> xfe_caption)
/*----------------------------------------------------------------------*/
/* */
/* XfeCaption Method invocation functions */
/* */
/*----------------------------------------------------------------------*/
extern void
_XfeCaptionActivate (Widget w);
/*----------------------------------------------------------------------*/
XFE_END_CPLUSPLUS_PROTECTION
#endif /* end CaptionP.h */

View File

@ -0,0 +1,73 @@
/* -*- 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/CaptionStringDefs.h> */
/* Description: XfeCaption string definitions. */
/* Author: Ramiro Estrugo <ramiro@netscape.com> */
/* */
/*----------------------------------------------------------------------*/
#ifndef _XfeCaptionStringDefs_h_ /* start CaptionStringDefs.h*/
#define _XfeCaptionStringDefs_h_
/*----------------------------------------------------------------------*/
/* */
/* Callback Names */
/* */
/*----------------------------------------------------------------------*/
/*----------------------------------------------------------------------*/
/* */
/* Resource Names */
/* */
/*----------------------------------------------------------------------*/
#define XmNcaptionLayout "captionLayout"
#define XmNchild "child"
#define XmNchildResize "childResize"
#define XmNmaxChildHeight "maxChildHeight"
#define XmNmaxChildWidth "maxChildWidth"
#define XmNtitleDirection "titleDirection"
#define XmNtitleHorizontalAlignment "TitleHorizontalAlignment"
#define XmNtitleVerticalAlignment "TitleVerticalAlignment"
/*----------------------------------------------------------------------*/
/* */
/* Class Names */
/* */
/*----------------------------------------------------------------------*/
#define XmCCaptionHorizontalAlignment "CaptionHorizontalAlignment"
#define XmCCaptionLayout "CaptionLayout"
#define XmCCaptionVerticalAlignment "CaptionVerticalAlignment"
#define XmCChild "Child"
#define XmCChildResize "ChildResize"
#define XmCMaxChildHeight "MaxChildHeight"
#define XmCMaxChildWidth "MaxChildWidth"
#define XmCTitleDirection "TitleDirection"
/*----------------------------------------------------------------------*/
/* */
/* Representation Types */
/* */
/*----------------------------------------------------------------------*/
#define XmRCaptionHorizontalAlignment "CaptionHorizontalAlignment"
#define XmRCaptionLayout "CaptionLayout"
#define XmRCaptionVerticalAlignment "CaptionVerticalAlignment"
#endif /* end CaptionStringDefs.h */

View File

@ -0,0 +1,55 @@
#!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 XfeCaption library
# Author: Ramiro Estrugo <ramiro@netscape.com>
#
##########################################################################
DEPTH = ../../../..
# XfeWidgets headers are exported to dist/public/XfeCaption/Xfe. We use
# the 'Xfe' directory to avoid the hasstle of having to remember yet another
# include prefix.
MODULE = XfeCaption/Xfe
LIBRARY_NAME = XfeCaption
CSRCS = \
Caption.c \
TextCaption.c \
$(NULL)
REQUIRES = \
XfeCaption \
XfeWidgets
EXPORTS = \
Caption.h \
CaptionP.h \
TextCaption.h \
TextCaptionP.h \
CaptionStringDefs.h \
$(NULL)
include $(DEPTH)/config/rules.mk

View File

@ -0,0 +1,359 @@
/* -*- 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/TextCaption.c> */
/* Description: XfeTextCaption widget source. */
/* Author: Ramiro Estrugo <ramiro@netscape.com> */
/* */
/*----------------------------------------------------------------------*/
#include <Xfe/TextCaptionP.h>
#include <Xm/TextF.h>
#define MESSAGE1 "Widget is not an XfeTextCaption."
#define MESSAGE2 "XmNtitleDirection is not XmSTRING_DIRECTION_L_TO_R or XmSTRING_DIRECTION_R_TO_L."
#define TEXT_NAME "CaptionText"
#define DEFAULT_SUB_TITLE_NAME "TextCaptionSubTitle"
/*----------------------------------------------------------------------*/
/* */
/* 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 */
/* */
/*----------------------------------------------------------------------*/
/*----------------------------------------------------------------------*/
/* */
/* XfeCaption class methods */
/* */
/*----------------------------------------------------------------------*/
static void Activate (Widget);
/*----------------------------------------------------------------------*/
/* */
/* Text functions */
/* */
/*----------------------------------------------------------------------*/
static Widget TextCreate (Widget);
/*----------------------------------------------------------------------*/
/* */
/* XfeCaption resources */
/* */
/*----------------------------------------------------------------------*/
static XtResource resources[] =
{
/* Text resources */
{
XmNtextFontList,
XmCTextFontList,
XmRFontList,
sizeof(XmFontList),
XtOffsetOf(XfeTextCaptionRec , xfe_text_caption . text_font_list),
XmRCallProc,
(XtPointer) _XfeCallProcDefaultLabelFontList
},
{
XmNtextString,
XmCTextString,
XmRXmString,
sizeof(XmString),
XtOffsetOf(XfeTextCaptionRec , xfe_text_caption . text_string),
XmRImmediate,
(XtPointer) NULL
},
};
#if 0
/*----------------------------------------------------------------------*/
/* */
/* XfeCaption synthetic resources */
/* */
/*----------------------------------------------------------------------*/
static XmSyntheticResource synthetic_resources[] =
{
{
XmNtitleSpacing,
sizeof(Dimension),
XtOffsetOf(XfeTextCaptionRec , xfe_text_caption . title_spacing),
_XmFromHorizontalPixels,
_XmToHorizontalPixels
},
};
#endif
/*----------------------------------------------------------------------*/
/* */
/* Widget Class Record Initialization */
/* */
/*----------------------------------------------------------------------*/
_XFE_WIDGET_CLASS_RECORD(textcaption,TextCaption) =
{
{
(WidgetClass) &xfeCaptionClassRec, /* superclass */
"XfeTextCaption", /* class_name */
sizeof(XfeTextCaptionRec), /* 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 */
#if 0
synthetic_resources, /* syn resources */
XtNumber(synthetic_resources), /* num syn_resources */
#else
NULL, /* syn resources */
0, /* num syn_resources */
#endif
NULL, /* syn_cont_resources */
0, /* num_syn_cont_resource*/
XmInheritParentProcess, /* parent_process */
NULL, /* extension */
},
/* XfeManager Part */
{
XfeInheritBitGravity, /* bit_gravity */
XfeInheritPreferredGeometry, /* preferred_geometry */
XfeInheritMinimumGeometry, /* minimum_geometry */
XfeInheritUpdateRect, /* update_rect */
XfeInheritAcceptChild, /* accept_child */
XfeInheritInsertChild, /* insert_child */
XfeInheritDeleteChild, /* delete_child */
NULL, /* change_managed */
NULL, /* prepare_components */
XfeInheritLayoutComponents, /* layout_components */
NULL, /* layout_children */
NULL, /* draw_background */
XfeInheritDrawShadow, /* draw_shadow */
XfeInheritDrawComponents, /* draw_components */
False, /* count_layable_children*/
NULL, /* child_is_layable */
NULL, /* extension */
},
/* XfeCaption Part */
{
Activate, /* activate */
NULL, /* extension */
},
/* XfeTextCaption Part */
{
NULL, /* extension */
},
};
/*----------------------------------------------------------------------*/
/* */
/* xfeTextCaptionWidgetClass declaration. */
/* */
/*----------------------------------------------------------------------*/
_XFE_WIDGET_CLASS(textcaption,TextCaption);
/*----------------------------------------------------------------------*/
/* */
/* Core Class methods */
/* */
/*----------------------------------------------------------------------*/
static void
Initialize(Widget rw,Widget nw,ArgList args,Cardinal *nargs)
{
XfeCaptionPart * pp = _XfeCaptionPart(nw);
/* XfeTextCaptionPart * tp = _XfeTextCaptionPart(nw); */
/* Create private components */
pp->child = TextCreate(nw);
/* Finish of initialization */
_XfeManagerChainInitialize(rw,nw,xfeTextCaptionWidgetClass);
}
/*----------------------------------------------------------------------*/
static void
Destroy(Widget w)
{
/* XfeCaptionPart * pp = _XfeCaptionPart(w); */
}
/*----------------------------------------------------------------------*/
static Boolean
SetValues(Widget ow,Widget rw,Widget nw,ArgList args,Cardinal *nargs)
{
/* XfeCaptionPart * np = _XfeCaptionPart(nw); */
/* XfeCaptionPart * op = _XfeCaptionPart(ow); */
/* shadow_thickness */
if (_XfemShadowThickness(nw) != _XfemShadowThickness(ow))
{
_XfemConfigFlags(nw) |= XfeConfigLE;
}
return _XfeManagerChainSetValues(ow,rw,nw,xfeTextCaptionWidgetClass);
}
/*----------------------------------------------------------------------*/
static void
GetValuesHook(Widget w,ArgList args,Cardinal* nargs)
{
/* XfeCaptionPart * pp = _XfeCaptionPart(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
}
}
/*----------------------------------------------------------------------*/
/*----------------------------------------------------------------------*/
/* */
/* XfeCaption class methods */
/* */
/*----------------------------------------------------------------------*/
static void
Activate(Widget w)
{
XfeCaptionPart * pp = _XfeCaptionPart(w);
/* Traverse to the child if its alive */
if (_XfeChildIsShown(pp->child))
{
XmProcessTraversal(pp->child,XmTRAVERSE_CURRENT);
}
}
/*----------------------------------------------------------------------*/
/*----------------------------------------------------------------------*/
/* */
/* Text functions */
/* */
/*----------------------------------------------------------------------*/
static Widget
TextCreate(Widget w)
{
XfeTextCaptionPart * tp = _XfeTextCaptionPart(w);
Widget text = NULL;
Arg av[20];
Cardinal ac = 0;
/* XtSetArg(av[ac],XmNbackground, tp->text_background); ac++; */
/* XtSetArg(av[ac],XmNforeground, tp->text_foreground); ac++; */
/* XtSetArg(av[ac],XmNshadowThickness, 0); ac++; */
/* XtSetArg(av[ac],XmNstringDirection, tp->text_direction); ac++; */
/* XtSetArg(av[ac],XmNalignment, tp->text_alignment); ac++; */
if (tp->text_font_list != NULL)
{
XtSetArg(av[ac],XmNfontList, tp->text_font_list); ac++;
}
text = XtCreateManagedWidget(TEXT_NAME,
xmTextFieldWidgetClass,
w,
av,
ac);
return text;
}
/*----------------------------------------------------------------------*/
/*----------------------------------------------------------------------*/
/* */
/* XfeCaption Public Methods */
/* */
/*----------------------------------------------------------------------*/
/* extern */ Widget
XfeCreateTextCaption(Widget pw,char * name,Arg * av,Cardinal ac)
{
return XtCreateWidget(name,xfeTextCaptionWidgetClass,pw,av,ac);
}
/*----------------------------------------------------------------------*/

View File

@ -0,0 +1,65 @@
/* -*- 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/TextCaption.h> */
/* Description: XfeTextCaption widget public header file. */
/* Author: Ramiro Estrugo <ramiro@netscape.com> */
/* */
/*----------------------------------------------------------------------*/
#ifndef _XfeTextCaption_h_ /* start TextCaption.h */
#define _XfeTextCaption_h_
#include <Xfe/Caption.h>
XFE_BEGIN_CPLUSPLUS_PROTECTION
/*----------------------------------------------------------------------*/
/* */
/* XfeTextCaption class names */
/* */
/*----------------------------------------------------------------------*/
externalref WidgetClass xfeTextCaptionWidgetClass;
typedef struct _XfeTextCaptionClassRec * XfeTextCaptionWidgetClass;
typedef struct _XfeTextCaptionRec * XfeTextCaptionWidget;
/*----------------------------------------------------------------------*/
/* */
/* XfeTextCaption subclass test macro */
/* */
/*----------------------------------------------------------------------*/
#define XfeIsTextCaption(w) XtIsSubclass(w,xfeTextCaptionWidgetClass)
/*----------------------------------------------------------------------*/
/* */
/* XfeTextCaption public methods */
/* */
/*----------------------------------------------------------------------*/
extern Widget
XfeCreateTextCaption (Widget pw,
String name,
Arg * av,
Cardinal ac);
/*----------------------------------------------------------------------*/
XFE_END_CPLUSPLUS_PROTECTION
#endif /* end Caption.h */

View File

@ -0,0 +1,104 @@
/* -*- 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/TextCaptionP.h> */
/* Description: XfeTextCaption widget private header file. */
/* Author: Ramiro Estrugo <ramiro@netscape.com> */
/* */
/*----------------------------------------------------------------------*/
#ifndef _XfeTextCaptionP_h_ /* start TextCaptionP.h */
#define _XfeTextCaptionP_h_
#include <Xfe/CaptionP.h>
#include <Xfe/TextCaption.h>
XFE_BEGIN_CPLUSPLUS_PROTECTION
/*----------------------------------------------------------------------*/
/* */
/* XfeTextCaptionClassPart */
/* */
/*----------------------------------------------------------------------*/
typedef struct
{
XtPointer extension; /* extension */
} XfeTextCaptionClassPart;
/*----------------------------------------------------------------------*/
/* */
/* XfeTextCaptionClassRec */
/* */
/*----------------------------------------------------------------------*/
typedef struct _XfeTextCaptionClassRec
{
CoreClassPart core_class;
CompositeClassPart composite_class;
ConstraintClassPart constraint_class;
XmManagerClassPart manager_class;
XfeManagerClassPart xfe_manager_class;
XfeCaptionClassPart xfe_caption_class;
XfeTextCaptionClassPart xfe_text_caption_class;
} XfeTextCaptionClassRec;
externalref XfeTextCaptionClassRec xfeTextCaptionClassRec;
/*----------------------------------------------------------------------*/
/* */
/* XfeTextCaptionPart */
/* */
/*----------------------------------------------------------------------*/
typedef struct _XfeTextCaptionPart
{
/* Text resources */
XmString text_string; /* Text string */
XmFontList text_font_list; /* Text font list */
/* Private data -- Dont even look past this comment -- */
} XfeTextCaptionPart;
/*----------------------------------------------------------------------*/
/* */
/* XfeTextCaptionRec */
/* */
/*----------------------------------------------------------------------*/
typedef struct _XfeTextCaptionRec
{
CorePart core;
CompositePart composite;
ConstraintPart constraint;
XmManagerPart manager;
XfeManagerPart xfe_manager;
XfeCaptionPart xfe_caption;
XfeTextCaptionPart xfe_text_caption;
} XfeTextCaptionRec;
/*----------------------------------------------------------------------*/
/* */
/* XfeTextCaptionPart Access Macro */
/* */
/*----------------------------------------------------------------------*/
#define _XfeTextCaptionPart(w) \
&(((XfeTextCaptionWidget) w) -> xfe_text_caption)
XFE_END_CPLUSPLUS_PROTECTION
#endif /* end TextCaptionP.h */

View File

@ -34,6 +34,7 @@
#include <Xm/TextF.h>
#include <Xm/List.h>
#include <Xm/RepType.h>
#include <Xfe/Button.h>
#include <Xfe/Arrow.h>

View File

@ -44,7 +44,6 @@
#define XmNshell "shell"
#define XmNtitleShadowThickness "titleShadowThickness"
#define XmNtitleShadowType "titleShadowType"
#define XmNtitleFontList "titleFontList"
/*----------------------------------------------------------------------*/
/* */
@ -52,7 +51,6 @@
/* */
/*----------------------------------------------------------------------*/
#define XmCListFontList "ListFontList"
#define XmCTitleFontList "TitleFontList"
#define XmCShareShell "ShareShell"
/*----------------------------------------------------------------------*/

View File

@ -0,0 +1,55 @@
#!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 XfeComboBox library
# Author: Ramiro Estrugo <ramiro@netscape.com>
#
##########################################################################
DEPTH = ../../../..
# XfeWidgets headers are exported to dist/public/XfeComboBox/Xfe. We use
# the 'Xfe' directory to avoid the hasstle of having to remember yet another
# include prefix.
MODULE = XfeComboBox/Xfe
LIBRARY_NAME = XfeComboBox
CSRCS = \
ComboBox.c \
FancyBox.c \
$(NULL)
REQUIRES = \
XfeComboBox \
XfeWidgets
EXPORTS = \
ComboBox.h \
ComboBoxP.h \
ComboBoxStringDefs.h \
FancyBox.h \
FancyBoxP.h \
$(NULL)
include $(DEPTH)/config/rules.mk

View File

@ -29,6 +29,7 @@ DEPTH = ../../../..
ifdef eXFE_WIDGETS_BUILD_UNUSED
UNUSED_DIRS = \
XfeComboBox \
XfeCaption \
$(NULL)
endif

View File

@ -1,102 +0,0 @@
! -*- 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.
ComboBoxTest*MainForm.width: 800
ComboBoxTest*MainForm.height: 400
ComboBoxTest*MainForm.background: Gray70
ComboBoxTest*MainForm.shadowThickness: 0
ComboBoxTest*MainForm.shadowType: shadow_in
ComboBoxTest*fontList: -*-helvetica-medium-r-*-*-*-140-*-*-*-*-iso8859-*
ComboBoxTest*foreground: Black
!ComboBoxTest*ComboBox*spacing: 0
ComboBoxTest*ComboBox1.usePreferredWidth: false
ComboBoxTest*ComboBox1.leftAttachment: attach_form
ComboBoxTest*ComboBox1.rightAttachment: attach_form
ComboBoxTest*ComboBox1.topAttachment: attach_form
ComboBoxTest*ComboBox1.bottomAttachment: attach_none
ComboBoxTest*ComboBox1.leftOffset: 5
ComboBoxTest*ComboBox1.rightOffset: 5
ComboBoxTest*ComboBox1.topOffset: 5
ComboBoxTest*ComboBox1.bottomOffset: 5
ComboBoxTest*ComboBox1.shadowThickness: 1
ComboBoxTest*ComboBox1*background: yellow
ComboBoxTest*ComboBox2.usePreferredWidth: false
ComboBoxTest*ComboBox2.leftAttachment: attach_form
ComboBoxTest*ComboBox2.rightAttachment: attach_form
ComboBoxTest*ComboBox2.topAttachment: attach_widget
ComboBoxTest*ComboBox2.bottomAttachment: attach_none
ComboBoxTest*ComboBox2.topWidget: ComboBox1
ComboBoxTest*ComboBox2.leftOffset: 5
ComboBoxTest*ComboBox2.rightOffset: 5
ComboBoxTest*ComboBox2.topOffset: 10
ComboBoxTest*ComboBox2.bottomOffset: 5
ComboBoxTest*ComboBox2.shadowThickness: 1
ComboBoxTest*ComboBox2*background: green
ComboBoxTest*ComboBox3.usePreferredWidth: false
ComboBoxTest*ComboBox3.leftAttachment: attach_form
ComboBoxTest*ComboBox3.rightAttachment: attach_form
ComboBoxTest*ComboBox3.topAttachment: attach_widget
ComboBoxTest*ComboBox3.bottomAttachment: attach_none
ComboBoxTest*ComboBox3.topWidget: ComboBox2
ComboBoxTest*ComboBox3.leftOffset: 5
ComboBoxTest*ComboBox3.rightOffset: 5
ComboBoxTest*ComboBox3.topOffset: 10
ComboBoxTest*ComboBox3.bottomOffset: 5
!ComboBoxTest*ComboBox3.background: Gray60
ComboBoxTest*ComboBox3*background: red
ComboBoxTest*ComboBox4.usePreferredWidth: false
ComboBoxTest*ComboBox4.leftAttachment: attach_form
ComboBoxTest*ComboBox4.rightAttachment: attach_form
ComboBoxTest*ComboBox4.topAttachment: attach_widget
ComboBoxTest*ComboBox4.bottomAttachment: attach_none
ComboBoxTest*ComboBox4.topWidget: ComboBox3
ComboBoxTest*ComboBox4.leftOffset: 5
ComboBoxTest*ComboBox4.rightOffset: 5
ComboBoxTest*ComboBox4.topOffset: 10
ComboBoxTest*ComboBox4.bottomOffset: 5
ComboBoxTest*ComboBox4*background: blue
!ComboBoxTest*XfeComboBox*background: Gray65
!ComboBoxTest*XmList*background: red
!ComboBoxTest*XfeBypassShell.shadowThickness: 10
!ComboBoxTest*XfeBypassShell.background: green
ComboBoxTest*ListSW.leftAttachment: attach_form
ComboBoxTest*ListSW.rightAttachment: attach_none
ComboBoxTest*ListSW.topAttachment: attach_widget
ComboBoxTest*ListSW.bottomAttachment: attach_none
ComboBoxTest*ListSW.topWidget: ComboBox3
ComboBoxTest*ListSW.leftOffset: 10
ComboBoxTest*ListSW.topOffset: 100
ComboBoxTest*List.visibleItemCount: 8
!ComboBoxTest*List.listMarginWidth: 5

View File

@ -1,242 +0,0 @@
/* -*- 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: ComboBoxTest.c */
/* Description: Test for XfeComboBox widget. */
/* Author: Ramiro Estrugo <ramiro@netscape.com> */
/* */
/*----------------------------------------------------------------------*/
#include <Xfe/XfeTest.h>
#include <Xfe/ListUtilP.h>
static void activate_callback (Widget,XtPointer,XtPointer);
static void arm_callback (Widget,XtPointer,XtPointer);
static void disarm_callback (Widget,XtPointer,XtPointer);
static void combo_add_items (Widget,String *,Cardinal);
static void list_add_items (Widget,String *,Cardinal);
static String items1[] =
{
"Item One",
"Item Two",
"Item Three",
"Item Four",
"Item Five",
"Item Six",
"Item Seven",
"Item Eight",
"Item Nine",
"Item Ten",
"Item Eleven",
"Item Twelve",
};
static String items2[] =
{
"Red",
"Green",
"Blue",
"Brown",
"Orange",
"Cyan",
"Magenta",
"Black",
"White",
"Yellow"
};
static String items3[] =
{
"North",
"South",
"East",
"West",
"South East",
"South West",
"North East",
"North West"
};
static String items4[] =
{
"January",
"February",
"March",
"April",
"May",
"June",
"July",
"August",
"September",
"October",
"November",
"December"
};
#define num_items1 XtNumber(items1)
#define num_items2 XtNumber(items2)
#define num_items3 XtNumber(items3)
#define num_items4 XtNumber(items4)
/*----------------------------------------------------------------------*/
int
main(int argc,char *argv[])
{
Widget form;
Widget frame;
Widget cb[4];
Widget icon;
Widget list;
XfeAppCreateSimple("ComboBoxTest",&argc,argv,"MainFrame",&frame,&form);
cb[0] = XtVaCreateManagedWidget("ComboBox1",
xfeComboBoxWidgetClass,
form,
XmNcomboBoxType,XmCOMBO_BOX_EDITABLE,
NULL);
cb[1] = XtVaCreateManagedWidget("ComboBox2",
xfeComboBoxWidgetClass,
form,
XmNcomboBoxType,XmCOMBO_BOX_READ_ONLY,
NULL);
cb[2] = XtVaCreateManagedWidget("ComboBox3",
xfeFancyBoxWidgetClass,
form,
XmNcomboBoxType,XmCOMBO_BOX_EDITABLE,
NULL);
cb[3] = XtVaCreateManagedWidget("ComboBox4",
xfeFancyBoxWidgetClass,
form,
XmNcomboBoxType,XmCOMBO_BOX_READ_ONLY,
NULL);
icon = XtVaCreateManagedWidget("IC",
xfeButtonWidgetClass,
cb[2],
XmNbackground, XfeBackground(cb[2]),
XmNforeground, XfeForeground(cb[2]),
NULL);
assert( XfeIsAlive(icon) );
XtVaSetValues(
icon,
XmNpixmap, XfeGetPixmap(icon,"proxy"),
XmNpixmapMask, XfeGetMask(icon,"proxy"),
XmNraisedPixmap, XfeGetPixmap(icon,"proxy_raised"),
XmNraisedPixmapMask, XfeGetMask(icon,"proxy_raised"),
XmNbuttonLayout, XmBUTTON_PIXMAP_ONLY,
XmNfillOnEnter, False,
XmNfillOnArm, False,
XmNraiseOnEnter, True,
XmNshadowThickness, 0,
XmNraiseBorderThickness, 0,
NULL);
list = XmCreateScrolledList(form,"List",NULL,0);
/* _XfeXmListAccess(list,BaseX) += 10; */
/* lw->list.BaseX = (Position )lw->list.margin_width + */
XtManageChild(list);
combo_add_items(cb[0],items1,num_items1);
combo_add_items(cb[1],items2,num_items2);
combo_add_items(cb[2],items3,num_items3);
combo_add_items(cb[3],items4,num_items4);
list_add_items(list,items1,num_items1);
XtPopup(frame,XtGrabNone);
XfeAppMainLoop();
return 0;
}
/*----------------------------------------------------------------------*/
static void
combo_add_items(Widget w,String * items,Cardinal n)
{
XmString * table = NULL;
Cardinal i;
assert( XfeIsAlive(w) );
assert( XfeIsComboBox(w) );
assert( items != NULL );
assert( n > 0 );
table = XfeGetXmStringTable(items,n);
for (i = 0; i < n; i++)
{
XfeComboBoxAddItem(w,table[i],0);
}
XfeFreeXmStringTable(table,n);
}
/*----------------------------------------------------------------------*/
static void
list_add_items(Widget w,String * items,Cardinal n)
{
XmString * table = NULL;
Cardinal i;
assert( XfeIsAlive(w) );
assert( XmIsList(w) );
assert( items != NULL );
assert( n > 0 );
table = XfeGetXmStringTable(items,n);
for (i = 0; i < n; i++)
{
XmListAddItem(w,table[i],0);
}
XfeFreeXmStringTable(table,n);
}
/*----------------------------------------------------------------------*/
static void
activate_callback(Widget w,XtPointer client_data,XtPointer call_data)
{
printf("Activate(%s)\n",XtName(w));
}
/*----------------------------------------------------------------------*/
static void
arm_callback(Widget w,XtPointer client_data,XtPointer call_data)
{
printf("Arm(%s)\n",XtName(w));
}
/*----------------------------------------------------------------------*/
static void
disarm_callback(Widget w,XtPointer client_data,XtPointer call_data)
{
printf("Disarm(%s)\n",XtName(w));
}
/*----------------------------------------------------------------------*/

View File

@ -28,7 +28,6 @@ DEPTH = ../../../../..
ifdef XFE_WIDGETS_BUILD_UNUSED
UNUSED_CSRCS = \
ChromeTest.c \
ComboBoxTest.c \
FontChooserTest.c \
FrameShellTest.c \
$(NULL)

View File

@ -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.
CaptionTest*MainForm.width: 800
CaptionTest*MainForm.height: 400
CaptionTest*MainForm.background: Gray60
CaptionTest*MainForm.shadowThickness: 0
CaptionTest*MainForm.shadowType: shadow_in
CaptionTest*fontList: -*-helvetica-medium-r-*-*-*-120-*-*-*-*-iso8859-*
CaptionTest*labelFontList: -*-helvetica-medium-r-*-*-*-120-*-*-*-*-iso8859-*
CaptionTest*foreground: Black
CaptionTest*Caption.bottomAttachment: attach_form
CaptionTest*Caption.leftAttachment: attach_form
CaptionTest*Caption.rightAttachment: attach_form
CaptionTest*Caption.topAttachment: attach_form
CaptionTest*Caption.bottomOffset: 10
CaptionTest*Caption.leftOffset: 10
CaptionTest*Caption.rightOffset: 10
CaptionTest*Caption.topOffset: 10
CaptionTest*Caption*background: Gray60
CaptionTest*Caption.usePreferredWidth: false
CaptionTest*Caption.usePreferredHeight: false
CaptionTest*Caption.titleFontList: -*-helvetica-bold-r-*-*-*-120-*-*-*-*-iso8859-*
CaptionTest*Caption.subTitleFontList: -*-helvetica-medium-r-*-*-*-100-*-*-*-*-iso8859-*
!CaptionTest*Caption.titleDirection: string_direction_r_to_l
CaptionTest*Caption.titleAlignment: alignment_beginning
CaptionTest*Caption.subTitleAlignment: alignment_end
CaptionTest*Caption.frameThickness: 3
CaptionTest*Caption.frameType: shadow_etched_in
CaptionTest*Caption.titleWidgetName: Caca
CaptionTest*Caption.subTitleWidgetName: Vaca
!CaptionTest*Caption*Caca*background: red
!CaptionTest*CaptionselectBackground: #FFFFCC
!CaptionTest*Caption*selectForeground: Black
!CaptionTest*Caption.background: red

View File

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

View File

@ -0,0 +1,44 @@
#! 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 = \
CaptionTest.c \
TextCaptionTest.c \
$(NULL)
REQUIRES = \
XfeTest \
XfeCaption \
XfeBm \
XfeWidgets
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)

View File

@ -0,0 +1,80 @@
! -*- 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.
TextCaptionTest*MainForm.width: 800
TextCaptionTest*MainForm.height: 400
TextCaptionTest*MainForm.background: Gray60
TextCaptionTest*MainForm.shadowThickness: 0
TextCaptionTest*MainForm.shadowType: shadow_in
!TextCaptionTest*fontList: -*-helvetica-medium-r-*-*-*-120-*-*-*-*-iso8859-*
!TextCaptionTest*labelFontList: -*-helvetica-medium-r-*-*-*-120-*-*-*-*-iso8859-*
TextCaptionTest*foreground: Black
TextCaptionTest*titleFontList: -*-helvetica-medium-r-*-*-*-120-*-*-*-*-iso8859-*
TextCaptionTest*textFontList: -*-helvetica-bold-r-*-*-*-120-*-*-*-*-iso8859-*
TextCaptionTest*XfeTextCaption*background: CadetBlue
TextCaptionTest*XfeTextCaption*CaptionText.shadowThickness: 1
TextCaptionTest*XfeTextCaption.shadowThickness: 1
TextCaptionTest*XfeTextCaption.childResize: true
!TextCaptionTest*XfeTextCaption.maxChildWidth: 400
TextCaptionTest*XfeTextCaption.usePreferredWidth: false
TextCaptionTest*XfeTextCaption.usePreferredHeight: true
TextCaptionTest*Caption1.topAttachment: attach_form
TextCaptionTest*Caption1.bottomAttachment: attach_none
TextCaptionTest*Caption1.leftAttachment: attach_form
TextCaptionTest*Caption1.rightAttachment: attach_form
TextCaptionTest*Caption1.bottomOffset: 10
TextCaptionTest*Caption1.leftOffset: 10
TextCaptionTest*Caption1.rightOffset: 10
TextCaptionTest*Caption1.topOffset: 10
TextCaptionTest*Caption2.topAttachment: attach_widget
TextCaptionTest*Caption2.bottomAttachment: attach_none
TextCaptionTest*Caption2.leftAttachment: attach_form
TextCaptionTest*Caption2.rightAttachment: attach_form
TextCaptionTest*Caption2.topWidget: Caption1
TextCaptionTest*Caption2.bottomOffset: 10
TextCaptionTest*Caption2.leftOffset: 10
TextCaptionTest*Caption2.rightOffset: 10
TextCaptionTest*Caption2.topOffset: 10
TextCaptionTest*Caption3.topAttachment: attach_widget
TextCaptionTest*Caption3.bottomAttachment: attach_none
TextCaptionTest*Caption3.leftAttachment: attach_form
TextCaptionTest*Caption3.rightAttachment: attach_form
TextCaptionTest*Caption3.topWidget: Caption2
TextCaptionTest*Caption3.bottomOffset: 10
TextCaptionTest*Caption3.leftOffset: 10
TextCaptionTest*Caption3.rightOffset: 10
TextCaptionTest*Caption3.topOffset: 10
TextCaptionTest*Caption1.titleString: Phone Number:
TextCaptionTest*Caption2.titleString: Address:
TextCaptionTest*Caption3.titleString: Name:

View File

@ -0,0 +1,66 @@
/* -*- 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: TextCaptionTest.c */
/* Description: Test for XfeTextCaption widget. */
/* Author: Ramiro Estrugo <ramiro@netscape.com> */
/* */
/*----------------------------------------------------------------------*/
#include <Xfe/XfeTest.h>
#include <Xfe/TextCaption.h>
static Widget create_caption (Widget,String);
static Widget _captions[3];
/*----------------------------------------------------------------------*/
int
main(int argc,char *argv[])
{
Widget form;
Widget frame;
XfeAppCreateSimple("TextCaptionTest",&argc,argv,"MainFrame",&frame,&form);
_captions[0] = create_caption(form,"Caption1");
_captions[1] = create_caption(form,"Caption2");
_captions[2] = create_caption(form,"Caption3");
XtPopup(frame,XtGrabNone);
XfeAppMainLoop();
return 0;
}
/*----------------------------------------------------------------------*/
static Widget
create_caption(Widget pw,String name)
{
Widget caption;
caption = XtVaCreateManagedWidget(name,
xfeTextCaptionWidgetClass,
pw,
NULL);
return caption;
}
/*----------------------------------------------------------------------*/