Unbloat the XfeWidgets a little bit. Move the combo stuff to their own lib.

This commit is contained in:
ramiro%netscape.com 1998-07-31 10:22:09 +00:00
parent cdf487bf43
commit 9f5be51af3
22 changed files with 619 additions and 92 deletions

View File

@ -33,9 +33,16 @@ TEST_DIRS = \
$(NULL)
endif
ifdef eXFE_WIDGETS_BUILD_UNUSED
UNUSED_DIRS = \
XfeComboBox \
$(NULL)
endif
DIRS = \
Xfe \
XfeBm \
$(UNUSED_DIRS) \
$(TEST_DIRS)
include $(DEPTH)/config/rules.mk

View File

@ -31,10 +31,6 @@
#define XfeDEFAULT_ARM_OFFSET 0
#define XfeDEFAULT_BUFFER_TYPE XmBUFFER_NONE
#define XfeDEFAULT_CASCADE_DELAY 250
#define XfeDEFAULT_COMBO_BOX_LIST_MARGIN_HEIGHT 2
#define XfeDEFAULT_COMBO_BOX_LIST_MARGIN_WIDTH 2
#define XfeDEFAULT_COMBO_BOX_LIST_SPACING 2
#define XfeDEFAULT_COMBO_BOX_LIST_VISIBLE_ITEM_COUNT 10
#define XfeDEFAULT_CYLON_INTERVAL 100
#define XfeDEFAULT_EMULATE_MOTIF True
#define XfeDEFAULT_MAPPING_DELAY 250

View File

@ -58,16 +58,10 @@ ifdef XFE_WIDGETS_BUILD_UNUSED
XFE_EXTRA_DEFINES += -DXFE_WIDGETS_BUILD_UNUSED
UNUSED_CSRCS = \
ComboBox.c \
FancyBox.c \
FontChooser.c \
$(NULL)
UNUSED_EXPORTS = \
ComboBox.h \
ComboBoxP.h \
FancyBox.h \
FancyBoxP.h \
FontChooser.h \
FontChooserP.h \
$(NULL)

View File

@ -69,13 +69,6 @@
#define _XFE_PREPARE_TAB_TOP_RAISED_PIXMAP XfePrepare16
#define _XFE_PREPARE_TAB_VERTICAL_RAISED_PIXMAP XfePrepare17
/*----------------------------------------------------------------------*/
/* */
/* XfeComboBox - superclass = XfeManager */
/* */
/*----------------------------------------------------------------------*/
#define _XFE_PREPARE_ARROW XfePrepare1
/*----------------------------------------------------------------------*/
/* */
/* XfeToolBar - superclass = XfeOriented */

View File

@ -167,18 +167,6 @@ RegisterLocationType(void)
}
/*----------------------------------------------------------------------*/
static void
RegisterComboBoxType(void)
{
static String names[] =
{
"combo_box_editable",
"combo_box_read_only"
};
XmRepTypeRegister(XmRComboBoxType,names,NULL,XtNumber(names));
}
/*----------------------------------------------------------------------*/
static void
RegisterToolScrollArrowPlacement(void)
{
static String names[] =
@ -318,7 +306,6 @@ XfeRegisterRepresentationTypes(void)
RegisterButtonTrigger();
RegisterButtonType();
RegisterChromeChildType();
RegisterComboBoxType();
RegisterLocationType();
RegisterPaneChildAttachment();
RegisterPaneChildType();

View File

@ -27,7 +27,7 @@
#ifndef _XfeRepType_h_ /* start RepType.h */
#define _XfeRepType_h_
#include <Xm/Xm.h> /* Motif public defs */
#include <Xfe/BasicDefines.h>
XFE_BEGIN_CPLUSPLUS_PROTECTION

View File

@ -96,7 +96,6 @@
#define XmNarmed "armed"
#define XmNarmedPixmap "armedPixmap"
#define XmNarmedPixmapMask "armedPixmapMask"
#define XmNarrow "arrow"
#define XmNarrowDisplayPolicy "arrowDisplayPolicy"
#define XmNarrowHeight "arrowHeight"
#define XmNarrowPlacement "arrowPlacement"
@ -202,7 +201,6 @@
#define XmNleftRaisedPixmap "leftRaisedPixmap"
#define XmNleftView "leftView"
#define XmNlinkNode "linkNode"
#define XmNlistFontList "listFontList"
#define XmNlogo "logo"
#define XmNmanagedItemCount "managedItemCount"
#define XmNmatchSubMenuWidth "matchSubMenuWidth"
@ -260,8 +258,6 @@
#define XmNselectionColor "selectionColor"
#define XmNselectionModifiers "selectionModifiers"
#define XmNseparatorThickness "separatorThickness"
#define XmNshareShell "shareShell"
#define XmNshell "shell"
#define XmNshowActionButton "showActionButton"
#define XmNshowDockedTaskBar "showDockedTaskBar"
#define XmNshowLogo "showLogo"
@ -275,9 +271,6 @@
#define XmNtabOffset "TabOffset"
#define XmNtaskBar "taskBar"
#define XmNtaskBarDocked "taskBarDocked"
#define XmNtitleFontList "titleFontList"
#define XmNtitleShadowThickness "titleShadowThickness"
#define XmNtitleShadowType "titleShadowType"
#define XmNtoggleBehavior "toggleBehavior"
#define XmNtoolBar "toolBar"
#define XmNtoolBarPosition "toolBarPosition"
@ -407,7 +400,6 @@
#define XmCLeftPixmap "LeftPixmap"
#define XmCLeftRaisedPixmap "LeftRaisedPixmap"
#define XmCLinkNode "LinkNode"
#define XmCListFontList "ListFontList"
#define XmCMatchSubMenuWidth "MatchSubMenuWidth"
#define XmCMaxNumColumns "MaxNumColumns"
#define XmCMaxNumRows "MaxNumRows"
@ -449,7 +441,6 @@
#define XmCSelectionColor "SelectionColor"
#define XmCSelectionModifiers "SelectionModifiers"
#define XmCSeparatorThickness "SeparatorThickness"
#define XmCShareShell "ShareShell"
#define XmCShowActionButton "ShowActionButton"
#define XmCShowDockedTaskBar "ShowDockedTaskBar"
#define XmCShowLogo "ShowLogo"
@ -459,7 +450,6 @@
#define XmCSubMenuLocation "SubMenuLocation"
#define XmCSwapThreshold "SwapThreshold"
#define XmCTaskBarDocked "TaskBarDocked"
#define XmCTitleFontList "TitleFontList"
#define XmCToggleBehavior "ToggleBehavior"
#define XmCToolBarPosition "ToolBarPosition"
#define XmCToolBarSelectionPolicy "ToolBarSelectionPolicy"
@ -517,18 +507,6 @@
/*----------------------------------------------------------------------*/
#if XmVersion < 2000
#define XmNdragStartCallback "dragStartCallback"
#define XmNcomboBoxType "comboBoxType"
#define XmCComboBoxType "ComboBoxType"
#define XmRComboBoxType "ComboBoxType"
#endif
/*----------------------------------------------------------------------*/
/* */
/* Things that conflict elsewhere */
/* */
/*----------------------------------------------------------------------*/
#ifndef XmNlist
#define XmNlist "list"
#endif
#endif /* end StringDefs.h */

View File

@ -116,37 +116,6 @@ c<Btn1Down>: Focus()\n\
<Btn3Down>: Btn3Down()\n\
<Btn3Up>: Btn3Up()";
/*----------------------------------------------------------------------*/
/* */
/* XfeComboBox translations. */
/* */
/*----------------------------------------------------------------------*/
/* extern */ char _XfeComboBoxTextEditableTranslations[] ="\
~c s ~m ~a <Btn1Down>: extend-start()\n\
c ~s ~m ~a <Btn1Down>: move-destination()\n\
~c ~s ~m ~a <Btn1Down>: grab-focus()\n\
~c ~m ~a <Btn1Motion>: extend-adjust()\n\
~c ~m ~a <Btn1Up>: extend-end()";
/* extern */ char _XfeComboBoxTextReadOnlyTranslations[] ="\
~c ~s ~m ~a <Btn1Down>: grab-focus() Popup()\n\
~c ~m ~a <Btn1Motion>: \n\
~c ~m ~a <Btn1Up>: Popdown()";
#if 0
/* extern */ char _XfeComboBoxArrowTranslations[] ="\
~c ~s ~m ~a <Btn1Down>: Highlight() Arm() Popup()\n\
~c ~m ~a <Btn1Up>: Activate() Disarm() Popdown()";
#else
/* extern */ char _XfeComboBoxArrowTranslations[] ="\
~c ~s ~m ~a <Btn1Down>: Highlight() Arm() Popup()\n\
~c ~m ~a <Btn1Up>: Activate() Disarm() Popdown()";
#endif
/* extern */ char _XfeComboBoxExtraTranslations[] ="\
~c ~s ~m ~a <Btn1Down>: Highlight() Popup()\n\
~c ~m ~a <Btn1Up>: Popdown()";
/*----------------------------------------------------------------------*/
/* */
/* Translation / Action functions */

View File

@ -51,8 +51,6 @@
#if defined(XFE_WIDGETS_BUILD_UNUSED)
#include <Xfe/BypassShell.h>
#include <Xfe/ComboBox.h>
#include <Xfe/FancyBox.h>
#include <Xfe/FontChooser.h>
#endif /* XFE_WIDGETS_BUILD_UNUSED */

View File

@ -373,10 +373,6 @@ extern char _XfeButtonDefaultTranslations[];
extern char _XfeButtonMotionAddTranslations[];
extern char _XfeButtonMotionRemoveTranslations[];
extern char _XfeBypassShellDefaultTranslations[];
extern char _XfeComboBoxArrowTranslations[];
extern char _XfeComboBoxExtraTranslations[];
extern char _XfeComboBoxTextEditableTranslations[];
extern char _XfeComboBoxTextReadOnlyTranslations[];
extern char _XfeLabelDefaultTranslations[];
extern char _XfePrimitiveDefaultTranslations[];
extern char _XfeToolBarExtraTranslations[];

View File

@ -68,6 +68,7 @@
/* Core class methods */
/* */
/*----------------------------------------------------------------------*/
static void ClassInitialize (void);
static void ClassPartInit (WidgetClass);
static void Initialize (Widget,Widget,ArgList,Cardinal *);
static void Destroy (Widget);
@ -118,6 +119,12 @@ static Widget TitleLabelCreate (Widget);
static Widget ArrowCreate (Widget);
/*----------------------------------------------------------------------*/
/* */
/* Rep type registration functions */
/* */
/*----------------------------------------------------------------------*/
static void RegisterComboBoxType (void);
/*----------------------------------------------------------------------*/
/* */
@ -474,6 +481,37 @@ static XmSyntheticResource synthetic_resources[] =
},
};
/*----------------------------------------------------------------------*/
/* */
/* XfeComboBox translations. */
/* */
/*----------------------------------------------------------------------*/
/* extern */ char _XfeComboBoxTextEditableTranslations[] ="\
~c s ~m ~a <Btn1Down>: extend-start()\n\
c ~s ~m ~a <Btn1Down>: move-destination()\n\
~c ~s ~m ~a <Btn1Down>: grab-focus()\n\
~c ~m ~a <Btn1Motion>: extend-adjust()\n\
~c ~m ~a <Btn1Up>: extend-end()";
/* extern */ char _XfeComboBoxTextReadOnlyTranslations[] ="\
~c ~s ~m ~a <Btn1Down>: grab-focus() Popup()\n\
~c ~m ~a <Btn1Motion>: \n\
~c ~m ~a <Btn1Up>: Popdown()";
#if 0
/* extern */ char _XfeComboBoxArrowTranslations[] ="\
~c ~s ~m ~a <Btn1Down>: Highlight() Arm() Popup()\n\
~c ~m ~a <Btn1Up>: Activate() Disarm() Popdown()";
#else
/* extern */ char _XfeComboBoxArrowTranslations[] ="\
~c ~s ~m ~a <Btn1Down>: Highlight() Arm() Popup()\n\
~c ~m ~a <Btn1Up>: Activate() Disarm() Popdown()";
#endif
/* extern */ char _XfeComboBoxExtraTranslations[] ="\
~c ~s ~m ~a <Btn1Down>: Highlight() Popup()\n\
~c ~m ~a <Btn1Up>: Popdown()";
/*----------------------------------------------------------------------*/
/* */
/* XfeComboBox actions */
@ -497,7 +535,7 @@ _XFE_WIDGET_CLASS_RECORD(combobox,ComboBox) =
(WidgetClass) &xfeManagerClassRec, /* superclass */
"XfeComboBox", /* class_name */
sizeof(XfeComboBoxRec), /* widget_size */
NULL, /* class_initialize */
ClassInitialize, /* class_initialize */
ClassPartInit, /* class_part_initialize*/
FALSE, /* class_inited */
Initialize, /* initialize */
@ -644,6 +682,13 @@ SyntheticGetListItemCount(Widget w,int offset, XtArgVal * value)
/* */
/*----------------------------------------------------------------------*/
static void
ClassInitialize()
{
/* Register XfeComboBox Representation Types */
RegisterComboBoxType();
}
/*----------------------------------------------------------------------*/
static void
ClassPartInit(WidgetClass wc)
{
XfeComboBoxWidgetClass cc = (XfeComboBoxWidgetClass) wc;
@ -1168,6 +1213,24 @@ LayoutTitle(Widget w)
}
/*----------------------------------------------------------------------*/
/*----------------------------------------------------------------------*/
/* */
/* Rep type registration functions */
/* */
/*----------------------------------------------------------------------*/
static void
RegisterComboBoxType(void)
{
static String names[] =
{
"combo_box_editable",
"combo_box_read_only"
};
XmRepTypeRegister(XmRComboBoxType,names,NULL,XtNumber(names));
}
/*----------------------------------------------------------------------*/
/*----------------------------------------------------------------------*/
/* */
/* List functions */

View File

@ -28,9 +28,20 @@
#define _XfeComboBox_h_
#include <Xfe/Manager.h>
#include <Xfe/ComboBoxStringDefs.h>
XFE_BEGIN_CPLUSPLUS_PROTECTION
/*----------------------------------------------------------------------*/
/* */
/* XfeComboBox reasonable defaults for some resources */
/* */
/*----------------------------------------------------------------------*/
#define XfeDEFAULT_COMBO_BOX_LIST_MARGIN_HEIGHT 2
#define XfeDEFAULT_COMBO_BOX_LIST_MARGIN_WIDTH 2
#define XfeDEFAULT_COMBO_BOX_LIST_SPACING 2
#define XfeDEFAULT_COMBO_BOX_LIST_VISIBLE_ITEM_COUNT 10
/*----------------------------------------------------------------------*/
/* */
/* XmRComboBoxType */

View File

@ -158,6 +158,15 @@ _XfeComboBoxDrawTitleShadow (Widget w,
XRectangle * clip_rect);
/*----------------------------------------------------------------------*/
/*----------------------------------------------------------------------*/
/* */
/* XfeComboBox - superclass = XfeManager */
/* */
/* Component preparation macros. */
/* */
/*----------------------------------------------------------------------*/
#define _XFE_PREPARE_ARROW XfePrepare1
XFE_END_CPLUSPLUS_PROTECTION
#endif /* end ComboBoxP.h */

View File

@ -0,0 +1,79 @@
/* -*- 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/ComboBoxStringDefs.h> */
/* Description: XfeComboBox string definitions. */
/* Author: Ramiro Estrugo <ramiro@netscape.com> */
/* */
/*----------------------------------------------------------------------*/
#ifndef _XfeComboBoxStringDefs_h_ /* start ComboBoxStringDefs.h*/
#define _XfeComboBoxStringDefs_h_
/*----------------------------------------------------------------------*/
/* */
/* Callback Names */
/* */
/*----------------------------------------------------------------------*/
/*----------------------------------------------------------------------*/
/* */
/* Resource Names */
/* */
/*----------------------------------------------------------------------*/
#define XmNarrow "arrow"
#define XmNlistFontList "listFontList"
#define XmNshareShell "shareShell"
#define XmNshell "shell"
#define XmNtitleShadowThickness "titleShadowThickness"
#define XmNtitleShadowType "titleShadowType"
#define XmNtitleFontList "titleFontList"
/*----------------------------------------------------------------------*/
/* */
/* Class Names */
/* */
/*----------------------------------------------------------------------*/
#define XmCListFontList "ListFontList"
#define XmCTitleFontList "TitleFontList"
#define XmCShareShell "ShareShell"
/*----------------------------------------------------------------------*/
/* */
/* Things that conflict with Motif 2.x */
/* */
/*----------------------------------------------------------------------*/
#if XmVersion < 2000
#define XmNcomboBoxType "comboBoxType"
#define XmCComboBoxType "ComboBoxType"
#define XmRComboBoxType "ComboBoxType"
#endif
/*----------------------------------------------------------------------*/
/* */
/* Things that conflict elsewhere */
/* */
/*----------------------------------------------------------------------*/
#ifndef XmNlist
#define XmNlist "list"
#endif
#endif /* end ComboBoxStringDefs.h */

View File

@ -185,6 +185,57 @@ else
endif
##
## XfeCaption Library
##
XFE_STATIC_CAPTION_LIB = $(DIST)/lib/libXfeCaption.a
XFE_SHARED_CAPTION_LIB = $(DIST)/bin/libXfeCaption.$(DLL_SUFFIX)
XFE_CAPTION_REQUIRES = XfeCaption
##
## XfeCaption required ?
##
ifeq ($(filter $(REQUIRES),$(XFE_CAPTION_REQUIRES)),$(XFE_CAPTION_REQUIRES))
XFE_SHARED_LIBS += $(XFE_SHARED_CAPTION_LIB)
XFE_STATIC_LIBS += $(XFE_STATIC_CAPTION_LIB)
endif
##
## XfeComboBox Library
##
XFE_STATIC_COMBO_BOX_LIB = $(DIST)/lib/libXfeComboBox.a
XFE_SHARED_COMBO_BOX_LIB = $(DIST)/bin/libXfeComboBox.$(DLL_SUFFIX)
XFE_COMBO_BOX_REQUIRES = XfeComboBox
##
## XfeComboBox required ?
##
ifeq ($(filter $(REQUIRES),$(XFE_COMBO_BOX_REQUIRES)),$(XFE_COMBO_BOX_REQUIRES))
XFE_SHARED_LIBS += $(XFE_SHARED_COMBO_BOX_LIB)
XFE_STATIC_LIBS += $(XFE_STATIC_COMBO_BOX_LIB)
endif
##
## Xfe Pref Library
##
XFE_STATIC_PREF_LIB = $(DIST)/lib/libXfePref.a
XFE_SHARED_PREF_LIB = $(DIST)/bin/libXfePref.$(DLL_SUFFIX)
XFE_PREF_REQUIRES = XfePref
##
## XfePref required ?
##
ifeq ($(filter $(REQUIRES),$(XFE_PREF_REQUIRES)),$(XFE_PREF_REQUIRES))
XFE_SHARED_LIBS += $(XFE_SHARED_PREF_LIB)
XFE_STATIC_LIBS += $(XFE_STATIC_PREF_LIB)
endif
##
## XfeTest required ?
##

View File

@ -26,9 +26,16 @@
DEPTH = ../../../..
ifdef eXFE_WIDGETS_BUILD_UNUSED
UNUSED_DIRS = \
XfeComboBox \
$(NULL)
endif
DIRS = \
Xfe \
XfeBm \
XmL
XmL \
$(UNUSED_DIRS)
include $(DEPTH)/config/rules.mk

View File

@ -0,0 +1,102 @@
! -*- 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

@ -0,0 +1,244 @@
/* -*- 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/ComboBox.h>
#include <Xfe/FancyBox.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

@ -0,0 +1,43 @@
#! 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 = \
ComboBoxTest.c \
$(NULL)
REQUIRES = \
XfeTest \
XfeComboBox \
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)